GUI: simplify icon display by moving up the thumbnail test up to reslistpager as it was identical in restable and reslist

This commit is contained in:
Jean-Francois Dockes
2020-06-14 13:31:26 +02:00
parent f500474643
commit 1eeeba4874
3 changed files with 21 additions and 42 deletions
+21 -1
View File
@@ -478,9 +478,29 @@ string ResListPager::prevUrl()
string ResListPager::iconUrl(RclConfig *config, Rcl::Doc& doc)
{
// If this is a top level doc, check for a thumbnail image
if (doc.ipath.empty()) {
vector<Rcl::Doc> docs;
docs.push_back(doc);
vector<string> paths;
Rcl::docsToPaths(docs, paths);
if (!paths.empty()) {
string path;
LOGDEB2("ResList::iconUrl: source path [" << paths[0] << "]\n");
if (thumbPathForUrl(cstr_fileu + paths[0], 128, path)) {
LOGDEB2("ResList::iconUrl: icon path [" << path << "]\n");
return cstr_fileu + path;
} else {
LOGDEB2("ResList::iconUrl: no icon: path [" << path << "]\n");
}
} else {
LOGDEB("ResList::iconUrl: docsToPaths failed\n");
}
}
// No thumbnail, look for the MIME type icon.
string apptag;
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
return path_pathtofileurl(config->getMimeIconPath(doc.mimetype, apptag));
}