qml: handle android back button in wizard, map to prev page action instead of closing wizard.
Also add initial focus to WCHaveSeed and WCHaveMasterKey wizard components.
This commit is contained in:
@@ -114,7 +114,6 @@ WizardComponent {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumHeight: 80
|
Layout.minimumHeight: 80
|
||||||
font.family: FixedFont
|
font.family: FixedFont
|
||||||
focus: true
|
|
||||||
wrapMode: TextEdit.WrapAnywhere
|
wrapMode: TextEdit.WrapAnywhere
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if (activeFocus)
|
if (activeFocus)
|
||||||
@@ -194,5 +193,6 @@ WizardComponent {
|
|||||||
cosigner = wizard_data['multisig_current_cosigner']
|
cosigner = wizard_data['multisig_current_cosigner']
|
||||||
participants = wizard_data['multisig_participants']
|
participants = wizard_data['multisig_participants']
|
||||||
}
|
}
|
||||||
|
Qt.callLater(masterkey_ta.forceActiveFocus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,6 +241,7 @@ WizardComponent {
|
|||||||
cosigner = wizard_data['multisig_current_cosigner']
|
cosigner = wizard_data['multisig_current_cosigner']
|
||||||
}
|
}
|
||||||
setSeedTypeHelpText()
|
setSeedTypeHelpText()
|
||||||
|
Qt.callLater(seedtext.forceActiveFocus)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ ElDialog {
|
|||||||
title: wizardTitle + (pages.currentItem.title ? ' - ' + pages.currentItem.title : '')
|
title: wizardTitle + (pages.currentItem.title ? ' - ' + pages.currentItem.title : '')
|
||||||
iconSource: '../../../icons/electrum.png'
|
iconSource: '../../../icons/electrum.png'
|
||||||
|
|
||||||
|
// android back button triggers close() on Popups. Disabling close here,
|
||||||
|
// we handle that via Keys.onReleased event handler in the root layout.
|
||||||
|
closePolicy: Popup.NoAutoClose
|
||||||
|
|
||||||
property string wizardTitle
|
property string wizardTitle
|
||||||
|
|
||||||
property var wizard_data
|
property var wizard_data
|
||||||
@@ -86,6 +90,14 @@ ElDialog {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
|
// root Item in Wizard, capture back button here and delegate to main
|
||||||
|
Keys.onReleased: {
|
||||||
|
if (event.key == Qt.Key_Back) {
|
||||||
|
console.log("Back button within wizard")
|
||||||
|
app.close() // this handles unwind of dialogs/stack
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SwipeView {
|
SwipeView {
|
||||||
id: pages
|
id: pages
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: root
|
||||||
signal next
|
signal next
|
||||||
signal prev
|
signal prev
|
||||||
signal accept
|
signal accept
|
||||||
@@ -28,6 +29,10 @@ Item {
|
|||||||
// wizard_data keys if apply() depends on variables set in descendant
|
// wizard_data keys if apply() depends on variables set in descendant
|
||||||
// Component.onCompleted handler.
|
// Component.onCompleted handler.
|
||||||
Qt.callLater(checkIsLast)
|
Qt.callLater(checkIsLast)
|
||||||
|
|
||||||
|
// move focus to root of WizardComponent, otherwise Android back button
|
||||||
|
// might be missed in Wizard root Item.
|
||||||
|
root.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user