1
0

qml MessageDialog: split messages into title and header message. hide header if it is empty.

This commit is contained in:
ThomasV
2023-04-18 14:07:41 +02:00
parent bea41d2098
commit 5e29b94561
10 changed files with 28 additions and 23 deletions

View File

@@ -93,7 +93,7 @@ Pane {
Connections {
target: Daemon.currentWallet
function onImportChannelBackupFailed(message) {
var dialog = app.messageDialog.createObject(root, { text: message })
var dialog = app.messageDialog.createObject(root, { title: qstr('Error'), text: message })
dialog.open()
}
}

View File

@@ -283,9 +283,8 @@ Pane {
visible: channeldetails.canDelete
onClicked: {
var dialog = app.messageDialog.createObject(root, {
text: channeldetails.isBackup
? qsTr('Are you sure you want to delete this channel backup?')
: qsTr('Are you sure you want to delete this channel? This will purge associated transactions from your wallet history.'),
title: qsTr('Are you sure?'),
text: channeldetails.isBackup ? '' : qsTr('This will purge associated transactions from your wallet history.'),
yesno: true
})
dialog.accepted.connect(function() {

View File

@@ -163,7 +163,7 @@ Pane {
Connections {
target: Daemon.currentWallet
function onImportChannelBackupFailed(message) {
var dialog = app.messageDialog.createObject(root, { text: message })
var dialog = app.messageDialog.createObject(root, { title: qsTr('Error'), text: message })
dialog.open()
}
}

View File

@@ -24,6 +24,7 @@ ElDialog {
ColumnLayout {
ColumnLayout {
visible: text
Layout.margins: constants.paddingMedium
Layout.alignment: Qt.AlignHCenter
TextArea {
@@ -39,7 +40,7 @@ ElDialog {
}
ButtonContainer {
Layout.fillWidth: true
Layout.preferredWidth: dialog.parent.width * 2/3
FlatButton {
Layout.fillWidth: true

View File

@@ -214,7 +214,7 @@ ElDialog {
}
onValidationError: {
if (code == 'invalid_nodeid') {
var dialog = app.messageDialog.createObject(app, { 'text': message })
var dialog = app.messageDialog.createObject(app, { title: qsTr('Error'), 'text': message })
dialog.open()
}
}

View File

@@ -256,7 +256,8 @@ Pane {
if (activeFocus) {
if (!checked) {
var dialog = app.messageDialog.createObject(app, {
text: qsTr('Using plain gossip mode is not recommended on mobile. Are you sure?'),
title: qsTr('Are you sure?'),
text: qsTr('Electrum will have to download the Lightning Network graph, which is not recommended on mobile.'),
yesno: true
})
dialog.accepted.connect(function() {
@@ -291,7 +292,8 @@ Pane {
if (activeFocus) {
if (!checked) {
var dialog = app.messageDialog.createObject(app, {
text: qsTr('Are you sure? This option allows you to recover your lightning funds if you lose your device, or if you uninstall this app while lightning channels are active. Do not disable it unless you know how to recover channels from backups.'),
title: qsTr('Are you sure?'),
text: qsTr('This option allows you to recover your lightning funds if you lose your device, or if you uninstall this app while lightning channels are active. Do not disable it unless you know how to recover channels from backups.'),
yesno: true
})
dialog.accepted.connect(function() {

View File

@@ -414,8 +414,8 @@ Pane {
if (txid != txdetails.txid)
return
var dialog = app.messageDialog.createObject(app, {
text: qsTr('Transaction added to wallet history.') + '\n\n' +
qsTr('Note: this is an offline transaction, if you want the network to see it, you need to broadcast it.')
title: qsTr('Transaction added to wallet history.'),
text: qsTr('Note: this is an offline transaction, if you want the network to see it, you need to broadcast it.')
})
dialog.open()
root.close()
@@ -446,7 +446,8 @@ Pane {
txdetails.sign_and_broadcast()
} else {
var dialog = app.messageDialog.createObject(app, {
text: qsTr('Transaction fee updated.') + '\n\n' + qsTr('You still need to sign and broadcast this transaction.')
title: qsTr('Transaction fee updated.'),
text: qsTr('You still need to sign and broadcast this transaction.')
})
dialog.open()
}
@@ -472,7 +473,8 @@ Pane {
txdetails.sign_and_broadcast()
} else {
var dialog = app.messageDialog.createObject(app, {
text: qsTr('CPFP fee bump transaction created.') + '\n\n' + qsTr('You still need to sign and broadcast this transaction.')
title: qsTr('CPFP fee bump transaction created.'),
text: qsTr('You still need to sign and broadcast this transaction.')
})
dialog.open()
}
@@ -497,7 +499,8 @@ Pane {
txdetails.sign_and_broadcast()
} else {
var dialog = app.messageDialog.createObject(app, {
text: qsTr('Cancel transaction created.') + '\n\n' + qsTr('You still need to sign and broadcast this transaction.')
title: qsTr('Cancel transaction created.'),
text: qsTr('You still need to sign and broadcast this transaction.')
})
dialog.open()
}

View File

@@ -17,7 +17,7 @@ Pane {
function enableLightning() {
var dialog = app.messageDialog.createObject(rootItem,
{'text': qsTr('Enable Lightning for this wallet?'), 'yesno': true})
{'title': qsTr('Enable Lightning for this wallet?'), 'yesno': true})
dialog.accepted.connect(function() {
Daemon.currentWallet.enableLightning()
})
@@ -466,19 +466,19 @@ Pane {
}
function onWalletDeleteError(code, message) {
if (code == 'unpaid_requests') {
var dialog = app.messageDialog.createObject(app, {text: message, yesno: true })
var dialog = app.messageDialog.createObject(app, {title: qsTr('Error'), text: message, yesno: true })
dialog.accepted.connect(function() {
Daemon.checkThenDeleteWallet(Daemon.currentWallet, true)
})
dialog.open()
} else if (code == 'balance') {
var dialog = app.messageDialog.createObject(app, {text: message, yesno: true })
var dialog = app.messageDialog.createObject(app, {title: qsTr('Error'), text: message, yesno: true })
dialog.accepted.connect(function() {
Daemon.checkThenDeleteWallet(Daemon.currentWallet, true, true)
})
dialog.open()
} else {
var dialog = app.messageDialog.createObject(app, {text: message })
var dialog = app.messageDialog.createObject(app, {title: qsTr('Error'), text: message })
dialog.open()
}
}

View File

@@ -252,7 +252,7 @@ Item {
dialog.open()
}
onLnurlError: {
var dialog = app.messageDialog.createObject(app, { text: message })
var dialog = app.messageDialog.createObject(app, { title: qsTr('Error'), text: message })
dialog.open()
}
}
@@ -370,7 +370,7 @@ Item {
}
onChannelBackupFound: {
var dialog = app.messageDialog.createObject(app, {
text: qsTr('Import Channel backup?'),
title: qsTr('Import Channel backup?'),
yesno: true
})
dialog.accepted.connect(function() {

View File

@@ -375,7 +375,7 @@ ApplicationWindow
app.handleAuthRequired(_swaphelper, method, authMessage)
}
onError: {
var dialog = app.messageDialog.createObject(app, { text: message })
var dialog = app.messageDialog.createObject(app, { title: qsTr('Error'), text: message })
dialog.open()
}
}
@@ -452,7 +452,7 @@ ApplicationWindow
mainStackView.clear()
} else {
var dialog = app.messageDialog.createObject(app, {
text: qsTr('Close Electrum?'),
title: qsTr('Close Electrum?'),
yesno: true
})
dialog.accepted.connect(function() {
@@ -578,7 +578,7 @@ ApplicationWindow
qtobject.authProceed()
return
}
var dialog = app.messageDialog.createObject(app, {text: authMessage, yesno: true})
var dialog = app.messageDialog.createObject(app, {title: authMessage, yesno: true})
dialog.accepted.connect(function() {
qtobject.authProceed()
})