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 11:12:24 +02:00
parent 24f7b6ad3b
commit 89fbeddf2a
3 changed files with 28 additions and 5 deletions
+19 -5
View File
@@ -466,7 +466,8 @@ PackageInfo::PackageInfo()
fDownloadProgress(0.0), fDownloadProgress(0.0),
fFlags(0), fFlags(0),
fSystemDependency(false), fSystemDependency(false),
fArchitecture() fArchitecture(),
fLocalFilePath()
{ {
} }
@@ -488,7 +489,8 @@ PackageInfo::PackageInfo(const BPackageInfo& info)
fDownloadProgress(0.0), fDownloadProgress(0.0),
fFlags(info.Flags()), fFlags(info.Flags()),
fSystemDependency(false), fSystemDependency(false),
fArchitecture(info.ArchitectureName()) fArchitecture(info.ArchitectureName()),
fLocalFilePath()
{ {
BString publisherURL; BString publisherURL;
if (info.URLList().CountStrings() > 0) if (info.URLList().CountStrings() > 0)
@@ -524,7 +526,8 @@ PackageInfo::PackageInfo(const BString& title,
fDownloadProgress(0.0), fDownloadProgress(0.0),
fFlags(flags), fFlags(flags),
fSystemDependency(false), fSystemDependency(false),
fArchitecture(architecture) fArchitecture(architecture),
fLocalFilePath()
{ {
} }
@@ -548,7 +551,8 @@ PackageInfo::PackageInfo(const PackageInfo& other)
fDownloadProgress(other.fDownloadProgress), fDownloadProgress(other.fDownloadProgress),
fFlags(other.fFlags), fFlags(other.fFlags),
fSystemDependency(other.fSystemDependency), fSystemDependency(other.fSystemDependency),
fArchitecture(other.fArchitecture) fArchitecture(other.fArchitecture),
fLocalFilePath(other.fLocalFilePath)
{ {
} }
@@ -574,6 +578,8 @@ PackageInfo::operator=(const PackageInfo& other)
fFlags = other.fFlags; fFlags = other.fFlags;
fSystemDependency = other.fSystemDependency; fSystemDependency = other.fSystemDependency;
fArchitecture = other.fArchitecture; fArchitecture = other.fArchitecture;
fLocalFilePath = other.fLocalFilePath;
return *this; return *this;
} }
@@ -597,7 +603,8 @@ PackageInfo::operator==(const PackageInfo& other) const
&& fFlags == other.fFlags && fFlags == other.fFlags
&& fDownloadProgress == other.fDownloadProgress && fDownloadProgress == other.fDownloadProgress
&& fSystemDependency == other.fSystemDependency && 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 void
PackageInfo::ClearUserRatings() PackageInfo::ClearUserRatings()
{ {
+7
View File
@@ -295,6 +295,12 @@ public:
{ return fDownloadProgress; } { return fDownloadProgress; }
void SetDownloadProgress(float progress); void SetDownloadProgress(float progress);
void SetLocalFilePath(const char* path);
const BString& LocalFilePath() const
{ return fLocalFilePath; }
bool IsLocalFile() const
{ return !fLocalFilePath.IsEmpty(); }
void ClearCategories(); void ClearCategories();
bool AddCategory(const CategoryRef& category); bool AddCategory(const CategoryRef& category);
const CategoryList& Categories() const const CategoryList& Categories() const
@@ -348,6 +354,7 @@ private:
int32 fFlags; int32 fFlags;
bool fSystemDependency; bool fSystemDependency;
BString fArchitecture; BString fArchitecture;
BString fLocalFilePath;
static BitmapRef sDefaultIcon; static BitmapRef sDefaultIcon;
}; };
+2
View File
@@ -144,6 +144,8 @@ App::_Open(const BEntry& entry)
fprintf(stderr, "Could not allocate PackageInfo\n"); fprintf(stderr, "Could not allocate PackageInfo\n");
return; return;
} }
package->SetLocalFilePath(path.Path());
BMessage settings; BMessage settings;
_LoadSettings(settings); _LoadSettings(settings);