diff --git a/src/qtgui/preview/preview.ui b/src/qtgui/preview/preview.ui
index f07a5589..0896e5ee 100644
--- a/src/qtgui/preview/preview.ui
+++ b/src/qtgui/preview/preview.ui
@@ -214,7 +214,7 @@
init()
closeEvent( QCloseEvent * e )
eventFilter( QObject * target, QEvent * event )
- makeFileCurrent( const string & fn )
+ makeDocCurrent( const string & fn, const Rcl::Doc & doc )
getCurrentEditor()
addEditorTab()
destroy()
diff --git a/src/qtgui/preview/preview.ui.h b/src/qtgui/preview/preview.ui.h
index da807bb9..3aa4e1ee 100644
--- a/src/qtgui/preview/preview.ui.h
+++ b/src/qtgui/preview/preview.ui.h
@@ -25,12 +25,15 @@ using std::pair;
#include "recoll.h"
#include "plaintorich.h"
+extern int recollNeedsExit;
+
// We keep a list of data associated to each tab
class TabData {
public:
string fn; // filename for this tab
+ string ipath; // Internal doc path inside file
QWidget *w; // widget for setCurrent
- TabData(const string &str, QWidget *wi) : fn(str), w(wi) {}
+ TabData(QWidget *wi) : w(wi) {}
};
#define TABDATA ((list *)tabData)
@@ -43,8 +46,9 @@ void Preview::init()
dynSearchActive = false;
canBeep = true;
tabData = new list;
- TABDATA->push_back(TabData(string(""), pvTab->currentPage()));
+ TABDATA->push_back(TabData(pvTab->currentPage()));
}
+
void Preview::destroy()
{
delete TABDATA;
@@ -56,8 +60,6 @@ void Preview::closeEvent(QCloseEvent *e)
QWidget::closeEvent(e);
}
-extern int recollNeedsExit;
-
bool Preview::eventFilter(QObject *target, QEvent *event)
{
if (event->type() != QEvent::KeyPress)
@@ -243,7 +245,7 @@ QTextEdit * Preview::addEditorTab()
pvTab->addTab(anon, "Tab");
pvTab->showPage(anon);
if (tabData)
- TABDATA->push_back(TabData(string(""), anon));
+ TABDATA->push_back(TabData(anon));
return editor;
}
@@ -275,19 +277,20 @@ void Preview::setCurTabProps(const string &fn, const Rcl::Doc &doc)
it != TABDATA->end(); it++) {
if (it->w == w) {
it->fn = fn;
+ it->ipath = doc.ipath;
break;
}
}
}
-bool Preview::makeFileCurrent(const string &fn)
+bool Preview::makeDocCurrent(const string &fn, const Rcl::Doc &doc)
{
LOGDEB(("Preview::makeFileCurrent: %s\n", fn.c_str()));
for (list::iterator it = TABDATA->begin();
it != TABDATA->end(); it++) {
LOGDEB2(("Preview::makeFileCurrent: compare to w %p, file %s\n",
it->w, it->fn.c_str()));
- if (!it->fn.compare(fn)) {
+ if (!it->fn.compare(fn) && !it->ipath.compare(doc.ipath)) {
pvTab->showPage(it->w);
return true;
}
diff --git a/src/qtgui/recollmain.ui.h b/src/qtgui/recollmain.ui.h
index 12764c23..0020ab2c 100644
--- a/src/qtgui/recollmain.ui.h
+++ b/src/qtgui/recollmain.ui.h
@@ -33,7 +33,6 @@ using std::pair;
#include "mimehandler.h"
#include "pathut.h"
#include "recoll.h"
-#include "internfile.h"
#include "smallut.h"
#include "plaintorich.h"
#include "unacpp.h"
@@ -602,7 +601,7 @@ void RecollMain::startPreview(int docnum)
this, SLOT(previewClosed(Preview *)));
curPreview->show();
} else {
- if (curPreview->makeFileCurrent(fn)) {
+ if (curPreview->makeDocCurrent(fn, doc)) {
// Already there
return;
}