From db0c4237631074e40c972dd197ed31b68721c519 Mon Sep 17 00:00:00 2001 From: James Graham Date: Mon, 5 May 2025 12:20:26 +0100 Subject: [PATCH] Use isOnline from libquotient Use `isOnline` from libquotient This require a bump of the min libquotient to 0.9.1 --- CMakeLists.txt | 2 +- src/libneochat/neochatconnection.cpp | 20 -------------------- src/libneochat/neochatconnection.h | 11 ----------- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffa322b9e..c23fa0b3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ if (NOT ANDROID AND NOT WIN32 AND NOT APPLE AND NOT HAIKU) find_package(KF6DBusAddons ${KF_MIN_VERSION} REQUIRED) endif() -find_package(QuotientQt6 0.9) +find_package(QuotientQt6 0.9.1) set_package_properties(QuotientQt6 PROPERTIES TYPE REQUIRED DESCRIPTION "Qt wrapper around Matrix API" diff --git a/src/libneochat/neochatconnection.cpp b/src/libneochat/neochatconnection.cpp index 3a8eb830b..9d9c55cf2 100644 --- a/src/libneochat/neochatconnection.cpp +++ b/src/libneochat/neochatconnection.cpp @@ -61,12 +61,6 @@ void NeoChatConnection::connectSignals() Q_EMIT identityServerChanged(); } }); - connect(this, &NeoChatConnection::syncDone, this, [this] { - setIsOnline(true); - }); - 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()); @@ -501,20 +495,6 @@ QCoro::Task NeoChatConnection::setupPushNotifications(QString endpoint) #endif } -bool NeoChatConnection::isOnline() const -{ - return m_isOnline; -} - -void NeoChatConnection::setIsOnline(bool isOnline) -{ - if (isOnline == m_isOnline) { - return; - } - m_isOnline = isOnline; - Q_EMIT isOnlineChanged(); -} - QString NeoChatConnection::accountDataJsonString(const QString &type) const { return QString::fromUtf8(QJsonDocument(accountDataJson(type)).toJson()); diff --git a/src/libneochat/neochatconnection.h b/src/libneochat/neochatconnection.h index b9dcbc4ef..96a50908f 100644 --- a/src/libneochat/neochatconnection.h +++ b/src/libneochat/neochatconnection.h @@ -70,11 +70,6 @@ class NeoChatConnection : public Quotient::Connection */ Q_PROPERTY(bool directChatInvites READ directChatInvites NOTIFY directChatInvitesChanged) - /** - * @brief Whether NeoChat is currently able to connect to the server. - */ - Q_PROPERTY(bool isOnline READ isOnline WRITE setIsOnline NOTIFY isOnlineChanged) - /** * @brief Whether the server supports querying a user's mutual rooms. */ @@ -201,8 +196,6 @@ public: bool pushNotificationsAvailable() const; bool enablePushNotifications() const; - bool isOnline() const; - LinkPreviewer *previewerForLink(const QUrl &link); Q_SIGNALS: @@ -214,7 +207,6 @@ Q_SIGNALS: void homeNotificationsChanged(); void homeHaveHighlightNotificationsChanged(); void directChatInvitesChanged(); - void isOnlineChanged(); void passwordStatus(NeoChatConnection::PasswordStatus status); void userConsentRequired(QUrl url); void badgeNotificationCountChanged(int count); @@ -236,9 +228,6 @@ private: static bool m_globalUrlPreviewDefault; static PushRuleAction::Action m_defaultAction; - bool m_isOnline = true; - void setIsOnline(bool isOnline); - void connectSignals(); int m_badgeNotificationCount = 0;