From ba58c6357e8e4b021eacc8041dad966c4cc3b4cc Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Thu, 24 Feb 2022 16:14:55 +0100 Subject: [PATCH] add initial dialog for opening wallets, initial coverage also for splitting and db upgrades --- electrum/gui/qml/components/OpenWallet.qml | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 electrum/gui/qml/components/OpenWallet.qml diff --git a/electrum/gui/qml/components/OpenWallet.qml b/electrum/gui/qml/components/OpenWallet.qml new file mode 100644 index 000000000..d072b54b1 --- /dev/null +++ b/electrum/gui/qml/components/OpenWallet.qml @@ -0,0 +1,126 @@ +import QtQuick 2.6 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.1 + +import org.electrum 1.0 + +Pane { + id: openwalletdialog + + property string title: qsTr("Open Wallet") + + property string name + property string path + + property bool _unlockClicked: false + + GridLayout { + columns: 2 + width: parent.width + + Label { + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + text: name + } + + MessagePane { + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + text: qsTr("Wallet requires password to unlock") + visible: wallet_db.needsPassword + width: parent.width * 2/3 + warning: true + } + + MessagePane { + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + text: qsTr("Invalid Password") + visible: wallet_db.invalidPassword && _unlockClicked + width: parent.width * 2/3 + error: true + } + + Label { + text: qsTr('Password') + visible: wallet_db.needsPassword + } + + TextField { + id: password + visible: wallet_db.needsPassword + echoMode: TextInput.Password + } + + Button { + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + visible: wallet_db.needsPassword + text: qsTr("Unlock") + onClicked: { + _unlockClicked = true + wallet_db.password = password.text + } + } + + Label { + text: qsTr('Select HW device') + visible: wallet_db.needsHWDevice + } + + ComboBox { + id: hw_device + model: ['','Not implemented'] + visible: wallet_db.needsHWDevice + } + + Label { + text: qsTr('Wallet requires splitting') + visible: wallet_db.requiresSplit + } + + Button { + visible: wallet_db.requiresSplit + text: qsTr('Split wallet') + onClicked: wallet_db.doSplit() + } + + Label { + text: qsTr('Wallet requires upgrade') + visible: wallet_db.requiresUpgrade + } + + Button { + visible: wallet_db.requiresUpgrade + text: qsTr('Upgrade') + onClicked: wallet_db.doUpgrade() + } + + Rectangle { + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignHCenter + visible: wallet_db.upgrading + width: 100 + height: 100 + color: "red" + } + + } + + WalletDB { + id: wallet_db + path: openwalletdialog.path + onSplitFinished: { + // if wallet needed splitting, we close the pane and refresh the wallet list + Daemon.availableWallets.reload() + app.stack.pop() + } + onReadyChanged: { + if (ready) { + app.stack.pop(null) + } + } + } + +}