Fix possible crash with folder watching

This commit is contained in:
Christophe Dumez 2010-03-22 18:50:04 +00:00
parent 8ccaaae085
commit 38cb4ccbd3
5 changed files with 32 additions and 23 deletions

View file

@ -110,7 +110,7 @@ bool ScanFoldersModel::setData(const QModelIndex &index, const QVariant &value,
return true;
}
ScanFoldersModel::PathStatus ScanFoldersModel::addPath(const QString &path) {
ScanFoldersModel::PathStatus ScanFoldersModel::addPath(const QString &path, bool download_at_path) {
QDir dir(path);
if (!dir.exists())
return DoesNotExist;
@ -126,6 +126,9 @@ ScanFoldersModel::PathStatus ScanFoldersModel::addPath(const QString &path) {
beginInsertRows(QModelIndex(), rowCount(), rowCount());
m_pathList << new PathData(canonicalPath);
endInsertRows();
// Set download at path
setDownloadAtPath(m_pathList.size()-1, download_at_path);
// Start scanning
m_fsWatcher->addPath(canonicalPath);
return Ok;
}