Added back folder watching in Web UI

This commit is contained in:
Christophe Dumez 2010-03-18 19:25:16 +00:00
parent 165b33a94e
commit 912056a364
6 changed files with 138 additions and 31 deletions

View file

@ -31,6 +31,7 @@
#include "eventmanager.h"
#include "bittorrent.h"
#include "scannedfoldersmodel.h"
#include "misc.h"
#include "preferences.h"
//#include "proplistdelegate.h"
@ -129,8 +130,23 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
Preferences::setTempPathEnabled(m["temp_path_enabled"].toBool());
if(m.contains("temp_path"))
Preferences::setTempPath(m["temp_path"].toString());
if(m.contains("scan_dirs"))
Preferences::setScanDirs(m["scan_dirs"].toStringList());
if(m.contains("scan_dirs")) {
QStringList old_folders = Preferences::getScanDirs();
QStringList new_folders = m["scan_dirs"].toStringList();
foreach(const QString &old_folder, old_folders) {
// Update deleted folders
if(!new_folders.contains(old_folder)) {
BTSession->getScanFoldersModel()->removePath(old_folder);
}
}
foreach(const QString &new_folder, new_folders) {
// Update new folders
if(!old_folders.contains(new_folder)) {
BTSession->getScanFoldersModel()->addPath(new_folder);
}
}
Preferences::setScanDirs(new_folders);
}
if(m.contains("download_in_scan_dirs"))
Preferences::setDownloadInScanDirs(m["download_in_scan_dirs"].toList());
if(m.contains("export_dir"))