projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Preserve white-space in the input history.
[quassel.git]
/
src
/
uisupport
/
multilineedit.cpp
diff --git
a/src/uisupport/multilineedit.cpp
b/src/uisupport/multilineedit.cpp
index
f5ed317
..
0651abf
100644
(file)
--- a/
src/uisupport/multilineedit.cpp
+++ b/
src/uisupport/multilineedit.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-201
4
by the Quassel Project *
+ * Copyright (C) 2005-201
5
by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-43,9
+43,7
@@
MultiLineEdit::MultiLineEdit(QWidget *parent)
_emacsMode(false),
_lastDocumentHeight(-1)
{
_emacsMode(false),
_lastDocumentHeight(-1)
{
-#if QT_VERSION >= 0x040500
- document()->setDocumentMargin(0); // new in Qt 4.5 and we really don't want it here
-#endif
+ document()->setDocumentMargin(0);
setAcceptRichText(false);
#ifdef HAVE_KDE
setAcceptRichText(false);
#ifdef HAVE_KDE
@@
-56,6
+54,9
@@
MultiLineEdit::MultiLineEdit(QWidget *parent)
setLineWrapEnabled(false);
reset();
setLineWrapEnabled(false);
reset();
+ // Prevent QTextHtmlImporter::appendNodeText from eating whitespace
+ document()->setDefaultStyleSheet("span { white-space: pre-wrap; }");
+
connect(this, SIGNAL(textChanged()), this, SLOT(on_textChanged()));
_mircColorMap["00"] = "#ffffff";
connect(this, SIGNAL(textChanged()), this, SLOT(on_textChanged()));
_mircColorMap["00"] = "#ffffff";
@@
-296,18
+297,7
@@
bool MultiLineEdit::event(QEvent *e)
void MultiLineEdit::keyPressEvent(QKeyEvent *event)
{
void MultiLineEdit::keyPressEvent(QKeyEvent *event)
{
- // Workaround the fact that Qt < 4.5 doesn't know InsertLineSeparator yet
-#if QT_VERSION >= 0x040500
if (event == QKeySequence::InsertLineSeparator) {
if (event == QKeySequence::InsertLineSeparator) {
-#else
-
-# ifdef Q_OS_MAC
- if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::META) {
-# else
- if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::SHIFT) {
-# endif
-#endif
-
if (_mode == SingleLine) {
event->accept();
on_returnPressed();
if (_mode == SingleLine) {
event->accept();
on_returnPressed();
@@
-564,22
+554,18
@@
QString MultiLineEdit::convertRichtextToMircCodes()
cursor.clearSelection();
}
cursor.clearSelection();
}
- if (color) {
- color = false;
+
+ if (color)
mircText.append('\x03');
mircText.append('\x03');
- }
- if (underline) {
- underline = false;
+
+ if (underline)
mircText.append('\x1f');
mircText.append('\x1f');
- }
- if (italic) {
- italic = false;
+
+ if (italic)
mircText.append('\x1d');
mircText.append('\x1d');
- }
- if (bold) {
- bold = false;
+
+ if (bold)
mircText.append('\x02');
mircText.append('\x02');
- }
return mircText;
}
return mircText;
}