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