|
a/src/qtgui/guiutils.cpp |
|
b/src/qtgui/guiutils.cpp |
|
... |
|
... |
314 |
// variable.
|
314 |
// variable.
|
315 |
// This are stored inside the dynamic configuration file (aka: history),
|
315 |
// This are stored inside the dynamic configuration file (aka: history),
|
316 |
// as they are likely to depend on RECOLL_CONFDIR.
|
316 |
// as they are likely to depend on RECOLL_CONFDIR.
|
317 |
if (writing) {
|
317 |
if (writing) {
|
318 |
g_dynconf->eraseAll(allEdbsSk);
|
318 |
g_dynconf->eraseAll(allEdbsSk);
|
319 |
for (list<string>::const_iterator it = prefs.allExtraDbs.begin();
|
319 |
for (const auto& dbdir : prefs.allExtraDbs) {
|
320 |
it != prefs.allExtraDbs.end(); it++) {
|
|
|
321 |
g_dynconf->enterString(allEdbsSk, *it);
|
320 |
g_dynconf->enterString(allEdbsSk, dbdir);
|
322 |
}
|
321 |
}
|
323 |
|
322 |
|
324 |
g_dynconf->eraseAll(actEdbsSk);
|
323 |
g_dynconf->eraseAll(actEdbsSk);
|
325 |
for (list<string>::const_iterator it = prefs.activeExtraDbs.begin();
|
324 |
for (const auto& dbdir : prefs.activeExtraDbs) {
|
326 |
it != prefs.activeExtraDbs.end(); it++) {
|
|
|
327 |
g_dynconf->enterString(actEdbsSk, *it);
|
325 |
g_dynconf->enterString(actEdbsSk, dbdir);
|
328 |
|
326 |
|
329 |
}
|
327 |
}
|
330 |
} else {
|
328 |
} else {
|
331 |
prefs.allExtraDbs = g_dynconf->getStringList(allEdbsSk);
|
329 |
prefs.allExtraDbs = g_dynconf->getStringEntries<vector>(allEdbsSk);
|
332 |
const char *cp;
|
330 |
const char *cp;
|
333 |
if ((cp = getenv("RECOLL_EXTRA_DBS")) != 0) {
|
331 |
if ((cp = getenv("RECOLL_EXTRA_DBS")) != 0) {
|
334 |
vector<string> dbl;
|
332 |
vector<string> dbl;
|
335 |
stringToTokens(cp, dbl, ":");
|
333 |
stringToTokens(cp, dbl, ":");
|
336 |
for (vector<string>::iterator dit = dbl.begin(); dit != dbl.end();
|
334 |
for (vector<string>::iterator dit = dbl.begin(); dit != dbl.end();
|
337 |
dit++) {
|
335 |
dit++) {
|
338 |
string dbdir = path_canon(*dit);
|
336 |
string dbdir = path_canon(*dit);
|
339 |
path_catslash(dbdir);
|
337 |
path_catslash(dbdir);
|
340 |
if (std::find(prefs.allExtraDbs.begin(),
|
338 |
if (std::find(prefs.allExtraDbs.begin(),
|
341 |
prefs.allExtraDbs.end(), dbdir) !=
|
339 |
prefs.allExtraDbs.end(), dbdir) !=
|
342 |
prefs.allExtraDbs.end())
|
340 |
prefs.allExtraDbs.end())
|
343 |
continue;
|
341 |
continue;
|
344 |
bool stripped;
|
342 |
bool stripped;
|
345 |
if (!Rcl::Db::testDbDir(dbdir, &stripped)) {
|
343 |
if (!Rcl::Db::testDbDir(dbdir, &stripped)) {
|
346 |
LOGERR("Not a xapian index: [" << (dbdir) << "]\n" );
|
344 |
LOGERR("Not a xapian index: [" << dbdir << "]\n");
|
347 |
continue;
|
345 |
continue;
|
348 |
}
|
346 |
}
|
349 |
if (stripped != o_index_stripchars) {
|
347 |
if (stripped != o_index_stripchars) {
|
350 |
LOGERR("Incompatible character stripping: [" << (dbdir) << "]\n" );
|
348 |
LOGERR("Incompatible character stripping: [" << dbdir <<
|
|
|
349 |
"]\n");
|
351 |
continue;
|
350 |
continue;
|
352 |
}
|
351 |
}
|
353 |
prefs.allExtraDbs.push_back(dbdir);
|
352 |
prefs.allExtraDbs.push_back(dbdir);
|
354 |
}
|
353 |
}
|
355 |
}
|
354 |
}
|
356 |
|
355 |
|
357 |
// Get the remembered "active external indexes":
|
356 |
// Get the remembered "active external indexes":
|
358 |
prefs.activeExtraDbs = g_dynconf->getStringList(actEdbsSk);
|
357 |
prefs.activeExtraDbs = g_dynconf->getStringEntries<vector>(actEdbsSk);
|
359 |
|
358 |
|
360 |
// Clean up the list: remove directories which are not
|
359 |
// Clean up the list: remove directories which are not
|
361 |
// actually there: useful for removable volumes.
|
360 |
// actually there: useful for removable volumes.
|
362 |
for (list<string>::iterator it = prefs.activeExtraDbs.begin();
|
361 |
for (auto it = prefs.activeExtraDbs.begin();
|
363 |
it != prefs.activeExtraDbs.end();) {
|
362 |
it != prefs.activeExtraDbs.end();) {
|
364 |
bool stripped;
|
363 |
bool stripped;
|
365 |
if (!Rcl::Db::testDbDir(*it, &stripped) ||
|
364 |
if (!Rcl::Db::testDbDir(*it, &stripped) ||
|
366 |
stripped != o_index_stripchars) {
|
365 |
stripped != o_index_stripchars) {
|
367 |
LOGINFO("Not a Xapian index or char stripping differs: [" << *it << "]\n" );
|
366 |
LOGINFO("Not a Xapian index or char stripping differs: [" <<
|
|
|
367 |
*it << "]\n");
|
368 |
it = prefs.activeExtraDbs.erase(it);
|
368 |
it = prefs.activeExtraDbs.erase(it);
|
369 |
} else {
|
369 |
} else {
|
370 |
it++;
|
370 |
it++;
|
371 |
}
|
371 |
}
|
372 |
}
|
372 |
}
|
|
... |
|
... |
416 |
const string asbdSk = "asearchSbd";
|
416 |
const string asbdSk = "asearchSbd";
|
417 |
if (writing) {
|
417 |
if (writing) {
|
418 |
while (prefs.asearchSubdirHist.size() > 20)
|
418 |
while (prefs.asearchSubdirHist.size() > 20)
|
419 |
prefs.asearchSubdirHist.pop_back();
|
419 |
prefs.asearchSubdirHist.pop_back();
|
420 |
g_dynconf->eraseAll(asbdSk);
|
420 |
g_dynconf->eraseAll(asbdSk);
|
421 |
for (QStringList::iterator it = prefs.asearchSubdirHist.begin();
|
421 |
for (const auto& qdbd : prefs.asearchSubdirHist) {
|
422 |
it != prefs.asearchSubdirHist.end(); it++) {
|
422 |
g_dynconf->enterString(asbdSk, qs2utf8s(qdbd));
|
423 |
g_dynconf->enterString(asbdSk, (const char *)((*it).toUtf8()));
|
|
|
424 |
}
|
423 |
}
|
425 |
} else {
|
424 |
} else {
|
426 |
list<string> tl = g_dynconf->getStringList(asbdSk);
|
425 |
vector<string> tl = g_dynconf->getStringEntries<vector>(asbdSk);
|
427 |
for (list<string>::iterator it = tl.begin(); it != tl.end(); it++)
|
426 |
for (const auto& dbd: tl) {
|
428 |
prefs.asearchSubdirHist.push_front(QString::fromUtf8(it->c_str()));
|
427 |
prefs.asearchSubdirHist.push_back(u8s2qs(dbd.c_str()));
|
|
|
428 |
}
|
429 |
}
|
429 |
}
|
430 |
if (!writing)
|
430 |
if (!writing)
|
431 |
havereadsettings = true;
|
431 |
havereadsettings = true;
|
432 |
}
|
432 |
}
|
433 |
|
433 |
|