From aa18667905881acdbf817f364bab79d3ea221c65 Mon Sep 17 00:00:00 2001 From: Michael Schuster Date: Sat, 21 Dec 2019 03:16:22 +0100 Subject: [PATCH] WebFlowCredentialsDialog: Bring re-auth dialog to top (raise) upon showing SettingsDialog 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 --- src/gui/creds/webflowcredentialsdialog.cpp | 13 +++++++++++++ src/gui/creds/webflowcredentialsdialog.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/gui/creds/webflowcredentialsdialog.cpp b/src/gui/creds/webflowcredentialsdialog.cpp index 9971f8f34..7a1485bd1 100644 --- a/src/gui/creds/webflowcredentialsdialog.cpp +++ b/src/gui/creds/webflowcredentialsdialog.cpp @@ -4,6 +4,8 @@ #include #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(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); + }); +} + } diff --git a/src/gui/creds/webflowcredentialsdialog.h b/src/gui/creds/webflowcredentialsdialog.h index a540f0edb..9885eef29 100644 --- a/src/gui/creds/webflowcredentialsdialog.h +++ b/src/gui/creds/webflowcredentialsdialog.h @@ -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); -- 2.39.5