feat: add actions to dismiss/cancel the add account form
Users may now cancel adding an account and dismiss the page. This change is particularly relevant in the context of an account that is being added via URI passed on the commandline: the user may now explicitly reject it. Additionally quitting Keysmith from the add account form is now also supported, hidden behding a boolean flag. This will be useful for the initial page when receiving an account via URI from the commandline: the user may reject the account and quit Keysmith via a single action. Issues: #7, #14master
parent
92e92557fa
commit
b0bc89810e
|
@ -15,8 +15,11 @@ import Keysmith.Validators 1.0 as Validators
|
|||
Kirigami.Page {
|
||||
id: root
|
||||
title: i18nc("@title:window", "Add new account")
|
||||
signal dismissed
|
||||
signal quit
|
||||
signal cancelled
|
||||
signal newAccount(var input)
|
||||
property Models.AccountListModel accounts: Keysmith.accountListModel()
|
||||
property bool quitEnabled: false
|
||||
property bool detailsEnabled: false
|
||||
property bool validateAccountAvailability: true
|
||||
|
||||
|
@ -117,13 +120,28 @@ Kirigami.Page {
|
|||
}
|
||||
}
|
||||
|
||||
actions.left: Kirigami.Action {
|
||||
text: i18nc("@action:button cancel and dismiss the add account form", "Cancel")
|
||||
iconName: "edit-undo"
|
||||
onTriggered: {
|
||||
root.cancelled();
|
||||
}
|
||||
}
|
||||
actions.right: Kirigami.Action {
|
||||
text: i18nc("@action:button Dismiss the error page and quit Keysmtih", "Quit")
|
||||
iconName: "application-exit"
|
||||
enabled: root.quitEnabled
|
||||
visible: root.quitEnabled
|
||||
onTriggered: {
|
||||
root.quit();
|
||||
}
|
||||
}
|
||||
actions.main: Kirigami.Action {
|
||||
text: i18n("Add")
|
||||
iconName: "answer-correct"
|
||||
enabled: acceptable
|
||||
onTriggered: {
|
||||
root.accounts.addAccount(root.validatedInput);
|
||||
root.dismissed();
|
||||
root.newAccount(root.validatedInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,10 +49,21 @@ Kirigami.ApplicationWindow {
|
|||
id: addPageComponent
|
||||
AddAccount {
|
||||
accounts: root.accounts
|
||||
onDismissed: {
|
||||
pageStack.pop();
|
||||
addActionEnabled = true;
|
||||
onCancelled: {
|
||||
popAddAccountPage();
|
||||
}
|
||||
onNewAccount: {
|
||||
popAddAccountPage();
|
||||
root.accounts.addAccount(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function popAddAccountPage(next) {
|
||||
pageStack.pop();
|
||||
addActionEnabled = true;
|
||||
if (next) {
|
||||
pageStack.push(next);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue