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.
This commit is contained in:
Rene Gollent 2013-10-05 17:31:38 -04:00
parent f302cc52a4
commit 3697e7e8b1

View File

@ -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<BPackageManager::RemoteRepository*>(repository)
!= NULL) {
depots[repository->Name()].AddPackage(modelInfo);
remotePackages[modelInfo->Title()] = modelInfo;
} else {
const char* installationLocation = NULL;
if (repository == static_cast<const BSolverRepository*>(
@ -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);