avoid spurious warning popups about stemming languages when index does not exist
This commit is contained in:
parent
6be1be6b6d
commit
4071618548
@ -128,15 +128,29 @@ bool maybeOpenDb(string &reason, bool force, bool *maindberror)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getStemLangs(vector<string>& langs)
|
// Retrieve the list currently active stemming languages. We try to
|
||||||
|
// get this from the db, as some may have been added from recollindex
|
||||||
|
// without changing the config. If this fails, use the config. This is
|
||||||
|
// used for setting up choice menus, not updating the configuration.
|
||||||
|
bool getStemLangs(vector<string>& vlangs)
|
||||||
{
|
{
|
||||||
|
// Try from db
|
||||||
string reason;
|
string reason;
|
||||||
if (!maybeOpenDb(reason)) {
|
if (maybeOpenDb(reason)) {
|
||||||
LOGERR(("getStemLangs: %s\n", reason.c_str()));
|
vlangs = rcldb->getStemLangs();
|
||||||
|
LOGDEB0(("getStemLangs: from index: %s\n",
|
||||||
|
stringsToString(vlangs).c_str()));
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// Cant get the langs from the index. Maybe it just does not
|
||||||
|
// exist yet. So get them from the config
|
||||||
|
string slangs;
|
||||||
|
if (theconfig->getConfParam("indexstemminglanguages", slangs)) {
|
||||||
|
stringToStrings(slangs, vlangs);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
langs = rcldb->getStemLangs();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void recollCleanup()
|
static void recollCleanup()
|
||||||
|
|||||||
@ -137,17 +137,14 @@ void RclMain::init()
|
|||||||
// db not open yet (the case where it does not even exist makes
|
// db not open yet (the case where it does not even exist makes
|
||||||
// things complicated). So get the languages from the config
|
// things complicated). So get the languages from the config
|
||||||
// instead
|
// instead
|
||||||
string slangs;
|
vector<string> langs;
|
||||||
list<string> langs;
|
if (!getStemLangs(langs)) {
|
||||||
if (theconfig->getConfParam("indexstemminglanguages", slangs)) {
|
|
||||||
stringToStrings(slangs, langs);
|
|
||||||
} else {
|
|
||||||
QMessageBox::warning(0, "Recoll",
|
QMessageBox::warning(0, "Recoll",
|
||||||
tr("error retrieving stemming languages"));
|
tr("error retrieving stemming languages"));
|
||||||
}
|
}
|
||||||
QAction *curid = prefs.queryStemLang == "ALL" ? m_idAllStem : m_idNoStem;
|
QAction *curid = prefs.queryStemLang == "ALL" ? m_idAllStem : m_idNoStem;
|
||||||
QAction *id;
|
QAction *id;
|
||||||
for (list<string>::const_iterator it = langs.begin();
|
for (vector<string>::const_iterator it = langs.begin();
|
||||||
it != langs.end(); it++) {
|
it != langs.end(); it++) {
|
||||||
QString qlang = QString::fromAscii(it->c_str(), it->length());
|
QString qlang = QString::fromAscii(it->c_str(), it->length());
|
||||||
id = preferencesMenu->addAction(qlang);
|
id = preferencesMenu->addAction(qlang);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user