summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircservertab.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircservertab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircservertab.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index 4ed5364..5d1e290 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -8,4 +8,5 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
m_mainWindow = mainWindow;
m_close = FALSE;
+ m_lines = 0;
m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>");
m_textview = new QTextView(this);
@@ -14,5 +15,5 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
m_textview->setTextFormat(RichText);
m_layout->add(m_textview);
- m_field = new QLineEdit(this);
+ m_field = new IRCHistoryLineEdit(this);
m_layout->add(m_field);
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
@@ -24,5 +25,14 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
void IRCServerTab::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);
@@ -59,4 +69,5 @@ IRCServer *IRCServerTab::server() {
void IRCServerTab::settingsChanged() {
m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
+ m_lines = 0;
}