reslist: added menu entry to see parent doc of attachment
This commit is contained in:
parent
50174005a1
commit
38604c239b
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.11 2006-12-19 08:40:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.12 2006-12-20 13:55:46 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -207,7 +207,10 @@ QTextEdit *Preview::getCurrentEditor()
|
||||
void Preview::doSearch(const QString &text, bool next, bool reverse,
|
||||
bool wordOnly)
|
||||
{
|
||||
LOGDEB1(("Preview::doSearch: next %d rev %d\n", int(next), int(reverse)));
|
||||
LOGDEB1(("Preview::doSearch: [%s] next %d rev %d\n",
|
||||
(const char *)text.utf8(), int(next), int(reverse)));
|
||||
if (text.isEmpty())
|
||||
return;
|
||||
QTextEdit *edit = getCurrentEditor();
|
||||
if (edit == 0) {
|
||||
// ??
|
||||
@ -684,7 +687,10 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc,
|
||||
#ifdef QT_SCROLL_TO_ANCHOR_BUG
|
||||
bool wasC = matchCheck->isChecked();
|
||||
matchCheck->setChecked(false);
|
||||
bool ocanbeep = canBeep;
|
||||
canBeep = false;
|
||||
doSearch(QString::fromUtf8(firstTermBeacon), 0, false, false);
|
||||
canBeep = ocanbeep;
|
||||
editor->del();
|
||||
matchCheck->setChecked(wasC);
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.16 2006-12-18 12:05:29 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.17 2006-12-20 13:55:46 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -125,6 +125,9 @@ void RclMain::init()
|
||||
connect(resList, SIGNAL(docPreviewClicked(int, int)),
|
||||
this, SLOT(startPreview(int, int)));
|
||||
|
||||
connect(resList, SIGNAL(previewRequested(Rcl::Doc)),
|
||||
this, SLOT(startPreview(Rcl::Doc)));
|
||||
|
||||
connect(fileExitAction, SIGNAL(activated() ), this, SLOT(fileExit() ) );
|
||||
connect(fileStart_IndexingAction, SIGNAL(activated()),
|
||||
this, SLOT(startIndexing()));
|
||||
@ -534,6 +537,41 @@ void RclMain::startPreview(int docnum, int mod)
|
||||
curPreview->closeCurrentTab();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a preview window for a given document, no linking to result list
|
||||
*
|
||||
* This is used to show ie parent documents, which have no corresponding
|
||||
* entry in the result list.
|
||||
*
|
||||
*/
|
||||
void RclMain::startPreview(Rcl::Doc doc)
|
||||
{
|
||||
// Check file exists in file system
|
||||
string fn = urltolocalpath(doc.url);
|
||||
struct stat st;
|
||||
if (stat(fn.c_str(), &st) < 0) {
|
||||
QMessageBox::warning(0, "Recoll", tr("Cannot access document file: ") +
|
||||
fn.c_str());
|
||||
return;
|
||||
}
|
||||
Preview *preview = new Preview(0);
|
||||
if (preview == 0) {
|
||||
QMessageBox::warning(0, tr("Warning"),
|
||||
tr("Can't create preview window"),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
RefCntr<Rcl::SearchData> searchdata(new Rcl::SearchData(Rcl::SCLT_AND));
|
||||
preview->setSId(0, searchdata);
|
||||
connect(preview, SIGNAL(wordSelect(QString)),
|
||||
this, SLOT(ssearchAddTerm(QString)));
|
||||
g_dynconf->enterDoc(fn, doc.ipath);
|
||||
preview->show();
|
||||
if (!preview->loadFileInCurrentTab(fn, st.st_size, doc, 0))
|
||||
preview->closeCurrentTab();
|
||||
}
|
||||
|
||||
// Show next document from result list in current preview tab
|
||||
void RclMain::previewNextInTab(int sid, int docnum)
|
||||
{
|
||||
|
||||
@ -88,6 +88,7 @@ public slots:
|
||||
virtual void docExpand(int);
|
||||
virtual void ssearchAddTerm(QString);
|
||||
virtual void startPreview(int docnum, int);
|
||||
virtual void startPreview(Rcl::Doc doc);
|
||||
virtual void startNativeViewer(int docnum);
|
||||
virtual void previewNextInTab(int sid, int docnum);
|
||||
virtual void previewPrevInTab(int sid, int docnum);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.15 2006-12-05 15:23:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.16 2006-12-20 13:55:46 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
@ -604,9 +604,15 @@ RCLPOPUP *ResList::createPopupMenu(const QPoint& pos)
|
||||
RCLPOPUP *popup = new RCLPOPUP(this);
|
||||
popup->insertItem(tr("&Preview"), this, SLOT(menuPreview()));
|
||||
popup->insertItem(tr("&Edit"), this, SLOT(menuEdit()));
|
||||
popup->insertItem(tr("&Copy File Name"), this, SLOT(menuCopyFN()));
|
||||
popup->insertItem(tr("Copy &File Name"), this, SLOT(menuCopyFN()));
|
||||
popup->insertItem(tr("Copy &Url"), this, SLOT(menuCopyURL()));
|
||||
popup->insertItem(tr("Find &similar documents"), this, SLOT(menuExpand()));
|
||||
Rcl::Doc doc;
|
||||
if (getDoc(m_popDoc, doc)) {
|
||||
if (!doc.ipath.empty())
|
||||
popup->insertItem(tr("P&arent document"),
|
||||
this, SLOT(menuSeeParent()));
|
||||
}
|
||||
return popup;
|
||||
}
|
||||
|
||||
@ -614,6 +620,31 @@ void ResList::menuPreview()
|
||||
{
|
||||
emit docPreviewClicked(m_popDoc, 0);
|
||||
}
|
||||
void ResList::menuSeeParent()
|
||||
{
|
||||
Rcl::Doc doc;
|
||||
if (getDoc(m_popDoc, doc)) {
|
||||
if (doc.ipath.empty())
|
||||
return;
|
||||
Rcl::Doc doc1;
|
||||
doc1.url = doc.url;
|
||||
doc1.ipath = doc.ipath;
|
||||
string::size_type colon;
|
||||
LOGDEB(("Ipath: [%s]\n", doc1.ipath.c_str()));
|
||||
if ((colon=doc1.ipath.find_last_of(":")) != string::npos) {
|
||||
doc1.ipath.erase(colon);
|
||||
} else {
|
||||
doc1.ipath.erase();
|
||||
}
|
||||
LOGDEB(("Ipath after: [%s]\n", doc1.ipath.c_str()));
|
||||
|
||||
list<string> lipath;
|
||||
stringToTokens(doc.ipath, lipath, ":");
|
||||
if (lipath.size() >= 1)
|
||||
lipath.pop_back();
|
||||
emit previewRequested(doc1);
|
||||
}
|
||||
}
|
||||
void ResList::menuEdit()
|
||||
{
|
||||
emit docEditClicked(m_popDoc);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#ifndef _RESLIST_H_INCLUDED_
|
||||
#define _RESLIST_H_INCLUDED_
|
||||
/* @(#$Id: reslist.h,v 1.6 2006-12-05 15:23:50 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||
/* @(#$Id: reslist.h,v 1.7 2006-12-20 13:55:46 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||
|
||||
#include <list>
|
||||
|
||||
@ -60,6 +60,7 @@ class ResList : public QTEXTBROWSER
|
||||
virtual void menuCopyFN();
|
||||
virtual void menuCopyURL();
|
||||
virtual void menuExpand();
|
||||
virtual void menuSeeParent();
|
||||
virtual void previewExposed(int);
|
||||
|
||||
signals:
|
||||
@ -67,6 +68,7 @@ class ResList : public QTEXTBROWSER
|
||||
void prevPageAvailable(bool);
|
||||
void docEditClicked(int);
|
||||
void docPreviewClicked(int, int);
|
||||
void previewRequested(Rcl::Doc);
|
||||
void headerClicked();
|
||||
void docExpand(int);
|
||||
void wordSelect(QString);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user