HaikuDepot: Add some getters to Model.
For category, depot and search terms filter.
This commit is contained in:
@@ -70,6 +70,11 @@ public:
|
||||
return fDepot.Packages().Contains(package);
|
||||
}
|
||||
|
||||
const BString& Depot() const
|
||||
{
|
||||
return fDepot.Name();
|
||||
}
|
||||
|
||||
private:
|
||||
DepotInfo fDepot;
|
||||
};
|
||||
@@ -99,6 +104,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
const BString& Category() const
|
||||
{
|
||||
return fCategory;
|
||||
}
|
||||
|
||||
private:
|
||||
BString fCategory;
|
||||
};
|
||||
@@ -235,6 +245,20 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
BString SearchTerms() const
|
||||
{
|
||||
BString searchTerms;
|
||||
for (int32 i = 0; i < fSearchTerms.CountItems(); i++) {
|
||||
const BString& term = fSearchTerms.ItemAtFast(i);
|
||||
if (term.IsEmpty())
|
||||
continue;
|
||||
if (!searchTerms.IsEmpty())
|
||||
searchTerms.Append(" ");
|
||||
searchTerms.Append(term);
|
||||
}
|
||||
return searchTerms;
|
||||
}
|
||||
|
||||
private:
|
||||
bool _TextContains(BString text, const BString& string) const
|
||||
{
|
||||
@@ -244,7 +268,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
List<BString, false> fSearchTerms;
|
||||
StringList fSearchTerms;
|
||||
};
|
||||
|
||||
|
||||
@@ -477,6 +501,17 @@ Model::SetCategory(const BString& category)
|
||||
}
|
||||
|
||||
|
||||
BString
|
||||
Model::Category() const
|
||||
{
|
||||
CategoryFilter* filter
|
||||
= dynamic_cast<CategoryFilter*>(fCategoryFilter.Get());
|
||||
if (filter == NULL)
|
||||
return "";
|
||||
return filter->Category();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::SetDepot(const BString& depot)
|
||||
{
|
||||
@@ -484,6 +519,13 @@ Model::SetDepot(const BString& depot)
|
||||
}
|
||||
|
||||
|
||||
BString
|
||||
Model::Depot() const
|
||||
{
|
||||
return fDepotFilter;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::SetSearchTerms(const BString& searchTerms)
|
||||
{
|
||||
@@ -498,6 +540,17 @@ Model::SetSearchTerms(const BString& searchTerms)
|
||||
}
|
||||
|
||||
|
||||
BString
|
||||
Model::SearchTerms() const
|
||||
{
|
||||
SearchTermsFilter* filter
|
||||
= dynamic_cast<SearchTermsFilter*>(fSearchTermsFilter.Get());
|
||||
if (filter == NULL)
|
||||
return "";
|
||||
return filter->SearchTerms();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Model::SetShowAvailablePackages(bool show)
|
||||
{
|
||||
|
||||
@@ -91,8 +91,11 @@ public:
|
||||
|
||||
// Configure PackageFilters
|
||||
void SetCategory(const BString& category);
|
||||
BString Category() const;
|
||||
void SetDepot(const BString& depot);
|
||||
BString Depot() const;
|
||||
void SetSearchTerms(const BString& searchTerms);
|
||||
BString SearchTerms() const;
|
||||
|
||||
void SetShowAvailablePackages(bool show);
|
||||
bool ShowAvailablePackages() const
|
||||
|
||||
Reference in New Issue
Block a user