| 1285 | } |
| 1286 | |
| 1287 | void |
| 1288 | FileSystemModel::onWatchedDirectoryChanged(const QString& directory) |
| 1289 | { |
| 1290 | FileSystemItemPtr item = _imp->getItemFromPath(directory); |
| 1291 | |
| 1292 | if (item) { |
| 1293 | if (directory == _imp->currentRootPath) { |
| 1294 | cleanAndRefreshItem(item); |
| 1295 | } else { |
| 1296 | ///This is a sub-directory |
| 1297 | ///Clear the parent of the corresponding item |
| 1298 | FileSystemItemPtr parent = item->getParentItem(); |
| 1299 | if (parent) { |
| 1300 | QModelIndex idx = index( item.get() ); |
| 1301 | assert( idx.isValid() ); |
| 1302 | int count = parent->childCount(); |
| 1303 | if (count > 0) { |
| 1304 | beginRemoveRows(idx.parent(), 0, count - 1); |
| 1305 | parent->clearChildren(); |
| 1306 | endRemoveRows(); |
| 1307 | } |
| 1308 | } |
| 1309 | } |
| 1310 | } |
| 1311 | |
| 1312 | QDir dir(_imp->currentRootPath); |
| 1313 | if ( !dir.exists() ) { |
| 1314 | ///The current directory has changed its name or was deleted.. just fallback the filesystem to the root-path |
| 1315 | setRootPath( QDir::rootPath() ); |
| 1316 | } else { |
| 1317 | setRootPath(_imp->currentRootPath); |
| 1318 | } |
| 1319 | } |
| 1320 | |
| 1321 | void |
| 1322 | FileSystemModel::onWatchedFileChanged(const QString& file) |
nothing calls this directly
no test coverage detected