JBoolean CBSymbolUpdatePG::IncrementProgress ( const JSize delta ) { return IncrementProgress(NULL, delta); }
JBoolean CBSymbolUpdatePG::IncrementProgress ( const JCharacter* message ) { return IncrementProgress(message, 1); }
void CImapCompoundDeleteFolder::DeleteLocalFolderL() { // sync manager deletes the local folder, any children entries iSyncManager.DeleteFolderContentsL((*iDeleteSel)[0]); if (!iRemoteFolderNotDeleted) { // update the sync manager's view of folders. iSyncManager.RemoveFolderL((*iDeleteSel)[0]); } // finished with this folder now, // increment the progress IncrementProgress(); iNextStep=ESelectSourceMailboxRW; }
void CImapCompoundDeleteFolder::SelectSourceMailboxL() { iFolder = NULL; iRemoteFolderNotDeleted=EFalse; // Get a temporary folder object for the delete operation, as this // can be performed on non-subscribed folders for which the sync manager // does not own a folder object. Owned by this class. iFolder = iSyncManager.GetFolderL((*iDeleteSel)[0]); if (iFolder==NULL) { IncrementProgress(); // Try with the next folder in the array, unless this was the last. if (iDeleteSel->Count()==0) { iNextStep=EFinished; } CompleteSelf(); } else { SetEntryL(iFolder->MailboxId()); TMsvEmailEntry entry = iServerEntry.Entry(); if (entry.Mailbox()) { iFolder->SelectL(iStatus, *iSession); iProgressState = TImap4GenericProgress::ESelecting; iNextStep=EDeleteAllMessages; SetActive(); } else { // do not attempt to select a folder marked \noselect // go straight to the delete folder step. iNextStep=EDeleteLocalFolder; CompleteSelf(); } } }
void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& WXUNUSED(event) ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CWizardAttachProject* pWAP = ((CWizardAttachProject*)GetParent()); ACCOUNT_IN* ai = &pWAP->account_in; ACCOUNT_OUT* ao = &pWAP->account_out; unsigned int i; PROJECT_ATTACH_REPLY reply; wxString strBuffer = wxEmptyString; wxDateTime dtStartExecutionTime; wxDateTime dtCurrentExecutionTime; wxTimeSpan tsExecutionTime; bool bPostNewEvent = true; int iReturnValue = 0; bool creating_account = false; wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); switch(GetCurrentState()) { case ATTACHPROJECT_INIT: pWAP->DisableNextButton(); pWAP->DisableBackButton(); StartProgress(m_pProgressIndicator); SetNextState(ATTACHPROJECT_ACCOUNTQUERY_BEGIN); break; case ATTACHPROJECT_ACCOUNTQUERY_BEGIN: SetNextState(ATTACHPROJECT_ACCOUNTQUERY_EXECUTE); break; case ATTACHPROJECT_ACCOUNTQUERY_EXECUTE: // Attempt to create the account or reterieve the authenticator. ai->clear(); ao->clear(); // Newer versions of the server-side software contain the correct // master url in the get_project_config response. If it is available // use it instead of what the user typed in. if (!pWAP->project_config.master_url.empty()) { ai->url = pWAP->project_config.master_url; } else { ai->url = (const char*)pWAP->m_ProjectInfoPage->GetProjectURL().mb_str(); } if (!pWAP->GetProjectAuthenticator().IsEmpty() || pWAP->m_bCredentialsCached || pWAP->m_bCredentialsDetected ) { if (!pWAP->m_bCredentialsCached || pWAP->m_bCredentialsDetected) { ao->authenticator = (const char*)pWAP->GetProjectAuthenticator().mb_str(); } SetProjectCommunitcationsSucceeded(true); } else { // Setup initial values for both the create and lookup API ai->email_addr = (const char*)pWAP->m_AccountInfoPage->GetAccountEmailAddress().mb_str(); ai->passwd = (const char*)pWAP->m_AccountInfoPage->GetAccountPassword().mb_str(); ai->user_name = (const char*)::wxGetUserName().mb_str(); ai->team_name = pWAP->team_name; if (ai->user_name.empty()) { ai->user_name = (const char*)::wxGetUserId().mb_str(); } if (pWAP->m_AccountInfoPage->m_pAccountCreateCtrl->GetValue()) { creating_account = true; // Wait until we are done processing the request. dtStartExecutionTime = wxDateTime::Now(); dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = 0; ao->error_num = ERR_RETRY; while ( !iReturnValue && ((ERR_IN_PROGRESS == ao->error_num) || (ERR_RETRY == ao->error_num)) && tsExecutionTime.GetSeconds() <= 60 && !CHECK_CLOSINGINPROGRESS() ) { if (ERR_RETRY == ao->error_num) { pDoc->rpc.create_account(*ai); } dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = pDoc->rpc.create_account_poll(*ao); IncrementProgress(m_pProgressIndicator); ::wxMilliSleep(500); ::wxSafeYield(GetParent()); } if ((!iReturnValue) && !ao->error_num) { pWAP->SetAccountCreatedSuccessfully(true); } } else { creating_account = false; // Wait until we are done processing the request. dtStartExecutionTime = wxDateTime::Now(); dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = 0; ao->error_num = ERR_RETRY; while ( !iReturnValue && ((ERR_IN_PROGRESS == ao->error_num) || (ERR_RETRY == ao->error_num)) && tsExecutionTime.GetSeconds() <= 60 && !CHECK_CLOSINGINPROGRESS() ) { if (ERR_RETRY == ao->error_num) { pDoc->rpc.lookup_account(*ai); } dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = pDoc->rpc.lookup_account_poll(*ao); IncrementProgress(m_pProgressIndicator); ::wxMilliSleep(500); ::wxSafeYield(GetParent()); } } if ((!iReturnValue) && !ao->error_num) { SetProjectCommunitcationsSucceeded(true); } else { SetProjectCommunitcationsSucceeded(false); if ((ao->error_num == ERR_DB_NOT_UNIQUE) || (ao->error_num == ERR_NONUNIQUE_EMAIL) || (ao->error_num == ERR_BAD_PASSWD && creating_account) ) { SetProjectAccountAlreadyExists(true); } else { SetProjectAccountAlreadyExists(false); } if ((ERR_NOT_FOUND == ao->error_num) || (ao->error_num == ERR_DB_NOT_FOUND) || (ERR_BAD_EMAIL_ADDR == ao->error_num) || (ERR_BAD_PASSWD == ao->error_num) ) { SetProjectAccountNotFound(true); } else { SetProjectAccountNotFound(false); } strBuffer = pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel(); if ((HTTP_STATUS_NOT_FOUND == ao->error_num)) { strBuffer += _("Required wizard file(s) are missing from the target server.\n(lookup_account.php/create_account.php)\n"); } else if ((HTTP_STATUS_INTERNAL_SERVER_ERROR == ao->error_num)) { strBuffer += _("An internal server error has occurred.\n"); } else { if (ao->error_msg.size()) { strBuffer += wxString(ao->error_msg.c_str(), wxConvUTF8) + wxString(wxT("\n")); } } pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer); } } SetNextState(ATTACHPROJECT_ATTACHPROJECT_BEGIN); break; case ATTACHPROJECT_ATTACHPROJECT_BEGIN: SetNextState(ATTACHPROJECT_ATTACHPROJECT_EXECUTE); break; case ATTACHPROJECT_ATTACHPROJECT_EXECUTE: if (GetProjectCommunitcationsSucceeded()) { // Wait until we are done processing the request. dtStartExecutionTime = wxDateTime::Now(); dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = 0; reply.error_num = ERR_RETRY; while ( !iReturnValue && ((ERR_IN_PROGRESS == reply.error_num) || (ERR_RETRY == reply.error_num)) && tsExecutionTime.GetSeconds() <= 60 && !CHECK_CLOSINGINPROGRESS() ) { if (ERR_RETRY == reply.error_num) { if (pWAP->m_bCredentialsCached) { pDoc->rpc.project_attach_from_file(); } else { pDoc->rpc.project_attach( ai->url.c_str(), ao->authenticator.c_str(), pWAP->project_config.name.c_str() ); } } dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = pDoc->rpc.project_attach_poll(reply); IncrementProgress(m_pProgressIndicator); ::wxMilliSleep(500); ::wxSafeYield(GetParent()); } if (!iReturnValue && !reply.error_num) { SetProjectAttachSucceeded(true); pWAP->SetAttachedToProjectSuccessfully(true); pWAP->SetProjectURL(wxString(ai->url.c_str(), wxConvUTF8)); pWAP->SetProjectAuthenticator(wxString(ao->authenticator.c_str(), wxConvUTF8)); } else { SetProjectAttachSucceeded(false); strBuffer = pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel(); if ((HTTP_STATUS_INTERNAL_SERVER_ERROR == reply.error_num)) { strBuffer += _("An internal server error has occurred.\n"); } else { for (i=0; i<reply.messages.size(); i++) { strBuffer += wxString(reply.messages[i].c_str(), wxConvUTF8) + wxString(wxT("\n")); } } pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(wxString(strBuffer, wxConvUTF8)); } } else { SetProjectAttachSucceeded(false); } SetNextState(ATTACHPROJECT_CLEANUP); break; case ATTACHPROJECT_CLEANUP: FinishProgress(m_pProgressIndicator); SetNextState(ATTACHPROJECT_END); break; default: // Allow a glimps of what the result was before advancing to the next page. wxSleep(1); pWAP->EnableNextButton(); pWAP->EnableBackButton(); pWAP->SimulateNextButton(); bPostNewEvent = false; break; } Update(); if (bPostNewEvent && !CHECK_CLOSINGINPROGRESS()) { CProjectProcessingPageEvent TransitionEvent(wxEVT_PROJECTPROCESSING_STATECHANGE, this); AddPendingEvent(TransitionEvent); } }
void CProjectPropertiesPage::OnStateChange( CProjectPropertiesPageEvent& WXUNUSED(event) ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CWizardAttach* pWAP = ((CWizardAttach*)GetParent()); PROJECT_CONFIG* pc = &pWAP->project_config; CC_STATUS status; wxDateTime dtStartExecutionTime; wxDateTime dtCurrentExecutionTime; wxTimeSpan tsExecutionTime; wxString strBuffer = wxEmptyString; bool bPostNewEvent = true; int iReturnValue = 0; wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); switch(GetCurrentState()) { case PROJPROP_INIT: pWAP->DisableNextButton(); pWAP->DisableBackButton(); StartProgress(m_pProgressIndicator); SetNextState(PROJPROP_RETRPROJECTPROPERTIES_BEGIN); break; case PROJPROP_RETRPROJECTPROPERTIES_BEGIN: SetNextState(PROJPROP_RETRPROJECTPROPERTIES_EXECUTE); break; case PROJPROP_RETRPROJECTPROPERTIES_EXECUTE: // Attempt to retrieve the project's account creation policies // Wait until we are done processing the request. dtStartExecutionTime = wxDateTime::Now(); dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = 0; pc->clear(); pc->error_num = ERR_RETRY; while ( !iReturnValue && ((ERR_IN_PROGRESS == pc->error_num) || (ERR_RETRY == pc->error_num)) && tsExecutionTime.GetSeconds() <= 60 && !CHECK_CLOSINGINPROGRESS() ) { if (ERR_RETRY == pc->error_num) { pDoc->rpc.get_project_config( (const char*)pWAP->m_ProjectInfoPage->GetProjectURL().mb_str() ); } dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = pDoc->rpc.get_project_config_poll(*pc); IncrementProgress(m_pProgressIndicator); ::wxMilliSleep(500); wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_USER_INPUT); } if ( !iReturnValue && (!pc->error_num || pc->error_num == ERR_ACCT_CREATION_DISABLED) ) { // We either successfully retrieved the project's // account creation policies or we were able to talk // to the web server and found out they do not support // account creation through the wizard. // In either case, claim success and set the correct flags // to show the correct 'next' page. // SetProjectPropertiesSucceeded(true); SetProjectAccountCreationDisabled(pc->account_creation_disabled); SetProjectClientAccountCreationDisabled(pc->client_account_creation_disabled); SetTermsOfUseRequired(!pc->terms_of_use.empty()); } else { SetProjectPropertiesSucceeded(false); SetProjectPropertiesURLFailure(pc->error_num == ERR_HTTP_PERMANENT); bool comm_failure = !iReturnValue && ( (ERR_GETHOSTBYNAME == pc->error_num) || (ERR_CONNECT == pc->error_num) || (ERR_XML_PARSE == pc->error_num) || (ERR_PROJECT_DOWN == pc->error_num) ); SetProjectPropertiesCommunicationFailure(comm_failure); bool server_reported_error = !iReturnValue && ( (ERR_HTTP_PERMANENT != pc->error_num) && (ERR_GETHOSTBYNAME != pc->error_num) && (ERR_CONNECT != pc->error_num) && (ERR_XML_PARSE != pc->error_num) && (ERR_PROJECT_DOWN != pc->error_num) ); SetServerReportedError(server_reported_error); if (server_reported_error) { strBuffer = pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel(); if (pc->error_msg.size()) { strBuffer += wxString(pc->error_msg.c_str(), wxConvUTF8) + wxString(wxT("\n")); } pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer); } } SetNextState(PROJPROP_DETERMINENETWORKSTATUS_BEGIN); break; case PROJPROP_DETERMINENETWORKSTATUS_BEGIN: SetNextState(PROJPROP_DETERMINENETWORKSTATUS_EXECUTE); break; case PROJPROP_DETERMINENETWORKSTATUS_EXECUTE: // Attempt to determine if we are even connected to a network // Wait until we are done processing the request. dtStartExecutionTime = wxDateTime::Now(); dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = 0; status.network_status = NETWORK_STATUS_LOOKUP_PENDING; while ((!iReturnValue && (NETWORK_STATUS_LOOKUP_PENDING == status.network_status)) && tsExecutionTime.GetSeconds() <= 60 && !CHECK_CLOSINGINPROGRESS() ) { dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = pDoc->GetCoreClientStatus(status); IncrementProgress(m_pProgressIndicator); ::wxMilliSleep(500); wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_USER_INPUT); } SetNetworkConnectionNotDetected(NETWORK_STATUS_WANT_CONNECTION == status.network_status); SetNextState(PROJPROP_DETERMINEACCOUNTINFOSTATUS_BEGIN); break; case PROJPROP_DETERMINEACCOUNTINFOSTATUS_BEGIN: SetNextState(PROJPROP_DETERMINEACCOUNTINFOSTATUS_EXECUTE); break; case PROJPROP_DETERMINEACCOUNTINFOSTATUS_EXECUTE: // Determine if the account settings are already pre-populated. // If so, advance to the Project Processing page. SetCredentialsAlreadyAvailable(pWAP->m_bCredentialsCached || pWAP->m_bCredentialsDetected); SetNextState(PROJPROP_CLEANUP); break; case PROJPROP_CLEANUP: FinishProgress(m_pProgressIndicator); SetNextState(PROJPROP_END); break; default: // Allow a glimps of what the result was before advancing to the next page. wxSleep(1); pWAP->EnableNextButton(); pWAP->EnableBackButton(); pWAP->SimulateNextButton(); bPostNewEvent = false; break; } Update(); if (bPostNewEvent && !CHECK_CLOSINGINPROGRESS()) { CProjectPropertiesPageEvent TransitionEvent(wxEVT_PROJECTPROPERTIES_STATECHANGE, this); AddPendingEvent(TransitionEvent); } }
void CAccountManagerProcessingPage::OnStateChange( CAccountManagerProcessingPageEvent& WXUNUSED(event) ) { CMainDocument* pDoc = wxGetApp().GetDocument(); CWizardAttach* pWA = ((CWizardAttach*)GetParent()); wxDateTime dtStartExecutionTime; wxDateTime dtCurrentExecutionTime; wxTimeSpan tsExecutionTime; ACCT_MGR_RPC_REPLY reply; wxString strBuffer = wxEmptyString; std::string url = ""; std::string username = ""; std::string password = ""; bool bPostNewEvent = true; int iReturnValue = 0; unsigned int i; wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); switch(GetCurrentState()) { case ATTACHACCTMGR_INIT: pWA->DisableNextButton(); pWA->DisableBackButton(); StartProgress(m_pProgressIndicator); SetNextState(ATTACHACCTMGR_ATTACHACCTMGR_BEGIN); break; case ATTACHACCTMGR_ATTACHACCTMGR_BEGIN: SetNextState(ATTACHACCTMGR_ATTACHACCTMGR_EXECUTE); break; case ATTACHACCTMGR_ATTACHACCTMGR_EXECUTE: // Attempt to attach to the account manager. // Newer versions of the server-side software contain the correct // master url in the get_project_config response. If it is available // use it instead of what the user typed in. if (!pWA->project_config.master_url.empty()) { url = pWA->project_config.master_url; } else { url = (const char*)pWA->m_AccountManagerInfoPage->GetProjectURL().mb_str(); } if (pWA->project_config.uses_username) { username = (const char*)pWA->m_AccountInfoPage->GetAccountUsername().mb_str(); } else { username = (const char*)pWA->m_AccountInfoPage->GetAccountEmailAddress().mb_str(); } password = (const char*)pWA->m_AccountInfoPage->GetAccountPassword().mb_str(); // Wait until we are done processing the request. dtStartExecutionTime = wxDateTime::Now(); dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = 0; reply.error_num = ERR_RETRY; while ( !iReturnValue && ((ERR_IN_PROGRESS == reply.error_num) || (ERR_RETRY == reply.error_num)) && (tsExecutionTime.GetSeconds() <= 60) && !CHECK_CLOSINGINPROGRESS() ) { if (ERR_RETRY == reply.error_num) { pDoc->rpc.acct_mgr_rpc( url.c_str(), username.c_str(), password.c_str(), pWA->m_bCredentialsCached ); } dtCurrentExecutionTime = wxDateTime::Now(); tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime; iReturnValue = pDoc->rpc.acct_mgr_rpc_poll(reply); IncrementProgress(m_pProgressIndicator); ::wxMilliSleep(500); wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_USER_INPUT); } if (!iReturnValue && !reply.error_num) { SetProjectAttachSucceeded(true); pWA->SetAttachedToProjectSuccessfully(true); } else { SetProjectAttachSucceeded(false); if ((ERR_NOT_FOUND == reply.error_num) || (ERR_DB_NOT_FOUND == reply.error_num) || (ERR_BAD_EMAIL_ADDR == reply.error_num) || (ERR_BAD_PASSWD == reply.error_num) ) { // For any logon error, make sure we do not attempt to use cached credentials // on any follow-ups. pWA->m_bCredentialsCached = false; SetProjectAccountNotFound(true); } else { SetProjectAccountNotFound(false); } strBuffer = pWA->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel(); if ((HTTP_STATUS_INTERNAL_SERVER_ERROR == reply.error_num)) { strBuffer += _("An internal server error has occurred.\n"); } else { for (i=0; i<reply.messages.size(); i++) { strBuffer += wxString(reply.messages[i].c_str(), wxConvUTF8) + wxString(wxT("\n")); } } pWA->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer); } SetNextState(ATTACHACCTMGR_CLEANUP); break; case ATTACHACCTMGR_CLEANUP: FinishProgress(m_pProgressIndicator); SetNextState(ATTACHACCTMGR_END); break; default: // Allow a glimps of what the result was before advancing to the next page. wxSleep(1); pWA->EnableNextButton(); pWA->EnableBackButton(); pWA->SimulateNextButton(); bPostNewEvent = false; break; } Update(); if (bPostNewEvent && !CHECK_CLOSINGINPROGRESS()) { CAccountManagerProcessingPageEvent TransitionEvent(wxEVT_ACCOUNTMANAGERPROCESSING_STATECHANGE, this); AddPendingEvent(TransitionEvent); } }