diff --git a/src/httpconnection.cpp b/src/httpconnection.cpp index 558faae47..165a24ed3 100644 --- a/src/httpconnection.cpp +++ b/src/httpconnection.cpp @@ -224,7 +224,12 @@ void HttpConnection::respondCommand(QString command) } if(command == "delete") { - emit deleteTorrent(parser.post("hash")); + emit deleteTorrent(parser.post("hash"), false); return; } + if(command == "deletePerm") + { + emit deleteTorrent(parser.post("hash"), true); + return; + } } diff --git a/src/httpconnection.h b/src/httpconnection.h index c43f07807..1b4a1466f 100644 --- a/src/httpconnection.h +++ b/src/httpconnection.h @@ -59,7 +59,7 @@ class HttpConnection : public QObject signals: void UrlReadyToBeDownloaded(QString url); void torrentReadyToBeDownloaded(QString, bool, QString, bool); - void deleteTorrent(QString hash); + void deleteTorrent(QString hash, bool permanently); void resumeTorrent(QString hash); void pauseTorrent(QString hash); void resumeAllTorrents(); diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 27068c11b..fd25b1013 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -63,7 +63,7 @@ void HttpServer::newHttpConnection() //connect connection to BTSession connect(connection, SIGNAL(UrlReadyToBeDownloaded(QString)), BTSession, SLOT(downloadUrlAndSkipDialog(QString))); connect(connection, SIGNAL(torrentReadyToBeDownloaded(QString, bool, QString, bool)), BTSession, SLOT(addTorrent(QString, bool, QString, bool))); - connect(connection, SIGNAL(deleteTorrent(QString)), BTSession, SLOT(deleteTorrent(QString))); + connect(connection, SIGNAL(deleteTorrent(QString, bool)), BTSession, SLOT(deleteTorrent(QString, bool))); connect(connection, SIGNAL(pauseTorrent(QString)), BTSession, SLOT(pauseTorrent(QString))); connect(connection, SIGNAL(resumeTorrent(QString)), BTSession, SLOT(resumeTorrent(QString))); connect(connection, SIGNAL(pauseAllTorrents()), BTSession, SLOT(pauseAllTorrents())); diff --git a/src/webui/index.html b/src/webui/index.html index b357b1bbb..fc2cd4b30 100644 --- a/src/webui/index.html +++ b/src/webui/index.html @@ -41,6 +41,7 @@
  • Start
  • Pause
  • Delete
  • +
  • Delete from HD
  • @@ -57,7 +58,8 @@
    - + + diff --git a/src/webui/scripts/mocha-init.js b/src/webui/scripts/mocha-init.js index 0f994cba4..20e2017c4 100644 --- a/src/webui/scripts/mocha-init.js +++ b/src/webui/scripts/mocha-init.js @@ -68,6 +68,20 @@ initializeWindows = function(){ } }); + addClickEvent('deletePerm', function(e){ + new Event(e).stop(); + if($("Tab1").hasClass('active')) { + var h = myTable.selectedIds(); + } else { + var h = myTableUP.selectedIds(); + } + if(h.length && confirm('Are you sure you want to delete from hard drive the selected item in download list?')) { + h.each(function(item, index){ + new Request({url: '/command/deletePerm', method: 'post', data: {hash: item}}).send(); + }); + } + }); + ['pause','resume'].each(function(item) { addClickEvent(item, function(e){ new Event(e).stop();