GUI: when opening the index, discriminate errors on the main index from errors on external ones, to avoid starting the initial indexing dialog in the latter case

This commit is contained in:
Jean-Francois Dockes
2011-04-29 16:16:04 +02:00
parent eacf71bf99
commit 84d59f18a0
6 changed files with 63 additions and 39 deletions
+12 -2
View File
@@ -534,8 +534,11 @@ list<string> Db::getStemmerNames()
return res;
}
bool Db::open(OpenMode mode)
bool Db::open(OpenMode mode, OpenError *error)
{
if (error)
*error = DbOpenMainDb;
if (m_ndb == 0 || m_config == 0) {
m_reason = "Null configuration or Xapian Db";
return false;
@@ -586,12 +589,17 @@ bool Db::open(OpenMode mode)
m_ndb->xrdb = Xapian::Database(dir);
for (list<string>::iterator it = m_extraDbs.begin();
it != m_extraDbs.end(); it++) {
if (error)
*error = DbOpenExtraDb;
LOGDEB(("Db::Open: adding query db [%s]\n", it->c_str()));
// Used to be non-fatal (1.13 and older) but I can't see why
// An error here used to be non-fatal (1.13 and older)
// but I can't see why
m_ndb->xrdb.add_database(Xapian::Database(*it));
}
break;
}
if (error)
*error = DbOpenMainDb;
// Check index format version. Must not try to check a just created or
// truncated db
@@ -608,6 +616,8 @@ bool Db::open(OpenMode mode)
m_mode = mode;
m_ndb->m_isopen = true;
m_basedir = dir;
if (error)
*error = DbOpenNoError;
return true;
} XCATCHERROR(ermsg);
+2 -1
View File
@@ -95,7 +95,8 @@ class Db {
~Db();
enum OpenMode {DbRO, DbUpd, DbTrunc};
bool open(OpenMode mode);
enum OpenError {DbOpenNoError, DbOpenMainDb, DbOpenExtraDb};
bool open(OpenMode mode, OpenError *error = 0);
bool close();
bool isopen();