From f14058afe9409862d7dfbc8a2c7f3d00dce68cd5 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 19 Aug 2023 10:53:41 -0400 Subject: [PATCH] Add prompts before deleting an account or profile --- launcher/ui/Settings/AccountSettings.qml | 18 +++++++++++++++--- launcher/ui/Settings/ProfileSettings.qml | 18 +++++++++++++++--- launcher/ui/Settings/SettingsPage.qml | 1 - 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/launcher/ui/Settings/AccountSettings.qml b/launcher/ui/Settings/AccountSettings.qml index f9bcc13..715dc9b 100644 --- a/launcher/ui/Settings/AccountSettings.qml +++ b/launcher/ui/Settings/AccountSettings.qml @@ -224,10 +224,22 @@ FormCard.FormCardPage { description: !enabled ? i18n("Cannot delete the only account.") : "" icon.name: "delete" enabled: LauncherCore.accountManager.canDelete(page.account) - onClicked: { - LauncherCore.accountManager.deleteAccount(page.account) - applicationWindow().pageStack.layers.pop() + + Kirigami.PromptDialog { + id: deletePrompt + + title: i18nc("@title", "Delete Account") + subtitle: i18nc("@label", "Are you sure you want to delete this account?") + standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel + showCloseButton: false + + onAccepted: { + LauncherCore.accountManager.deleteAccount(page.account); + applicationWindow().pageStack.layers.pop(); + } } + + onClicked: deletePrompt.open() } } } \ No newline at end of file diff --git a/launcher/ui/Settings/ProfileSettings.qml b/launcher/ui/Settings/ProfileSettings.qml index 60140f6..0c84f90 100644 --- a/launcher/ui/Settings/ProfileSettings.qml +++ b/launcher/ui/Settings/ProfileSettings.qml @@ -330,10 +330,22 @@ FormCard.FormCardPage { description: !enabled ? i18n("Cannot delete the only profile.") : "" icon.name: "delete" enabled: LauncherCore.profileManager.canDelete(page.profile) - onClicked: { - LauncherCore.profileManager.deleteProfile(page.profile) - applicationWindow().pageStack.layers.pop() + + Kirigami.PromptDialog { + id: deletePrompt + + title: i18nc("@title", "Delete Profile") + subtitle: i18nc("@label", "Are you sure you want to delete this profile?") + standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel + showCloseButton: false + + onAccepted: { + LauncherCore.profileManager.deleteProfile(page.profile); + applicationWindow().pageStack.layers.pop(); + } } + + onClicked: deletePrompt.open() } } } \ No newline at end of file diff --git a/launcher/ui/Settings/SettingsPage.qml b/launcher/ui/Settings/SettingsPage.qml index 3fbcc80..cecf308 100644 --- a/launcher/ui/Settings/SettingsPage.qml +++ b/launcher/ui/Settings/SettingsPage.qml @@ -9,7 +9,6 @@ import QtQuick.Layouts 1.15 KirigamiSettings.CategorizedSettings { id: settingsPage - objectName: "settingsPage" actions: [ KirigamiSettings.SettingAction { actionName: "general"