#include "version.h"
+// Define the event types.
+
DEFINE_EVENT_TYPE(CE_UPDATECONTACTLIST);
DEFINE_EVENT_TYPE(CE_UPDATEACCOUNTLIST);
DEFINE_EVENT_TYPE(SE_UPDATECONTACTNOTIF);
DEFINE_EVENT_TYPE(RELOADCONTACTLIST);
DEFINE_EVENT_TYPE(REFRESHADDRESSBOOK);
+// Setup the event table using the event types.
+
BEGIN_EVENT_TABLE(frmMain, wxFrame)
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, frmMain::ConflictResolution)
EVT_COMMAND(wxID_ANY, CE_UPDATECONTACTLIST, frmMain::UpdateContactList)
frmMainADT( parent )
{
- // Setup the account icons.
+ // Setup the account icons.
- wxMemoryInputStream astream(icons_accinet_png, sizeof(icons_accinet_png));
- wxMemoryInputStream bstream(icons_acclocal_png, sizeof(icons_acclocal_png));
- wxMemoryInputStream cstream(icons_accgroup_png, sizeof(icons_accgroup_png));
- wxMemoryInputStream dstream(icons_accnone_png, sizeof(icons_accnone_png));
+ wxMemoryInputStream astream(icons_accinet_png, sizeof(icons_accinet_png));
+ wxMemoryInputStream bstream(icons_acclocal_png, sizeof(icons_acclocal_png));
+ wxMemoryInputStream cstream(icons_accgroup_png, sizeof(icons_accgroup_png));
+ wxMemoryInputStream dstream(icons_accnone_png, sizeof(icons_accnone_png));
- wxImage icons_accinet_png(astream, wxBITMAP_TYPE_PNG);
- wxBitmap AccInet(icons_accinet_png, -1);
- wxIcon wxIAccInet;
- wxIAccInet.CopyFromBitmap(AccInet);
+ wxImage icons_accinet_png(astream, wxBITMAP_TYPE_PNG);
+ wxBitmap AccInet(icons_accinet_png, -1);
+ wxIcon wxIAccInet;
+ wxIAccInet.CopyFromBitmap(AccInet);
- wxImage icons_acclocal_png(bstream, wxBITMAP_TYPE_PNG);
- wxBitmap AccNIcon(icons_acclocal_png, -1);
- wxIcon wxIAccNIcon;
- wxIAccNIcon.CopyFromBitmap(AccNIcon);
+ wxImage icons_acclocal_png(bstream, wxBITMAP_TYPE_PNG);
+ wxBitmap AccNIcon(icons_acclocal_png, -1);
+ wxIcon wxIAccNIcon;
+ wxIAccNIcon.CopyFromBitmap(AccNIcon);
- wxImage icons_accgroup_png(cstream, wxBITMAP_TYPE_PNG);
- wxBitmap AccGrp(icons_accgroup_png, -1);
- wxIcon wxIAccGrp;
- wxIAccGrp.CopyFromBitmap(AccGrp);
+ wxImage icons_accgroup_png(cstream, wxBITMAP_TYPE_PNG);
+ wxBitmap AccGrp(icons_accgroup_png, -1);
+ wxIcon wxIAccGrp;
+ wxIAccGrp.CopyFromBitmap(AccGrp);
- wxImage icons_accnone_png(dstream, wxBITMAP_TYPE_PNG);
- wxBitmap AccNone(icons_accnone_png, -1);
- wxIcon wxIAccNone;
- wxIAccNone.CopyFromBitmap(AccNone);
+ wxImage icons_accnone_png(dstream, wxBITMAP_TYPE_PNG);
+ wxBitmap AccNone(icons_accnone_png, -1);
+ wxIcon wxIAccNone;
+ wxIAccNone.CopyFromBitmap(AccNone);
- AccountID = AccImgList->Add(wxIAccNIcon);
- AccountNetID = AccImgList->Add(wxIAccInet);
- AccountGrpID = AccImgList->Add(wxIAccGrp);
- AccountNoneID = AccImgList->Add(wxIAccNone);
+ AccountID = AccImgList->Add(wxIAccNIcon);
+ AccountNetID = AccImgList->Add(wxIAccInet);
+ AccountGrpID = AccImgList->Add(wxIAccGrp);
+ AccountNoneID = AccImgList->Add(wxIAccNone);
- bmpIcon->SetIcon(AccImgList->GetIcon(AccountNoneID));
+ bmpIcon->SetIcon(AccImgList->GetIcon(AccountNoneID));
- // Setup the status bar icons.
+ // Setup the status bar icons.
- // SSL icons.
+ // SSL icons.
- wxMemoryInputStream sslstream(icons_ssl_png, sizeof(icons_ssl_png));
- wxMemoryInputStream sslwarningstream(icons_sslwarning_png, sizeof(icons_sslwarning_png));
- wxMemoryInputStream nosslstream(icons_nossl_png, sizeof(icons_nossl_png));
+ wxMemoryInputStream sslstream(icons_ssl_png, sizeof(icons_ssl_png));
+ wxMemoryInputStream sslwarningstream(icons_sslwarning_png, sizeof(icons_sslwarning_png));
+ wxMemoryInputStream nosslstream(icons_nossl_png, sizeof(icons_nossl_png));
- wxImage icons_ssl_png(sslstream, wxBITMAP_TYPE_PNG);
- imgSSL = new wxBitmap(icons_ssl_png, -1);
+ wxImage icons_ssl_png(sslstream, wxBITMAP_TYPE_PNG);
+ imgSSL = new wxBitmap(icons_ssl_png, -1);
- wxImage icons_sslwarning_png(sslwarningstream, wxBITMAP_TYPE_PNG);
- imgSSLWarning = new wxBitmap(icons_sslwarning_png, -1);
+ wxImage icons_sslwarning_png(sslwarningstream, wxBITMAP_TYPE_PNG);
+ imgSSLWarning = new wxBitmap(icons_sslwarning_png, -1);
- wxImage icons_nossl_png(nosslstream, wxBITMAP_TYPE_PNG);
- imgNoSSL = new wxBitmap(icons_nossl_png, -1);
+ wxImage icons_nossl_png(nosslstream, wxBITMAP_TYPE_PNG);
+ imgNoSSL = new wxBitmap(icons_nossl_png, -1);
- // Activity Icon.
+ // Activity Icon.
- wxMemoryInputStream act1(icons_act1_png, sizeof(icons_act1_png));
- wxMemoryInputStream act2(icons_act2_png, sizeof(icons_act2_png));
- wxMemoryInputStream act3(icons_act3_png, sizeof(icons_act3_png));
- wxMemoryInputStream act4(icons_act4_png, sizeof(icons_act4_png));
- wxMemoryInputStream actsleep(icons_actsleep_png, sizeof(icons_actsleep_png));
+ wxMemoryInputStream act1(icons_act1_png, sizeof(icons_act1_png));
+ wxMemoryInputStream act2(icons_act2_png, sizeof(icons_act2_png));
+ wxMemoryInputStream act3(icons_act3_png, sizeof(icons_act3_png));
+ wxMemoryInputStream act4(icons_act4_png, sizeof(icons_act4_png));
+ wxMemoryInputStream actsleep(icons_actsleep_png, sizeof(icons_actsleep_png));
- wxImage icons_actsleep_png(actsleep, wxBITMAP_TYPE_PNG);
- imgActIconSleep = new wxBitmap (icons_actsleep_png, -1);
+ wxImage icons_actsleep_png(actsleep, wxBITMAP_TYPE_PNG);
+ imgActIconSleep = new wxBitmap (icons_actsleep_png, -1);
- wxImage icons_act1_png(act1, wxBITMAP_TYPE_PNG);
- imgActIcon1 = new wxBitmap (icons_act1_png, -1);
- wxIcon wxIAct1icon;
- wxIAct1icon.CopyFromBitmap(*imgActIcon1);
+ wxImage icons_act1_png(act1, wxBITMAP_TYPE_PNG);
+ imgActIcon1 = new wxBitmap (icons_act1_png, -1);
+ wxIcon wxIAct1icon;
+ wxIAct1icon.CopyFromBitmap(*imgActIcon1);
- wxImage icons_act2_png(act2, wxBITMAP_TYPE_PNG);
- imgActIcon2 = new wxBitmap (icons_act2_png, -1);
- wxIcon wxIAct2icon;
- wxIAct2icon.CopyFromBitmap(*imgActIcon2);
+ wxImage icons_act2_png(act2, wxBITMAP_TYPE_PNG);
+ imgActIcon2 = new wxBitmap (icons_act2_png, -1);
+ wxIcon wxIAct2icon;
+ wxIAct2icon.CopyFromBitmap(*imgActIcon2);
- wxImage icons_act3_png(act3, wxBITMAP_TYPE_PNG);
- imgActIcon3 = new wxBitmap (icons_act3_png, -1);
- wxIcon wxIAct3icon;
- wxIAct3icon.CopyFromBitmap(*imgActIcon3);
+ wxImage icons_act3_png(act3, wxBITMAP_TYPE_PNG);
+ imgActIcon3 = new wxBitmap (icons_act3_png, -1);
+ wxIcon wxIAct3icon;
+ wxIAct3icon.CopyFromBitmap(*imgActIcon3);
- wxImage icons_act4_png(act4, wxBITMAP_TYPE_PNG);
- imgActIcon4 = new wxBitmap (icons_act4_png, -1);
- wxIcon wxIAct4icon;
- wxIAct4icon.CopyFromBitmap(*imgActIcon4);
+ wxImage icons_act4_png(act4, wxBITMAP_TYPE_PNG);
+ imgActIcon4 = new wxBitmap (icons_act4_png, -1);
+ wxIcon wxIAct4icon;
+ wxIAct4icon.CopyFromBitmap(*imgActIcon4);
- // Online/Offline icons.
+ // Online/Offline icons.
- wxMemoryInputStream onlinestream(icons_online_png, sizeof(icons_online_png));
- wxMemoryInputStream offlinestream(icons_offline_png, sizeof(icons_offline_png));
+ wxMemoryInputStream onlinestream(icons_online_png, sizeof(icons_online_png));
+ wxMemoryInputStream offlinestream(icons_offline_png, sizeof(icons_offline_png));
- wxImage icons_online_png(onlinestream, wxBITMAP_TYPE_PNG);
- imgOnline = new wxBitmap(icons_online_png, -1);
+ wxImage icons_online_png(onlinestream, wxBITMAP_TYPE_PNG);
+ imgOnline = new wxBitmap(icons_online_png, -1);
- wxImage icons_offline_png(offlinestream, wxBITMAP_TYPE_PNG);
- imgOffline = new wxBitmap(icons_offline_png, -1);
+ wxImage icons_offline_png(offlinestream, wxBITMAP_TYPE_PNG);
+ imgOffline = new wxBitmap(icons_offline_png, -1);
- // Setup the account view.
+ // Setup the account view.
- AccCtrl->SetPopupControl(treAccounts);
- AccCtrl->SetPopupMaxHeight(175);
- AccCtrl->SetPopupMinWidth(250);
- treAccounts->AssignImageList(AccImgList);
+ AccCtrl->SetPopupControl(treAccounts);
+ AccCtrl->SetPopupMaxHeight(175);
+ AccCtrl->SetPopupMinWidth(250);
+ treAccounts->AssignImageList(AccImgList);
- wxListItem ColumnData;
- ColumnData.SetId(0);
- ColumnData.SetText(wxT("Name0"));
- ColumnData.SetWidth(320);
- lstContacts->InsertColumn(0, ColumnData);
+ wxListItem ColumnData;
+ ColumnData.SetId(0);
+ ColumnData.SetText(wxT("Name0"));
+ ColumnData.SetWidth(320);
+ lstContacts->InsertColumn(0, ColumnData);
- treAccounts->Connect(wxEVT_LEFT_DCLICK, wxTreeEventHandler(frmMain::LoadContactList), NULL, this);
- treAccounts->Connect(wxEVT_TREE_SEL_CHANGED, wxTreeEventHandler(frmMain::LoadContactList), NULL, this);
+ treAccounts->Connect(wxEVT_LEFT_DCLICK, wxTreeEventHandler(frmMain::LoadContactList), NULL, this);
+ treAccounts->Connect(wxEVT_TREE_SEL_CHANGED, wxTreeEventHandler(frmMain::LoadContactList), NULL, this);
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- int stbBottomData [4] = { -1, 8, 8, 8 };
+ int stbBottomData [4] = { -1, 8, 8, 8 };
#else
- int stbBottomData [4] = { -1, 20, 20, 20 };
+ int stbBottomData [4] = { -1, 20, 20, 20 };
#endif
- stbBottom->SetFieldsCount(4, stbBottomData);
- stbBottom->SetMinHeight(16);
+ stbBottom->SetFieldsCount(4, stbBottomData);
+ stbBottom->SetMinHeight(16);
- wxRect rectOnline;
- wxRect rectSSL;
- wxRect rectActivity;
- stbBottom->GetFieldRect(1, rectOnline);
- stbBottom->GetFieldRect(2, rectSSL);
- stbBottom->GetFieldRect(3, rectActivity);
+ wxRect rectOnline;
+ wxRect rectSSL;
+ wxRect rectActivity;
+ stbBottom->GetFieldRect(1, rectOnline);
+ stbBottom->GetFieldRect(2, rectSSL);
+ stbBottom->GetFieldRect(3, rectActivity);
- SSLToolTip = new wxToolTip(wxT(""));
+ SSLToolTip = new wxToolTip(wxT(""));
- imgConnStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectOnline.GetX()),(rectOnline.GetY())), wxDefaultSize, 0 );
- imgConnStatus->SetBitmap(*imgOnline);
- imgConnStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ToggleConnectionStatus ), NULL, this );
+ imgConnStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectOnline.GetX()),(rectOnline.GetY())), wxDefaultSize, 0 );
+ imgConnStatus->SetBitmap(*imgOnline);
+ imgConnStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ToggleConnectionStatus ), NULL, this );
- imgSSLStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectSSL.GetX()),(rectSSL.GetY())), wxDefaultSize, 0 );
- imgSSLStatus->SetBitmap(*imgNoSSL);
- imgSSLStatus->SetToolTip(SSLToolTip);
- imgSSLStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ShowSSLCertificates ), NULL, this );
+ imgSSLStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectSSL.GetX()),(rectSSL.GetY())), wxDefaultSize, 0 );
+ imgSSLStatus->SetBitmap(*imgNoSSL);
+ imgSSLStatus->SetToolTip(SSLToolTip);
+ imgSSLStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ShowSSLCertificates ), NULL, this );
- imgActivityStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectActivity.GetX()),(rectActivity.GetY())), wxDefaultSize, 0);
- imgActivityStatus->SetBitmap(*imgActIconSleep);
- imgActivityStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ShowActivityWindow ), NULL, this );
+ imgActivityStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectActivity.GetX()),(rectActivity.GetY())), wxDefaultSize, 0);
+ imgActivityStatus->SetBitmap(*imgActIconSleep);
+ imgActivityStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ShowActivityWindow ), NULL, this );
- // Setup the window menu.
+ // Setup the window menu.
- // By default should be:
+ // By default should be:
- // Contact windows:
- // (none)
- // (horizontal line)
- // Contact editor windows:
- // (none)
- // (horizontal line)
- // Search windows:
- // (none)
+ // Contact windows:
+ // (none)
+ // (horizontal line)
+ // Contact editor windows:
+ // (none)
+ // (horizontal line)
+ // Search windows:
+ // (none)
- mnuContactWindows = new wxMenuItem( mnuManage, wxID_ANY, wxString( _("Contact windows:") ), wxEmptyString, wxITEM_NORMAL );
- mnuWindow->Append( mnuContactWindows );
+ mnuContactWindows = new wxMenuItem( mnuManage, wxID_ANY, wxString( _("Contact windows:") ), wxEmptyString, wxITEM_NORMAL );
+ mnuWindow->Append( mnuContactWindows );
- mnuWindow->AppendSeparator();
+ mnuWindow->AppendSeparator();
- mnuContactEditorWindows = new wxMenuItem( mnuManage, wxID_ANY, wxString( _("Contact editor windows:") ), wxEmptyString, wxITEM_NORMAL );
- mnuWindow->Append( mnuContactEditorWindows );
+ mnuContactEditorWindows = new wxMenuItem( mnuManage, wxID_ANY, wxString( _("Contact editor windows:") ), wxEmptyString, wxITEM_NORMAL );
+ mnuWindow->Append( mnuContactEditorWindows );
- mnuWindow->AppendSeparator();
+ mnuWindow->AppendSeparator();
- mnuSearchWindows = new wxMenuItem( mnuManage, wxID_ANY, wxString( wxT("Search windows:") ), wxEmptyString, wxITEM_NORMAL );
- mnuWindow->Append( mnuSearchWindows );
+ mnuSearchWindows = new wxMenuItem( mnuManage, wxID_ANY, wxString( wxT("Search windows:") ), wxEmptyString, wxITEM_NORMAL );
+ mnuWindow->Append( mnuSearchWindows );
#if defined(__WIN32__)
- wxFont fontstyle;
- fontstyle.Bold();
+ wxFont fontstyle;
+ fontstyle.Bold();
- mnuContactWindows->SetFont(fontstyle);
- mnuContactEditorWindows->SetFont(fontstyle);
- mnuSearchWindows->SetFont(fontstyle);
+ mnuContactWindows->SetFont(fontstyle);
+ mnuContactEditorWindows->SetFont(fontstyle);
+ mnuSearchWindows->SetFont(fontstyle);
#else
- mnuContactWindows->Enable(FALSE);
- mnuContactEditorWindows->Enable(FALSE);
- mnuSearchWindows->Enable(FALSE);
+ mnuContactWindows->Enable(FALSE);
+ mnuContactEditorWindows->Enable(FALSE);
+ mnuSearchWindows->Enable(FALSE);
#endif
- // Hide unimplemented functions.
+ // Hide unimplemented functions.
- mnuMain->Remove(3);
+ mnuMain->Remove(3);
}
void frmMain::QuitApp( wxCloseEvent& event )
{
- QuitApp();
+ // Run the QuitApp function.
+
+ QuitApp();
}
void frmMain::QuitApp( wxCommandEvent& event )
{
- QuitApp();
+ // Run the QuitApp function.
+
+ QuitApp();
}
void frmMain::QuitApp()
{
- //-------------------------------------------------------------------
- // frmMain::QuitApp: Quits the application by simply closing this
- // window which causes the exit as frmMain is the main window.
- //
- // wxCommandEvent Accepts a referenced event command.
- //-------------------------------------------------------------------
-
- //-------------------------------------------------------------------
- // frmMain::QuitApp: Quits the application by simply closing this
- // window which causes the exit as frmMain is the main window.
- //
- // wxCommandEvent Accepts a referenced event command.
- //-------------------------------------------------------------------
+
+ // Function to run when quitting.
- //Go through the windows and close each one (be it search
- //or contact editor). Abort if user wants to cancel.
+ //Go through the windows and close each one (be it search
+ //or contact editor). Abort if user wants to cancel.
- // Close the contact editor windows.
+ // Close the contact editor windows.
- // Close the contact windows.
+ // Close the contact windows.
- // Close the search windows.
+ // Close the search windows.
- // Write out the ETag databases.
+ // Write out the ETag databases.
- // Save Preferences: Save the window position if that option is enabled.
+ // Save Preferences: Save the window position if that option is enabled.
- wxString SetFilename = GetUserPrefDir();
+ wxString SetFilename = GetUserPrefDir();
#if defined(__HAIKU__)
#elif defined(__WIN32__)
- SetFilename.Append(wxT("settings"));
+ SetFilename.Append(wxT("settings"));
#else
- // *nix OSes
+ // *nix OSes
- SetFilename.Append(wxT("settings"));
+ SetFilename.Append(wxT("settings"));
#endif
- wxFileConfig *cfgfile = new wxFileConfig("", "", SetFilename);
+ wxFileConfig *cfgfile = new wxFileConfig("", "", SetFilename);
- bool SaveWindowPos = FALSE;
- wxString SaveWindowInc;
- cfgfile->Read(wxT("SaveWindowPosition"), &SaveWindowInc);
+ bool SaveWindowPos = FALSE;
+ wxString SaveWindowInc;
+ cfgfile->Read(wxT("SaveWindowPosition"), &SaveWindowInc);
- if (SaveWindowInc == wxT("true")){
+ if (SaveWindowInc == wxT("true")){
- SaveWindowPos = TRUE;
+ SaveWindowPos = TRUE;
- }
+ }
- if (SaveWindowPos == TRUE){
+ if (SaveWindowPos == TRUE){
- wxRect frmMainPos = this->GetRect();
+ wxRect frmMainPos = this->GetRect();
- cfgfile->Write(wxT("WindowPositionX"), frmMainPos.GetX());
- cfgfile->Write(wxT("WindowPositionY"), frmMainPos.GetY());
- cfgfile->Write(wxT("WindowPositionHeight"), frmMainPos.GetHeight());
- cfgfile->Write(wxT("WindowPositionWidth"), frmMainPos.GetWidth());
+ cfgfile->Write(wxT("WindowPositionX"), frmMainPos.GetX());
+ cfgfile->Write(wxT("WindowPositionY"), frmMainPos.GetY());
+ cfgfile->Write(wxT("WindowPositionHeight"), frmMainPos.GetHeight());
+ cfgfile->Write(wxT("WindowPositionWidth"), frmMainPos.GetWidth());
-
- }
+ }
- delete cfgfile;
- cfgfile = NULL;
+ delete cfgfile;
+ cfgfile = NULL;
- //Everything closed... exit.
+ //Everything closed... exit.
- std::exit(0);
+ std::exit(0);
- Close();
+ Close();
}
void frmMain::ShowActivityWindow( wxCommandEvent& event )
{
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- frameActMgr->OpenWindow();
- frameActMgr->Show();
+ // Open the activity manager window.
+
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ frameActMgr->OpenWindow();
+ frameActMgr->Show();
}
void frmMain::ShowAboutWindow( wxCommandEvent& event )
{
- //-------------------------------------------------------------------
- // frmMain::ShowAboutWindow: Shows the About window as a modal
- // dialog and then cleans up when finished.
- //
- // wxCommandEvent Accepts a referenced event command.
- //-------------------------------------------------------------------
+
+ // Show the about window.
- frmAbout *frameAbout = new frmAbout ( this );
- frameAbout->SetupAboutWindow();
- frameAbout->ShowModal();
- delete frameAbout;
- frameAbout = NULL;
+ frmAbout *frameAbout = new frmAbout ( this );
+ frameAbout->SetupAboutWindow();
+ frameAbout->ShowModal();
+ delete frameAbout;
+ frameAbout = NULL;
}
void frmMain::OpenPreferences( wxCommandEvent& event)
{
- //-------------------------------------------------------------------
- // frmMain::ShowAboutWindow: Opens the Preferences window as a modal
- // dialog and then cleans up when finished.
- //
- // wxCommandEvent Accepts a referenced event command.
- //-------------------------------------------------------------------
+
+ // Open the preferences window.
- ReloadAccounts = FALSE;
+ ReloadAccounts = FALSE;
- frmPreferences *framePreferences = new frmPreferences ( this );
- framePreferences->SetupPointers(&ReloadAccounts);
- framePreferences->ShowModal();
- delete framePreferences;
- framePreferences = NULL;
+ frmPreferences *framePreferences = new frmPreferences ( this );
+ framePreferences->SetupPointers(&ReloadAccounts);
+ framePreferences->ShowModal();
+ delete framePreferences;
+ framePreferences = NULL;
- if (ReloadAccounts == TRUE){
+ if (ReloadAccounts == TRUE){
- // Reload the accounts as a change has been made within
- // the application and clear the current contact information.
+ // Reload the accounts as a change has been made within
+ // the application and clear the current contact information.
- this->LoadPreferences();
- this->ResetContactInfo();
-
- }
+ this->LoadPreferences();
+ this->ResetContactInfo();
+
+ }
}
void frmMain::OpenNewABDialog( wxCommandEvent& event)
{
- //-------------------------------------------------------------------
- // frmMain::ShowAboutWindow: Opens the Preferences window as a modal
- // dialog and then cleans up when finished.
- //
- // wxCommandEvent Accepts a referenced event command.
- //-------------------------------------------------------------------
-
- ReloadAccounts = FALSE;
-
- frmNewAccount *frameNewAccount = new frmNewAccount ( this );
- frameNewAccount->SetupPointers(&ReloadAccounts);
- frameNewAccount->ShowModal();
- delete frameNewAccount;
- frameNewAccount = NULL;
+
+ // Open the new account dialog.
+
+ ReloadAccounts = FALSE;
+
+ frmNewAccount *frameNewAccount = new frmNewAccount ( this );
+ frameNewAccount->SetupPointers(&ReloadAccounts);
+ frameNewAccount->ShowModal();
+ delete frameNewAccount;
+ frameNewAccount = NULL;
- if (ReloadAccounts == TRUE){
+ if (ReloadAccounts == TRUE){
- // Reload the accounts as a change has been made within
- // the application.
+ // Reload the accounts as a change has been made within
+ // the application.
- this->LoadPreferences();
+ this->LoadPreferences();
- }
+ }
}
void frmMain::LoadContactList( wxTreeEvent& event )
{
- // Clear all existing variables.
+ // Load the contact list.
+
+ // Clear all existing variables.
- lstContacts->DeleteAllItems();
+ lstContacts->DeleteAllItems();
- treAccounts->SetAccount();
+ treAccounts->SetAccount();
- wxTreeItemIdValue cookie;
- wxTreeItemId next = treAccounts->GetRootItem();
- wxString AccountName;
- wxString AccountDir, AccountType, AccountDirFinal, AccountTypeFinal;
- wxString AccountDirCmb;
- long selectedaccount = 0;
+ wxTreeItemIdValue cookie;
+ wxTreeItemId next = treAccounts->GetRootItem();
+ wxString AccountName;
+ wxString AccountDir, AccountType, AccountDirFinal, AccountTypeFinal;
+ wxString AccountDirCmb;
+ long selectedaccount = 0;
- wxTreeItemId selectedChild = treAccounts->GetSelection();
- wxTreeItemId nextChild;
+ wxTreeItemId selectedChild = treAccounts->GetSelection();
+ wxTreeItemId nextChild;
- wxTreeItemId ActiveItemId = treAccounts->GetFocusedItem();
- int ActiveItemIcon = treAccounts->GetItemImage(ActiveItemId, wxTreeItemIcon_Normal);
+ wxTreeItemId ActiveItemId = treAccounts->GetFocusedItem();
+ int ActiveItemIcon = treAccounts->GetItemImage(ActiveItemId, wxTreeItemIcon_Normal);
- int SCImg = treAccounts->GetItemImage(selectedChild);
- int AccountIndex = 0;
+ int SCImg = treAccounts->GetItemImage(selectedChild);
+ int AccountIndex = 0;
- bmpIcon->SetIcon(AccImgList->GetIcon(SCImg));
+ bmpIcon->SetIcon(AccImgList->GetIcon(SCImg));
- for (int i = 0; i < prefaccounts.GetCount(); i++){
+ // Process each account.
+
+ for (int i = 0; i < prefaccounts.GetCount(); i++){
- if (ActiveItemIcon == 2){
+ if (ActiveItemIcon == 2){
- std::multimap<wxTreeItemId, int>::iterator AGTiter = AccountGroupTreeId.find(ActiveItemId);
- std::multimap<int, int>::iterator AGLiter = AccountGroupList.find(AGTiter->second);
- int ActiveAccountG = AGLiter->second;
+ std::multimap<wxTreeItemId, int>::iterator AGTiter = AccountGroupTreeId.find(ActiveItemId);
+ std::multimap<int, int>::iterator AGLiter = AccountGroupList.find(AGTiter->second);
+ int ActiveAccountG = AGLiter->second;
- if (i == ActiveAccountG){
+ if (i == ActiveAccountG){
- AccountDir.Append(prefaccounts.GetAccountDirectory(i));
- AccountType.Append(prefaccounts.GetAccountType(i));
+ AccountDir.Append(prefaccounts.GetAccountDirectory(i));
+ AccountType.Append(prefaccounts.GetAccountType(i));
- AccountDir.Trim();
- AccountType.Trim();
+ AccountDir.Trim();
+ AccountType.Trim();
- if (AccountType == wxT("CardDAV")){
- AccountTypeFinal.Append(wxT("carddav"));
- }
- else if (AccountType == wxT("Local")){
- imgSSLStatus->SetBitmap(*imgOffline);
- SSLToolTip->SetTip(wxT("SSL status is not applicable for this account"));
- AccountTypeFinal.Append(wxT("local"));
- }
+ if (AccountType == wxT("CardDAV")){
+ AccountTypeFinal.Append(wxT("carddav"));
+ } else if (AccountType == wxT("Local")){
+ imgSSLStatus->SetBitmap(*imgOffline);
+ SSLToolTip->SetTip(wxT("SSL status is not applicable for this account"));
+ AccountTypeFinal.Append(wxT("local"));
+ }
- AccountIndex = i;
- break;
+ AccountIndex = i;
+ break;
- }
+ }
- }
+ }
- if (!nextChild){
- nextChild = treAccounts->GetFirstChild(next, cookie);
- }
- else {
- nextChild = treAccounts->GetNextSibling(nextChild);
- }
+ if (!nextChild){
+ nextChild = treAccounts->GetFirstChild(next, cookie);
+ } else {
+ nextChild = treAccounts->GetNextSibling(nextChild);
+ }
- AccountName = treAccounts->GetItemText(nextChild);
+ AccountName = treAccounts->GetItemText(nextChild);
- if (nextChild == selectedChild){
- AccountDir.Append(prefaccounts.GetAccountDirectory(i));
- AccountType.Append(prefaccounts.GetAccountType(i));
+ if (nextChild == selectedChild){
+
+ AccountDir.Append(prefaccounts.GetAccountDirectory(i));
+ AccountType.Append(prefaccounts.GetAccountType(i));
- AccountDir.Trim();
- AccountType.Trim();
+ AccountDir.Trim();
+ AccountType.Trim();
- if (AccountType == wxT("CardDAV")){
- AccountTypeFinal.Append(wxT("carddav"));
- }
- else if (AccountType == wxT("Local")){
- SSLToolTip->SetTip(wxT("SSL status is not applicable for this account"));
- AccountTypeFinal.Append(wxT("local"));
- }
+ if (AccountType == wxT("CardDAV")){
+ AccountTypeFinal.Append(wxT("carddav"));
+ } else if (AccountType == wxT("Local")){
+ SSLToolTip->SetTip(wxT("SSL status is not applicable for this account"));
+ AccountTypeFinal.Append(wxT("local"));
+ }
- AccountIndex = i;
+ AccountIndex = i;
- }
+ }
- }
+ }
- if (selectedaccount >= prefaccounts.GetCount()){
+ if (selectedaccount >= prefaccounts.GetCount()){
- // The account selected isn't there so return.
-
- RevealWait = FALSE;
+ // The account selected isn't there so return.
+
+ RevealWait = FALSE;
- return;
+ return;
- }
+ }
- // Open the directory and get the list of .vcf files
- // in that directory.
+ // Open the directory and get the list of .vcf files
+ // in that directory.
- ActiveAccount = AccountDir + wxT(".") + AccountTypeFinal;
- ActiveAccountType = AccountType;
+ ActiveAccount = AccountDir + wxT(".") + AccountTypeFinal;
+ ActiveAccountType = AccountType;
- SetupSSLStatus(AccountIndex);
+ SetupSSLStatus(AccountIndex);
- AccountDirFinal.Clear();
- AccountDirFinal = GetAccountDir(AccountDir + wxT(".") + AccountTypeFinal, FALSE);
+ AccountDirFinal.Clear();
+ AccountDirFinal = GetAccountDir(AccountDir + wxT(".") + AccountTypeFinal, FALSE);
- ContactsFileIndex.Clear();
+ ContactsFileIndex.Clear();
- wxString vCardFilename;
- wxString vCardFilenameFull;
- wxString vCardDataString;
- wxStringTokenizer vcardfileline;
- wxString lwxs;
- wxString setname, setvalue;
- std::multimap<wxString, wxString, std::greater<wxString>> vCardNamesAsc;
- std::multimap<wxString, wxString, std::less<wxString>> vCardNamesDsc;
- long ContactIndex = 1;
- long ContactSeekPoint = 0;
+ wxString vCardFilename;
+ wxString vCardFilenameFull;
+ wxString vCardDataString;
+ wxStringTokenizer vcardfileline;
+ wxString lwxs;
+ wxString setname, setvalue;
+ std::multimap<wxString, wxString, std::greater<wxString>> vCardNamesAsc;
+ std::multimap<wxString, wxString, std::less<wxString>> vCardNamesDsc;
+ long ContactIndex = 1;
+ long ContactSeekPoint = 0;
- wxDir vcardaccdir(AccountDirFinal);
+ wxDir vcardaccdir(AccountDirFinal);
- // Get the wxTreeItemId and image icon and compare it to the list.
+ // Get the wxTreeItemId and image icon and compare it to the list.
- if (ActiveItemIcon == AccountGrpID){
+ if (ActiveItemIcon == AccountGrpID){
- // It's a group so load the file containing the group and
- // get the members of the group.
+ // It's a group so load the file containing the group and
+ // get the members of the group.
- vCard Group;
- wxString UIDCode;
+ vCard Group;
+ wxString UIDCode;
- std::multimap<wxTreeItemId, int>::iterator AGTiter = AccountGroupTreeId.find(ActiveItemId);
- std::multimap<int, wxString>::iterator AGFiter = AccountGroupFilename.find(AGTiter->second);
+ std::multimap<wxTreeItemId, int>::iterator AGTiter = AccountGroupTreeId.find(ActiveItemId);
+ std::multimap<int, wxString>::iterator AGFiter = AccountGroupFilename.find(AGTiter->second);
- Group.LoadFile(AGFiter->second);
+ Group.LoadFile(AGFiter->second);
- ArrayvCardOutData vCardMember = Group.GetByPartial(wxT("MEMBER"));
+ ArrayvCardOutData vCardMember = Group.GetByPartial(wxT("MEMBER"));
- for (int i = 0; i < vCardMember.PropCount; i++){
+ for (int i = 0; i < vCardMember.PropCount; i++){
- vCardMember.PropValues[i].Trim();
- if (vCardMember.PropValues[i].Left(9) == wxT("urn:uuid:")){
+ vCardMember.PropValues[i].Trim();
+ if (vCardMember.PropValues[i].Left(9) == wxT("urn:uuid:")){
- wxString NewPropValue;
- NewPropValue = vCardMember.PropValues[i].Mid(9, wxString::npos);
- vCardMember.PropValues[i] = NewPropValue;
+ wxString NewPropValue;
+ NewPropValue = vCardMember.PropValues[i].Mid(9, wxString::npos);
+ vCardMember.PropValues[i] = NewPropValue;
- }
+ }
-
- }
+ }
+
+ bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
- bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
- while(ProcFiles){
+ while(ProcFiles){
- if (vCardFilename.Right(4) == wxT(".vcf") ||
- vCardFilename.Right(4) == wxT(".VCF") ||
- vCardFilename.Right(5) == wxT(".vcard") ||
- vCardFilename.Right(5) == wxT(".VCARD")){
+ if (vCardFilename.Right(4) == wxT(".vcf") ||
+ vCardFilename.Right(4) == wxT(".VCF") ||
+ vCardFlename.Right(5) == wxT(".vcard") ||
+ vCardFilename.Right(5) == wxT(".VCARD")){
- vCard Person;
- bool FoundMember = FALSE;
+ vCard Person;
+ bool FoundMember = FALSE;
- vCardFilenameFull.Append(AccountDirFinal);
- vCardFilenameFull.Append(wxT("/"));
- vCardFilenameFull.Append(vCardFilename);
+ vCardFilenameFull.Append(AccountDirFinal);
+ vCardFilenameFull.Append(wxT("/"));
+ vCardFilenameFull.Append(vCardFilename);
- Person.LoadFile(vCardFilenameFull);
+ Person.LoadFile(vCardFilenameFull);
- UIDCode = Person.Get(wxT("UID"));
+ UIDCode = Person.Get(wxT("UID"));
- for (int i = 0; i < vCardMember.PropCount; i++){
+ for (int i = 0; i < vCardMember.PropCount; i++){
- if (vCardMember.PropValues[i] == UIDCode){
+ if (vCardMember.PropValues[i] == UIDCode){
- FoundMember = TRUE;
+ FoundMember = TRUE;
- }
-
- }
+ }
+
+ }
- if (FoundMember == FALSE){
+ if (FoundMember == FALSE){
- vCardFilename.Clear();
- vCardFilenameFull.Clear();
- vCardDataString.Clear();
- ProcFiles = vcardaccdir.GetNext(&vCardFilename);
- continue;
+ vCardFilename.Clear();
+ vCardFilenameFull.Clear();
+ vCardDataString.Clear();
+ ProcFiles = vcardaccdir.GetNext(&vCardFilename);
+ continue;
- }
-
- if (Person.MeetBaseSpecification()){
+ }
+
+ if (Person.MeetBaseSpecification()){
- if (SortMode == 1){
+ if (SortMode == 1){
- // Split the name into sections.
+ // Split the name into sections.
- vCardDataString = Person.Get(wxT("N"));
+ vCardDataString = Person.Get(wxT("N"));
- vCardName NameData = Person.GetName();
+ vCardName NameData = Person.GetName();
- vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname;
+ vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname;
- } else if (SortMode == 2){
+ } else if (SortMode == 2){
- // Split the name into sections.
+ // Split the name into sections.
- vCardName NameData = Person.GetName();
+ vCardName NameData = Person.GetName();
- vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename;
+ vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename;
- } else if (SortMode == 3){
+ } else if (SortMode == 3){
- // Check and make sure that the top most nickname is used.
+ // Check and make sure that the top most nickname is used.
- vCardDataString = Person.Get(wxT("NICKNAME"));
+ vCardDataString = Person.Get(wxT("NICKNAME"));
- if (vCardDataString.IsEmpty()){
+ if (vCardDataString.IsEmpty()){
- vCardDataString = wxT("(no nickname)");
+ vCardDataString = wxT("(no nickname)");
- }
+ }
- } else if (SortMode == 4){
+ } else if (SortMode == 4){
- vCardDataString = Person.Get(wxT("FN"));
+ vCardDataString = Person.Get(wxT("FN"));
- }
+ }
- if (AscendingMode == TRUE){
- vCardNamesAsc.insert(std::make_pair(vCardDataString, vCardFilenameFull));
- } else {
- vCardNamesDsc.insert(std::make_pair(vCardDataString, vCardFilenameFull));
- }
+ if (AscendingMode == TRUE){
+ vCardNamesAsc.insert(std::make_pair(vCardDataString, vCardFilenameFull));
+ } else {
+ vCardNamesDsc.insert(std::make_pair(vCardDataString, vCardFilenameFull));
+ }
- } else {
-
- }
+ }
- }
+ }
- vCardFilename.Clear();
- vCardFilenameFull.Clear();
- vCardDataString.Clear();
- ProcFiles = vcardaccdir.GetNext(&vCardFilename);
- }
+ vCardFilename.Clear();
+ vCardFilenameFull.Clear();
+ vCardDataString.Clear();
+ ProcFiles = vcardaccdir.GetNext(&vCardFilename);
+
+ }
- } else {
+ } else {
- bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
- while(ProcFiles){
+ bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
+ while(ProcFiles){
- if (vCardFilename.Right(4) == wxT(".vcf") ||
- vCardFilename.Right(4) == wxT(".VCF") ||
- vCardFilename.Right(5) == wxT(".vcard") ||
- vCardFilename.Right(5) == wxT(".VCARD")){
+ if (vCardFilename.Right(4) == wxT(".vcf") ||
+ vCardFilename.Right(4) == wxT(".VCF") ||
+ vCardFilename.Right(5) == wxT(".vcard") ||
+ vCardFilename.Right(5) == wxT(".VCARD")){
- vCard Person;
+ vCard Person;
- vCardFilenameFull.Append(AccountDirFinal);
- vCardFilenameFull.Append(vCardFilename);
+ vCardFilenameFull.Append(AccountDirFinal);
+ vCardFilenameFull.Append(vCardFilename);
- Person.LoadFile(vCardFilenameFull);
+ Person.LoadFile(vCardFilenameFull);
- if (Person.MeetBaseSpecification()){
+ if (Person.MeetBaseSpecification()){
- if (SortMode == 1){
+ if (SortMode == 1){
- // Split the name into sections.
+ // Split the name into sections.
- vCardDataString = Person.Get(wxT("N"));
+ vCardDataString = Person.Get(wxT("N"));
- vCardName NameData = Person.GetName();
+ vCardName NameData = Person.GetName();
- vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname;
+ vCardDataString = NameData.Forename + wxT(" ") + NameData.Surname;
- } else if (SortMode == 2){
+ } else if (SortMode == 2){
- // Split the name into sections.
+ // Split the name into sections.
- vCardName NameData = Person.GetName();
+ vCardName NameData = Person.GetName();
- vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename;
+ vCardDataString = NameData.Surname + wxT(", ") + NameData.Forename;
- } else if (SortMode == 3){
+ } else if (SortMode == 3){
- // Check and make sure that the top most nickname is used.
+ // Check and make sure that the top most nickname is used.
- vCardDataString = Person.Get(wxT("NICKNAME"));
+ vCardDataString = Person.Get(wxT("NICKNAME"));
- if (vCardDataString.IsEmpty()){
+ if (vCardDataString.IsEmpty()){
- vCardDataString = wxT("(no nickname)");
+ vCardDataString = wxT("(no nickname)");
- }
+ }
- } else if (SortMode == 4){
+ } else if (SortMode == 4){
- vCardDataString = Person.Get(wxT("FN"));
+ vCardDataString = Person.Get(wxT("FN"));
- }
+ }
- if (AscendingMode == TRUE){
- vCardNamesAsc.insert(std::make_pair(vCardDataString, vCardFilenameFull));
- } else {
- vCardNamesDsc.insert(std::make_pair(vCardDataString, vCardFilenameFull));
- }
+ if (AscendingMode == TRUE){
+
+ vCardNamesAsc.insert(std::make_pair(vCardDataString, vCardFilenameFull));
+
+ } else {
+
+ vCardNamesDsc.insert(std::make_pair(vCardDataString, vCardFilenameFull));
+
+ }
- } else {
-
- }
+ }
- }
+ }
- vCardFilename.Clear();
- vCardFilenameFull.Clear();
- vCardDataString.Clear();
- ProcFiles = vcardaccdir.GetNext(&vCardFilename);
- }
+ vCardFilename.Clear();
+ vCardFilenameFull.Clear();
+ vCardDataString.Clear();
+ ProcFiles = vcardaccdir.GetNext(&vCardFilename);
+ }
- }
+ }
- // Sort the data.
+ // Sort the data.
- // Insert the data into the control.
+ // Insert the data into the control.
- if (AscendingMode == TRUE){
- for (std::map<wxString, wxString>::iterator iter = vCardNamesAsc.begin();
- iter != vCardNamesAsc.end(); ++iter){
+ if (AscendingMode == TRUE){
+ for (std::map<wxString, wxString>::iterator iter = vCardNamesAsc.begin();
+ iter != vCardNamesAsc.end(); ++iter){
+
+ wxListItem ContactInfo;
- wxListItem ContactInfo;
+ ContactInfo.SetId(0);
+ ContactInfo.SetText(_("Mooo"));
+ ContactInfo.SetData(ContactSeekPoint);
+ ContactIndex = lstContacts->InsertItem(ContactInfo);
- ContactInfo.SetId(0);
- ContactInfo.SetText(_("Mooo"));
- ContactInfo.SetData(ContactSeekPoint);
- ContactIndex = lstContacts->InsertItem(ContactInfo);
+ lstContacts->SetItem(ContactIndex, 0, iter->first);
- lstContacts->SetItem(ContactIndex, 0, iter->first);
- ContactsFileIndex.Insert(iter->second, ContactSeekPoint);
- ContactSeekPoint++;
+ ContactsFileIndex.Insert(iter->second, ContactSeekPoint);
+ ContactSeekPoint++;
- }
+ }
- } else {
+ } else {
- for (std::map<wxString, wxString>::iterator iter = vCardNamesDsc.begin();
- iter != vCardNamesDsc.end(); ++iter){
+ for (std::map<wxString, wxString>::iterator iter = vCardNamesDsc.begin();
+ iter != vCardNamesDsc.end(); ++iter){
- wxListItem ContactInfo;
+ wxListItem ContactInfo;
- ContactInfo.SetId(0);
- ContactInfo.SetText(_("Mooo"));
- ContactInfo.SetData(ContactSeekPoint);
- ContactIndex = lstContacts->InsertItem(ContactInfo);
+ ContactInfo.SetId(0);
+ ContactInfo.SetText(_("Mooo"));
+ ContactInfo.SetData(ContactSeekPoint);
+ ContactIndex = lstContacts->InsertItem(ContactInfo);
- lstContacts->SetItem(ContactIndex, 0, iter->first);
- ContactsFileIndex.Insert(iter->second, ContactSeekPoint);
- ContactSeekPoint++;
+ lstContacts->SetItem(ContactIndex, 0, iter->first);
+ ContactsFileIndex.Insert(iter->second, ContactSeekPoint);
+ ContactSeekPoint++;
- }
+ }
- }
+ }
}
void frmMain::ShowContactInfo( wxListEvent& event )
{
- long intSelected = -1;
- long ContactSeekNum = -1;
+ // Display the contact information.
- // Check if several contacts have been selected.
+ long intSelected = -1;
+ long ContactSeekNum = -1;
- int ContactTotal = 0;
+ // Check if several contacts have been selected.
- for (;;){
+ int ContactTotal = 0;
+
+ for (;;){
- intSelected = lstContacts->GetNextItem(intSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ intSelected = lstContacts->GetNextItem(intSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
- if (intSelected == -1){
+ if (intSelected == -1){
- break;
+ break;
- }
+ }
- ContactTotal++;
+ ContactTotal++;
- }
+ }
- if (ContactTotal == 0){
- htmContactData->SetPage(wxT(""));
- return;
- }
+ if (ContactTotal == 0){
+ htmContactData->SetPage(wxT(""));
+ return;
+ }
- if (ContactTotal > 1){
+ if (ContactTotal > 1){
- htmContactData->SetPage(wxString::Format(wxT("%i contacts selected."), ContactTotal));
- ActiveFilename.Clear();
- return;
+ htmContactData->SetPage(wxString::Format(wxT("%i contacts selected."), ContactTotal));
+ ActiveFilename.Clear();
+ return;
- }
+ }
- intSelected = lstContacts->GetNextItem(intSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ intSelected = lstContacts->GetNextItem(intSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
- ContactSeekNum = lstContacts->GetItemData(intSelected);
+ ContactSeekNum = lstContacts->GetItemData(intSelected);
- wxFFile ContactFile;
- wxString wxSContactString;
- wxString ContactLine;
- vCard Person;
+ wxFFile ContactFile;
+ wxString wxSContactString;
+ wxString ContactLine;
+ vCard Person;
- size_t ContactLineLen;
- bool ExtraLineSeek = FALSE;
- int QuoteBreakPoint = 0;
+ size_t ContactLineLen;
+ bool ExtraLineSeek = FALSE;
+ int QuoteBreakPoint = 0;
- bool PropertyFind = FALSE;
- bool QuoteMode = FALSE;
+ bool PropertyFind = FALSE;
+ bool QuoteMode = FALSE;
- wxString wxSPropertyNextLine;
- wxString wxSProperty;
- wxString wxSPropertySeg1;
- wxString wxSPropertySeg2;
+ wxString wxSPropertyNextLine;
+ wxString wxSProperty;
+ wxString wxSPropertySeg1;
+ wxString wxSPropertySeg2;
- // Check if we are using wxWidgets version 2.8 or less and
- // execute the required command accordingly.
+ // Check if we are using wxWidgets version 2.8 or less and
+ // execute the required command accordingly.
#if wxABI_VERSION < 20900
- ContactFile.Open(ContactsFileIndex[ContactSeekNum].c_str(), wxT("r"));
+ ContactFile.Open(ContactsFileIndex[ContactSeekNum].c_str(), wxT("r"));
#else
- ContactFile.Open(ContactsFileIndex[ContactSeekNum], wxT("r"));
+ ContactFile.Open(ContactsFileIndex[ContactSeekNum], wxT("r"));
#endif
- if (ContactFile.IsOpened() == FALSE){
+ if (ContactFile.IsOpened() == FALSE){
- return;
+ return;
- }
+ }
- ContactFile.ReadAll(&wxSContactString, wxConvAuto());
+ ContactFile.ReadAll(&wxSContactString, wxConvAuto());
- // Split the lines.
+ // Split the lines.
- std::map<int, wxString> ContactFileLines;
- std::map<int, wxString>::iterator striter;
+ std::map<int, wxString> ContactFileLines;
+ std::map<int, wxString>::iterator striter;
- wxStringTokenizer wSTContactFileLines(wxSContactString, wxT("\r\n"));
+ wxStringTokenizer wSTContactFileLines(wxSContactString, wxT("\r\n"));
- int ContactLineSeek = 0;
+ int ContactLineSeek = 0;
- while (wSTContactFileLines.HasMoreTokens() == TRUE){
+ while (wSTContactFileLines.HasMoreTokens() == TRUE){
- ContactLine = wSTContactFileLines.GetNextToken();
- ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
- ContactLineSeek++;
+ ContactLine = wSTContactFileLines.GetNextToken();
+ ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
+ ContactLineSeek++;
- }
+ }
- if (ContactSeekNum < 0){
- return;
- }
+ if (ContactSeekNum < 0){
+ return;
+ }
- for (std::map<int, wxString>::iterator iter = ContactFileLines.begin();
- iter != ContactFileLines.end(); ++iter){
+ for (std::map<int, wxString>::iterator iter = ContactFileLines.begin();
+ iter != ContactFileLines.end(); ++iter){
- // Find the colon which splits the start bit from the data part.
+ // Find the colon which splits the start bit from the data part.
- ContactLine = iter->second;
+ ContactLine = iter->second;
- while (ExtraLineSeek == TRUE){
+ while (ExtraLineSeek == TRUE){
- // Check if there is extra data on the next line
- // (indicated by space or tab at the start) and add data.
+ // Check if there is extra data on the next line
+ // (indicated by space or tab at the start) and add data.
- iter++;
+ iter++;
- if (iter == ContactFileLines.end()){
+ if (iter == ContactFileLines.end()){
- iter--;
- break;
+ iter--;
+ break;
- }
+ }
- wxSPropertyNextLine = iter->second;
+ wxSPropertyNextLine = iter->second;
- if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
+ if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
- wxSPropertyNextLine.Remove(0, 1);
- ContactLine.Append(wxSPropertyNextLine);
+ wxSPropertyNextLine.Remove(0, 1);
+ ContactLine.Append(wxSPropertyNextLine);
- } else {
+ } else {
- iter--;
- ExtraLineSeek = FALSE;
+ iter--;
+ ExtraLineSeek = FALSE;
- }
+ }
- }
+ }
- ContactLineLen = ContactLine.Len();
+ ContactLineLen = ContactLine.Len();
- // Make sure we are not in quotation mode.
- // Make sure colon does not have \ or \\ before it.
+ // Make sure we are not in quotation mode.
+ // Make sure colon does not have \ or \\ before it.
- for (int i = 0; i <= ContactLineLen; i++){
+ for (int i = 0; i <= ContactLineLen; i++){
- if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
+ if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
- PropertyFind = FALSE;
+ PropertyFind = FALSE;
- } else if (PropertyFind == TRUE){
+ } else if (PropertyFind == TRUE){
- wxSProperty.Append(ContactLine.Mid(i, 1));
+ wxSProperty.Append(ContactLine.Mid(i, 1));
- }
+ }
- if (ContactLine.Mid(i, 1) == wxT("\"")){
+ if (ContactLine.Mid(i, 1) == wxT("\"")){
- if (QuoteMode == TRUE){
+ if (QuoteMode == TRUE){
- QuoteMode = FALSE;
+ QuoteMode = FALSE;
- } else {
+ } else {
- QuoteMode = TRUE;
+ QuoteMode = TRUE;
- }
+ }
- }
+ }
- if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
+ if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
- QuoteBreakPoint = i;
- break;
+ QuoteBreakPoint = i;
+ break;
- }
+ }
- }
+ }
- // Split that line at the point into two variables (ignore the colon).
+ // Split that line at the point into two variables (ignore the colon).
- wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
- wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
+ wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
+ wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
- // Insert both into the vCard data file.
+ // Insert both into the vCard data file.
- Person.AddRaw(wxSPropertySeg1, wxSPropertySeg2);
+ Person.AddRaw(wxSPropertySeg1, wxSPropertySeg2);
- QuoteMode = FALSE;
- PropertyFind = TRUE;
- ExtraLineSeek = TRUE;
- ContactLineLen = 0;
- QuoteBreakPoint = 0;
- ContactLine.Clear();
- wxSProperty.Clear();
+ QuoteMode = FALSE;
+ PropertyFind = TRUE;
+ ExtraLineSeek = TRUE;
+ ContactLineLen = 0;
+ QuoteBreakPoint = 0;
+ ContactLine.Clear();
+ wxSProperty.Clear();
- }
+ }
- OldSessionID = SessionID;
- SessionID = wxString::Format(wxT("%i"), rand() % 32768);
- LoadContactData(&Person, htmContactData, SessionID, OldSessionID, &MemoryFileList);
- ActiveFilename = ContactsFileIndex[ContactSeekNum];
+ OldSessionID = SessionID;
+ SessionID = wxString::Format(wxT("%i"), rand() % 32768);
+ LoadContactData(&Person, htmContactData, SessionID, OldSessionID, &MemoryFileList);
+ ActiveFilename = ContactsFileIndex[ContactSeekNum];
}
void frmMain::ShowContactEditorNew( wxCommandEvent& event )
{
- // Check if there is an account selected and if not
- // return immediately.
+ // Open a contact editor window to write a new contact with.
- if (ActiveAccount.IsEmpty()){
+ // Check if there is an account selected and if not
+ // return immediately.
+
+ if (ActiveAccount.IsEmpty()){
- return;
+ return;
- }
+ }
- // Add Pointer to SetupPointers for the ETagDB.
+ // Add Pointer to SetupPointers for the ETagDB.
- wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
- wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
- wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
- wxIcon contacticon;
- contacticon.CopyFromBitmap(contacticonbmp);
+ wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
+ wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
+ wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
+ wxIcon contacticon;
+ contacticon.CopyFromBitmap(contacticonbmp);
- frmContactEditor *ContactEditor = new frmContactEditor( this );
+ frmContactEditor *ContactEditor = new frmContactEditor( this );
- WindowMenuItemID++;
+ WindowMenuItemID++;
- ContactEditor->SetUID(WindowMenuItemID);
+ ContactEditor->SetUID(WindowMenuItemID);
- WindowData *WData = new WindowData;
+ WindowData *WData = new WindowData;
- WData->DataType = 1;
- WData->WindowPointer = (void*)ContactEditor;
- WData->WindowID = WindowMenuItemID;
+ WData->DataType = 1;
+ WData->WindowPointer = (void*)ContactEditor;
+ WData->WindowID = WindowMenuItemID;
- wxCommandEvent addevent(WINDOW_ADD);
- addevent.SetClientData(WData);
- wxPostEvent(this, addevent);
+ wxCommandEvent addevent(WINDOW_ADD);
+ addevent.SetClientData(WData);
+ wxPostEvent(this, addevent);
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- ContactEditor->SetupHeaders();
- ContactEditor->SetupContact(ActiveAccount);
- ContactEditor->SetIcon(contacticon);
- ContactEditor->SetupPointers(frameActMgr, &ETagProcTimer, this);
- ContactEditor->Show(true);
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ ContactEditor->SetupHeaders();
+ ContactEditor->SetupContact(ActiveAccount);
+ ContactEditor->SetIcon(contacticon);
+ ContactEditor->SetupPointers(frameActMgr, &ETagProcTimer, this);
+ ContactEditor->Show(true);
}
void frmMain::ShowContactEditorEdit( wxCommandEvent& event )
{
- // Check if there is an account selected and if not
- // return immediately.
+ // Open a contact editor window for editing an existing contact
+ // with.
+
+ // Check if there is an account selected and if not
+ // return immediately.
- int DataCheck = event.GetInt();
+ int DataCheck = event.GetInt();
- if (ActiveAccount.IsEmpty() && DataCheck == 0){
+ if (ActiveAccount.IsEmpty() && DataCheck == 0){
- return;
+ return;
- }
+ }
- wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
- wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
- wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
- wxIcon contacticon;
- contacticon.CopyFromBitmap(contacticonbmp);
+ wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
+ wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
+ wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
+ wxIcon contacticon;
+ contacticon.CopyFromBitmap(contacticonbmp);
- // Check if a contact has been selected.
+ // Check if a contact has been selected.
- long intSelected = -1;
- long intContactSeekNum = -1;
+ long intSelected = -1;
+ long intContactSeekNum = -1;
- intSelected = lstContacts->GetNextItem(intSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ intSelected = lstContacts->GetNextItem(intSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
- if (intSelected == -1){
- return;
- }
+ if (intSelected == -1){
+
+ return;
+
+ }
- intContactSeekNum = lstContacts->GetItemData(intSelected);
+ intContactSeekNum = lstContacts->GetItemData(intSelected);
- // Get the filename of the selected contact.
+ // Get the filename of the selected contact.
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- frmContactEditor *ContactEditor = new frmContactEditor( this );
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ frmContactEditor *ContactEditor = new frmContactEditor( this );
- WindowMenuItemID++;
+ WindowMenuItemID++;
- ContactEditor->SetUID(WindowMenuItemID);
+ ContactEditor->SetUID(WindowMenuItemID);
- WindowData *WData = new WindowData;
+ WindowData *WData = new WindowData;
- WData->DataType = 1;
- WData->WindowPointer = (void*)ContactEditor;
- WData->WindowID = WindowMenuItemID;
+ WData->DataType = 1;
+ WData->WindowPointer = (void*)ContactEditor;
+ WData->WindowID = WindowMenuItemID;
- wxCommandEvent addevent(WINDOW_ADD);
- addevent.SetClientData(WData);
- wxPostEvent(this, addevent);
+ wxCommandEvent addevent(WINDOW_ADD);
+ addevent.SetClientData(WData);
+ wxPostEvent(this, addevent);
- ContactEditor->SetupPointers(frameActMgr, &ETagProcTimer, this);
- ContactEditor->SetupHeaders();
+ ContactEditor->SetupPointers(frameActMgr, &ETagProcTimer, this);
+ ContactEditor->SetupHeaders();
- // Check if pointer is NULL (not from the search forms) or not.
+ // Check if pointer is NULL (not from the search forms) or not.
- if (DataCheck == 0){
+ if (DataCheck == 0){
- ContactEditor->LoadContact(ContactsFileIndex[intContactSeekNum]);
- ContactEditor->SetupContact(ActiveAccount);
+ ContactEditor->LoadContact(ContactsFileIndex[intContactSeekNum]);
+ ContactEditor->SetupContact(ActiveAccount);
- } else {
+ } else {
- UCNotif *uc = (UCNotif*)event.GetClientData();
+ UCNotif *uc = (UCNotif*)event.GetClientData();
- if (!uc){
+ if (!uc){
- ContactEditor->SetupContact(ActiveAccount);
- ContactEditor->LoadContact(ContactsFileIndex[intContactSeekNum]);
+ ContactEditor->SetupContact(ActiveAccount);
+ ContactEditor->LoadContact(ContactsFileIndex[intContactSeekNum]);
- } else {
+ } else {
- ContactEditor->SetupContact(uc->ContactAccount);
- ContactEditor->LoadContact(uc->ContactFilename);
+ ContactEditor->SetupContact(uc->ContactAccount);
+ ContactEditor->LoadContact(uc->ContactFilename);
- delete uc;
- uc = NULL;
-
-
- }
+ delete uc;
+ uc = NULL;
+
+ }
- }
+ }
- ContactEditor->SetIcon(contacticon);
- ContactEditor->Show(true);
+ ContactEditor->SetIcon(contacticon);
+ ContactEditor->Show(true);
}
void frmMain::RefreshAddressBook( wxCommandEvent& event ){
+
+ // Refresh the address book data.
- // Check if ActiveAccount is empty. If not then check if
- // account type is not local otherwise continue.
+ // Check if ActiveAccount is empty. If not then check if
+ // account type is not local otherwise continue.
- if (!ActiveAccount.IsEmpty()){
+ if (!ActiveAccount.IsEmpty()){
- if (ActiveAccountType != wxT("Local")){
+ if (ActiveAccountType != wxT("Local")){
- // Account type is not local.
+ // Account type is not local.
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- frameActMgr->AddTask(3, wxT(""), ActiveAccount,
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ frameActMgr->AddTask(3, wxT(""), ActiveAccount,
wxT(""), wxT(""), wxT(""), wxT(""));
- } else {
+ } else {
- wxMessageBox(_("The refresh address book command is not supported with this type of account."), wxT("Not supported for this type of account"));
+ wxMessageBox(_("The refresh address book command is not supported with this type of account."), wxT("Not supported for this type of account"));
- }
+ }
- }
+ }
}
void frmMain::OpenContactInfoList( wxListEvent& event )
{
- wxStringTokenizer vcardfileline;
- std::string l;
- wxString lwxs;
- wxString setname, setvalue;
- vCard Person;
- wxString nextchar;
+ // Open the contact information window.
- long intSelected = -1;
- long intContactSeekNum = -1;
+ wxStringTokenizer vcardfileline;
+ std::string l;
+ wxString lwxs;
+ wxString setname, setvalue;
+ vCard Person;
+ wxString nextchar;
- intSelected = lstContacts->GetNextItem(intSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ long intSelected = -1;
+ long intContactSeekNum = -1;
- intContactSeekNum = lstContacts->GetItemData(intSelected);
+ intSelected = lstContacts->GetNextItem(intSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
- if (intContactSeekNum == -1){
- return;
- }
+ intContactSeekNum = lstContacts->GetItemData(intSelected);
- Person.LoadFile(ContactsFileIndex[intContactSeekNum]);
+ if (intContactSeekNum == -1){
+
+ return;
+
+ }
+
+ Person.LoadFile(ContactsFileIndex[intContactSeekNum]);
- wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
- wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
- wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
- wxIcon contacticon;
- contacticon.CopyFromBitmap(contacticonbmp);
+ wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
+ wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
+ wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
+ wxIcon contacticon;
+ contacticon.CopyFromBitmap(contacticonbmp);
- frmContact *Contact = new frmContact( this );
+ frmContact *Contact = new frmContact( this );
- // Add to window list.
+ // Add to window list.
- WindowMenuItemID++;
+ WindowMenuItemID++;
- Contact->SetUID(WindowMenuItemID);
+ Contact->SetUID(WindowMenuItemID);
- WindowData *WData = new WindowData;
+ WindowData *WData = new WindowData;
- WData->DataType = 0;
- WData->WindowPointer = (void*)Contact;
- WData->WindowID = WindowMenuItemID;
+ WData->DataType = 0;
+ WData->WindowPointer = (void*)Contact;
+ WData->WindowID = WindowMenuItemID;
- wxCommandEvent addevent(WINDOW_ADD);
- addevent.SetClientData(WData);
- wxPostEvent(this, addevent);
+ wxCommandEvent addevent(WINDOW_ADD);
+ addevent.SetClientData(WData);
+ wxPostEvent(this, addevent);
- Contact->SetupPointers(&MemoryFileList);
- Contact->SetupContactData(&Person);
+ Contact->SetupPointers(&MemoryFileList);
+ Contact->SetupContactData(&Person);
- Contact->SetIcon(contacticon);
- Contact->Show(true);
+ Contact->SetIcon(contacticon);
+ Contact->Show(true);
}
void frmMain::OpenContactInfoList( wxCommandEvent& event ){
+ // Open a list of contact information windows.
+
wxListEvent pevent;
OpenContactInfoList(pevent);
void frmMain::OpenContactInfo( wxCommandEvent& event )
{
+
+ // Open the contact information window.
+
+ UCNotif *uc = (UCNotif*)event.GetClientData();
- UCNotif *uc = (UCNotif*)event.GetClientData();
-
- wxStringTokenizer vcardfileline;
- std::string l;
- wxString lwxs;
- wxString setname, setvalue;
- vCard Person;
- wxString nextchar;
+ wxStringTokenizer vcardfileline;
+ std::string l;
+ wxString lwxs;
+ wxString setname, setvalue;
+ vCard Person;
+ wxString nextchar;
- Person.LoadFile(uc->ContactFilename);
+ Person.LoadFile(uc->ContactFilename);
- wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
- wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
- wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
- wxIcon contacticon;
- contacticon.CopyFromBitmap(contacticonbmp);
+ wxMemoryInputStream istream(bigimgs_contactpersonicon48_png, sizeof(bigimgs_contactpersonicon48_png));
+ wxImage bigimgs_contactpersonicon48i(istream, wxBITMAP_TYPE_PNG);
+ wxBitmap contacticonbmp(bigimgs_contactpersonicon48i, -1);
+ wxIcon contacticon;
+ contacticon.CopyFromBitmap(contacticonbmp);
- frmContact *Contact = new frmContact( this );
+ frmContact *Contact = new frmContact( this );
- // Add to window list.
+ // Add to window list.
- WindowMenuItemID++;
+ WindowMenuItemID++;
- Contact->SetUID(WindowMenuItemID);
+ Contact->SetUID(WindowMenuItemID);
- WindowData *WData = new WindowData;
+ WindowData *WData = new WindowData;
- WData->DataType = 0;
- WData->WindowPointer = (void*)Contact;
- WData->WindowID = WindowMenuItemID;
+ WData->DataType = 0;
+ WData->WindowPointer = (void*)Contact;
+ WData->WindowID = WindowMenuItemID;
- wxCommandEvent addevent(WINDOW_ADD);
- addevent.SetClientData(WData);
- wxPostEvent(this, addevent);
+ wxCommandEvent addevent(WINDOW_ADD);
+ addevent.SetClientData(WData);
+ wxPostEvent(this, addevent);
- Contact->SetupPointers(&MemoryFileList);
- Contact->SetupContactData(&Person);
+ Contact->SetupPointers(&MemoryFileList);
+ Contact->SetupContactData(&Person);
- Contact->SetIcon(contacticon);
- Contact->Show(true);
+ Contact->SetIcon(contacticon);
+ Contact->Show(true);
}
void frmMain::LoadPreferences( wxActivateEvent& event)
{
- this->LoadPreferences();
+
+ // Load the preferences.
+
+ this->LoadPreferences();
+
}
void frmMain::LoadPreferences(){
- // Load the preferences.
+ // Load the preferences.
- wxString preffilename = GetUserPrefDir();
+ wxString preffilename = GetUserPrefDir();
- XABPreferences preferences(preffilename);
+ XABPreferences preferences(preffilename);
- // Setup the main window position (if needed).
+ // Setup the main window position (if needed).
- bool SaveWindowPos = preferences.GetBoolData(wxT("SaveWindowPosition"));
- bool HideLocalABs = preferences.GetBoolData(wxT("HideLocalAddressBooks"));
+ bool SaveWindowPos = preferences.GetBoolData(wxT("SaveWindowPosition"));
+ bool HideLocalABs = preferences.GetBoolData(wxT("HideLocalAddressBooks"));
- if (SaveWindowPos == TRUE){
+ if (SaveWindowPos == TRUE){
- this->SetSize(preferences.GetMainWindowData());
+ this->SetSize(preferences.GetMainWindowData());
- }
+ }
- treAccounts->DeleteAllItems();
+ treAccounts->DeleteAllItems();
- wxTreeItemId RootNode = treAccounts->AddRoot(wxT("Root Item"), AccountNoneID);
+ wxTreeItemId RootNode = treAccounts->AddRoot(wxT("Root Item"), AccountNoneID);
- // Stop all account timers and remove the accounts.
+ // Stop all account timers and remove the accounts.
- for (std::map<wxString, wxAccountSyncTimer*>::iterator iter = AccountSyncTimers.begin();
- iter != AccountSyncTimers.end(); iter++){
+ for (std::map<wxString, wxAccountSyncTimer*>::iterator iter = AccountSyncTimers.begin();
+ iter != AccountSyncTimers.end(); iter++){
- wxAccountSyncTimer *AccTmrPtr = iter->second;
- AccTmrPtr->Stop();
+ wxAccountSyncTimer *AccTmrPtr = iter->second;
+ AccTmrPtr->Stop();
- delete AccTmrPtr;
- AccTmrPtr = NULL;
+ delete AccTmrPtr;
+ AccTmrPtr = NULL;
- }
+ }
- AccountSyncTimers.clear();
+ AccountSyncTimers.clear();
- wxString AccDir;
- wxString AccDirFull;
- wxString AccDirFullSfx;
- wxString AccName;
- wxString AccDirFinal;
- AccountAccDirList.clear();
- AccountGroupList.clear();
- AccountGroupFilename.clear();
- AccountGroupTreeId.clear();
- wxTreeItemId AccountTreeId;
- wxTreeItemId GroupTreeId;
- int intGroupID = 0;
+ wxString AccDir;
+ wxString AccDirFull;
+ wxString AccDirFullSfx;
+ wxString AccName;
+ wxString AccDirFinal;
+ AccountAccDirList.clear();
+ AccountGroupList.clear();
+ AccountGroupFilename.clear();
+ AccountGroupTreeId.clear();
+ wxTreeItemId AccountTreeId;
+ wxTreeItemId GroupTreeId;
+ int intGroupID = 0;
- for (int i = 0; i < preferences.accounts.GetCount(); i++){
+ for (int i = 0; i < preferences.accounts.GetCount(); i++){
- if ((preferences.accounts.GetAccountType(i) == wxT("Local") ||
- preferences.accounts.GetAccountType(i) == wxT("local")) && HideLocalABs == TRUE){
+ if ((preferences.accounts.GetAccountType(i) == wxT("Local") ||
+ preferences.accounts.GetAccountType(i) == wxT("local")) && HideLocalABs == TRUE){
- continue;
+ continue;
- }
+ }
- if (preferences.accounts.GetAccountDirectory(i).IsEmpty()){
+ if (preferences.accounts.GetAccountDirectory(i).IsEmpty()){
- continue;
+ continue;
- }
+ }
- AccDir = preferences.accounts.GetAccountDirectory(i);
- AccDirFull = preferences.accounts.GetAccountDirectory(i);
- AccDirFull.Trim();
- AccDirFull.Append(wxT("."));
- AccDirFullSfx.Append(preferences.accounts.GetAccountType(i));
- AccDirFullSfx.LowerCase();
- AccDirFullSfx.Trim();
- AccDirFull.Append(AccDirFullSfx);
- AccName = preferences.accounts.GetAccountName(i);
- AccName.Trim();
- AccountAccDirList.insert(std::make_pair(i, AccDirFull));
+ AccDir = preferences.accounts.GetAccountDirectory(i);
+ AccDirFull = preferences.accounts.GetAccountDirectory(i);
+ AccDirFull.Trim();
+ AccDirFull.Append(wxT("."));
+ AccDirFullSfx.Append(preferences.accounts.GetAccountType(i));
+ AccDirFullSfx.LowerCase();
+ AccDirFullSfx.Trim();
+ AccDirFull.Append(AccDirFullSfx);
+ AccName = preferences.accounts.GetAccountName(i);
+ AccName.Trim();
+ AccountAccDirList.insert(std::make_pair(i, AccDirFull));
- if (preferences.accounts.GetAccountType(i) == wxT("CardDAV") ||
- preferences.accounts.GetAccountType(i) == wxT("carddav")){
+ if (preferences.accounts.GetAccountType(i) == wxT("CardDAV") ||
+ preferences.accounts.GetAccountType(i) == wxT("carddav")){
- // TODO: Check if the directory exists before doing anything.
+ // TODO: Check if the directory exists before doing anything.
- // Add a new timer using the existing account details.
+ // Add a new timer using the existing account details.
- wxAccountSyncTimer *ActTmrPtr = new wxAccountSyncTimer;
+ wxAccountSyncTimer *ActTmrPtr = new wxAccountSyncTimer;
- ActTmrPtr->SetupData(AccDirFull, AccName);
- ActTmrPtr->SetupPointers(this, ActMgrPtr, ETagProcTimer.GetPointer(AccDirFull));
- ActTmrPtr->Start((int)(preferences.accounts.GetAccountRefresh(i) * 1000));
- ActTmrPtr->SetOwner(this);
- ActTmrPtr->Notify();
+ ActTmrPtr->SetupData(AccDirFull, AccName);
+ ActTmrPtr->SetupPointers(this, ActMgrPtr, ETagProcTimer.GetPointer(AccDirFull));
+ ActTmrPtr->Start((int)(preferences.accounts.GetAccountRefresh(i) * 1000));
+ ActTmrPtr->SetOwner(this);
+ ActTmrPtr->Notify();
- // Add the timer to the list of timers.
+ // Add the timer to the list of timers.
- AccountSyncTimers.insert(std::make_pair(AccDirFull, ActTmrPtr));
+ AccountSyncTimers.insert(std::make_pair(AccDirFull, ActTmrPtr));
- AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountNetID, -1);
+ AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountNetID, -1);
- } else {
+ } else {
- AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountID, -1);
+ AccountTreeId = treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i), AccountID, -1);
- }
+ }
- // Go through the account directory and find contact files with
- // 'KIND:group' set and add them to the list of groups for the account.
+ // Go through the account directory and find contact files with
+ // 'KIND:group' set and add them to the list of groups for the account.
- AccDirFinal = GetAccountDir(AccDirFull, FALSE);
+ AccDirFinal = GetAccountDir(AccDirFull, FALSE);
- wxDir vcardaccdir(AccDirFinal);
+ wxDir vcardaccdir(AccDirFinal);
- wxString vCardFilename;
- wxString vCardDataString;
- wxString vCardFilenameFull;
+ wxString vCardFilename;
+ wxString vCardDataString;
+ wxString vCardFilenameFull;
- bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
- while(ProcFiles){
+ bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
+
+ while(ProcFiles){
- if (vCardFilename.Right(4) == wxT(".vcf") ||
- vCardFilename.Right(4) == wxT(".VCF") ||
- vCardFilename.Right(5) == wxT(".vcard") ||
- vCardFilename.Right(5) == wxT(".VCARD")){
+ if (vCardFilename.Right(4) == wxT(".vcf") ||
+ vCardFilename.Right(4) == wxT(".VCF") ||
+ vCardFilename.Right(5) == wxT(".vcard") ||
+ vCardFilename.Right(5) == wxT(".VCARD")){
- vCard Person;
+ vCard Person;
- vCardFilenameFull.Append(AccDirFinal);
- vCardFilenameFull.Append(wxT("/"));
- vCardFilenameFull.Append(vCardFilename);
+ vCardFilenameFull.Append(AccDirFinal);
+ vCardFilenameFull.Append(wxT("/"));
+ vCardFilenameFull.Append(vCardFilename);
- Person.LoadFile(vCardFilenameFull);
+ Person.LoadFile(vCardFilenameFull);
- if (Person.MeetBaseSpecification()){
+ if (Person.MeetBaseSpecification()){
- vCardDataString = Person.Get(wxT("KIND"));
+ vCardDataString = Person.Get(wxT("KIND"));
- if (vCardDataString == wxT("group")){
+ if (vCardDataString == wxT("group")){
- // The vCard kind is a group. Add to the account's group list.
+ // The vCard kind is a group. Add to the account's group list.
- GroupTreeId = treAccounts->AppendItem(AccountTreeId, Person.Get(wxT("FN")), AccountGrpID, -1);
- treAccounts->SetItemHasChildren(AccountTreeId, TRUE);
- AccountGroupList.insert(std::make_pair(intGroupID, i));
- AccountGroupFilename.insert(std::make_pair(intGroupID, vCardFilenameFull));
- AccountGroupTreeId.insert(std::make_pair(GroupTreeId, intGroupID));
+ GroupTreeId = treAccounts->AppendItem(AccountTreeId, Person.Get(wxT("FN")), AccountGrpID, -1);
+ treAccounts->SetItemHasChildren(AccountTreeId, TRUE);
+ AccountGroupList.insert(std::make_pair(intGroupID, i));
+ AccountGroupFilename.insert(std::make_pair(intGroupID, vCardFilenameFull));
+ AccountGroupTreeId.insert(std::make_pair(GroupTreeId, intGroupID));
- }
+ }
- intGroupID++;
+ intGroupID++;
- } else {
-
- }
+ }
- }
+ }
- vCardFilename.Clear();
- vCardFilenameFull.Clear();
- vCardDataString.Clear();
- ProcFiles = vcardaccdir.GetNext(&vCardFilename);
+ vCardFilename.Clear();
+ vCardFilenameFull.Clear();
+ vCardDataString.Clear();
+ ProcFiles = vcardaccdir.GetNext(&vCardFilename);
- }
+ }
- // Clearup for next account.
+ // Clearup for next account.
- AccDir.clear();
- AccDirFull.clear();
- AccDirFullSfx.clear();
- AccDirFinal.clear();
- AccName.clear();
+ AccDir.clear();
+ AccDirFull.clear();
+ AccDirFullSfx.clear();
+ AccDirFinal.clear();
+ AccName.clear();
- }
+ }
- // Load the account settings as they are needed for connecting
- // to the servers.
+ // Load the account settings as they are needed for connecting
+ // to the servers.
- prefaccounts = preferences.accounts;
+ prefaccounts = preferences.accounts;
}
void frmMain::ConflictResolution(wxCommandEvent& event){
- frmConflictResolution *frameCR = new frmConflictResolution ( this );
- vCardConflictObj *vCardConfObj = (vCardConflictObj*)event.GetClientData();
- vCard *ClientDataPtr = vCardConfObj->vCardLocalData;
- vCard *ServerDataPtr = vCardConfObj->vCardServerData;
- frameCR->LoadData(ClientDataPtr, ServerDataPtr, &MemoryFileList);
- frameCR->ShowModal();
+ // Display the conflict resolution window.
- int FinalConflictResult = frameCR->GetResult();
+ frmConflictResolution *frameCR = new frmConflictResolution ( this );
+ vCardConflictObj *vCardConfObj = (vCardConflictObj*)event.GetClientData();
+ vCard *ClientDataPtr = vCardConfObj->vCardLocalData;
+ vCard *ServerDataPtr = vCardConfObj->vCardServerData;
+ frameCR->LoadData(ClientDataPtr, ServerDataPtr, &MemoryFileList);
+ frameCR->ShowModal();
- wxCommandEvent event2(ACTMGR_RESUMEPROC);
- event2.SetClientData(vCardConfObj->QRNotifData);
- event2.SetInt(FinalConflictResult);
+ int FinalConflictResult = frameCR->GetResult();
- delete frameCR;
- frameCR = NULL;
+ wxCommandEvent event2(ACTMGR_RESUMEPROC);
+ event2.SetClientData(vCardConfObj->QRNotifData);
+ event2.SetInt(FinalConflictResult);
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- wxPostEvent(frameActMgr, event2);
+ delete frameCR;
+ frameCR = NULL;
+
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ wxPostEvent(frameActMgr, event2);
}
void frmMain::UpdateContactList(wxCommandEvent& event){
- UCNotif *ucd = (UCNotif*)event.GetClientData();
+ // Update the contact list in the main window.
+
+ UCNotif *ucd = (UCNotif*)event.GetClientData();
- // Check if the active account is being displayed in the
- // main window. If not, skip and delete the data.
+ // Check if the active account is being displayed in the
+ // main window. If not, skip and delete the data.
- long longSelected = -1;
- int intSelectedData = 0;
+ long longSelected = -1;
+ int intSelectedData = 0;
- if (ActiveAccount == ucd->ContactAccount){
+ if (ActiveAccount == ucd->ContactAccount){
- // Look at the list of contacts and if it matches the
- // filename then update the name.
+ // Look at the list of contacts and if it matches the
+ // filename then update the name.
- for (;;){
+ for (;;){
- longSelected = lstContacts->GetNextItem(longSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_DONTCARE);
+ longSelected = lstContacts->GetNextItem(longSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_DONTCARE);
- if (longSelected == -1){
+ if (longSelected == -1){
- break;
+ break;
- }
+ }
- intSelectedData = (int)lstContacts->GetItemData(longSelected);
+ intSelectedData = (int)lstContacts->GetItemData(longSelected);
- if (ucd->ContactFilename == ContactsFileIndex[intSelectedData]){
+ if (ucd->ContactFilename == ContactsFileIndex[intSelectedData]){
- // Work out which sorting mode we are in.
+ // Work out which sorting mode we are in.
- if (SortMode == 1){
+ if (SortMode == 1){
- // First Name, Last Name.
+ // First Name, Last Name.
- lstContacts->SetItem(longSelected, 0, ucd->ContactNameArray.Forename + wxT(" ") + ucd->ContactNameArray.Surname);
+ lstContacts->SetItem(longSelected, 0, ucd->ContactNameArray.Forename + wxT(" ") + ucd->ContactNameArray.Surname);
- } else if (SortMode == 2){
+ } else if (SortMode == 2){
- // Last Name, First Name.
+ // Last Name, First Name.
- lstContacts->SetItem(longSelected, 0, ucd->ContactNameArray.Surname + wxT(", ") + ucd->ContactNameArray.Forename);
+ lstContacts->SetItem(longSelected, 0, ucd->ContactNameArray.Surname + wxT(", ") + ucd->ContactNameArray.Forename);
- } else if (SortMode == 3){
+ } else if (SortMode == 3){
- // Nickname.
+ // Nickname.
- lstContacts->SetItem(longSelected, 0, ucd->ContactNickname);
+ lstContacts->SetItem(longSelected, 0, ucd->ContactNickname);
- } else if (SortMode == 4){
+ } else if (SortMode == 4){
- // Display As.
+ // Display As.
- lstContacts->SetItem(longSelected, 0, ucd->ContactName);
+ lstContacts->SetItem(longSelected, 0, ucd->ContactName);
- }
+ }
- }
+ }
- // If the filename is the one loaded into the
- // browser control, then update this too.
+ // If the filename is the one loaded into the
+ // browser control, then update this too.
- if (ActiveFilename == ContactsFileIndex[intSelectedData]){
+ if (ActiveFilename == ContactsFileIndex[intSelectedData]){
- wxListEvent nullevent;
- ShowContactInfo(nullevent);
+ wxListEvent nullevent;
+ ShowContactInfo(nullevent);
- }
+ }
- }
+ }
- }
+ }
- for (std::map<int, void*>::iterator WindowIter = WindowListPointers.begin();
- WindowIter != WindowListPointers.end(); WindowIter++){
+ for (std::map<int, void*>::iterator WindowIter = WindowListPointers.begin();
+ WindowIter != WindowListPointers.end(); WindowIter++){
- if (WindowListType[WindowIter->first] != 0){
+ if (WindowListType[WindowIter->first] != 0){
- continue;
+ continue;
- }
+ }
- frmContact *frmContactPtr = static_cast<frmContact*>(WindowIter->second);
+ frmContact *frmContactPtr = static_cast<frmContact*>(WindowIter->second);
- if (frmContactPtr->GetFilename() == ucd->ContactFilename){
+ if (frmContactPtr->GetFilename() == ucd->ContactFilename){
- vCard UpdatedPerson;
- UpdatedPerson.LoadFile(ucd->ContactFilename);
- frmContactPtr->SetupContactData(&UpdatedPerson);
+ vCard UpdatedPerson;
+ UpdatedPerson.LoadFile(ucd->ContactFilename);
+ frmContactPtr->SetupContactData(&UpdatedPerson);
- }
+ }
- }
+ }
- // Send message to search window controller subroutine and
- // pass that notification onto the search windows.
+ // Send message to search window controller subroutine and
+ // pass that notification onto the search windows.
- // Setup the new pointer to use the existing UCNotif without
- // deleting it.
+ // Setup the new pointer to use the existing UCNotif without
+ // deleting it.
- UCNotif *ucd2 = ucd;
+ UCNotif *ucd2 = ucd;
- wxCommandEvent sup(SE_UPDATECONTACTNOTIF);
- sup.SetClientData(ucd2);
- wxPostEvent(this, sup);
+ wxCommandEvent sup(SE_UPDATECONTACTNOTIF);
+ sup.SetClientData(ucd2);
+ wxPostEvent(this, sup);
- // Clear up the unused pointer.
+ // Clear up the unused pointer.
- ucd = NULL;
+ ucd = NULL;
}
void frmMain::UpdateAccountList(wxCommandEvent& event){
+ // Update the account list (currently unimplemented).
+
}
void frmMain::SetupPointers(void *ActMgrPtrInc){
- ActMgrPtr = ActMgrPtrInc;
+ // Setup the pointers for the main window.
+
+ ActMgrPtr = ActMgrPtrInc;
}
void frmMain::SetupForm(){
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- frameActMgr->SetupPointers(&ETagProcTimer, this);
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ frameActMgr->SetupPointers(&ETagProcTimer, this);
- // Setup the contact information icons for later.
+ // Setup the contact information icons for later.
- wxFileSystem::AddHandler(new wxMemoryFSHandler);
- wxImage ciicon_png;
- //wxBitmap ciicon;
+ wxFileSystem::AddHandler(new wxMemoryFSHandler);
+ wxImage ciicon_png;
+ //wxBitmap ciicon;
- wxMemoryInputStream ciptostream(icons_cipto_png, sizeof(icons_cipto_png));
- ciicon_png.LoadFile(ciptostream, wxBITMAP_TYPE_PNG);
- wxMemoryFSHandler::AddFile(wxT("cipto.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+ wxMemoryInputStream ciptostream(icons_cipto_png, sizeof(icons_cipto_png));
+ ciicon_png.LoadFile(ciptostream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("cipto.png"), ciicon_png, wxBITMAP_TYPE_PNG);
- wxMemoryInputStream cilogstream(icons_cilog_png, sizeof(icons_cilog_png));
- ciicon_png.LoadFile(cilogstream, wxBITMAP_TYPE_PNG);
- wxMemoryFSHandler::AddFile(wxT("cilog.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+ wxMemoryInputStream cilogstream(icons_cilog_png, sizeof(icons_cilog_png));
+ ciicon_png.LoadFile(cilogstream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("cilog.png"), ciicon_png, wxBITMAP_TYPE_PNG);
- wxMemoryInputStream cisndstream(icons_cisnd_png, sizeof(icons_cisnd_png));
- ciicon_png.LoadFile(cisndstream, wxBITMAP_TYPE_PNG);
- wxMemoryFSHandler::AddFile(wxT("cisnd.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+ wxMemoryInputStream cisndstream(icons_cisnd_png, sizeof(icons_cisnd_png));
+ ciicon_png.LoadFile(cisndstream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("cisnd.png"), ciicon_png, wxBITMAP_TYPE_PNG);
- wxMemoryInputStream cikeystream(icons_cikey_png, sizeof(icons_cikey_png));
- ciicon_png.LoadFile(cikeystream, wxBITMAP_TYPE_PNG);
- wxMemoryFSHandler::AddFile(wxT("cikey.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+ wxMemoryInputStream cikeystream(icons_cikey_png, sizeof(icons_cikey_png));
+ ciicon_png.LoadFile(cikeystream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("cikey.png"), ciicon_png, wxBITMAP_TYPE_PNG);
- wxMemoryInputStream civenstream(icons_civen_png, sizeof(icons_civen_png));
- ciicon_png.LoadFile(civenstream, wxBITMAP_TYPE_PNG);
- wxMemoryFSHandler::AddFile(wxT("civen.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+ wxMemoryInputStream civenstream(icons_civen_png, sizeof(icons_civen_png));
+ ciicon_png.LoadFile(civenstream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("civen.png"), ciicon_png, wxBITMAP_TYPE_PNG);
- wxMemoryInputStream ciextstream(icons_ciext_png, sizeof(icons_ciext_png));
- ciicon_png.LoadFile(ciextstream, wxBITMAP_TYPE_PNG);
- wxMemoryFSHandler::AddFile(wxT("ciext.png"), ciicon_png, wxBITMAP_TYPE_PNG);
+ wxMemoryInputStream ciextstream(icons_ciext_png, sizeof(icons_ciext_png));
+ ciicon_png.LoadFile(ciextstream, wxBITMAP_TYPE_PNG);
+ wxMemoryFSHandler::AddFile(wxT("ciext.png"), ciicon_png, wxBITMAP_TYPE_PNG);
- LoadPreferences();
+ LoadPreferences();
}
void frmMain::UpdateSearchContactLists(wxCommandEvent& event){
- // Go through each of the search windows and
- // send the required notification to update the
- // contact information.
+ // Update the contact lists in the search windows.
+
+ // Go through each of the search windows and
+ // send the required notification to update the
+ // contact information.
- // Get the event notification data.
+ // Get the event notification data.
- UCNotif *ucd = (UCNotif*)event.GetClientData();
+ UCNotif *ucd = (UCNotif*)event.GetClientData();
- // Process each search window giving the new details.
+ // Process each search window giving the new details.
- for (std::map<void*,wxString>::iterator switer = SearchWindowList.begin();
- switer != SearchWindowList.end(); switer++){
+ for (std::map<void*,wxString>::iterator switer = SearchWindowList.begin();
+ switer != SearchWindowList.end(); switer++){
- // Duplicate the event notification data.
+ // Duplicate the event notification data.
- UCNotif *ucd2 = new UCNotif;
+ UCNotif *ucd2 = new UCNotif;
- ucd2->ContactAccount = ucd->ContactAccount;
- ucd2->ContactFilename = ucd->ContactFilename;
- ucd2->ContactName = ucd->ContactName;
- ucd2->ContactNickname = ucd->ContactNickname;
- ucd2->ContactNameArray = ucd->ContactNameArray;
+ ucd2->ContactAccount = ucd->ContactAccount;
+ ucd2->ContactFilename = ucd->ContactFilename;
+ ucd2->ContactName = ucd->ContactName;
+ ucd2->ContactNickname = ucd->ContactNickname;
+ ucd2->ContactNameArray = ucd->ContactNameArray;
- // Pass the data to the search window for processing.
+ // Pass the data to the search window for processing.
- frmSearch *frameSCH = static_cast<frmSearch*>(switer->first);
- wxCommandEvent schupdate(SE_UPDATERESULT);
- schupdate.SetClientData(ucd2);
- wxPostEvent(frameSCH, schupdate);
+ frmSearch *frameSCH = static_cast<frmSearch*>(switer->first);
+ wxCommandEvent schupdate(SE_UPDATERESULT);
+ schupdate.SetClientData(ucd2);
+ wxPostEvent(frameSCH, schupdate);
- // Clear up the pointer prior to variable deletion.
+ // Clear up the pointer prior to variable deletion.
- frameSCH = NULL;
+ frameSCH = NULL;
- }
+ }
- delete ucd;
- ucd = NULL;
+ delete ucd;
+ ucd = NULL;
}
void frmMain::OpenFindContactsWindow(wxCommandEvent& event){
- WindowMenuItemID++;
+ // Open a new search window.
- frmSearch *frameSCH = new frmSearch ( this );
- frameSCH->SetUID(WindowMenuItemID);
- frameSCH->Show(true);
+ WindowMenuItemID++;
- WindowData *WData = new WindowData;
+ frmSearch *frameSCH = new frmSearch ( this );
+ frameSCH->SetUID(WindowMenuItemID);
+ frameSCH->Show(true);
- WData->DataType = 2;
- WData->WindowPointer = (void*)frameSCH;
- WData->WindowID = WindowMenuItemID;
+ WindowData *WData = new WindowData;
- wxCommandEvent addevent(WINDOW_ADD);
- addevent.SetClientData(WData);
- wxPostEvent(this, addevent);
+ WData->DataType = 2;
+ WData->WindowPointer = (void*)frameSCH;
+ WData->WindowID = WindowMenuItemID;
- // Add pointer to the list of open search windows.
+ wxCommandEvent addevent(WINDOW_ADD);
+ addevent.SetClientData(WData);
+ wxPostEvent(this, addevent);
- SearchWindowList.insert(std::make_pair(frameSCH, wxT("Search")));
+ // Add pointer to the list of open search windows.
- WData = NULL;
+ SearchWindowList.insert(std::make_pair(frameSCH, wxT("Search")));
+
+ WData = NULL;
}
void frmMain::RemoveContactsWindowPointer(wxCommandEvent& event){
- void *frameSCH = (void*)event.GetClientData();
+ // Remove the pointer for a contact window from the
+ // window list.
+
+ void *frameSCH = (void*)event.GetClientData();
- SearchWindowList.erase(frameSCH);
+ SearchWindowList.erase(frameSCH);
- frameSCH = NULL;
+ frameSCH = NULL;
}
void frmMain::RemoveContactEditorWindowPointer(wxCommandEvent& event){
- void *frameSCH = (void*)event.GetClientData();
+ // Remove the pointer for a contact editor window from
+ // the window list.
+
+ void *frameSCH = (void*)event.GetClientData();
- SearchWindowList.erase(frameSCH);
+ SearchWindowList.erase(frameSCH);
- frameSCH = NULL;
+ frameSCH = NULL;
}
void frmMain::RevealContact(wxCommandEvent& event){
- UCNotif *uc = (UCNotif*)event.GetClientData();
+ // Reveal a contact in the main window.
- // Switch the account to the one passed.
+ UCNotif *uc = (UCNotif*)event.GetClientData();
- wxTreeItemIdValue cookie;
- wxTreeItemId next = treAccounts->GetRootItem();
- wxTreeItemId nextChild;
+ // Switch the account to the one passed.
- for (int i = 0; i < prefaccounts.GetCount(); i++){
-
- if (!nextChild){
- nextChild = treAccounts->GetFirstChild(next, cookie);
- } else {
- nextChild = treAccounts->GetNextSibling(nextChild);
- }
-
- //AccountName = treAccounts->GetItemText(nextChild);
+ wxTreeItemIdValue cookie;
+ wxTreeItemId next = treAccounts->GetRootItem();
+ wxTreeItemId nextChild;
+
+ for (int i = 0; i < prefaccounts.GetCount(); i++){
- if (uc->ContactAccount == AccountAccDirList[i]){
+ if (!nextChild){
+ nextChild = treAccounts->GetFirstChild(next, cookie);
+ } else {
+ nextChild = treAccounts->GetNextSibling(nextChild);
+ }
+
+ if (uc->ContactAccount == AccountAccDirList[i]){
- //AccControl->();
- treAccounts->SelectItem(nextChild, TRUE);
- AccCtrl->SetText(treAccounts->GetItemText(nextChild));
+ treAccounts->SelectItem(nextChild, TRUE);
+ AccCtrl->SetText(treAccounts->GetItemText(nextChild));
- }
+ }
- }
+ }
- // Switch the contact to the one passed.
+ // Switch the contact to the one passed.
- long longSelected = -1;
- int intSelectedData = 0;
+ long longSelected = -1;
+ int intSelectedData = 0;
- for (;;){
+ for (;;){
- longSelected = lstContacts->GetNextItem(longSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_DONTCARE);
+ longSelected = lstContacts->GetNextItem(longSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_DONTCARE);
- if (longSelected == -1){
+ if (longSelected == -1){
- break;
+ break;
- }
+ }
- intSelectedData = (int)lstContacts->GetItemData(longSelected);
+ intSelectedData = (int)lstContacts->GetItemData(longSelected);
- // Compare the filename with the one received.
- // If they match then select it.
+ // Compare the filename with the one received.
+ // If they match then select it.
- if (ContactsFileIndex[intSelectedData] == uc->ContactFilename){
+ if (ContactsFileIndex[intSelectedData] == uc->ContactFilename){
- // Select.
+ // Select.
- lstContacts->SetItemState(longSelected, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
- lstContacts->EnsureVisible(longSelected);
+ lstContacts->SetItemState(longSelected, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ lstContacts->EnsureVisible(longSelected);
- } else {
+ } else {
- lstContacts->SetItemState(longSelected, 0, wxLIST_STATE_SELECTED);
+ lstContacts->SetItemState(longSelected, 0, wxLIST_STATE_SELECTED);
- }
+ }
- }
+ }
}
void frmMain::DeleteContact(wxCommandEvent& event){
- // Check if a contact is selected.
+ // Delete a contact from the main window.
- long intSelected = -1;
- long intContactSeekNum = -1;
- wxString wxSContactName;
+ // Check if a contact is selected.
- intSelected = lstContacts->GetNextItem(intSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ long intSelected = -1;
+ long intContactSeekNum = -1;
+ wxString wxSContactName;
- if (intSelected == -1){
- return;
- }
+ intSelected = lstContacts->GetNextItem(intSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ if (intSelected == -1){
+ return;
+ }
- // Get the item data of the contact.
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- intContactSeekNum = lstContacts->GetItemData(intSelected);
+ // Get the item data of the contact.
- // Get the name of the contact.
+ intContactSeekNum = lstContacts->GetItemData(intSelected);
- wxSContactName = lstContacts->GetItemText(intSelected);
+ // Get the name of the contact.
- // Display a message confirming if the contact should
- // be deleted.
+ wxSContactName = lstContacts->GetItemText(intSelected);
- int QuestionResponse;
+ // Display a message confirming if the contact should
+ // be deleted.
- QuestionResponse = wxMessageBox(_("Are you sure you want to delete this contact?"), _("Delete contact"), wxYES_NO, this);
+ int QuestionResponse;
- if (QuestionResponse == wxNO){
+ QuestionResponse = wxMessageBox(_("Are you sure you want to delete this contact?"), _("Delete contact"), wxYES_NO, this);
+
+ if (QuestionResponse == wxNO){
- // Exit the subroutine
+ // Exit the subroutine
- return;
+ return;
- }
+ }
- // Delete the contact.
+ // Delete the contact.
- if (!wxRemoveFile(ContactsFileIndex[intContactSeekNum])){
+ if (!wxRemoveFile(ContactsFileIndex[intContactSeekNum])){
- wxMessageBox(_("Unable to delete the contact."), _("Cannot delete contact"), wxOK, this);
- return;
+ wxMessageBox(_("Unable to delete the contact."), _("Cannot delete contact"), wxOK, this);
+ return;
- }
+ }
- // Remove the contact from the list.
+ // Remove the contact from the list.
- lstContacts->DeleteItem(intSelected);
+ lstContacts->DeleteItem(intSelected);
- // Update the search windows, removing the deleted
- // contact.
+ // Update the search windows, removing the deleted
+ // contact.
- UCNotif *ucd = new UCNotif;
+ UCNotif *ucd = new UCNotif;
- ucd->ContactAccount = ActiveAccount;
- ucd->ContactFilename = ContactsFileIndex[intContactSeekNum];
+ ucd->ContactAccount = ActiveAccount;
+ ucd->ContactFilename = ContactsFileIndex[intContactSeekNum];
- for (std::map<void*,wxString>::iterator switer = SearchWindowList.begin();
- switer != SearchWindowList.end(); switer++){
+ for (std::map<void*,wxString>::iterator switer = SearchWindowList.begin();
+ switer != SearchWindowList.end(); switer++){
- // Duplicate the event notification data.
+ // Duplicate the event notification data.
- UCNotif *ucd2 = new UCNotif;
+ UCNotif *ucd2 = new UCNotif;
- ucd2->ContactAccount = ucd->ContactAccount;
- ucd2->ContactFilename = ucd->ContactFilename;
+ ucd2->ContactAccount = ucd->ContactAccount;
+ ucd2->ContactFilename = ucd->ContactFilename;
- // Pass the data to the search window for processing.
+ // Pass the data to the search window for processing.
- frmSearch *frameSCH = static_cast<frmSearch*>(switer->first);
- wxCommandEvent schdelete(SE_DELETERESULT);
- schdelete.SetClientData(ucd2);
- wxPostEvent(frameSCH, schdelete);
+ frmSearch *frameSCH = static_cast<frmSearch*>(switer->first);
+ wxCommandEvent schdelete(SE_DELETERESULT);
+ schdelete.SetClientData(ucd2);
+ wxPostEvent(frameSCH, schdelete);
- // Clear up the pointer prior to variable deletion.
+ // Clear up the pointer prior to variable deletion.
- frameSCH = NULL;
- ucd2 = NULL;
+ frameSCH = NULL;
+ ucd2 = NULL;
- }
+ }
- // Clear the wxHTMLWindow.
+ // Clear the wxHTMLWindow.
- wxString EmptyPage = wxT("");
+ wxString EmptyPage = wxT("");
- htmContactData->SetPage(EmptyPage);
+ htmContactData->SetPage(EmptyPage);
- wxStringTokenizer wSTFilename(ContactsFileIndex[intContactSeekNum], wxT("/"));
+ wxStringTokenizer wSTFilename(ContactsFileIndex[intContactSeekNum], wxT("/"));
- wxString wxSplitFilename;
- wxString wxSDataURL;
+ wxString wxSplitFilename;
+ wxString wxSDataURL;
- while(wSTFilename.HasMoreTokens()){
+ while(wSTFilename.HasMoreTokens()){
- wxSplitFilename = wSTFilename.GetNextToken();
+ wxSplitFilename = wSTFilename.GetNextToken();
- }
+ }
- if (ActiveAccountType == wxT("CardDAV") || ActiveAccountType == wxT("carddav")){
+ if (ActiveAccountType == wxT("CardDAV") || ActiveAccountType == wxT("carddav")){
- // Update the ETagDB and mark it as deleted.
+ // Update the ETagDB and mark it as deleted.
- ETagDB *ETagDBPtr = ETagProcTimer.GetPointer(ActiveAccount);
+ ETagDB *ETagDBPtr = ETagProcTimer.GetPointer(ActiveAccount);
- ETagDBPtr->UpdateETag(wxSplitFilename, wxT("DELETED"));
+ ETagDBPtr->UpdateETag(wxSplitFilename, wxT("DELETED"));
- // Get the Data URL.
+ // Get the Data URL.
- wxTreeItemIdValue cookie;
- wxTreeItemId next = treAccounts->GetRootItem();
+ wxTreeItemIdValue cookie;
+ wxTreeItemId next = treAccounts->GetRootItem();
- wxTreeItemId selectedChild = treAccounts->GetSelection();
- wxTreeItemId nextChild;
+ wxTreeItemId selectedChild = treAccounts->GetSelection();
+ wxTreeItemId nextChild;
- for (int i = 0; i < prefaccounts.GetCount(); i++){
+ for (int i = 0; i < prefaccounts.GetCount(); i++){
- if (!nextChild){
- nextChild = treAccounts->GetFirstChild(next, cookie);
- }
- else {
- nextChild = treAccounts->GetNextSibling(nextChild);
- }
+ if (!nextChild){
+ nextChild = treAccounts->GetFirstChild(next, cookie);
+ } else {
+ nextChild = treAccounts->GetNextSibling(nextChild);
+ }
- if (nextChild == selectedChild){
- wxSDataURL = prefaccounts.GetAccountDirPrefix(i) + wxT("/") + wxSplitFilename;
-
- }
+ if (nextChild == selectedChild){
+
+ wxSDataURL = prefaccounts.GetAccountDirPrefix(i) + wxT("/") + wxSplitFilename;
+
+ }
- }
+ }
- // Add task to the activity monitor to delete the contact.
+ // Add task to the activity monitor to delete the contact.
- frameActMgr->AddTask(2, wxSContactName, ActiveAccount, wxSDataURL, wxSplitFilename, ContactsFileIndex[intContactSeekNum], wxT(""));
+ frameActMgr->AddTask(2, wxSContactName, ActiveAccount, wxSDataURL, wxSplitFilename, ContactsFileIndex[intContactSeekNum], wxT(""));
- }
-
- // Clear the variable. Don't delete as it will mess things up.
+ }
- ContactsFileIndex[intContactSeekNum] = wxT("");
+ // Clear the variable. Don't delete as it will mess things up.
- delete ucd;
- ucd = NULL;
+ ContactsFileIndex[intContactSeekNum] = wxT("");
+ delete ucd;
+ ucd = NULL;
+
}
void frmMain::EmptyServerDialog(wxCommandEvent& event){
- QRNotif *qrn = (QRNotif *)event.GetClientData();
+ // Display this message when the server information has changed
+ // and it is empty.
+
+ QRNotif *qrn = (QRNotif *)event.GetClientData();
- int QResponse = wxMessageBox(_("The list of contacts on the server is empty. Upload all locally stored contacts for this account now?"), _("No contacts on server"), wxYES_NO, this);
+ int QResponse = wxMessageBox(_("The list of contacts on the server is empty. Upload all locally stored contacts for this account now?"), _("No contacts on server"), wxYES_NO, this);
- if (QResponse == wxNO){
+ if (QResponse == wxNO){
- return;
+ return;
- }
+ }
- wxCommandEvent event2(ACTMGR_RESUMEPROC);
- event2.SetInt(*qrn->QResponse);
- event2.SetClientData(qrn->PausePtr);
+ wxCommandEvent event2(ACTMGR_RESUMEPROC);
+ event2.SetInt(*qrn->QResponse);
+ event2.SetClientData(qrn->PausePtr);
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- wxPostEvent(frameActMgr, event2);
+ wxPostEvent(frameActMgr, event2);
}
void frmMain::DeleteContactSync(wxString &Account, wxString &Filename){
- // Remove the contact from the window after syncronising.
+ // Remove the contact from the window after syncronising.
- // Check which account is currently active in the window.
- // If it is different from the one passed to this subroutine then
- // exit from the subroutine.
+ // Check which account is currently active in the window.
+ // If it is different from the one passed to this subroutine then
+ // exit from the subroutine.
- if (Account != ActiveAccount){
- return;
- }
+ if (Account != ActiveAccount){
+ return;
+ }
- long longSelected = -1;
- int intSelectedData = 0;
+ long longSelected = -1;
+ int intSelectedData = 0;
- for (;;){
+ for (;;){
- longSelected = lstContacts->GetNextItem(longSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_DONTCARE);
+ longSelected = lstContacts->GetNextItem(longSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_DONTCARE);
- if (longSelected == -1){
+ if (longSelected == -1){
- break;
+ break;
- }
+ }
- intSelectedData = (int)lstContacts->GetItemData(longSelected);
+ intSelectedData = (int)lstContacts->GetItemData(longSelected);
- // Compare the filename with the one received.
- // If they match then select it.
+ // Compare the filename with the one received.
+ // If they match then select it.
- if (ContactsFileIndex[intSelectedData] == Filename){
+ if (ContactsFileIndex[intSelectedData] == Filename){
- // Remove the contact from the window.
+ // Remove the contact from the window.
- lstContacts->DeleteItem(intSelectedData);
+ lstContacts->DeleteItem(intSelectedData);
- // Check if contact is the selected contact in the HTML window and
- // if it is then clear the window.
+ // Check if contact is the selected contact in the HTML window and
+ // if it is then clear the window.
- if (ActiveFilename == Filename){
+ if (ActiveFilename == Filename){
- wxString EmptyPage = wxT("");
- htmContactData->SetPage(EmptyPage);
+ wxString EmptyPage = wxT("");
+ htmContactData->SetPage(EmptyPage);
- }
+ }
- break;
+ break;
- }
+ }
- }
+ }
}
void frmMain::SortFNLN( wxCommandEvent& event ) {
- wxTreeEvent NullEvent;
- SortMode = 1;
- LoadContactList(NullEvent);
+ // Sort first name then last name.
+
+ wxTreeEvent NullEvent;
+ SortMode = 1;
+ LoadContactList(NullEvent);
}
void frmMain::SortLNFN( wxCommandEvent& event ) {
- wxTreeEvent NullEvent;
- SortMode = 2;
- LoadContactList(NullEvent);
+ // Sort last name then first name.
+
+ wxTreeEvent NullEvent;
+ SortMode = 2;
+ LoadContactList(NullEvent);
}
void frmMain::SortNickname( wxCommandEvent& event ) {
- wxTreeEvent NullEvent;
- SortMode = 3;
- LoadContactList(NullEvent);
+ // Sort by nickname.
+
+ wxTreeEvent NullEvent;
+ SortMode = 3;
+ LoadContactList(NullEvent);
}
void frmMain::SortDisplayAs( wxCommandEvent& event ) {
- wxTreeEvent NullEvent;
- SortMode = 4;
- LoadContactList(NullEvent);
+ // Sort by Display As name.
+
+ wxTreeEvent NullEvent;
+ SortMode = 4;
+ LoadContactList(NullEvent);
}
void frmMain::SortAscending( wxCommandEvent& event ) {
- wxTreeEvent NullEvent;
- AscendingMode = TRUE;
- LoadContactList(NullEvent);
+ // Sort Ascending.
+
+ wxTreeEvent NullEvent;
+ AscendingMode = TRUE;
+ LoadContactList(NullEvent);
}
void frmMain::SortDescending( wxCommandEvent& event ) {
- wxTreeEvent NullEvent;
- AscendingMode = FALSE;
- LoadContactList(NullEvent);
+ // Sort Descending.
+
+ wxTreeEvent NullEvent;
+ AscendingMode = FALSE;
+ LoadContactList(NullEvent);
}
void frmMain::ToggleStatusBar( wxCommandEvent& event ) {
- if (stbBottom->IsShown() == TRUE){
+ // Toggle the appearance of the status bar.
+
+ if (stbBottom->IsShown() == TRUE){
- stbBottom->Hide();
+ stbBottom->Hide();
- } else {
+ } else {
- stbBottom->Show();
+ stbBottom->Show();
- }
+ }
- this->Layout();
+ this->Layout();
}
void frmMain::ActivityIconStart( wxCommandEvent& event ){
- // Display the activity icon.
+ // Display the activity icon.
- imgActivityStatus->SetBitmap(*imgActIcon1);
- ActivityIconStatus = 0;
+ imgActivityStatus->SetBitmap(*imgActIcon1);
+ ActivityIconStatus = 0;
}
void frmMain::ActivityIconShuffle( wxCommandEvent& event ){
-
- switch (ActivityIconStatus){
-
- case 0:
- imgActivityStatus->SetBitmap(*imgActIcon1);
- ActivityIconStatus = 1;
- break;
- case 1:
- imgActivityStatus->SetBitmap(*imgActIcon2);
- ActivityIconStatus = 2;
- break;
- case 2:
- imgActivityStatus->SetBitmap(*imgActIcon3);
- ActivityIconStatus = 3;
- break;
- case 3:
- imgActivityStatus->SetBitmap(*imgActIcon4);
- ActivityIconStatus = 0;
- break;
- default:
- ActivityIconStatus = 0;
-
- }
+
+ // Shuffle through the activity icons.
+
+ switch (ActivityIconStatus){
+
+ case 0:
+ imgActivityStatus->SetBitmap(*imgActIcon1);
+ ActivityIconStatus = 1;
+ break;
+ case 1:
+ imgActivityStatus->SetBitmap(*imgActIcon2);
+ ActivityIconStatus = 2;
+ break;
+ case 2:
+ imgActivityStatus->SetBitmap(*imgActIcon3);
+ ActivityIconStatus = 3;
+ break;
+ case 3:
+ imgActivityStatus->SetBitmap(*imgActIcon4);
+ ActivityIconStatus = 0;
+ break;
+ default:
+ ActivityIconStatus = 0;
+
+ }
}
void frmMain::ActivityIconStop( wxCommandEvent& event ){
- // Display the sleep icon.
+ // Display the sleep icon.
- imgActivityStatus->SetBitmap(*imgActIconSleep);
+ imgActivityStatus->SetBitmap(*imgActIconSleep);
}
void frmMain::UpdateSBIconPlacement( wxSizeEvent& event ){
- if (imgConnStatus == 0 || imgSSLStatus == 0 || imgActivityStatus == 0){
+ // Set the placement of the status bar icons.
+
+ if (imgConnStatus == 0 || imgSSLStatus == 0 || imgActivityStatus == 0){
- return;
+ return;
- }
+ }
- wxRect rectOnline;
- wxRect rectSSL;
- wxRect rectActivity;
- stbBottom->GetFieldRect(1, rectOnline);
- stbBottom->GetFieldRect(2, rectSSL);
- stbBottom->GetFieldRect(3, rectActivity);
+ wxRect rectOnline;
+ wxRect rectSSL;
+ wxRect rectActivity;
+ stbBottom->GetFieldRect(1, rectOnline);
+ stbBottom->GetFieldRect(2, rectSSL);
+ stbBottom->GetFieldRect(3, rectActivity);
- imgConnStatus->Move(rectOnline.GetX(),rectOnline.GetY());
- imgSSLStatus->Move(rectSSL.GetX(),rectSSL.GetY());
- imgActivityStatus->Move(rectActivity.GetX(),rectActivity.GetY());
+ imgConnStatus->Move(rectOnline.GetX(),rectOnline.GetY());
+ imgSSLStatus->Move(rectSSL.GetX(),rectSSL.GetY());
+ imgActivityStatus->Move(rectActivity.GetX(),rectActivity.GetY());
}
XABViewMode frmMain::GetViewMode(){
- XABViewMode xvm;
+ // Set the view mode of the contact list.
+
+ XABViewMode xvm;
- xvm.SortMode = SortMode;
- xvm.AscendingMode = AscendingMode;
+ xvm.SortMode = SortMode;
+ xvm.AscendingMode = AscendingMode;
- return xvm;
+ return xvm;
}
void frmMain::WindowAdd( wxCommandEvent &event ){
- WindowData *WData = (WindowData*)event.GetClientData();
+ // Add a window to the window list.
- size_t pos;
+ WindowData *WData = (WindowData*)event.GetClientData();
- if (WData->DataType == 0){
-
- // Contact Window
+ size_t pos;
+
+ if (WData->DataType == 0){
- int intID = mnuContactWindows->GetId();
+ // Contact Window
- mnuWindow->FindChildItem(intID, &pos);
- wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, wxT("Contact Window #") + wxString::Format(wxT("%i"), WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL);
- mnuNewItem->SetId(WData->WindowID);
- WindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem));
- WindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer));
- WindowListType.insert(std::make_pair(WData->WindowID, 0));
- mnuWindow->Insert((pos + 1), mnuNewItem);
- this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowContactWindow));
+ int intID = mnuContactWindows->GetId();
- } else if (WData->DataType == 1){
+ mnuWindow->FindChildItem(intID, &pos);
+ wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, wxT("Contact Window #") + wxString::Format(wxT("%i"), WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL);
+ mnuNewItem->SetId(WData->WindowID);
+ WindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem));
+ WindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer));
+ WindowListType.insert(std::make_pair(WData->WindowID, 0));
+ mnuWindow->Insert((pos + 1), mnuNewItem);
+ this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowContactWindow));
- // Contact Editor Window
+ } else if (WData->DataType == 1){
- int intID = mnuContactEditorWindows->GetId();
+ // Contact Editor Window
- mnuWindow->FindChildItem(intID, &pos);
- wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, wxT("Contact Editor Window #") + wxString::Format(wxT("%i"), WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL);
- mnuNewItem->SetId(WData->WindowID);
- WindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem));
- WindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer));
- WindowListType.insert(std::make_pair(WData->WindowID, 1));
- mnuWindow->Insert((pos + 1), mnuNewItem);
- this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowContactEditorWindow));
+ int intID = mnuContactEditorWindows->GetId();
- } else if (WData->DataType == 2){
+ mnuWindow->FindChildItem(intID, &pos);
+ wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, wxT("Contact Editor Window #") + wxString::Format(wxT("%i"), WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL);
+ mnuNewItem->SetId(WData->WindowID);
+ WindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem));
+ WindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer));
+ WindowListType.insert(std::make_pair(WData->WindowID, 1));
+ mnuWindow->Insert((pos + 1), mnuNewItem);
+ this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowContactEditorWindow));
- // Search Window
+ } else if (WData->DataType == 2){
- int intID = mnuSearchWindows->GetId();
+ // Search Window
- mnuWindow->FindChildItem(intID, &pos);
- wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, wxT("Search Window #") + wxString::Format(wxT("%i"), WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL);
- mnuNewItem->SetId(WData->WindowID);
- WindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem));
- WindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer));
- WindowListType.insert(std::make_pair(WData->WindowID, 2));
- mnuWindow->Insert((pos + 1), mnuNewItem);
- this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowSearchWindow));
+ int intID = mnuSearchWindows->GetId();
+
+ mnuWindow->FindChildItem(intID, &pos);
+ wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, wxT("Search Window #") + wxString::Format(wxT("%i"), WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL);
+ mnuNewItem->SetId(WData->WindowID);
+ WindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem));
+ WindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer));
+ WindowListType.insert(std::make_pair(WData->WindowID, 2));
+ mnuWindow->Insert((pos + 1), mnuNewItem);
+ this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowSearchWindow));
- }
+ }
- delete WData;
- WData = NULL;
+ delete WData;
+ WData = NULL;
}
void frmMain::WindowEdit( wxCommandEvent &event ){
+
+ // Edit a window in the window list.
- WindowData *WData = (WindowData*)event.GetClientData();
+ WindowData *WData = (WindowData*)event.GetClientData();
- if (WData->DataType == 0){
+ if (WData->DataType == 0){
- // Get the window title and use that.
+ // Get the window title and use that.
- frmContact *frmContactPtr = static_cast<frmContact*>(WData->WindowPointer);
+ frmContact *frmContactPtr = static_cast<frmContact*>(WData->WindowPointer);
- wxString WindowTitle = frmContactPtr->GetTitle();
+ wxString WindowTitle = frmContactPtr->GetTitle();
- std::map<int, wxMenuItem*>::iterator MenuIter = WindowListPointersMenu.find(WData->WindowID);
+ std::map<int, wxMenuItem*>::iterator MenuIter = WindowListPointersMenu.find(WData->WindowID);
- MenuIter->second->SetItemLabel(WindowTitle);
+ MenuIter->second->SetItemLabel(WindowTitle);
- } else if (WData->DataType == 1){
+ } else if (WData->DataType == 1){
- // Get the window title and use that.
+ // Get the window title and use that.
- frmContactEditor *frmCEPtr = static_cast<frmContactEditor*>(WData->WindowPointer);
+ frmContactEditor *frmCEPtr = static_cast<frmContactEditor*>(WData->WindowPointer);
- wxString WindowTitle = frmCEPtr->GetTitle();
+ wxString WindowTitle = frmCEPtr->GetTitle();
- std::map<int, wxMenuItem*>::iterator MenuIter = WindowListPointersMenu.find(WData->WindowID);
+ std::map<int, wxMenuItem*>::iterator MenuIter = WindowListPointersMenu.find(WData->WindowID);
- if (WindowTitle.IsEmpty()){
+ if (WindowTitle.IsEmpty()){
- MenuIter->second->SetItemLabel(_("Unnamed Contact"));
+ MenuIter->second->SetItemLabel(_("Unnamed Contact"));
- } else {
+ } else {
- MenuIter->second->SetItemLabel(WindowTitle);
+ MenuIter->second->SetItemLabel(WindowTitle);
- }
+ }
- }
+ }
- delete WData;
- WData = NULL;
+ delete WData;
+ WData = NULL;
}
void frmMain::WindowDelete( wxCommandEvent &event ){
- WindowData *WData = (WindowData*)event.GetClientData();
+ // Delete a window from the window list.
- std::map<int, wxMenuItem*>::iterator MenuIter = WindowListPointersMenu.find(WData->WindowID);
+ WindowData *WData = (WindowData*)event.GetClientData();
- mnuWindow->Remove(MenuIter->second);
+ std::map<int, wxMenuItem*>::iterator MenuIter = WindowListPointersMenu.find(WData->WindowID);
- delete MenuIter->second;
- MenuIter->second = NULL;
+ mnuWindow->Remove(MenuIter->second);
- WindowListPointersMenu.erase(WData->WindowID);
- WindowListPointers.erase(WData->WindowID);
- WindowListType.erase(WData->WindowID);
+ delete MenuIter->second;
+ MenuIter->second = NULL;
- delete WData;
- WData = NULL;
+ WindowListPointersMenu.erase(WData->WindowID);
+ WindowListPointers.erase(WData->WindowID);
+ WindowListType.erase(WData->WindowID);
+
+ delete WData;
+ WData = NULL;
}
void frmMain::ShowContactWindow( wxCommandEvent &event ){
- std::map<int, void*>::iterator WindowIter = WindowListPointers.find(event.GetId());
+ // Show a contact window from the window list.
+
+ std::map<int, void*>::iterator WindowIter = WindowListPointers.find(event.GetId());
- frmContact *frmContactPtr = static_cast<frmContact*>(WindowIter->second);
+ frmContact *frmContactPtr = static_cast<frmContact*>(WindowIter->second);
- frmContactPtr->Show();
- frmContactPtr->Raise();
+ frmContactPtr->Show();
+ frmContactPtr->Raise();
}
void frmMain::ShowContactEditorWindow( wxCommandEvent &event ){
- std::map<int, void*>::iterator WindowIter = WindowListPointers.find(event.GetId());
+ // Show a contact editor window from the window list.
+
+ std::map<int, void*>::iterator WindowIter = WindowListPointers.find(event.GetId());
- frmContactEditor *frmCEPtr = static_cast<frmContactEditor*>(WindowIter->second);
+ frmContactEditor *frmCEPtr = static_cast<frmContactEditor*>(WindowIter->second);
- frmCEPtr->Show();
- frmCEPtr->Raise();
+ frmCEPtr->Show();
+ frmCEPtr->Raise();
}
void frmMain::ShowSearchWindow( wxCommandEvent &event ){
- // Look through the Search Window List Pointers, grab the
- // window point and show the window.
-
- std::map<int, void*>::iterator WindowIter = WindowListPointers.find(event.GetId());
+ // Show a search window from the window list.
+
+ std::map<int, void*>::iterator WindowIter = WindowListPointers.find(event.GetId());
- frmSearch *frmSearchPtr = static_cast<frmSearch*>(WindowIter->second);
+ frmSearch *frmSearchPtr = static_cast<frmSearch*>(WindowIter->second);
- frmSearchPtr->Show();
- frmSearchPtr->Raise();
+ frmSearchPtr->Show();
+ frmSearchPtr->Raise();
}
void frmMain::ToggleConnectionStatus( wxCommandEvent &event ){
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- wxCommandEvent toggconn(ACTMGR_TOGGLECONN);
- wxPostEvent(frameActMgr, toggconn);
+ // Toggle the online/offline connection status.
+
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ wxCommandEvent toggconn(ACTMGR_TOGGLECONN);
+ wxPostEvent(frameActMgr, toggconn);
}
void frmMain::ShowSSLCertificates( wxCommandEvent &event ){
- // Check the account type before continuing.
+ // Check the account type before continuing.
- wxString SeekAccount;
- wxString AccTypeLower;
- wxString AccType;
- bool AccountSSL;
- std::map<int, SSLCertCollection>::iterator SSLColIter;
+ wxString SeekAccount;
+ wxString AccTypeLower;
+ wxString AccType;
+ bool AccountSSL;
+ std::map<int, SSLCertCollection>::iterator SSLColIter;
- for (int i = 0; i < prefaccounts.GetCount(); i++){
+ for (int i = 0; i < prefaccounts.GetCount(); i++){
- SeekAccount.Append(prefaccounts.GetAccountDirectory(i));
- AccType.Append(prefaccounts.GetAccountType(i));
- AccountSSL = prefaccounts.GetAccountSSL(i);
- AccTypeLower = AccType.MakeLower();
- SeekAccount.Append(wxT("."));
- SeekAccount.Append(AccTypeLower);
+ SeekAccount.Append(prefaccounts.GetAccountDirectory(i));
+ AccType.Append(prefaccounts.GetAccountType(i));
+ AccountSSL = prefaccounts.GetAccountSSL(i);
+ AccTypeLower = AccType.MakeLower();
+ SeekAccount.Append(wxT("."));
+ SeekAccount.Append(AccTypeLower);
- if (SeekAccount == ActiveAccount){
+ if (SeekAccount == ActiveAccount){
- if (AccTypeLower == wxT("local")){
+ if (AccTypeLower == wxT("local")){
- return;
+ return;
- }
+ }
- if (AccountSSL == false){
+ if (AccountSSL == false){
- return;
+ return;
- }
+ }
- SSLColIter = AccountSSLData.find(i);
+ SSLColIter = AccountSSLData.find(i);
- SSLCertCollection SSLCertInfo = SSLColIter->second;
+ SSLCertCollection SSLCertInfo = SSLColIter->second;
- frmSSLCertificate *frameSSLCert = new frmSSLCertificate ( this );
- frameSSLCert->StartCertFrom(0);
- frameSSLCert->SetupCerts(SSLCertInfo);
- frameSSLCert->ShowModal();
+ frmSSLCertificate *frameSSLCert = new frmSSLCertificate ( this );
+ frameSSLCert->StartCertFrom(0);
+ frameSSLCert->SetupCerts(SSLCertInfo);
+ frameSSLCert->ShowModal();
- delete frameSSLCert;
- frameSSLCert = NULL;
+ delete frameSSLCert;
+ frameSSLCert = NULL;
- }
+ }
- SeekAccount.Clear();
- AccTypeLower.Clear();
- AccType.clear();
+ SeekAccount.Clear();
+ AccTypeLower.Clear();
+ AccType.clear();
- }
+ }
}
void frmMain::ShowSSLInfo( wxCommandEvent &event ){
- // Check the account type before continuing.
+ // Check the account type before continuing.
}
void frmMain::HideSSLInfo( wxCommandEvent &event ){
- // Check the account type before continuing.
+ // Check the account type before continuing.
}
void frmMain::UpdateConnectionStatus( wxCommandEvent &event ){
- if (event.GetInt() == 0){
+ if (event.GetInt() == 0){
- imgConnStatus->SetBitmap(*imgOnline);
+ imgConnStatus->SetBitmap(*imgOnline);
- } else {
+ } else {
- imgConnStatus->SetBitmap(*imgOffline);
+ imgConnStatus->SetBitmap(*imgOffline);
- }
+ }
}
void frmMain::SetupSSLStatus( int AccountID ){
- // Check if account ID given is
- // the active account and if not, do nothing.
+ // Check if account ID given is
+ // the active account and if not, do nothing.
- wxString AccType;
- wxString AccTypeLower;
+ wxString AccType;
+ wxString AccTypeLower;
- AccType = prefaccounts.GetAccountType(AccountID);
- AccTypeLower = AccType.MakeLower();
+ AccType = prefaccounts.GetAccountType(AccountID);
+ AccTypeLower = AccType.MakeLower();
- wxString AccountIDName = prefaccounts.GetAccountDirectory(AccountID) + wxT(".") +
- AccTypeLower;
+ wxString AccountIDName = prefaccounts.GetAccountDirectory(AccountID) + wxT(".") +
+ AccTypeLower;
- if (AccountIDName != ActiveAccount){
+ if (AccountIDName != ActiveAccount){
- return;
+ return;
- }
+ }
- // Check if the account has SSL enabled.
+ // Check if the account has SSL enabled.
- bool SSLInUse = prefaccounts.GetAccountSSL(AccountID);
+ bool SSLInUse = prefaccounts.GetAccountSSL(AccountID);
- if (SSLInUse == FALSE){
+ if (SSLInUse == FALSE){
- SSLToolTip->SetTip(wxT("SSL is not enabled for this account"));
- imgSSLStatus->SetBitmap(*imgNoSSL);
+ SSLToolTip->SetTip(wxT("SSL is not enabled for this account"));
+ imgSSLStatus->SetBitmap(*imgNoSSL);
- } else {
+ } else {
- // Get the SSL Collection Data.
+ // Get the SSL Collection Data.
- std::map<int,int>::iterator SSLResultIter = AccountSSLResult.find(AccountID);
+ std::map<int,int>::iterator SSLResultIter = AccountSSLResult.find(AccountID);
- if (SSLResultIter->second == 1){
+ if (SSLResultIter->second == 1){
- imgSSLStatus->SetBitmap(*imgSSLWarning);
- SSLToolTip->SetTip(wxT("Invalid certificate(s) received for '") +
- prefaccounts.GetAccountName(AccountID) +
- wxT("' (Connection denied by user)\n\nDouble click for more information."));
+ imgSSLStatus->SetBitmap(*imgSSLWarning);
+ SSLToolTip->SetTip(wxT("Invalid certificate(s) received for '") +
+ prefaccounts.GetAccountName(AccountID) +
+ wxT("' (Connection denied by user)\n\nDouble click for more information."));
+ } else if (SSLResultIter->second == 0){
- } else if (SSLResultIter->second == 0){
+ imgSSLStatus->SetBitmap(*imgSSL);
+ SSLToolTip->SetTip(wxT("Account '") +
+ prefaccounts.GetAccountName(AccountID) +
+ wxT("' secured using SSL\n\nDouble click for more information."));
- imgSSLStatus->SetBitmap(*imgSSL);
- SSLToolTip->SetTip(wxT("Account '") +
- prefaccounts.GetAccountName(AccountID) +
- wxT("' secured using SSL\n\nDouble click for more information."));
-
- }
+ }
- }
+ }
}
void frmMain::InvalidSSLCertificate( wxCommandEvent &event ){
- frmInvalidSSLCertificate *frameISC = new frmInvalidSSLCertificate ( this );
- SSLInvalidCertNotifObj *SSLICNObj = (SSLInvalidCertNotifObj*)event.GetClientData();
- SSLCertCollection SSLCCData = SSLICNObj->CertCollection;
- wxString AccountName = SSLICNObj->AccountName;
- frameISC->LoadData(SSLCCData, AccountName);
- frameISC->ShowModal();
+ // Display the form for showing an invalid SSL certificate.
+
+ frmInvalidSSLCertificate *frameISC = new frmInvalidSSLCertificate ( this );
+ SSLInvalidCertNotifObj *SSLICNObj = (SSLInvalidCertNotifObj*)event.GetClientData();
+ SSLCertCollection SSLCCData = SSLICNObj->CertCollection;
+ wxString AccountName = SSLICNObj->AccountName;
+ frameISC->LoadData(SSLCCData, AccountName);
+ frameISC->ShowModal();
- int FinalConflictResult = frameISC->GetResult();
+ int FinalConflictResult = frameISC->GetResult();
- wxCommandEvent event2(ACTMGR_RESUMEPROC);
- event2.SetClientData(SSLICNObj->QRNotifData);
- event2.SetInt(FinalConflictResult);
+ wxCommandEvent event2(ACTMGR_RESUMEPROC);
+ event2.SetClientData(SSLICNObj->QRNotifData);
+ event2.SetInt(FinalConflictResult);
- delete frameISC;
- frameISC = NULL;
+ delete frameISC;
+ frameISC = NULL;
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- wxPostEvent(frameActMgr, event2);
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ wxPostEvent(frameActMgr, event2);
}
void frmMain::PauseAllTimers(){
- for (std::map<wxString, wxAccountSyncTimer*>::iterator ASTiter = AccountSyncTimers.begin();
- ASTiter != AccountSyncTimers.end(); ASTiter++){
+ // Pause all the account timers.
+
+ for (std::map<wxString, wxAccountSyncTimer*>::iterator ASTiter = AccountSyncTimers.begin();
+ ASTiter != AccountSyncTimers.end(); ASTiter++){
- ASTiter->second->Stop();
+ ASTiter->second->Stop();
- }
+ }
}
void frmMain::ResumeAllTimers(){
- for (std::map<wxString, wxAccountSyncTimer*>::iterator ASTiter = AccountSyncTimers.begin();
- ASTiter != AccountSyncTimers.end(); ASTiter++){
+ // Resume all the account timers.
+
+ for (std::map<wxString, wxAccountSyncTimer*>::iterator ASTiter = AccountSyncTimers.begin();
+ ASTiter != AccountSyncTimers.end(); ASTiter++){
- ASTiter->second->Start();
+ ASTiter->second->Start();
- }
+ }
}
void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollection SSLCertInc){
- // Delete existing data.
+ // Delete existing data.
- AccountSSLData.erase(AccountID);
- AccountSSLResult.erase(AccountID);
+ AccountSSLData.erase(AccountID);
+ AccountSSLResult.erase(AccountID);
- // Insert new data.
+ // Insert new data.
- AccountSSLData.insert(std::make_pair(AccountID, SSLCertInc));
- AccountSSLResult.insert(std::make_pair(AccountID, SSLStatus));
+ AccountSSLData.insert(std::make_pair(AccountID, SSLCertInc));
+ AccountSSLResult.insert(std::make_pair(AccountID, SSLStatus));
}
void frmMain::CheckUpdates( wxCommandEvent& event ){
- frmUpdate *frameUpdate = new frmUpdate ( this );
- frameUpdate->FetchData();
- frameUpdate->ShowModal();
+ // Check for updates to Xestia Address Book.
+
+ frmUpdate *frameUpdate = new frmUpdate ( this );
+ frameUpdate->FetchData();
+ frameUpdate->ShowModal();
}
void frmMain::OpenImportDialog( wxCommandEvent& event ){
- // Run the import contacts system.
+ // Run the import contacts function.
- ImportRun(this);
+ ImportRun(this);
}
void frmMain::OpenExportDialog( wxCommandEvent& event ){
- // Check if an account and at least one contact is selected
- // before continuing.
+ // Check if an account and at least one contact is selected
+ // before continuing.
- wxArrayString ArrData;
+ wxArrayString ArrData;
- if (ActiveAccount.IsEmpty()){
+ if (ActiveAccount.IsEmpty()){
- return;
+ return;
- }
+ }
- int ContactSelected = 0;
- int ContactsCollected = 0;
- long longSelected = -1;
+ int ContactSelected = 0;
+ int ContactsCollected = 0;
+ long longSelected = -1;
- for (;;){
+ for (;;){
- longSelected = lstContacts->GetNextItem(longSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ longSelected = lstContacts->GetNextItem(longSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
- if (longSelected == -1){
-
- break;
+ if (longSelected == -1){
- }
+ break;
+
+ }
- int FileID = (int)lstContacts->GetItemData(longSelected);
+ int FileID = (int)lstContacts->GetItemData(longSelected);
- ArrData.Insert(ContactsFileIndex[FileID],
+ ArrData.Insert(ContactsFileIndex[FileID],
ContactsCollected, 1);
- ContactSelected++;
+ ContactSelected++;
- }
+ }
- if (ContactSelected == 0){
+ if (ContactSelected == 0){
- return;
+ return;
- }
+ }
- // Run the export contacts system.
+ // Run the export contacts system.
- ExportRun(this, &ArrData);
+ ExportRun(this, &ArrData);
}
void frmMain::GetListControl(wxListCtrl *lstContactsPtr,
wxArrayString *ContactsFileIndexPtr){
- lstContactsPtr = lstContacts;
- ContactsFileIndexPtr = &ContactsFileIndex;
+ // Set the list control pointers.
+
+ lstContactsPtr = lstContacts;
+ ContactsFileIndexPtr = &ContactsFileIndex;
}
void frmMain::GetSelectedList( wxCommandEvent& event ){
- // Get the array of contact filenames.
+ // Get the array of contact filenames.
- wxArrayString *ArrData = (wxArrayString*)event.GetClientData();
+ wxArrayString *ArrData = (wxArrayString*)event.GetClientData();
- // Process them into an array of files.
+ // Process them into an array of files.
- long longSelected = -1;
- int ContactsCollected = 0;
- wxString ContactFilename;
+ long longSelected = -1;
+ int ContactsCollected = 0;
+ wxString ContactFilename;
- for (;;){
+ for (;;){
- longSelected = lstContacts->GetNextItem(longSelected,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ longSelected = lstContacts->GetNextItem(longSelected,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
- if (longSelected == -1){
+ if (longSelected == -1){
- break;
+ break;
- }
+ }
- // Get the file information and add to the list.
+ // Get the file information and add to the list.
- int FileID = (int)lstContacts->GetItemData(longSelected);
+ int FileID = (int)lstContacts->GetItemData(longSelected);
- ArrData->Insert(ContactsFileIndex[FileID],
- ContactsCollected, 1);
+ ArrData->Insert(ContactsFileIndex[FileID],
+ ContactsCollected, 1);
- ContactsCollected++;
- ContactFilename.Clear();
+ ContactsCollected++;
+ ContactFilename.Clear();
- }
+ }
- event.SetInt(1);
+ event.SetInt(1);
}
void frmMain::SyncAccount( wxCommandEvent& event ){
- wxString AccNameInc = event.GetString();
+ // Syncronise the selected account.
- frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
- frameActMgr->AddTask(3, wxT(""), AccNameInc,
- wxT(""), wxT(""), wxT(""), wxT(""));
+ wxString AccNameInc = event.GetString();
+
+ frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
+ frameActMgr->AddTask(3, wxT(""), AccNameInc,
+ wxT(""), wxT(""), wxT(""), wxT(""));
}
void frmMain::ShowHelp( wxCommandEvent& event ){
- // Based on the operating system, work out where
- // the documentation should be.
+ // Based on the operating system, work out where
+ // the documentation should be.
- //#ifdef __APPLE__
+//#ifdef __APPLE__
#if defined(__HAIKU__)
#else
- if (wxFileExists("/usr/share/doc/xestiaab/index.html")){
+ if (wxFileExists("/usr/share/doc/xestiaab/index.html")){
- wxLaunchDefaultBrowser(wxT("file:///usr/share/doc/xestiaab/index.html"));
- return;
+ wxLaunchDefaultBrowser(wxT("file:///usr/share/doc/xestiaab/index.html"));
+ return;
#if XSDAB_RELEASE == 0
- } else if (wxFileExists("/usr/local/share/doc/xestiaab/index.html")){
+ } else if (wxFileExists("/usr/local/share/doc/xestiaab/index.html")){
- wxLaunchDefaultBrowser(wxT("file:///usr/local/share/doc/xestiaab/index.html"));
- return;
+ wxLaunchDefaultBrowser(wxT("file:///usr/local/share/doc/xestiaab/index.html"));
+ return;
#endif
- }
+ }
#endif
#if XSDAB_RELEASE == 0
- wxMessageBox(_("The help documentation is not available.\n\nYou can view the documentation that came with your source package."), _("Help documentation missing!"));
+ wxMessageBox(_("The help documentation is not available.\n\nYou can view the documentation that came with your source package."), _("Help documentation missing!"));
#else
- wxMessageBox(_("The help documentation is not available in the usual locations on the system. Please visit http://documentation.xestia.co.uk/xestiaab/ for documentation"), _("Help documentation missing!"));
+ wxMessageBox(_("The help documentation is not available in the usual locations on the system. Please visit http://documentation.xestia.co.uk/xestiaab/ for documentation"), _("Help documentation missing!"));
#endif
void frmMain::ShowImportResults( wxCommandEvent &event ){
+ // Show the results of importing contacts.
+
std::map<int,wxString> *ResultData = (std::map<int,wxString>*)event.GetClientData();
frmImportResults *frmIR = new frmImportResults(this);
void frmMain::ShowContactMenu( wxMouseEvent& event ){
+ // Show the contact menu when a right click occurs
+ // in the contacts list.
+
bool EnableRefresh = FALSE;
if (!ActiveAccount.IsEmpty()){
}
void frmMain::ResetContactInfo(){
+
+ // Reset the contact information to an empty page.
wxString EmptyPage = wxT("");
htmContactData->SetPage(EmptyPage);