HaikuDepot: Store local package path in PackageInfo...

... when launched with a path to a .hpkg file.
This commit is contained in:
Stephan Aßmus 2014-10-25 10:35:01 +02:00
parent 24f7b6ad3b
commit 89fbeddf2a
3 changed files with 28 additions and 5 deletions

View File

@ -466,7 +466,8 @@ PackageInfo::PackageInfo()
fDownloadProgress(0.0),
fFlags(0),
fSystemDependency(false),
fArchitecture()
fArchitecture(),
fLocalFilePath()
{
}
@ -488,7 +489,8 @@ PackageInfo::PackageInfo(const BPackageInfo& info)
fDownloadProgress(0.0),
fFlags(info.Flags()),
fSystemDependency(false),
fArchitecture(info.ArchitectureName())
fArchitecture(info.ArchitectureName()),
fLocalFilePath()
{
BString publisherURL;
if (info.URLList().CountStrings() > 0)
@ -524,7 +526,8 @@ PackageInfo::PackageInfo(const BString& title,
fDownloadProgress(0.0),
fFlags(flags),
fSystemDependency(false),
fArchitecture(architecture)
fArchitecture(architecture),
fLocalFilePath()
{
}
@ -548,7 +551,8 @@ PackageInfo::PackageInfo(const PackageInfo& other)
fDownloadProgress(other.fDownloadProgress),
fFlags(other.fFlags),
fSystemDependency(other.fSystemDependency),
fArchitecture(other.fArchitecture)
fArchitecture(other.fArchitecture),
fLocalFilePath(other.fLocalFilePath)
{
}
@ -574,6 +578,8 @@ PackageInfo::operator=(const PackageInfo& other)
fFlags = other.fFlags;
fSystemDependency = other.fSystemDependency;
fArchitecture = other.fArchitecture;
fLocalFilePath = other.fLocalFilePath;
return *this;
}
@ -597,7 +603,8 @@ PackageInfo::operator==(const PackageInfo& other) const
&& fFlags == other.fFlags
&& fDownloadProgress == other.fDownloadProgress
&& fSystemDependency == other.fSystemDependency
&& fArchitecture == other.fArchitecture;
&& fArchitecture == other.fArchitecture
&& fLocalFilePath == other.fLocalFilePath;
}
@ -713,6 +720,13 @@ PackageInfo::SetDownloadProgress(float progress)
}
void
PackageInfo::SetLocalFilePath(const char* path)
{
fLocalFilePath = path;
}
void
PackageInfo::ClearUserRatings()
{

View File

@ -295,6 +295,12 @@ public:
{ return fDownloadProgress; }
void SetDownloadProgress(float progress);
void SetLocalFilePath(const char* path);
const BString& LocalFilePath() const
{ return fLocalFilePath; }
bool IsLocalFile() const
{ return !fLocalFilePath.IsEmpty(); }
void ClearCategories();
bool AddCategory(const CategoryRef& category);
const CategoryList& Categories() const
@ -348,6 +354,7 @@ private:
int32 fFlags;
bool fSystemDependency;
BString fArchitecture;
BString fLocalFilePath;
static BitmapRef sDefaultIcon;
};

View File

@ -144,6 +144,8 @@ App::_Open(const BEntry& entry)
fprintf(stderr, "Could not allocate PackageInfo\n");
return;
}
package->SetLocalFilePath(path.Path());
BMessage settings;
_LoadSettings(settings);