|
a/src/qtgui/preview_w.cpp |
|
b/src/qtgui/preview_w.cpp |
|
... |
|
... |
78 |
if (m_inputhtml) {
|
78 |
if (m_inputhtml) {
|
79 |
return snull;
|
79 |
return snull;
|
80 |
} else {
|
80 |
} else {
|
81 |
if (prefs.previewPlainPre) {
|
81 |
if (prefs.previewPlainPre) {
|
82 |
m_eolbr = false;
|
82 |
m_eolbr = false;
|
83 |
return string("<qt><head><title></title></head><body><pre>");
|
83 |
return string("<qt><head><title></title></head><body>"
|
|
|
84 |
"<pre>");
|
|
|
85 |
// Note we could also use the following for line-folding instead of <br>s
|
|
|
86 |
// This would be possible without recomputing the whole text, much better perfs
|
|
|
87 |
// for toggling wrap/no-wrap
|
|
|
88 |
// "<pre style=\"white-space: pre-wrap\">");
|
84 |
} else {
|
89 |
} else {
|
85 |
m_eolbr = true;
|
90 |
m_eolbr = true;
|
86 |
return string("<qt><head><title></title></head><body>");
|
91 |
return string("<qt><head><title></title></head><body>");
|
87 |
}
|
92 |
}
|
88 |
}
|
93 |
}
|
|
... |
|
... |
503 |
void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
|
508 |
void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
|
504 |
{
|
509 |
{
|
505 |
LOGDEB1(("PreviewTextEdit::setCurTabProps\n"));
|
510 |
LOGDEB1(("PreviewTextEdit::setCurTabProps\n"));
|
506 |
QString title;
|
511 |
QString title;
|
507 |
string ctitle;
|
512 |
string ctitle;
|
508 |
if (doc.getmeta(Rcl::Doc::keytt, &ctitle)) {
|
513 |
if (doc.getmeta(Rcl::Doc::keytt, &ctitle) && !ctitle.empty()) {
|
509 |
title = QString::fromUtf8(ctitle.c_str(), ctitle.length());
|
514 |
title = QString::fromUtf8(ctitle.c_str(), ctitle.length());
|
510 |
} else {
|
515 |
} else {
|
511 |
title = QString::fromLocal8Bit(path_getsimple(doc.url).c_str());
|
516 |
title = QString::fromLocal8Bit(path_getsimple(doc.url).c_str());
|
512 |
}
|
517 |
}
|
513 |
if (title.length() > 20) {
|
518 |
if (title.length() > 20) {
|
|
... |
|
... |
574 |
closeCurrentTab();
|
579 |
closeCurrentTab();
|
575 |
return false;
|
580 |
return false;
|
576 |
}
|
581 |
}
|
577 |
raise();
|
582 |
raise();
|
578 |
return true;
|
583 |
return true;
|
|
|
584 |
}
|
|
|
585 |
void Preview::togglePlainPre()
|
|
|
586 |
{
|
|
|
587 |
prefs.previewPlainPre = !prefs.previewPlainPre;
|
|
|
588 |
|
|
|
589 |
PreviewTextEdit *editor = currentEditor();
|
|
|
590 |
if (editor)
|
|
|
591 |
loadDocInCurrentTab(editor->m_dbdoc, editor->m_docnum);
|
579 |
}
|
592 |
}
|
580 |
|
593 |
|
581 |
void Preview::emitWordSelect(QString word)
|
594 |
void Preview::emitWordSelect(QString word)
|
582 |
{
|
595 |
{
|
583 |
emit(wordSelect(word));
|
596 |
emit(wordSelect(word));
|
|
... |
|
... |
701 |
~LoadGuard() {*m_bp = false; CancelCheck::instance().setCancel(false);}
|
714 |
~LoadGuard() {*m_bp = false; CancelCheck::instance().setCancel(false);}
|
702 |
};
|
715 |
};
|
703 |
|
716 |
|
704 |
bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
717 |
bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
705 |
{
|
718 |
{
|
706 |
LOGDEB1(("PreviewTextEdit::loadDocInCurrentTab()\n"));
|
719 |
LOGDEB1(("Preview::loadDocInCurrentTab()\n"));
|
707 |
|
720 |
|
708 |
LoadGuard guard(&m_loading);
|
721 |
LoadGuard guard(&m_loading);
|
709 |
CancelCheck::instance().setCancel(false);
|
722 |
CancelCheck::instance().setCancel(false);
|
710 |
|
723 |
|
711 |
m_haveAnchors = false;
|
724 |
m_haveAnchors = false;
|
|
... |
|
... |
1013 |
break;
|
1026 |
break;
|
1014 |
}
|
1027 |
}
|
1015 |
popup->addAction(tr("Select All"), this, SLOT(selectAll()));
|
1028 |
popup->addAction(tr("Select All"), this, SLOT(selectAll()));
|
1016 |
popup->addAction(tr("Copy"), this, SLOT(copy()));
|
1029 |
popup->addAction(tr("Copy"), this, SLOT(copy()));
|
1017 |
popup->addAction(tr("Print"), this, SLOT(print()));
|
1030 |
popup->addAction(tr("Print"), this, SLOT(print()));
|
|
|
1031 |
if (prefs.previewPlainPre) {
|
|
|
1032 |
popup->addAction(tr("Fold lines"), m_preview, SLOT(togglePlainPre()));
|
|
|
1033 |
} else {
|
|
|
1034 |
popup->addAction(tr("Preserve indentation"),
|
|
|
1035 |
m_preview, SLOT(togglePlainPre()));
|
|
|
1036 |
}
|
1018 |
// Need to check ipath until we fix the internfile bug that always
|
1037 |
// Need to check ipath until we fix the internfile bug that always
|
1019 |
// has it convert to html for top level docs
|
1038 |
// has it convert to html for top level docs
|
1020 |
if (!m_dbdoc.url.empty() && !m_dbdoc.ipath.empty())
|
1039 |
if (!m_dbdoc.url.empty() && !m_dbdoc.ipath.empty())
|
1021 |
popup->addAction(tr("Save document to file"),
|
1040 |
popup->addAction(tr("Save document to file"),
|
1022 |
m_preview, SLOT(emitSaveDocToFile()));
|
1041 |
m_preview, SLOT(emitSaveDocToFile()));
|