X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2FfrmPreferences.cpp;h=e8e37540acef2289ae9fe9c3823406749676c381;hp=c9623e022068dcbe9dca5a8cc32958848ad967d5;hb=76214fdd5e820c60a468a62fa586749102310f21;hpb=77c692f2d711f7140eab5bc12ae445d307b961cc diff --git a/source/frmPreferences.cpp b/source/frmPreferences.cpp index c9623e0..e8e3754 100644 --- a/source/frmPreferences.cpp +++ b/source/frmPreferences.cpp @@ -22,7 +22,7 @@ #include "frmMain.h" #include "common/preferences.h" #include "common/dirs.h" -#include "bitmaps.h" +#include "Bitmaps.h" #include "import/import.h" #include "export/export.h" @@ -33,7 +33,6 @@ #include #include - frmPreferences::frmPreferences( wxWindow* parent ) : frmPreferencesADT( parent ) @@ -44,6 +43,17 @@ frmPreferencesADT( parent ) wxMemoryInputStream astream(icons_accinet_png, sizeof(icons_accinet_png)); wxMemoryInputStream bstream(icons_acclocal_png, sizeof(icons_acclocal_png)); wxMemoryInputStream cstream(icons_accunsupported_png, sizeof(icons_accunsupported_png)); + wxMemoryInputStream windowposstream(icons_windowpos_png, sizeof(icons_windowpos_png)); + wxMemoryInputStream hideaddressbooksstream(icons_hideaddressbooks_png, sizeof(icons_hideaddressbooks_png)); + + wxImage icons_windowpos_png(windowposstream, wxBITMAP_TYPE_PNG); + wxBitmap WindowPosition(icons_windowpos_png, -1); + + wxImage icons_hideaddressbooks_png(hideaddressbooksstream, wxBITMAP_TYPE_PNG); + wxBitmap HideAddressBooks(icons_hideaddressbooks_png, -1); + + bmpWindowPosition->SetBitmap(WindowPosition); + bmpLocalAddressBooks->SetBitmap(HideAddressBooks); wxImage icons_accinet_png(astream, wxBITMAP_TYPE_PNG); wxBitmap AccInet(icons_accinet_png, -1); @@ -134,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); @@ -153,6 +171,8 @@ void frmPreferences::ModifyABAccount( wxCommandEvent& event ) return; } + + // Get the account name. AccName = preferences->accounts.GetAccountName((int)lstAccountsIndex); @@ -181,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. @@ -297,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; @@ -446,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; @@ -454,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 +}