summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-07-17 19:43:35 -0400
committerLoren Burkholder <computersemiexpert@outlook.com>2021-07-20 21:48:03 -0400
commitf1f5796fb8ba5b504043310dba17acd3ef2860bd (patch)
tree60c7c53672278b993f5ef05dcf412f3fe1680ea5 /resources/qml
parentFix bad property name (diff)
downloadnheko-f1f5796fb8ba5b504043310dba17acd3ef2860bd.tar.xz
Get Ctrl+Enter working and fix cleaning up and closing
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/InviteDialog.qml29
1 files changed, 14 insertions, 15 deletions
diff --git a/resources/qml/InviteDialog.qml b/resources/qml/InviteDialog.qml
index 8bdbb767..417de049 100644
--- a/resources/qml/InviteDialog.qml
+++ b/resources/qml/InviteDialog.qml
@@ -23,6 +23,13 @@ ApplicationWindow {
         }
     }
 
+    function cleanUpAndClose() {
+        if (inviteeEntry.text !== "")
+            addInvite();
+        invitees.accept();
+        close();
+    }
+
     title: qsTr("Invite users to ") + roomName
     x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
     y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
@@ -30,6 +37,11 @@ ApplicationWindow {
     width: 340
 
     Shortcut {
+        sequence: "Ctrl+Enter"
+        onActivated: cleanUpAndClose()
+    }
+
+    Shortcut {
         sequence: StandardKey.Cancel
         onActivated: inviteDialogRoot.close()
     }
@@ -39,10 +51,6 @@ ApplicationWindow {
         anchors.margins: 10
         spacing: 10
 
-        Keys.onShortcutOverride: event.accepted = ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && (event.modifiers & Qt.ControlModifier))
-        Keys.onEnterPressed: if (event.modifiers & Qt.ControlModifier) invitees.accept()
-        Keys.onReturnPressed: if (event.modifiers & Qt.ControlModifier) invitees.accept()
-
         Label {
             text: qsTr("User ID to invite")
             Layout.fillWidth: true
@@ -64,14 +72,8 @@ ApplicationWindow {
                 }
                 Component.onCompleted: forceActiveFocus()
 
-//                Shortcut {
-//                    sequence: "Ctrl+Enter"
-//                    onActivated: invitees.accept()
-//                }
-
                 Keys.onShortcutOverride: event.accepted = ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && (event.modifiers & Qt.ControlModifier))
-                Keys.onEnterPressed: if (event.modifiers & Qt.ControlModifier) invitees.accept()
-                Keys.onReturnPressed: if (event.modifiers & Qt.ControlModifier) invitees.accept()
+                Keys.onPressed: if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && (event.modifiers === Qt.ControlModifier)) cleanUpAndClose()
 
             }
 
@@ -208,10 +210,7 @@ ApplicationWindow {
         Button {
             text: qsTr("Invite")
             DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
-            onClicked: {
-                invitees.accept();
-                inviteDialogRoot.close();
-            }
+            onClicked: cleanUpAndClose()
         }
 
         Button {