Skip to content

Commit

Permalink
Make sure login required dialog is shown once at most
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Müller authored and fmoc committed Oct 26, 2022
1 parent 8ce22a6 commit 6b9f3da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/creds/httpcredentialsgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -136,6 +140,8 @@ void HttpCredentialsGui::showDialog()
QTimer::singleShot(0, [contentWidget]() {
contentWidget->setFocus(Qt::OtherFocusReason);
});

_loginRequiredDialog = dialog;
}

QUrl HttpCredentialsGui::authorisationLink() const
Expand Down
1 change: 1 addition & 0 deletions src/gui/creds/httpcredentialsgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private slots:

private:
QScopedPointer<AccountBasedOAuth, QScopedPointerObjectDeleteLater<AccountBasedOAuth>> _asyncAuth;
QPointer<QWidget> _loginRequiredDialog;
};

} // namespace OCC

0 comments on commit 6b9f3da

Please sign in to comment.