2023-07-17 10:49:06 +02:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Controls.Material
|
2021-04-05 12:24:45 +02:00
|
|
|
|
2022-02-16 18:07:28 +01:00
|
|
|
import org.electrum 1.0
|
|
|
|
|
|
2022-04-06 13:52:21 +02:00
|
|
|
import "controls"
|
|
|
|
|
|
2021-04-07 16:50:34 +02:00
|
|
|
Pane {
|
|
|
|
|
id: rootItem
|
2022-11-02 16:43:10 +01:00
|
|
|
objectName: 'Wallets'
|
2021-04-05 12:24:45 +02:00
|
|
|
|
2022-11-02 16:43:10 +01:00
|
|
|
padding: 0
|
|
|
|
|
|
2023-03-02 15:44:30 +01:00
|
|
|
property string title: qsTr('Wallets')
|
|
|
|
|
|
2022-06-15 18:19:04 +02:00
|
|
|
function createWallet() {
|
2023-02-23 18:20:29 +01:00
|
|
|
var dialog = app.newWalletWizard.createObject(app)
|
2022-06-15 18:19:04 +02:00
|
|
|
dialog.open()
|
|
|
|
|
dialog.walletCreated.connect(function() {
|
|
|
|
|
Daemon.availableWallets.reload()
|
|
|
|
|
// and load the new wallet
|
2023-04-25 13:40:16 +02:00
|
|
|
Daemon.loadWallet(dialog.path, dialog.wizard_data['password'])
|
2022-06-15 18:19:04 +02:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-07 16:50:34 +02:00
|
|
|
ColumnLayout {
|
2022-11-02 16:43:10 +01:00
|
|
|
id: rootLayout
|
2023-07-14 13:51:08 +02:00
|
|
|
anchors.fill: parent
|
2022-11-02 16:43:10 +01:00
|
|
|
spacing: 0
|
2021-04-05 12:24:45 +02:00
|
|
|
|
2022-11-02 16:43:10 +01:00
|
|
|
ColumnLayout {
|
2023-07-14 13:51:08 +02:00
|
|
|
Layout.fillWidth: true
|
2021-04-05 12:24:45 +02:00
|
|
|
|
2023-01-17 00:34:01 +01:00
|
|
|
Heading {
|
2022-11-02 16:43:10 +01:00
|
|
|
text: qsTr('Wallets')
|
2021-04-07 16:50:34 +02:00
|
|
|
}
|
2022-05-10 19:31:25 +02:00
|
|
|
|
2022-11-02 16:43:10 +01:00
|
|
|
Frame {
|
|
|
|
|
id: detailsFrame
|
2023-07-14 13:51:08 +02:00
|
|
|
Layout.fillWidth: true
|
2022-11-02 16:43:10 +01:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
verticalPadding: 0
|
|
|
|
|
horizontalPadding: 0
|
|
|
|
|
background: PaneInsetBackground {}
|
2022-03-24 21:10:01 +01:00
|
|
|
|
2023-07-13 16:19:37 +02:00
|
|
|
ElListView {
|
2022-05-10 19:31:25 +02:00
|
|
|
id: listview
|
2022-11-02 16:43:10 +01:00
|
|
|
anchors.fill: parent
|
2022-05-10 19:31:25 +02:00
|
|
|
clip: true
|
|
|
|
|
model: Daemon.availableWallets
|
|
|
|
|
|
2022-06-21 00:01:30 +02:00
|
|
|
delegate: ItemDelegate {
|
2022-05-10 19:31:25 +02:00
|
|
|
width: ListView.view.width
|
|
|
|
|
height: row.height
|
|
|
|
|
|
2022-06-21 00:01:30 +02:00
|
|
|
onClicked: {
|
2023-09-26 12:48:25 +02:00
|
|
|
if (!Daemon.currentWallet || Daemon.currentWallet.name != model.name) {
|
2023-04-29 14:13:12 +02:00
|
|
|
if (!Daemon.loading) // wallet load in progress
|
|
|
|
|
Daemon.loadWallet(model.path)
|
2023-09-26 12:48:25 +02:00
|
|
|
} else {
|
2023-02-23 20:46:56 +01:00
|
|
|
app.stack.pop()
|
2023-09-26 12:48:25 +02:00
|
|
|
}
|
2022-06-21 00:01:30 +02:00
|
|
|
}
|
|
|
|
|
|
2022-05-10 19:31:25 +02:00
|
|
|
RowLayout {
|
|
|
|
|
id: row
|
|
|
|
|
spacing: 10
|
|
|
|
|
x: constants.paddingSmall
|
|
|
|
|
width: parent.width - 2 * constants.paddingSmall
|
|
|
|
|
|
|
|
|
|
Image {
|
|
|
|
|
id: walleticon
|
|
|
|
|
source: "../../icons/wallet.png"
|
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
|
Layout.preferredWidth: constants.iconSizeLarge
|
|
|
|
|
Layout.preferredHeight: constants.iconSizeLarge
|
2022-06-21 00:01:30 +02:00
|
|
|
Layout.topMargin: constants.paddingSmall
|
|
|
|
|
Layout.bottomMargin: constants.paddingSmall
|
2022-05-10 19:31:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Label {
|
2023-04-20 10:27:30 +02:00
|
|
|
Layout.fillWidth: true
|
2022-05-10 19:31:25 +02:00
|
|
|
font.pixelSize: constants.fontSizeLarge
|
|
|
|
|
text: model.name
|
2023-04-20 10:27:30 +02:00
|
|
|
elide: Label.ElideRight
|
2022-06-21 00:01:30 +02:00
|
|
|
color: model.active ? Material.foreground : Qt.darker(Material.foreground, 1.20)
|
2022-05-10 19:31:25 +02:00
|
|
|
}
|
|
|
|
|
|
2022-06-21 00:01:30 +02:00
|
|
|
Tag {
|
|
|
|
|
visible: Daemon.currentWallet && model.name == Daemon.currentWallet.name
|
|
|
|
|
text: qsTr('Current')
|
|
|
|
|
border.color: Material.foreground
|
|
|
|
|
font.bold: true
|
|
|
|
|
labelcolor: Material.foreground
|
|
|
|
|
}
|
|
|
|
|
Tag {
|
|
|
|
|
visible: model.active
|
|
|
|
|
text: qsTr('Active')
|
|
|
|
|
border.color: 'green'
|
|
|
|
|
labelcolor: 'green'
|
|
|
|
|
}
|
|
|
|
|
Tag {
|
|
|
|
|
visible: !model.active
|
|
|
|
|
text: qsTr('Not loaded')
|
|
|
|
|
border.color: 'grey'
|
|
|
|
|
labelcolor: 'grey'
|
2022-03-24 21:10:01 +01:00
|
|
|
}
|
2022-03-10 12:25:18 +01:00
|
|
|
}
|
2021-04-07 16:50:34 +02:00
|
|
|
}
|
2022-03-24 21:10:01 +01:00
|
|
|
|
2022-05-10 19:31:25 +02:00
|
|
|
ScrollIndicator.vertical: ScrollIndicator { }
|
|
|
|
|
}
|
2021-04-06 14:13:51 +02:00
|
|
|
}
|
2022-11-02 16:43:10 +01:00
|
|
|
|
2022-03-24 21:10:01 +01:00
|
|
|
}
|
2021-04-06 14:13:51 +02:00
|
|
|
|
2022-11-02 16:43:10 +01:00
|
|
|
FlatButton {
|
|
|
|
|
Layout.fillWidth: true
|
2023-04-24 12:38:41 +02:00
|
|
|
text: qsTr('Create Wallet')
|
2023-02-07 14:16:29 +01:00
|
|
|
icon.source: '../../icons/add.png'
|
2025-12-04 15:37:09 +01:00
|
|
|
onClicked: {
|
|
|
|
|
if (Daemon.availableWallets.rowCount() > 0 && Config.walletShouldUseSinglePassword
|
|
|
|
|
&& (!Daemon.singlePassword || Daemon.numWalletsWithPassword(Daemon.singlePassword) < 1)) {
|
|
|
|
|
// if the user has wallets but hasn't unlocked any wallet yet force them to do so.
|
|
|
|
|
// this ensures they know at least one wallets password and can complete the wizard
|
|
|
|
|
// where they will need to enter the password of an existing wallet.
|
|
|
|
|
var dialog = app.messageDialog.createObject(app, {
|
|
|
|
|
title: qsTr('Wallet unlock required'),
|
|
|
|
|
text: qsTr("You have to unlock any existing wallet first before creating a new wallet."),
|
|
|
|
|
})
|
|
|
|
|
dialog.open()
|
|
|
|
|
} else {
|
|
|
|
|
rootItem.createWallet()
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-05 12:24:45 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-02-16 18:07:28 +01:00
|
|
|
|
2023-02-23 20:46:56 +01:00
|
|
|
Connections {
|
|
|
|
|
target: Daemon
|
|
|
|
|
function onWalletLoaded() {
|
|
|
|
|
if (app.stack.currentItem.objectName == 'Wallets')
|
2025-12-16 15:59:02 +01:00
|
|
|
if (app.stack.getRoot().objectName == 'Wallets') {
|
|
|
|
|
app.stack.replaceRoot('WalletMainView.qml')
|
|
|
|
|
} else {
|
|
|
|
|
app.stack.pop()
|
|
|
|
|
}
|
2023-02-23 20:46:56 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-05 12:24:45 +02:00
|
|
|
}
|