Browse Source

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

master
ThomasV 3 years ago
parent
commit
5e29b94561
  1. 2
      electrum/gui/qml/components/ChannelBackups.qml
  2. 5
      electrum/gui/qml/components/ChannelDetails.qml
  3. 2
      electrum/gui/qml/components/Channels.qml
  4. 3
      electrum/gui/qml/components/MessageDialog.qml
  5. 2
      electrum/gui/qml/components/OpenChannelDialog.qml
  6. 6
      electrum/gui/qml/components/Preferences.qml
  7. 13
      electrum/gui/qml/components/TxDetails.qml
  8. 8
      electrum/gui/qml/components/WalletDetails.qml
  9. 4
      electrum/gui/qml/components/WalletMainView.qml
  10. 6
      electrum/gui/qml/components/main.qml

2
electrum/gui/qml/components/ChannelBackups.qml

@ -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()
}
}

5
electrum/gui/qml/components/ChannelDetails.qml

@ -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() {

2
electrum/gui/qml/components/Channels.qml

@ -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()
}
}

3
electrum/gui/qml/components/MessageDialog.qml

@ -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

2
electrum/gui/qml/components/OpenChannelDialog.qml

@ -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()
}
}

6
electrum/gui/qml/components/Preferences.qml

@ -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() {

13
electrum/gui/qml/components/TxDetails.qml

@ -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()
}

8
electrum/gui/qml/components/WalletDetails.qml

@ -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()
}
}

4
electrum/gui/qml/components/WalletMainView.qml

@ -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() {

6
electrum/gui/qml/components/main.qml

@ -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()
})

Loading…
Cancel
Save