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)) { if (!rcldb->isopen() && !rcldb->open(Rcl::Db::DbRO, &error)) {
reason = "Could not open database"; reason = "Could not open database";
if (maindberror) { if (maindberror) {
reason += " in " + theconfig->getDbDir() + reason += " in " + theconfig->getDbDir() + " : " + rcldb->getReason();
" wait for indexing to complete?";
*maindberror = (error == Rcl::Db::DbOpenMainDb) ? true : false; *maindberror = (error == Rcl::Db::DbOpenMainDb) ? true : false;
} }
return false; return false;

View File

@ -572,13 +572,20 @@ void RclMain::initDbOpen()
if (!maybeOpenDb(reason, true, &maindberror)) { if (!maybeOpenDb(reason, true, &maindberror)) {
nodb = true; nodb = true;
if (maindberror) { if (maindberror) {
FirstIdxDialog fidia(this); if (theconfig && !path_exists(theconfig->getDbDir())) {
connect(fidia.idxconfCLB, SIGNAL(clicked()), this, SLOT(execIndexConfig())); FirstIdxDialog fidia(this);
connect(fidia.idxschedCLB, SIGNAL(clicked()), this, SLOT(execIndexSched())); connect(fidia.idxconfCLB, SIGNAL(clicked()), this, SLOT(execIndexConfig()));
connect(fidia.runidxPB, SIGNAL(clicked()), this, SLOT(rebuildIndex())); connect(fidia.idxschedCLB, SIGNAL(clicked()), this, SLOT(execIndexSched()));
fidia.exec(); connect(fidia.runidxPB, SIGNAL(clicked()), this, SLOT(rebuildIndex()));
// Don't open adv search or run cmd line search in this case. fidia.exec();
return; // 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 { } else {
QMessageBox::warning(0, "Recoll", tr("Could not open external index. Db not " QMessageBox::warning(0, "Recoll", tr("Could not open external index. Db not "
"open. Check external indexes list.")); "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; break;
} }
if (!m_reason.empty()) { if (!m_reason.empty()) {
LOGERR("Db::dirlist: " << m_reason << "\n"); LOGERR("Db::dirlist: exception while accessing index: " << m_reason << "\n");
return false; return false;
} }