diff --git a/resources/qml/EncryptionIndicator.qml b/resources/qml/EncryptionIndicator.qml
new file mode 100644
index 00000000..6cb5138a
--- /dev/null
+++ b/resources/qml/EncryptionIndicator.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.5
+import QtGraphicalEffects 1.0
+import com.github.nheko 1.0
+
+Rectangle {
+ id: indicator
+ color: "transparent"
+ width: 16
+ height: 16
+ ToolTip.visible: ma.containsMouse && indicator.visible
+ ToolTip.text: qsTr("Encrypted")
+ MouseArea{
+ id: ma
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ Image {
+ id: stateImg
+ anchors.fill: parent
+ source: "qrc:/icons/icons/ui/lock.png"
+ }
+ ColorOverlay {
+ anchors.fill: stateImg
+ source: stateImg
+ color: colors.buttonText
+ }
+}
+
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index a04c0c7f..ee4b53b9 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -124,6 +124,12 @@ Rectangle {
Layout.preferredHeight: 16
}
+ EncryptionIndicator {
+ visible: model.isEncrypted
+ Layout.alignment: Qt.AlignRight | Qt.AlignTop
+ Layout.preferredHeight: 16
+ }
+
Button {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
id: replyButton
diff --git a/resources/res.qrc b/resources/res.qrc
index a9cf885b..02b4c0c0 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -118,6 +118,7 @@
qml/TimelineView.qml
qml/Avatar.qml
qml/StatusIndicator.qml
+ qml/EncryptionIndicator.qml
qml/delegates/TextMessage.qml
qml/delegates/NoticeMessage.qml
qml/delegates/ImageMessage.qml
diff --git a/src/timeline2/TimelineModel.cpp b/src/timeline2/TimelineModel.cpp
index 9537649b..36b768ba 100644
--- a/src/timeline2/TimelineModel.cpp
+++ b/src/timeline2/TimelineModel.cpp
@@ -293,6 +293,7 @@ TimelineModel::roleNames() const
{ProportionalHeight, "proportionalHeight"},
{Id, "id"},
{State, "state"},
+ {IsEncrypted, "isEncrypted"},
};
}
int
@@ -391,6 +392,11 @@ TimelineModel::data(const QModelIndex &index, int role) const
return qml_mtx_events::Read;
else
return qml_mtx_events::Received;
+ case IsEncrypted: {
+ auto tempEvent = events[id];
+ return boost::get>(
+ &tempEvent) != nullptr;
+ }
default:
return QVariant();
}
diff --git a/src/timeline2/TimelineModel.h b/src/timeline2/TimelineModel.h
index 7723ef66..3d55f206 100644
--- a/src/timeline2/TimelineModel.h
+++ b/src/timeline2/TimelineModel.h
@@ -132,6 +132,7 @@ public:
ProportionalHeight,
Id,
State,
+ IsEncrypted,
};
QHash roleNames() const override;