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.
btnNext->Disable();
btnNext->SetLabel(_("Finish"));
- if (txtAccountName->IsEmpty() && PageSeek == 2){
+ if (txtAccountName->IsEmpty() && pageSeek == 2){
btnNext->Disable();
}
- } 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__)
#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);
}
// 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 {
}
- 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);
}
// 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 {
delete cfgfile;
cfgfile = NULL;
- *ReloadAccountConfig = true;
+ *reloadAccountConfig = true;
#endif
// Close the window.
- *ReloadAccountConfig = FALSE;
+ *reloadAccountConfig = FALSE;
this->Close();
}
// Setup the pointers for the new account window.
- ReloadAccountConfig = ReloadAccountInc;
+ reloadAccountConfig = ReloadAccountInc;
}
// 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();
}
-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