Take advantage of text storage when possible to display preview data for an unaccessible document
This commit is contained in:
@@ -42,6 +42,7 @@ using namespace std;
|
||||
#include "mh_unknown.h"
|
||||
#include "mh_null.h"
|
||||
#include "mh_xslt.h"
|
||||
#include "rcldoc.h"
|
||||
|
||||
// Performance help: we use a pool of already known and created
|
||||
// handlers. There can be several instances for a given mime type
|
||||
@@ -381,6 +382,24 @@ bool canIntern(const std::string mtype, RclConfig *cfg)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
/// Same, getting MIME from doc
|
||||
bool canIntern(Rcl::Doc *doc, RclConfig *cfg)
|
||||
{
|
||||
if (doc) {
|
||||
return canIntern(doc->mimetype, cfg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Can this MIME type be opened (has viewer def) ?
|
||||
bool canOpen(Rcl::Doc *doc, RclConfig *cfg) {
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
string apptag;
|
||||
doc->getmeta(Rcl::Doc::keyapptg, &apptag);
|
||||
return !cfg->getMimeViewerDef(doc->mimetype, apptag, false).empty();
|
||||
}
|
||||
|
||||
string RecollFilter::metadataAsString()
|
||||
{
|
||||
|
||||
@@ -179,7 +179,14 @@ extern void returnMimeHandler(RecollFilter *);
|
||||
/// off recoll.
|
||||
extern void clearMimeHandlerCache();
|
||||
|
||||
namespace Rcl {
|
||||
class Doc;
|
||||
}
|
||||
/// Can this mime type be interned ?
|
||||
extern bool canIntern(const std::string mimetype, RclConfig *cfg);
|
||||
/// Same, getting MIME from doc
|
||||
extern bool canIntern(Rcl::Doc *doc, RclConfig *cfg);
|
||||
/// Can this MIME type be opened (has viewer def) ?
|
||||
extern bool canOpen(Rcl::Doc *doc, RclConfig *cfg);
|
||||
|
||||
#endif /* _MIMEHANDLER_H_INCLUDED_ */
|
||||
|
||||
Reference in New Issue
Block a user