Diffstat (limited to 'noncore/net/opieirc/ircquerytab.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircquerytab.cpp | 15 |
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 | |||
@@ -5,6 +5,7 @@ | |||
5 | IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 5 | IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
6 | m_mainWindow = mainWindow; | 6 | m_mainWindow = mainWindow; |
7 | m_parentTab = parentTab; | 7 | m_parentTab = parentTab; |
8 | m_lines = 0; | ||
8 | m_person = new IRCPerson(*person); /* We need this (the person might sign off and the original IRCPerson gets deleted) */ | 9 | m_person = new IRCPerson(*person); /* We need this (the person might sign off and the original IRCPerson gets deleted) */ |
9 | m_description->setText(tr("Talking to ") + " <b>" + person->nick() + "</b>"); | 10 | m_description->setText(tr("Talking to ") + " <b>" + person->nick() + "</b>"); |
10 | QHBox *hbox = new QHBox(this); | 11 | QHBox *hbox = new QHBox(this); |
@@ -12,7 +13,7 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow | |||
12 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 13 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
13 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 14 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
14 | m_textview->setTextFormat(RichText); | 15 | m_textview->setTextFormat(RichText); |
15 | m_field = new QLineEdit(this); | 16 | m_field = new IRCHistoryLineEdit(this); |
16 | m_layout->add(hbox); | 17 | m_layout->add(hbox); |
17 | hbox->show(); | 18 | hbox->show(); |
18 | m_layout->add(m_field); | 19 | m_layout->add(m_field); |
@@ -23,7 +24,16 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow | |||
23 | 24 | ||
24 | void IRCQueryTab::appendText(QString text) { | 25 | void IRCQueryTab::appendText(QString text) { |
25 | /* not using append because it creates layout problems */ | 26 | /* not using append because it creates layout problems */ |
26 | m_textview->setText(m_textview->text() + text); | 27 | QString txt = m_textview->text() + text + "\n"; |
28 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | ||
29 | int firstBreak = txt.find('\n'); | ||
30 | if (firstBreak != -1) { | ||
31 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | ||
32 | } | ||
33 | } else { | ||
34 | m_lines++; | ||
35 | } | ||
36 | m_textview->setText(txt); | ||
27 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 37 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
28 | emit changed(this); | 38 | emit changed(this); |
29 | } | 39 | } |
@@ -63,6 +73,7 @@ void IRCQueryTab::display(IRCOutput output) { | |||
63 | 73 | ||
64 | void IRCQueryTab::settingsChanged() { | 74 | void IRCQueryTab::settingsChanged() { |
65 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 75 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
76 | m_lines = 0; | ||
66 | } | 77 | } |
67 | 78 | ||
68 | QString IRCQueryTab::title() { | 79 | QString IRCQueryTab::title() { |