Skip to content

Commit

Permalink
HaikuDepot: Store package file name in PackageInfo
Browse files Browse the repository at this point in the history
Also removed misplaced WIP functionality to find deskbar links
  • Loading branch information
stippi committed Oct 26, 2014
1 parent ad5bc04 commit 2d2824b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 37 deletions.
46 changes: 11 additions & 35 deletions src/apps/haikudepot/model/PackageInfo.cpp
Expand Up @@ -470,7 +470,8 @@ PackageInfo::PackageInfo()
fFlags(0),
fSystemDependency(false),
fArchitecture(),
fLocalFilePath()
fLocalFilePath(),
fFileName()
{
}

Expand All @@ -493,7 +494,8 @@ PackageInfo::PackageInfo(const BPackageInfo& info)
fFlags(info.Flags()),
fSystemDependency(false),
fArchitecture(info.ArchitectureName()),
fLocalFilePath()
fLocalFilePath(),
fFileName(info.FileName())
{
BString publisherURL;
if (info.URLList().CountStrings() > 0)
Expand Down Expand Up @@ -530,7 +532,8 @@ PackageInfo::PackageInfo(const BString& title,
fFlags(flags),
fSystemDependency(false),
fArchitecture(architecture),
fLocalFilePath()
fLocalFilePath(),
fFileName()
{
}

Expand All @@ -555,7 +558,8 @@ PackageInfo::PackageInfo(const PackageInfo& other)
fFlags(other.fFlags),
fSystemDependency(other.fSystemDependency),
fArchitecture(other.fArchitecture),
fLocalFilePath(other.fLocalFilePath)
fLocalFilePath(other.fLocalFilePath),
fFileName(other.fFileName)
{
}

Expand All @@ -582,6 +586,7 @@ PackageInfo::operator=(const PackageInfo& other)
fSystemDependency = other.fSystemDependency;
fArchitecture = other.fArchitecture;
fLocalFilePath = other.fLocalFilePath;
fFileName = other.fFileName;

return *this;
}
Expand All @@ -607,7 +612,8 @@ PackageInfo::operator==(const PackageInfo& other) const
&& fDownloadProgress == other.fDownloadProgress
&& fSystemDependency == other.fSystemDependency
&& fArchitecture == other.fArchitecture
&& fLocalFilePath == other.fLocalFilePath;
&& fLocalFilePath == other.fLocalFilePath
&& fFileName == other.fFileName;
}


Expand Down Expand Up @@ -737,36 +743,6 @@ PackageInfo::IsLocalFile() const
}


BPath
PackageInfo::FindAppToLaunch() const
{
BPath path;
if (fLocalFilePath.IsEmpty() || fInstallationLocations.empty())
return path;

BPath packagePath;
if (fInstallationLocations.find(
BPackageKit::B_PACKAGE_INSTALLATION_LOCATION_SYSTEM)
!= fInstallationLocations.end()) {
if (find_directory(B_SYSTEM_PACKAGES_DIRECTORY, &packagePath) != B_OK)
return path;
} else if (fInstallationLocations.find(
BPackageKit::B_PACKAGE_INSTALLATION_LOCATION_HOME)
!= fInstallationLocations.end()) {
if (find_directory(B_USER_PACKAGES_DIRECTORY, &packagePath) != B_OK)
return path;
} else {
return path;
}

packagePath.Append(fLocalFilePath);

// TODO: Scan package contents for Deskbar links

return path;
}


void
PackageInfo::ClearUserRatings()
{
Expand Down
5 changes: 3 additions & 2 deletions src/apps/haikudepot/model/PackageInfo.h
Expand Up @@ -302,9 +302,9 @@ class PackageInfo : public BReferenceable {
const BString& LocalFilePath() const
{ return fLocalFilePath; }
bool IsLocalFile() const;
const BString& FileName() const
{ return fFileName; }

BPath FindAppToLaunch() const;

void ClearCategories();
bool AddCategory(const CategoryRef& category);
const CategoryList& Categories() const
Expand Down Expand Up @@ -359,6 +359,7 @@ class PackageInfo : public BReferenceable {
bool fSystemDependency;
BString fArchitecture;
BString fLocalFilePath;
BString fFileName;

static BitmapRef sDefaultIcon;
};
Expand Down

0 comments on commit 2d2824b

Please sign in to comment.