X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Finputline.cpp;h=7511e07a32227d0701b1335a2d0260198d926417;hp=535b3c279d350e4341c808e023a6baf26d7e6fce;hb=8de2d4650197bdae2f39f804228f3bce5ddbd59c;hpb=5df99c1ab83baf3a6caef7e49177f84bd48d127e diff --git a/src/uisupport/inputline.cpp b/src/uisupport/inputline.cpp index 535b3c27..7511e07a 100644 --- a/src/uisupport/inputline.cpp +++ b/src/uisupport/inputline.cpp @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005/06 by The Quassel Team * + * Copyright (C) 2005/06 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -22,15 +22,15 @@ #include "tabcompleter.h" -InputLine::InputLine(QWidget *parent) : QLineEdit(parent) { - idx = 0; +InputLine::InputLine(QWidget *parent) + : QLineEdit(parent), + idx(0) +{ connect(this, SIGNAL(returnPressed()), this, SLOT(enter())); tabComplete = new TabCompleter(this); - connect(this, SIGNAL(nickListUpdated(QStringList)), tabComplete, SLOT(updateNickList(QStringList))); } InputLine::~InputLine() { - delete tabComplete; } void InputLine::keyPressEvent(QKeyEvent * event) { @@ -38,7 +38,7 @@ void InputLine::keyPressEvent(QKeyEvent * event) { tabComplete->complete(); event->accept(); } else { - tabComplete->disable(); + tabComplete->reset(); if(event->key() == Qt::Key_Up) { if(idx > 0) { idx--; setText(history[idx]); } event->accept(); @@ -47,6 +47,9 @@ void InputLine::keyPressEvent(QKeyEvent * event) { if(idx < history.count()) setText(history[idx]); else setText(""); event->accept(); + } else if(event->key() == Qt::Key_Select) { // for Qtopia + emit returnPressed(); + QLineEdit::keyPressEvent(event); } else { QLineEdit::keyPressEvent(event); } @@ -55,7 +58,7 @@ void InputLine::keyPressEvent(QKeyEvent * event) { bool InputLine::event(QEvent *e) { if(e->type() == QEvent::KeyPress) { - keyPressEvent(dynamic_cast(e)); + keyPressEvent(static_cast(e)); return true; } return QLineEdit::event(e);