WebFlowCredentialsDialog: Bring re-auth dialog to top (raise) upon showing SettingsDialog
authorMichael Schuster <michael@schuster.ms>
Sat, 21 Dec 2019 02:16:22 +0000 (03:16 +0100)
committerMichael Schuster <48932272+misch7@users.noreply.github.com>
Tue, 24 Dec 2019 06:46:57 +0000 (07:46 +0100)
Purpose: The floating re-auth windows of the WebFlowCredentialsDialog often get hidden behind
the SettingsDialog, and the users have to minimize a lot of other windows to find them again.

See previous commit for dependent implementation details.

Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/creds/webflowcredentialsdialog.cpp
src/gui/creds/webflowcredentialsdialog.h

index 9971f8f34e93b6e9b4cdeeb7114fcb21232a7e81..7a1485bd150d6505224152400eaf03f655972bb1 100644 (file)
@@ -4,6 +4,8 @@
 #include <QLabel>
 
 #include "theme.h"
+#include "application.h"
+#include "owncloudgui.h"
 #include "wizard/owncloudwizardcommon.h"
 #include "wizard/webview.h"
 #include "wizard/flow2authwidget.h"
@@ -37,6 +39,9 @@ WebFlowCredentialsDialog::WebFlowCredentialsDialog(Account *account, bool useFlo
         connect(_webView, &WebView::urlCatched, this, &WebFlowCredentialsDialog::urlCatched);
     }
 
+    auto app = static_cast<Application *>(qApp);
+    connect(app, &Application::isShowingSettingsDialog, this, &WebFlowCredentialsDialog::slotShowSettingsDialog);
+
     _errorLabel = new QLabel();
     _errorLabel->hide();
     _layout->addWidget(_errorLabel);
@@ -82,4 +87,12 @@ void WebFlowCredentialsDialog::setError(const QString &error) {
     }
 }
 
+void WebFlowCredentialsDialog::slotShowSettingsDialog()
+{
+    // bring window to top but slightly delay, to avoid being hidden behind the SettingsDialog
+    QTimer::singleShot(100, this, [this] {
+        ownCloudGui::raiseDialog(this);
+    });
+}
+
 }
index a540f0edb41609583496bd939dd3135d3fa47994..9885eef297e653085ca83bf2ba288fc8d69423b9 100644 (file)
@@ -31,6 +31,9 @@ public:
 protected:
     void closeEvent(QCloseEvent * e) override;
 
+public slots:
+    void slotShowSettingsDialog();
+
 signals:
     void urlCatched(const QString user, const QString pass, const QString host);