From 67453d9fb83fac8d3281d1d2b7a1acd9fc6458e5 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Mon, 7 Aug 2023 22:38:25 +0200 Subject: [PATCH] Remove ifdefs for E2EE --- src/controller.cpp | 5 ----- src/controller.h | 7 ------- src/main.cpp | 2 -- src/models/messageeventmodel.cpp | 2 -- src/neochatroom.cpp | 3 --- src/neochatroom.h | 3 --- src/notificationsmanager.cpp | 2 -- src/qml/Component/ChatBox/ChatBar.qml | 3 +-- src/qml/RoomSettings/Security.qml | 1 - src/qml/Settings/DeviceDelegate.qml | 2 +- src/qml/main.qml | 2 -- 11 files changed, 2 insertions(+), 30 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index 4f0c29487..101c92996 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -581,11 +581,6 @@ bool Controller::hasWindowSystem() const #endif } -bool Controller::encryptionSupported() const -{ - return Quotient::encryptionSupported(); -} - void Controller::forceRefreshTextDocument(QQuickTextDocument *textDocument, QQuickItem *item) { // HACK: Workaround bug QTBUG 93281 diff --git a/src/controller.h b/src/controller.h index 126904ea7..21e265460 100644 --- a/src/controller.h +++ b/src/controller.h @@ -87,11 +87,6 @@ class Controller : public QObject */ Q_PROPERTY(bool isOnline READ isOnline NOTIFY isOnlineChanged) - /** - * @brief Whether the ecryption support has been enabled. - */ - Q_PROPERTY(bool encryptionSupported READ encryptionSupported CONSTANT) - /** * @brief The current minor version number of libQuotient being used. * @@ -194,8 +189,6 @@ public: bool isOnline() const; - bool encryptionSupported() const; - /** * @brief Sets the QNetworkProxy for the application. * diff --git a/src/main.cpp b/src/main.cpp index 1b02b5e8c..91d8af919 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -272,11 +272,9 @@ int main(int argc, char *argv[]) qRegisterMetaType("User*"); qRegisterMetaType("GetRoomEventsJob*"); qRegisterMetaType("QMimeType"); -#ifdef Quotient_E2EE_ENABLED qRegisterMetaType("KeyVerificationSession*"); qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "KeyVerificationSession", {}); qRegisterMetaType>("QVector"); -#endif qmlRegisterSingletonType("org.kde.neochat", 1, 0, "About", [](QQmlEngine *engine, QJSEngine *) -> QJSValue { return engine->toScriptValue(KAboutData::applicationData()); }); diff --git a/src/models/messageeventmodel.cpp b/src/models/messageeventmodel.cpp index d05933adf..7dfebc64b 100644 --- a/src/models/messageeventmodel.cpp +++ b/src/models/messageeventmodel.cpp @@ -865,13 +865,11 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const } if (role == VerifiedRole) { -#ifdef Quotient_E2EE_ENABLED if (evt.originalEvent()) { auto encrypted = dynamic_cast(evt.originalEvent()); Q_ASSERT(encrypted); return m_currentRoom->connection()->isVerifiedSession(encrypted->sessionId().toLatin1()); } -#endif return false; } diff --git a/src/neochatroom.cpp b/src/neochatroom.cpp index 9760e3fc2..f351e49c3 100644 --- a/src/neochatroom.cpp +++ b/src/neochatroom.cpp @@ -1812,10 +1812,7 @@ void NeoChatRoom::editLastMessage() bool NeoChatRoom::canEncryptRoom() const { -#ifdef Quotient_E2EE_ENABLED return !usesEncryption() && canSendState("m.room.encryption"); -#endif - return false; } PollHandler *NeoChatRoom::poll(const QString &eventId) diff --git a/src/neochatroom.h b/src/neochatroom.h index 44481881b..fcba4e62c 100644 --- a/src/neochatroom.h +++ b/src/neochatroom.h @@ -186,9 +186,6 @@ class NeoChatRoom : public Quotient::Room /** * @brief Whether the local user can encrypt the room. * - * Requires libQuotient 0.7 compiled with the Quotient_E2EE_ENABLED parameter to - * be able to return true. - * * A local user can encrypt a room if they have permission to send the m.room.encryption * state event. * diff --git a/src/notificationsmanager.cpp b/src/notificationsmanager.cpp index 535f0a364..22d9ef9e7 100644 --- a/src/notificationsmanager.cpp +++ b/src/notificationsmanager.cpp @@ -122,10 +122,8 @@ void NotificationsManager::processNotificationJob(QPointer } if (notification["event"]["type"] == "m.room.encrypted") { -#ifdef Quotient_E2EE_ENABLED auto decrypted = connection->decryptNotification(notification); body = decrypted["content"].toObject()["body"].toString(); -#endif if (body.isEmpty()) { body = i18n("Encrypted Message"); } diff --git a/src/qml/Component/ChatBox/ChatBar.qml b/src/qml/Component/ChatBox/ChatBar.qml index fb7e29c48..b56f24aa0 100644 --- a/src/qml/Component/ChatBox/ChatBar.qml +++ b/src/qml/Component/ChatBox/ChatBar.qml @@ -162,10 +162,9 @@ QQC2.Control { leftPadding: LayoutMirroring.enabled ? actionsRow.width : Kirigami.Units.largeSpacing rightPadding: LayoutMirroring.enabled ? Kirigami.Units.largeSpacing : actionsRow.width + x * 2 + Kirigami.Units.largeSpacing * 2 - placeholderText: readOnly ? i18n("This room is encrypted. Build libQuotient with encryption enabled to send encrypted messages.") : root.currentRoom.usesEncryption ? i18n("Send an encrypted message…") : root.currentRoom.chatBoxAttachmentPath.length > 0 ? i18n("Set an attachment caption...") : i18n("Send a message…") + placeholderText: root.currentRoom.usesEncryption ? i18n("Send an encrypted message…") : root.currentRoom.chatBoxAttachmentPath.length > 0 ? i18n("Set an attachment caption...") : i18n("Send a message…") verticalAlignment: TextEdit.AlignVCenter wrapMode: Text.Wrap - readOnly: (root.currentRoom.usesEncryption && !Controller.encryptionSupported) Accessible.description: placeholderText diff --git a/src/qml/RoomSettings/Security.qml b/src/qml/RoomSettings/Security.qml index f1a135518..d65b6d106 100644 --- a/src/qml/RoomSettings/Security.qml +++ b/src/qml/RoomSettings/Security.qml @@ -27,7 +27,6 @@ Kirigami.ScrollablePage { title: i18nc("@option:check", "Encryption") } MobileForm.FormCard { - visible: Controller.encryptionSupported Layout.fillWidth: true contentItem: ColumnLayout { spacing: 0 diff --git a/src/qml/Settings/DeviceDelegate.qml b/src/qml/Settings/DeviceDelegate.qml index e945fcfd6..419d63f0f 100644 --- a/src/qml/Settings/DeviceDelegate.qml +++ b/src/qml/Settings/DeviceDelegate.qml @@ -100,7 +100,7 @@ MobileForm.AbstractFormDelegate { } QQC2.ToolButton { display: QQC2.AbstractButton.IconOnly - visible: Controller.encryptionSupported && deviceDelegate.showVerifyButton + visible: deviceDelegate.showVerifyButton action: Kirigami.Action { id: verifyDeviceAction text: i18n("Verify device") diff --git a/src/qml/main.qml b/src/qml/main.qml index 7ad06f13d..2c78a5495 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -287,8 +287,6 @@ Kirigami.ApplicationWindow { Connections { target: Controller.activeConnection - //TODO Remove this when the E2EE flag in libQuotient goes away - ignoreUnknownSignals: true function onDirectChatAvailable(directChat) { RoomManager.enterRoom(Controller.activeConnection.room(directChat.id)); }