From 6b9f3dabeac89ef2c10e5f4009ac7861be3ae45b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Tue, 25 Oct 2022 16:17:00 +0200 Subject: [PATCH] Make sure login required dialog is shown once at most --- src/gui/creds/httpcredentialsgui.cpp | 6 ++++++ src/gui/creds/httpcredentialsgui.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/gui/creds/httpcredentialsgui.cpp b/src/gui/creds/httpcredentialsgui.cpp index 7c30bfafba9..5319085e7cb 100644 --- a/src/gui/creds/httpcredentialsgui.cpp +++ b/src/gui/creds/httpcredentialsgui.cpp @@ -104,6 +104,10 @@ void HttpCredentialsGui::asyncAuthResult(OAuth::Result r, const QString &user, void HttpCredentialsGui::showDialog() { + if (_loginRequiredDialog != nullptr) { + return; + } + auto *dialog = new LoginRequiredDialog(LoginRequiredDialog::Mode::Basic, ocApp()->gui()->settingsDialog()); // make sure it's cleaned up since it's not owned by the account settings (also prevents memory leaks) @@ -136,6 +140,8 @@ void HttpCredentialsGui::showDialog() QTimer::singleShot(0, [contentWidget]() { contentWidget->setFocus(Qt::OtherFocusReason); }); + + _loginRequiredDialog = dialog; } QUrl HttpCredentialsGui::authorisationLink() const diff --git a/src/gui/creds/httpcredentialsgui.h b/src/gui/creds/httpcredentialsgui.h index 929007d30da..280f0f504ef 100644 --- a/src/gui/creds/httpcredentialsgui.h +++ b/src/gui/creds/httpcredentialsgui.h @@ -69,6 +69,7 @@ private slots: private: QScopedPointer> _asyncAuth; + QPointer _loginRequiredDialog; }; } // namespace OCC