a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.16 2006-12-18 12:05:29 dockes Exp $ (C) 2005 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.17 2006-12-20 13:55:46 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
...
...
122
        this, SLOT(enablePrevPage(bool)));
122
        this, SLOT(enablePrevPage(bool)));
123
    connect(resList, SIGNAL(docEditClicked(int)), 
123
    connect(resList, SIGNAL(docEditClicked(int)), 
124
        this, SLOT(startNativeViewer(int)));
124
        this, SLOT(startNativeViewer(int)));
125
    connect(resList, SIGNAL(docPreviewClicked(int, int)), 
125
    connect(resList, SIGNAL(docPreviewClicked(int, int)), 
126
        this, SLOT(startPreview(int, int)));
126
        this, SLOT(startPreview(int, int)));
127
128
    connect(resList, SIGNAL(previewRequested(Rcl::Doc)), 
129
      this, SLOT(startPreview(Rcl::Doc)));
127
130
128
    connect(fileExitAction, SIGNAL(activated() ), this, SLOT(fileExit() ) );
131
    connect(fileExitAction, SIGNAL(activated() ), this, SLOT(fileExit() ) );
129
    connect(fileStart_IndexingAction, SIGNAL(activated()), 
132
    connect(fileStart_IndexingAction, SIGNAL(activated()), 
130
        this, SLOT(startIndexing()));
133
        this, SLOT(startIndexing()));
131
    connect(helpAbout_RecollAction, SIGNAL(activated()), 
134
    connect(helpAbout_RecollAction, SIGNAL(activated()), 
...
...
532
    g_dynconf->enterDoc(fn, doc.ipath);
535
    g_dynconf->enterDoc(fn, doc.ipath);
533
    if (!curPreview->loadFileInCurrentTab(fn, st.st_size, doc, docnum))
536
    if (!curPreview->loadFileInCurrentTab(fn, st.st_size, doc, docnum))
534
    curPreview->closeCurrentTab();
537
    curPreview->closeCurrentTab();
535
}
538
}
536
539
540
/** 
541
 * Open a preview window for a given document, no linking to result list
542
 *
543
 * This is used to show ie parent documents, which have no corresponding
544
 * entry in the result list.
545
 * 
546
 */
547
void RclMain::startPreview(Rcl::Doc doc)
548
{
549
    // Check file exists in file system
550
    string fn = urltolocalpath(doc.url);
551
    struct stat st;
552
    if (stat(fn.c_str(), &st) < 0) {
553
  QMessageBox::warning(0, "Recoll", tr("Cannot access document file: ") +
554
               fn.c_str());
555
  return;
556
    }
557
    Preview *preview = new Preview(0);
558
    if (preview == 0) {
559
  QMessageBox::warning(0, tr("Warning"), 
560
               tr("Can't create preview window"),
561
               QMessageBox::Ok, 
562
               QMessageBox::NoButton);
563
  return;
564
    }
565
    RefCntr<Rcl::SearchData> searchdata(new Rcl::SearchData(Rcl::SCLT_AND));
566
    preview->setSId(0, searchdata);
567
    connect(preview, SIGNAL(wordSelect(QString)),
568
      this, SLOT(ssearchAddTerm(QString)));
569
    g_dynconf->enterDoc(fn, doc.ipath);
570
    preview->show();
571
    if (!preview->loadFileInCurrentTab(fn, st.st_size, doc, 0))
572
  preview->closeCurrentTab();
573
}
574
537
// Show next document from result list in current preview tab
575
// Show next document from result list in current preview tab
538
void RclMain::previewNextInTab(int sid, int docnum)
576
void RclMain::previewNextInTab(int sid, int docnum)
539
{
577
{
540
    LOGDEB(("RclMain::previewNextInTab  sid %d docnum %d, m_sid %d\n", 
578
    LOGDEB(("RclMain::previewNextInTab  sid %d docnum %d, m_sid %d\n", 
541
        sid, docnum, m_searchId));
579
        sid, docnum, m_searchId));