Allow setting fields in fs subtree. Use for an application tag used for starting a specialized viewer
This commit is contained in:
parent
e7dfd57d6e
commit
4d0e860a04
@ -386,7 +386,7 @@ bool RclConfig::inStopSuffixes(const string& fni)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string RclConfig::getMimeTypeFromSuffix(const string &suff)
|
string RclConfig::getMimeTypeFromSuffix(const string& suff)
|
||||||
{
|
{
|
||||||
string mtype;
|
string mtype;
|
||||||
mimemap->get(suff, mtype, m_keydir);
|
mimemap->get(suff, mtype, m_keydir);
|
||||||
@ -611,10 +611,14 @@ string RclConfig::fieldCanon(const string& f)
|
|||||||
return fld;
|
return fld;
|
||||||
}
|
}
|
||||||
|
|
||||||
string RclConfig::getMimeViewerDef(const string &mtype)
|
string RclConfig::getMimeViewerDef(const string &mtype, const string& apptag)
|
||||||
{
|
{
|
||||||
|
LOGDEB(("RclConfig::getMimeViewerDef: mtype %s apptag %s\n",
|
||||||
|
mtype.c_str(), apptag.c_str()));
|
||||||
string hs;
|
string hs;
|
||||||
mimeview->get(mtype, hs, "view");
|
if (apptag.empty() || !mimeview->get(mtype + string("|") + apptag,
|
||||||
|
hs, "view"))
|
||||||
|
mimeview->get(mtype, hs, "view");
|
||||||
return hs;
|
return hs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,7 +628,7 @@ bool RclConfig::getMimeViewerDefs(vector<pair<string, string> >& defs)
|
|||||||
return false;
|
return false;
|
||||||
list<string>tps = mimeview->getNames("view");
|
list<string>tps = mimeview->getNames("view");
|
||||||
for (list<string>::const_iterator it = tps.begin(); it != tps.end();it++) {
|
for (list<string>::const_iterator it = tps.begin(); it != tps.end();it++) {
|
||||||
defs.push_back(pair<string, string>(*it, getMimeViewerDef(*it)));
|
defs.push_back(pair<string, string>(*it, getMimeViewerDef(*it, "")));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,7 +176,7 @@ class RclConfig {
|
|||||||
const map<string, string>& getXattrToField() {return m_xattrtofld;}
|
const map<string, string>& getXattrToField() {return m_xattrtofld;}
|
||||||
|
|
||||||
/** mimeview: get/set external viewer exec string(s) for mimetype(s) */
|
/** mimeview: get/set external viewer exec string(s) for mimetype(s) */
|
||||||
string getMimeViewerDef(const string &mimetype);
|
string getMimeViewerDef(const string &mimetype, const string& apptag);
|
||||||
bool getMimeViewerDefs(vector<pair<string, string> >&);
|
bool getMimeViewerDefs(vector<pair<string, string> >&);
|
||||||
bool setMimeViewerDef(const string& mimetype, const string& cmd);
|
bool setMimeViewerDef(const string& mimetype, const string& cmd);
|
||||||
|
|
||||||
|
|||||||
@ -918,9 +918,13 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
|||||||
// Look for appropriate viewer
|
// Look for appropriate viewer
|
||||||
string cmd;
|
string cmd;
|
||||||
if (prefs.useDesktopOpen) {
|
if (prefs.useDesktopOpen) {
|
||||||
cmd = rclconfig->getMimeViewerDef("application/x-all");
|
cmd = rclconfig->getMimeViewerDef("application/x-all", "");
|
||||||
} else {
|
} else {
|
||||||
cmd = rclconfig->getMimeViewerDef(doc.mimetype);
|
string apptag;
|
||||||
|
map<string,string>::const_iterator it;
|
||||||
|
if ((it = doc.meta.find("apptag")) != doc.meta.end())
|
||||||
|
apptag = it->second;
|
||||||
|
cmd = rclconfig->getMimeViewerDef(doc.mimetype, apptag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd.length() == 0) {
|
if (cmd.length() == 0) {
|
||||||
|
|||||||
@ -217,7 +217,13 @@ void ResListPager::displayPage()
|
|||||||
linksbuf += string("<a href=") + vlbuf + ">" + trans("Preview")
|
linksbuf += string("<a href=") + vlbuf + ">" + trans("Preview")
|
||||||
+ "</a> ";
|
+ "</a> ";
|
||||||
}
|
}
|
||||||
if (!RclConfig::getMainConfig()->getMimeViewerDef(doc.mimetype).empty()) {
|
|
||||||
|
string apptag;
|
||||||
|
map<string,string>::const_iterator it;
|
||||||
|
if ((it = doc.meta.find("apptag")) != doc.meta.end())
|
||||||
|
apptag = it->second;
|
||||||
|
|
||||||
|
if (!RclConfig::getMainConfig()->getMimeViewerDef(doc.mimetype, apptag).empty()) {
|
||||||
sprintf(vlbuf, "E%d", docnumforlinks);
|
sprintf(vlbuf, "E%d", docnumforlinks);
|
||||||
linksbuf += string("<a href=") + vlbuf + ">" + trans("Open")
|
linksbuf += string("<a href=") + vlbuf + ">" + trans("Open")
|
||||||
+ "</a>";
|
+ "</a>";
|
||||||
|
|||||||
@ -35,10 +35,11 @@ recipient = XTO
|
|||||||
#
|
#
|
||||||
# Some fields are stored by default, don't add them here, else they will be
|
# Some fields are stored by default, don't add them here, else they will be
|
||||||
# stored twice: caption, keywords, abstract, filename, mimetype, url
|
# stored twice: caption, keywords, abstract, filename, mimetype, url
|
||||||
# "author" used to be stored by default, now set here as optional
|
|
||||||
# Only canonical names should be used here, not aliases.
|
# Only canonical names should be used here, not aliases.
|
||||||
|
# "author" used to be stored by default, now set here as optional
|
||||||
|
# "apptag" is used for viewer specialization (depending on local config)
|
||||||
[stored]
|
[stored]
|
||||||
stored = author
|
stored = author apptag
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# This section defines field names aliases or synonyms. Any right hand side
|
# This section defines field names aliases or synonyms. Any right hand side
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user