Don't loop indefinitely while trying to teach manners to Qt
[quassel.git] / src / qtui / bufferwidget.cpp
index a58723d..135c0d1 100644 (file)
@@ -50,7 +50,7 @@ BufferWidget::BufferWidget(QWidget *parent)
   _chatViewSearchController->setSearchMsgs(ui.searchBar->searchMsgsBox()->isChecked());
   _chatViewSearchController->setSearchOnlyRegularMsgs(ui.searchBar->searchOnlyRegularMsgsBox()->isChecked());
 
-  connect(ui.searchBar->searchEditLine(), SIGNAL(textChanged(const QString &)),
+  connect(ui.searchBar, SIGNAL(searchChanged(const QString &)),
          _chatViewSearchController, SLOT(setSearchString(const QString &)));
   connect(ui.searchBar->caseSensitiveBox(), SIGNAL(toggled(bool)),
          _chatViewSearchController, SLOT(setCaseSensitive(bool)));
@@ -161,11 +161,12 @@ bool BufferWidget::eventFilter(QObject *watched, QEvent *event) {
 
   QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
 
+  MultiLineEdit *inputLine = qobject_cast<MultiLineEdit *>(watched);
+  if(!inputLine)
+    return false;
+
   // Intercept copy key presses
   if(keyEvent == QKeySequence::Copy) {
-    MultiLineEdit *inputLine = qobject_cast<MultiLineEdit *>(watched);
-    if(!inputLine)
-      return false;
     if(inputLine->hasSelectedText())
       return false;
     ChatView *view = qobject_cast<ChatView *>(ui.stackedWidget->currentWidget());
@@ -174,6 +175,10 @@ bool BufferWidget::eventFilter(QObject *watched, QEvent *event) {
     return true;
   }
 
+  // We don't want to steal cursor movement keys if the input line is in multiline mode
+  if(!inputLine->isSingleLine())
+    return false;
+
   switch(keyEvent->key()) {
   case Qt::Key_Up:
   case Qt::Key_Down: