Browse Source

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.
master
Sander van Grieken 3 years ago
parent
commit
30079c06a8
  1. 2
      electrum/gui/qml/components/wizard/WCHaveMasterKey.qml
  2. 1
      electrum/gui/qml/components/wizard/WCHaveSeed.qml
  3. 12
      electrum/gui/qml/components/wizard/Wizard.qml
  4. 5
      electrum/gui/qml/components/wizard/WizardComponent.qml

2
electrum/gui/qml/components/wizard/WCHaveMasterKey.qml

@ -114,7 +114,6 @@ WizardComponent {
Layout.fillWidth: true
Layout.minimumHeight: 80
font.family: FixedFont
focus: true
wrapMode: TextEdit.WrapAnywhere
onTextChanged: {
if (activeFocus)
@ -194,5 +193,6 @@ WizardComponent {
cosigner = wizard_data['multisig_current_cosigner']
participants = wizard_data['multisig_participants']
}
Qt.callLater(masterkey_ta.forceActiveFocus)
}
}

1
electrum/gui/qml/components/wizard/WCHaveSeed.qml

@ -241,6 +241,7 @@ WizardComponent {
cosigner = wizard_data['multisig_current_cosigner']
}
setSeedTypeHelpText()
Qt.callLater(seedtext.forceActiveFocus)
}
}

12
electrum/gui/qml/components/wizard/Wizard.qml

@ -15,6 +15,10 @@ ElDialog {
title: wizardTitle + (pages.currentItem.title ? ' - ' + pages.currentItem.title : '')
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 var wizard_data
@ -86,6 +90,14 @@ ElDialog {
anchors.fill: parent
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 {
id: pages
Layout.fillWidth: true

5
electrum/gui/qml/components/wizard/WizardComponent.qml

@ -1,6 +1,7 @@
import QtQuick 2.0
Item {
id: root
signal next
signal prev
signal accept
@ -28,6 +29,10 @@ Item {
// wizard_data keys if apply() depends on variables set in descendant
// Component.onCompleted handler.
Qt.callLater(checkIsLast)
// move focus to root of WizardComponent, otherwise Android back button
// might be missed in Wizard root Item.
root.forceActiveFocus()
}
}

Loading…
Cancel
Save