Merge pull request #102 from mamarley/qcaqt5
[quassel.git] / src / uisupport / multilineedit.cpp
index c56b03c..48ffdba 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2014 by the Quassel Project                        *
+ *   Copyright (C) 2005-2015 by the Quassel Project                        *
  *   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)
 {
-#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
@@ -296,18 +294,7 @@ bool MultiLineEdit::event(QEvent *e)
 
 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) {
-#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();
@@ -718,7 +705,11 @@ void MultiLineEdit::on_textChanged()
                 QString msg = tr("Do you really want to paste %n line(s)?", "", lines.count());
                 msg += "<p>";
                 for (int i = 0; i < 4; i++) {
+#if QT_VERSION < 0x050000
                     msg += Qt::escape(lines[i].left(40));
+#else
+                    msg += lines[i].left(40).toHtmlEscaped();
+#endif
                     if (lines[i].count() > 40)
                         msg += "...";
                     msg += "<br />";