Port all confirm dialogs to Kirigami.PromptDialog
This commit is contained in:
committed by
Tobias Fella
parent
40d55805ff
commit
f45226a680
@@ -2,35 +2,34 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Controls as QQC2
|
||||||
|
|
||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||||||
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
FormCard.FormCardPage {
|
Kirigami.PromptDialog {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property NeoChatConnection connection
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
title: i18nc("@title", "Deactivate Account")
|
title: i18nc("@title:dialog", "Confirm Account Deactivation")
|
||||||
|
subtitle: i18n("Your account will be permanently disabled.\nThis cannot be undone.\nYour Matrix ID will not be available for new accounts.\nYour messages will stay available.")
|
||||||
|
|
||||||
FormCard.FormHeader {
|
dialogType: Kirigami.PromptDialog.Warning
|
||||||
title: i18nc("@title", "Deactivate Account")
|
|
||||||
|
mainItem: FormCard.FormTextFieldDelegate {
|
||||||
|
id: passwordField
|
||||||
|
label: i18nc("@label:textbox", "Password")
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
horizontalPadding: 0
|
||||||
|
bottomPadding: 0
|
||||||
}
|
}
|
||||||
FormCard.FormCard {
|
|
||||||
FormCard.FormTextDelegate {
|
|
||||||
text: i18nc("@title", "Warning")
|
|
||||||
description: i18n("Your account will be permanently disabled.\nThis cannot be undone.\nYour Matrix ID will not be available for new accounts.\nYour messages will stay available.")
|
|
||||||
}
|
|
||||||
|
|
||||||
FormCard.FormTextFieldDelegate {
|
footer: QQC2.DialogButtonBox {
|
||||||
id: passwordField
|
standardButtons: QQC2.Dialog.Cancel
|
||||||
label: i18n("Password")
|
|
||||||
echoMode: TextInput.Password
|
|
||||||
}
|
|
||||||
|
|
||||||
FormCard.FormButtonDelegate {
|
QQC2.Button {
|
||||||
text: i18n("Deactivate account")
|
text: i18n("Deactivate account")
|
||||||
icon.name: "emblem-warning"
|
icon.name: "emblem-warning"
|
||||||
enabled: passwordField.text.length > 0
|
enabled: passwordField.text.length > 0
|
||||||
|
|||||||
@@ -4,35 +4,25 @@
|
|||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
QQC2.Dialog {
|
Kirigami.PromptDialog {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
title: i18nc("@title:dialog", "Activate Encryption")
|
||||||
|
subtitle: i18n("It will not be possible to deactivate the encryption after it is enabled.")
|
||||||
|
dialogType: Kirigami.PromptDialog.Warning
|
||||||
|
|
||||||
property NeoChatRoom room
|
property NeoChatRoom room
|
||||||
|
|
||||||
ColumnLayout {
|
onRejected: {
|
||||||
Kirigami.Heading {
|
root.close();
|
||||||
text: i18n("Activate Encryption")
|
|
||||||
}
|
|
||||||
QQC2.Label {
|
|
||||||
text: i18n("It will not be possible to deactivate the encryption after it is enabled.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x: Math.round((parent.width - width) / 2)
|
|
||||||
y: Math.round((parent.height - height) / 2)
|
|
||||||
modal: true
|
|
||||||
|
|
||||||
footer: QQC2.DialogButtonBox {
|
footer: QQC2.DialogButtonBox {
|
||||||
QQC2.Button {
|
standardButtons: QQC2.Dialog.Cancel
|
||||||
text: i18n("Cancel")
|
|
||||||
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
|
|
||||||
onClicked: root.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
QQC2.Button {
|
QQC2.Button {
|
||||||
text: i18n("Activate Encryption")
|
text: i18n("Activate Encryption")
|
||||||
|
|||||||
@@ -5,28 +5,30 @@ import QtQuick
|
|||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
Kirigami.Dialog {
|
Kirigami.PromptDialog {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property NeoChatRoom room
|
required property NeoChatRoom room
|
||||||
|
|
||||||
width: Kirigami.Units.gridUnit * 24
|
|
||||||
|
|
||||||
title: i18nc("@title:dialog", "Confirm Leaving Room")
|
title: i18nc("@title:dialog", "Confirm Leaving Room")
|
||||||
|
subtitle: root.room ? i18nc("Do you really want to leave <room name>?", "Do you really want to leave %1?", root.room.displayNameForHtml) : ""
|
||||||
|
dialogType: Kirigami.PromptDialog.Warning
|
||||||
|
|
||||||
contentItem: FormCard.FormTextDelegate {
|
onRejected: {
|
||||||
text: root.room ? i18nc("Do you really want to leave <room name>?", "Do you really want to leave %1?", root.room.displayNameForHtml) : ""
|
root.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
customFooterActions: [
|
footer: QQC2.DialogButtonBox {
|
||||||
Kirigami.Action {
|
standardButtons: QQC2.Dialog.Cancel
|
||||||
|
|
||||||
|
QQC2.Button {
|
||||||
text: i18nc("@action:button", "Leave Room")
|
text: i18nc("@action:button", "Leave Room")
|
||||||
|
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
|
||||||
icon.name: "arrow-left"
|
icon.name: "arrow-left"
|
||||||
onTriggered: RoomManager.leaveRoom(root.room)
|
onClicked: RoomManager.leaveRoom(root.room)
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,38 +3,28 @@
|
|||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
QQC2.Dialog {
|
Kirigami.PromptDialog {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property NeoChatConnection connection
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
ColumnLayout {
|
title: i18nc("@title:dialog", "Sign out")
|
||||||
Kirigami.Heading {
|
subtitle: i18n("Are you sure you want to sign out?")
|
||||||
text: i18n("Sign out")
|
dialogType: Kirigami.PromptDialog.Warning
|
||||||
}
|
|
||||||
QQC2.Label {
|
onRejected: {
|
||||||
text: i18n("Are you sure you want to sign out?")
|
root.close();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x: parent ? Math.round((parent.width - width) / 2) : 0
|
|
||||||
y: parent ? Math.round((parent.height - height) / 2) : 0
|
|
||||||
modal: true
|
|
||||||
|
|
||||||
footer: QQC2.DialogButtonBox {
|
footer: QQC2.DialogButtonBox {
|
||||||
QQC2.Button {
|
standardButtons: QQC2.Dialog.Cancel
|
||||||
text: i18n("Cancel")
|
|
||||||
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
|
|
||||||
onClicked: root.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
QQC2.Button {
|
QQC2.Button {
|
||||||
text: i18n("Sign out")
|
text: i18nc("@action:button", "Sign out")
|
||||||
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
|
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.connection.logout(true);
|
root.connection.logout(true);
|
||||||
|
|||||||
@@ -6,28 +6,22 @@ import QtQuick.Controls as QQC2
|
|||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
||||||
Kirigami.Dialog {
|
Kirigami.PromptDialog {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property url link
|
property url link
|
||||||
|
|
||||||
width: Kirigami.Units.gridUnit * 24
|
title: i18nc("@title:dialog", "Open URL")
|
||||||
height: Kirigami.Units.gridUnit * 8
|
subtitle: xi18nc("@info", "Do you want to open <link>%1</link>?", root.link)
|
||||||
|
dialogType: Kirigami.PromptDialog.Warning
|
||||||
|
|
||||||
title: i18nc("@title", "Open URL")
|
|
||||||
standardButtons: QQC2.DialogButtonBox.Open | QQC2.DialogButtonBox.Cancel
|
standardButtons: QQC2.DialogButtonBox.Open | QQC2.DialogButtonBox.Cancel
|
||||||
|
|
||||||
contentItem: QQC2.Label {
|
|
||||||
text: xi18nc("@info", "Do you want to open <link>%1</link>?", root.link)
|
|
||||||
wrapMode: QQC2.Label.Wrap
|
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
|
||||||
verticalAlignment: Qt.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
Qt.openUrlExternally(root.link);
|
Qt.openUrlExternally(root.link);
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
onRejected: {
|
onRejected: {
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,12 @@ Loader {
|
|||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18n("Leave Room")
|
text: i18n("Leave Room")
|
||||||
icon.name: "go-previous"
|
icon.name: "go-previous"
|
||||||
onTriggered: RoomManager.leaveRoom(room)
|
onTriggered: {
|
||||||
|
Qt.createComponent('org.kde.neochat', 'ConfirmLeaveDialog').createObject(root.QQC2.ApplicationWindow.window, {
|
||||||
|
room: root.room
|
||||||
|
}).open();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
|
|||||||
@@ -239,11 +239,13 @@ FormCard.FormCardPage {
|
|||||||
FormCard.FormButtonDelegate {
|
FormCard.FormButtonDelegate {
|
||||||
id: deactivateAccountButton
|
id: deactivateAccountButton
|
||||||
text: i18n("Deactivate Account")
|
text: i18n("Deactivate Account")
|
||||||
onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ConfirmDeactivateAccountDialog'), {
|
onClicked: {
|
||||||
connection: root.connection
|
const component = Qt.createComponent('org.kde.neochat', 'ConfirmDeactivateAccountDialog');
|
||||||
}, {
|
const dialog = component.createObject(QQC2.ApplicationWindow.window, {
|
||||||
title: i18nc("@title", "Confirm Deactivating Account")
|
connection: root.connection,
|
||||||
})
|
});
|
||||||
|
dialog.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user