Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Remove unused function UpdateAccountList
[xestiaab/.git] / source / frmMain.cpp
index 4dc43f6..e9ce304 100644 (file)
@@ -65,7 +65,6 @@
 // Define the event types.
 
 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);
@@ -99,7 +98,6 @@ DEFINE_EVENT_TYPE(INVALIDSSLTRUST);
 BEGIN_EVENT_TABLE(frmMain, wxFrame)
 EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, frmMain::ConflictResolution)
 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)
@@ -477,6 +475,13 @@ void frmMain::ShowAboutWindow( wxCommandEvent& event )
 void frmMain::OpenPreferences( wxCommandEvent& event)
 {
 
+       // Close all windows first.
+       
+       if (CloseAllWindows() == false)
+       {
+               return;
+       }
+
        // Open the preferences window.
     
        ReloadAccounts = FALSE;
@@ -1103,7 +1108,7 @@ void frmMain::ShowContactInfo( wxListEvent& event )
     
        OldSessionID = SessionID;
        SessionID = wxString::Format(wxT("%i"), rand() % 32768);
-       LoadContactData(&Person, htmContactData, SessionID, OldSessionID, &MemoryFileList);
+       LoadContactData(&Person, htmContactData, SessionID, OldSessionID, &MemoryFileList, ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX));
        ActiveFilename = ContactsFileIndex[ContactSeekNum];
     
 }
@@ -1349,6 +1354,7 @@ void frmMain::OpenContactInfoList( wxListEvent& event )
        wxPostEvent(this, addevent);
     
        Contact->SetupPointers(&MemoryFileList);
+       Contact->SetBackgroundColour(ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX));
        Contact->SetupContactData(&Person);
     
        Contact->SetIcon(contacticon);
@@ -1406,6 +1412,7 @@ void frmMain::OpenContactInfo( wxCommandEvent& event )
        wxPostEvent(this, addevent);
     
        Contact->SetupPointers(&MemoryFileList);
+       Contact->SetBackgroundColour(ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX));
        Contact->SetupContactData(&Person);
     
        Contact->SetIcon(contacticon);
@@ -1435,13 +1442,24 @@ void frmMain::LoadPreferences(){
     
        bool SaveWindowPos = preferences.GetBoolData(wxT("SaveWindowPosition"));
        bool HideLocalABs = preferences.GetBoolData(wxT("HideLocalAddressBooks"));
+       bool UseBackgroundContactColour = preferences.GetBoolData(wxT("UseBackgroundContactColour"));
     
-       if (SaveWindowPos == TRUE){
+       if (SaveWindowPos == true){
         
                this->SetSize(preferences.GetMainWindowData());
         
        }
     
+       if (UseBackgroundContactColour == true){
+               
+               ContactBackgroundColour = preferences.GetBackgroundContactColourData();
+               
+        } else {
+                
+                ContactBackgroundColour = wxTransparentColour;
+                
+        }
+       
        treAccounts->DeleteAllItems();
     
        wxTreeItemId RootNode = treAccounts->AddRoot(wxT("Root Item"), AccountNoneID);
@@ -1494,7 +1512,7 @@ void frmMain::LoadPreferences(){
        for (int i = 0; i < preferences.accounts.GetCount(); i++){
                
                if ((preferences.accounts.GetAccountType(i) == wxT("Local") ||
-                       preferences.accounts.GetAccountType(i) == wxT("local")) && HideLocalABs == TRUE){
+                       preferences.accounts.GetAccountType(i) == wxT("local")) && HideLocalABs == true){
             
                        continue;
             
@@ -1634,7 +1652,7 @@ void frmMain::ConflictResolution(wxCommandEvent& event){
        vCardConflictObj *vCardConfObj = (vCardConflictObj*)event.GetClientData();
        vCard *ClientDataPtr = vCardConfObj->vCardLocalData;
        vCard *ServerDataPtr = vCardConfObj->vCardServerData;
-       frameCR->LoadData(ClientDataPtr, ServerDataPtr, &MemoryFileList);
+       frameCR->LoadData(ClientDataPtr, ServerDataPtr, &MemoryFileList, ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX));
        frameCR->ShowModal();
     
        int FinalConflictResult = frameCR->GetResult();
@@ -1744,6 +1762,7 @@ void frmMain::UpdateContactList(wxCommandEvent& event){
             
                        vCard UpdatedPerson;
                        UpdatedPerson.LoadFile(ucd->ContactFilename);
+                       frmContactPtr->SetBackgroundColour(ContactBackgroundColour.GetAsString(wxC2S_CSS_SYNTAX));
                        frmContactPtr->SetupContactData(&UpdatedPerson);
             
                }
@@ -1768,12 +1787,6 @@ void frmMain::UpdateContactList(wxCommandEvent& event){
     
 }
 
-void frmMain::UpdateAccountList(wxCommandEvent& event){
-    
-       // Update the account list (currently unimplemented).
-    
-}
-
 void frmMain::SetupPointers(void *ActMgrPtrInc){
     
        // Setup the pointers for the main window.
@@ -3162,7 +3175,10 @@ void frmMain::ShowContactMenu( wxMouseEvent& event ){
 
        bool EnableRefresh = FALSE;
 
-       if (!ActiveAccount.IsEmpty() && (ActiveAccountType == "CardDAV" || ActiveAccountType == "carddav")){
+       if (!ActiveAccount.IsEmpty() && (ActiveAccountType == "CardDAV" ||
+                ActiveAccountType == "carddav" ||
+                ActiveAccountType == "Local" ||
+                ActiveAccountType == "local")){
 
                EnableRefresh = TRUE;
        
@@ -3182,4 +3198,29 @@ void frmMain::ResetContactInfo(){
        htmContactData->SetPage(EmptyPage);
        AccCtrl->SetValue("");
        
-}
\ No newline at end of file
+}
+
+bool frmMain::CloseAllWindows()
+{
+       // Attempt to close all windows.
+       
+       if (WindowListPointersMenu.size() == 0)
+       {
+               return true;
+       }
+       
+       if (wxMessageBox(_("Before preforming the action, all windows that are open will need to close. Do you wish to continue?"), _("Close All Windowss"), wxYES_NO) == wxYES)
+       {
+               for(std::map<int, void*>::iterator windowIter = WindowListPointers.begin();
+                       windowIter != WindowListPointers.end(); windowIter++)
+               {
+                       wxWindow *windowPointer = static_cast<wxWindow*>(windowIter->second);
+                       windowPointer->Close();
+               }
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+}
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy