reslist popup: enable save to file for web cache entries, disable open parent

This commit is contained in:
Jean-Francois Dockes 2015-07-25 10:59:27 +02:00
parent 4d35cbabfb
commit 922f73039a
3 changed files with 19 additions and 13 deletions

View File

@ -291,18 +291,10 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
LOGDEB(("RclMain::startNV: groksipath %d wantsf %d wantsparentf %d\n",
groksipath, wantsfile, wantsparentfile));
bool notinfs = false;
{
string backend;
doc.getmeta(Rcl::Doc::keybcknd, &backend);
if (!backend.empty() && backend.compare("FS"))
notinfs = true;
}
// If the command wants a file but this is not a file url, or
// there is an ipath that it won't understand, we need a temp file:
theconfig->setKeyDir(path_getfather(fn));
if (notinfs ||
if (!doc.isFsFile() ||
((wantsfile || wantsparentfile) && fn.empty()) ||
(!groksipath && !doc.ipath.empty()) ) {
TempFile temp;

View File

@ -103,8 +103,9 @@ QMenu *create(QWidget *me, int opts, RefCntr<DocSequence> source, Rcl::Doc& doc)
popup->addAction(QWidget::tr("Copy &File Name"), me, SLOT(menuCopyFN()));
popup->addAction(QWidget::tr("Copy &URL"), me, SLOT(menuCopyURL()));
if ((opts&showSaveOne) && !doc.ipath.empty())
popup->addAction(QWidget::tr("&Write to File"), me, SLOT(menuSaveToFile()));
if ((opts&showSaveOne) && (!doc.isFsFile() || !doc.ipath.empty()))
popup->addAction(QWidget::tr("&Write to File"), me,
SLOT(menuSaveToFile()));
if ((opts&showSaveSel))
popup->addAction(QWidget::tr("Save selection to files"),
@ -117,8 +118,9 @@ QMenu *create(QWidget *me, int opts, RefCntr<DocSequence> source, Rcl::Doc& doc)
}
// Open parent is useful even if there is no parent because we open
// the enclosing folder.
popup->addAction(QWidget::tr("&Open Parent document/folder"),
me, SLOT(menuOpenParent()));
if (doc.isFsFile())
popup->addAction(QWidget::tr("&Open Parent document/folder"),
me, SLOT(menuOpenParent()));
if (opts & showExpand)
popup->addAction(QWidget::tr("Find &similar documents"),

View File

@ -233,6 +233,18 @@ class Doc {
return true;
}
/* Is this document stored as a regular filesystem file ?
* (as opposed to e.g. a webcache file), not a subdoc,
*/
bool isFsFile() {
string backend;
getmeta(keybcknd, &backend);
if (!backend.empty() && backend.compare("FS"))
return false;
return true;
}
void dump(bool dotext=false) const;
// The official names for recoll native fields when used in a text