From 1ca3d028e68156100c0b884f542f3ab6d0df8fd2 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Thu, 25 Apr 2013 14:21:24 +0200 Subject: [PATCH] fixed a few connections in subdocs aux reslist --- src/index/recollindex.cpp | 16 +++++++++++----- src/qtgui/reslist.cpp | 24 ++++++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index 4de2740a..178c211a 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -367,13 +367,19 @@ int main(int argc, char **argv) string rundir; config->getConfParam("idxrundir", rundir); if (!rundir.compare("tmp")) { - LOGDEB(("recollindex: changing current directory to [%s]\n", + LOGINFO(("recollindex: changing current directory to [%s]\n", tmplocation().c_str())); - chdir(tmplocation().c_str()); + if (chdir(tmplocation().c_str()) < 0) { + LOGERR(("chdir(%s) failed, errno %d\n", + tmplocation().c_str(), errno)); + } } else if (!rundir.empty()) { - LOGDEB(("recollindex: changing current directory to [%s]\n", - rundir.c_str())); - chdir(rundir.c_str()); + LOGINFO(("recollindex: changing current directory to [%s]\n", + rundir.c_str())); + if (chdir(rundir.c_str()) < 0) { + LOGERR(("chdir(%s) failed, errno %d\n", + rundir.c_str(), errno)); + } } bool rezero((op_flags & OPT_z) != 0); diff --git a/src/qtgui/reslist.cpp b/src/qtgui/reslist.cpp index 8ac6e7d8..798690dd 100644 --- a/src/qtgui/reslist.cpp +++ b/src/qtgui/reslist.cpp @@ -389,6 +389,10 @@ void ResList::setDocSource(RefCntr nsource) m_rclmain, SLOT(startPreview(Rcl::Doc))); connect(this, SIGNAL(docEditClicked(Rcl::Doc)), m_rclmain, SLOT(startNativeViewer(Rcl::Doc))); + connect(this, SIGNAL(docSaveToFileClicked(Rcl::Doc)), + m_rclmain, SLOT(saveDocToFile(Rcl::Doc))); + connect(this, SIGNAL(editRequested(Rcl::Doc)), + m_rclmain, SLOT(startNativeViewer(Rcl::Doc))); } } @@ -985,15 +989,16 @@ void ResList::createPopupMenu(const QPoint& pos) if (m_popDoc < 0) return; - QMenu *popup = new QMenu(this); - popup->addAction(tr("&Preview"), this, SLOT(menuPreview())); - Rcl::Doc doc; bool havedoc = getDoc(m_popDoc, doc); string apptag; if (havedoc) doc.getmeta(Rcl::Doc::keyapptg, &apptag); + QMenu *popup = new QMenu(this); + + popup->addAction(tr("&Preview"), this, SLOT(menuPreview())); + if (havedoc && !theconfig->getMimeViewerDef(doc.mimetype, apptag, 0).empty()) { popup->addAction(tr("&Open"), this, SLOT(menuEdit())); @@ -1004,7 +1009,9 @@ void ResList::createPopupMenu(const QPoint& pos) popup->addAction(tr("&Write to File"), this, SLOT(menuSaveToFile())); } - popup->addAction(tr("Find &similar documents"), this, SLOT(menuExpand())); + if (m_ismainlist) + popup->addAction(tr("Find &similar documents"), + this, SLOT(menuExpand())); Rcl::Doc pdoc; if (m_source.isNotNull() && m_source->getEnclosing(doc, pdoc)) @@ -1028,8 +1035,13 @@ void ResList::createPopupMenu(const QPoint& pos) void ResList::menuPreview() { Rcl::Doc doc; - if (getDoc(m_popDoc, doc)) - emit docPreviewClicked(m_popDoc, doc, 0); + if (getDoc(m_popDoc, doc)) { + if (m_ismainlist) { + emit docPreviewClicked(m_popDoc, doc, 0); + } else { + emit previewRequested(doc); + } + } } void ResList::menuSaveToFile()