Switch to unified view

a/src/qtgui/main.cpp b/src/qtgui/main.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: main.cpp,v 1.72 2008-12-12 11:00:27 dockes Exp $ (C) 2005 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: main.cpp,v 1.73 2008-12-17 08:01:40 dockes Exp $ (C) 2005 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
85
}
85
}
86
86
87
RclHistory *g_dynconf;
87
RclHistory *g_dynconf;
88
int recollNeedsExit;
88
int recollNeedsExit;
89
int startIndexingAfterConfig;
89
int startIndexingAfterConfig;
90
static string dbdir;
91
static RclMain *mainWindow;
90
static RclMain *mainWindow;
92
static string recollsharedir;
91
static string recollsharedir;
93
92
94
bool maybeOpenDb(string &reason, bool force)
93
bool maybeOpenDb(string &reason, bool force)
95
{
94
{
...
...
104
    for (list<string>::const_iterator it = prefs.activeExtraDbs.begin();
103
    for (list<string>::const_iterator it = prefs.activeExtraDbs.begin();
105
     it != prefs.activeExtraDbs.end(); it++) {
104
     it != prefs.activeExtraDbs.end(); it++) {
106
    LOGDEB(("main: adding [%s]\n", it->c_str()));
105
    LOGDEB(("main: adding [%s]\n", it->c_str()));
107
    rcldb->addQueryDb(*it);
106
    rcldb->addQueryDb(*it);
108
    }
107
    }
109
    if (!rcldb->isopen() && !rcldb->open(dbdir, rclconfig->getStopfile(),
108
    if (!rcldb->isopen() && !rcldb->open(Rcl::Db::DbRO)) {
110
                   Rcl::Db::DbRO)) {
111
    reason = "Could not open database in " + 
109
    reason = "Could not open database in " + 
112
        dbdir + " wait for indexing to complete?";
110
        rclconfig->getDbDir() + " wait for indexing to complete?";
113
    return false;
111
    return false;
114
    }
112
    }
115
    rcldb->setAbstractParams(-1, prefs.syntAbsLen, prefs.syntAbsCtx);
113
    rcldb->setAbstractParams(-1, prefs.syntAbsLen, prefs.syntAbsCtx);
116
    return true;
114
    return true;
117
}
115
}
...
...
313
    QSize s(prefs.mainwidth, prefs.mainheight);
311
    QSize s(prefs.mainwidth, prefs.mainheight);
314
    mainWindow->resize(s);
312
    mainWindow->resize(s);
315
    }
313
    }
316
314
317
    mainWindow->sSearch->searchTypCMB->setCurrentItem(prefs.ssearchTyp);
315
    mainWindow->sSearch->searchTypCMB->setCurrentItem(prefs.ssearchTyp);
318
    dbdir = rclconfig->getDbDir();
316
    string dbdir = rclconfig->getDbDir();
319
    if (dbdir.empty()) {
317
    if (dbdir.empty()) {
320
    // Note: this will have to be replaced by a call to a
318
    // Note: this will have to be replaced by a call to a
321
    // configuration buildin dialog for initial configuration
319
    // configuration buildin dialog for initial configuration
322
    QMessageBox::critical(0, "Recoll",
320
    QMessageBox::critical(0, "Recoll",
323
                  app.translate("Main", 
321
                  app.translate("Main", 
324
                      "No db directory in configuration"));
322
                      "No db directory in configuration"));
325
    exit(1);
323
    exit(1);
326
    }
324
    }
327
325
328
    rcldb = new Rcl::Db;
326
    rcldb = new Rcl::Db(rclconfig);
329
327
330
    bool needindexconfig = false;
328
    bool needindexconfig = false;
331
    if (!maybeOpenDb(reason)) {
329
    if (!maybeOpenDb(reason)) {
332
330
333
    switch (QMessageBox::
331
    switch (QMessageBox::