feat(delete-all-torrents): added remove all torrents capability to the Transfers menu
This commit is contained in:
committed by
Mathias Rasmussen
parent
11b42e58c1
commit
b7fedb1983
@@ -201,6 +201,13 @@ module.exports = class TorrentListController {
|
||||
}
|
||||
}
|
||||
|
||||
confirmDeleteAllTorrents (deleteData) {
|
||||
this.state.modal = {
|
||||
id: 'delete-all-torrents-modal',
|
||||
deleteData
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: use torrentKey, not infoHash
|
||||
deleteTorrent (infoHash, deleteData) {
|
||||
ipcRenderer.send('wt-stop-torrenting', infoHash)
|
||||
@@ -227,6 +234,26 @@ module.exports = class TorrentListController {
|
||||
sound.play('DELETE')
|
||||
}
|
||||
|
||||
deleteAllTorrents (deleteData) {
|
||||
this.state.saved.torrents.forEach((summary) => {
|
||||
ipcRenderer.send('wt-stop-torrenting', summary.infoHash)
|
||||
|
||||
// remove torrent and poster file
|
||||
deleteFile(TorrentSummary.getTorrentPath(summary))
|
||||
deleteFile(TorrentSummary.getPosterPath(summary))
|
||||
|
||||
if (deleteData) moveItemToTrash(summary)
|
||||
|
||||
dispatch('stateSave')
|
||||
})
|
||||
|
||||
this.state.saved.torrents = []
|
||||
|
||||
// prevent user from going forward to a deleted torrent
|
||||
this.state.location.clearForward('player')
|
||||
sound.play('DELETE')
|
||||
}
|
||||
|
||||
toggleSelectTorrent (infoHash) {
|
||||
if (this.state.selectedInfoHash === infoHash) {
|
||||
this.state.selectedInfoHash = null
|
||||
|
||||
Reference in New Issue
Block a user