summary refs log tree commit diff
path: root/resources/qml/dialogs/UserProfile.qml
diff options
context:
space:
mode:
authorThulinma <jaron@vietors.com>2021-09-19 22:55:12 +0200
committerThulinma <jaron@vietors.com>2021-10-06 22:52:19 +0200
commit456a41bcdf9c0bff99a20bb77d1039c89f2101eb (patch)
tree7fda457fa164998d60a745ac2172da702b66ff6f /resources/qml/dialogs/UserProfile.qml
parentFix appimage builder url (diff)
downloadnheko-456a41bcdf9c0bff99a20bb77d1039c89f2101eb.tar.xz
Added support for refreshing the device list, marking current device with a checkmark instead of a lock
Diffstat (limited to 'resources/qml/dialogs/UserProfile.qml')
-rw-r--r--resources/qml/dialogs/UserProfile.qml38
1 files changed, 30 insertions, 8 deletions
diff --git a/resources/qml/dialogs/UserProfile.qml b/resources/qml/dialogs/UserProfile.qml
index 9bf548e3..86822bdf 100644
--- a/resources/qml/dialogs/UserProfile.qml
+++ b/resources/qml/dialogs/UserProfile.qml
@@ -249,6 +249,14 @@ ApplicationWindow {
                     visible: !profile.isGlobalUserProfile && profile.room.permissions.canBan()
                 }
 
+                ImageButton {
+                    image: ":/icons/icons/ui/refresh.png"
+                    hoverEnabled: true
+                    ToolTip.visible: hovered
+                    ToolTip.text: qsTr("Refresh device list.")
+                    onClicked: profile.refreshDevices();
+                }
+
             }
         }
 
@@ -264,6 +272,9 @@ ApplicationWindow {
 
 
         delegate: RowLayout {
+            required property int verificationStatus
+            required property string deviceId
+            required property string deviceName
             width: devicelist.width
             spacing: 4
 
@@ -276,7 +287,7 @@ ApplicationWindow {
                     elide: Text.ElideRight
                     font.bold: true
                     color: Nheko.colors.text
-                    text: model.deviceId
+                    text: deviceId
                 }
 
                 Text {
@@ -284,7 +295,7 @@ ApplicationWindow {
                     Layout.alignment: Qt.AlignRight
                     elide: Text.ElideRight
                     color: Nheko.colors.text
-                    text: model.deviceName
+                    text: deviceName
                 }
 
             }
@@ -292,19 +303,30 @@ ApplicationWindow {
             Image {
                 Layout.preferredHeight: 16
                 Layout.preferredWidth: 16
-                source: ((model.verificationStatus == VerificationStatus.VERIFIED) ? "image://colorimage/:/icons/icons/ui/lock.png?green" : ((model.verificationStatus == VerificationStatus.UNVERIFIED) ? "image://colorimage/:/icons/icons/ui/unlock.png?yellow" : "image://colorimage/:/icons/icons/ui/unlock.png?red"))
+                source: {
+                    switch (verificationStatus){
+                    case VerificationStatus.VERIFIED:
+                        return "image://colorimage/:/icons/icons/ui/lock.png?green";
+                    case VerificationStatus.UNVERIFIED:
+                        return "image://colorimage/:/icons/icons/ui/unlock.png?yellow";
+                    case VerificationStatus.SELF:
+                        return "image://colorimage/:/icons/icons/ui/checkmark.png?green";
+                    default:
+                        return "image://colorimage/:/icons/icons/ui/unlock.png?red";
+                    }
+                }
             }
 
             Button {
                 id: verifyButton
 
-                visible: (!profile.userVerificationEnabled && !profile.isSelf) || (profile.isSelf && (model.verificationStatus != VerificationStatus.VERIFIED || !profile.userVerificationEnabled))
-                text: (model.verificationStatus != VerificationStatus.VERIFIED) ? qsTr("Verify") : qsTr("Unverify")
+                visible: (!profile.userVerificationEnabled && !profile.isSelf) || (profile.isSelf && (verificationStatus == VerificationStatus.UNVERIFIED || !profile.userVerificationEnabled))
+                text: (verificationStatus != VerificationStatus.VERIFIED) ? qsTr("Verify") : qsTr("Unverify")
                 onClicked: {
-                    if (model.verificationStatus == VerificationStatus.VERIFIED)
-                        profile.unverify(model.deviceId);
+                    if (verificationStatus == VerificationStatus.VERIFIED)
+                        profile.unverify(deviceId);
                     else
-                        profile.verify(model.deviceId);
+                        profile.verify(deviceId);
                 }
             }