Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 08182df3 authored by David Kahles's avatar David Kahles

Set error if oauth dialog is aborted

Summary:
Also, connect the signals of the auth widget in one place.
This makes it easier to understand.

Test Plan:
- Error is set if user presses the cancel button
- Toghether with a change in kdepim-runtime,
  there are no more invalid entries in the access list

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: #kde_pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D10221
parent 8f5469f6
......@@ -79,11 +79,6 @@ QWidget* AuthJob::Private::fullAuthentication()
authWidget->d->apiKey = apiKey;
authWidget->d->secretKey = secretKey;
connect(authWidget, &AuthWidget::error,
q, [this](KGAPI2::Error error, const QString &str) { _k_fullAuthenticationFailed(error, str); });
connect(authWidget, &AuthWidget::authenticated,
q, [this](const KGAPI2::AccountPtr &account) { _k_fullAuthenticationFinished(account); });
authWidget->setUsername(username);
authWidget->setPassword(password);
authWidget->setAccount(account);
......@@ -248,12 +243,20 @@ void AuthJob::start()
layout->addWidget(buttons, 0);
connect(buttons, &QDialogButtonBox::rejected,
this, [this]() { d->_k_destructDelayed(); });
this, [this]() {
d->_k_destructDelayed();
d->_k_fullAuthenticationFailed(AuthCancelled, tr("Authentication canceled"));
});
connect(widget, &AuthWidget::authenticated,
this, [this]() { d->_k_destructDelayed(); });
this, [this](const KGAPI2::AccountPtr &account) {
d->_k_destructDelayed();
d->_k_fullAuthenticationFinished(account);
});
connect(widget, &AuthWidget::error,
this, [this]() { d->_k_destructDelayed(); });
connect(buttons, &QDialogButtonBox::rejected, this, &AuthJob::emitFinished);
this, [this](KGAPI2::Error error, const QString &str) {
d->_k_destructDelayed();
d->_k_fullAuthenticationFailed(error, str);
});
d->dialog->show();
buttons->button(QDialogButtonBox::Cancel)->setDefault(false); // QTBUG-66109
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment