author | wazlaf <wazlaf> | 2002-09-30 13:43:36 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-30 13:43:36 (UTC) |
commit | 5db3af80f392f8f063f53cbbad67bbe7c5c6eb6d (patch) (unidiff) | |
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 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/resource.h> | 2 | #include <qpe/resource.h> |
3 | #include <qcursor.h> | 3 | #include <qcursor.h> |
4 | #include <stdio.h> | ||
4 | #include <qhbox.h> | 5 | #include <qhbox.h> |
5 | #include "ircchanneltab.h" | 6 | #include "ircchanneltab.h" |
6 | #include "ircservertab.h" | 7 | #include "ircservertab.h" |
@@ -22,11 +23,13 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
22 | m_list = new IRCChannelList(m_channel, hbox); | 23 | m_list = new IRCChannelList(m_channel, hbox); |
23 | m_list->update(); | 24 | m_list->update(); |
24 | m_list->setMaximumWidth(LISTWIDTH); | 25 | m_list->setMaximumWidth(LISTWIDTH); |
25 | m_field = new QLineEdit(this); | 26 | m_field = new IRCHistoryLineEdit(this); |
26 | m_popup = new QPopupMenu(m_list); | 27 | m_popup = new QPopupMenu(m_list); |
28 | m_lines = 0; | ||
27 | /* Required so that embedded-style "right" clicks work */ | 29 | /* Required so that embedded-style "right" clicks work */ |
28 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); | 30 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); |
29 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); | 31 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); |
32 | |||
30 | /* Construct the popup menu */ | 33 | /* Construct the popup menu */ |
31 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); | 34 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); |
32 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); | 35 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); |
@@ -45,7 +48,16 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
45 | 48 | ||
46 | void IRCChannelTab::appendText(QString text) { | 49 | void IRCChannelTab::appendText(QString text) { |
47 | /* not using append because it creates layout problems */ | 50 | /* not using append because it creates layout problems */ |
48 | m_textview->setText(m_textview->text() + text); | 51 | QString txt = m_textview->text() + text + "\n"; |
52 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | ||
53 | int firstBreak = txt.find('\n'); | ||
54 | if (firstBreak != -1) { | ||
55 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | ||
56 | } | ||
57 | } else { | ||
58 | m_lines++; | ||
59 | } | ||
60 | m_textview->setText(txt); | ||
49 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 61 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
50 | emit changed(this); | 62 | emit changed(this); |
51 | } | 63 | } |
@@ -76,6 +88,7 @@ void IRCChannelTab::processCommand() { | |||
76 | 88 | ||
77 | void IRCChannelTab::settingsChanged() { | 89 | void IRCChannelTab::settingsChanged() { |
78 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 90 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
91 | m_lines = 0; | ||
79 | } | 92 | } |
80 | 93 | ||
81 | void IRCChannelTab::toggleList() { | 94 | void IRCChannelTab::toggleList() { |