Remove watch folders permanently only if the user accepts the Preferences dialog.

This commit is contained in:
sledgehammer999 2016-01-02 01:23:26 +02:00
parent 9c88959651
commit 06be9edfe1
4 changed files with 26 additions and 8 deletions

View file

@ -268,24 +268,31 @@ void ScanFoldersModel::addToFSWatcher(const QStringList &watchPaths)
}
}
void ScanFoldersModel::removePath(int row)
void ScanFoldersModel::removePath(int row, bool removeFromFSWatcher)
{
Q_ASSERT((row >= 0) && (row < rowCount()));
beginRemoveRows(QModelIndex(), row, row);
m_fsWatcher->removePath(m_pathList.at(row)->watchPath);
if (removeFromFSWatcher)
m_fsWatcher->removePath(m_pathList.at(row)->watchPath);
delete m_pathList.takeAt(row);
endRemoveRows();
}
bool ScanFoldersModel::removePath(const QString &path)
bool ScanFoldersModel::removePath(const QString &path, bool removeFromFSWatcher)
{
const int row = findPathData(path);
if (row == -1) return false;
removePath(row);
removePath(row, removeFromFSWatcher);
return true;
}
void ScanFoldersModel::removeFromFSWatcher(const QStringList &watchPaths)
{
foreach (const QString &path, watchPaths)
m_fsWatcher->removePath(path);
}
bool ScanFoldersModel::downloadInWatchFolder(const QString &filePath) const
{
const int row = findPathData(QFileInfo(filePath).dir().path());