|
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.61 2007-06-08 16:47:19 dockes Exp $ (C) 2005 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: main.cpp,v 1.62 2007-10-05 08:03:01 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
|
|
... |
|
... |
146 |
static const char *thisprog;
|
146 |
static const char *thisprog;
|
147 |
static int op_flags;
|
147 |
static int op_flags;
|
148 |
#define OPT_MOINS 0x1
|
148 |
#define OPT_MOINS 0x1
|
149 |
#define OPT_h 0x4
|
149 |
#define OPT_h 0x4
|
150 |
#define OPT_c 0x20
|
150 |
#define OPT_c 0x20
|
|
|
151 |
#define OPT_q 0x40
|
|
|
152 |
#define OPT_O 0x80
|
|
|
153 |
#define OPT_L 0x100
|
|
|
154 |
#define OPT_F 0x200
|
|
|
155 |
|
151 |
static const char usage [] =
|
156 |
static const char usage [] =
|
152 |
"\n"
|
157 |
"\n"
|
153 |
"recoll [-h] [-c <configdir>]\n"
|
158 |
"recoll [-h] [-c <configdir>]\n"
|
154 |
" -h : Print help and exit\n"
|
159 |
" -h : Print help and exit\n"
|
155 |
" -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR\n"
|
160 |
" -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR\n"
|
|
|
161 |
" -q 'query' [-o|l|f]: search query to be executed on startup as if entered\n"
|
|
|
162 |
" into simple search. The default mode is AND (but see modifier options)\n"
|
|
|
163 |
" In most cases, the query string should be quoted with single-quotes to\n"
|
|
|
164 |
" avoid shell interpretation\n"
|
|
|
165 |
" -L : the query will be interpreted as a query language string\n"
|
|
|
166 |
" -O : the query will be interpreted as an OR query\n"
|
|
|
167 |
" -F : the query will be interpreted as a filename search\n"
|
156 |
;
|
168 |
;
|
157 |
static void
|
169 |
static void
|
158 |
Usage(void)
|
170 |
Usage(void)
|
159 |
{
|
171 |
{
|
160 |
FILE *fp = (op_flags & OPT_h) ? stdout : stderr;
|
172 |
FILE *fp = (op_flags & OPT_h) ? stdout : stderr;
|
|
... |
|
... |
176 |
QApplication app(argc, argv);
|
188 |
QApplication app(argc, argv);
|
177 |
#endif
|
189 |
#endif
|
178 |
|
190 |
|
179 |
// fprintf(stderr, "Application created\n");
|
191 |
// fprintf(stderr, "Application created\n");
|
180 |
string a_config;
|
192 |
string a_config;
|
|
|
193 |
string qstring;
|
|
|
194 |
|
181 |
thisprog = argv[0];
|
195 |
thisprog = argv[0];
|
182 |
argc--; argv++;
|
196 |
argc--; argv++;
|
183 |
|
197 |
|
184 |
while (argc > 0 && **argv == '-') {
|
198 |
while (argc > 0 && **argv == '-') {
|
185 |
(*argv)++;
|
199 |
(*argv)++;
|
|
... |
|
... |
188 |
while (**argv)
|
202 |
while (**argv)
|
189 |
switch (*(*argv)++) {
|
203 |
switch (*(*argv)++) {
|
190 |
case 'c': op_flags |= OPT_c; if (argc < 2) Usage();
|
204 |
case 'c': op_flags |= OPT_c; if (argc < 2) Usage();
|
191 |
a_config = *(++argv);
|
205 |
a_config = *(++argv);
|
192 |
argc--; goto b1;
|
206 |
argc--; goto b1;
|
|
|
207 |
case 'F': op_flags |= OPT_F; break;
|
193 |
case 'h': op_flags |= OPT_h; Usage();break;
|
208 |
case 'h': op_flags |= OPT_h; Usage();break;
|
|
|
209 |
case 'L': op_flags |= OPT_L; break;
|
|
|
210 |
case 'O': op_flags |= OPT_O; break;
|
|
|
211 |
case 'q': op_flags |= OPT_q; if (argc < 2) Usage();
|
|
|
212 |
qstring = *(++argv);
|
|
|
213 |
argc--; goto b1;
|
194 |
}
|
214 |
}
|
195 |
b1: argc--; argv++;
|
215 |
b1: argc--; argv++;
|
196 |
}
|
216 |
}
|
197 |
|
217 |
|
198 |
// Translation file for Qt
|
218 |
// Translation file for Qt
|
|
... |
|
... |
324 |
mainWindow, SLOT(periodic100()));
|
344 |
mainWindow, SLOT(periodic100()));
|
325 |
timer->start(100);
|
345 |
timer->start(100);
|
326 |
app.connect(&app, SIGNAL(aboutToQuit()), mainWindow, SLOT(close()));
|
346 |
app.connect(&app, SIGNAL(aboutToQuit()), mainWindow, SLOT(close()));
|
327 |
|
347 |
|
328 |
start_idxthread(*rclconfig);
|
348 |
start_idxthread(*rclconfig);
|
329 |
|
349 |
if (op_flags & OPT_q) {
|
|
|
350 |
SSearch::SSearchType stype;
|
|
|
351 |
if (op_flags & OPT_O) {
|
|
|
352 |
stype = SSearch::SST_ANY;
|
|
|
353 |
} else if (op_flags & OPT_F) {
|
|
|
354 |
stype = SSearch::SST_FNM;
|
|
|
355 |
} else if (op_flags & OPT_L) {
|
|
|
356 |
stype = SSearch::SST_LANG;
|
|
|
357 |
} else {
|
|
|
358 |
stype = SSearch::SST_ALL;
|
|
|
359 |
}
|
|
|
360 |
mainWindow->sSearch->searchTypCMB->setCurrentItem(int(stype));
|
|
|
361 |
mainWindow->
|
|
|
362 |
sSearch->setSearchString(QString::fromUtf8(qstring.c_str()));
|
|
|
363 |
QTimer::singleShot(0, mainWindow->sSearch, SLOT(startSimpleSearch()));
|
|
|
364 |
}
|
330 |
// fprintf(stderr, "Go\n");
|
365 |
// fprintf(stderr, "Go\n");
|
331 |
// Let's go
|
366 |
// Let's go
|
332 |
return app.exec();
|
367 |
return app.exec();
|
333 |
}
|
368 |
}
|
334 |
|
369 |
|