mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Fix workflow in wizard.
Pressing back in third window should show us browser again. Closing browser window should show us server setup window again.
This commit is contained in:
parent
577bc546d8
commit
e1d1c10fad
4 changed files with 59 additions and 15 deletions
|
@ -49,4 +49,10 @@ void ShibbolethWebView::onNewCookiesForUrl (const QList<QNetworkCookie>& cookieL
|
|||
}
|
||||
}
|
||||
|
||||
void ShibbolethWebView::hideEvent(QHideEvent* event)
|
||||
{
|
||||
Q_EMIT viewHidden();
|
||||
QWebView::hideEvent(event);
|
||||
}
|
||||
|
||||
} // ns Mirall
|
||||
|
|
|
@ -30,8 +30,12 @@ class ShibbolethWebView : public QWebView
|
|||
public:
|
||||
ShibbolethWebView(const QUrl& url, QWidget* parent = 0);
|
||||
|
||||
protected:
|
||||
void hideEvent(QHideEvent* event);
|
||||
|
||||
Q_SIGNALS:
|
||||
void shibbolethCookieReceived (const QNetworkCookie& cookie);
|
||||
void viewHidden();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onNewCookiesForUrl (const QList<QNetworkCookie>& cookieList, const QUrl& url);
|
||||
|
|
|
@ -25,7 +25,8 @@ OwncloudShibbolethCredsPage::OwncloudShibbolethCredsPage()
|
|||
_ui(),
|
||||
_stage(INITIAL_STEP),
|
||||
_browser(0),
|
||||
_cookie()
|
||||
_cookie(),
|
||||
_afterInitialSetup(false)
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
|
@ -56,19 +57,38 @@ bool OwncloudShibbolethCredsPage::isComplete() const
|
|||
return _stage == GOT_COOKIE;
|
||||
}
|
||||
|
||||
void OwncloudShibbolethCredsPage::setVisible(bool visible)
|
||||
{
|
||||
if (!_afterInitialSetup) {
|
||||
QWizardPage::setVisible(visible);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isVisible() == visible) {
|
||||
return;
|
||||
}
|
||||
if (_browser) {
|
||||
disposeBrowser(true);
|
||||
}
|
||||
if (visible) {
|
||||
_browser = new ShibbolethWebView(QUrl(field("OCUrl").toString().simplified()));
|
||||
connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)),
|
||||
this, SLOT(slotShibbolethCookieReceived(QNetworkCookie)));
|
||||
connect(_browser, SIGNAL(viewHidden()),
|
||||
this, SLOT(slotViewHidden()));
|
||||
|
||||
_browser->show();
|
||||
_browser->setFocus();
|
||||
wizard()->hide();
|
||||
} else {
|
||||
wizard()->show();
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudShibbolethCredsPage::initializePage()
|
||||
{
|
||||
WizardCommon::initErrorLabel(_ui.errorLabel);
|
||||
_browser = new ShibbolethWebView(QUrl(field("OCUrl").toString().simplified()));
|
||||
|
||||
_browser->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)),
|
||||
this, SLOT(onShibbolethCookieReceived(QNetworkCookie)));
|
||||
|
||||
//_ui.contentLayout->insertWidget(0, _browser);
|
||||
_browser->show();
|
||||
_browser->setFocus();
|
||||
wizard()->hide();
|
||||
_afterInitialSetup = true;
|
||||
_ui.infoLabel->show();
|
||||
_ui.infoLabel->setText(tr("Please follow the steps on displayed page above"));
|
||||
_stage = INITIAL_STEP;
|
||||
|
@ -78,9 +98,11 @@ void OwncloudShibbolethCredsPage::initializePage()
|
|||
void OwncloudShibbolethCredsPage::disposeBrowser(bool later)
|
||||
{
|
||||
if (_browser) {
|
||||
_browser->hide();
|
||||
disconnect(_browser, SIGNAL(viewHidden()),
|
||||
this, SLOT(slotViewHidden()));
|
||||
disconnect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie)),
|
||||
this, SLOT(onShibbolethCookieReceived(QNetworkCookie)));
|
||||
this, SLOT(slotShibbolethCookieReceived(QNetworkCookie)));
|
||||
_browser->hide();
|
||||
if (later) {
|
||||
_browser->deleteLater();
|
||||
} else {
|
||||
|
@ -151,7 +173,7 @@ AbstractCredentials* OwncloudShibbolethCredsPage::getCredentials() const
|
|||
return new ShibbolethCredentials(_cookie);
|
||||
}
|
||||
|
||||
void OwncloudShibbolethCredsPage::onShibbolethCookieReceived(const QNetworkCookie& cookie)
|
||||
void OwncloudShibbolethCredsPage::slotShibbolethCookieReceived(const QNetworkCookie& cookie)
|
||||
{
|
||||
disposeBrowser(true);
|
||||
_stage = GOT_COOKIE;
|
||||
|
@ -161,4 +183,11 @@ void OwncloudShibbolethCredsPage::onShibbolethCookieReceived(const QNetworkCooki
|
|||
validatePage();
|
||||
}
|
||||
|
||||
void OwncloudShibbolethCredsPage::slotViewHidden()
|
||||
{
|
||||
disposeBrowser(true);
|
||||
wizard()->back();
|
||||
wizard()->show();
|
||||
}
|
||||
|
||||
} // ns Mirall
|
||||
|
|
|
@ -43,8 +43,12 @@ public:
|
|||
Q_SIGNALS:
|
||||
void connectToOCUrl(const QString&);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setVisible(bool visible);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onShibbolethCookieReceived(const QNetworkCookie& cookie);
|
||||
void slotShibbolethCookieReceived(const QNetworkCookie& cookie);
|
||||
void slotViewHidden();
|
||||
|
||||
private:
|
||||
enum Stage {
|
||||
|
@ -61,6 +65,7 @@ private:
|
|||
Stage _stage;
|
||||
ShibbolethWebView* _browser;
|
||||
QNetworkCookie _cookie;
|
||||
bool _afterInitialSetup;
|
||||
};
|
||||
|
||||
} // ns Mirall
|
||||
|
|
Loading…
Reference in a new issue