mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 00:33:09 -07:00
Don't add the watch folder before the user closes the Preferences window.
This commit is contained in:
parent
56ca80eb78
commit
990e33a4b1
3 changed files with 20 additions and 4 deletions
|
@ -203,7 +203,7 @@ bool ScanFoldersModel::setData(const QModelIndex &index, const QVariant &value,
|
|||
return true;
|
||||
}
|
||||
|
||||
ScanFoldersModel::PathStatus ScanFoldersModel::addPath(const QString &watchPath, const PathType &downloadType, const QString &downloadPath)
|
||||
ScanFoldersModel::PathStatus ScanFoldersModel::addPath(const QString &watchPath, const PathType &downloadType, const QString &downloadPath, bool addToFSWatcher)
|
||||
{
|
||||
QDir watchDir(watchPath);
|
||||
if (!watchDir.exists()) return DoesNotExist;
|
||||
|
@ -225,10 +225,23 @@ ScanFoldersModel::PathStatus ScanFoldersModel::addPath(const QString &watchPath,
|
|||
endInsertRows();
|
||||
|
||||
// Start scanning
|
||||
m_fsWatcher->addPath(canonicalWatchPath);
|
||||
if (addToFSWatcher)
|
||||
m_fsWatcher->addPath(canonicalWatchPath);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
void ScanFoldersModel::addToFSWatcher(const QStringList &watchPaths)
|
||||
{
|
||||
if (!m_fsWatcher)
|
||||
return; // addPath() wasn't called before this
|
||||
|
||||
foreach (const QString &path, watchPaths) {
|
||||
QDir watchDir(path);
|
||||
const QString &canonicalWatchPath = watchDir.canonicalPath();
|
||||
m_fsWatcher->addPath(canonicalWatchPath);
|
||||
}
|
||||
}
|
||||
|
||||
void ScanFoldersModel::removePath(int row)
|
||||
{
|
||||
Q_ASSERT((row >= 0) && (row < rowCount()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue