summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircquerytab.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieirc/ircquerytab.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircquerytab.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircquerytab.cpp b/noncore/net/opieirc/ircquerytab.cpp
index b946174..869e4f7 100644
--- a/noncore/net/opieirc/ircquerytab.cpp
+++ b/noncore/net/opieirc/ircquerytab.cpp
@@ -6,4 +6,5 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow
m_mainWindow = mainWindow;
m_parentTab = parentTab;
+ m_lines = 0;
m_person = new IRCPerson(*person); /* We need this (the person might sign off and the original IRCPerson gets deleted) */
m_description->setText(tr("Talking to ") + " <b>" + person->nick() + "</b>");
@@ -13,5 +14,5 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow
m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
m_textview->setTextFormat(RichText);
- m_field = new QLineEdit(this);
+ m_field = new IRCHistoryLineEdit(this);
m_layout->add(hbox);
hbox->show();
@@ -24,5 +25,14 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow
void IRCQueryTab::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);
@@ -64,4 +74,5 @@ void IRCQueryTab::display(IRCOutput output) {
void IRCQueryTab::settingsChanged() {
m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
+ m_lines = 0;
}