qml: show wallet list as root if no wallet is loaded
Shows Wallets.qml as root if no wallet is loaded and removes the logic for no loaded wallet from the WalletMainView as WalletMainView won't be shown anymore without a Daemon.currentWallet.
This commit is contained in:
@@ -11,10 +11,9 @@ import "controls"
|
|||||||
Item {
|
Item {
|
||||||
id: mainView
|
id: mainView
|
||||||
|
|
||||||
property string title: Daemon.currentWallet ? Daemon.currentWallet.name : qsTr('no wallet loaded')
|
property string title: Daemon.currentWallet.name
|
||||||
|
|
||||||
property var _sendDialog
|
property var _sendDialog
|
||||||
property string _intentUri
|
|
||||||
|
|
||||||
property string _request_amount
|
property string _request_amount
|
||||||
property string _request_description
|
property string _request_description
|
||||||
@@ -188,7 +187,7 @@ Item {
|
|||||||
icon.source: '../../icons/wallet.png'
|
icon.source: '../../icons/wallet.png'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Wallet details')
|
text: qsTr('Wallet details')
|
||||||
enabled: Daemon.currentWallet && app.stack.currentItem.objectName != 'WalletDetails'
|
enabled: app.stack.currentItem.objectName != 'WalletDetails'
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('WalletDetails.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('WalletDetails.qml'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,7 +197,7 @@ Item {
|
|||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Addresses/Coins');
|
text: qsTr('Addresses/Coins');
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml'));
|
onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml'));
|
||||||
enabled: Daemon.currentWallet && app.stack.currentItem.objectName != 'Addresses'
|
enabled: app.stack.currentItem.objectName != 'Addresses'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
@@ -206,7 +205,7 @@ Item {
|
|||||||
icon.source: '../../icons/lightning.png'
|
icon.source: '../../icons/lightning.png'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Channels');
|
text: qsTr('Channels');
|
||||||
enabled: Daemon.currentWallet && Daemon.currentWallet.isLightning && app.stack.currentItem.objectName != 'Channels'
|
enabled: Daemon.currentWallet.isLightning && app.stack.currentItem.objectName != 'Channels'
|
||||||
onTriggered: menu.openPage(Qt.resolvedUrl('Channels.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('Channels.qml'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,62 +284,16 @@ Item {
|
|||||||
|
|
||||||
History {
|
History {
|
||||||
id: history
|
id: history
|
||||||
visible: Daemon.currentWallet
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
Layout.fillHeight: true
|
|
||||||
spacing: 2*constants.paddingXLarge
|
|
||||||
visible: !Daemon.currentWallet
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
text: qsTr('No wallet loaded')
|
|
||||||
font.pixelSize: constants.fontSizeXXLarge
|
|
||||||
}
|
|
||||||
|
|
||||||
Pane {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
padding: 0
|
|
||||||
background: Rectangle {
|
|
||||||
color: Material.dialogColor
|
|
||||||
}
|
|
||||||
FlatButton {
|
|
||||||
text: qsTr('Open/Create Wallet')
|
|
||||||
icon.source: '../../icons/wallet.png'
|
|
||||||
onClicked: {
|
|
||||||
if (Daemon.availableWallets.rowCount() > 0) {
|
|
||||||
stack.push(Qt.resolvedUrl('Wallets.qml'))
|
|
||||||
} else {
|
|
||||||
var newww = app.newWalletWizard.createObject(app)
|
|
||||||
newww.walletCreated.connect(function() {
|
|
||||||
Daemon.availableWallets.reload()
|
|
||||||
// and load the new wallet
|
|
||||||
Daemon.loadWallet(newww.path, newww.wizard_data['password'])
|
|
||||||
})
|
|
||||||
newww.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Item {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonContainer {
|
ButtonContainer {
|
||||||
id: buttonContainer
|
id: buttonContainer
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
FlatButton {
|
FlatButton {
|
||||||
id: receiveButton
|
id: receiveButton
|
||||||
visible: Daemon.currentWallet
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredWidth: 1
|
Layout.preferredWidth: 1
|
||||||
icon.source: '../../icons/tab_receive.png'
|
icon.source: '../../icons/tab_receive.png'
|
||||||
@@ -357,7 +310,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FlatButton {
|
FlatButton {
|
||||||
visible: Daemon.currentWallet
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredWidth: 1
|
Layout.preferredWidth: 1
|
||||||
icon.source: '../../icons/tab_send.png'
|
icon.source: '../../icons/tab_send.png'
|
||||||
@@ -489,25 +441,22 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: AppController
|
target: Daemon
|
||||||
function onUriReceived(uri) {
|
function onWalletLoaded() {
|
||||||
console.log('uri received: ' + uri)
|
if (!Daemon.currentWallet) { // wallet got deleted
|
||||||
if (!Daemon.currentWallet) {
|
app.stack.replaceRoot('Wallets.qml')
|
||||||
console.log('No wallet open, deferring')
|
|
||||||
_intentUri = uri
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
piResolver.recipient = uri
|
infobanner.hide() // start hidden when switching wallets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Daemon
|
target: app
|
||||||
function onWalletLoaded() {
|
function onPendingIntentChanged() {
|
||||||
infobanner.hide() // start hidden when switching wallets
|
if (app.pendingIntent) {
|
||||||
if (_intentUri) {
|
piResolver.recipient = app.pendingIntent
|
||||||
piResolver.recipient = _intentUri
|
app.pendingIntent = ""
|
||||||
_intentUri = ''
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -819,5 +768,12 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
console.log("WalletMainView completed: ", Daemon.currentWallet.name)
|
||||||
|
if (app.pendingIntent) {
|
||||||
|
piResolver.recipient = app.pendingIntent
|
||||||
|
app.pendingIntent = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,11 @@ Pane {
|
|||||||
target: Daemon
|
target: Daemon
|
||||||
function onWalletLoaded() {
|
function onWalletLoaded() {
|
||||||
if (app.stack.currentItem.objectName == 'Wallets')
|
if (app.stack.currentItem.objectName == 'Wallets')
|
||||||
app.stack.pop()
|
if (app.stack.getRoot().objectName == 'Wallets') {
|
||||||
|
app.stack.replaceRoot('WalletMainView.qml')
|
||||||
|
} else {
|
||||||
|
app.stack.pop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ ApplicationWindow
|
|||||||
property alias keyboardFreeZone: _keyboardFreeZone
|
property alias keyboardFreeZone: _keyboardFreeZone
|
||||||
property alias infobanner: _infobanner
|
property alias infobanner: _infobanner
|
||||||
|
|
||||||
|
property string pendingIntent: ""
|
||||||
|
|
||||||
property variant activeDialogs: []
|
property variant activeDialogs: []
|
||||||
|
|
||||||
property var _exceptionDialog
|
property var _exceptionDialog
|
||||||
@@ -120,7 +122,7 @@ ApplicationWindow
|
|||||||
|
|
||||||
header: ToolBar {
|
header: ToolBar {
|
||||||
id: toolbar
|
id: toolbar
|
||||||
|
|
||||||
// Add top margin for status bar on Android when using edge-to-edge
|
// Add top margin for status bar on Android when using edge-to-edge
|
||||||
topPadding: app.statusBarHeight
|
topPadding: app.statusBarHeight
|
||||||
|
|
||||||
@@ -269,7 +271,7 @@ ApplicationWindow
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
initialItem: Component {
|
initialItem: Component {
|
||||||
WalletMainView {}
|
Wallets {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRoot() {
|
function getRoot() {
|
||||||
@@ -282,6 +284,10 @@ ApplicationWindow
|
|||||||
mainStackView.push(item)
|
mainStackView.push(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function replaceRoot(item_url) {
|
||||||
|
mainStackView.clear()
|
||||||
|
mainStackView.push(Qt.resolvedUrl(item_url))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add bottom padding for navigation bar on Android when UI is edge-to-edge
|
// Add bottom padding for navigation bar on Android when UI is edge-to-edge
|
||||||
@@ -698,6 +704,10 @@ ApplicationWindow
|
|||||||
if (obj != null)
|
if (obj != null)
|
||||||
app.pluginobjects[name] = obj
|
app.pluginobjects[name] = obj
|
||||||
}
|
}
|
||||||
|
function onUriReceived(uri) {
|
||||||
|
console.log('uri received (main): ' + uri)
|
||||||
|
app.pendingIntent = uri
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginsComponentsByName(comp_name) {
|
function pluginsComponentsByName(comp_name) {
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class QEDaemon(AuthMixin, QObject):
|
|||||||
except InvalidPassword:
|
except InvalidPassword:
|
||||||
self.walletRequiresPassword.emit(self._name, self._path)
|
self.walletRequiresPassword.emit(self._name, self._path)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
self.walletOpenError.emit(_('File not found'))
|
self.walletOpenError.emit(_('File not found') + f":\n{self._path}")
|
||||||
except StorageReadWriteError:
|
except StorageReadWriteError:
|
||||||
self.walletOpenError.emit(_('Could not read/write file'))
|
self.walletOpenError.emit(_('Could not read/write file'))
|
||||||
except WalletFileException as e:
|
except WalletFileException as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user