GUI: perform up to date check before previewing a subdoc. This is for example to avoid showing the wrong message if a mail folder has been compacted

This commit is contained in:
Jean-Francois Dockes
2012-01-20 17:48:55 +01:00
parent 036937e8bf
commit 516863b5d6
6 changed files with 83 additions and 14 deletions
+36
View File
@@ -441,6 +441,42 @@ FileInterner::FileInterner(const Rcl::Doc& idoc, RclConfig *cnf,
}
}
#include "fsindexer.h"
bool FileInterner::makesig(const Rcl::Doc& idoc, string& sig)
{
if (idoc.url.empty()) {
LOGERR(("FileInterner::makesig:: no url!\n"));
return false;
}
string backend;
idoc.getmeta(Rcl::Doc::keybcknd, &backend);
if (backend.empty() || !backend.compare("FS")) {
if (idoc.url.find(cstr_fileu) != 0) {
LOGERR(("FileInterner: FS backend and non fs url: [%s]\n",
idoc.url.c_str()));
return false;
}
string fn = idoc.url.substr(7, string::npos);
struct stat st;
if (stat(fn.c_str(), &st) < 0) {
LOGERR(("FileInterner:: cannot access document file: [%s]\n",
fn.c_str()));
return false;
}
FsIndexer::makesig(&st, sig);
return true;
} else if (!backend.compare("BGL")) {
// Bgl sigs are empty
sig.clear();
return true;
} else {
LOGERR(("FileInterner:: unknown backend: [%s]\n", backend.c_str()));
return false;
}
return false;
}
FileInterner::~FileInterner()
{
tmpcleanup();
+5
View File
@@ -121,6 +121,11 @@ class FileInterner {
FileInterner(const Rcl::Doc& idoc, RclConfig *cnf, TempDir &td,
int flags);
/**
* Build sig for doc coming from rcldb. This is here because we know how
* to query the right backend */
static bool makesig(const Rcl::Doc& idoc, string& sig);
~FileInterner();
void setMissingStore(FIMissingStore *st)