From 922f73039a877f031493de1f0921fd9d0b4eda25 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sat, 25 Jul 2015 10:59:27 +0200 Subject: [PATCH] reslist popup: enable save to file for web cache entries, disable open parent --- src/qtgui/rclm_view.cpp | 10 +--------- src/qtgui/respopup.cpp | 10 ++++++---- src/rcldb/rcldoc.h | 12 ++++++++++++ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/qtgui/rclm_view.cpp b/src/qtgui/rclm_view.cpp index e189ce6c..8881f94d 100644 --- a/src/qtgui/rclm_view.cpp +++ b/src/qtgui/rclm_view.cpp @@ -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; diff --git a/src/qtgui/respopup.cpp b/src/qtgui/respopup.cpp index 73b7f88c..97b0024a 100644 --- a/src/qtgui/respopup.cpp +++ b/src/qtgui/respopup.cpp @@ -103,8 +103,9 @@ QMenu *create(QWidget *me, int opts, RefCntr 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 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"), diff --git a/src/rcldb/rcldoc.h b/src/rcldb/rcldoc.h index d2288566..120d9ae8 100644 --- a/src/rcldb/rcldoc.h +++ b/src/rcldb/rcldoc.h @@ -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