"); char line[80]; - sprintf(line, "
Displaying results starting at index %d (maximum set size %d)
",
+ sprintf(line, "
Displaying results starting at index"
+ " %d (maximum set size %d)
",
reslist_winfirst+1, resCnt);
reslistTE->append(line);
}
@@ -458,7 +472,8 @@ void RecollMain::advSearchPB_clicked()
}
}
-// Execute and advanced search query
+// Execute an advanced search query. The parameters normally come from
+// the advanced search dialog
void RecollMain::startAdvSearch(Rcl::AdvSearchData sdata)
{
LOGDEB(("RecollMain::startAdvSearch\n"));
@@ -495,7 +510,6 @@ void RecollMain::reslistTE_delayedclick()
int par = reslistTE_par;
- Rcl::Doc doc;
if (reslist_current != -1) {
QColor color("white");
reslistTE->setParagraphBackgroundColor(reslist_current+1, color);
@@ -508,16 +522,44 @@ void RecollMain::reslistTE_delayedclick()
return;
reslist_current = reldocnum;
+ startPreview(reslist_winfirst + reldocnum);
+}
- if (!rcldb->getDoc(reslist_winfirst + reldocnum, doc, 0)) {
+
+// Open a preview window for a given document
+// docnum is a db query index
+void RecollMain::startPreview(int docnum)
+{
+ Rcl::Doc doc;
+ if (!rcldb->getDoc(docnum, doc, 0)) {
QMessageBox::warning(0, "Recoll",
- QString("Can't retrieve document from database"));
+ QString("Cannot retrieve document info"
+ " from database"));
return;
}
// Go to the file system to retrieve / convert the document text
// for preview:
string fn = urltolocalpath(doc.url);
+ struct stat st;
+ if (stat(fn.c_str(), &st) < 0) {
+ QMessageBox::warning(0, "Recoll",
+ QString("Cannot access document file: ") +
+ fn.c_str());
+ return;
+ }
+
+ QStatusBar *stb = statusBar();
+ if (stb) {
+ char csz[20];
+ sprintf(csz, "%lu", (unsigned long)st.st_size);
+ string msg = string("Loading: ") + fn + " (size " + csz
+ + " bytes)";
+ stb->message(msg.c_str());
+ stb->repaint(false);
+ XFlush(qt_xdisplay());
+ }
+
Rcl::Doc fdoc;
FileInterner interner(fn, rclconfig, tmpdir);
if (interner.internfile(fdoc, doc.ipath) != FileInterner::FIDone) {
@@ -526,6 +568,10 @@ void RecollMain::reslistTE_delayedclick()
doc.mimetype.c_str());
return;
}
+
+ if (stb)
+ stb->clear();
+
list