diff --git a/harmonyqml/backend/client.py b/harmonyqml/backend/client.py
index f9527926..2307243d 100644
--- a/harmonyqml/backend/client.py
+++ b/harmonyqml/backend/client.py
@@ -312,3 +312,8 @@ class Client(QObject):
response = self.net.talk(self.nio.room_forget, room_id=room_id)
self.nio.invalidate_outbound_session(room_id)
return response
+
+
+ @pyqtSlot(str, result=bool)
+ def roomHasUnknownDevices(self, room_id: str) -> bool:
+ return self.nio.room_contains_unverified(room_id)
diff --git a/harmonyqml/components/Base/HStyle.qml b/harmonyqml/components/Base/HStyle.qml
index 85af4a6e..b1173bea 100644
--- a/harmonyqml/components/Base/HStyle.qml
+++ b/harmonyqml/components/Base/HStyle.qml
@@ -92,6 +92,10 @@ QtObject {
property color background: colors.background1
}
+ readonly property QtObject unknownDevices: QtObject {
+ property color background: colors.background1
+ }
+
readonly property QtObject typingUsers: QtObject {
property color background: colors.background0
}
diff --git a/harmonyqml/components/Chat/Banners/Banner.qml b/harmonyqml/components/Chat/Banners/Banner.qml
index e8e9c3da..45dfa71b 100644
--- a/harmonyqml/components/Chat/Banners/Banner.qml
+++ b/harmonyqml/components/Chat/Banners/Banner.qml
@@ -7,8 +7,8 @@ HGlassRectangle {
Layout.fillWidth: true
Layout.preferredHeight: 32
- property alias avatarName: bannerAvatar.name
- property alias avatarSource: bannerAvatar.imageSource
+ property alias avatar: bannerAvatar
+ property alias icon: bannerIcon
property alias labelText: bannerLabel.text
property alias buttonModel: bannerRepeater.model
property var buttonCallbacks: []
@@ -22,6 +22,14 @@ HGlassRectangle {
dimension: banner.Layout.preferredHeight
}
+ HIcon {
+ id: bannerIcon
+ dimension: bannerLabel.implicitHeight
+ visible: Boolean(svgName)
+
+ Layout.leftMargin: 5
+ }
+
HLabel {
id: bannerLabel
textFormat: Text.StyledText
@@ -36,7 +44,7 @@ HGlassRectangle {
bannerAvatar.width - bannerButtons.width -
Layout.leftMargin - Layout.rightMargin
- Layout.leftMargin: 10
+ Layout.leftMargin: 5
Layout.rightMargin: Layout.leftMargin
}
diff --git a/harmonyqml/components/Chat/Banners/InviteBanner.qml b/harmonyqml/components/Chat/Banners/InviteBanner.qml
index 6e9712f8..35e86504 100644
--- a/harmonyqml/components/Chat/Banners/InviteBanner.qml
+++ b/harmonyqml/components/Chat/Banners/InviteBanner.qml
@@ -6,8 +6,8 @@ Banner {
color: HStyle.chat.inviteBanner.background
- avatarName: inviter ? inviter.displayname : ""
- //avatarSource: inviter ? inviter.avatar_url : ""
+ avatar.name: inviter ? inviter.displayname : ""
+ //avatar.imageSource: inviter ? inviter.avatar_url : ""
labelText:
(inviter ?
diff --git a/harmonyqml/components/Chat/Banners/LeftBanner.qml b/harmonyqml/components/Chat/Banners/LeftBanner.qml
index 1676333d..1c5be78b 100644
--- a/harmonyqml/components/Chat/Banners/LeftBanner.qml
+++ b/harmonyqml/components/Chat/Banners/LeftBanner.qml
@@ -7,7 +7,7 @@ Banner {
color: HStyle.chat.leftBanner.background
- avatarName: ChatJS.getLeftBannerAvatarName(leftEvent, chatPage.userId)
+ avatar.name: ChatJS.getLeftBannerAvatarName(leftEvent, chatPage.userId)
labelText: ChatJS.getLeftBannerText(leftEvent)
buttonModel: [
diff --git a/harmonyqml/components/Chat/Banners/UnknownDevicesBanner.qml b/harmonyqml/components/Chat/Banners/UnknownDevicesBanner.qml
new file mode 100644
index 00000000..fdb8a677
--- /dev/null
+++ b/harmonyqml/components/Chat/Banners/UnknownDevicesBanner.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.7
+import "../../Base"
+import "../utils.js" as ChatJS
+
+Banner {
+ color: HStyle.chat.unknownDevices.background
+
+ avatar.visible: false
+ icon.svgName: "unknown_devices_warning"
+ labelText: "Unknown devices are present in this encrypted room."
+
+ buttonModel: [
+ {
+ name: "inspect",
+ text: qsTr("Inspect"),
+ iconName: "unknown_devices_inspect",
+ }
+ ]
+
+ buttonCallbacks: {
+ "inspect": function(button) {
+ print("show")
+ },
+ }
+}
diff --git a/harmonyqml/components/Chat/Chat.qml b/harmonyqml/components/Chat/Chat.qml
index d353e78b..80436edf 100644
--- a/harmonyqml/components/Chat/Chat.qml
+++ b/harmonyqml/components/Chat/Chat.qml
@@ -14,6 +14,9 @@ HColumnLayout {
.roomCategories.get(category)
.rooms.get(roomId)
+ readonly property bool hasUnknownDevices:
+ Backend.clients.get(userId).roomHasUnknownDevices(roomId)
+
id: chatPage
onFocusChanged: sendBox.setFocus()
@@ -42,9 +45,13 @@ HColumnLayout {
inviter: roomInfo.inviter
}
+ UnknownDevicesBanner {
+ visible: category === "Rooms" && hasUnknownDevices
+ }
+
SendBox {
id: sendBox
- visible: category === "Rooms"
+ visible: category === "Rooms" && ! hasUnknownDevices
}
LeftBanner {
diff --git a/harmonyqml/icons/unknown_devices_inspect.svg b/harmonyqml/icons/unknown_devices_inspect.svg
new file mode 100644
index 00000000..4d104b7a
--- /dev/null
+++ b/harmonyqml/icons/unknown_devices_inspect.svg
@@ -0,0 +1,51 @@
+
+
diff --git a/harmonyqml/icons/unknown_devices_warning.svg b/harmonyqml/icons/unknown_devices_warning.svg
new file mode 100644
index 00000000..ae43d92a
--- /dev/null
+++ b/harmonyqml/icons/unknown_devices_warning.svg
@@ -0,0 +1 @@
+
\ No newline at end of file