diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-10-19 14:49:40 +0300 |
---|---|---|
committer | Olivier Goffart <olivier@woboq.com> | 2017-10-20 11:51:35 +0300 |
commit | a0e50670de6f5fc4e001e387210abc1da69d61e9 (patch) | |
tree | 00d769c88cf4f99f513cf9ffbe4d36baa5837a7f /src/gui/owncloudsetupwizard.cpp | |
parent | 984631d8070c4d4b758853fa2e1c9ed2c04fd227 (diff) |
Shibolleth: raise the browser when clicking on the tray
Issue #6105
Dynamically find the browser trough topLevelWidgets instead of
forwarding the call to the relevant page as it would require to break
many abstration layers (OwncloudSetupWizard -> OwncloudWizard ->
AbstractCredentialsWizardPage -> OwncloudShibbolethCredsPage)
And considering that we want to phase shibboleth down, I tought is
was not worth adding an interface for this.
The OAuth page don't have this problem because it shows a label and
allow the user to re-open the browser.
Diffstat (limited to 'src/gui/owncloudsetupwizard.cpp')
-rw-r--r-- | src/gui/owncloudsetupwizard.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index 86a0c19ad..4f83a8496 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -18,6 +18,7 @@ #include <QProcess> #include <QMessageBox> #include <QDesktopServices> +#include <QApplication> #include "wizard/owncloudwizardcommon.h" #include "wizard/owncloudwizard.h" @@ -84,6 +85,17 @@ bool OwncloudSetupWizard::bringWizardToFrontIfVisible() return false; } + if (wiz->_ocWizard->currentId() == WizardCommon::Page_ShibbolethCreds) { + // Try to find if there is a browser open and raise that instead (Issue #6105) + const auto allWindow = qApp->topLevelWidgets(); + auto it = std::find_if(allWindow.cbegin(), allWindow.cend(), [](QWidget *w) + { return QLatin1String(w->metaObject()->className()) == QLatin1String("OCC::ShibbolethWebView"); }); + if (it != allWindow.cend()) { + ownCloudGui::raiseDialog(*it); + return true; + } + } + ownCloudGui::raiseDialog(wiz->_ocWizard); return true; } |