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:
parent
c2fdf5961e
commit
f14058afe9
3 changed files with 30 additions and 7 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,6 @@ import QtQuick.Layouts 1.15
|
|||
KirigamiSettings.CategorizedSettings {
|
||||
id: settingsPage
|
||||
|
||||
objectName: "settingsPage"
|
||||
actions: [
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "general"
|
||||
|
|
Loading…
Add table
Reference in a new issue