2005-09-26 11:29:28 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
|
|
|
//
|
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This software 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 Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
//
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "ProjectPropertiesPage.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "wizardex.h"
|
|
|
|
#include "error_numbers.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "network.h"
|
|
|
|
#include "BOINCWizards.h"
|
|
|
|
#include "BOINCBaseWizard.h"
|
|
|
|
#include "WizardAttachProject.h"
|
|
|
|
#include "ProjectPropertiesPage.h"
|
|
|
|
#include "ProjectInfoPage.h"
|
|
|
|
|
|
|
|
|
|
|
|
////@begin XPM images
|
|
|
|
#include "res/wizprogress01.xpm"
|
|
|
|
#include "res/wizprogress02.xpm"
|
|
|
|
#include "res/wizprogress03.xpm"
|
|
|
|
#include "res/wizprogress04.xpm"
|
|
|
|
#include "res/wizprogress05.xpm"
|
|
|
|
#include "res/wizprogress06.xpm"
|
|
|
|
#include "res/wizprogress07.xpm"
|
|
|
|
#include "res/wizprogress08.xpm"
|
|
|
|
#include "res/wizprogress09.xpm"
|
|
|
|
#include "res/wizprogress10.xpm"
|
|
|
|
#include "res/wizprogress11.xpm"
|
|
|
|
#include "res/wizprogress12.xpm"
|
|
|
|
////@end XPM images
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CProjectPropertiesPage custom event definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
DEFINE_EVENT_TYPE(wxEVT_PROJECTPROPERTIES_STATECHANGE)
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CProjectPropertiesPage type definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS( CProjectPropertiesPage, wxWizardPageEx )
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CProjectPropertiesPage event table definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE( CProjectPropertiesPage, wxWizardPageEx )
|
|
|
|
|
|
|
|
EVT_PROJECTPROPERTIES_STATECHANGE( CProjectPropertiesPage::OnStateChange )
|
|
|
|
|
|
|
|
////@begin CProjectPropertiesPage event table entries
|
|
|
|
EVT_WIZARDEX_PAGE_CHANGED( -1, CProjectPropertiesPage::OnPageChanged )
|
|
|
|
EVT_WIZARDEX_CANCEL( -1, CProjectPropertiesPage::OnCancel )
|
|
|
|
|
|
|
|
////@end CProjectPropertiesPage event table entries
|
|
|
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CProjectPropertiesPage constructors
|
|
|
|
*/
|
|
|
|
|
|
|
|
CProjectPropertiesPage::CProjectPropertiesPage( )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CProjectPropertiesPage::CProjectPropertiesPage( CBOINCBaseWizard* parent )
|
|
|
|
{
|
|
|
|
Create( parent );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* WizardPage creator
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool CProjectPropertiesPage::Create( CBOINCBaseWizard* parent )
|
|
|
|
{
|
|
|
|
////@begin CProjectPropertiesPage member initialisation
|
|
|
|
m_ProgressIndicator = NULL;
|
|
|
|
////@end CProjectPropertiesPage member initialisation
|
|
|
|
|
|
|
|
m_bProjectPropertiesSucceeded = false;
|
|
|
|
m_bProjectPropertiesURLFailure = false;
|
|
|
|
m_bProjectAccountCreationDisabled = false;
|
|
|
|
m_bProjectClientAccountCreationDisabled = false;
|
|
|
|
m_bCommunicateYahooSucceeded = false;
|
|
|
|
m_bCommunicateGoogleSucceeded = false;
|
|
|
|
m_bDeterminingConnectionStatusSucceeded = false;
|
|
|
|
m_iBitmapIndex = 0;
|
|
|
|
m_iCurrentState = PROJPROP_INIT;
|
|
|
|
|
|
|
|
////@begin CProjectPropertiesPage creation
|
|
|
|
wxBitmap wizardBitmap(wxNullBitmap);
|
|
|
|
wxWizardPageEx::Create( parent, wizardBitmap );
|
|
|
|
|
|
|
|
CreateControls();
|
|
|
|
GetSizer()->Fit(this);
|
|
|
|
////@end CProjectPropertiesPage creation
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Control creation for WizardPage
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CProjectPropertiesPage::CreateControls()
|
|
|
|
{
|
|
|
|
////@begin CProjectPropertiesPage content construction
|
|
|
|
CProjectPropertiesPage* itemWizardPage36 = this;
|
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemWizardPage36->SetSizer(itemBoxSizer37);
|
|
|
|
|
|
|
|
wxStaticText* itemStaticText38 = new wxStaticText;
|
|
|
|
itemStaticText38->Create( itemWizardPage36, wxID_STATIC, _("Communicating with project \nPlease wait..."), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemStaticText38->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
|
|
|
|
itemBoxSizer37->Add(itemStaticText38, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
itemBoxSizer37->Add(5, 80, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
wxFlexGridSizer* itemFlexGridSizer40 = new wxFlexGridSizer(1, 3, 0, 0);
|
|
|
|
itemFlexGridSizer40->AddGrowableRow(0);
|
|
|
|
itemFlexGridSizer40->AddGrowableCol(0);
|
|
|
|
itemFlexGridSizer40->AddGrowableCol(1);
|
|
|
|
itemFlexGridSizer40->AddGrowableCol(2);
|
|
|
|
itemBoxSizer37->Add(itemFlexGridSizer40, 0, wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
itemFlexGridSizer40->Add(5, 5, 0, wxGROW|wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
wxBitmap m_ProjectPropertiesProgressBitmap(itemWizardPage36->GetBitmapResource(wxT("res/wizprogress01.xpm")));
|
|
|
|
m_ProgressIndicator = new wxStaticBitmap;
|
|
|
|
m_ProgressIndicator->Create( itemWizardPage36, ID_PROGRESSCTRL, m_ProjectPropertiesProgressBitmap, wxDefaultPosition, wxSize(184, 48), 0 );
|
|
|
|
itemFlexGridSizer40->Add(m_ProgressIndicator, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
|
|
|
|
|
|
|
itemFlexGridSizer40->Add(5, 5, 0, wxGROW|wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
////@end CProjectPropertiesPage content construction
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Gets the previous page.
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxWizardPageEx* CProjectPropertiesPage::GetPrev() const
|
|
|
|
{
|
|
|
|
return PAGE_TRANSITION_BACK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Gets the next page.
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxWizardPageEx* CProjectPropertiesPage::GetNext() const
|
|
|
|
{
|
|
|
|
if (CHECK_CLOSINGINPROGRESS()) {
|
|
|
|
// Cancel Event Detected
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
|
|
|
|
} else if (GetProjectPropertiesSucceeded() && GetProjectAlreadyAttached()) {
|
|
|
|
// Already attach to the project
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_ERRALREADYATTACHEDPAGE);
|
|
|
|
} else if (GetProjectPropertiesSucceeded() && GetProjectClientAccountCreationDisabled()) {
|
|
|
|
// Client Account Creation Disabled - Use Legacy Authentication Scheme
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_ACCOUNTKEYPAGE);
|
|
|
|
} else if (GetProjectPropertiesSucceeded()) {
|
|
|
|
// We were successful in retrieving the project properties
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_ACCOUNTINFOPAGE);
|
|
|
|
} else if (!GetProjectPropertiesSucceeded() && GetProjectPropertiesURLFailure()) {
|
|
|
|
// Not a BOINC based project
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_ERRNOTDETECTEDPAGE);
|
|
|
|
} else if ((!GetCommunicateYahooSucceeded() && !GetCommunicateGoogleSucceeded()) && GetDeterminingConnectionStatusSucceeded()) {
|
|
|
|
// Possible proxy problem
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_ERRPROXYPAGE);
|
|
|
|
} else if ((!GetCommunicateYahooSucceeded() && !GetCommunicateGoogleSucceeded()) && !GetDeterminingConnectionStatusSucceeded()) {
|
|
|
|
// No Internet Connection
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_ERRNOINTERNETCONNECTIONPAGE);
|
|
|
|
} else {
|
|
|
|
// The project much be down for maintenance
|
|
|
|
return PAGE_TRANSITION_NEXT(ID_ERRUNAVAILABLEPAGE);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Should we show tooltips?
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool CProjectPropertiesPage::ShowToolTips()
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CProjectPropertiesPage::StartProgress(wxStaticBitmap* pBitmap) {
|
|
|
|
m_iBitmapIndex = 1;
|
|
|
|
pBitmap->SetBitmap(GetBitmapResource(wxT("res/wizprogress01.xpm")));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CProjectPropertiesPage::IncrementProgress(wxStaticBitmap* pBitmap) {
|
|
|
|
m_iBitmapIndex += 1;
|
|
|
|
if (12 < m_iBitmapIndex) m_iBitmapIndex = 1;
|
|
|
|
|
|
|
|
wxString str;
|
|
|
|
str.Printf(wxT("res/wizprogress%02d.xpm"), m_iBitmapIndex);
|
|
|
|
|
|
|
|
pBitmap->SetBitmap(GetBitmapResource(str));
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CProjectPropertiesPage::FinishProgress(wxStaticBitmap* pBitmap) {
|
|
|
|
m_iBitmapIndex = 12;
|
|
|
|
pBitmap->SetBitmap(GetBitmapResource(wxT("res/wizprogress12.xpm")));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get bitmap resources
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxBitmap CProjectPropertiesPage::GetBitmapResource( const wxString& name )
|
|
|
|
{
|
|
|
|
// Bitmap retrieval
|
|
|
|
if (name == wxT("res/wizprogress01.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress01_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress02.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress02_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress03.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress03_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress04.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress04_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress05.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress05_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress06.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress06_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress07.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress07_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress08.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress08_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress09.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress09_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress10.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress10_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress11.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress11_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
else if (name == wxT("res/wizprogress12.xpm"))
|
|
|
|
{
|
|
|
|
wxBitmap bitmap(wizprogress12_xpm);
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
return wxNullBitmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get icon resources
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxIcon CProjectPropertiesPage::GetIconResource( const wxString& name )
|
|
|
|
{
|
|
|
|
// Icon retrieval
|
|
|
|
////@begin CProjectPropertiesPage icon retrieval
|
|
|
|
return wxNullIcon;
|
|
|
|
////@end CProjectPropertiesPage icon retrieval
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_PAGE_CHANGED event handler for ID_PROJECTPROPERTIESPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CProjectPropertiesPage::OnPageChanged( wxWizardExEvent& event )
|
|
|
|
{
|
|
|
|
if (event.GetDirection() == false) return;
|
|
|
|
|
|
|
|
SetProjectPropertiesSucceeded(false);
|
|
|
|
SetProjectPropertiesURLFailure(false);
|
|
|
|
SetProjectAccountCreationDisabled(false);
|
|
|
|
SetProjectClientAccountCreationDisabled(false);
|
|
|
|
SetCommunicateYahooSucceeded(false);
|
|
|
|
SetCommunicateGoogleSucceeded(false);
|
|
|
|
SetDeterminingConnectionStatusSucceeded(false);
|
|
|
|
SetNextState(PROJPROP_INIT);
|
|
|
|
|
|
|
|
CProjectPropertiesPageEvent TransitionEvent(wxEVT_PROJECTPROPERTIES_STATECHANGE, this);
|
|
|
|
AddPendingEvent(TransitionEvent);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_CANCEL event handler for ID_PROJECTPROPERTIESPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CProjectPropertiesPage::OnCancel( wxWizardExEvent& event ) {
|
|
|
|
PROCESS_CANCELEVENT(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_PROJECTPROPERTIES_STATECHANGE event handler for ID_PROJECTPROPERTIESPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CProjectPropertiesPage::OnStateChange( CProjectPropertiesPageEvent& event )
|
|
|
|
{
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
PROJECT_CONFIG* pc = &((CWizardAttachProject*)GetParent())->project_config;
|
|
|
|
wxDateTime dtStartExecutionTime;
|
|
|
|
wxDateTime dtCurrentExecutionTime;
|
|
|
|
wxTimeSpan tsExecutionTime;
|
|
|
|
bool bPostNewEvent = true;
|
|
|
|
bool bSuccessfulCondition = false;
|
|
|
|
int iReturnValue = 0;
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
switch(GetCurrentState()) {
|
|
|
|
case PROJPROP_INIT:
|
|
|
|
((CWizardAttachProject*)GetParent())->DisableNextButton();
|
|
|
|
((CWizardAttachProject*)GetParent())->DisableBackButton();
|
|
|
|
StartProgress(m_ProgressIndicator);
|
|
|
|
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
|
|
|
|
pDoc->rpc.get_project_config(
|
|
|
|
((CWizardAttachProject*)GetParent())->m_ProjectInfoPage->GetProjectURL().c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
// Wait until we are done processing the request.
|
|
|
|
dtStartExecutionTime = wxDateTime::Now();
|
|
|
|
dtCurrentExecutionTime = wxDateTime::Now();
|
|
|
|
tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime;
|
2005-09-29 00:50:19 +00:00
|
|
|
iReturnValue = 0;
|
|
|
|
pc->error_num = ERR_IN_PROGRESS;
|
|
|
|
while ((!iReturnValue && (ERR_IN_PROGRESS == pc->error_num)) &&
|
2005-09-26 11:29:28 +00:00
|
|
|
tsExecutionTime.GetSeconds() <= 60 &&
|
|
|
|
!CHECK_CLOSINGINPROGRESS()
|
|
|
|
)
|
|
|
|
{
|
|
|
|
dtCurrentExecutionTime = wxDateTime::Now();
|
|
|
|
tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime;
|
|
|
|
iReturnValue = pDoc->rpc.get_project_config_poll(*pc);
|
|
|
|
IncrementProgress(m_ProgressIndicator);
|
|
|
|
|
|
|
|
::wxMilliSleep(500);
|
|
|
|
::wxSafeYield(GetParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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 we should claim success and set the correct flags to show the
|
|
|
|
// correct 'next' page.
|
2005-09-29 00:50:19 +00:00
|
|
|
bSuccessfulCondition =
|
|
|
|
(!iReturnValue) && (!pc->error_num) ||
|
|
|
|
(!iReturnValue) && (ERR_ACCT_CREATION_DISABLED == pc->error_num);
|
2005-09-26 11:29:28 +00:00
|
|
|
if (bSuccessfulCondition && !CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTPROPERTIES)) {
|
|
|
|
SetProjectPropertiesSucceeded(true);
|
|
|
|
|
|
|
|
bSuccessfulCondition = pc->account_creation_disabled;
|
|
|
|
if (bSuccessfulCondition || CHECK_DEBUG_FLAG(WIZDEBUG_ERRACCOUNTCREATIONDISABLED)) {
|
|
|
|
SetProjectAccountCreationDisabled(true);
|
|
|
|
} else {
|
|
|
|
SetProjectAccountCreationDisabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
bSuccessfulCondition = (ERR_ALREADY_ATTACHED == pDoc->rpc.project_attach(
|
|
|
|
((CWizardAttachProject*)GetParent())->m_ProjectInfoPage->GetProjectURL().c_str(),
|
|
|
|
""
|
|
|
|
));
|
|
|
|
if (bSuccessfulCondition || CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTALREADYATTACHED)) {
|
|
|
|
SetProjectAlreadyAttached(true);
|
|
|
|
} else {
|
|
|
|
SetProjectAlreadyAttached(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
bSuccessfulCondition = pc->client_account_creation_disabled;
|
|
|
|
if (bSuccessfulCondition || CHECK_DEBUG_FLAG(WIZDEBUG_ERRCLIENTACCOUNTCREATIONDISABLED)) {
|
|
|
|
SetProjectClientAccountCreationDisabled(true);
|
|
|
|
} else {
|
|
|
|
SetProjectClientAccountCreationDisabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetNextState(PROJPROP_CLEANUP);
|
|
|
|
} else {
|
|
|
|
SetProjectPropertiesSucceeded(false);
|
2005-09-29 00:50:19 +00:00
|
|
|
bSuccessfulCondition =
|
|
|
|
(!iReturnValue) && (HTTP_STATUS_NOT_FOUND == pc->error_num) ||
|
|
|
|
(!iReturnValue) && (ERR_GETHOSTBYNAME == pc->error_num) ||
|
|
|
|
(!iReturnValue) && (ERR_XML_PARSE == pc->error_num);
|
2005-09-26 11:29:28 +00:00
|
|
|
if (bSuccessfulCondition || CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTPROPERTIESURL)) {
|
|
|
|
SetProjectPropertiesURLFailure(true);
|
|
|
|
} else {
|
|
|
|
SetProjectPropertiesURLFailure(false);
|
|
|
|
}
|
|
|
|
SetNextState(PROJPROP_COMMUNICATEYAHOO_BEGIN);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PROJPROP_COMMUNICATEYAHOO_BEGIN:
|
|
|
|
SetNextState(PROJPROP_COMMUNICATEYAHOO_EXECUTE);
|
|
|
|
break;
|
|
|
|
case PROJPROP_COMMUNICATEYAHOO_EXECUTE:
|
|
|
|
// Attempt to successfully download the Yahoo homepage
|
|
|
|
pDoc->rpc.lookup_website(LOOKUP_YAHOO);
|
|
|
|
|
|
|
|
// Wait until we are done processing the request.
|
|
|
|
dtStartExecutionTime = wxDateTime::Now();
|
|
|
|
dtCurrentExecutionTime = wxDateTime::Now();
|
|
|
|
tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime;
|
|
|
|
iReturnValue = ERR_IN_PROGRESS;
|
|
|
|
while (ERR_IN_PROGRESS == iReturnValue &&
|
|
|
|
tsExecutionTime.GetSeconds() <= 60 &&
|
|
|
|
!CHECK_CLOSINGINPROGRESS()
|
|
|
|
)
|
|
|
|
{
|
|
|
|
dtCurrentExecutionTime = wxDateTime::Now();
|
|
|
|
tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime;
|
|
|
|
iReturnValue = pDoc->rpc.lookup_website_poll();
|
|
|
|
IncrementProgress(m_ProgressIndicator);
|
|
|
|
|
|
|
|
::wxMilliSleep(500);
|
|
|
|
::wxSafeYield(GetParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((BOINC_SUCCESS == iReturnValue) && !CHECK_DEBUG_FLAG(WIZDEBUG_ERRYAHOOCOMM)) {
|
|
|
|
SetCommunicateYahooSucceeded(true);
|
|
|
|
} else {
|
|
|
|
SetCommunicateYahooSucceeded(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetNextState(PROJPROP_COMMUNICATEGOOGLE_BEGIN);
|
|
|
|
break;
|
|
|
|
case PROJPROP_COMMUNICATEGOOGLE_BEGIN:
|
|
|
|
SetNextState(PROJPROP_COMMUNICATEGOOGLE_EXECUTE);
|
|
|
|
break;
|
|
|
|
case PROJPROP_COMMUNICATEGOOGLE_EXECUTE:
|
|
|
|
// Attempt to successfully download the Google homepage
|
|
|
|
pDoc->rpc.lookup_website(LOOKUP_GOOGLE);
|
|
|
|
|
|
|
|
// Wait until we are done processing the request.
|
|
|
|
dtStartExecutionTime = wxDateTime::Now();
|
|
|
|
dtCurrentExecutionTime = wxDateTime::Now();
|
|
|
|
tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime;
|
|
|
|
iReturnValue = ERR_IN_PROGRESS;
|
|
|
|
while (ERR_IN_PROGRESS == iReturnValue &&
|
|
|
|
tsExecutionTime.GetSeconds() <= 60 &&
|
|
|
|
!CHECK_CLOSINGINPROGRESS()
|
|
|
|
)
|
|
|
|
{
|
|
|
|
dtCurrentExecutionTime = wxDateTime::Now();
|
|
|
|
tsExecutionTime = dtCurrentExecutionTime - dtStartExecutionTime;
|
|
|
|
iReturnValue = pDoc->rpc.lookup_website_poll();
|
|
|
|
IncrementProgress(m_ProgressIndicator);
|
|
|
|
|
|
|
|
::wxMilliSleep(500);
|
|
|
|
::wxSafeYield(GetParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((BOINC_SUCCESS == iReturnValue) && !CHECK_DEBUG_FLAG(WIZDEBUG_ERRGOOGLECOMM)) {
|
|
|
|
SetCommunicateGoogleSucceeded(true);
|
|
|
|
} else {
|
|
|
|
SetCommunicateGoogleSucceeded(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
bSuccessfulCondition = CONNECTED_STATE_CONNECTED == get_connected_state();
|
|
|
|
if (bSuccessfulCondition && !CHECK_DEBUG_FLAG(WIZDEBUG_ERRNETDETECTION)) {
|
|
|
|
SetDeterminingConnectionStatusSucceeded(true);
|
|
|
|
} else {
|
|
|
|
SetDeterminingConnectionStatusSucceeded(false);
|
|
|
|
}
|
|
|
|
SetNextState(PROJPROP_CLEANUP);
|
|
|
|
break;
|
|
|
|
case PROJPROP_CLEANUP:
|
|
|
|
FinishProgress(m_ProgressIndicator);
|
|
|
|
SetNextState(PROJPROP_END);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// Allow a glimps of what the result was before advancing to the next page.
|
|
|
|
wxSleep(1);
|
|
|
|
((CWizardAttachProject*)GetParent())->EnableNextButton();
|
|
|
|
((CWizardAttachProject*)GetParent())->EnableBackButton();
|
|
|
|
((CWizardAttachProject*)GetParent())->SimulateNextButton();
|
|
|
|
bPostNewEvent = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Update();
|
|
|
|
|
|
|
|
if (bPostNewEvent && !CHECK_CLOSINGINPROGRESS()) {
|
|
|
|
CProjectPropertiesPageEvent TransitionEvent(wxEVT_PROJECTPROPERTIES_STATECHANGE, this);
|
|
|
|
AddPendingEvent(TransitionEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|