Switch to unified view

a/src/qtgui/preview_w.cpp b/src/qtgui/preview_w.cpp
...
...
33
#include <qprinter.h>
33
#include <qprinter.h>
34
#include <qprintdialog.h>
34
#include <qprintdialog.h>
35
#include <qscrollbar.h>
35
#include <qscrollbar.h>
36
#include <qmenu.h>
36
#include <qmenu.h>
37
#include <qtextedit.h>
37
#include <qtextedit.h>
38
#include <qtextbrowser.h>
38
#include <qprogressdialog.h>
39
#include <qprogressdialog.h>
39
#include <qevent.h>
40
#include <qevent.h>
40
#include <qlabel.h>
41
#include <qlabel.h>
41
#include <qlineedit.h>
42
#include <qlineedit.h>
42
#include <qcheckbox.h>
43
#include <qcheckbox.h>
...
...
730
731
731
    FileInterner interner(idoc, theconfig, tmpdir, 
732
    FileInterner interner(idoc, theconfig, tmpdir, 
732
                              FileInterner::FIF_forPreview);
733
                              FileInterner::FIF_forPreview);
733
    FIMissingStore mst;
734
    FIMissingStore mst;
734
    interner.setMissingStore(&mst);
735
    interner.setMissingStore(&mst);
735
  // We don't set the interner's target mtype to html because we
736
  // Even when previewHtml is set, we don't set the interner's
736
  // do want the html filter to do its work: we won't use the
737
  // target mtype to html because we do want the html filter to
737
  // text, but we need the conversion to utf-8
738
  // do its work: we won't use the text/plain, but we want the
738
  // interner.setTargetMType("text/html");
739
  // text/html to be converted to utf-8 (for highlight processing)
739
    try {
740
    try {
740
            string ipath = idoc.ipath;
741
            string ipath = idoc.ipath;
741
        FileInterner::Status ret = interner.internfile(out, ipath);
742
        FileInterner::Status ret = interner.internfile(out, ipath);
742
        if (ret == FileInterner::FIDone || ret == FileInterner::FIAgain) {
743
        if (ret == FileInterner::FIDone || ret == FileInterner::FIAgain) {
743
        // FIAgain is actually not nice here. It means that the record
744
        // FIAgain is actually not nice here. It means that the record
...
...
881
882
882
    // Final text is produced in chunks so that we can display the top
883
    // Final text is produced in chunks so that we can display the top
883
    // while still inserting at bottom
884
    // while still inserting at bottom
884
    list<QString> qrichlst;
885
    list<QString> qrichlst;
885
    PreviewTextEdit *editor = currentEditor();
886
    PreviewTextEdit *editor = currentEditor();
887
888
    // For an actual html file, if we want to have the images and
889
    // style loaded in the preview, we need to set the search
890
    // path. Not too sure this is a good idea as I find them rather
891
    // distracting when looking for text, esp. with qtextedit
892
    // relatively limited html support (text sometimes get hidden by
893
    // images).
894
#if 0
895
    string path = fileurltolocalpath(idoc.url);
896
    if (!path.empty()) {
897
  path = path_getfather(path);
898
  QStringList paths(QString::fromLocal8Bit(path.c_str()));
899
  editor->setSearchPaths(paths);
900
    }
901
#endif
902
886
    editor->setHtml("");
903
    editor->setHtml("");
887
    editor->m_format = Qt::RichText;
904
    editor->m_format = Qt::RichText;
888
    bool inputishtml = !fdoc.mimetype.compare("text/html");
905
    bool inputishtml = !fdoc.mimetype.compare("text/html");
889
906
890
#if 0
907
#if 0
...
...
1071
    LOGDEB(("LoadFileInCurrentTab: returning true\n"));
1088
    LOGDEB(("LoadFileInCurrentTab: returning true\n"));
1072
    return true;
1089
    return true;
1073
}
1090
}
1074
1091
1075
PreviewTextEdit::PreviewTextEdit(QWidget* parent, const char* nm, Preview *pv) 
1092
PreviewTextEdit::PreviewTextEdit(QWidget* parent, const char* nm, Preview *pv) 
1076
    : QTextEdit(parent), m_preview(pv), 
1093
    : QTextBrowser(parent), m_preview(pv), 
1077
      m_plaintorich(new PlainToRichQtPreview()), 
1094
      m_plaintorich(new PlainToRichQtPreview()), 
1078
      m_dspflds(false), m_docnum(-1) 
1095
      m_dspflds(false), m_docnum(-1) 
1079
{
1096
{
1080
    setContextMenuPolicy(Qt::CustomContextMenu);
1097
    setContextMenuPolicy(Qt::CustomContextMenu);
1081
    setObjectName(nm);
1098
    setObjectName(nm);
1082
    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
1099
    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
1083
        this, SLOT(createPopupMenu(const QPoint&)));
1100
        this, SLOT(createPopupMenu(const QPoint&)));
1101
    setOpenExternalLinks(false);
1102
    setOpenLinks(false);
1084
}
1103
}
1085
1104
1086
PreviewTextEdit::~PreviewTextEdit()
1105
PreviewTextEdit::~PreviewTextEdit()
1087
{
1106
{
1088
    delete m_plaintorich;
1107
    delete m_plaintorich;