summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircmisc.cpp
authorwazlaf <wazlaf>2002-09-30 13:43:36 (UTC)
committer wazlaf <wazlaf>2002-09-30 13:43:36 (UTC)
commit5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d (patch) (side-by-side diff)
tree12d8e59152c434e0774f067d5b0163578d603daf /noncore/net/opieirc/ircmisc.cpp
parentb753c264b7acd26aba9f5a73c1fa0a7deb0b73a3 (diff)
downloadopie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.zip
opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.tar.gz
opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.tar.bz2
history functionality, tabs switch colors, extended settings dialog
Diffstat (limited to 'noncore/net/opieirc/ircmisc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp53
1 files changed, 42 insertions, 11 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index dd7292c..2e7f316 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -30,21 +30,24 @@ QColor IRCFramedColorLabel::color() {
return m_label->color();
}
+
IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
}
int IRCTabBar::insertTab(QTab *tab, int index = -1) {
- if (m_colors.size() == (unsigned int)count())
- m_colors.resize(m_colors.size() * 2 + 1);
- if (index == -1)
- m_colors.insert(count(), &black);
- else
- m_colors.insert(index, &black);
- return QTabBar::insertTab(tab, index);
+ /* FIXME: find some nicer way to do this */
+ QExtTab *ext = new QExtTab();
+ ext->color = black;
+ ext->label = tab->text();
+ ext->r = tab->rect();
+ ext->enabled = tab->isEnabled();
+ ext->iconset = tab->iconSet();
+ delete tab;
+ return QTabBar::insertTab(ext, index);
}
-void IRCTabBar::setTabColor(int index, const QColor *color) {
- m_colors.insert(index, color);
+void IRCTabBar::setTabColor(int index, QColor color) {
+ ((QExtTab *)tab(index))->color = color;
update();
}
@@ -53,7 +56,7 @@ void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) co
QTabBar::paintLabel(p, br, t, focus);
if (t->id == currentTab())
r.setBottom(r.bottom() - style().defaultFrameWidth());
- p->setPen(*m_colors.at(t->id));
+ p->setPen(((QExtTab *)t)->color);
p->drawText(r, AlignCenter | ShowPrefix, t->label);
}
@@ -61,6 +64,34 @@ IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(paren
setTabBar(new IRCTabBar(this, "tab control"));
}
-void IRCTabWidget::setTabColor(int index, const QColor *color) {
+void IRCTabWidget::setTabColor(int index, QColor color) {
((IRCTabBar *)tabBar())->setTabColor(index, color);
}
+
+
+IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) {
+ m_index = -1;
+}
+
+void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
+ int key = event->key();
+ if (key == Key_Up) {
+ if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) {
+ m_index++;
+ setText(m_history[m_index]);
+ }
+ } else if (key == Key_Down) {
+ if (m_history.count() > 0 && m_index > 0) {
+ m_index--;
+ setText(m_history[m_index]);
+ }
+ if (m_index == 0) {
+ m_index = -1;
+ setText("");
+ }
+ } else if (key == Key_Return) {
+ m_history.prepend(text());
+ m_index = -1;
+ }
+ QLineEdit::keyPressEvent(event);
+}