diff --git a/src/gui/creds/webflowcredentialsdialog.cpp b/src/gui/creds/webflowcredentialsdialog.cpp index 7a1485bd1..6d8b9473f 100644 --- a/src/gui/creds/webflowcredentialsdialog.cpp +++ b/src/gui/creds/webflowcredentialsdialog.cpp @@ -32,6 +32,9 @@ WebFlowCredentialsDialog::WebFlowCredentialsDialog(Account *account, bool useFlo _layout->addWidget(_flow2AuthWidget); connect(_flow2AuthWidget, &Flow2AuthWidget::urlCatched, this, &WebFlowCredentialsDialog::urlCatched); + + // allow Flow2 page to poll on window activation + connect(this, &WebFlowCredentialsDialog::onActivate, _flow2AuthWidget, &Flow2AuthWidget::slotPollNow); } else { _webView = new WebView(); _layout->addWidget(_webView); @@ -87,6 +90,20 @@ void WebFlowCredentialsDialog::setError(const QString &error) { } } +void WebFlowCredentialsDialog::changeEvent(QEvent *e) +{ + switch (e->type()) { + case QEvent::ActivationChange: + if(isActiveWindow()) + emit onActivate(); + break; + default: + break; + } + + QDialog::changeEvent(e); +} + void WebFlowCredentialsDialog::slotShowSettingsDialog() { // bring window to top but slightly delay, to avoid being hidden behind the SettingsDialog diff --git a/src/gui/creds/webflowcredentialsdialog.h b/src/gui/creds/webflowcredentialsdialog.h index 9885eef29..67775ff7b 100644 --- a/src/gui/creds/webflowcredentialsdialog.h +++ b/src/gui/creds/webflowcredentialsdialog.h @@ -30,12 +30,14 @@ public: protected: void closeEvent(QCloseEvent * e) override; + void changeEvent(QEvent *) override; public slots: void slotShowSettingsDialog(); signals: void urlCatched(const QString user, const QString pass, const QString host); + void onActivate(); private: bool _useFlow2; diff --git a/src/gui/wizard/flow2authwidget.cpp b/src/gui/wizard/flow2authwidget.cpp index c050a54d0..c26def167 100644 --- a/src/gui/wizard/flow2authwidget.cpp +++ b/src/gui/wizard/flow2authwidget.cpp @@ -55,6 +55,7 @@ Flow2AuthWidget::Flow2AuthWidget(Account *account, QWidget *parent) _asyncAuth.reset(new Flow2Auth(_account, this)); connect(_asyncAuth.data(), &Flow2Auth::result, this, &Flow2AuthWidget::asyncAuthResult, Qt::QueuedConnection); + connect(this, &Flow2AuthWidget::pollNow, _asyncAuth.data(), &Flow2Auth::slotPollNow); _asyncAuth->start(); } @@ -112,4 +113,9 @@ void Flow2AuthWidget::slotCopyLinkToClipboard() QApplication::clipboard()->setText(_asyncAuth->authorisationLink().toString(QUrl::FullyEncoded)); } +void Flow2AuthWidget::slotPollNow() +{ + emit pollNow(); +} + } // namespace OCC diff --git a/src/gui/wizard/flow2authwidget.h b/src/gui/wizard/flow2authwidget.h index 7fe1844c1..c07805e60 100644 --- a/src/gui/wizard/flow2authwidget.h +++ b/src/gui/wizard/flow2authwidget.h @@ -35,9 +35,11 @@ public: public Q_SLOTS: void asyncAuthResult(Flow2Auth::Result, const QString &user, const QString &appPassword); + void slotPollNow(); signals: void urlCatched(const QString user, const QString pass, const QString host); + void pollNow(); private: Account *_account;