Hide main 'Add' action if the add account form is already opened.
In this way we can avoid the confusing situation with multiple add account forms open by mistake.master
parent
042b51d183
commit
3734e908a9
|
@ -33,21 +33,28 @@ Kirigami.ApplicationWindow {
|
||||||
|
|
||||||
pageStack.initialPage: accounts.rowCount() > 0 ? mainPageComponent : addPageComponent
|
pageStack.initialPage: accounts.rowCount() > 0 ? mainPageComponent : addPageComponent
|
||||||
|
|
||||||
|
property bool addActionEnabled: true
|
||||||
|
|
||||||
AccountModel {
|
AccountModel {
|
||||||
id: accounts
|
id: accounts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Kirigami.Action {
|
||||||
|
id: addAction
|
||||||
|
text: "Add"
|
||||||
|
iconName: "list-add"
|
||||||
|
visible: addActionEnabled
|
||||||
|
onTriggered: {
|
||||||
|
pageStack.push(addPageComponent);
|
||||||
|
addActionEnabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: mainPageComponent
|
id: mainPageComponent
|
||||||
Kirigami.ScrollablePage {
|
Kirigami.ScrollablePage {
|
||||||
title: "OTP"
|
title: "OTP"
|
||||||
actions.main: Kirigami.Action {
|
actions.main: addAction
|
||||||
text: "Add"
|
|
||||||
iconName: "list-add"
|
|
||||||
onTriggered: {
|
|
||||||
pageStack.push(addPageComponent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
text: "No account set up. Use the add button to add accounts."
|
text: "No account set up. Use the add button to add accounts."
|
||||||
visible: view.count == 0
|
visible: view.count == 0
|
||||||
|
@ -146,6 +153,7 @@ Kirigami.ApplicationWindow {
|
||||||
newAccount.pinLength = parseInt(pinLengthField.text)
|
newAccount.pinLength = parseInt(pinLengthField.text)
|
||||||
|
|
||||||
pageStack.pop();
|
pageStack.pop();
|
||||||
|
addActionEnabled = true;
|
||||||
/*
|
/*
|
||||||
* Check if the pageStack is now 'empty', which will be the case if
|
* Check if the pageStack is now 'empty', which will be the case if
|
||||||
* the starting page was this addPageComponent.
|
* the starting page was this addPageComponent.
|
||||||
|
|
Loading…
Reference in New Issue