diff options
| author | Tomasz Sterna <tomek@xiaoka.com> | 2015-01-10 22:35:12 +0100 |
|---|---|---|
| committer | Tomasz Sterna <tomek@xiaoka.com> | 2015-01-10 23:06:11 +0100 |
| commit | 40e6d1a8323bc462c842a4aa090adda899ea6952 (patch) | |
| tree | 793721979270eb92f6720c6e97fb147173502fb9 | |
| parent | 16ddb4d6ca5742aa36112f187e36a039a7357460 (diff) | |
Do not remove watch-only apps when rescanning app dir
| -rw-r--r-- | daemon/appmanager.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/daemon/appmanager.cpp b/daemon/appmanager.cpp index d79c761..9046c5d 100644 --- a/daemon/appmanager.cpp +++ b/daemon/appmanager.cpp @@ -51,8 +51,21 @@ void AppManager::rescan() if (!watchedDirs.isEmpty()) _watcher->removePaths(watchedDirs); QStringList watchedFiles = _watcher->files(); if (!watchedFiles.isEmpty()) _watcher->removePaths(watchedFiles); - _apps.clear(); - _names.clear(); + Q_FOREACH(const AppInfo &appInfo, _apps) { + if (appInfo.isLocal()) { + _apps.remove(appInfo.uuid()); + _names.remove(appInfo.shortName()); + } + } + Q_FOREACH(const QUuid uuid, _names) { + // shouldn't really be needed, but just to make sure + if (_apps.find(uuid) == _apps.end()) { + QString key = _names.key(uuid); + qCWarning(l) << "DESYNC! Got UUID" << uuid << "for app" + << key << "with no app for UUID registered"; + _names.remove(key); + } + } Q_FOREACH(const QString &path, appPaths()) { QDir dir(path); @@ -88,5 +101,5 @@ void AppManager::scanApp(const QString &path) { qCDebug(l) << "scanning app" << path; const AppInfo &info = AppInfo::fromPath(path); - if (info.isLocal()) insertAppInfo(info); + if (info.isValid() && info.isLocal()) insertAppInfo(info); } |
