allow opening config gui if no index on first start

This commit is contained in:
dockes 2007-11-21 14:15:48 +00:00
parent a4a4652748
commit 0cc19093a5
4 changed files with 29 additions and 14 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.9 2007-10-25 15:51:06 dockes Exp $ (C) 2007 J.F.Dockes"; static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.10 2007-11-21 14:15:48 dockes Exp $ (C) 2007 J.F.Dockes";
#endif #endif
#include <qglobal.h> #include <qglobal.h>
@ -50,6 +50,8 @@ static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.9 2007-10-25 15:51:06 dockes
using std::list; using std::list;
#include "confgui.h" #include "confgui.h"
#include "recoll.h"
#include "idxthread.h"
#include "confguiindex.h" #include "confguiindex.h"
#include "smallut.h" #include "smallut.h"
#include "debuglog.h" #include "debuglog.h"
@ -94,6 +96,10 @@ void ConfIndexW::acceptChanges()
m_rclconf->updateMainConfig(); m_rclconf->updateMainConfig();
QTimer::singleShot(0, this, SLOT(reloadPanels())); QTimer::singleShot(0, this, SLOT(reloadPanels()));
if (startIndexingAfterConfig) {
startIndexingAfterConfig = 0;
startindexing = 1;
}
} }
void ConfIndexW::rejectChanges() void ConfIndexW::rejectChanges()

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: main.cpp,v 1.63 2007-11-08 09:35:47 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: main.cpp,v 1.64 2007-11-21 14:15:48 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -86,6 +86,7 @@ RclConfig* RclConfig::getMainConfig()
RclHistory *g_dynconf; RclHistory *g_dynconf;
int recollNeedsExit; int recollNeedsExit;
int startIndexingAfterConfig;
static string dbdir; static string dbdir;
static RclMain *mainWindow; static RclMain *mainWindow;
static string recollsharedir; static string recollsharedir;
@ -320,8 +321,8 @@ int main(int argc, char **argv)
rcldb = new Rcl::Db; rcldb = new Rcl::Db;
bool needindexconfig = false;
if (!maybeOpenDb(reason)) { if (!maybeOpenDb(reason)) {
startindexing = 1;
switch (QMessageBox:: switch (QMessageBox::
#if (QT_VERSION >= 0x030200) #if (QT_VERSION >= 0x030200)
@ -337,20 +338,27 @@ int main(int argc, char **argv)
"Click Cancel if you want to edit the configuration file before indexation starts, or Ok to let it proceed."), "Click Cancel if you want to edit the configuration file before indexation starts, or Ok to let it proceed."),
"Ok", "Cancel", 0, 0)) { "Ok", "Cancel", 0, 0)) {
case 0: // Ok case 0: // Ok: indexing is going to start.
startindexing = 1;
break; break;
case 1: // Cancel case 1: // Cancel
exit(0); needindexconfig = true;
startindexing = 0;
break;
} }
} }
mainWindow->show(); mainWindow->show();
if (needindexconfig) {
if (prefs.startWithAdvSearchOpen) startIndexingAfterConfig = 1;
mainWindow->showAdvSearchDialog(); mainWindow->showIndexConfig();
if (prefs.startWithSortToolOpen) } else {
mainWindow->showSortDialog(); if (prefs.startWithAdvSearchOpen)
mainWindow->showAdvSearchDialog();
if (prefs.startWithSortToolOpen)
mainWindow->showSortDialog();
}
// Connect exit handlers etc.. Beware, apparently this must come // Connect exit handlers etc.. Beware, apparently this must come
// after mainWindow->show() , else the QMessageBox above never // after mainWindow->show() , else the QMessageBox above never

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.44 2007-10-09 14:08:24 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.45 2007-11-21 14:15:48 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -407,7 +407,7 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata)
// If indexing is being performed, we reopen the db at each query. // If indexing is being performed, we reopen the db at each query.
if (!maybeOpenDb(reason, indexingdone == 0)) { if (!maybeOpenDb(reason, indexingdone == 0)) {
QMessageBox::critical(0, "Recoll", QString(reason.c_str())); QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
exit(1); return;
} }
resList->resetSearch(); resList->resetSearch();
@ -915,7 +915,7 @@ void RclMain::showDocHistory()
string reason; string reason;
if (!maybeOpenDb(reason)) { if (!maybeOpenDb(reason)) {
QMessageBox::critical(0, "Recoll", QString(reason.c_str())); QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
exit(1); return;
} }
// Construct a bogus SearchData structure // Construct a bogus SearchData structure
m_searchData = m_searchData =

View File

@ -16,7 +16,7 @@
*/ */
#ifndef _RECOLL_H_INCLUDED_ #ifndef _RECOLL_H_INCLUDED_
#define _RECOLL_H_INCLUDED_ #define _RECOLL_H_INCLUDED_
/* @(#$Id: recoll.h,v 1.17 2006-10-11 14:16:26 dockes Exp $ (C) 2004 J.F.Dockes */ /* @(#$Id: recoll.h,v 1.18 2007-11-21 14:15:48 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string> #include <string>
#include "rclconfig.h" #include "rclconfig.h"
@ -32,6 +32,7 @@ extern bool maybeOpenDb(std::string &reason, bool force = true);
extern RclConfig *rclconfig; extern RclConfig *rclconfig;
extern Rcl::Db *rcldb; extern Rcl::Db *rcldb;
extern int recollNeedsExit; extern int recollNeedsExit;
extern int startIndexingAfterConfig; // 1st startup
extern const std::string recoll_datadir; extern const std::string recoll_datadir;
extern RclHistory *g_dynconf; extern RclHistory *g_dynconf;
#ifdef RCL_USE_ASPELL #ifdef RCL_USE_ASPELL