|
a/src/qtgui/main.cpp |
|
b/src/qtgui/main.cpp |
|
... |
|
... |
314 |
if (prefs.mainwidth > 100) {
|
314 |
if (prefs.mainwidth > 100) {
|
315 |
QSize s(prefs.mainwidth, prefs.mainheight);
|
315 |
QSize s(prefs.mainwidth, prefs.mainheight);
|
316 |
mainWindow->resize(s);
|
316 |
mainWindow->resize(s);
|
317 |
}
|
317 |
}
|
318 |
|
318 |
|
319 |
mainWindow->sSearch->searchTypCMB->setCurrentItem(prefs.ssearchTyp);
|
|
|
320 |
mainWindow->sSearch->searchTypeChanged(prefs.ssearchTyp);
|
|
|
321 |
string dbdir = rclconfig->getDbDir();
|
319 |
string dbdir = rclconfig->getDbDir();
|
322 |
if (dbdir.empty()) {
|
320 |
if (dbdir.empty()) {
|
323 |
// Note: this will have to be replaced by a call to a
|
|
|
324 |
// configuration buildin dialog for initial configuration
|
|
|
325 |
QMessageBox::critical(0, "Recoll",
|
321 |
QMessageBox::critical(0, "Recoll",
|
326 |
app.translate("Main",
|
322 |
app.translate("Main",
|
327 |
"No db directory in configuration"));
|
323 |
"No db directory in configuration"));
|
328 |
exit(1);
|
324 |
exit(1);
|
329 |
}
|
325 |
}
|
330 |
|
326 |
|
331 |
rcldb = new Rcl::Db(rclconfig);
|
327 |
rcldb = new Rcl::Db(rclconfig);
|
332 |
|
328 |
|
333 |
bool needindexconfig = false;
|
|
|
334 |
if (!maybeOpenDb(reason)) {
|
|
|
335 |
|
|
|
336 |
switch (QMessageBox::
|
|
|
337 |
#if (QT_VERSION >= 0x030200)
|
|
|
338 |
question
|
|
|
339 |
#else
|
|
|
340 |
information
|
|
|
341 |
#endif
|
|
|
342 |
(0, "Recoll",
|
|
|
343 |
app.translate("Main", "Could not open database in ") +
|
|
|
344 |
QString::fromLocal8Bit(dbdir.c_str()) +
|
|
|
345 |
app.translate("Main",
|
|
|
346 |
".\n"
|
|
|
347 |
"Click Cancel if you want to edit the configuration file before indexation starts, or Ok to let it proceed."),
|
|
|
348 |
"Ok", "Cancel", 0, 0)) {
|
|
|
349 |
|
|
|
350 |
case 0: // Ok: indexing is going to start.
|
|
|
351 |
start_indexing(true);
|
|
|
352 |
break;
|
|
|
353 |
|
|
|
354 |
case 1: // Cancel
|
|
|
355 |
needindexconfig = true;
|
|
|
356 |
break;
|
|
|
357 |
}
|
|
|
358 |
}
|
|
|
359 |
|
|
|
360 |
mainWindow->show();
|
329 |
mainWindow->show();
|
361 |
if (needindexconfig) {
|
330 |
QTimer::singleShot(0, mainWindow, SLOT(initDbOpen()));
|
362 |
startIndexingAfterConfig = 1;
|
|
|
363 |
mainWindow->showIndexConfig();
|
|
|
364 |
} else {
|
|
|
365 |
if (prefs.startWithAdvSearchOpen)
|
|
|
366 |
mainWindow->showAdvSearchDialog();
|
|
|
367 |
if (prefs.startWithSortToolOpen)
|
|
|
368 |
mainWindow->showSortDialog();
|
|
|
369 |
}
|
|
|
370 |
|
331 |
|
371 |
// Connect exit handlers etc.. Beware, apparently this must come
|
332 |
// Connect exit handlers etc.. Beware, apparently this must come
|
372 |
// after mainWindow->show() , else the QMessageBox above never
|
333 |
// after mainWindow->show()?
|
373 |
// returns.
|
|
|
374 |
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
334 |
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
375 |
app.connect(&app, SIGNAL(aboutToQuit()), mainWindow, SLOT(close()));
|
335 |
app.connect(&app, SIGNAL(aboutToQuit()), mainWindow, SLOT(close()));
|
376 |
|
336 |
|
377 |
// Start the indexing thread. It will immediately go to sleep waiting for
|
337 |
// Start the indexing thread. It will immediately go to sleep waiting for
|
378 |
// something to do.
|
338 |
// something to do.
|
379 |
start_idxthread(*rclconfig);
|
339 |
start_idxthread(*rclconfig);
|
380 |
|
340 |
|
|
|
341 |
mainWindow->sSearch->searchTypCMB->setCurrentItem(prefs.ssearchTyp);
|
|
|
342 |
mainWindow->sSearch->searchTypeChanged(prefs.ssearchTyp);
|
381 |
if (op_flags & OPT_q) {
|
343 |
if (op_flags & OPT_q) {
|
382 |
SSearch::SSearchType stype;
|
344 |
SSearch::SSearchType stype;
|
383 |
if (op_flags & OPT_o) {
|
345 |
if (op_flags & OPT_o) {
|
384 |
stype = SSearch::SST_ANY;
|
346 |
stype = SSearch::SST_ANY;
|
385 |
} else if (op_flags & OPT_f) {
|
347 |
} else if (op_flags & OPT_f) {
|
|
... |
|
... |
390 |
stype = SSearch::SST_LANG;
|
352 |
stype = SSearch::SST_LANG;
|
391 |
}
|
353 |
}
|
392 |
mainWindow->sSearch->searchTypCMB->setCurrentItem(int(stype));
|
354 |
mainWindow->sSearch->searchTypCMB->setCurrentItem(int(stype));
|
393 |
mainWindow->
|
355 |
mainWindow->
|
394 |
sSearch->setSearchString(QString::fromLocal8Bit(question.c_str()));
|
356 |
sSearch->setSearchString(QString::fromLocal8Bit(question.c_str()));
|
395 |
QTimer::singleShot(0, mainWindow->sSearch, SLOT(startSimpleSearch()));
|
|
|
396 |
}
|
357 |
}
|
397 |
// fprintf(stderr, "Go\n");
|
|
|
398 |
// Let's go
|
|
|
399 |
return app.exec();
|
358 |
return app.exec();
|
400 |
}
|
359 |
}
|
401 |
|
360 |
|