qml: allow renaming wallets
Allows to rename a wallet file from the QML Wallet Details view. This seems like a feature we should support as the use-case of a wallet can change or maybe the user didn't think about a proper name when setting up the wallet. Especially with lightning channels it is not possible to restore from seed to change the name. Fixes #4377
This commit is contained in:
@@ -130,6 +130,64 @@ Pane {
|
||||
visible: Daemon.currentWallet
|
||||
columns: 2
|
||||
|
||||
Label {
|
||||
Layout.columnSpan: 2
|
||||
Layout.topMargin: constants.paddingSmall
|
||||
text: qsTr('Name')
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
TextHighlightPane {
|
||||
id: walletNameContent
|
||||
property bool editmode: false
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
Label {
|
||||
visible: !walletNameContent.editmode
|
||||
text: Daemon.currentWallet.name
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
font.pixelSize: constants.fontSizeLarge
|
||||
}
|
||||
ToolButton {
|
||||
visible: !walletNameContent.editmode
|
||||
icon.source: '../../icons/pen.png'
|
||||
icon.color: 'transparent'
|
||||
onClicked: {
|
||||
walletNameEdit.text = Daemon.currentWallet.name
|
||||
walletNameContent.editmode = true
|
||||
walletNameEdit.focus = true
|
||||
}
|
||||
}
|
||||
TextField {
|
||||
id: walletNameEdit
|
||||
visible: walletNameContent.editmode
|
||||
Layout.fillWidth: true
|
||||
font.pixelSize: constants.fontSizeLarge
|
||||
}
|
||||
ToolButton {
|
||||
visible: walletNameContent.editmode
|
||||
icon.source: '../../icons/confirmed.png'
|
||||
icon.color: enabled ? 'transparent' : constants.mutedForeground
|
||||
enabled: walletNameEdit.text !== Daemon.currentWallet.name
|
||||
&& Daemon.isValidWalletName(walletNameEdit.text)
|
||||
onClicked: {
|
||||
walletNameContent.editmode = false
|
||||
Daemon.renameWallet(walletNameEdit.text)
|
||||
}
|
||||
}
|
||||
ToolButton {
|
||||
visible: walletNameContent.editmode
|
||||
icon.source: '../../icons/closebutton.png'
|
||||
icon.color: 'transparent'
|
||||
onClicked: walletNameContent.editmode = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.columnSpan: 2
|
||||
Layout.topMargin: constants.paddingSmall
|
||||
@@ -526,6 +584,14 @@ Pane {
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
function onWalletRenameError(message) {
|
||||
var dialog = app.messageDialog.createObject(app, {
|
||||
title: qsTr('Error'),
|
||||
iconSource: Qt.resolvedUrl('../../icons/warning.png'),
|
||||
text: message
|
||||
})
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
||||
Reference in New Issue
Block a user