Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Capitalise Bitmaps and Tools directories
[xestiaab/.git] / source / frmPreferences.cpp
index 2b2f481..e8e3754 100644 (file)
@@ -22,8 +22,7 @@
 #include "frmMain.h"
 #include "common/preferences.h"
 #include "common/dirs.h"
-#include "bitmaps.h"
-#include "bitmaps/preferences.h"
+#include "Bitmaps.h"
 
 #include "import/import.h"
 #include "export/export.h"
@@ -145,14 +144,22 @@ void frmPreferences::ModifyABAccount( wxCommandEvent& event )
        wxString AccName;
        wxString AccType;
     
-       wxFileConfig *cfgfile = new wxFileConfig("", "", AccFilename);
+       // Check if an account has been selected before continuing.
        
-       // Get the account name.
-    
        lstAccountsIndex = lstAccounts->GetNextItem(lstAccountsIndex,
                wxLIST_NEXT_ALL,
                wxLIST_STATE_SELECTED);
        
+       if (lstAccountsIndex == -1){
+               
+               // No account has been selected so exit this subroutine.
+               
+               return;
+               
+       }
+       
+       wxFileConfig *cfgfile = new wxFileConfig("", "", AccFilename);
+       
        // Check that the account type is a supported account type.
        
        AccType = preferences->accounts.GetAccountType((int)lstAccountsIndex);
@@ -164,6 +171,8 @@ void frmPreferences::ModifyABAccount( wxCommandEvent& event )
                return;
                        
        }
+       
+       // Get the account name.
     
        AccName = preferences->accounts.GetAccountName((int)lstAccountsIndex);
     
@@ -192,6 +201,14 @@ void frmPreferences::ModifyABAccount( wxCommandEvent& event )
     
 }
 
+void frmPreferences::ModifyABAccount( wxMouseEvent& event )
+{
+       
+       wxCommandEvent NullEvent;
+       ModifyABAccount(NullEvent);
+       
+}
+
 void frmPreferences::DeleteABAccount( wxCommandEvent& event )
 {
        // Display a confirmation dialog to confirm deletion.
@@ -308,19 +325,31 @@ void frmPreferences::LoadPreferences( wxInitDialogEvent& event )
     
        bool SaveWindowPos = preferences->GetBoolData(wxT("SaveWindowPosition"));
        bool HideLocalABs = preferences->GetBoolData(wxT("HideLocalAddressBooks"));
+       bool UseBackgroundContactColour = preferences->GetBoolData(wxT("UseBackgroundContactColour"));
     
-       if (SaveWindowPos == TRUE){
+       if (SaveWindowPos == true){
     
-               chkSaveWindowPosition->SetValue(TRUE);
+               chkSaveWindowPosition->SetValue(true);
     
        }
     
-       if (HideLocalABs == TRUE){
+       if (HideLocalABs == true){
     
-               chkHideLocal->SetValue(TRUE);
+               chkHideLocal->SetValue(true);
     
        }
     
+       if (UseBackgroundContactColour == true){
+               
+               chkUseBackgroundColour->SetValue(true);
+               clpContactBackgroundColour->SetColour(preferences->GetBackgroundContactColourData());
+               
+       } else {
+               
+               clpContactBackgroundColour->Enable(false);
+               
+       }
+       
        // Setup the Themes tab.
 
        wxListItem themecol0;
@@ -457,6 +486,19 @@ void frmPreferences::SavePreferences(wxCommandEvent &event){
                *ReloadAccountConfig = TRUE;
        
        }
+       
+       if (chkUseBackgroundColour->GetValue() == TRUE){
+               
+               cfgfile->Write(wxT("UseBackgroundContactColour"), wxT("true"));
+               cfgfile->Write(wxT("BackgroundContactColour"), clpContactBackgroundColour->GetColour().GetAsString(wxC2S_HTML_SYNTAX));
+               *ReloadAccountConfig = TRUE;
+               
+       } else {
+
+               cfgfile->Write(wxT("UseBackgroundContactColour"), wxT("false"));
+               *ReloadAccountConfig = TRUE;
+               
+       }
 
        delete cfgfile;
        cfgfile = NULL;
@@ -465,10 +507,20 @@ void frmPreferences::SavePreferences(wxCommandEvent &event){
 
 }
 
+void frmPreferences::EnableBackgroundColourPicker(wxCommandEvent &event){
+       
+       if (chkUseBackgroundColour->GetValue() == true){
+               clpContactBackgroundColour->Enable(true);
+       } else {
+               clpContactBackgroundColour->Enable(false);
+       }
+       
+}
+
 void frmPreferences::CloseWindow(wxCommandEvent &event){
 
        // Close the preferences window.
        
        this->Close();
 
-}
\ No newline at end of file
+}
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