Remove ifdefs for E2EE
This commit is contained in:
committed by
Carl Schwan
parent
3ab04583ae
commit
67453d9fb8
@@ -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
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -272,11 +272,9 @@ int main(int argc, char *argv[])
|
||||
qRegisterMetaType<User *>("User*");
|
||||
qRegisterMetaType<GetRoomEventsJob *>("GetRoomEventsJob*");
|
||||
qRegisterMetaType<QMimeType>("QMimeType");
|
||||
#ifdef Quotient_E2EE_ENABLED
|
||||
qRegisterMetaType<KeyVerificationSession *>("KeyVerificationSession*");
|
||||
qmlRegisterUncreatableType<KeyVerificationSession>("org.kde.neochat", 1, 0, "KeyVerificationSession", {});
|
||||
qRegisterMetaType<QVector<EmojiEntry>>("QVector<EmojiEntry>");
|
||||
#endif
|
||||
qmlRegisterSingletonType("org.kde.neochat", 1, 0, "About", [](QQmlEngine *engine, QJSEngine *) -> QJSValue {
|
||||
return engine->toScriptValue(KAboutData::applicationData());
|
||||
});
|
||||
|
||||
@@ -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<const EncryptedEvent *>(evt.originalEvent());
|
||||
Q_ASSERT(encrypted);
|
||||
return m_currentRoom->connection()->isVerifiedSession(encrypted->sessionId().toLatin1());
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -122,10 +122,8 @@ void NotificationsManager::processNotificationJob(QPointer<Quotient::Connection>
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ Kirigami.ScrollablePage {
|
||||
title: i18nc("@option:check", "Encryption")
|
||||
}
|
||||
MobileForm.FormCard {
|
||||
visible: Controller.encryptionSupported
|
||||
Layout.fillWidth: true
|
||||
contentItem: ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user