delete channel
This commit is contained in:
@@ -24,7 +24,7 @@ Pane {
|
|||||||
text: qsTr('Backup');
|
text: qsTr('Backup');
|
||||||
enabled: false
|
enabled: false
|
||||||
onTriggered: {}
|
onTriggered: {}
|
||||||
//icon.source: '../../icons/wallet.png'
|
icon.source: '../../icons/file.png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
@@ -36,7 +36,30 @@ Pane {
|
|||||||
var dialog = closechannel.createObject(root, { 'channelid': channelid })
|
var dialog = closechannel.createObject(root, { 'channelid': channelid })
|
||||||
dialog.open()
|
dialog.open()
|
||||||
}
|
}
|
||||||
//icon.source: '../../icons/wallet.png'
|
icon.source: '../../icons/closebutton.png'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MenuItem {
|
||||||
|
icon.color: 'transparent'
|
||||||
|
action: Action {
|
||||||
|
text: qsTr('Delete channel');
|
||||||
|
enabled: channeldetails.canDelete
|
||||||
|
onTriggered: {
|
||||||
|
var dialog = app.messageDialog.createObject(root,
|
||||||
|
{
|
||||||
|
'text': qsTr('Are you sure you want to delete this channel? This will purge associated transactions from your wallet history.'),
|
||||||
|
'yesno': true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
dialog.yesClicked.connect(function() {
|
||||||
|
channeldetails.deleteChannel()
|
||||||
|
app.stack.pop()
|
||||||
|
Daemon.currentWallet.historyModel.init_model() // needed here?
|
||||||
|
Daemon.currentWallet.channelModel.remove_channel(channelid)
|
||||||
|
})
|
||||||
|
dialog.open()
|
||||||
|
}
|
||||||
|
icon.source: '../../icons/delete.png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
|
|||||||
@@ -134,6 +134,10 @@ class QEChannelDetails(QObject):
|
|||||||
def canForceClose(self):
|
def canForceClose(self):
|
||||||
return ChanCloseOption.LOCAL_FCLOSE in self._channel.get_close_options()
|
return ChanCloseOption.LOCAL_FCLOSE in self._channel.get_close_options()
|
||||||
|
|
||||||
|
@pyqtProperty(bool, notify=channelChanged)
|
||||||
|
def canDelete(self):
|
||||||
|
return self._channel.can_be_deleted()
|
||||||
|
|
||||||
@pyqtProperty(str, notify=channelChanged)
|
@pyqtProperty(str, notify=channelChanged)
|
||||||
def message_force_close(self, notify=channelChanged):
|
def message_force_close(self, notify=channelChanged):
|
||||||
return _(messages.MSG_REQUEST_FORCE_CLOSE)
|
return _(messages.MSG_REQUEST_FORCE_CLOSE)
|
||||||
@@ -173,3 +177,7 @@ class QEChannelDetails(QObject):
|
|||||||
loop = self._wallet.wallet.network.asyncio_loop
|
loop = self._wallet.wallet.network.asyncio_loop
|
||||||
coro = do_close(closetype, self._channel.channel_id)
|
coro = do_close(closetype, self._channel.channel_id)
|
||||||
asyncio.run_coroutine_threadsafe(coro, loop)
|
asyncio.run_coroutine_threadsafe(coro, loop)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def deleteChannel(self):
|
||||||
|
self._wallet.wallet.lnworker.remove_channel(self._channel.channel_id)
|
||||||
|
|||||||
@@ -149,4 +149,15 @@ class QEChannelListModel(QAbstractListModel):
|
|||||||
self.beginInsertRows(QModelIndex(), 0, 0)
|
self.beginInsertRows(QModelIndex(), 0, 0)
|
||||||
self.channels.insert(0,item)
|
self.channels.insert(0,item)
|
||||||
self.endInsertRows()
|
self.endInsertRows()
|
||||||
self.numOpenChannelsChanged.emit()
|
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def remove_channel(self, cid):
|
||||||
|
i = 0
|
||||||
|
for channel in self.channels:
|
||||||
|
if cid == channel['cid']:
|
||||||
|
self._logger.debug(cid)
|
||||||
|
self.beginRemoveRows(QModelIndex(), i, i)
|
||||||
|
self.channels.remove(channel)
|
||||||
|
self.endRemoveRows()
|
||||||
|
return
|
||||||
|
i = i + 1
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ class QETransactionListModel(QAbstractListModel):
|
|||||||
return date.strftime(dfmt[section])
|
return date.strftime(dfmt[section])
|
||||||
|
|
||||||
# initial model data
|
# initial model data
|
||||||
|
@pyqtSlot()
|
||||||
def init_model(self):
|
def init_model(self):
|
||||||
history = self.wallet.get_full_history(onchain_domain=self.onchain_domain,
|
history = self.wallet.get_full_history(onchain_domain=self.onchain_domain,
|
||||||
include_lightning=self.include_lightning)
|
include_lightning=self.include_lightning)
|
||||||
|
|||||||
Reference in New Issue
Block a user