Switch to unified view

a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp
...
...
31
using std::pair;
31
using std::pair;
32
#endif /* NO_NAMESPACES */
32
#endif /* NO_NAMESPACES */
33
33
34
#include <qapplication.h>
34
#include <qapplication.h>
35
#include <qmessagebox.h>
35
#include <qmessagebox.h>
36
36
#if (QT_VERSION < 0x040000)
37
#if (QT_VERSION < 0x040000)
37
#include <qcstring.h>
38
#include <qcstring.h>
38
#include <qpopupmenu.h>
39
#include <qpopupmenu.h>
39
#include <qradiobutton.h>
40
#include <qradiobutton.h>
40
#include <qbuttongroup.h>
41
#include <qbuttongroup.h>
42
#include <qfiledialog.h>
43
#else
44
#include <q3filedialog.h>
45
#define QFileDialog  Q3FileDialog
41
#endif
46
#endif
47
42
#include <qtabwidget.h>
48
#include <qtabwidget.h>
43
#include <qtimer.h>
49
#include <qtimer.h>
44
#include <qstatusbar.h>
50
#include <qstatusbar.h>
45
#include <qwindowdefs.h>
51
#include <qwindowdefs.h>
46
#include <qcheckbox.h>
52
#include <qcheckbox.h>
...
...
194
        this, SLOT(enableNextPage(bool)));
200
        this, SLOT(enableNextPage(bool)));
195
    connect(resList, SIGNAL(prevPageAvailable(bool)), 
201
    connect(resList, SIGNAL(prevPageAvailable(bool)), 
196
        this, SLOT(enablePrevPage(bool)));
202
        this, SLOT(enablePrevPage(bool)));
197
    connect(resList, SIGNAL(docEditClicked(int)), 
203
    connect(resList, SIGNAL(docEditClicked(int)), 
198
        this, SLOT(startNativeViewer(int)));
204
        this, SLOT(startNativeViewer(int)));
205
    connect(resList, SIGNAL(docSaveToFileClicked(int)), 
206
      this, SLOT(saveDocToFile(int)));
199
    connect(resList, SIGNAL(editRequested(Rcl::Doc)), 
207
    connect(resList, SIGNAL(editRequested(Rcl::Doc)), 
200
        this, SLOT(startNativeViewer(Rcl::Doc)));
208
        this, SLOT(startNativeViewer(Rcl::Doc)));
201
209
202
    connect(resList, SIGNAL(docPreviewClicked(int, int)), 
210
    connect(resList, SIGNAL(docPreviewClicked(int, int)), 
203
        this, SLOT(startPreview(int, int)));
211
        this, SLOT(startPreview(int, int)));
...
...
791
    QString text = sSearch->queryText->currentText();
799
    QString text = sSearch->queryText->currentText();
792
    text += QString::fromLatin1(" ") + term;
800
    text += QString::fromLatin1(" ") + term;
793
    sSearch->queryText->setEditText(text);
801
    sSearch->queryText->setEditText(text);
794
}
802
}
795
803
804
void RclMain::saveDocToFile(int docnum)
805
{
806
    Rcl::Doc doc;
807
    if (!resList->getDoc(docnum, doc)) {
808
  QMessageBox::warning(0, "Recoll",
809
               tr("Cannot retrieve document info" 
810
              " from database"));
811
  return;
812
    }
813
    string fn = urltolocalpath(doc.url);
814
    QString s = 
815
  QFileDialog::getSaveFileName(path_home().c_str(),
816
                   "",  this,
817
                   tr("Save file dialog"),
818
                   tr("Choose a file name to save under"));
819
    string tofile((const char *)s.toLocal8Bit());
820
    TempFile temp; // not used
821
    if (!FileInterner::idocToFile(temp, tofile, rclconfig, fn, 
822
                doc.ipath, doc.mimetype)) {
823
  QMessageBox::warning(0, "Recoll",
824
               tr("Cannot extract document or create "
825
              "temporary file"));
826
  return;
827
    }
828
}
829
796
void RclMain::startNativeViewer(int docnum)
830
void RclMain::startNativeViewer(int docnum)
797
{
831
{
798
    Rcl::Doc doc;
832
    Rcl::Doc doc;
799
    if (!resList->getDoc(docnum, doc)) {
833
    if (!resList->getDoc(docnum, doc)) {
800
    QMessageBox::warning(0, "Recoll",
834
    QMessageBox::warning(0, "Recoll",
...
...
877
    url = url_encode(doc.url, 7);
911
    url = url_encode(doc.url, 7);
878
    } else {
912
    } else {
879
    // There is an ipath and the command does not know about
913
    // There is an ipath and the command does not know about
880
    // them. We need a temp file.
914
    // them. We need a temp file.
881
    TempFile temp;
915
    TempFile temp;
882
    if (!FileInterner::idocTempFile(temp, rclconfig, fn, 
916
    if (!FileInterner::idocToFile(temp, string(), rclconfig, fn, 
883
                    doc.ipath, doc.mimetype)) {
917
                    doc.ipath, doc.mimetype)) {
884
        QMessageBox::warning(0, "Recoll",
918
        QMessageBox::warning(0, "Recoll",
885
                 tr("Cannot extract document or create "
919
                 tr("Cannot extract document or create "
886
                    "temporary file"));
920
                    "temporary file"));
887
        return;
921
        return;