qml: show experimental warning before opening first lightning channel. closes #8564
This commit is contained in:
@@ -136,8 +136,22 @@ Pane {
|
||||
enabled: Daemon.currentWallet.confirmedBalance.satsInt > 0
|
||||
text: qsTr('Open Channel')
|
||||
onClicked: {
|
||||
var dialog = openChannelDialog.createObject(root)
|
||||
dialog.open()
|
||||
if (Daemon.currentWallet.channelModel.count == 0) {
|
||||
var txt = Daemon.currentWallet.channelModel.lightningWarningMessage() + '\n\n' +
|
||||
qsTr('Do you want to create your first channel?')
|
||||
var confirmdialog = app.messageDialog.createObject(root, {
|
||||
text: txt,
|
||||
yesno: true
|
||||
})
|
||||
confirmdialog.accepted.connect(function () {
|
||||
var dialog = openChannelDialog.createObject(root)
|
||||
dialog.open()
|
||||
})
|
||||
confirmdialog.open()
|
||||
} else {
|
||||
var dialog = openChannelDialog.createObject(root)
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
icon.source: '../../icons/lightning.png'
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ from electrum.lnchannel import ChannelState
|
||||
from electrum.lnutil import LOCAL, REMOTE
|
||||
from electrum.logging import get_logger
|
||||
from electrum.util import Satoshis
|
||||
from electrum.gui import messages
|
||||
|
||||
from .qetypes import QEAmount
|
||||
from .util import QtEventListener, qt_event_listener
|
||||
from .qemodelfilter import QEFilterProxyModel
|
||||
|
||||
|
||||
class QEChannelListModel(QAbstractListModel, QtEventListener):
|
||||
_logger = get_logger(__name__)
|
||||
|
||||
@@ -195,3 +197,6 @@ class QEChannelListModel(QAbstractListModel, QtEventListener):
|
||||
self._fm_nobackups = self.filterModel('is_backup', False)
|
||||
return self._fm_nobackups
|
||||
|
||||
@pyqtSlot(result=str)
|
||||
def lightningWarningMessage(self):
|
||||
return messages.MSG_LIGHTNING_WARNING
|
||||
|
||||
Reference in New Issue
Block a user