wxWizardPageEx* CAccountInfoPage::GetNext() const { if (CHECK_CLOSINGINPROGRESS()) { // Cancel Event Detected return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } else if (IS_ATTACHTOPROJECTWIZARD()) { return PAGE_TRANSITION_NEXT(ID_PROJECTPROCESSINGPAGE); } else if (IS_ACCOUNTMANAGERWIZARD()) { return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROCESSINGPAGE); } return NULL; }
wxWizardPageEx* CTermsOfUsePage::GetNext() const { if (CHECK_CLOSINGINPROGRESS()) { // Cancel Event Detected return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } else if (IS_ATTACHTOPROJECTWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) { return PAGE_TRANSITION_NEXT(ID_PROJECTPROCESSINGPAGE); } else if (IS_ACCOUNTMANAGERWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) { return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROCESSINGPAGE); } else if (GetUserAgrees()) { return PAGE_TRANSITION_NEXT(ID_ACCOUNTINFOPAGE); } else { return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } return NULL; }
void CAccountInfoPage::OnPageChanging( wxWizardExEvent& event ) { if (event.GetDirection() == false) return; CWizardAttach* pWA = ((CWizardAttach*)GetParent()); PROJECT_CONFIG& pc = pWA->project_config; wxString strTitle; wxString strMessage = wxT(""); bool bDisplayError = false; wxString strBaseConfigLocation = wxString(wxT("/Wizards")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); if (!CHECK_CLOSINGINPROGRESS()) { // We are leaving this page, so store the email address for future // use. pConfig->SetPath(strBaseConfigLocation); pConfig->Write(wxT("DefaultEmailAddress"), m_strAccountEmailAddress); pConfig->Write(wxT("DefaultUsername"), m_strAccountUsername); pConfig->Flush(); // Construct potiental dialog title if (IS_ATTACHTOPROJECTWIZARD()) { strTitle = _("Add project"); } else if (IS_ACCOUNTMANAGERWIZARD() && IS_ACCOUNTMANAGERUPDATEWIZARD()) { strTitle = _("Update account manager"); } else if (IS_ACCOUNTMANAGERWIZARD()) { strTitle = _("Use account manager"); } // Verify minimum username length if (!m_pAccountUseExistingCtrl->GetValue()) { if (!(m_pAccountPasswordCtrl->GetValue().Length() > 0)) { if (pc.uses_username) { if (IS_ATTACHTOPROJECTWIZARD()) { strMessage.Printf( _("The minimum username length for this project is 1. Please enter a different username.") ); } if (IS_ACCOUNTMANAGERWIZARD()) { strMessage.Printf( _("The minimum username length for this account manager is 1. Please enter a different username.") ); } } else { if (IS_ATTACHTOPROJECTWIZARD()) { strMessage.Printf( _("The minimum email address length for this project is 1. Please enter a different email address.") ); } if (IS_ACCOUNTMANAGERWIZARD()) { strMessage.Printf( _("The minimum email address length for this account manager is 1. Please enter a different email address.") ); } } bDisplayError = true; } } // Verify minimum password length if (!m_pAccountUseExistingCtrl->GetValue()) { if (m_pAccountPasswordCtrl->GetValue().Length() < (size_t)pc.min_passwd_length) { if (IS_ATTACHTOPROJECTWIZARD()) { strMessage.Printf( _("The minimum password length for this project is %d. Please enter a different password."), pc.min_passwd_length ); } if (IS_ACCOUNTMANAGERWIZARD()) { strMessage.Printf( _("The minimum password length for this account manager is %d. Please enter a different password."), pc.min_passwd_length ); } bDisplayError = true; } } // Verify that the password and confirmation password math. if (!IS_ACCOUNTMANAGERWIZARD() && m_pAccountCreateCtrl->GetValue()) { if (m_pAccountPasswordCtrl->GetValue() != m_pAccountConfirmPasswordCtrl->GetValue()) { strMessage = _("The password and confirmation password do not match. Please type them again."); bDisplayError = true; } } if (bDisplayError) { wxGetApp().SafeMessageBox( strMessage, strTitle, wxICON_ERROR | wxOK, this ); event.Veto(); } } }