Confirm removal of downloads

This commit is contained in:
Nils Maier 2014-05-16 00:35:38 +02:00
parent 5d1af829fd
commit 8b5b465231

View File

@ -38,14 +38,17 @@ function(
// put it in stopped list if active, // put it in stopped list if active,
// otherwise permanantly remove it // otherwise permanantly remove it
// d: the download ctx // d: the download ctx
scope.remove = function(d, cb) { scope.remove = function(d, cb, noConfirm) {
if (!noConfirm && !confirm("Remove %s and associated meta-data?".replace("%s", d.name))) {
return;
}
var method = 'remove'; var method = 'remove';
if (scope.getType(d) == 'stopped') if (scope.getType(d) == 'stopped')
method = 'removeDownloadResult'; method = 'removeDownloadResult';
if (d.followedFrom) { if (d.followedFrom) {
scope.remove(d.followedFrom, function() {}); scope.remove(d.followedFrom, function() {}, true);
d.followedFrom = null; d.followedFrom = null;
} }
rpc.once(method, [d.gid], cb); rpc.once(method, [d.gid], cb);