From 360c8500bb1f0e3dffba98c63ecf2a878d5baf84 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 16 Jul 2008 22:06:37 +0000 Subject: [PATCH] - Unqueue torrents before disabling queueing system --- src/bittorrent.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index a5bf2e787..fbfc7b965 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -346,6 +346,27 @@ void bittorrent::setQueueingEnabled(bool enable) { queuedUploads = new QStringList(); updateUploadQueue(); } else { + // Unqueue torrents + foreach(QString hash, *queuedDownloads) { + QTorrentHandle h = getTorrentHandle(hash); + h.resume(); + if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued")) { + QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued"); + } + if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio")) { + QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio"); + } + } + foreach(QString hash, *queuedUploads) { + QTorrentHandle h = getTorrentHandle(hash); + h.resume(); + if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued")) { + QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued"); + } + if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio")) { + QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio"); + } + } delete downloadQueue; downloadQueue = 0; delete queuedDownloads;