Add lock to encrypted messages
This commit is contained in:
parent
a5ccd00be0
commit
82091999c4
30
resources/qml/EncryptionIndicator.qml
Normal file
30
resources/qml/EncryptionIndicator.qml
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -118,6 +118,7 @@
|
||||
<file>qml/TimelineView.qml</file>
|
||||
<file>qml/Avatar.qml</file>
|
||||
<file>qml/StatusIndicator.qml</file>
|
||||
<file>qml/EncryptionIndicator.qml</file>
|
||||
<file>qml/delegates/TextMessage.qml</file>
|
||||
<file>qml/delegates/NoticeMessage.qml</file>
|
||||
<file>qml/delegates/ImageMessage.qml</file>
|
||||
|
@ -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<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(
|
||||
&tempEvent) != nullptr;
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -132,6 +132,7 @@ public:
|
||||
ProportionalHeight,
|
||||
Id,
|
||||
State,
|
||||
IsEncrypted,
|
||||
};
|
||||
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
Loading…
Reference in New Issue
Block a user