Browse Source

- Allow to delete permanently from WebUI

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
1544300616
  1. 7
      src/httpconnection.cpp
  2. 2
      src/httpconnection.h
  3. 2
      src/httpserver.cpp
  4. 4
      src/webui/index.html
  5. 14
      src/webui/scripts/mocha-init.js

7
src/httpconnection.cpp

@ -224,7 +224,12 @@ void HttpConnection::respondCommand(QString command) @@ -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;
}
}

2
src/httpconnection.h

@ -59,7 +59,7 @@ class HttpConnection : public QObject @@ -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();

2
src/httpserver.cpp

@ -63,7 +63,7 @@ void HttpServer::newHttpConnection() @@ -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()));

4
src/webui/index.html

@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
<li class="divider"><a id="resumeLink">Start</a></li>
<li><a id="pauseLink">Pause</a></li>
<li class="divider"><a id="deleteLink">Delete</a></li>
<li><a id="deletePermLink">Delete from HD</a></li>
</ul>
</li>
<li>
@ -57,7 +58,8 @@ @@ -57,7 +58,8 @@
<div id="mochaToolbar">
<a id="downloadButton"><img class="mochaToolButton" title="Download from URL" src="images/skin/url.png"/></a>
<a id="uploadButton"><img class="mochaToolButton" title="Download local torrent" src="images/skin/open.png"/></a>
<a id="deleteButton"><img class="mochaToolButton" title="Delete" src="images/skin/delete.png"/></a>
<a id="deleteButton"><img class="mochaToolButton" title="Delete" src="images/skin/delete.png"/></a>
<a id="deletePermButton"><img class="mochaToolButton" title="Delete from HD" src="images/skin/delete_perm.png"/></a>
<a id="resumeButton"><img class="mochaToolButton" title="Resume" src="images/skin/play.png"/></a>
<a id="pauseButton"><img class="mochaToolButton" title="Pause" src="images/skin/pause.png"/></a>
<a id="resumeAllButton"><img class="mochaToolButton" title="Resume all" src="images/skin/play_all.png"/></a>

14
src/webui/scripts/mocha-init.js

@ -68,6 +68,20 @@ initializeWindows = function(){ @@ -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();

Loading…
Cancel
Save