From a88c6713102624e3f11c1eb254c4f1b0198d34d4 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Tue, 6 Jan 2015 17:33:37 -0500 Subject: [PATCH] MGR: In the simple attach scenario, only launch the attach wizard if we are not already attached to the project. --- clientgui/AdvancedFrame.cpp | 44 ++++++++++++++++--------------- clientgui/MainDocument.h | 2 +- clientgui/sg_BoincSimpleFrame.cpp | 32 +++++++++++----------- 3 files changed, 41 insertions(+), 37 deletions(-) diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index 50cadb5a94..6238880eb8 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -1783,29 +1783,31 @@ void CAdvancedFrame::OnConnect(CFrameEvent& WXUNUSED(event)) { strProjectName, strProjectURL, strProjectAuthenticator, strProjectInstitution, strProjectDescription, strProjectKnown ) ){ - wasShown = IsShown(); - Show(); - wasVisible = wxGetApp().IsApplicationVisible(); - if (!wasVisible) { - wxGetApp().ShowApplication(true); - } + if (!pDoc->project((char*)strProjectURL.c_str())) { + wasShown = IsShown(); + Show(); + wasVisible = wxGetApp().IsApplicationVisible(); + if (!wasVisible) { + wxGetApp().ShowApplication(true); + } - pWizard = new CWizardAttach(this); + pWizard = new CWizardAttach(this); - if (pWizard->RunSimpleProjectAttach( - wxURI::Unescape(strProjectName), - wxURI::Unescape(strProjectURL), - wxURI::Unescape(strProjectAuthenticator), - wxURI::Unescape(strProjectInstitution), - wxURI::Unescape(strProjectDescription), - wxURI::Unescape(strProjectKnown) - ) - ) { - // If successful, display the projects tab - m_pNotebook->SetSelection(ID_ADVTASKSVIEW - ID_ADVVIEWBASE); - } else { - // If failure, display the notices tab - m_pNotebook->SetSelection(ID_ADVNOTICESVIEW - ID_ADVVIEWBASE); + if (pWizard->RunSimpleProjectAttach( + wxURI::Unescape(strProjectName), + wxURI::Unescape(strProjectURL), + wxURI::Unescape(strProjectAuthenticator), + wxURI::Unescape(strProjectInstitution), + wxURI::Unescape(strProjectDescription), + wxURI::Unescape(strProjectKnown) + ) + ) { + // If successful, display the projects tab + m_pNotebook->SetSelection(ID_ADVTASKSVIEW - ID_ADVVIEWBASE); + } else { + // If failure, display the notices tab + m_pNotebook->SetSelection(ID_ADVNOTICESVIEW - ID_ADVVIEWBASE); + } } } else if (ami.acct_mgr_url.size() && ami.have_credentials) { // Fall through diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index 028537d358..8fe4b67c52 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -224,7 +224,7 @@ private: public: int CachedProjectStatusUpdate(bool bForce = false); PROJECT* project(unsigned int); - PROJECT* project(char* url); + PROJECT* project(char* url); float m_fProjectTotalResourceShare; int GetProjectCount(); diff --git a/clientgui/sg_BoincSimpleFrame.cpp b/clientgui/sg_BoincSimpleFrame.cpp index 1b37b5f855..415b20b1c0 100755 --- a/clientgui/sg_BoincSimpleFrame.cpp +++ b/clientgui/sg_BoincSimpleFrame.cpp @@ -714,23 +714,25 @@ void CSimpleFrame::OnConnect(CFrameEvent& WXUNUSED(event)) { strProjectName, strProjectURL, strProjectAuthenticator, strProjectInstitution, strProjectDescription, strProjectKnown ) ){ - wasShown = IsShown(); - Show(); - wasVisible = wxGetApp().IsApplicationVisible(); - if (!wasVisible) { - wxGetApp().ShowApplication(true); - } + if (!pDoc->project((char*)strProjectURL.c_str())) { + wasShown = IsShown(); + Show(); + wasVisible = wxGetApp().IsApplicationVisible(); + if (!wasVisible) { + wxGetApp().ShowApplication(true); + } - pWizard = new CWizardAttach(this); + pWizard = new CWizardAttach(this); - pWizard->RunSimpleProjectAttach( - wxURI::Unescape(strProjectName), - wxURI::Unescape(strProjectURL), - wxURI::Unescape(strProjectAuthenticator), - wxURI::Unescape(strProjectInstitution), - wxURI::Unescape(strProjectDescription), - wxURI::Unescape(strProjectKnown) - ); + pWizard->RunSimpleProjectAttach( + wxURI::Unescape(strProjectName), + wxURI::Unescape(strProjectURL), + wxURI::Unescape(strProjectAuthenticator), + wxURI::Unescape(strProjectInstitution), + wxURI::Unescape(strProjectDescription), + wxURI::Unescape(strProjectKnown) + ); + } } else if (ami.acct_mgr_url.size() && ami.have_credentials) { // Fall through //