summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmisc.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircmisc.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index 22387b3..6d93a34 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -1,27 +1,30 @@
1#include <stdio.h>
2#include "ircmisc.h" 1#include "ircmisc.h"
3 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
4IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { 7IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
5} 8}
6 9
7int IRCTabBar::insertTab(QTab *tab, int index) { 10int IRCTabBar::insertTab(QTab *tab, int index) {
8 /* FIXME: find some nicer way to do this */ 11 /* FIXME: find some nicer way to do this */
9 QExtTab *ext = new QExtTab(); 12 QExtTab *ext = new QExtTab();
10 ext->color = black; 13 ext->color = black;
11 ext->label = tab->text(); 14 ext->label = tab->text();
12 ext->r = tab->rect(); 15 ext->r = tab->rect();
13 ext->enabled = tab->isEnabled(); 16 ext->enabled = tab->isEnabled();
14 ext->iconset = tab->iconSet(); 17 ext->iconset = tab->iconSet();
15 delete tab; 18 delete tab;
16 return QTabBar::insertTab(ext, index); 19 return QTabBar::insertTab(ext, index);
17} 20}
18 21
19void IRCTabBar::setTabColor(int index, QColor color) { 22void IRCTabBar::setTabColor(int index, QColor color) {
20 ((QExtTab *)tab(index))->color = color; 23 ((QExtTab *)tab(index))->color = color;
21 update(); 24 update();
22} 25}
23 26
24void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { 27void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const {
25 QRect r = br; 28 QRect r = br;
26 QTabBar::paintLabel(p, br, t, focus); 29 QTabBar::paintLabel(p, br, t, focus);
27 if (t->id == currentTab()) 30 if (t->id == currentTab())
@@ -43,41 +46,41 @@ IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLin
43 m_index = -1; 46 m_index = -1;
44 installEventFilter(this); 47 installEventFilter(this);
45} 48}
46 49
47void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { 50void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
48 int key = event->key(); 51 int key = event->key();
49 if (key == Key_Up) { 52 if (key == Key_Up) {
50 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { 53 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) {
51 m_index++; 54 m_index++;
52 setText(m_history[m_index]); 55 setText(m_history[m_index]);
53 } 56 }
54 } else if (key == Key_Down) { 57 } else if (key == Key_Down) {
55 if (m_history.count() > 0 && m_index > 0) { 58 if (m_history.count() > 0 && m_index > 0) {
56 m_index--; 59 m_index--;
57 setText(m_history[m_index]); 60 setText(m_history[m_index]);
58 } 61 }
59 if (m_index == 0) { 62 if (m_index == 0) {
60 m_index = -1; 63 m_index = -1;
61 setText(""); 64 setText("");
62 } 65 }
63 } else if (key == Key_Return) { 66 } else if (key == Key_Return) {
64 m_history.prepend(text()); 67 m_history.prepend(text());
65 m_index = -1; 68 m_index = -1;
66 } else if (key == Key_Tab) { 69 } else if (key == Key_Tab) {
67 printf("got tab\n"); 70 odebug << "got tab" << oendl;
68 return; 71 return;
69 } 72 }
70 QLineEdit::keyPressEvent(event); 73 QLineEdit::keyPressEvent(event);
71} 74}
72 75
73bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { 76bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
74 if (event->type() == QEvent::KeyPress) { 77 if (event->type() == QEvent::KeyPress) {
75 QKeyEvent *k = (QKeyEvent *) event; 78 QKeyEvent *k = (QKeyEvent *) event;
76 /* Catch tab characters */ 79 /* Catch tab characters */
77 if (k->key() == Key_Tab) { 80 if (k->key() == Key_Tab) {
78 qDebug("tab!"); 81 odebug << "tab!" << oendl;
79 return TRUE; 82 return TRUE;
80 } 83 }
81 } 84 }
82 return QLineEdit::eventFilter(object, event); 85 return QLineEdit::eventFilter(object, event);
83} 86}