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. 2
      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)
} }
if(command == "delete") 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; return;
} }
} }

2
src/httpconnection.h

@ -59,7 +59,7 @@ class HttpConnection : public QObject
signals: signals:
void UrlReadyToBeDownloaded(QString url); void UrlReadyToBeDownloaded(QString url);
void torrentReadyToBeDownloaded(QString, bool, QString, bool); void torrentReadyToBeDownloaded(QString, bool, QString, bool);
void deleteTorrent(QString hash); void deleteTorrent(QString hash, bool permanently);
void resumeTorrent(QString hash); void resumeTorrent(QString hash);
void pauseTorrent(QString hash); void pauseTorrent(QString hash);
void resumeAllTorrents(); void resumeAllTorrents();

2
src/httpserver.cpp

@ -63,7 +63,7 @@ void HttpServer::newHttpConnection()
//connect connection to BTSession //connect connection to BTSession
connect(connection, SIGNAL(UrlReadyToBeDownloaded(QString)), BTSession, SLOT(downloadUrlAndSkipDialog(QString))); 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(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(pauseTorrent(QString)), BTSession, SLOT(pauseTorrent(QString)));
connect(connection, SIGNAL(resumeTorrent(QString)), BTSession, SLOT(resumeTorrent(QString))); connect(connection, SIGNAL(resumeTorrent(QString)), BTSession, SLOT(resumeTorrent(QString)));
connect(connection, SIGNAL(pauseAllTorrents()), BTSession, SLOT(pauseAllTorrents())); connect(connection, SIGNAL(pauseAllTorrents()), BTSession, SLOT(pauseAllTorrents()));

2
src/webui/index.html

@ -41,6 +41,7 @@
<li class="divider"><a id="resumeLink">Start</a></li> <li class="divider"><a id="resumeLink">Start</a></li>
<li><a id="pauseLink">Pause</a></li> <li><a id="pauseLink">Pause</a></li>
<li class="divider"><a id="deleteLink">Delete</a></li> <li class="divider"><a id="deleteLink">Delete</a></li>
<li><a id="deletePermLink">Delete from HD</a></li>
</ul> </ul>
</li> </li>
<li> <li>
@ -58,6 +59,7 @@
<a id="downloadButton"><img class="mochaToolButton" title="Download from URL" src="images/skin/url.png"/></a> <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="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="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="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> <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(){
} }
}); });
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) { ['pause','resume'].each(function(item) {
addClickEvent(item, function(e){ addClickEvent(item, function(e){
new Event(e).stop(); new Event(e).stop();

Loading…
Cancel
Save