Implement the gui category filters as query language fragments instead of hard-coding them. This allows implementing other kinds of filtering (ie:on directory) just by changing a configuration file

This commit is contained in:
Jean-Francois Dockes
2012-02-18 11:21:09 +01:00
parent fab69fc3a1
commit ef00bfae70
11 changed files with 151 additions and 26 deletions
+18
View File
@@ -576,6 +576,24 @@ string RclConfig::getMimeHandlerDef(const string &mtype, bool filtertypes)
return hs;
}
bool RclConfig::getGuiFilterNames(list<string>& cats)
{
if (!mimeconf)
return false;
cats = mimeconf->getNamesShallow("guifilters");
return true;
}
bool RclConfig::getGuiFilter(const string& catfiltername, string& frag)
{
frag.clear();
if (!mimeconf)
return false;
if (!mimeconf->get(catfiltername, frag, "guifilters"))
return false;
return true;
}
bool RclConfig::valueSplitAttributes(const string& whole, string& value,
ConfSimple& attrs)
{
+5
View File
@@ -202,6 +202,11 @@ class RclConfig {
/** mimeconf: get list of mime types for category */
bool getMimeCatTypes(const string& cat, list<string>&);
/** mimeconf: get list of gui filters (doc cats by default */
bool getGuiFilterNames(list<string>&);
/** mimeconf: get query lang frag for named filter */
bool getGuiFilter(const string& filtername, string& frag);
/** fields: get field prefix from field name */
bool getFieldTraits(const string& fldname, const FieldTraits **);
const set<string>& getStoredFields() {return m_storedFields;}