From 2e2851dc13d73352530dd4495c7e05603b2e520d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 23:38:38 +0200 Subject: Adding upstream version 2.1.2~dev0+20240219. Signed-off-by: Daniel Baumann --- deluge/ui/web/js/deluge-all/RemoveWindow.js | 77 +++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 deluge/ui/web/js/deluge-all/RemoveWindow.js (limited to 'deluge/ui/web/js/deluge-all/RemoveWindow.js') diff --git a/deluge/ui/web/js/deluge-all/RemoveWindow.js b/deluge/ui/web/js/deluge-all/RemoveWindow.js new file mode 100644 index 0000000..ccac2ef --- /dev/null +++ b/deluge/ui/web/js/deluge-all/RemoveWindow.js @@ -0,0 +1,77 @@ +/** + * Deluge.RemoveWindow.js + * + * Copyright (c) Damien Churchill 2009-2010 + * + * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with + * the additional special exception to link portions of this program with the OpenSSL library. + * See LICENSE for more details. + */ + +/** + * @class Deluge.RemoveWindow + * @extends Ext.Window + */ +Deluge.RemoveWindow = Ext.extend(Ext.Window, { + title: _('Remove Torrent'), + layout: 'fit', + width: 350, + height: 100, + constrainHeader: true, + buttonAlign: 'right', + closeAction: 'hide', + closable: true, + iconCls: 'x-deluge-remove-window-icon', + plain: true, + + bodyStyle: 'padding: 5px; padding-left: 10px;', + html: 'Are you sure you wish to remove the torrent (s)?', + + initComponent: function () { + Deluge.RemoveWindow.superclass.initComponent.call(this); + this.addButton(_('Cancel'), this.onCancel, this); + this.addButton(_('Remove With Data'), this.onRemoveData, this); + this.addButton(_('Remove Torrent'), this.onRemove, this); + }, + + remove: function (removeData) { + deluge.client.core.remove_torrents(this.torrentIds, removeData, { + success: function (result) { + if (result == true) { + console.log( + 'Error(s) occured when trying to delete torrent(s).' + ); + } + this.onRemoved(this.torrentIds); + }, + scope: this, + torrentIds: this.torrentIds, + }); + }, + + show: function (ids) { + Deluge.RemoveWindow.superclass.show.call(this); + this.torrentIds = ids; + }, + + onCancel: function () { + this.hide(); + this.torrentIds = null; + }, + + onRemove: function () { + this.remove(false); + }, + + onRemoveData: function () { + this.remove(true); + }, + + onRemoved: function (torrentIds) { + deluge.events.fire('torrentsRemoved', torrentIds); + this.hide(); + deluge.ui.update(); + }, +}); + +deluge.removeWindow = new Deluge.RemoveWindow(); -- cgit v1.2.3