more refactoring
This commit is contained in:
parent
21346df77b
commit
34ab3a7fed
@ -1,5 +1,21 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the
|
||||||
|
* Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <qthread.h>
|
#include <qthread.h>
|
||||||
|
|||||||
@ -1,20 +1,41 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.33 2006-01-22 18:46:41 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: main.cpp,v 1.34 2006-01-23 13:32:05 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the
|
||||||
|
* Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <qapplication.h>
|
|
||||||
//#define WITH_KDE
|
//#define WITH_KDE
|
||||||
#ifdef WITH_KDE
|
#ifdef WITH_KDE
|
||||||
#include <kapplication.h>
|
#include <kapplication.h>
|
||||||
#endif
|
#include <kmainwindow.h>
|
||||||
|
#include <kaboutdata.h>
|
||||||
|
#include <kcmdlineargs.h>
|
||||||
|
#include <klocale.h>
|
||||||
|
#else
|
||||||
|
#include <qapplication.h>
|
||||||
#include <qtranslator.h>
|
#include <qtranslator.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
#include <qthread.h>
|
#include <qthread.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qsettings.h>
|
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
|
|
||||||
|
|
||||||
@ -28,10 +49,23 @@ using Rcl::AdvSearchData;
|
|||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
#include "rclinit.h"
|
#include "rclinit.h"
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
|
#include "rclversion.h"
|
||||||
#include "rclmain.h"
|
#include "rclmain.h"
|
||||||
|
#include "guiutils.h"
|
||||||
|
|
||||||
static const char *recoll_datadir = RECOLL_DATADIR;
|
#ifdef WITH_KDE
|
||||||
|
static const char description[] =
|
||||||
|
I18N_NOOP("A KDE fulltext search application");
|
||||||
|
|
||||||
|
static KCmdLineOptions options[] =
|
||||||
|
{
|
||||||
|
// { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
|
||||||
|
KCmdLineLastOption
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
const string recoll_datadir = RECOLL_DATADIR;
|
||||||
|
|
||||||
RclConfig *rclconfig;
|
RclConfig *rclconfig;
|
||||||
Rcl::Db *rcldb;
|
Rcl::Db *rcldb;
|
||||||
@ -40,52 +74,6 @@ static string dbdir;
|
|||||||
static RclMainBase *mainWindow;
|
static RclMainBase *mainWindow;
|
||||||
static string recollsharedir;
|
static string recollsharedir;
|
||||||
|
|
||||||
/////////////////////////
|
|
||||||
// Global variables for user preferences. These are set in the user preference
|
|
||||||
// dialog and saved restored to the appropriate place in the qt settings
|
|
||||||
bool prefs_showicons;
|
|
||||||
int prefs_respagesize = 8;
|
|
||||||
QString prefs_reslistfontfamily;
|
|
||||||
int prefs_reslistfontsize;
|
|
||||||
QString prefs_queryStemLang;
|
|
||||||
int prefs_mainwidth;
|
|
||||||
int prefs_mainheight;
|
|
||||||
bool prefs_ssall;
|
|
||||||
QString prefs_htmlBrowser;
|
|
||||||
|
|
||||||
#define SETTING_RW(var, nm, tp, def) \
|
|
||||||
if (writing) { \
|
|
||||||
settings.writeEntry(nm , var); \
|
|
||||||
} else { \
|
|
||||||
var = settings.read##tp##Entry(nm, def); \
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rwSettings(bool writing)
|
|
||||||
{
|
|
||||||
if (writing) {
|
|
||||||
if (!mainWindow)
|
|
||||||
return;
|
|
||||||
prefs_mainwidth = mainWindow->width();
|
|
||||||
prefs_mainheight = mainWindow->height();
|
|
||||||
prefs_ssall = mainWindow->sSearch->allTermsCB->isChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
QSettings settings;
|
|
||||||
settings.setPath("Recoll.org", "Recoll");
|
|
||||||
|
|
||||||
SETTING_RW(prefs_mainwidth, "/Recoll/geometry/width", Num, 590);
|
|
||||||
SETTING_RW(prefs_mainheight, "/Recoll/geometry/height", Num, 810);
|
|
||||||
SETTING_RW(prefs_ssall, "/Recoll/prefs/simpleSearchAll", Bool, false);
|
|
||||||
SETTING_RW(prefs_showicons, "/Recoll/prefs/reslist/showicons", Bool, true);
|
|
||||||
SETTING_RW(prefs_respagesize, "/Recoll/prefs/reslist/pagelen", Num, 8);
|
|
||||||
SETTING_RW(prefs_reslistfontfamily, "/Recoll/prefs/reslist/fontFamily", ,
|
|
||||||
"");
|
|
||||||
SETTING_RW(prefs_reslistfontsize, "/Recoll/prefs/reslist/fontSize", Num,
|
|
||||||
0);
|
|
||||||
SETTING_RW(prefs_queryStemLang, "/Recoll/prefs/query/stemLang", ,
|
|
||||||
"english");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool maybeOpenDb(string &reason)
|
bool maybeOpenDb(string &reason)
|
||||||
{
|
{
|
||||||
if (!rcldb) {
|
if (!rcldb) {
|
||||||
@ -102,6 +90,11 @@ bool maybeOpenDb(string &reason)
|
|||||||
|
|
||||||
static void recollCleanup()
|
static void recollCleanup()
|
||||||
{
|
{
|
||||||
|
if (mainWindow) {
|
||||||
|
prefs.mainwidth = mainWindow->width();
|
||||||
|
prefs.mainheight = mainWindow->height();
|
||||||
|
prefs.ssall = mainWindow->sSearch->allTermsCB->isChecked();
|
||||||
|
}
|
||||||
rwSettings(true);
|
rwSettings(true);
|
||||||
stop_idxthread();
|
stop_idxthread();
|
||||||
delete rcldb;
|
delete rcldb;
|
||||||
@ -119,19 +112,26 @@ static void sigcleanup(int)
|
|||||||
recollNeedsExit = 1;
|
recollNeedsExit = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void qInitImages_recoll();
|
||||||
|
|
||||||
int main( int argc, char ** argv )
|
int main( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
#ifdef WITH_KDE
|
#ifdef WITH_KDE
|
||||||
KApplication a(argc, argv, "recoll");
|
KAboutData about("recoll", I18N_NOOP("Recoll"), rclversion, description,
|
||||||
|
KAboutData::License_GPL, "(C) 2006 Jean-Francois Dockes", 0, 0, "jean-francois.dockes@wanadoo.fr");
|
||||||
|
about.addAuthor( "Jean-Francois Dockes", 0,
|
||||||
|
"jean-francois.dockes@wanadoo.fr" );
|
||||||
|
KCmdLineArgs::init(argc, argv, &about);
|
||||||
|
KCmdLineArgs::addCmdLineOptions( options );
|
||||||
|
KApplication app;
|
||||||
#else
|
#else
|
||||||
QApplication a(argc, argv);
|
QApplication app(argc, argv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// translation file for Qt
|
// Translation file for Qt
|
||||||
QTranslator qt( 0 );
|
QTranslator qt( 0 );
|
||||||
qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
|
qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
|
||||||
a.installTranslator( &qt );
|
app.installTranslator( &qt );
|
||||||
|
|
||||||
// Translations for Recoll
|
// Translations for Recoll
|
||||||
string translatdir = path_cat(recoll_datadir, "translations");
|
string translatdir = path_cat(recoll_datadir, "translations");
|
||||||
@ -139,32 +139,52 @@ int main( int argc, char ** argv )
|
|||||||
// QTextCodec::locale() returns $LANG
|
// QTextCodec::locale() returns $LANG
|
||||||
translator.load( QString("recoll_") + QTextCodec::locale(),
|
translator.load( QString("recoll_") + QTextCodec::locale(),
|
||||||
translatdir.c_str() );
|
translatdir.c_str() );
|
||||||
a.installTranslator( &translator );
|
app.installTranslator( &translator );
|
||||||
|
|
||||||
rwSettings(false);
|
rwSettings(false);
|
||||||
|
|
||||||
string reason;
|
string reason;
|
||||||
rclconfig = recollinit(recollCleanup, sigcleanup, reason);
|
rclconfig = recollinit(recollCleanup, sigcleanup, reason);
|
||||||
if (!rclconfig || !rclconfig->ok()) {
|
if (!rclconfig || !rclconfig->ok()) {
|
||||||
QString msg = a.translate("Main", "Configuration problem: ");
|
QString msg = app.translate("Main", "Configuration problem: ");
|
||||||
msg += reason;
|
msg += reason;
|
||||||
QMessageBox::critical(0, "Recoll", msg);
|
QMessageBox::critical(0, "Recoll", msg);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create main window and set its size to previous session's
|
// Create main window and set its size to previous session's
|
||||||
|
#ifdef WITH_KDE
|
||||||
|
#if 0
|
||||||
|
if (app.isRestored()) {
|
||||||
|
RESTORE(RclMain);
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
|
// no session.. just start up normally
|
||||||
|
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
||||||
|
/// @todo do something with the command line args here
|
||||||
|
qInitImages_recoll();
|
||||||
|
mainWindow = new RclMain;
|
||||||
|
app.setMainWidget( mainWindow );
|
||||||
|
mainWindow->show();
|
||||||
|
|
||||||
|
args->clear();
|
||||||
|
|
||||||
|
// }
|
||||||
|
#else
|
||||||
RclMain w;
|
RclMain w;
|
||||||
mainWindow = &w;
|
mainWindow = &w;
|
||||||
QSize s(prefs_mainwidth, prefs_mainheight);
|
#endif
|
||||||
w.resize(s);
|
QSize s(prefs.mainwidth, prefs.mainheight);
|
||||||
|
mainWindow->resize(s);
|
||||||
|
|
||||||
w.sSearch->allTermsCB->setChecked(prefs_ssall);
|
|
||||||
|
mainWindow->sSearch->allTermsCB->setChecked(prefs.ssall);
|
||||||
|
|
||||||
if (rclconfig->getConfParam(string("dbdir"), dbdir) == 0) {
|
if (rclconfig->getConfParam(string("dbdir"), dbdir) == 0) {
|
||||||
// Note: this will have to be replaced by a call to a
|
// Note: this will have to be replaced by a call to a
|
||||||
// configuration buildin dialog for initial configuration
|
// configuration buildin dialog for initial configuration
|
||||||
QMessageBox::critical(0, "Recoll",
|
QMessageBox::critical(0, "Recoll",
|
||||||
a.translate("Main",
|
app.translate("Main",
|
||||||
"No db directory in configuration"));
|
"No db directory in configuration"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -173,18 +193,19 @@ int main( int argc, char ** argv )
|
|||||||
rcldb = new Rcl::Db;
|
rcldb = new Rcl::Db;
|
||||||
|
|
||||||
// Connect exit handlers etc..
|
// Connect exit handlers etc..
|
||||||
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
|
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
||||||
QTimer *timer = new QTimer(&a);
|
QTimer *timer = new QTimer(&app);
|
||||||
w.connect(timer, SIGNAL(timeout()), &w, SLOT(periodic100()));
|
mainWindow->connect(timer, SIGNAL(timeout()),
|
||||||
|
mainWindow, SLOT(periodic100()));
|
||||||
timer->start(100);
|
timer->start(100);
|
||||||
|
|
||||||
if (!rcldb->open(dbdir, Rcl::Db::DbRO)) {
|
if (!rcldb->open(dbdir, Rcl::Db::DbRO)) {
|
||||||
startindexing = 1;
|
startindexing = 1;
|
||||||
switch (QMessageBox::
|
switch (QMessageBox::
|
||||||
question(0, "Recoll",
|
question(0, "Recoll",
|
||||||
a.translate("Main", "Could not open database in ")+
|
app.translate("Main", "Could not open database in ")+
|
||||||
QString(dbdir) +
|
QString(dbdir) +
|
||||||
a.translate("Main",
|
app.translate("Main",
|
||||||
".\n"
|
".\n"
|
||||||
"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",
|
"Ok",
|
||||||
@ -196,75 +217,10 @@ int main( int argc, char ** argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mainWindow->show();
|
||||||
start_idxthread(*rclconfig);
|
start_idxthread(*rclconfig);
|
||||||
|
|
||||||
// Let's go
|
// Let's go
|
||||||
w.show();
|
return app.exec();
|
||||||
return a.exec();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const static char *htmlbrowserlist =
|
|
||||||
"opera konqueror firefox mozilla netscape";
|
|
||||||
// Search for and launch an html browser for the documentation. If the
|
|
||||||
// user has set a preference, we use it directly instead of guessing.
|
|
||||||
bool startHelpBrowser(const string &iurl)
|
|
||||||
{
|
|
||||||
string url;
|
|
||||||
if (iurl.empty()) {
|
|
||||||
url = path_cat(recoll_datadir, "doc");
|
|
||||||
url = path_cat(url, "usermanual.html");
|
|
||||||
url = string("file://") + url;
|
|
||||||
} else
|
|
||||||
url = iurl;
|
|
||||||
|
|
||||||
|
|
||||||
// If the user set a preference with an absolute path then things are
|
|
||||||
// simple
|
|
||||||
if (!prefs_htmlBrowser.isEmpty() && prefs_htmlBrowser.find('/') != -1) {
|
|
||||||
if (access(prefs_htmlBrowser.ascii(), X_OK) != 0) {
|
|
||||||
LOGERR(("startHelpBrowser: %s not found or not executable\n",
|
|
||||||
prefs_htmlBrowser.ascii()));
|
|
||||||
}
|
|
||||||
string cmd = string(prefs_htmlBrowser.ascii()) + " " + url + "&";
|
|
||||||
if (system(cmd.c_str()) == 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
string searched;
|
|
||||||
if (prefs_htmlBrowser.isEmpty()) {
|
|
||||||
searched = htmlbrowserlist;
|
|
||||||
} else {
|
|
||||||
searched = prefs_htmlBrowser.ascii();
|
|
||||||
}
|
|
||||||
list<string> blist;
|
|
||||||
stringToTokens(searched, blist, " ");
|
|
||||||
|
|
||||||
const char *path = getenv("PATH");
|
|
||||||
if (path == 0)
|
|
||||||
path = "/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin";
|
|
||||||
|
|
||||||
list<string> pathl;
|
|
||||||
stringToTokens(path, pathl, ":");
|
|
||||||
|
|
||||||
// For each browser name, search path and exec/stop if found
|
|
||||||
for (list<string>::const_iterator bit = blist.begin();
|
|
||||||
bit != blist.end(); bit++) {
|
|
||||||
for (list<string>::const_iterator pit = pathl.begin();
|
|
||||||
pit != pathl.end(); pit++) {
|
|
||||||
string exefile = path_cat(*pit, *bit);
|
|
||||||
LOGDEB1(("startHelpBrowser: trying %s\n", exefile.c_str()));
|
|
||||||
if (access(exefile.c_str(), X_OK) == 0) {
|
|
||||||
string cmd = exefile + " " + url + "&";
|
|
||||||
if (system(cmd.c_str()) == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGERR(("startHelpBrowser: no html browser found. Looked for: %s\n",
|
|
||||||
searched.c_str()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,6 +1,22 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.7 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.8 2006-01-23 13:32:05 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the
|
||||||
|
* Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@ -1,14 +1,22 @@
|
|||||||
/****************************************************************************
|
#ifndef lint
|
||||||
** ui.h extension file, included from the uic-generated form implementation.
|
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.6 2006-01-23 13:32:06 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
**
|
#endif
|
||||||
** If you want to add, delete, or rename functions or slots, use
|
/*
|
||||||
** Qt Designer to update this file, preserving your code.
|
* This program is free software; you can redistribute it and/or modify
|
||||||
**
|
* it under the terms of the GNU General Public License as published by
|
||||||
** You should not define a constructor or destructor in this file.
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
** Instead, write your code in functions called init() and destroy().
|
* (at your option) any later version.
|
||||||
** These will automatically be called by the form's constructor and
|
*
|
||||||
** destructor.
|
* This program is distributed in the hope that it will be useful,
|
||||||
*****************************************************************************/
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the
|
||||||
|
* Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -49,6 +57,7 @@ using std::pair;
|
|||||||
#include "rclversion.h"
|
#include "rclversion.h"
|
||||||
#include "sortseq.h"
|
#include "sortseq.h"
|
||||||
#include "uiprefs.h"
|
#include "uiprefs.h"
|
||||||
|
#include "guiutils.h"
|
||||||
|
|
||||||
#include "rclmain.h"
|
#include "rclmain.h"
|
||||||
#include "moc_rclmain.cpp"
|
#include "moc_rclmain.cpp"
|
||||||
@ -72,8 +81,8 @@ void RclMain::init()
|
|||||||
sSearch->queryText->setFocus();
|
sSearch->queryText->setFocus();
|
||||||
|
|
||||||
// Set result list font according to user preferences.
|
// Set result list font according to user preferences.
|
||||||
if (prefs_reslistfontfamily.length()) {
|
if (prefs.reslistfontfamily.length()) {
|
||||||
QFont nfont(prefs_reslistfontfamily, prefs_reslistfontsize);
|
QFont nfont(prefs.reslistfontfamily, prefs.reslistfontsize);
|
||||||
resList->setFont(nfont);
|
resList->setFont(nfont);
|
||||||
}
|
}
|
||||||
string historyfile = path_cat(rclconfig->getConfDir(), "history");
|
string historyfile = path_cat(rclconfig->getConfDir(), "history");
|
||||||
@ -281,9 +290,9 @@ void RclMain::startAdvSearch(Rcl::AdvSearchData sdata)
|
|||||||
|
|
||||||
resList->m_winfirst = -1;
|
resList->m_winfirst = -1;
|
||||||
|
|
||||||
if (!rcldb->setQuery(sdata, prefs_queryStemLang.length() > 0 ?
|
if (!rcldb->setQuery(sdata, prefs.queryStemLang.length() > 0 ?
|
||||||
Rcl::Db::QO_STEM : Rcl::Db::QO_NONE,
|
Rcl::Db::QO_STEM : Rcl::Db::QO_NONE,
|
||||||
prefs_queryStemLang.ascii()))
|
prefs.queryStemLang.ascii()))
|
||||||
return;
|
return;
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
|
|
||||||
@ -516,22 +525,22 @@ void RclMain::setUIPrefs()
|
|||||||
if (!uiprefs)
|
if (!uiprefs)
|
||||||
return;
|
return;
|
||||||
LOGDEB(("Recollmain::setUIPrefs\n"));
|
LOGDEB(("Recollmain::setUIPrefs\n"));
|
||||||
prefs_showicons = uiprefs->useIconsCB->isChecked();
|
prefs.showicons = uiprefs->useIconsCB->isChecked();
|
||||||
prefs_respagesize = uiprefs->pageLenSB->value();
|
prefs.respagesize = uiprefs->pageLenSB->value();
|
||||||
|
|
||||||
prefs_reslistfontfamily = uiprefs->reslistFontFamily;
|
prefs.reslistfontfamily = uiprefs->reslistFontFamily;
|
||||||
prefs_reslistfontsize = uiprefs->reslistFontSize;
|
prefs.reslistfontsize = uiprefs->reslistFontSize;
|
||||||
if (prefs_reslistfontfamily.length()) {
|
if (prefs.reslistfontfamily.length()) {
|
||||||
QFont nfont(prefs_reslistfontfamily, prefs_reslistfontsize);
|
QFont nfont(prefs.reslistfontfamily, prefs.reslistfontsize);
|
||||||
resList->setFont(nfont);
|
resList->setFont(nfont);
|
||||||
} else {
|
} else {
|
||||||
resList->setFont(this->font());
|
resList->setFont(this->font());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uiprefs->stemLangCMB->currentItem() == 0) {
|
if (uiprefs->stemLangCMB->currentItem() == 0) {
|
||||||
prefs_queryStemLang = "";
|
prefs.queryStemLang = "";
|
||||||
} else {
|
} else {
|
||||||
prefs_queryStemLang = uiprefs->stemLangCMB->currentText();
|
prefs.queryStemLang = uiprefs->stemLangCMB->currentText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#ifndef _RECOLL_H_INCLUDED_
|
#ifndef _RECOLL_H_INCLUDED_
|
||||||
#define _RECOLL_H_INCLUDED_
|
#define _RECOLL_H_INCLUDED_
|
||||||
/* @(#$Id: recoll.h,v 1.11 2006-01-20 14:58:57 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: recoll.h,v 1.12 2006-01-23 13:32:06 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "rclconfig.h"
|
#include "rclconfig.h"
|
||||||
@ -9,17 +9,10 @@
|
|||||||
|
|
||||||
// Misc declarations in need of sharing between the UI files
|
// Misc declarations in need of sharing between the UI files
|
||||||
extern bool maybeOpenDb(std::string &reason);
|
extern bool maybeOpenDb(std::string &reason);
|
||||||
extern bool startHelpBrowser(const string& url = "");
|
|
||||||
|
|
||||||
extern RclConfig *rclconfig;
|
extern RclConfig *rclconfig;
|
||||||
extern Rcl::Db *rcldb;
|
extern Rcl::Db *rcldb;
|
||||||
extern int recollNeedsExit;
|
extern int recollNeedsExit;
|
||||||
|
extern const std::string recoll_datadir;
|
||||||
class QString;
|
|
||||||
extern bool prefs_showicons;
|
|
||||||
extern int prefs_respagesize;
|
|
||||||
extern QString prefs_reslistfontfamily;
|
|
||||||
extern int prefs_reslistfontsize;
|
|
||||||
extern QString prefs_queryStemLang;
|
|
||||||
|
|
||||||
#endif /* _RECOLL_H_INCLUDED_ */
|
#endif /* _RECOLL_H_INCLUDED_ */
|
||||||
|
|||||||
@ -8,7 +8,8 @@ HEADERS += rclmain.h
|
|||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
rclmain.cpp \
|
rclmain.cpp \
|
||||||
idxthread.cpp \
|
idxthread.cpp \
|
||||||
plaintorich.cpp
|
plaintorich.cpp \
|
||||||
|
guiutils.cpp
|
||||||
|
|
||||||
FORMS = reslistb.ui \
|
FORMS = reslistb.ui \
|
||||||
recollmain.ui \
|
recollmain.ui \
|
||||||
@ -42,7 +43,7 @@ unix {
|
|||||||
DEFINES += RECOLL_DATADIR=\"/usr/local/share\"
|
DEFINES += RECOLL_DATADIR=\"/usr/local/share\"
|
||||||
LIBS += ../lib/librcl.a ../bincimapmime/libmime.a \
|
LIBS += ../lib/librcl.a ../bincimapmime/libmime.a \
|
||||||
$(BSTATIC) -L/usr/local/lib -lxapian -L/usr/local/lib -liconv $(BDYNAMIC) \
|
$(BSTATIC) -L/usr/local/lib -lxapian -L/usr/local/lib -liconv $(BDYNAMIC) \
|
||||||
-lz
|
-lkdecore -lz
|
||||||
|
|
||||||
INCLUDEPATH += ../common ../index ../query ../unac ../utils
|
INCLUDEPATH += ../common ../index ../query ../unac ../utils
|
||||||
POST_TARGETDEPS = ../lib/librcl.a
|
POST_TARGETDEPS = ../lib/librcl.a
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
|
#include "guiutils.h"
|
||||||
#include "pathut.h"
|
#include "pathut.h"
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
|
|
||||||
@ -170,7 +171,7 @@ void ResListBase::resultPageBack()
|
|||||||
{
|
{
|
||||||
if (m_winfirst <= 0)
|
if (m_winfirst <= 0)
|
||||||
return;
|
return;
|
||||||
m_winfirst -= 2 * prefs_respagesize;
|
m_winfirst -= 2 * prefs.respagesize;
|
||||||
showResultPage();
|
showResultPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +193,7 @@ void ResListBase::showResultPage()
|
|||||||
|
|
||||||
// If we are already on the last page, nothing to do:
|
// If we are already on the last page, nothing to do:
|
||||||
if (m_winfirst >= 0 &&
|
if (m_winfirst >= 0 &&
|
||||||
(m_winfirst + prefs_respagesize > resCnt)) {
|
(m_winfirst + prefs.respagesize > resCnt)) {
|
||||||
emit nextPageAvailable(false);
|
emit nextPageAvailable(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -202,13 +203,13 @@ void ResListBase::showResultPage()
|
|||||||
emit prevPageAvailable(false);
|
emit prevPageAvailable(false);
|
||||||
} else {
|
} else {
|
||||||
emit prevPageAvailable(true);
|
emit prevPageAvailable(true);
|
||||||
m_winfirst += prefs_respagesize;
|
m_winfirst += prefs.respagesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gotone = false;
|
bool gotone = false;
|
||||||
reslistTE->clear();
|
reslistTE->clear();
|
||||||
|
|
||||||
int last = MIN(resCnt-m_winfirst, prefs_respagesize);
|
int last = MIN(resCnt-m_winfirst, prefs.respagesize);
|
||||||
|
|
||||||
|
|
||||||
// Insert results if any in result list window. We have to send
|
// Insert results if any in result list window. We have to send
|
||||||
@ -256,7 +257,7 @@ void ResListBase::showResultPage()
|
|||||||
result = "<p>";
|
result = "<p>";
|
||||||
|
|
||||||
string img_name;
|
string img_name;
|
||||||
if (prefs_showicons) {
|
if (prefs.showicons) {
|
||||||
string iconpath;
|
string iconpath;
|
||||||
string iconname = rclconfig->getMimeIconName(doc.mimetype,
|
string iconname = rclconfig->getMimeIconName(doc.mimetype,
|
||||||
&iconpath);
|
&iconpath);
|
||||||
@ -310,7 +311,7 @@ void ResListBase::showResultPage()
|
|||||||
/*"<img align=\"left\" source=\"myimage\">"*/
|
/*"<img align=\"left\" source=\"myimage\">"*/
|
||||||
"<b>No results found</b>"
|
"<b>No results found</b>"
|
||||||
"<br>"));
|
"<br>"));
|
||||||
m_winfirst -= prefs_respagesize;
|
m_winfirst -= prefs.respagesize;
|
||||||
if (m_winfirst < 0)
|
if (m_winfirst < 0)
|
||||||
m_winfirst = -1;
|
m_winfirst = -1;
|
||||||
}
|
}
|
||||||
@ -331,7 +332,7 @@ void ResListBase::showResultPage()
|
|||||||
|
|
||||||
if (m_winfirst < 0 ||
|
if (m_winfirst < 0 ||
|
||||||
(m_winfirst >= 0 &&
|
(m_winfirst >= 0 &&
|
||||||
m_winfirst + prefs_respagesize >= resCnt)) {
|
m_winfirst + prefs.respagesize >= resCnt)) {
|
||||||
emit nextPageAvailable(false);
|
emit nextPageAvailable(false);
|
||||||
} else {
|
} else {
|
||||||
emit nextPageAvailable(true);
|
emit nextPageAvailable(true);
|
||||||
|
|||||||
@ -15,18 +15,19 @@
|
|||||||
#include "qmessagebox.h"
|
#include "qmessagebox.h"
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
|
#include "guiutils.h"
|
||||||
|
|
||||||
void UIPrefsDialog::init()
|
void UIPrefsDialog::init()
|
||||||
{
|
{
|
||||||
// Entries per result page spinbox
|
// Entries per result page spinbox
|
||||||
pageLenSB->setValue(prefs_respagesize);
|
pageLenSB->setValue(prefs.respagesize);
|
||||||
// Show icons checkbox
|
// Show icons checkbox
|
||||||
useIconsCB->setChecked(prefs_showicons);
|
useIconsCB->setChecked(prefs.showicons);
|
||||||
// Result list font family and size
|
// Result list font family and size
|
||||||
reslistFontFamily = prefs_reslistfontfamily;
|
reslistFontFamily = prefs.reslistfontfamily;
|
||||||
reslistFontSize = prefs_reslistfontsize;
|
reslistFontSize = prefs.reslistfontsize;
|
||||||
QString s;
|
QString s;
|
||||||
if (prefs_reslistfontfamily.length() == 0) {
|
if (prefs.reslistfontfamily.length() == 0) {
|
||||||
reslistFontPB->setText(this->font().family() + "-" +
|
reslistFontPB->setText(this->font().family() + "-" +
|
||||||
s.setNum(this->font().pointSize()));
|
s.setNum(this->font().pointSize()));
|
||||||
} else {
|
} else {
|
||||||
@ -57,7 +58,7 @@ void UIPrefsDialog::init()
|
|||||||
insertItem(QString::fromAscii(it->c_str(), it->length()));
|
insertItem(QString::fromAscii(it->c_str(), it->length()));
|
||||||
i++;
|
i++;
|
||||||
if (cur == -1) {
|
if (cur == -1) {
|
||||||
if (!strcmp(prefs_queryStemLang.ascii(), it->c_str()))
|
if (!strcmp(prefs.queryStemLang.ascii(), it->c_str()))
|
||||||
cur = i;
|
cur = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,9 +80,9 @@ void UIPrefsDialog::showFontDialog()
|
|||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
QFont font;
|
QFont font;
|
||||||
if (prefs_reslistfontfamily.length()) {
|
if (prefs.reslistfontfamily.length()) {
|
||||||
font.setFamily(prefs_reslistfontfamily);
|
font.setFamily(prefs.reslistfontfamily);
|
||||||
font.setPointSize(prefs_reslistfontsize);
|
font.setPointSize(prefs.reslistfontsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
font = QFontDialog::getFont(&ok, font, this );
|
font = QFontDialog::getFont(&ok, font, this );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user