Add a confirm dialog for the sign out
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
41
src/qml/Dialog/ConfirmLogoutDialog.qml
Normal file
41
src/qml/Dialog/ConfirmLogoutDialog.qml
Normal file
@@ -0,0 +1,41 @@
|
||||
// SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import QtQuick.Layouts 1.15
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
|
||||
QQC2.Dialog {
|
||||
id: root
|
||||
|
||||
ColumnLayout {
|
||||
Kirigami.Heading {
|
||||
text: i18n("Sign out")
|
||||
}
|
||||
QQC2.Label {
|
||||
text: i18n("Are you sure you want to sign out?")
|
||||
}
|
||||
}
|
||||
|
||||
x: Math.round((parent.width - width) / 2)
|
||||
y: Math.round((parent.height - height) / 2)
|
||||
modal: true
|
||||
|
||||
footer: QQC2.DialogButtonBox {
|
||||
QQC2.Button {
|
||||
text: i18n("Cancel")
|
||||
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
|
||||
onClicked: root.close()
|
||||
}
|
||||
|
||||
QQC2.Button {
|
||||
text: i18n("Sign out")
|
||||
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
|
||||
onClicked: {
|
||||
Controller.logout(Controller.activeConnection, true);
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ Kirigami.ApplicationWindow {
|
||||
text: i18n("Logout")
|
||||
icon.name: "list-remove-user"
|
||||
enabled: Controller.accountCount > 0
|
||||
onTriggered: Controller.logout(Controller.activeConnection, true)
|
||||
onTriggered: confirmLogoutDialog.open()
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("Quit")
|
||||
@@ -280,6 +280,10 @@ Kirigami.ApplicationWindow {
|
||||
]
|
||||
}
|
||||
|
||||
ConfirmLogoutDialog {
|
||||
id: confirmLogoutDialog
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Controller.setBlur(pageStack, Config.blur && !Config.compactLayout);
|
||||
if (Config.minimizeToSystemTrayOnStartup && !Kirigami.Settings.isMobile && Controller.supportSystemTray && Config.systemTray) {
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<file alias="EmojiDialog.qml">qml/Dialog/EmojiDialog.qml</file>
|
||||
<file alias="OpenFileDialog.qml">qml/Dialog/OpenFileDialog.qml</file>
|
||||
<file alias="KeyVerificationDialog.qml">qml/Dialog/KeyVerification/KeyVerificationDialog.qml</file>
|
||||
<file alias="ConfirmLogoutDialog.qml">qml/Dialog/ConfirmLogoutDialog.qml</file>
|
||||
<file alias="Message.qml">qml/Dialog/KeyVerification/Message.qml</file>
|
||||
<file alias="EmojiItem.qml">qml/Dialog/KeyVerification/EmojiItem.qml</file>
|
||||
<file alias="EmojiRow.qml">qml/Dialog/KeyVerification/EmojiRow.qml</file>
|
||||
|
||||
Reference in New Issue
Block a user