replace local variable recoll_datadir with access to config

This commit is contained in:
dockes 2008-11-24 15:23:12 +00:00
parent 5045829957
commit afd369d2c4
4 changed files with 17 additions and 22 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: main.cpp,v 1.5 2007-10-09 11:08:17 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: main.cpp,v 1.6 2008-11-24 15:23:12 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -84,8 +84,6 @@ using namespace std;
using namespace confgui;
const string recoll_datadir = RECOLL_DATADIR;
static const char *thisprog;
static int op_flags;
#define OPT_MOINS 0x1
@ -151,7 +149,7 @@ int main(int argc, char **argv)
app.installTranslator( &qt );
// Translations for Recoll
string translatdir = path_cat(recoll_datadir, "translations");
string translatdir = path_cat(config->getDatadir(), "translations");
QTranslator translator( 0 );
// QTextCodec::locale() returns $LANG
translator.load( QString("recoll_") + QTextCodec::locale(),

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.39 2008-10-03 08:09:35 dockes Exp $ (C) 2005 Jean-Francois Dockes";
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.40 2008-11-24 15:23:12 dockes Exp $ (C) 2005 Jean-Francois Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -54,7 +54,7 @@ bool startHelpBrowser(const string &iurl)
{
string url;
if (iurl.empty()) {
url = path_cat(recoll_datadir, "doc");
url = path_cat(rclconfig->getDatadir(), "doc");
url = path_cat(url, "usermanual.html");
url = string("file://") + url;
} else

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: main.cpp,v 1.70 2008-09-30 12:38:29 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: main.cpp,v 1.71 2008-11-24 15:23:12 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -73,8 +73,6 @@ static KCmdLineOptions options[] =
};
#endif
const string recoll_datadir = RECOLL_DATADIR;
RclConfig *rclconfig;
Rcl::Db *rcldb;
#ifdef RCL_USE_ASPELL
@ -237,8 +235,18 @@ int main(int argc, char **argv)
qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
app.installTranslator( &qt );
string reason;
rclconfig = recollinit(recollCleanup, sigcleanup, reason, &a_config);
if (!rclconfig || !rclconfig->ok()) {
QString msg = "Configuration problem: ";
msg += QString::fromUtf8(reason.c_str());
QMessageBox::critical(0, "Recoll", msg);
exit(1);
}
// fprintf(stderr, "recollinit done\n");
// Translations for Recoll
string translatdir = path_cat(recoll_datadir, "translations");
string translatdir = path_cat(rclconfig->getDatadir(), "translations");
QTranslator translator( 0 );
// QTextCodec::locale() returns $LANG
translator.load( QString("recoll_") + QTextCodec::locale(),
@ -247,16 +255,6 @@ int main(int argc, char **argv)
// fprintf(stderr, "Translations installed\n");
string reason;
rclconfig = recollinit(recollCleanup, sigcleanup, reason, &a_config);
if (!rclconfig || !rclconfig->ok()) {
QString msg = app.translate("Main", "Configuration problem: ");
msg += QString::fromUtf8(reason.c_str());
QMessageBox::critical(0, "Recoll", msg);
exit(1);
}
// fprintf(stderr, "recollinit done\n");
#ifdef RCL_USE_ASPELL
aspell = new Aspell(rclconfig);
aspell->init(reason);

View File

@ -16,7 +16,7 @@
*/
#ifndef _RECOLL_H_INCLUDED_
#define _RECOLL_H_INCLUDED_
/* @(#$Id: recoll.h,v 1.18 2007-11-21 14:15:48 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: recoll.h,v 1.19 2008-11-24 15:23:12 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include "rclconfig.h"
@ -33,7 +33,6 @@ extern RclConfig *rclconfig;
extern Rcl::Db *rcldb;
extern int recollNeedsExit;
extern int startIndexingAfterConfig; // 1st startup
extern const std::string recoll_datadir;
extern RclHistory *g_dynconf;
#ifdef RCL_USE_ASPELL
class Aspell;