Switch to unified view

a/src/qtgui/rclmain.cpp b/src/qtgui/rclmain.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.23 2006-04-20 09:20:09 dockes Exp $ (C) 2005 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.24 2006-04-22 06:27:37 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
...
...
93
    }
93
    }
94
    string historyfile = path_cat(rclconfig->getConfDir(), "history");
94
    string historyfile = path_cat(rclconfig->getConfDir(), "history");
95
    m_history = new RclDHistory(historyfile);
95
    m_history = new RclDHistory(historyfile);
96
    connect(sSearch, SIGNAL(startSearch(Rcl::AdvSearchData)), 
96
    connect(sSearch, SIGNAL(startSearch(Rcl::AdvSearchData)), 
97
        this, SLOT(startAdvSearch(Rcl::AdvSearchData)));
97
        this, SLOT(startAdvSearch(Rcl::AdvSearchData)));
98
    connect(sSearch, SIGNAL(clearSearch()), 
98
    connect(sSearch, SIGNAL(clearSearch()), resList, SLOT(resetSearch()));
99
      resList, SLOT(resetSearch()));
99
    connect(resList, SIGNAL(docExpand(int)), this, SLOT(docExpand(int)));
100
100
101
    nextPageAction->setIconSet(createIconSet("nextpage.png"));
101
    nextPageAction->setIconSet(createIconSet("nextpage.png"));
102
    prevPageAction->setIconSet(createIconSet("prevpage.png"));
102
    prevPageAction->setIconSet(createIconSet("prevpage.png"));
103
}
103
}
104
104
...
...
287
    exit(1);
287
    exit(1);
288
    }
288
    }
289
289
290
    resList->resetSearch();
290
    resList->resetSearch();
291
291
292
    int qopts = 0;
293
    if (prefs.queryBuildAbstract && !sdata.fileNameOnly()) {
294
  qopts |= Rcl::Db::QO_BUILD_ABSTRACT;
295
  if (prefs.queryReplaceAbstract)
296
      qopts |= Rcl::Db::QO_REPLACE_ABSTRACT;
297
    }
298
    if (!prefs.queryStemLang.length() == 0)
299
  qopts |= Rcl::Db::QO_STEM;
300
292
    if (!rcldb->setQuery(sdata, prefs.queryStemLang.length() > 0 ? 
301
    if (!rcldb->setQuery(sdata, qopts, prefs.queryStemLang.ascii()))
293
           Rcl::Db::QO_STEM : Rcl::Db::QO_NONE, 
294
           prefs.queryStemLang.ascii()))
295
    return;
302
    return;
296
    curPreview = 0;
303
    curPreview = 0;
297
304
298
    DocSequence *docsource;
305
    DocSequence *docsource;
299
    if (sortspecs.sortwidth > 0) {
306
    if (sortspecs.sortwidth > 0) {
...
...
407
        return;
414
        return;
408
    }
415
    }
409
    curPreview->setCaption(resList->getDescription());
416
    curPreview->setCaption(resList->getDescription());
410
    connect(curPreview, SIGNAL(previewClosed(QWidget *)), 
417
    connect(curPreview, SIGNAL(previewClosed(QWidget *)), 
411
        this, SLOT(previewClosed(QWidget *)));
418
        this, SLOT(previewClosed(QWidget *)));
419
  connect(curPreview, SIGNAL(wordSelect(QString)),
420
      this, SLOT(ssearchAddTerm(QString)));
412
    curPreview->show();
421
    curPreview->show();
413
    } else {
422
    } else {
414
    if (curPreview->makeDocCurrent(fn, doc)) {
423
    if (curPreview->makeDocCurrent(fn, doc)) {
415
        // Already there
424
        // Already there
416
        return;
425
        return;
...
...
418
    (void)curPreview->addEditorTab();
427
    (void)curPreview->addEditorTab();
419
    }
428
    }
420
    m_history->enterDocument(fn, doc.ipath);
429
    m_history->enterDocument(fn, doc.ipath);
421
    if (!curPreview->loadFileInCurrentTab(fn, st.st_size, doc))
430
    if (!curPreview->loadFileInCurrentTab(fn, st.st_size, doc))
422
    curPreview->closeCurrentTab();
431
    curPreview->closeCurrentTab();
432
}
433
434
void RclMain::ssearchAddTerm(QString term)
435
{
436
    QString text = sSearch->queryText->text();
437
    text += QString::fromLatin1(" ") + term;
438
    sSearch->queryText->setText(text);
423
}
439
}
424
440
425
void RclMain::startNativeViewer(int docnum)
441
void RclMain::startNativeViewer(int docnum)
426
{
442
{
427
    Rcl::Doc doc;
443
    Rcl::Doc doc;
...
...
493
    msg += prefs.htmlBrowser;
509
    msg += prefs.htmlBrowser;
494
    statusBar()->message(msg, 3000);
510
    statusBar()->message(msg, 3000);
495
    startHelpBrowser();
511
    startHelpBrowser();
496
}
512
}
497
513
514
void RclMain::docExpand(int docnum)
515
{
516
    Rcl::Doc doc;
517
    if (!resList->getDoc(docnum, doc))
518
  return;
519
    list<string> terms;
520
    terms = rcldb->expand(doc);
521
    QString text = sSearch->queryText->text();
522
    for (list<string>::iterator it = terms.begin(); it != terms.end(); it++) {
523
  text += QString::fromLatin1(" \"") +
524
      QString::fromUtf8((*it).c_str()) + QString::fromLatin1("\"");
525
    }
526
    sSearch->queryText->setText(text);
527
    sSearch->setAnyTermMode();
528
    sSearch->startSimpleSearch();
529
}
530
498
void RclMain::showDocHistory()
531
void RclMain::showDocHistory()
499
{
532
{
500
    LOGDEB(("RclMain::showDocHistory\n"));
533
    LOGDEB(("RclMain::showDocHistory\n"));
501
    resList->resetSearch();
534
    resList->resetSearch();
502
    curPreview = 0;
535
    curPreview = 0;