From 80d76ae0388239d35131ff8730138ea170f01777 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Mon, 14 Jun 2010 17:46:33 +0000 Subject: [PATCH] BUGFIX: The user can disable permanently recursive torrent download --- Changelog | 1 + src/GUI.cpp | 13 ++++++++++++- src/preferences.h | 10 ++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 2a6a33a59..9550a952a 100644 --- a/Changelog +++ b/Changelog @@ -11,6 +11,7 @@ - FEATURE: Added filter for paused/error torrents - FEATURE: Add Check/Uncheck all feature in Web UI - BUGFIX: Hide seeding torrents files priorities in Web UI + - BUGFIX: The user can disable permanently recursive torrent download - COSMETIC: Display peers country name in tooltip - COSMETIC: Display number of torrents in transfers tab label diff --git a/src/GUI.cpp b/src/GUI.cpp index b2cfa14f1..507b4dbff 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -428,8 +428,19 @@ void GUI::balloonClicked() { } void GUI::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) { - if(QMessageBox::question(this, tr("Recursive download confirmation"), tr("The torrent %1 contains torrent files, do you want to proceed with their download?").arg(h.name()), QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes) { + if(Preferences::recursiveDownloadDisabled()) return; + QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent %1 contains torrent files, do you want to proceed with their download?").arg(h.name())); + QPushButton *yes = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole); + /*QPushButton *no = */confirmBox.addButton(tr("No"), QMessageBox::NoRole); + QPushButton *never = confirmBox.addButton(tr("Never"), QMessageBox::NoRole); + confirmBox.exec(); + if(confirmBox.clickedButton() == 0) return; + if(confirmBox.clickedButton() == yes) { BTSession->recursiveTorrentDownload(h); + return; + } + if(confirmBox.clickedButton() == never) { + Preferences::disableRecursiveDownload(); } } diff --git a/src/preferences.h b/src/preferences.h index 88f7f5d06..e81108247 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -1002,6 +1002,16 @@ public: qBTRSS.setValue("hosts_cookies", hosts_table); } + static bool recursiveDownloadDisabled() { + QSettings settings("qBittorrent", "qBittorrent"); + return settings.value(QString::fromUtf8("Preferences/Advanced/DisableRecursiveDownload"), false).toBool(); + } + + static void disableRecursiveDownload(bool disable=true) { + QSettings settings("qBittorrent", "qBittorrent"); + settings.setValue(QString::fromUtf8("Preferences/Advanced/DisableRecursiveDownload"), disable); + } + #ifdef Q_WS_WIN static QString getPythonPath() { QSettings reg_python("HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore", QSettings::NativeFormat);