Account wizard: Enable back button consistently #5107

Tested with http auth and shib auth.
This commit is contained in:
Christian Kamm 2016-08-23 15:43:43 +02:00
parent c1eb9244d1
commit 39e93768ea
3 changed files with 12 additions and 15 deletions

View File

@ -30,7 +30,6 @@ OwncloudHttpCredsPage::OwncloudHttpCredsPage(QWidget* parent)
: AbstractCredentialsWizardPage(),
_ui(),
_connected(false),
_checking(false),
_progressIndi(new QProgressIndicator (this))
{
_ui.setupUi(this);
@ -133,14 +132,20 @@ bool OwncloudHttpCredsPage::validatePage()
if (!_connected) {
_ui.errorLabel->setVisible(false);
_checking = true;
startSpinner();
// Reset cookies to ensure the username / password is actually used
OwncloudWizard* ocWizard = qobject_cast< OwncloudWizard* >(wizard());
ocWizard->account()->clearCookieJar();
emit completeChanged();
emit connectToOCUrl(field("OCUrl").toString().simplified());
return false;
} else {
_checking = false;
// Reset, to require another connection attempt next time
_connected = false;
emit completeChanged();
stopSpinner();
return true;
@ -153,9 +158,9 @@ int OwncloudHttpCredsPage::nextId() const
return WizardCommon::Page_AdvancedSetup;
}
void OwncloudHttpCredsPage::setConnected( bool comp )
void OwncloudHttpCredsPage::setConnected()
{
_connected = comp;
_connected = true;
stopSpinner ();
}
@ -181,7 +186,6 @@ void OwncloudHttpCredsPage::setErrorString(const QString& err)
_ui.errorLabel->setVisible(true);
_ui.errorLabel->setText(err);
}
_checking = false;
emit completeChanged();
stopSpinner();
}

View File

@ -40,7 +40,7 @@ public:
void cleanupPage() Q_DECL_OVERRIDE;
bool validatePage() Q_DECL_OVERRIDE;
int nextId() const Q_DECL_OVERRIDE;
void setConnected(bool connected);
void setConnected();
void setErrorString( const QString& err );
Q_SIGNALS:
@ -53,7 +53,6 @@ private:
Ui_OwncloudHttpCredsPage _ui;
bool _connected;
bool _checking;
QProgressIndicator* _progressIndi;
OwncloudWizard* _ocWizard;
};

View File

@ -125,7 +125,7 @@ void OwncloudWizard::successfulStep()
switch (id) {
case WizardCommon::Page_HttpCreds:
_httpCredsPage->setConnected(true);
_httpCredsPage->setConnected();
break;
case WizardCommon::Page_ShibbolethCreds:
@ -172,12 +172,6 @@ void OwncloudWizard::slotCurrentPageChanged( int id )
}
setOption(QWizard::HaveCustomButton1, id == WizardCommon::Page_AdvancedSetup);
if (id == WizardCommon::Page_AdvancedSetup) {
// Going back from this page messes the state as the account is created already
button(QWizard::BackButton)->setDisabled(true);
}
}
void OwncloudWizard::displayError( const QString& msg, bool retryHTTPonly )