X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2FfrmMain.cpp;h=1237b82e04a32daa2275ad32d28de592dd08407b;hb=9aa5e662734659c4c8220d0f424a2fa978c2f4c9;hp=4c3755597925d9f4a3083fa51405d1b3c4918453;hpb=f204cf9df7db6a3f097e4d013b47d19577db09a7;p=xestiaab%2F.git diff --git a/source/frmMain.cpp b/source/frmMain.cpp index 4c37555..1237b82 100644 --- a/source/frmMain.cpp +++ b/source/frmMain.cpp @@ -1,3 +1,21 @@ +// frmMain.cpp - Main window form. +// +// (c) 2012-2015 Xestia Software Development. +// +// This file is part of Xestia Address Book. +// +// Xestia Address Book is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Address Book is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Address Book. If not, see + #include #include #include @@ -13,7 +31,7 @@ #include #include #include -//#include +#include // Include the forms. @@ -21,11 +39,11 @@ #include "frmAbout.h" #include "frmPreferences.h" #include "frmNewAccount.h" -#include "frmActivityMgr.h" +#include "actmgr/frmActivityMgr.h" #include "frmContact.h" #include "frmConflictResolution.h" #include "frmInvalidSSLCertificate.h" -#include "frmSearch.h" +#include "search/frmSearch.h" #include "frmSSLCertificate.h" #include "frmUpdate.h" #include "import/frmImportResults.h" @@ -40,6 +58,7 @@ #include "contacteditor/frmContactEditor.h" #include "import/import.h" #include "export/export.h" +#include "widgets/XABContactMenu.h" #include "widgets/XABAccountView.h" #include "version.h" @@ -53,7 +72,10 @@ DEFINE_EVENT_TYPE(CE_UPDATECONTACTLIST); DEFINE_EVENT_TYPE(CE_UPDATEACCOUNTLIST); DEFINE_EVENT_TYPE(SE_UPDATECONTACTNOTIF); DEFINE_EVENT_TYPE(CE_OPENCONTACT); +DEFINE_EVENT_TYPE(CE_OPENCONTACTLIST); +DEFINE_EVENT_TYPE(CE_NEWCONTACT); DEFINE_EVENT_TYPE(CE_EDITCONTACT); +DEFINE_EVENT_TYPE(CE_DELETECONTACT); DEFINE_EVENT_TYPE(CE_REVEALCONTACT); DEFINE_EVENT_TYPE(CE_REMOVECONTACT); DEFINE_EVENT_TYPE(CE_REMOVESEARCH); @@ -63,7 +85,6 @@ DEFINE_EVENT_TYPE(ACTMGR_SHUFFLE); DEFINE_EVENT_TYPE(ACTMGR_STOP); DEFINE_EVENT_TYPE(WINDOW_ADD); DEFINE_EVENT_TYPE(WINDOW_EDIT); -//DEFINE_EVENT_TYPE(WINDOW_DELETE); DEFINE_EVENT_TYPE(WINDOW_CLOSE); DEFINE_EVENT_TYPE(CONNSTAT_UPDATE); DEFINE_EVENT_TYPE(INVALIDSSLCERT); @@ -71,6 +92,7 @@ DEFINE_EVENT_TYPE(GETSELECTEDLIST); DEFINE_EVENT_TYPE(SYNCACCOUNT); DEFINE_EVENT_TYPE(IMPORT_RESULTSSHOW); DEFINE_EVENT_TYPE(RELOADCONTACTLIST); +DEFINE_EVENT_TYPE(REFRESHADDRESSBOOK); BEGIN_EVENT_TABLE(frmMain, wxFrame) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, frmMain::ConflictResolution) @@ -78,7 +100,10 @@ EVT_COMMAND(wxID_ANY, CE_UPDATECONTACTLIST, frmMain::UpdateContactList) EVT_COMMAND(wxID_ANY, CE_UPDATEACCOUNTLIST, frmMain::UpdateAccountList) EVT_COMMAND(wxID_ANY, SE_UPDATECONTACTNOTIF, frmMain::UpdateSearchContactLists) EVT_COMMAND(wxID_ANY, CE_OPENCONTACT, frmMain::OpenContactInfo) +EVT_COMMAND(wxID_ANY, CE_OPENCONTACTLIST, frmMain::OpenContactInfoList) +EVT_COMMAND(wxID_ANY, CE_NEWCONTACT, frmMain::ShowContactEditorNew) EVT_COMMAND(wxID_ANY, CE_EDITCONTACT, frmMain::ShowContactEditorEdit) +EVT_COMMAND(wxID_ANY, CE_DELETECONTACT, frmMain::DeleteContact) EVT_COMMAND(wxID_ANY, CE_REVEALCONTACT, frmMain::RevealContact) EVT_COMMAND(wxID_ANY, CE_REMOVESEARCH, frmMain::RemoveContactsWindowPointer) EVT_COMMAND(wxID_ANY, SYNC_EMPTYSERVER, frmMain::EmptyServerDialog) @@ -94,6 +119,7 @@ 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) +EVT_COMMAND(wxID_ANY, REFRESHADDRESSBOOK, frmMain::RefreshAddressBook) END_EVENT_TABLE() frmMain::frmMain( wxWindow* parent ) @@ -1248,7 +1274,7 @@ void frmMain::RefreshAddressBook( wxCommandEvent& event ){ } -void frmMain::OpenContactInfo( wxListEvent& event ) +void frmMain::OpenContactInfoList( wxListEvent& event ) { wxStringTokenizer vcardfileline; @@ -1305,6 +1331,13 @@ void frmMain::OpenContactInfo( wxListEvent& event ) } +void frmMain::OpenContactInfoList( wxCommandEvent& event ){ + + wxListEvent pevent; + OpenContactInfoList(pevent); + +} + void frmMain::OpenContactInfo( wxCommandEvent& event ) { @@ -1809,7 +1842,6 @@ void frmMain::OpenFindContactsWindow(wxCommandEvent& event){ void frmMain::RemoveContactsWindowPointer(wxCommandEvent& event){ - //frmSearch *frameSCH = static_cast(ActMgrPtr); void *frameSCH = (void*)event.GetClientData(); SearchWindowList.erase(frameSCH); @@ -1828,20 +1860,6 @@ void frmMain::RemoveContactEditorWindowPointer(wxCommandEvent& event){ } -void frmMain::UpdateWindowList(wxCommandEvent& event){ - - // Update the Window List. - - // Delete the existing items in the window menu. - - // Get the list of contacts. - - // Insert a separator. - - // Get the list of search windows. - -} - void frmMain::RevealContact(wxCommandEvent& event){ UCNotif *uc = (UCNotif*)event.GetClientData(); @@ -2354,15 +2372,7 @@ void frmMain::WindowEdit( wxCommandEvent &event ){ std::map::iterator MenuIter = WindowListPointersMenu.find(WData->WindowID); MenuIter->second->SetItemLabel(WindowTitle); - - //mnuWindow->FindChildItem(intID, &pos); - //wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, WindowTitle, WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL); - //mnuNewItem->SetId(WData->WindowID); - //ContactWindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem)); - //ContactWindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer)); - //mnuWindow->Insert((pos + 1), mnuNewItem); - //this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowContactWindow)); - + } else if (WData->DataType == 1){ // Get the window title and use that. @@ -2383,14 +2393,6 @@ void frmMain::WindowEdit( wxCommandEvent &event ){ } - //mnuWindow->FindChildItem(intID, &pos); - //wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, WindowTitle, WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL); - //mnuNewItem->SetId(WData->WindowID); - //ContactEditorWindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem)); - //ContactEditorWindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer)); - //mnuWindow->Insert((pos + 1), mnuNewItem); - //this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowContactEditorWindow)); - } delete WData; @@ -2854,4 +2856,20 @@ void frmMain::ReloadContactList( wxCommandEvent &event ){ } +} + +void frmMain::ShowContactMenu( wxMouseEvent& event ){ + + bool EnableRefresh = FALSE; + + if (!ActiveAccount.IsEmpty()){ + + EnableRefresh = TRUE; + + } + + ContactMenu->SetupPointers(this, lstContacts, EnableRefresh); + + this->PopupMenu(ContactMenu->MenuPointer(), wxDefaultPosition); + } \ No newline at end of file