qml: parent channel open progress dialog to main.qml as it might live longer than OpenChannel
This commit is contained in:
@@ -27,6 +27,12 @@ ElDialog {
|
||||
property alias error: errorText.text
|
||||
property alias peer: peerText.text
|
||||
|
||||
function reset() {
|
||||
state = ''
|
||||
errorText.text = ''
|
||||
peerText.text = ''
|
||||
}
|
||||
|
||||
Item {
|
||||
id: s
|
||||
state: ''
|
||||
@@ -52,6 +58,7 @@ ElDialog {
|
||||
id: content
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
spacing: constants.paddingLarge
|
||||
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
@@ -103,6 +110,7 @@ ElDialog {
|
||||
id: infoText
|
||||
visible: false
|
||||
text: qsTr('Channel will be open after 3 confirmations')
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,12 +157,6 @@ Pane {
|
||||
}
|
||||
}
|
||||
|
||||
property var channelOpenProgressDialogInstance
|
||||
Component {
|
||||
id: channelOpenProgressDialog
|
||||
ChannelOpenProgressDialog { }
|
||||
}
|
||||
|
||||
ChannelOpener {
|
||||
id: channelopener
|
||||
wallet: Daemon.currentWallet
|
||||
@@ -190,21 +184,22 @@ Pane {
|
||||
}
|
||||
onChannelOpening: {
|
||||
console.log('Channel is opening')
|
||||
channelOpenProgressDialogInstance = channelOpenProgressDialog.createObject(app, {peer: peer})
|
||||
channelOpenProgressDialogInstance.open()
|
||||
app.channelOpenProgressDialog.reset()
|
||||
app.channelOpenProgressDialog.peer = peer
|
||||
app.channelOpenProgressDialog.open()
|
||||
}
|
||||
onChannelOpenError: {
|
||||
channelOpenProgressDialogInstance.state = 'failed'
|
||||
channelOpenProgressDialogInstance.error = message
|
||||
app.channelOpenProgressDialog.state = 'failed'
|
||||
app.channelOpenProgressDialog.error = message
|
||||
}
|
||||
onChannelOpenSuccess: {
|
||||
var message = 'success!'
|
||||
if (!has_backup)
|
||||
message = message + ' (but no backup. TODO: show QR)'
|
||||
channelOpenProgressDialogInstance.state = 'success'
|
||||
channelOpenProgressDialogInstance.error = message
|
||||
app.channelOpenProgressDialog.state = 'success'
|
||||
app.channelOpenProgressDialog.error = message
|
||||
channelopener.wallet.channelModel.new_channel(cid)
|
||||
// app.stack.pop()
|
||||
app.stack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,6 +186,11 @@ ApplicationWindow
|
||||
}
|
||||
}
|
||||
|
||||
property alias channelOpenProgressDialog: _channelOpenProgressDialog
|
||||
ChannelOpenProgressDialog {
|
||||
id: _channelOpenProgressDialog
|
||||
}
|
||||
|
||||
NotificationPopup {
|
||||
id: notificationPopup
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user