uncompress file before starting external viewer except if in the nouncompforviewmts list

This commit is contained in:
Jean-Francois Dockes
2010-09-20 10:35:26 +02:00
parent 8b1797b4a5
commit ad4f24923f
8 changed files with 180 additions and 2 deletions
+15
View File
@@ -721,6 +721,8 @@ 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;
if (mimeview == 0)
return hs;
if (apptag.empty() || !mimeview->get(mtype + string("|") + apptag,
hs, "view"))
mimeview->get(mtype, hs, "view");
@@ -740,6 +742,8 @@ bool RclConfig::getMimeViewerDefs(vector<pair<string, string> >& defs)
bool RclConfig::setMimeViewerDef(const string& mt, const string& def)
{
if (mimeview == 0)
return false;
string pconfname = path_cat(m_confdir, "mimeview");
// Make sure this exists
close(open(pconfname.c_str(), O_CREAT|O_WRONLY, 0600));
@@ -763,6 +767,17 @@ bool RclConfig::setMimeViewerDef(const string& mt, const string& def)
return true;
}
bool RclConfig::mimeViewerNeedsUncomp(const string &mimetype)
{
string s;
vector<string> v;
if (mimeview != 0 && mimeview->get("nouncompforviewmts", s, "") &&
stringToStrings(s, v) &&
find_if(v.begin(), v.end(), StringIcmpPred(mimetype)) != v.end())
return false;
return true;
}
/**
* Return icon name and path
*/
+4
View File
@@ -209,6 +209,10 @@ class RclConfig {
string getMimeViewerDef(const string &mimetype, const string& apptag);
bool getMimeViewerDefs(vector<pair<string, string> >&);
bool setMimeViewerDef(const string& mimetype, const string& cmd);
/** Check if mime type is designated as needing no uncompress before view
* (if a file of this type is found compressed). Default is true,
* exceptions are found in the nouncompforviewmts mimeview list */
bool mimeViewerNeedsUncomp(const string &mimetype);
/** Store/retrieve missing helpers description string */
string getMissingHelperDesc();