1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Add prompts before deleting an account or profile

This commit is contained in:
Joshua Goins 2023-08-19 10:53:41 -04:00
parent c2fdf5961e
commit f14058afe9
3 changed files with 30 additions and 7 deletions

View file

@ -224,10 +224,22 @@ FormCard.FormCardPage {
description: !enabled ? i18n("Cannot delete the only account.") : "" description: !enabled ? i18n("Cannot delete the only account.") : ""
icon.name: "delete" icon.name: "delete"
enabled: LauncherCore.accountManager.canDelete(page.account) enabled: LauncherCore.accountManager.canDelete(page.account)
onClicked: {
LauncherCore.accountManager.deleteAccount(page.account) Kirigami.PromptDialog {
applicationWindow().pageStack.layers.pop() 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()
} }
} }
} }

View file

@ -330,10 +330,22 @@ FormCard.FormCardPage {
description: !enabled ? i18n("Cannot delete the only profile.") : "" description: !enabled ? i18n("Cannot delete the only profile.") : ""
icon.name: "delete" icon.name: "delete"
enabled: LauncherCore.profileManager.canDelete(page.profile) enabled: LauncherCore.profileManager.canDelete(page.profile)
onClicked: {
LauncherCore.profileManager.deleteProfile(page.profile) Kirigami.PromptDialog {
applicationWindow().pageStack.layers.pop() 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()
} }
} }
} }

View file

@ -9,7 +9,6 @@ import QtQuick.Layouts 1.15
KirigamiSettings.CategorizedSettings { KirigamiSettings.CategorizedSettings {
id: settingsPage id: settingsPage
objectName: "settingsPage"
actions: [ actions: [
KirigamiSettings.SettingAction { KirigamiSettings.SettingAction {
actionName: "general" actionName: "general"