diff --git a/imports/NeoChat/Component/Timeline/EncryptedDelegate.qml b/imports/NeoChat/Component/Timeline/EncryptedDelegate.qml new file mode 100644 index 000000000..80504af19 --- /dev/null +++ b/imports/NeoChat/Component/Timeline/EncryptedDelegate.qml @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2021 Tobias Fella +// SPDX-License-Identifier: GPL-2.0-or-later + +import QtQuick 2.15 +import QtQuick.Controls 2.15 + +import org.kde.kirigami 2.15 as Kirigami +import org.kde.neochat 1.0 + +TextEdit { + text: i18n("This message is encrypted and the sender has not shared the key with this device.") + color: Kirigami.Theme.disabledTextColor + font.pointSize: Kirigami.Theme.defaultFont.pointSize + selectByMouse: !Kirigami.Settings.isMobile + readOnly: true + wrapMode: Text.WordWrap + textFormat: Text.RichText + width: messageContainer.bubbleMaxWidth +} diff --git a/imports/NeoChat/Component/Timeline/qmldir b/imports/NeoChat/Component/Timeline/qmldir index c70f8d63a..96d442c82 100644 --- a/imports/NeoChat/Component/Timeline/qmldir +++ b/imports/NeoChat/Component/Timeline/qmldir @@ -8,3 +8,4 @@ FileDelegate 1.0 FileDelegate.qml VideoDelegate 1.0 VideoDelegate.qml ReactionDelegate 1.0 ReactionDelegate.qml AudioDelegate 1.0 AudioDelegate.qml +EncryptedDelegate 1.0 EncryptedDelegate.qml \ No newline at end of file diff --git a/imports/NeoChat/Page/RoomPage.qml b/imports/NeoChat/Page/RoomPage.qml index 38806ec2c..e0e7a058e 100644 --- a/imports/NeoChat/Page/RoomPage.qml +++ b/imports/NeoChat/Page/RoomPage.qml @@ -557,6 +557,22 @@ Kirigami.ScrollablePage { } } + DelegateChoice { + roleValue: "encrypted" + delegate: TimelineContainer { + id: encryptedContainer + width: messageListView.width + isLoaded: timelineDelegateChooser.delegateLoaded + + innerObject: EncryptedDelegate { + Layout.fillWidth: Config.compactLayout + Layout.maximumWidth: encryptedContainer.bubbleMaxWidth + Layout.rightMargin: Kirigami.Units.largeSpacing + Layout.leftMargin: Config.showAvatarInTimeline ? Kirigami.Units.largeSpacing : 0 + } + } + } + DelegateChoice { roleValue: "readMarker" delegate: QQC2.ItemDelegate { diff --git a/res.qrc b/res.qrc index e415847ba..0ea107c60 100644 --- a/res.qrc +++ b/res.qrc @@ -40,6 +40,7 @@ imports/NeoChat/Component/Timeline/AudioDelegate.qml imports/NeoChat/Component/Timeline/FileDelegate.qml imports/NeoChat/Component/Timeline/ImageDelegate.qml + imports/NeoChat/Component/Timeline/EncryptedDelegate.qml imports/NeoChat/Component/Login/qmldir imports/NeoChat/Component/Login/LoginStep.qml imports/NeoChat/Component/Login/Login.qml diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp index ba46142cb..8bbecc730 100644 --- a/src/messageeventmodel.cpp +++ b/src/messageeventmodel.cpp @@ -490,6 +490,9 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const if (evt.isStateEvent()) { return "state"; } + if (is(evt)) { + return "encrypted"; + } return "other"; }