Move userConsentRequired to NeoChatConnection
This commit is contained in:
@@ -152,12 +152,6 @@ void Controller::addConnection(NeoChatConnection *c)
|
||||
dropConnection(c);
|
||||
});
|
||||
|
||||
connect(c, &NeoChatConnection::requestFailed, this, [this](BaseJob *job) {
|
||||
if (job->error() == BaseJob::UserConsentRequired) {
|
||||
Q_EMIT userConsentRequired(job->errorUrl());
|
||||
}
|
||||
});
|
||||
|
||||
c->sync();
|
||||
|
||||
Q_EMIT connectionAdded(c);
|
||||
|
||||
@@ -134,6 +134,5 @@ Q_SIGNALS:
|
||||
void connectionAdded(NeoChatConnection *connection);
|
||||
void connectionDropped(NeoChatConnection *connection);
|
||||
void activeConnectionChanged();
|
||||
void userConsentRequired(QUrl url);
|
||||
void accountsLoadingChanged();
|
||||
};
|
||||
|
||||
@@ -44,6 +44,11 @@ NeoChatConnection::NeoChatConnection(QObject *parent)
|
||||
connect(this, &NeoChatConnection::networkError, this, [this]() {
|
||||
setIsOnline(false);
|
||||
});
|
||||
connect(this, &NeoChatConnection::requestFailed, this, [this](BaseJob *job) {
|
||||
if (job->error() == BaseJob::UserConsentRequired) {
|
||||
Q_EMIT userConsentRequired(job->errorUrl());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
NeoChatConnection::NeoChatConnection(const QUrl &server, QObject *parent)
|
||||
|
||||
@@ -99,6 +99,7 @@ Q_SIGNALS:
|
||||
void labelChanged();
|
||||
void isOnlineChanged();
|
||||
void passwordStatus(NeoChatConnection::PasswordStatus status);
|
||||
void userConsentRequired(QUrl url);
|
||||
|
||||
private:
|
||||
bool m_isOnline = true;
|
||||
|
||||
@@ -300,12 +300,6 @@ Kirigami.ApplicationWindow {
|
||||
function onErrorOccured(error, detail) {
|
||||
showPassiveNotification(detail.length > 0 ? i18n("%1: %2", error, detail) : error);
|
||||
}
|
||||
|
||||
function onUserConsentRequired(url) {
|
||||
let consent = consentSheetComponent.createObject(QQC2.ApplicationWindow.overlay)
|
||||
consent.url = url
|
||||
consent.open()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -341,6 +335,11 @@ Kirigami.ApplicationWindow {
|
||||
title: i18nc("@title:window", "Session Verification")
|
||||
});
|
||||
}
|
||||
function onUserConsentRequired(url) {
|
||||
let consent = consentSheetComponent.createObject(QQC2.ApplicationWindow.overlay)
|
||||
consent.url = url
|
||||
consent.open()
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
|
||||
Reference in New Issue
Block a user