diff --git a/src/webui/html/index.html b/src/webui/html/index.html
index 9864ff84d..ecede2147 100644
--- a/src/webui/html/index.html
+++ b/src/webui/html/index.html
@@ -66,6 +66,7 @@
_(&About)
+ _(&Shutdown)
diff --git a/src/webui/httpconnection.cpp b/src/webui/httpconnection.cpp
index 308b1cc0b..4c3aef84b 100644
--- a/src/webui/httpconnection.cpp
+++ b/src/webui/httpconnection.cpp
@@ -595,6 +595,9 @@ void HttpConnection::respondCommand(const QString& command) {
QBtSession::instance()->recheckTorrent(m_parser.post("hash"));
return;
}
+ if (command == "shutdown") {
+ qApp->exit();
+ }
}
void HttpConnection::decreaseTorrentsPriority(const QStringList &hashes) {
diff --git a/src/webui/scripts/mocha-init.js b/src/webui/scripts/mocha-init.js
index abadd1bc3..4d9ae2c37 100644
--- a/src/webui/scripts/mocha-init.js
+++ b/src/webui/scripts/mocha-init.js
@@ -283,6 +283,13 @@ initializeWindows = function(){
});
});
+ addClickEvent('shutdown', function(e){
+ new Event(e).stop();
+ new Request({url: 'command/shutdown'}).send();
+ document.write("
_(qBittorrent has been shutdown.)_(qBittorrent has been shutdown.)
"); //TODO Can someone with artistic skills put a pretty webpage here
+ stop();
+ });
+
// Deactivate menu header links
$$('a.returnFalse').each(function(el){
el.addEvent('click', function(e){