From 54daedb29e38f1a51ab9c0fc8b075375d10f73f9 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 4 Oct 2015 15:57:54 +0100 Subject: [PATCH] Added event to allow the contact list to be reloaded. --- source/frmMain.cpp | 20 ++++++++++++++++++-- source/frmMain.h | 6 ++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/source/frmMain.cpp b/source/frmMain.cpp index d885b06..025022e 100644 --- a/source/frmMain.cpp +++ b/source/frmMain.cpp @@ -70,6 +70,7 @@ DEFINE_EVENT_TYPE(INVALIDSSLCERT); DEFINE_EVENT_TYPE(GETSELECTEDLIST); DEFINE_EVENT_TYPE(SYNCACCOUNT); DEFINE_EVENT_TYPE(IMPORT_RESULTSSHOW); +DEFINE_EVENT_TYPE(RELOADCONTACTLIST); BEGIN_EVENT_TABLE(frmMain, wxFrame) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, frmMain::ConflictResolution) @@ -92,6 +93,7 @@ EVT_COMMAND(wxID_ANY, INVALIDSSLCERT, frmMain::InvalidSSLCertificate) EVT_COMMAND(wxID_ANY, GETSELECTEDLIST, frmMain::GetSelectedList) EVT_COMMAND(wxID_ANY, SYNCACCOUNT, frmMain::SyncAccount) EVT_COMMAND(wxID_ANY, IMPORT_RESULTSSHOW, frmMain::ShowImportResults) +EVT_COMMAND(wxID_ANY, RELOADCONTACTLIST, frmMain::ReloadContactList) END_EVENT_TABLE() frmMain::frmMain( wxWindow* parent ) @@ -2761,10 +2763,10 @@ void frmMain::GetSelectedList( wxCommandEvent& event ){ void frmMain::SyncAccount( wxCommandEvent& event ){ - wxString *AccNameInc = (wxString*)event.GetClientData(); + wxString AccNameInc = event.GetString(); frmActivityMgr *frameActMgr = static_cast(ActMgrPtr); - frameActMgr->AddTask(3, wxT(""), *AccNameInc, + frameActMgr->AddTask(3, wxT(""), AccNameInc, wxT(""), wxT(""), wxT(""), wxT("")); } @@ -2828,4 +2830,18 @@ void frmMain::ShowImportResults( wxCommandEvent &event ){ delete ResultData; ResultData = NULL; +} + +void frmMain::ReloadContactList( wxCommandEvent &event ){ + + // Check if the account name given is the current + // account selected. + + if (ActiveAccount == event.GetString()){ + + wxTreeEvent NullEvent; + LoadContactList(NullEvent); + + } + } \ No newline at end of file diff --git a/source/frmMain.h b/source/frmMain.h index ca571dc..ff8ff74 100644 --- a/source/frmMain.h +++ b/source/frmMain.h @@ -49,6 +49,7 @@ DECLARE_EVENT_TYPE(INVALIDSSLCERT, wxID_ANY); DECLARE_EVENT_TYPE(GETSELECTEDLIST, wxID_ANY); DECLARE_EVENT_TYPE(SYNCACCOUNT, wxID_ANY); DECLARE_EVENT_TYPE(IMPORT_RESULTSSHOW, wxID_ANY); +DECLARE_EVENT_TYPE(RELOADCONTACTLIST, wxID_ANY); struct UCNotif{ wxString ContactAccount; @@ -161,14 +162,14 @@ class frmMain : public frmMainADT void OpenNewABDialog( wxCommandEvent& event ); void LoadPreferences( wxActivateEvent& event ); void LoadPreferences(); - void LoadContactList( wxTreeEvent& event ); void ShowContactInfo( wxListEvent& event ); void OpenContactInfo( wxListEvent& event ); void OpenContactInfo( wxCommandEvent& event ); void ShowContactEditorNew( wxCommandEvent& event ); void ShowContactEditorEdit( wxCommandEvent& event ); void RefreshAddressBook( wxCommandEvent& event ); - void ShowActivityWindow( wxCommandEvent& event ); + void ShowActivityWindow( wxCommandEvent& event ); + void LoadContactList( wxTreeEvent& event ); wxTreeItemId FindItemNamed(wxTreeCtrl &tree, const std::wstring &name); void ConflictResolution( wxCommandEvent& event ); @@ -225,6 +226,7 @@ class frmMain : public frmMainADT void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollection SSLCertInc); void GetListControl(wxListCtrl *lstContactsPtr, wxArrayString *ContactsFileIndexPtr); void ShowImportResults( wxCommandEvent& event ); + void ReloadContactList( wxCommandEvent& event ); XABViewMode GetViewMode(); DECLARE_EVENT_TABLE() -- 2.39.5