HaikuDepot : Fix Rating of Installed Pkg
This commit resolves a problem where a user would be unable to rate an installed packge. fixes #14554 Change-Id: I3141eaebbdf531f17eb05302a536c6e0d722a164 Reviewed-on: https://review.haiku-os.org/611 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
49a3ee2a3b
commit
6ab878c0e5
@ -32,6 +32,10 @@ enum {
|
||||
#define HD_ERR_NO_DATA (HD_ERROR_BASE + 4)
|
||||
|
||||
|
||||
#define REPOSITORY_NAME_SYSTEM "system"
|
||||
#define REPOSITORY_NAME_INSTALLED "installed"
|
||||
|
||||
|
||||
// These constants reference resources in 'HaikuDepot.ref'
|
||||
enum {
|
||||
RSRC_STAR_BLUE = 510,
|
||||
|
@ -1043,11 +1043,20 @@ MainWindow::_RefreshPackageList(bool force)
|
||||
if (modelInfo.Get() == NULL)
|
||||
return;
|
||||
|
||||
modelInfo->SetDepotName(repositoryName);
|
||||
|
||||
foundPackages[repoPackageInfo.Name()] = modelInfo;
|
||||
}
|
||||
|
||||
// The package list here considers those packages that are installed
|
||||
// in the system as well as those that exist in remote repositories.
|
||||
// It is better if the 'depot name' is from the remote repository
|
||||
// because then it will be possible to perform a rating on it later.
|
||||
|
||||
if (modelInfo->DepotName().IsEmpty()
|
||||
|| modelInfo->DepotName() == REPOSITORY_NAME_SYSTEM
|
||||
|| modelInfo->DepotName() == REPOSITORY_NAME_INSTALLED) {
|
||||
modelInfo->SetDepotName(repositoryName);
|
||||
}
|
||||
|
||||
modelInfo->AddListener(this);
|
||||
|
||||
BSolverRepository* repository = package->Repository();
|
||||
@ -1165,7 +1174,7 @@ MainWindow::_RefreshPackageList(bool force)
|
||||
BSolverRepository installedRepository;
|
||||
{
|
||||
BRepositoryBuilder installedRepositoryBuilder(installedRepository,
|
||||
"installed");
|
||||
REPOSITORY_NAME_INSTALLED);
|
||||
for (int32 i = 0; i < systemFlaggedPackages.CountStrings(); i++) {
|
||||
BPath packagePath(systemPath);
|
||||
packagePath.Append(systemFlaggedPackages.StringAt(i));
|
||||
@ -1178,7 +1187,7 @@ MainWindow::_RefreshPackageList(bool force)
|
||||
BSolverRepository systemRepository;
|
||||
{
|
||||
BRepositoryBuilder systemRepositoryBuilder(systemRepository,
|
||||
"system");
|
||||
REPOSITORY_NAME_SYSTEM);
|
||||
for (PackageInfoMap::iterator it = systemInstalledPackages.begin();
|
||||
it != systemInstalledPackages.end(); it++) {
|
||||
BPath packagePath(systemPath);
|
||||
@ -1531,14 +1540,32 @@ bool
|
||||
MainWindow::_SelectedPackageHasWebAppRepositoryCode()
|
||||
{
|
||||
const PackageInfoRef& package = fPackageInfoView->Package();
|
||||
const DepotInfo* depot = fModel.DepotForName(package->DepotName());
|
||||
const BString depotName = package->DepotName();
|
||||
|
||||
BString repositoryCode;
|
||||
if (depotName.IsEmpty()) {
|
||||
if (Logger::IsDebugEnabled()) {
|
||||
printf("the package [%s] has no depot name\n",
|
||||
package->Name().String());
|
||||
}
|
||||
} else {
|
||||
const DepotInfo* depot = fModel.DepotForName(depotName);
|
||||
|
||||
if (depot != NULL)
|
||||
repositoryCode = depot->WebAppRepositoryCode();
|
||||
if (depot == NULL) {
|
||||
printf("the depot [%s] was not able to be found\n",
|
||||
depotName.String());
|
||||
} else {
|
||||
BString repositoryCode = depot->WebAppRepositoryCode();
|
||||
|
||||
return !repositoryCode.IsEmpty();
|
||||
if (repositoryCode.IsEmpty()) {
|
||||
printf("the depot [%s] has no web app repository code\n",
|
||||
depotName.String());
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user