author | wazlaf <wazlaf> | 2002-09-30 13:43:36 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-30 13:43:36 (UTC) |
commit | 5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d (patch) (side-by-side diff) | |
tree | 12d8e59152c434e0774f067d5b0163578d603daf /noncore/net/opieirc/ircchanneltab.cpp | |
parent | b753c264b7acd26aba9f5a73c1fa0a7deb0b73a3 (diff) | |
download | opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.zip opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.tar.gz opie-5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d.tar.bz2 |
history functionality, tabs switch colors, extended settings dialog
Diffstat (limited to 'noncore/net/opieirc/ircchanneltab.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index ddd6cf1..f19e019 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp @@ -1,6 +1,7 @@ #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qcursor.h> +#include <stdio.h> #include <qhbox.h> #include "ircchanneltab.h" #include "ircservertab.h" @@ -22,11 +23,13 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW m_list = new IRCChannelList(m_channel, hbox); m_list->update(); m_list->setMaximumWidth(LISTWIDTH); - m_field = new QLineEdit(this); + m_field = new IRCHistoryLineEdit(this); m_popup = new QPopupMenu(m_list); + m_lines = 0; /* Required so that embedded-style "right" clicks work */ QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); + /* Construct the popup menu */ QPopupMenu *ctcpMenu = new QPopupMenu(m_list); m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); @@ -45,7 +48,16 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW void IRCChannelTab::appendText(QString text) { /* not using append because it creates layout problems */ - m_textview->setText(m_textview->text() + text); + QString txt = m_textview->text() + text + "\n"; + if (m_maxLines > 0 && m_lines >= m_maxLines) { + int firstBreak = txt.find('\n'); + if (firstBreak != -1) { + txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); + } + } else { + m_lines++; + } + m_textview->setText(txt); m_textview->ensureVisible(0, m_textview->contentsHeight()); emit changed(this); } @@ -76,6 +88,7 @@ void IRCChannelTab::processCommand() { void IRCChannelTab::settingsChanged() { m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); + m_lines = 0; } void IRCChannelTab::toggleList() { |