diff --git a/src/qtgui/preview.ui b/src/qtgui/preview.ui
index 94f295dc..c0de6991 100644
--- a/src/qtgui/preview.ui
+++ b/src/qtgui/preview.ui
@@ -95,6 +95,20 @@
+ -
+
+
+ Qt::Vertical
+
+
+
+ -
+
+
+ Open
+
+
+
diff --git a/src/qtgui/preview_w.cpp b/src/qtgui/preview_w.cpp
index 523bcadb..6613394d 100644
--- a/src/qtgui/preview_w.cpp
+++ b/src/qtgui/preview_w.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 J.F.Dockes
+/* Copyright (C) 2005-2019 J.F.Dockes
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -138,6 +138,7 @@ void Preview::init()
connect(nextPB, SIGNAL(clicked()), this, SLOT(nextPressed()));
connect(prevPB, SIGNAL(clicked()), this, SLOT(prevPressed()));
connect(clearPB, SIGNAL(clicked()), searchTextCMB, SLOT(clearEditText()));
+ connect(editPB, SIGNAL(clicked()), this, SLOT(emitEditRequested()));
connect(pvTab, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
connect(pvTab, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
@@ -276,7 +277,7 @@ void Preview::searchTextFromIndex(int idx)
m_searchTextFromIndex = idx;
}
-// Save current document to file
+
void Preview::emitSaveDocToFile()
{
PreviewTextEdit *ce = currentEditor();
@@ -285,6 +286,14 @@ void Preview::emitSaveDocToFile()
}
}
+void Preview::emitEditRequested()
+{
+ PreviewTextEdit *ce = currentEditor();
+ if (ce && !ce->m_dbdoc.url.empty()) {
+ emit editRequested(ce->m_dbdoc);
+ }
+}
+
// Perform text search. If next is true, we look for the next match of the
// current search, trying to advance and possibly wrapping around. If next is
// false, the search string has been modified, we search for the new string,
@@ -924,11 +933,12 @@ void PreviewTextEdit::createPopupMenu(const QPoint& pos)
popup->addAction(tr("Preserve indentation"),
m_preview, SLOT(togglePlainPre()));
}
- // Need to check ipath until we fix the internfile bug that always
- // has it convert to html for top level docs
- if (!m_dbdoc.url.empty() && !m_dbdoc.ipath.empty())
+ if (!m_dbdoc.url.empty()) {
popup->addAction(tr("Save document to file"),
m_preview, SLOT(emitSaveDocToFile()));
+ popup->addAction(tr("Open document"),
+ m_preview, SLOT(emitEditRequested()));
+ }
popup->popup(mapToGlobal(pos));
}
diff --git a/src/qtgui/preview_w.h b/src/qtgui/preview_w.h
index f0714e13..f31283af 100644
--- a/src/qtgui/preview_w.h
+++ b/src/qtgui/preview_w.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 J.F.Dockes
+/* Copyright (C) 2006-2019 J.F.Dockes
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -114,10 +114,10 @@ class Preview : public QDialog, public Ui::Preview {
public:
Preview(RclMain *m, int sid, // Search Id
- const HighlightData& hdata) // Search terms etc. for highlighting
- : m_rclmain(m), m_searchId(sid), m_hData(hdata) {
+ const HighlightData& hdata) // Search terms etc. for highlighting
+ : m_rclmain(m), m_searchId(sid), m_hData(hdata) {
setupUi(this);
- init();
+ init();
}
virtual void closeEvent(QCloseEvent *e);
@@ -130,7 +130,7 @@ public:
* paragraph when tab exposed etc.
*/
virtual bool makeDocCurrent(const Rcl::Doc& idoc, int docnum,
- bool sametab = false);
+ bool sametab = false);
void emitWordSelect(QString);
friend class PreviewTextEdit;
@@ -139,7 +139,7 @@ public slots:
virtual void searchTextChanged(const QString& text);
virtual void searchTextFromIndex(int);
virtual void doSearch(const QString& str, bool next, bool reverse,
- bool wo = false);
+ bool wo = false);
virtual void nextPressed();
virtual void prevPressed();
@@ -151,6 +151,7 @@ public slots:
virtual void emitShowPrev();
virtual void emitSaveDocToFile();
+ virtual void emitEditRequested();
virtual void togglePlainPre();
signals:
@@ -161,6 +162,7 @@ signals:
void previewExposed(Preview *w, int sid, int docnum);
void printCurrentPreviewRequest();
void saveDocToFile(Rcl::Doc);
+ void editRequested(Rcl::Doc);
private:
RclMain *m_rclmain;
diff --git a/src/qtgui/rclm_preview.cpp b/src/qtgui/rclm_preview.cpp
index d72142cd..02586b7d 100644
--- a/src/qtgui/rclm_preview.cpp
+++ b/src/qtgui/rclm_preview.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 J.F.Dockes
+/* Copyright (C) 2005-2019 J.F.Dockes
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -33,10 +33,10 @@ void RclMain::previewClosed(Preview *w)
{
LOGDEB("RclMain::previewClosed(" << w << ")\n");
if (w == curPreview) {
- LOGDEB("Active preview closed\n");
- curPreview = 0;
+ LOGDEB("Active preview closed\n");
+ curPreview = 0;
} else {
- LOGDEB("Old preview closed\n");
+ LOGDEB("Old preview closed\n");
}
delete w;
}
@@ -144,37 +144,39 @@ void RclMain::startPreview(int docnum, Rcl::Doc doc, int mod)
zg_send_event(ZGSEND_PREVIEW, doc);
if (mod & Qt::ShiftModifier) {
- // User wants new preview window
- curPreview = 0;
+ // User wants new preview window
+ curPreview = 0;
}
if (curPreview == 0) {
- HighlightData hdata;
- m_source->getTerms(hdata);
- curPreview = new Preview(this, reslist->listId(), hdata);
+ HighlightData hdata;
+ m_source->getTerms(hdata);
+ curPreview = new Preview(this, reslist->listId(), hdata);
- if (curPreview == 0) {
- QMessageBox::warning(0, tr("Warning"),
- tr("Can't create preview window"),
- QMessageBox::Ok,
- QMessageBox::NoButton);
- return;
- }
- connect(new QShortcut(quitKeySeq, curPreview), SIGNAL (activated()),
- this, SLOT (fileExit()));
- connect(curPreview, SIGNAL(previewClosed(Preview *)),
- this, SLOT(previewClosed(Preview *)));
- connect(curPreview, SIGNAL(wordSelect(QString)),
- sSearch, SLOT(addTerm(QString)));
- connect(curPreview, SIGNAL(showNext(Preview *, int, int)),
- this, SLOT(previewNextInTab(Preview *, int, int)));
- connect(curPreview, SIGNAL(showPrev(Preview *, int, int)),
- this, SLOT(previewPrevInTab(Preview *, int, int)));
- connect(curPreview, SIGNAL(previewExposed(Preview *, int, int)),
- this, SLOT(previewExposed(Preview *, int, int)));
- connect(curPreview, SIGNAL(saveDocToFile(Rcl::Doc)),
- this, SLOT(saveDocToFile(Rcl::Doc)));
- curPreview->setWindowTitle(getQueryDescription());
- curPreview->show();
+ if (curPreview == 0) {
+ QMessageBox::warning(0, tr("Warning"),
+ tr("Can't create preview window"),
+ QMessageBox::Ok,
+ QMessageBox::NoButton);
+ return;
+ }
+ connect(new QShortcut(quitKeySeq, curPreview), SIGNAL (activated()),
+ this, SLOT (fileExit()));
+ connect(curPreview, SIGNAL(previewClosed(Preview *)),
+ this, SLOT(previewClosed(Preview *)));
+ connect(curPreview, SIGNAL(wordSelect(QString)),
+ sSearch, SLOT(addTerm(QString)));
+ connect(curPreview, SIGNAL(showNext(Preview *, int, int)),
+ this, SLOT(previewNextInTab(Preview *, int, int)));
+ connect(curPreview, SIGNAL(showPrev(Preview *, int, int)),
+ this, SLOT(previewPrevInTab(Preview *, int, int)));
+ connect(curPreview, SIGNAL(previewExposed(Preview *, int, int)),
+ this, SLOT(previewExposed(Preview *, int, int)));
+ connect(curPreview, SIGNAL(saveDocToFile(Rcl::Doc)),
+ this, SLOT(saveDocToFile(Rcl::Doc)));
+ connect(curPreview, SIGNAL(editRequested(Rcl::Doc)),
+ this, SLOT(startNativeViewer(Rcl::Doc)));
+ curPreview->setWindowTitle(getQueryDescription());
+ curPreview->show();
}
curPreview->makeDocCurrent(doc, docnum);
}
@@ -190,16 +192,16 @@ void RclMain::startPreview(Rcl::Doc doc)
{
Preview *preview = new Preview(this, 0, HighlightData());
if (preview == 0) {
- QMessageBox::warning(0, tr("Warning"),
- tr("Can't create preview window"),
- QMessageBox::Ok,
- QMessageBox::NoButton);
- return;
+ QMessageBox::warning(0, tr("Warning"),
+ tr("Can't create preview window"),
+ QMessageBox::Ok,
+ QMessageBox::NoButton);
+ return;
}
connect(new QShortcut(quitKeySeq, preview), SIGNAL (activated()),
- this, SLOT (fileExit()));
+ this, SLOT (fileExit()));
connect(preview, SIGNAL(wordSelect(QString)),
- sSearch, SLOT(addTerm(QString)));
+ sSearch, SLOT(addTerm(QString)));
// Do the zeitgeist thing
zg_send_event(ZGSEND_PREVIEW, doc);
preview->show();
@@ -225,30 +227,30 @@ void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
", listId " << reslist->listId() << "\n");
if (w == 0) // ??
- return;
+ return;
if (sid != reslist->listId()) {
- QMessageBox::warning(0, "Recoll",
- tr("This search is not active any more"));
- return;
+ QMessageBox::warning(0, "Recoll",
+ tr("This search is not active any more"));
+ return;
}
if (nxt)
- docnum++;
+ docnum++;
else
- docnum--;
+ docnum--;
if (docnum < 0 || !m_source || docnum >= m_source->getResCnt()) {
- QApplication::beep();
- return;
+ QApplication::beep();
+ return;
}
Rcl::Doc doc;
if (!reslist->getDoc(docnum, doc)) {
- QMessageBox::warning(0, "Recoll",
- tr("Cannot retrieve document info from database"));
- return;
+ QMessageBox::warning(0, "Recoll",
+ tr("Cannot retrieve document info from database"));
+ return;
}
-
+
w->makeDocCurrent(doc, docnum, true);
}
@@ -259,8 +261,7 @@ void RclMain::previewExposed(Preview *, int sid, int docnum)
LOGDEB2("RclMain::previewExposed: sid " << sid << " docnum " << docnum <<
", m_sid " << reslist->listId() << "\n");
if (sid != reslist->listId()) {
- return;
+ return;
}
reslist->previewExposed(docnum);
}
-