handle application tag when looking for icon, and add icons for books and book chapters (epub, chm, info)

This commit is contained in:
Jean-Francois Dockes 2012-10-23 16:34:07 +02:00
parent 128b54cabd
commit 217c38edb4
8 changed files with 39 additions and 34 deletions

View file

@ -885,33 +885,30 @@ bool RclConfig::mimeViewerNeedsUncomp(const string &mimetype)
return true;
}
/**
* Return icon name and path
*/
string RclConfig::getMimeIconName(const string &mtype, string *path)
string RclConfig::getMimeIconPath(const string &mtype, const string &apptag)
{
string iconname;
mimeconf->get(mtype, iconname, "icons");
if (!apptag.empty())
mimeconf->get(mtype + string("|") + apptag, iconname, "icons");
if (iconname.empty())
mimeconf->get(mtype, iconname, "icons");
if (iconname.empty())
iconname = "document";
if (path) {
string iconsdir;
string iconpath;
#if defined (__FreeBSD__) && __FreeBSD_version < 500000
// gcc 2.95 dies if we call getConfParam here ??
if (m_conf) m_conf->get(string("iconsdir"), iconsdir, m_keydir);
// gcc 2.95 dies if we call getConfParam here ??
if (m_conf) m_conf->get(string("iconsdir"), iconpath, m_keydir);
#else
getConfParam("iconsdir", iconsdir);
getConfParam("iconsdir", iconpath);
#endif
if (iconsdir.empty()) {
iconsdir = path_cat(m_datadir, "images");
} else {
iconsdir = path_tildexpand(iconsdir);
}
*path = path_cat(iconsdir, iconname) + ".png";
if (iconpath.empty()) {
iconpath = path_cat(m_datadir, "images");
} else {
iconpath = path_tildexpand(iconpath);
}
return iconname;
return path_cat(iconpath, iconname) + ".png";
}
string RclConfig::getDbDir()

View file

@ -196,8 +196,8 @@ class RclConfig {
bool valueSplitAttributes(const string& whole, string& value,
ConfSimple& attrs);
/** mimeconf: get icon name for mimetype */
string getMimeIconName(const string &mtype, string *path = 0);
/** Return icon path for mime type and tag */
string getMimeIconPath(const string &mt, const string& apptag);
/** mimeconf: get list of file categories */
bool getMimeCategories(vector<string>&);

View file

@ -100,7 +100,7 @@ bool RecollFilter::txtdcode(const string& who)
string& ocs = m_metaData[cstr_dj_keyorigcharset];
string& itext = m_metaData[cstr_dj_keycontent];
LOGDEB0(("%s::txtdcode: %d bytes from [%s] to UTF-8\n",
LOGDEB1(("%s::txtdcode: %d bytes from [%s] to UTF-8\n",
who.c_str(), itext.size(), ocs.c_str()));
int ecnt;
string otext;

View file

@ -1,4 +1,8 @@
Most icons thanks to kde crystalsvg
The Python and archive icons comes from oxygen (www.oxygen-icons.org) GPL
The Pidgin icon comes from the Pidgin project (GPL)
Most icons thanks to KDE crystalsvg
Oxygen (www.oxygen-icons.org) (GPL):
archive.png book.png bookchap.png text-x-python.png
The Pidgin project (GPL):
pidgin.png

View file

@ -453,10 +453,10 @@ string ResListPager::prevUrl()
string ResListPager::iconUrl(RclConfig *config, Rcl::Doc& doc)
{
string iconurl;
config->getMimeIconName(doc.mimetype, &iconurl);
iconurl = cstr_fileu + iconurl;
return iconurl;
string apptag;
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
return cstr_fileu + config->getMimeIconPath(doc.mimetype, apptag);
}
bool ResListPager::append(const string& data)

View file

@ -146,16 +146,16 @@ text/xml = exec rclxml
## #############################################
# Icons to be used in the result list if required by gui config
[icons]
application/epub+zip = document
application/epub+zip = book
application/msword = wordprocessing
application/ogg = sownd
application/pdf = pdf
application/postscript = postscript
application/vnd.ms-excel = spreadsheet
application/vnd.ms-powerpoint = presentation
application/vnd.oasis.opendocument.text = wordprocessing
application/vnd.oasis.opendocument.presentation = presentation
application/vnd.oasis.opendocument.spreadsheet = spreadsheet
application/vnd.oasis.opendocument.text = wordprocessing
application/vnd.openxmlformats-officedocument.presentationml.presentation = presentation
application/vnd.openxmlformats-officedocument.presentationml.template = presentation
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet = spreadsheet
@ -175,12 +175,12 @@ application/vnd.sun.xml.writer.template = wordprocessing
application/vnd.wordperfect = wordprocessing
application/x-abiword = wordprocessing
application/x-awk = source
application/x-chm = document
application/x-chm = book
application/x-dia-diagram = drawing
application/x-dvi = document
application/x-flac = sownd
application/x-fsdirectory = folder
application/x-gnuinfo = document
application/x-gnuinfo = book
application/x-gnumeric = spreadsheet
application/x-kword = wordprocessing
application/x-lyx = wordprocessing
@ -211,6 +211,9 @@ image/x-xcf = image
image/x-xpmi = image
message/rfc822 = message
text/html = html
text/html|chm = bookchap
text/html|epub = bookchap
text/html|gnuinfo = bookchap
text/plain = txt
text/rtf = wordprocessing
text/x-c = source

View file

@ -79,6 +79,7 @@
<h2><a name="b_latest">recoll 1.17.3</a></h2>
<ul>
<li>Messages in Qt standard dialog messages are not translated.</li>
<li>The unac_except_trans mechanism can generate wrong
character translations in some cases.</li>
<li>The real time monitor can be terminated for for permissions-related

View file

@ -84,8 +84,8 @@
<h2>News</h2>
<div class="news">
<ul>
<li>2012-10-19: the source for <a href="recoll-1.18.0.tar.gz">
recoll 1.18.0</a> is available, and this is a call to
<li>2012-10-19: the source for <a href="recoll-1.18.001.tar.gz">
recoll 1.18.001</a> is available, and this is a call to
volunteers to test it. There are binary
packages for Ubuntu and Mint Linux users, and I can build
others. See this