summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmisc.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircmisc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index 2e7f316..c8e6190 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -68,12 +68,13 @@ void IRCTabWidget::setTabColor(int index, QColor color) {
68 ((IRCTabBar *)tabBar())->setTabColor(index, color); 68 ((IRCTabBar *)tabBar())->setTabColor(index, color);
69} 69}
70 70
71 71
72IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { 72IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) {
73 m_index = -1; 73 m_index = -1;
74 installEventFilter(this);
74} 75}
75 76
76void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { 77void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
77 int key = event->key(); 78 int key = event->key();
78 if (key == Key_Up) { 79 if (key == Key_Up) {
79 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { 80 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) {
@@ -89,9 +90,24 @@ void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
89 m_index = -1; 90 m_index = -1;
90 setText(""); 91 setText("");
91 } 92 }
92 } else if (key == Key_Return) { 93 } else if (key == Key_Return) {
93 m_history.prepend(text()); 94 m_history.prepend(text());
94 m_index = -1; 95 m_index = -1;
96 } else if (key == Key_Tab) {
97 printf("got tab\n");
98 return;
95 } 99 }
96 QLineEdit::keyPressEvent(event); 100 QLineEdit::keyPressEvent(event);
97} 101}
102
103bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
104 if (event->type() == QEvent::KeyPress) {
105 QKeyEvent *k = (QKeyEvent *) event;
106 /* Catch tab characters */
107 if (k->key() == Key_Tab) {
108 qDebug("tab!");
109 return TRUE;
110 }
111 }
112 return QLineEdit::eventFilter(object, event);
113}