diff --git a/src/apps/haiku-depot/MainWindow.cpp b/src/apps/haiku-depot/MainWindow.cpp index 2e95c3352f..3ffe43ef6c 100644 --- a/src/apps/haiku-depot/MainWindow.cpp +++ b/src/apps/haiku-depot/MainWindow.cpp @@ -422,6 +422,8 @@ MainWindow::_RefreshPackageList() // is available in. The above map is used to ensure that in such // cases we consolidate the information, rather than displaying // duplicates + + PackageInfoMap remotePackages; for (int32 i = 0; i < packages.CountItems(); i++) { BSolverPackage* package = packages.ItemAt(i); const BPackageInfo& repoPackageInfo = package->Info(); @@ -458,6 +460,7 @@ MainWindow::_RefreshPackageList() if (dynamic_cast(repository) != NULL) { depots[repository->Name()].AddPackage(modelInfo); + remotePackages[modelInfo->Title()] = modelInfo; } else { const char* installationLocation = NULL; if (repository == static_cast( @@ -479,6 +482,24 @@ MainWindow::_RefreshPackageList() fModel.Clear(); + // filter remote packages from the found list + // any packages remaining will be locally installed packages + // that weren't acquired from a repository + for (PackageInfoMap::iterator it = remotePackages.begin(); + it != remotePackages.end(); ++it) { + foundPackages.erase(it->first); + } + + if (!foundPackages.empty()) { + BString repoName = B_TRANSLATE("Local"); + depots[repoName] = DepotInfo(repoName); + DepotInfoMap::iterator depot = depots.find(repoName); + for (PackageInfoMap::iterator it = foundPackages.begin(); + it != foundPackages.end(); ++it) { + depot->second.AddPackage(it->second); + } + } + for (DepotInfoMap::iterator it = depots.begin(); it != depots.end(); ++it) { fModel.AddDepot(it->second);