summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircchanneltab.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircchanneltab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp
index 581f9a5..4a35929 100644
--- a/noncore/net/opieirc/ircchanneltab.cpp
+++ b/noncore/net/opieirc/ircchanneltab.cpp
@@ -1,20 +1,23 @@
1#include <qpe/resource.h> 1#include <qpe/resource.h>
2#include <qwhatsthis.h> 2#include <qwhatsthis.h>
3#include <qhbox.h> 3#include <qhbox.h>
4#include <qdict.h>
4 5
5#include "ircchanneltab.h" 6#include "ircchanneltab.h"
6#include "ircservertab.h" 7#include "ircservertab.h"
7#include "ircmessageparser.h" 8#include "ircmessageparser.h"
8 9
10QDict<QString> IRCChannelTab::m_queuedMessages (17);
11
9IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { 12IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
10 m_mainWindow = mainWindow; 13 m_mainWindow = mainWindow;
11 m_parentTab = parentTab; 14 m_parentTab = parentTab;
12 m_channel = channel; 15 m_channel = channel;
13 m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); 16 m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>");
14 QHBox *hbox = new QHBox(this); 17 QHBox *hbox = new QHBox(this);
15 m_textview = new QTextView(hbox); 18 m_textview = new QTextView(hbox);
16 m_textview->setHScrollBarMode(QScrollView::AlwaysOff); 19 m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
17 m_textview->setVScrollBarMode(QScrollView::AlwaysOn); 20 m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
18 m_listVisible = TRUE; 21 m_listVisible = TRUE;
19 m_listButton = new QPushButton(">", m_textview); 22 m_listButton = new QPushButton(">", m_textview);
20 m_listButton->setFlat( true ); 23 m_listButton->setFlat( true );
@@ -44,24 +47,30 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
44 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); 47 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion()));
45 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); 48 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois()));
46 connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); 49 connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
47 m_layout->add(hbox); 50 m_layout->add(hbox);
48 hbox->show(); 51 hbox->show();
49 m_layout->add(m_field); 52 m_layout->add(m_field);
50 m_field->setFocus(); 53 m_field->setFocus();
51 m_field->setActiveWindow(); 54 m_field->setActiveWindow();
52 55
53 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 56 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
54 connect(m_list, SIGNAL(doubleClicked ( QListBoxItem * ) ), this, SLOT(popupQuery( QListBoxItem * ) )); 57 connect(m_list, SIGNAL(doubleClicked ( QListBoxItem * ) ), this, SLOT(popupQuery( QListBoxItem * ) ));
55 settingsChanged(); 58 settingsChanged();
59
60 if(m_queuedMessages[m_channel->channelname()]) {
61 appendText(*m_queuedMessages[m_channel->channelname()]);
62 delete m_queuedMessages[m_channel->channelname()];
63 m_queuedMessages.remove(m_channel->channelname());
64 }
56} 65}
57 66
58void IRCChannelTab::scrolling(){ 67void IRCChannelTab::scrolling(){
59 m_textview->ensureVisible(0, m_textview->contentsHeight()); 68 m_textview->ensureVisible(0, m_textview->contentsHeight());
60} 69}
61 70
62void IRCChannelTab::appendText(QString text) { 71void IRCChannelTab::appendText(QString text) {
63 /* not using append because it creates layout problems */ 72 /* not using append because it creates layout problems */
64 QString txt = m_textview->text() + IRCTab::appendTimestamp( text ); 73 QString txt = m_textview->text() + IRCTab::appendTimestamp( text );
65 if (m_maxLines > 0 && m_lines >= m_maxLines) { 74 if (m_maxLines > 0 && m_lines >= m_maxLines) {
66 int firstBreak = txt.find('\n'); 75 int firstBreak = txt.find('\n');
67 if (firstBreak != -1) { 76 if (firstBreak != -1) {
@@ -173,19 +182,27 @@ QString IRCChannelTab::title() {
173IRCSession *IRCChannelTab::session() { 182IRCSession *IRCChannelTab::session() {
174 return m_parentTab->session(); 183 return m_parentTab->session();
175} 184}
176 185
177void IRCChannelTab::remove() { 186void IRCChannelTab::remove() {
178 if (session()->isSessionActive()) { 187 if (session()->isSessionActive()) {
179 session()->part(m_channel); 188 session()->part(m_channel);
180 } else { 189 } else {
181 m_mainWindow->killTab(this); 190 m_mainWindow->killTab(this);
182 } 191 }
183} 192}
184 193
194void IRCChannelTab::enqueue(const QString &channel, const QString &message) {
195 if (m_queuedMessages.count() == (m_queuedMessages.size() - 1) )
196 /* 17 messages max */
197 return;
198 m_queuedMessages.insert(channel, new QString(message));
199}
200
185IRCChannel *IRCChannelTab::channel() { 201IRCChannel *IRCChannelTab::channel() {
186 return m_channel; 202 return m_channel;
187} 203}
188 204
189IRCChannelList *IRCChannelTab::list() { 205IRCChannelList *IRCChannelTab::list() {
190 return m_list; 206 return m_list;
191} 207}
208