From 3697e7e8b11eaa2a76b001f9f6a92658b857c1cd Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 5 Oct 2013 17:31:38 -0400 Subject: [PATCH] HaikuDepot: Show packages that don't have a repository. - If a package was installed, but didn't have a corresponding remote repository package, it would have been missed in the list. Detect these and create a special local depot object to house them, so they also make their way into the visible package list. Thanks to diver for reporting the discrepancy. --- src/apps/haiku-depot/MainWindow.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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);