GUI: try to be more helpful when a main index open error occurs

This commit is contained in:
Jean-Francois Dockes 2022-06-02 12:08:32 +02:00
parent 8bd1494fd3
commit 4e8cc666f0
3 changed files with 16 additions and 10 deletions

View File

@ -115,8 +115,7 @@ bool maybeOpenDb(string &reason, bool force, bool *maindberror)
if (!rcldb->isopen() && !rcldb->open(Rcl::Db::DbRO, &error)) {
reason = "Could not open database";
if (maindberror) {
reason += " in " + theconfig->getDbDir() +
" wait for indexing to complete?";
reason += " in " + theconfig->getDbDir() + " : " + rcldb->getReason();
*maindberror = (error == Rcl::Db::DbOpenMainDb) ? true : false;
}
return false;

View File

@ -572,13 +572,20 @@ void RclMain::initDbOpen()
if (!maybeOpenDb(reason, true, &maindberror)) {
nodb = true;
if (maindberror) {
FirstIdxDialog fidia(this);
connect(fidia.idxconfCLB, SIGNAL(clicked()), this, SLOT(execIndexConfig()));
connect(fidia.idxschedCLB, SIGNAL(clicked()), this, SLOT(execIndexSched()));
connect(fidia.runidxPB, SIGNAL(clicked()), this, SLOT(rebuildIndex()));
fidia.exec();
// Don't open adv search or run cmd line search in this case.
return;
if (theconfig && !path_exists(theconfig->getDbDir())) {
FirstIdxDialog fidia(this);
connect(fidia.idxconfCLB, SIGNAL(clicked()), this, SLOT(execIndexConfig()));
connect(fidia.idxschedCLB, SIGNAL(clicked()), this, SLOT(execIndexSched()));
connect(fidia.runidxPB, SIGNAL(clicked()), this, SLOT(rebuildIndex()));
fidia.exec();
// Don't open adv search or run cmd line search in this case.
return;
} else {
QMessageBox::warning(
0, "Recoll", tr("Main index open error: ") + u8s2qs(reason) +
tr(". The index may be corrupted. Maybe try to run xapian-check or "
"rebuild the index ?."));
}
} else {
QMessageBox::warning(0, "Recoll", tr("Could not open external index. Db not "
"open. Check external indexes list."));

View File

@ -529,7 +529,7 @@ bool Db::dirlist(int depth, std::string& root, std::vector<std::string>& dirs)
break;
}
if (!m_reason.empty()) {
LOGERR("Db::dirlist: " << m_reason << "\n");
LOGERR("Db::dirlist: exception while accessing index: " << m_reason << "\n");
return false;
}