From b2f98bd0599d1923157e1143d48c221a17e9814f Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 15 Aug 2010 07:47:33 +0000 Subject: [PATCH] Priority actions should work only if the tab is displayed --- src/httpconnection.cpp | 10 ++++++++++ src/transferlistwidget.cpp | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/httpconnection.cpp b/src/httpconnection.cpp index 83c438ee1..5e1b36955 100644 --- a/src/httpconnection.cpp +++ b/src/httpconnection.cpp @@ -500,6 +500,16 @@ void HttpConnection::respondCommand(QString command) if(h.is_valid()) h.queue_position_down(); return; } + if(command == "topPrio") { + QTorrentHandle h = BTSession->getTorrentHandle(parser.post("hash")); + if(h.is_valid()) h.queue_position_top(); + return; + } + if(command == "bottomPrio") { + QTorrentHandle h = BTSession->getTorrentHandle(parser.post("hash")); + if(h.is_valid()) h.queue_position_bottom(); + return; + } if(command == "recheck"){ recheckTorrent(parser.post("hash")); return; diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 8e8b0fe67..7ca409ea9 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -742,8 +742,8 @@ void TransferListWidget::decreasePrioSelectedTorrents() { refreshList(); } -// FIXME: Should work only if the tab is displayed void TransferListWidget::topPrioSelectedTorrents() { + if(main_window->getCurrentTabWidget() != this) return; const QStringList hashes = getSelectedTorrentsHashes(); foreach(const QString &hash, hashes) { QTorrentHandle h = BTSession->getTorrentHandle(hash); @@ -754,8 +754,8 @@ void TransferListWidget::topPrioSelectedTorrents() { refreshList(); } -// FIXME: Should work only if the tab is displayed void TransferListWidget::bottomPrioSelectedTorrents() { + if(main_window->getCurrentTabWidget() != this) return; const QStringList hashes = getSelectedTorrentsHashes(); foreach(const QString &hash, hashes) { QTorrentHandle h = BTSession->getTorrentHandle(hash);