document already shown test was wrong, wouldnt show more docs from same file
This commit is contained in:
parent
9247d9f7d5
commit
698fade930
@ -214,7 +214,7 @@
|
||||
<function access="private" specifier="non virtual">init()</function>
|
||||
<function>closeEvent( QCloseEvent * e )</function>
|
||||
<function returnType="bool">eventFilter( QObject * target, QEvent * event )</function>
|
||||
<function returnType="bool">makeFileCurrent( const string & fn )</function>
|
||||
<function returnType="bool">makeDocCurrent( const string & fn, const Rcl::Doc & doc )</function>
|
||||
<function returnType="QTextEdit *">getCurrentEditor()</function>
|
||||
<function returnType="QTextEdit *">addEditorTab()</function>
|
||||
<function access="private">destroy()</function>
|
||||
|
||||
@ -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> *)tabData)
|
||||
@ -43,8 +46,9 @@ void Preview::init()
|
||||
dynSearchActive = false;
|
||||
canBeep = true;
|
||||
tabData = new list<TabData>;
|
||||
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<TabData>::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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user