Fix problems that occurred when multiple threads were trying to read/convert files at the same time (ie: indexing and previewing threads in the GUI calling internfile()). Either get rid of or lock-protect all shared data, eliminate misc initialization possible conflicts by using static initializers. Hopefuly closes issue #51
This commit is contained in:
@@ -48,8 +48,6 @@ using std::unique;
|
||||
#include "guiutils.h"
|
||||
#include "rclhelp.h"
|
||||
|
||||
extern RclConfig *rclconfig;
|
||||
|
||||
static const int initclausetypes[] = {1, 3, 0, 2, 5};
|
||||
static const unsigned int iclausescnt = sizeof(initclausetypes) / sizeof(int);
|
||||
static map<QString,QString> cat_translations;
|
||||
@@ -268,7 +266,7 @@ void AdvSearch::fillFileTypes()
|
||||
|
||||
QStringList ql;
|
||||
if (m_ignByCats == false) {
|
||||
list<string> types = rclconfig->getAllMimeTypes();
|
||||
list<string> types = theconfig->getAllMimeTypes();
|
||||
for (list<string>::iterator it = types.begin();
|
||||
it != types.end(); it++) {
|
||||
QString qs = QString::fromUtf8(it->c_str());
|
||||
@@ -277,7 +275,7 @@ void AdvSearch::fillFileTypes()
|
||||
}
|
||||
} else {
|
||||
list<string> cats;
|
||||
rclconfig->getMimeCategories(cats);
|
||||
theconfig->getMimeCategories(cats);
|
||||
for (list<string>::const_iterator it = cats.begin();
|
||||
it != cats.end(); it++) {
|
||||
map<QString, QString>::const_iterator it1;
|
||||
@@ -334,7 +332,7 @@ void AdvSearch::runSearch()
|
||||
cat = (const char *)qcat.toUtf8();
|
||||
}
|
||||
list<string> types;
|
||||
rclconfig->getMimeCatTypes(cat, types);
|
||||
theconfig->getMimeCatTypes(cat, types);
|
||||
for (list<string>::const_iterator it = types.begin();
|
||||
it != types.end(); it++) {
|
||||
sdata->addFiletype(*it);
|
||||
|
||||
@@ -49,8 +49,8 @@ using std::list;
|
||||
|
||||
namespace confgui {
|
||||
|
||||
const static int spacing = 2;
|
||||
const static int margin = 2;
|
||||
static const int spacing = 2;
|
||||
static const int margin = 2;
|
||||
|
||||
void ConfParamW::setValue(const QString& value)
|
||||
{
|
||||
|
||||
@@ -44,8 +44,8 @@ using std::list;
|
||||
#include "rclconfig.h"
|
||||
|
||||
namespace confgui {
|
||||
const static int spacing = 3;
|
||||
const static int margin = 3;
|
||||
static const int spacing = 3;
|
||||
static const int margin = 3;
|
||||
|
||||
ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
|
||||
: QDialog(parent), m_rclconf(config)
|
||||
@@ -84,6 +84,7 @@ void ConfIndexW::acceptChanges()
|
||||
delete m_conf;
|
||||
m_conf = 0;
|
||||
m_rclconf->updateMainConfig();
|
||||
snapshotConfig();
|
||||
|
||||
if (startIndexingAfterConfig) {
|
||||
startIndexingAfterConfig = 0;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "smallut.h"
|
||||
#include "rclinit.h"
|
||||
#include "pathut.h"
|
||||
#include "recoll.h"
|
||||
|
||||
static int stopindexing;
|
||||
static int startindexing;
|
||||
@@ -60,7 +61,6 @@ class IdxThread : public QThread , public DbIxStatusUpdater {
|
||||
// Maintain a copy/snapshot of idx status
|
||||
DbIxStatus m_statusSnap;
|
||||
bool m_interrupted;
|
||||
const RclConfig *cnf;
|
||||
};
|
||||
|
||||
void IdxThread::run()
|
||||
@@ -76,7 +76,11 @@ void IdxThread::run()
|
||||
indexingstatus = IDXTS_NULL;
|
||||
// We make a private snapshot of the config: setKeydir changes
|
||||
// it during indexing and it may be updated by the main thread.
|
||||
RclConfig *myconf = new RclConfig(*cnf);
|
||||
RclConfig *myconf;
|
||||
{
|
||||
PTMutexLocker locker(thestableconfiglock);
|
||||
myconf = new RclConfig(*thestableconfig);
|
||||
}
|
||||
int loglevel;
|
||||
myconf->setKeyDir("");
|
||||
myconf->getConfParam("loglevel", &loglevel);
|
||||
@@ -117,9 +121,8 @@ static IdxThread idxthread;
|
||||
|
||||
// Functions called by the main thread
|
||||
|
||||
void start_idxthread(const RclConfig& cnf)
|
||||
void start_idxthread()
|
||||
{
|
||||
idxthread.cnf = &cnf;
|
||||
idxthread.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
#include <string>
|
||||
#include "indexer.h"
|
||||
|
||||
class RclConfig;
|
||||
|
||||
// These two deal with starting / stopping the thread itself, not
|
||||
// indexing sessions.
|
||||
extern void start_idxthread(const RclConfig& cnf);
|
||||
// cnf will be cloned each time we start an indexing pass. The pointer must
|
||||
// stay valid for the whole program duration.
|
||||
extern void start_idxthread();
|
||||
extern void stop_idxthread();
|
||||
|
||||
// Use these to to request action from thread
|
||||
|
||||
+23
-12
@@ -47,7 +47,16 @@
|
||||
#include "smallut.h"
|
||||
#include "recollq.h"
|
||||
|
||||
RclConfig *rclconfig;
|
||||
RclConfig *theconfig;
|
||||
RclConfig *thestableconfig;
|
||||
PTMutexInit thestableconfiglock;
|
||||
|
||||
void snapshotConfig()
|
||||
{
|
||||
PTMutexLocker locker(thestableconfiglock);
|
||||
thestableconfig = new RclConfig(*theconfig);
|
||||
}
|
||||
|
||||
Rcl::Db *rcldb;
|
||||
#ifdef RCL_USE_ASPELL
|
||||
Aspell *aspell;
|
||||
@@ -80,7 +89,7 @@ bool maybeOpenDb(string &reason, bool force)
|
||||
}
|
||||
if (!rcldb->isopen() && !rcldb->open(Rcl::Db::DbRO)) {
|
||||
reason = "Could not open database in " +
|
||||
rclconfig->getDbDir() + " wait for indexing to complete?";
|
||||
theconfig->getDbDir() + " wait for indexing to complete?";
|
||||
return false;
|
||||
}
|
||||
rcldb->setAbstractParams(-1, prefs.syntAbsLen, prefs.syntAbsCtx);
|
||||
@@ -104,7 +113,8 @@ static void recollCleanup()
|
||||
rwSettings(true);
|
||||
LOGDEB2(("recollCleanup: closing database\n"));
|
||||
deleteZ(rcldb);
|
||||
deleteZ(rclconfig);
|
||||
deleteZ(theconfig);
|
||||
deleteZ(thestableconfig);
|
||||
#ifdef RCL_USE_ASPELL
|
||||
deleteZ(aspell);
|
||||
#endif
|
||||
@@ -165,7 +175,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-t")) {
|
||||
exit(recollq(&rclconfig, argc, argv));
|
||||
exit(recollq(&theconfig, argc, argv));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,17 +228,18 @@ int main(int argc, char **argv)
|
||||
app.installTranslator( &qt );
|
||||
|
||||
string reason;
|
||||
rclconfig = recollinit(recollCleanup, sigcleanup, reason, &a_config);
|
||||
if (!rclconfig || !rclconfig->ok()) {
|
||||
theconfig = recollinit(recollCleanup, sigcleanup, reason, &a_config);
|
||||
if (!theconfig || !theconfig->ok()) {
|
||||
QString msg = "Configuration problem: ";
|
||||
msg += QString::fromUtf8(reason.c_str());
|
||||
QMessageBox::critical(0, "Recoll", msg);
|
||||
exit(1);
|
||||
}
|
||||
snapshotConfig();
|
||||
// fprintf(stderr, "recollinit done\n");
|
||||
|
||||
// Translations for Recoll
|
||||
string translatdir = path_cat(rclconfig->getDatadir(), "translations");
|
||||
string translatdir = path_cat(theconfig->getDatadir(), "translations");
|
||||
QTranslator translator(0);
|
||||
translator.load( QString("recoll_") + slang, translatdir.c_str() );
|
||||
app.installTranslator( &translator );
|
||||
@@ -236,7 +247,7 @@ int main(int argc, char **argv)
|
||||
// fprintf(stderr, "Translations installed\n");
|
||||
|
||||
#ifdef RCL_USE_ASPELL
|
||||
aspell = new Aspell(rclconfig);
|
||||
aspell = new Aspell(theconfig);
|
||||
aspell->init(reason);
|
||||
if (!aspell || !aspell->ok()) {
|
||||
LOGDEB(("Aspell speller creation failed %s\n", reason.c_str()));
|
||||
@@ -244,7 +255,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
string historyfile = path_cat(rclconfig->getConfDir(), "history");
|
||||
string historyfile = path_cat(theconfig->getConfDir(), "history");
|
||||
g_dynconf = new RclDynConf(historyfile);
|
||||
if (!g_dynconf || !g_dynconf->ok()) {
|
||||
QString msg = app.translate("Main", "Configuration problem (dynconf");
|
||||
@@ -266,7 +277,7 @@ int main(int argc, char **argv)
|
||||
mainWindow->resize(s);
|
||||
}
|
||||
|
||||
string dbdir = rclconfig->getDbDir();
|
||||
string dbdir = theconfig->getDbDir();
|
||||
if (dbdir.empty()) {
|
||||
QMessageBox::critical(0, "Recoll",
|
||||
app.translate("Main",
|
||||
@@ -274,7 +285,7 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
rcldb = new Rcl::Db(rclconfig);
|
||||
rcldb = new Rcl::Db(theconfig);
|
||||
|
||||
mainWindow->show();
|
||||
QTimer::singleShot(0, mainWindow, SLOT(initDbOpen()));
|
||||
@@ -286,7 +297,7 @@ int main(int argc, char **argv)
|
||||
|
||||
// Start the indexing thread. It will immediately go to sleep waiting for
|
||||
// something to do.
|
||||
start_idxthread(*rclconfig);
|
||||
start_idxthread();
|
||||
|
||||
mainWindow->sSearch->searchTypCMB->setCurrentIndex(prefs.ssearchTyp);
|
||||
mainWindow->sSearch->searchTypeChanged(prefs.ssearchTyp);
|
||||
|
||||
+21
-13
@@ -518,7 +518,7 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
|
||||
}
|
||||
LOGDEB(("Doc.url: [%s]\n", doc.url.c_str()));
|
||||
string url;
|
||||
printableUrl(rclconfig->getDefCharset(), doc.url, url);
|
||||
printableUrl(theconfig->getDefCharset(), doc.url, url);
|
||||
string tiptxt = url + string("\n");
|
||||
tiptxt += doc.mimetype + " " + string(datebuf) + "\n";
|
||||
if (meta_it != doc.meta.end() && !meta_it->second.empty())
|
||||
@@ -538,6 +538,11 @@ bool Preview::makeDocCurrent(const Rcl::Doc& doc, int docnum, bool sametab)
|
||||
{
|
||||
LOGDEB(("Preview::makeDocCurrent: %s\n", doc.url.c_str()));
|
||||
|
||||
if (m_loading) {
|
||||
LOGERR(("Already loading\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check if we already have this page */
|
||||
for (int i = 0; i < pvTab->count(); i++) {
|
||||
QWidget *tw = pvTab->widget(i);
|
||||
@@ -621,9 +626,10 @@ class LoadThread : public QThread {
|
||||
|
||||
// QMessageBox::critical(0, "Recoll", Preview::tr("File does not exist"));
|
||||
|
||||
FileInterner interner(idoc, rclconfig, tmpdir,
|
||||
FileInterner interner(idoc, theconfig, tmpdir,
|
||||
FileInterner::FIF_forPreview);
|
||||
|
||||
FIMissingStore mst;
|
||||
interner.setMissingStore(&mst);
|
||||
// We don't set the interner's target mtype to html because we
|
||||
// do want the html filter to do its work: we won't use the
|
||||
// text, but we need the conversion to utf-8
|
||||
@@ -647,7 +653,7 @@ class LoadThread : public QThread {
|
||||
}
|
||||
} else {
|
||||
out.mimetype = interner.getMimetype();
|
||||
interner.getMissingExternal(missing);
|
||||
interner.getMissingExternal(&mst, missing);
|
||||
*statusp = -1;
|
||||
}
|
||||
} catch (CancelExcept) {
|
||||
@@ -706,10 +712,6 @@ public:
|
||||
bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
||||
{
|
||||
LOGDEB1(("PreviewTextEdit::loadDocInCurrentTab()\n"));
|
||||
if (m_loading) {
|
||||
LOGERR(("ALready loading\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadGuard guard(&m_loading);
|
||||
CancelCheck::instance().setCancel(false);
|
||||
@@ -757,14 +759,20 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
||||
if (CancelCheck::instance().cancelState())
|
||||
return false;
|
||||
if (status != 0) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("Can't turn doc into internal "
|
||||
"representation for ") +
|
||||
fdoc.mimetype.c_str());
|
||||
QString explain;
|
||||
if (!lthr.missing.empty()) {
|
||||
explain = QString::fromAscii("<br>") +
|
||||
tr("Missing helper program: ") +
|
||||
QString::fromLocal8Bit(lthr.missing.c_str());
|
||||
}
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("Can't turn doc into internal "
|
||||
"representation for ") +
|
||||
fdoc.mimetype.c_str() + explain);
|
||||
return false;
|
||||
}
|
||||
// Reset config just in case.
|
||||
rclconfig->setKeyDir("");
|
||||
theconfig->setKeyDir("");
|
||||
|
||||
// Create preview text: highlight search terms
|
||||
// We don't do the highlighting for very big texts: too long. We
|
||||
|
||||
+25
-25
@@ -97,6 +97,7 @@ void RclMain::init()
|
||||
spellform = 0;
|
||||
m_idxStatusAck = false;
|
||||
periodictimer = new QTimer(this);
|
||||
m_periodicToggle = 0;
|
||||
|
||||
// At least some versions of qt4 don't display the status bar if
|
||||
// it's not created here.
|
||||
@@ -124,7 +125,7 @@ void RclMain::init()
|
||||
// instead
|
||||
string slangs;
|
||||
list<string> langs;
|
||||
if (rclconfig->getConfParam("indexstemminglanguages", slangs)) {
|
||||
if (theconfig->getConfParam("indexstemminglanguages", slangs)) {
|
||||
stringToStrings(slangs, langs);
|
||||
} else {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
@@ -166,7 +167,7 @@ void RclMain::init()
|
||||
connect(bgrp, SIGNAL(buttonClicked(int)), this, SLOT(catgFilter(int)));
|
||||
allRDB->setChecked(true);
|
||||
list<string> cats;
|
||||
rclconfig->getMimeCategories(cats);
|
||||
theconfig->getMimeCategories(cats);
|
||||
// Text for button 0 is not used. Next statement just avoids unused
|
||||
// variable compiler warning for catg_strings
|
||||
m_catgbutvec.push_back(catg_strings[0]);
|
||||
@@ -350,7 +351,7 @@ void RclMain::initDbOpen()
|
||||
question
|
||||
(this, "Recoll",
|
||||
qApp->translate("Main", "Could not open database in ") +
|
||||
QString::fromLocal8Bit(rclconfig->getDbDir().c_str()) +
|
||||
QString::fromLocal8Bit(theconfig->getDbDir().c_str()) +
|
||||
qApp->translate("Main",
|
||||
".\n"
|
||||
"Click Cancel if you want to edit the configuration file before indexing starts, or Ok to let it proceed."),
|
||||
@@ -492,7 +493,6 @@ void RclMain::fileExit()
|
||||
// indexing thread and a possible need to exit
|
||||
void RclMain::periodic100()
|
||||
{
|
||||
static int toggle = 0;
|
||||
// Check if indexing thread done
|
||||
if (idxthread_getStatus() != IDXTS_NULL) {
|
||||
// Indexing is stopped
|
||||
@@ -527,7 +527,7 @@ void RclMain::periodic100()
|
||||
fileToggleIndexingAction->setEnabled(TRUE);
|
||||
periodictimer->setInterval(100);
|
||||
// The toggle thing is for the status to flash
|
||||
if (toggle < 9) {
|
||||
if (m_periodicToggle < 9) {
|
||||
QString msg = tr("Indexing in progress: ");
|
||||
DbIxStatus status = idxthread_idxStatus();
|
||||
QString phs;
|
||||
@@ -548,17 +548,17 @@ void RclMain::periodic100()
|
||||
msg += QString::fromAscii(cnts) + " ";
|
||||
}
|
||||
string mf;int ecnt = 0;
|
||||
string fcharset = rclconfig->getDefCharset(true);
|
||||
string fcharset = theconfig->getDefCharset(true);
|
||||
if (!transcode(status.fn, mf, fcharset, "UTF-8", &ecnt) || ecnt) {
|
||||
mf = url_encode(status.fn, 0);
|
||||
}
|
||||
msg += QString::fromUtf8(mf.c_str());
|
||||
statusBar()->showMessage(msg, 4000);
|
||||
} else if (toggle == 9) {
|
||||
} else if (m_periodicToggle == 9) {
|
||||
statusBar()->showMessage("");
|
||||
}
|
||||
if (++toggle >= 10)
|
||||
toggle = 0;
|
||||
if (++m_periodicToggle >= 10)
|
||||
m_periodicToggle = 0;
|
||||
}
|
||||
if (recollNeedsExit)
|
||||
fileExit();
|
||||
@@ -602,7 +602,7 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata)
|
||||
|
||||
string stemLang = (const char *)prefs.queryStemLang.toAscii();
|
||||
if (stemLang == "ALL") {
|
||||
rclconfig->getConfParam("indexstemminglanguages", stemLang);
|
||||
theconfig->getConfParam("indexstemminglanguages", stemLang);
|
||||
}
|
||||
sdata->setStemlang(stemLang);
|
||||
|
||||
@@ -692,7 +692,7 @@ void RclMain::showIndexConfig()
|
||||
{
|
||||
LOGDEB(("showIndexConfig()\n"));
|
||||
if (indexConfig == 0) {
|
||||
indexConfig = new ConfIndexW(0, rclconfig);
|
||||
indexConfig = new ConfIndexW(0, theconfig);
|
||||
connect(new QShortcut(quitKeySeq, indexConfig), SIGNAL (activated()),
|
||||
this, SLOT (fileExit()));
|
||||
} else {
|
||||
@@ -744,7 +744,7 @@ void RclMain::showAboutDialog()
|
||||
|
||||
void RclMain::showMissingHelpers()
|
||||
{
|
||||
string miss = rclconfig->getMissingHelperDesc();
|
||||
string miss = theconfig->getMissingHelperDesc();
|
||||
QString msg = tr("External applications/commands needed and not found "
|
||||
"for indexing your file types:\n\n");
|
||||
if (!miss.empty()) {
|
||||
@@ -984,7 +984,7 @@ void RclMain::saveDocToFile(Rcl::Doc doc)
|
||||
);
|
||||
string tofile((const char *)s.toLocal8Bit());
|
||||
TempFile temp; // not used
|
||||
if (!FileInterner::idocToFile(temp, tofile, rclconfig, doc)) {
|
||||
if (!FileInterner::idocToFile(temp, tofile, theconfig, doc)) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("Cannot extract document or create "
|
||||
"temporary file"));
|
||||
@@ -1034,13 +1034,13 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
||||
// Look for appropriate viewer
|
||||
string cmdplusattr;
|
||||
if (prefs.useDesktopOpen) {
|
||||
cmdplusattr = rclconfig->getMimeViewerDef("application/x-all", "");
|
||||
cmdplusattr = theconfig->getMimeViewerDef("application/x-all", "");
|
||||
} else {
|
||||
string apptag;
|
||||
map<string,string>::const_iterator it;
|
||||
if ((it = doc.meta.find(Rcl::Doc::keyapptg)) != doc.meta.end())
|
||||
apptag = it->second;
|
||||
cmdplusattr = rclconfig->getMimeViewerDef(doc.mimetype, apptag);
|
||||
cmdplusattr = theconfig->getMimeViewerDef(doc.mimetype, apptag);
|
||||
}
|
||||
|
||||
if (cmdplusattr.empty()) {
|
||||
@@ -1053,7 +1053,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
||||
// Extract possible viewer attributes
|
||||
ConfSimple attrs;
|
||||
string cmd;
|
||||
rclconfig->valueSplitAttributes(cmdplusattr, cmd, attrs);
|
||||
theconfig->valueSplitAttributes(cmdplusattr, cmd, attrs);
|
||||
bool ignoreipath = false;
|
||||
if (attrs.get("ignoreipath", cmdplusattr))
|
||||
ignoreipath = stringToBool(cmdplusattr);
|
||||
@@ -1073,7 +1073,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
||||
// directory
|
||||
string cmdpath;
|
||||
if (!ExecCmd::which(lcmd.front(), cmdpath)) {
|
||||
cmdpath = rclconfig->findFilter(lcmd.front());
|
||||
cmdpath = theconfig->findFilter(lcmd.front());
|
||||
// findFilter returns its input param if the filter is not in
|
||||
// the normal places. As we already looked in the path, we
|
||||
// have no use for a simple command name here (as opposed to
|
||||
@@ -1128,10 +1128,10 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
||||
|
||||
// If the command wants a file but this is not a file url, or
|
||||
// there is an ipath that it won't understand, we need a temp file:
|
||||
rclconfig->setKeyDir(path_getfather(fn));
|
||||
theconfig->setKeyDir(path_getfather(fn));
|
||||
if ((wantsfile && fn.empty()) || (!wantsipath && !doc.ipath.empty())) {
|
||||
TempFile temp;
|
||||
if (!FileInterner::idocToFile(temp, string(), rclconfig, doc)) {
|
||||
if (!FileInterner::idocToFile(temp, string(), theconfig, doc)) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("Cannot extract document or create "
|
||||
"temporary file"));
|
||||
@@ -1145,7 +1145,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
||||
|
||||
// If using an actual file, check that it exists, and if it is
|
||||
// compressed, we may need an uncompressed version
|
||||
if (!fn.empty() && rclconfig->mimeViewerNeedsUncomp(doc.mimetype)) {
|
||||
if (!fn.empty() && theconfig->mimeViewerNeedsUncomp(doc.mimetype)) {
|
||||
if (access(fn.c_str(), R_OK) != 0) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("Can't access file: ") +
|
||||
@@ -1153,8 +1153,8 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
||||
return;
|
||||
}
|
||||
TempFile temp;
|
||||
if (FileInterner::isCompressed(fn, rclconfig)) {
|
||||
if (!FileInterner::maybeUncompressToTemp(temp, fn, rclconfig,
|
||||
if (FileInterner::isCompressed(fn, theconfig)) {
|
||||
if (!FileInterner::maybeUncompressToTemp(temp, fn, theconfig,
|
||||
doc)) {
|
||||
QMessageBox::warning(0, "Recoll",
|
||||
tr("Can't uncompress file: ") +
|
||||
@@ -1208,7 +1208,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
|
||||
ncmd += " &";
|
||||
QStatusBar *stb = statusBar();
|
||||
if (stb) {
|
||||
string fcharset = rclconfig->getDefCharset(true);
|
||||
string fcharset = theconfig->getDefCharset(true);
|
||||
string prcmd;
|
||||
transcode(ncmd, prcmd, fcharset, "UTF-8");
|
||||
QString msg = tr("Executing: [") +
|
||||
@@ -1234,7 +1234,7 @@ void RclMain::startManual(const string& index)
|
||||
{
|
||||
Rcl::Doc doc;
|
||||
doc.url = "file://";
|
||||
doc.url = path_cat(doc.url, rclconfig->getDatadir());
|
||||
doc.url = path_cat(doc.url, theconfig->getDatadir());
|
||||
doc.url = path_cat(doc.url, "doc");
|
||||
doc.url = path_cat(doc.url, "usermanual.html");
|
||||
LOGDEB(("RclMain::startManual: help index is %s\n",
|
||||
@@ -1382,7 +1382,7 @@ void RclMain::catgFilter(int id)
|
||||
if (id != 0) {
|
||||
string catg = m_catgbutvec[id];
|
||||
list<string> tps;
|
||||
rclconfig->getMimeCatTypes(catg, tps);
|
||||
theconfig->getMimeCatTypes(catg, tps);
|
||||
for (list<string>::const_iterator it = tps.begin();
|
||||
it != tps.end(); it++)
|
||||
m_filtspec.orCrit(DocSeqFiltSpec::DSFS_MIMETYPE, *it);
|
||||
|
||||
@@ -133,7 +133,8 @@ private:
|
||||
bool m_sortspecnochange;
|
||||
DocSeqSortSpec m_sortspec;
|
||||
RefCntr<DocSequence> m_source;
|
||||
|
||||
int m_periodicToggle;
|
||||
|
||||
virtual void init();
|
||||
virtual void previewPrevOrNextInTab(Preview *, int sid, int docnum,
|
||||
bool next);
|
||||
|
||||
+6
-1
@@ -21,6 +21,7 @@
|
||||
#include "rclconfig.h"
|
||||
#include "rcldb.h"
|
||||
#include "idxthread.h"
|
||||
#include "ptmutex.h"
|
||||
|
||||
// Misc declarations in need of sharing between the UI files
|
||||
|
||||
@@ -30,7 +31,11 @@ extern bool maybeOpenDb(std::string &reason, bool force = true);
|
||||
/** Retrieve configured stemming languages */
|
||||
bool getStemLangs(list<string>& langs);
|
||||
|
||||
extern RclConfig *rclconfig;
|
||||
extern RclConfig *theconfig;
|
||||
extern RclConfig *thestableconfig;
|
||||
extern PTMutexInit thestableconfiglock;
|
||||
extern void snapshotConfig();
|
||||
|
||||
extern Rcl::Db *rcldb;
|
||||
extern int recollNeedsExit;
|
||||
extern int startIndexingAfterConfig; // 1st startup
|
||||
|
||||
@@ -158,7 +158,7 @@ string QtGuiResListPager::pageTop()
|
||||
string QtGuiResListPager::iconPath(const string& mtype)
|
||||
{
|
||||
string iconpath;
|
||||
rclconfig->getMimeIconName(mtype, &iconpath);
|
||||
theconfig->getMimeIconName(mtype, &iconpath);
|
||||
return iconpath;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void QtGuiResListPager::suggest(const vector<string>uterms, vector<string>&sugg)
|
||||
sugg.clear();
|
||||
#ifdef RCL_USE_ASPELL
|
||||
bool noaspell = false;
|
||||
rclconfig->getConfParam("noaspell", &noaspell);
|
||||
theconfig->getConfParam("noaspell", &noaspell);
|
||||
if (noaspell)
|
||||
return;
|
||||
if (!aspell) {
|
||||
@@ -524,7 +524,7 @@ void ResList::displayPage()
|
||||
{
|
||||
m_pageParaToReldocnums.clear();
|
||||
clear();
|
||||
m_pager->displayPage(rclconfig);
|
||||
m_pager->displayPage(theconfig);
|
||||
LOGDEB0(("ResList::resultPageNext: hasNext %d hasPrev %d\n",
|
||||
m_pager->hasPrev(), m_pager->hasNext()));
|
||||
emit prevPageAvailable(m_pager->hasPrev());
|
||||
|
||||
@@ -102,7 +102,7 @@ const string& ResTablePager::parFormat()
|
||||
string ResTablePager::iconPath(const string& mtype)
|
||||
{
|
||||
string iconpath;
|
||||
rclconfig->getMimeIconName(mtype, &iconpath);
|
||||
theconfig->getMimeIconName(mtype, &iconpath);
|
||||
return iconpath;
|
||||
}
|
||||
|
||||
@@ -229,8 +229,8 @@ RecollModel::RecollModel(const QStringList fields, QObject *parent)
|
||||
// Add dynamic "stored" fields to the full column list. This
|
||||
// could be protected to be done only once, but it's no real
|
||||
// problem
|
||||
if (rclconfig) {
|
||||
const set<string>& stored = rclconfig->getStoredFields();
|
||||
if (theconfig) {
|
||||
const set<string>& stored = theconfig->getStoredFields();
|
||||
for (set<string>::const_iterator it = stored.begin();
|
||||
it != stored.end(); it++) {
|
||||
if (o_displayableFields.find(*it) == o_displayableFields.end()) {
|
||||
@@ -535,7 +535,7 @@ void ResTable::onTableView_currentChanged(const QModelIndex& index)
|
||||
m_detail->clear();
|
||||
m_detaildocnum = index.row();
|
||||
m_detaildoc = doc;
|
||||
m_pager->displayDoc(rclconfig, index.row(), doc, m_model->m_hdata);
|
||||
m_pager->displayDoc(theconfig, index.row(), doc, m_model->m_hdata);
|
||||
} else {
|
||||
m_detaildocnum = -1;
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ void SearchClauseW::languageChange()
|
||||
// sTpCMB->insertItem(tr("Complex clause"));//6
|
||||
|
||||
fldCMB->addItem(tr("In field"));
|
||||
if (rclconfig) {
|
||||
set<string> fields = rclconfig->getIndexedFields();
|
||||
if (theconfig) {
|
||||
set<string> fields = theconfig->getIndexedFields();
|
||||
for (set<string>::const_iterator it = fields.begin();
|
||||
it != fields.end(); it++) {
|
||||
// Some fields don't make sense here
|
||||
|
||||
@@ -50,7 +50,7 @@ void SpellW::init()
|
||||
/*2*/expTypeCMB->addItem(tr("Stem expansion"));
|
||||
#ifdef RCL_USE_ASPELL
|
||||
bool noaspell = false;
|
||||
rclconfig->getConfParam("noaspell", &noaspell);
|
||||
theconfig->getConfParam("noaspell", &noaspell);
|
||||
if (!noaspell)
|
||||
/*3*/expTypeCMB->addItem(tr("Spelling/Phonetic"));
|
||||
#endif
|
||||
|
||||
@@ -132,9 +132,9 @@ void SSearch::startSimpleSearch()
|
||||
if (tp == SST_LANG) {
|
||||
string reason;
|
||||
if (prefs.autoSuffsEnable)
|
||||
sdata = wasaStringToRcl(rclconfig, u8, reason, (const char *)prefs.autoSuffs.toUtf8());
|
||||
sdata = wasaStringToRcl(theconfig, u8, reason, (const char *)prefs.autoSuffs.toUtf8());
|
||||
else
|
||||
sdata = wasaStringToRcl(rclconfig, u8, reason);
|
||||
sdata = wasaStringToRcl(theconfig, u8, reason);
|
||||
if (sdata == 0) {
|
||||
QMessageBox::warning(0, "Recoll", tr("Bad query string") + ": " +
|
||||
QString::fromAscii(reason.c_str()));
|
||||
@@ -280,7 +280,7 @@ void SSearch::completion()
|
||||
Rcl::TermMatchResult tmres;
|
||||
string stemLang = (const char *)prefs.queryStemLang.toAscii();
|
||||
if (stemLang == "ALL") {
|
||||
rclconfig->getConfParam("indexstemminglanguages", stemLang);
|
||||
theconfig->getConfParam("indexstemminglanguages", stemLang);
|
||||
}
|
||||
if (!rcldb->termMatch(Rcl::Db::ET_WILD, stemLang, s, tmres, max) ||
|
||||
tmres.entries.size() == 0) {
|
||||
|
||||
@@ -372,7 +372,7 @@ void UIPrefsDialog::addExtraDbPB_clicked()
|
||||
}
|
||||
struct stat st1, st2;
|
||||
stat(dbdir.c_str(), &st1);
|
||||
string rcldbdir = rclconfig->getDbDir();
|
||||
string rcldbdir = theconfig->getDbDir();
|
||||
stat(rcldbdir.c_str(), &st2);
|
||||
path_catslash(rcldbdir);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ void ViewAction::fillLists()
|
||||
actionsLV->clear();
|
||||
actionsLV->verticalHeader()->setDefaultSectionSize(20);
|
||||
vector<pair<string, string> > defs;
|
||||
rclconfig->getMimeViewerDefs(defs);
|
||||
theconfig->getMimeViewerDefs(defs);
|
||||
actionsLV->setRowCount(defs.size());
|
||||
int row = 0;
|
||||
for (vector<pair<string, string> >::const_iterator it = defs.begin();
|
||||
@@ -128,7 +128,7 @@ void ViewAction::editActions()
|
||||
string sact = (const char *)newaction.toLocal8Bit();
|
||||
for (list<string>::const_iterator it = mtypes.begin();
|
||||
it != mtypes.end(); it++) {
|
||||
rclconfig->setMimeViewerDef(*it, sact);
|
||||
theconfig->setMimeViewerDef(*it, sact);
|
||||
}
|
||||
fillLists();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user