From e12c26ec2d67bd3c274a0067be674656f71c7856 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 18 Sep 2013 17:27:29 +0200 Subject: [PATCH] ModelWindow: Populate publisher URL if available. - Also rework things a bit to fix passing the same reference into the installed package list repeatedly, thus causing only the first package to be marked as actually being installed. --- src/apps/haiku-depot/MainWindow.cpp | 31 +++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/apps/haiku-depot/MainWindow.cpp b/src/apps/haiku-depot/MainWindow.cpp index efd6fcb85b..c19207f1a8 100644 --- a/src/apps/haiku-depot/MainWindow.cpp +++ b/src/apps/haiku-depot/MainWindow.cpp @@ -274,15 +274,23 @@ MainWindow::_InitModel() PackageInfoMap::iterator it = foundPackages.find( repoPackageInfo.Name()); if (it != foundPackages.end()) - modelInfo = it->second; + modelInfo.SetTo(it->second); else { + BString publisherURL; + if (repoPackageInfo.URLList().CountStrings() > 0) + publisherURL = repoPackageInfo.URLList().StringAt(0); modelInfo.SetTo(new(std::nothrow) PackageInfo(NULL, - repoPackageInfo.Name(), repoPackageInfo.Version().ToString(), - PublisherInfo(BitmapRef(), repoPackageInfo.Vendor(), "", ""), - repoPackageInfo.Summary(), repoPackageInfo.Description(), ""), - true); + repoPackageInfo.Name(), + repoPackageInfo.Version().ToString(), + PublisherInfo(BitmapRef(), repoPackageInfo.Vendor(), + "", publisherURL), repoPackageInfo.Summary(), + repoPackageInfo.Description(), ""), + true); + if (modelInfo.Get() == NULL) return; + + foundPackages[repoPackageInfo.Name()] = modelInfo; } BSolverRepository* repository = package->Repository(); @@ -302,16 +310,20 @@ MainWindow::_InitModel() installationLocation = "home"; } - if (installationLocation != NULL) - packageLocations[installationLocation].AddItem(modelInfo.Get()); + if (installationLocation != NULL) { + packageLocations[installationLocation].AddItem( + modelInfo.Get()); + } } } - for (DepotInfoMap::iterator it = depots.begin(); it != depots.end(); ++it) + for (DepotInfoMap::iterator it = depots.begin(); it != depots.end(); + ++it) { fModel.AddDepot(it->second); + } for (PackageLocationMap::iterator it = packageLocations.begin(); - it != packageLocations.end(); ++it) { + it != packageLocations.end(); ++it) { for (int32 i = 0; i < it->second.CountItems(); i++) { fModel.SetPackageState(it->second.ItemAt(i), ACTIVATED); // TODO: indicate the specific installation location @@ -319,5 +331,4 @@ MainWindow::_InitModel() // by querying the package roster } } - }