summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorJedi18 <targetakhil@gmail.com>2021-02-11 19:54:09 +0530
committerJedi18 <targetakhil@gmail.com>2021-02-11 19:54:09 +0530
commit7401bd13b272bbe9a0415c2e523f8ec0fa7f3e11 (patch)
tree18f7e36fb8671957644656805f089e171317edaa /resources/qml
parentui almost looks the same, midway between transition from old room settings t... (diff)
downloadnheko-7401bd13b272bbe9a0415c2e523f8ec0fa7f3e11.tar.xz
added notifications and encryption for the new roomsettings
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/RoomSettings.qml58
-rw-r--r--resources/qml/TimelineView.qml2
2 files changed, 58 insertions, 2 deletions
diff --git a/resources/qml/RoomSettings.qml b/resources/qml/RoomSettings.qml
index d6f3fe7b..4b03e08b 100644
--- a/resources/qml/RoomSettings.qml
+++ b/resources/qml/RoomSettings.qml
@@ -2,6 +2,7 @@ import QtQuick 2.9
 import QtQuick.Controls 2.3
 import QtQuick.Layouts 1.2
 import QtQuick.Window 2.3
+import QtQuick.Dialogs 1.2
 import im.nheko 1.0
 
 ApplicationWindow {
@@ -17,7 +18,8 @@ ApplicationWindow {
     palette: colors
     color: colors.window
     title: roomSettings.roomName
-    modality: Qt.Modal
+    modality: Qt.WindowModal
+    flags: Qt.WindowStaysOnTopHint
 
     Shortcut {
         sequence: StandardKey.Cancel
@@ -75,6 +77,10 @@ ApplicationWindow {
 
             ComboBox {
                 model: [ "Muted", "Mentions only", "All messages" ]
+                currentIndex: roomSettings.notifications
+                onActivated: {
+                    roomSettings.changeNotifications(index)
+                }
             }
         }
 
@@ -85,7 +91,12 @@ ApplicationWindow {
 
             ComboBox {
                 Layout.fillWidth: true
+                enabled: roomSettings.canChangeJoinRules
                 model: [ "Anyone and guests", "Anyone", "Invited users" ]
+                currentIndex: roomSettings.accessJoinRules
+                onActivated: {
+                    roomSettings.changeAccessRules(index)
+                }
             }
         }
 
@@ -99,10 +110,46 @@ ApplicationWindow {
             }
 
             Switch {
+                id: encryptionSwitch
+
+                checked: roomSettings.isEncryptionEnabled
+                onToggled: {
+                    if(roomSettings.isEncryptionEnabled) {
+                        checked=true;
+                        return;
+                    }
+
+                    confirmEncryptionDialog.open();
+                }
+            }
+
+            MessageDialog {
+                id: confirmEncryptionDialog
+                title: qsTr("End-to-End Encryption")
+                text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br> 
+                            Please take note that it can't be disabled afterwards.")
+                modality: Qt.WindowModal
+                icon: StandardIcon.Question
+
+                onAccepted: {
+                    if(roomSettings.isEncryptionEnabled) {
+                        return;
+                    }
+
+                    roomSettings.enableEncryption();
+                }
+
+                onRejected: {
+                    encryptionSwitch.checked = false
+                }
+
+                standardButtons: Dialog.Ok | Dialog.Cancel
             }
         }
 
         RowLayout {
+            visible: roomSettings.isEncryptionEnabled
+
             MatrixText {
                 text: "Respond to key requests"
             }
@@ -112,6 +159,15 @@ ApplicationWindow {
             }
 
             Switch {
+                ToolTip.text: qsTr("Whether or not the client should respond automatically with the session keys 
+                                upon request. Use with caution, this is a temporary measure to test the 
+                                E2E implementation until device verification is completed.")
+
+                checked: roomSettings.respondsToKeyRequests
+
+                onToggled: {
+                    roomSettings.changeKeyRequestsPreference(checked)
+                }
             }
         }
 
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 6b34f2ab..0c32effd 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -178,7 +178,7 @@ Page {
             target: TimelineManager
             onOpenRoomSettingsDialog: {
                 var roomSettings = roomSettingsComponent.createObject(timelineRoot, {
-                    "roomSettings": roomSettings
+                    "roomSettings": settings
                 });
                 roomSettings.show();
             }