Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
camelCase: Converted code in forms directories
[xestiacalendar/.git] / source / forms / newaccount / frmNewAccount.cpp
index 9eb5d24..e3823db 100644 (file)
@@ -1,3 +1,21 @@
+// frmNewAccount.cpp - frmNewAccount form functions
+//
+// (c) 2016-2017 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar 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 Calendar 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 Calendar. If not, see <http://www.gnu.org/licenses/>
+
 #include "frmNewAccount.h"
 
 frmNewAccount::frmNewAccount( wxWindow* parent )
@@ -29,17 +47,17 @@ void frmNewAccount::ProcessPrevious( wxCommandEvent& event )
 void frmNewAccount::ProcessNext( wxCommandEvent& event )
 {
 
-       PageSeek++;
+       pageSeek++;
        
-       if (PageSeek == 1){
-               PageSeek++;
+       if (pageSeek == 1){
+               pageSeek++;
        }
     
-       if (PageSeek == 1){
+       if (pageSeek == 1){
         
                // Skip this page.
         
-       } else if (PageSeek == 2){
+       } else if (pageSeek == 2){
         
                // Finish screen.
         
@@ -51,7 +69,7 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
                btnNext->Disable();
                btnNext->SetLabel(_("Finish"));
        
-               if (txtAccountName->IsEmpty() && PageSeek == 2){
+               if (txtAccountName->IsEmpty() && pageSeek == 2){
        
                        btnNext->Disable();
            
@@ -61,19 +79,19 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
            
                }
         
-       } else if (PageSeek == 3){
+       } else if (pageSeek == 3){
         
                // Finished.
         
-               wxString XestiaCALPrefDirectory;
-               wxString XestiaCALDirectory;
-               wxString AccountSettingsFile;
+               wxString xestiaCALPrefDirectory;
+               wxString xestiaCALDirectory;
+               wxString accountSettingsFile;
                //wxFile ASFile;
                
                srand(time(0));
-               int RandomNumber = rand() % 32767;
-               wxString RandomNumberSuffix = wxString::Format(wxT("%i"), RandomNumber);
-               bool DirectoryCreated = FALSE;
+               int randomNumber = rand() % 32767;
+               wxString randomNumberSuffix = wxString::Format(wxT("%i"), randomNumber);
+               bool directoryCreated = FALSE;
         
 #if defined(__HAIKU__)
         
@@ -81,34 +99,34 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
         
 #elif defined(__WIN32__)
         
-               XestiaCALPrefDirectory = GetUserPrefDir();
-               XestiaCALDirectory = GetUserDir();
+               xestiaCALPrefDirectory = GetUserPrefDir();
+               xestiaCALDirectory = GetUserDir();
        
-               AccountSettingsFile = XestiaCALPrefDirectory + wxT("accounts");
+               accountSettingsFile = xestiaCALPrefDirectory + wxT("accounts");
         
                // Open the file for writing.
         
-               wxFileConfig *cfgfile = new wxFileConfig("", "", AccountSettingsFile);
+               wxFileConfig *cfgFile = new wxFileConfig("", "", accountSettingsFile);
         
                // Check if account name already exists and return an error message
                // if this is the case.
         
-               wxString AccountName;
-               long itemindex = 0;
-               bool ContinueAcc;
-               ContinueAcc = cfgfile->GetFirstGroup(AccountName, itemindex);
+               wxString accountName;
+               long itemIndex = 0;
+               bool continueAcc;
+               continueAcc = cfgFile->GetFirstGroup(accountName, itemIndex);
         
-               while (ContinueAcc){
+               while (continueAcc){
             
-                       if (txtAccountName->GetValue() == AccountName){
+                       if (txtAccountName->GetValue() == accountName){
                 
                                wxMessageBox(_("The selected account name is already used, please use another account name."), _("Account name already used"), wxICON_ERROR);
                                return;
                 
                        }
             
-                       cfgfile->SetPath(wxT("/"));
-                       ContinueAcc = cfgfile->GetNextGroup(AccountName, itemindex);
+                       cfgFile->SetPath(wxT("/"));
+                       continueAcc = cfgFile->GetNextGroup(accountName, itemIndex);
             
                }
         
@@ -116,17 +134,17 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
             
                        // Create the account directory.
             
-                       wxString DirectoryName = txtAccountName->GetValue().Mid(0, 30) + RandomNumberSuffix;
+                       wxString directoryName = txtAccountName->GetValue().Mid(0, 30) + randomNumberSuffix;
             
-                       if (wxMkdir(XestiaCALDirectory + wxT("\\accounts\\") + DirectoryName + wxT(".local"), 0740) == TRUE){
+                       if (wxMkdir(xestiaCALDirectory + wxT("\\accounts\\") + directoryName + wxT(".local"), 0740) == TRUE){
                 
-                               DirectoryCreated = TRUE;
+                               directoryCreated = TRUE;
                 
                        }
             
-                       if (DirectoryCreated == TRUE){
+                       if (directoryCreated == TRUE){
                 
-                               WriteAccountDetails(cfgfile, wxT("Local"), DirectoryName);
+                               WriteAccountDetails(cfgfile, wxT("Local"), directoryName);
                 
                        } else {
                 
@@ -137,41 +155,41 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
             
                }
         
-               delete cfgfile;
-               cfgfile = NULL;
+               delete cfgFile;
+               cfgFile = NULL;
         
-               *ReloadAccountConfig = TRUE;
+               *reloadAccountConfig = TRUE;
         
 #else
         
-               XestiaCALPrefDirectory = GetUserPrefDir();
-               XestiaCALDirectory = GetUserDir();
+               xestiaCALPrefDirectory = GetUserPrefDir();
+               xestiaCALDirectory = GetUserDir();
         
-               AccountSettingsFile = XestiaCALPrefDirectory + wxT("accounts");
+               accountSettingsFile = xestiaCALPrefDirectory + wxT("accounts");
         
                // Open the file for writing.
         
-               wxFileConfig *cfgfile = new wxFileConfig("", "", AccountSettingsFile);
+               wxFileConfig *cfgFile = new wxFileConfig("", "", accountSettingsFile);
         
                // Check if account name already exists and return an error message
                // if this is the case.
         
-               wxString AccountName;
-               long itemindex = 0;
-               bool ContinueAcc;
-               ContinueAcc = cfgfile->GetFirstGroup(AccountName, itemindex);
+               wxString accountName;
+               long itemIndex = 0;
+               bool continueAcc;
+               continueAcc = cfgfile->GetFirstGroup(accountName, itemIndex);
         
-               while (ContinueAcc){
+               while (continueAcc){
             
-                       if (txtAccountName->GetValue() == AccountName){
+                       if (txtAccountName->GetValue() == accountName){
                 
                                wxMessageBox(_("The selected account name is already used, please use another account name."), _("Account name already used"), wxICON_ERROR);
                                return;
                 
                        }
             
-                       cfgfile->SetPath(wxT("/"));
-                       ContinueAcc = cfgfile->GetNextGroup(AccountName, itemindex);
+                       cfgFile->SetPath(wxT("/"));
+                       continueAcc = cfgfile->GetNextGroup(accountName, itemIndex);
             
                }
         
@@ -179,17 +197,17 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
             
                        // Create the account directory.
             
-                       wxString DirectoryName = txtAccountName->GetValue().Mid(0, 30) + RandomNumberSuffix;
+                       wxString directoryName = txtAccountName->GetValue().Mid(0, 30) + randomNumberSuffix;
             
-                       if (wxMkdir(XestiaCALDirectory + wxT("/accounts/") + DirectoryName + wxT(".Local"), 0740) == TRUE){
+                       if (wxMkdir(XestiaCALDirectory + wxT("/accounts/") + directoryName + wxT(".Local"), 0740) == TRUE){
                 
-                               DirectoryCreated = TRUE;
+                               directoryCreated = TRUE;
                 
                        }
             
-                       if (DirectoryCreated == TRUE){
+                       if (directoryCreated == TRUE){
                 
-                               WriteAccountDetails(cfgfile, wxT("Local"), DirectoryName);
+                               WriteAccountDetails(cfgfile, wxT("Local"), directoryName);
                 
                        } else {
                 
@@ -203,7 +221,7 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
                delete cfgfile;
                cfgfile = NULL;
         
-               *ReloadAccountConfig = true;
+               *reloadAccountConfig = true;
                
 #endif
         
@@ -218,7 +236,7 @@ void frmNewAccount::CloseWindow( wxCommandEvent& event )
        
        // Close the window.
 
-       *ReloadAccountConfig = FALSE;
+       *reloadAccountConfig = FALSE;
        this->Close();
        
 }
@@ -227,7 +245,7 @@ void frmNewAccount::SetupPointers(bool *ReloadAccountInc, CalendarDataStorage *d
 
        // Setup the pointers for the new account window.
    
-       ReloadAccountConfig = ReloadAccountInc;
+       reloadAccountConfig = ReloadAccountInc;
     
 }
 
@@ -236,9 +254,9 @@ void frmNewAccount::CheckAccountName( wxCommandEvent& event )
     
        // Check that the account name is valid.
     
-       wxString CheckAccName = txtAccountName->GetValue();
+       wxString checkAccName = txtAccountName->GetValue();
     
-       if ((txtAccountName->IsEmpty() && PageSeek == 2) || CheckAccName.Len() < 4){
+       if ((txtAccountName->IsEmpty() && pageSeek == 2) || checkAccName.Len() < 4){
         
                btnNext->Disable();
         
@@ -250,29 +268,29 @@ void frmNewAccount::CheckAccountName( wxCommandEvent& event )
     
 }
 
-void frmNewAccount::WriteAccountDetails(wxFileConfig *cfgfilein, wxString AccountType, wxString DirectoryName){
+void frmNewAccount::WriteAccountDetails(wxFileConfig *cfgFileIn, wxString accountType, wxString directoryName){
     
        // Write the new account details.
     
-       cfgfilein->SetPath(txtAccountName->GetValue());
-       cfgfilein->Write(wxT("address"), txtServerAddress->GetValue());
-       cfgfilein->Write(wxT("port"), txtServerPort->GetValue());
-       cfgfilein->Write(wxT("username"), txtUsername->GetValue());
-       cfgfilein->Write(wxT("password"), txtPassword->GetValue());
-       cfgfilein->Write(wxT("prefix"), ServerPrefix);
-       cfgfilein->Write(wxT("accountdir"), DirectoryName);
+       cfgFileIn->SetPath(txtAccountName->GetValue());
+       cfgFileIn->Write(wxT("address"), txtServerAddress->GetValue());
+       cfgFileIn->Write(wxT("port"), txtServerPort->GetValue());
+       cfgFileIn->Write(wxT("username"), txtUsername->GetValue());
+       cfgFileIn->Write(wxT("password"), txtPassword->GetValue());
+       cfgFileIn->Write(wxT("prefix"), serverPrefix);
+       cfgFileIn->Write(wxT("accountdir"), directoryName);
     
        if (chkUseSSL->GetValue() == TRUE){
         
-               cfgfilein->Write(wxT("ssl"), wxT("true"));
+               cfgFileIn->Write(wxT("ssl"), wxT("true"));
         
        } else {
         
-               cfgfilein->Write(wxT("ssl"), wxT("false"));
+               cfgFileIn->Write(wxT("ssl"), wxT("false"));
         
        }
     
-       cfgfilein->Write(wxT("refresh"), wxT("1800"));
-       cfgfilein->Write(wxT("type"), AccountType);
+       cfgFileIn->Write(wxT("refresh"), wxT("1800"));
+       cfgFileIn->Write(wxT("type"), accountType);
     
 }
\ 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