X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=blobdiff_plain;f=source%2Fforms%2Fpreferences%2FfrmPreferences.cpp;h=f35fac16fc67c0439b074c52f6bfffd68a8bc05d;hp=312ae2607848b24f169c85d1d0eca219cbcdca80;hb=0c16b6458c0fdc03b94288c17d7a685b95f122fc;hpb=cba151c4b833a26c63984769f921bab5e755decd diff --git a/source/forms/preferences/frmPreferences.cpp b/source/forms/preferences/frmPreferences.cpp index 312ae26..f35fac1 100644 --- a/source/forms/preferences/frmPreferences.cpp +++ b/source/forms/preferences/frmPreferences.cpp @@ -27,20 +27,21 @@ frmPreferencesADT( parent ) wxMemoryInputStream cstream(icons_accunsupported_png, sizeof(icons_accunsupported_png)); wxImage icons_acclocal_png(bstream, wxBITMAP_TYPE_PNG); - wxBitmap AccNIcon(icons_acclocal_png, -1); + wxBitmap accNIcon(icons_acclocal_png, -1); wxIcon wxIAccNIcon; - wxIAccNIcon.CopyFromBitmap(AccNIcon); + wxIAccNIcon.CopyFromBitmap(accNIcon); wxImage icons_accunsupported_png(cstream, wxBITMAP_TYPE_PNG); - wxBitmap AccUIcon(icons_accunsupported_png, -1); + wxBitmap accUIcon(icons_accunsupported_png, -1); wxIcon wxIAccUIcon; - wxIAccUIcon.CopyFromBitmap(AccUIcon); + wxIAccUIcon.CopyFromBitmap(accUIcon); - AccountID = AccImgList->Add(wxIAccNIcon); - AccountUnsupportedID = AccImgList->Add(wxIAccUIcon); + accountID = accImgList->Add(wxIAccNIcon); + accountUnsupportedID = accImgList->Add(wxIAccUIcon); NbtPreferences->RemovePage(1); btnAccountAdd->Show(false); + NbtPreferences->ChangeSelection(0); } @@ -50,22 +51,22 @@ void frmPreferences::LoadPreferences( wxInitDialogEvent& event ) // Setup the preferences filename string. Default is the // *nix systems one (/home/$USER/.xestiacal/preferences) - preffilename = GetUserPrefDir(); + prefFilename = GetUserPrefDir(); - preferences = new XCALPreferences(preffilename); + preferences = new XCALPreferences(prefFilename); // Setup the General Tab. - bool SaveWindowPos = preferences->GetBoolData(wxT("SaveWindowPosition")); - bool HideLocalABs = preferences->GetBoolData(wxT("HideLocalCalendars")); + bool saveWindowPos = preferences->GetBoolData(wxT("SaveWindowPosition")); + bool hideLocalABs = preferences->GetBoolData(wxT("HideLocalCalendars")); - if (SaveWindowPos == TRUE){ + if (saveWindowPos == TRUE){ chkSaveWindowPosition->SetValue(TRUE); } - if (HideLocalABs == TRUE){ + if (hideLocalABs == TRUE){ chkHideLocal->SetValue(TRUE); @@ -90,8 +91,8 @@ frmPreferences::~frmPreferences(){ // Destory the preferences window. - delete AccImgList; - AccImgList = NULL; + delete accImgList; + accImgList = NULL; } @@ -99,12 +100,12 @@ void frmPreferences::ReloadAccounts(){ // Reload the accounts in the accounts list. - if (FirstLoad == FALSE){ + if (firstLoad == FALSE){ delete preferences; preferences = NULL; - preferences = new XCALPreferences(preffilename); + preferences = new XCALPreferences(prefFilename); } else { - FirstLoad = FALSE; + firstLoad = FALSE; } wxListItem accountscol0, accountscol1, accountscol2, accountscol3; @@ -114,7 +115,7 @@ void frmPreferences::ReloadAccounts(){ accountscol0.SetId(0); accountscol0.SetWidth(24); lstAccounts->InsertColumn(0,accountscol0); - lstAccounts->SetImageList(AccImgList, wxIMAGE_LIST_SMALL); + lstAccounts->SetImageList(accImgList, wxIMAGE_LIST_SMALL); accountscol1.SetId(1); accountscol1.SetText(_("Name")); @@ -126,7 +127,7 @@ void frmPreferences::ReloadAccounts(){ accountscol2.SetWidth(96); lstAccounts->InsertColumn(2,accountscol2); - wxString AccType; + wxString accType; for (int i = 0; i < preferences->accounts.GetCount() ; i++){ @@ -141,11 +142,11 @@ void frmPreferences::ReloadAccounts(){ if (preferences->accounts.GetAccountType(i) == wxT("Local")){ - col0.SetImage(AccountID); + col0.SetImage(accountID); } else { - col0.SetImage(AccountUnsupportedID); + col0.SetImage(accountUnsupportedID); } @@ -192,11 +193,11 @@ void frmPreferences::ModifyAccount( wxCommandEvent& event ) // with the settings. long lstAccountsIndex = -1; - wxString AccFilename = GetAccountsFile(); - wxString AccName; - wxString AccType; + wxString accFilename = GetAccountsFile(); + wxString accName; + wxString accType; - wxFileConfig *cfgfile = new wxFileConfig("", "", AccFilename); + wxFileConfig *cfgFile = new wxFileConfig("", "", accFilename); // Get the account name. @@ -206,38 +207,38 @@ void frmPreferences::ModifyAccount( wxCommandEvent& event ) // Check that the account type is a supported account type. - AccType = preferences->accounts.GetAccountType((int)lstAccountsIndex); + accType = preferences->accounts.GetAccountType((int)lstAccountsIndex); - if (AccType != "CardDAV" && AccType != "carddav" && - AccType != "Local" && AccType != "local"){ + if (accType != "CardDAV" && accType != "carddav" && + accType != "Local" && accType != "local"){ wxMessageBox(_("Cannot modify the selected account settings as the account type is unsupported."), _("Unsupported account type"), wxICON_ERROR); return; } - AccName = preferences->accounts.GetAccountName((int)lstAccountsIndex); + accName = preferences->accounts.GetAccountName((int)lstAccountsIndex); frmEditAccount *frameEditAccount = new frmEditAccount ( this ); - frameEditAccount->LoadPointers(cfgfile); - frameEditAccount->LoadSettings(AccName); + frameEditAccount->LoadPointers(cfgFile); + frameEditAccount->LoadSettings(accName); frameEditAccount->ShowModal(); - bool DialogResult = frameEditAccount->GetDialogResult(); + bool dialogResult = frameEditAccount->GetDialogResult(); delete frameEditAccount; frameEditAccount = NULL; - delete cfgfile; - cfgfile = NULL; + delete cfgFile; + cfgFile = NULL; - if (DialogResult == false){ + if (dialogResult == false){ return; } // Reload the account list in the preferences window. ReloadAccounts(); - *ReloadAccountConfig = TRUE; + *reloadAccountConfig = TRUE; btnAccountModify->Enable(FALSE); btnAccountDelete->Enable(FALSE); @@ -261,45 +262,45 @@ void frmPreferences::DeleteAccount( wxCommandEvent& event ) wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - bool ContinueAcc = TRUE; - wxString AccountDir; - wxString AccountType; - wxString AccountDirFull; - wxString AccountDirDelFull; - wxString AccountName; - wxString AccName; - long itemindex = 0; + bool continueAcc = TRUE; + wxString accountDir; + wxString accountType; + wxString accountDirFull; + wxString accountDirDelFull; + wxString accountName; + wxString accName; + long itemIndex = 0; - wxString AccFilename = GetAccountsFile(); + wxString accFilename = GetAccountsFile(); - wxFileConfig *cfgfile = new wxFileConfig("", "", AccFilename); + wxFileConfig *cfgFile = new wxFileConfig("", "", accFilename); - AccName = preferences->accounts.GetAccountName((int)lstAccounts->GetItemData(lstAccountsIndex)); + accName = preferences->accounts.GetAccountName((int)lstAccounts->GetItemData(lstAccountsIndex)); // Get the account directory name and account type.. - ContinueAcc = cfgfile->GetFirstGroup(AccountName, itemindex); + continueAcc = cfgFile->GetFirstGroup(accountName, itemIndex); - while (ContinueAcc){ + while (continueAcc){ - if (AccountName == AccName){ + if (accountName == accName){ - cfgfile->SetPath(AccountName); + cfgFile->SetPath(accountName); - cfgfile->Read("accountdir", &AccountDir); - cfgfile->Read("type", &AccountType); + cfgFile->Read("accountdir", &accountDir); + cfgFile->Read("type", &accountType); break; } - cfgfile->SetPath(wxT("/")); - ContinueAcc = cfgfile->GetNextGroup(AccountName, itemindex); + cfgFile->SetPath(wxT("/")); + continueAcc = cfgFile->GetNextGroup(accountName, itemIndex); } - AccountDirFull.Append(AccountDir); - AccountDirFull.Append(wxT(".")); + accountDirFull.Append(accountDir); + accountDirFull.Append(wxT(".")); /*if (AccountType == wxT("CalDAV")){ @@ -307,9 +308,9 @@ void frmPreferences::DeleteAccount( wxCommandEvent& event ) } else */ - if (AccountType == wxT("Local")){ + if (accountType == wxT("Local")){ - AccountDirFull.Append(wxT("Local")); + accountDirFull.Append(wxT("Local")); }/*else { @@ -321,25 +322,25 @@ void frmPreferences::DeleteAccount( wxCommandEvent& event ) // Delete the directory that contains the account information. - if (!AccountDirFull.IsEmpty()){ + if (!accountDirFull.IsEmpty()){ - AccountDirDelFull.Append(wxString::FromUTF8(getenv("HOME"))); - AccountDirDelFull.Append(wxT("/.xestiacal/accounts/")); - AccountDirDelFull.Append(AccountDirFull); + accountDirDelFull.Append(wxString::FromUTF8(getenv("HOME"))); + accountDirDelFull.Append(wxT("/.xestiacal/accounts/")); + accountDirDelFull.Append(accountDirFull); - wxRmDir(AccountDirDelFull); + wxRmDir(accountDirDelFull); } // Delete the account from the configuration file. - cfgfile->SetPath(wxT("/")); - cfgfile->DeleteGroup(AccountName); - cfgfile->Flush(); + cfgFile->SetPath(wxT("/")); + cfgFile->DeleteGroup(accountName); + cfgFile->Flush(); // Set flag for reloading accounts on window closure. - *ReloadAccountConfig = TRUE; + *reloadAccountConfig = TRUE; } @@ -353,21 +354,21 @@ void frmPreferences::SavePreferences( wxCommandEvent& event ) // Load up the preferences file. - wxString SetFilename = GetSettingsFile(); + wxString setFilename = GetSettingsFile(); - wxFileConfig *cfgfile = new wxFileConfig("", "", SetFilename); + wxFileConfig *cfgFile = new wxFileConfig("", "", setFilename); // Update the settings file. - cfgfile->DeleteEntry(wxT("SaveWindowPosition")); - cfgfile->DeleteEntry(wxT("WindowPositionX")); - cfgfile->DeleteEntry(wxT("WindowPositionY")); - cfgfile->DeleteEntry(wxT("WindowPositionHeight")); - cfgfile->DeleteEntry(wxT("WindowPositionWidth")); + cfgFile->DeleteEntry(wxT("SaveWindowPosition")); + cfgFile->DeleteEntry(wxT("WindowPositionX")); + cfgFile->DeleteEntry(wxT("WindowPositionY")); + cfgFile->DeleteEntry(wxT("WindowPositionHeight")); + cfgFile->DeleteEntry(wxT("WindowPositionWidth")); if (chkSaveWindowPosition->GetValue() == TRUE){ - cfgfile->Write(wxT("SaveWindowPosition"), wxT("true")); + cfgFile->Write(wxT("SaveWindowPosition"), wxT("true")); // Get parent window details. @@ -377,33 +378,33 @@ void frmPreferences::SavePreferences( wxCommandEvent& event ) wxRect frmMainPos = frmMainPtr->GetRect(); - cfgfile->Write(wxT("WindowPositionX"), frmMainPos.GetX()); - cfgfile->Write(wxT("WindowPositionY"), frmMainPos.GetY()); - cfgfile->Write(wxT("WindowPositionHeight"), frmMainPos.GetHeight()); - cfgfile->Write(wxT("WindowPositionWidth"), frmMainPos.GetWidth()); + cfgFile->Write(wxT("WindowPositionX"), frmMainPos.GetX()); + cfgFile->Write(wxT("WindowPositionY"), frmMainPos.GetY()); + cfgFile->Write(wxT("WindowPositionHeight"), frmMainPos.GetHeight()); + cfgFile->Write(wxT("WindowPositionWidth"), frmMainPos.GetWidth()); } else { - cfgfile->Write(wxT("SaveWindowPosition"), wxT("false")); + cfgFile->Write(wxT("SaveWindowPosition"), wxT("false")); } - cfgfile->DeleteEntry(wxT("HideLocalCalendars")); + cfgFile->DeleteEntry(wxT("HideLocalCalendars")); if (chkHideLocal->GetValue() == TRUE){ - cfgfile->Write(wxT("HideLocalCalendars"), wxT("true")); - *ReloadAccountConfig = TRUE; + cfgFile->Write(wxT("HideLocalCalendars"), wxT("true")); + *reloadAccountConfig = TRUE; } else { - cfgfile->Write(wxT("HideLocalCalendars"), wxT("false")); - *ReloadAccountConfig = TRUE; + cfgFile->Write(wxT("HideLocalCalendars"), wxT("false")); + *reloadAccountConfig = TRUE; } - delete cfgfile; - cfgfile = NULL; + delete cfgFile; + cfgFile = NULL; this->Close(); @@ -418,10 +419,10 @@ void frmPreferences::CloseWindow( wxCommandEvent& event ) } -void frmPreferences::SetupPointers(bool *ReloadAccountInc){ +void frmPreferences::SetupPointers(bool *reloadAccountInc){ // Setup the pointers for the preferences form. - ReloadAccountConfig = ReloadAccountInc; + reloadAccountConfig = reloadAccountInc; } \ No newline at end of file