summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-09-29 20:15:25 -0400
committerLoren Burkholder <computersemiexpert@outlook.com>2021-10-05 20:12:24 -0400
commit81406171a0d6b6751e9eb1777faf6ea895affcc7 (patch)
treec4b0e6aebf8e904556e0c94a4a810c985e2f906f /resources
parentFix appimage builder url (diff)
downloadnheko-81406171a0d6b6751e9eb1777faf6ea895affcc7.tar.xz
QML the logout dialog
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/Root.qml16
-rw-r--r--resources/qml/dialogs/LogoutDialog.qml19
-rw-r--r--resources/res.qrc1
3 files changed, 36 insertions, 0 deletions
diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml
index 4207f35b..29da45eb 100644
--- a/resources/qml/Root.qml
+++ b/resources/qml/Root.qml
@@ -111,6 +111,13 @@ Page {
 
     }
 
+    Component {
+        id: logoutDialog
+
+        LogoutDialog {
+        }
+    }
+
     Shortcut {
         sequence: "Ctrl+K"
         onActivated: {
@@ -136,6 +143,15 @@ Page {
     }
 
     Connections {
+        function onOpenLogoutDialog() {
+            var dialog = logoutDialog.createObject(timelineRoot);
+            dialog.open();
+        }
+
+        target: Nheko
+    }
+
+    Connections {
         function onNewDeviceVerificationRequest(flow) {
             var dialog = deviceVerificationDialog.createObject(timelineRoot, {
                 "flow": flow
diff --git a/resources/qml/dialogs/LogoutDialog.qml b/resources/qml/dialogs/LogoutDialog.qml
new file mode 100644
index 00000000..9e107097
--- /dev/null
+++ b/resources/qml/dialogs/LogoutDialog.qml
@@ -0,0 +1,19 @@
+// SPDX-FileCopyrightText: 2021 Nheko Contributors
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import Qt.labs.platform 1.1
+import im.nheko 1.0
+
+MessageDialog {
+    id: logoutRoot
+
+    title: qsTr("Log out")
+    text: CallManager.isOnCall ? qsTr("A call is in progress. Log out?") : qsTr("Are you sure you want to log out?")
+    modality: Qt.WindowModal
+    flags: Qt.Tool | Qt.WindowStaysOnTopHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
+    buttons: Dialog.Ok | Dialog.Cancel
+    onAccepted: Nheko.logout()
+}
diff --git a/resources/res.qrc b/resources/res.qrc
index a001a929..af684fc0 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -183,6 +183,7 @@
         <file>qml/dialogs/RoomMembers.qml</file>
         <file>qml/dialogs/RoomSettings.qml</file>
         <file>qml/dialogs/UserProfile.qml</file>
+        <file>qml/dialogs/LogoutDialog.qml</file>
     </qresource>
     <qresource prefix="/media">
         <file>media/ring.ogg</file>