Diffstat (limited to 'noncore/net/opieirc/ircchanneltab.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index b6e3954..7610058 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp | |||
@@ -15,6 +15,7 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
15 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 15 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
16 | m_listVisible = TRUE; | 16 | m_listVisible = TRUE; |
17 | m_listButton = new QPushButton(">", m_textview); | 17 | m_listButton = new QPushButton(">", m_textview); |
18 | m_listButton->setFlat( true ); | ||
18 | m_textview->setCornerWidget(m_listButton); | 19 | m_textview->setCornerWidget(m_listButton); |
19 | m_textview->setTextFormat(RichText); | 20 | m_textview->setTextFormat(RichText); |
20 | QWhatsThis::add(m_textview, tr("Channel discussion")); | 21 | QWhatsThis::add(m_textview, tr("Channel discussion")); |
@@ -25,7 +26,7 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
25 | m_field = new IRCHistoryLineEdit(this); | 26 | m_field = new IRCHistoryLineEdit(this); |
26 | connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); | 27 | connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); |
27 | connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); | 28 | connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); |
28 | connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab())); | 29 | connect(m_field, SIGNAL(closeTab()), this, SLOT(remove())); |
29 | connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); | 30 | connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); |
30 | 31 | ||
31 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); | 32 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); |
@@ -36,7 +37,6 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
36 | connect(m_list, SIGNAL(mouseButtonPressed(int,QListBoxItem*,const QPoint&)), this, SLOT(mouseButtonPressed(int,QListBoxItem*,const QPoint&))); | 37 | connect(m_list, SIGNAL(mouseButtonPressed(int,QListBoxItem*,const QPoint&)), this, SLOT(mouseButtonPressed(int,QListBoxItem*,const QPoint&))); |
37 | /* Construct the popup menu */ | 38 | /* Construct the popup menu */ |
38 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); | 39 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); |
39 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); | ||
40 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); | 40 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); |
41 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); | 41 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); |
42 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); | 42 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); |
@@ -49,6 +49,7 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
49 | m_field->setActiveWindow(); | 49 | m_field->setActiveWindow(); |
50 | 50 | ||
51 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 51 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
52 | connect(m_list, SIGNAL(doubleClicked ( QListBoxItem * ) ), this, SLOT(popupQuery( QListBoxItem * ) )); | ||
52 | settingsChanged(); | 53 | settingsChanged(); |
53 | } | 54 | } |
54 | 55 | ||
@@ -58,7 +59,7 @@ void IRCChannelTab::scrolling(){ | |||
58 | 59 | ||
59 | void IRCChannelTab::appendText(QString text) { | 60 | void IRCChannelTab::appendText(QString text) { |
60 | /* not using append because it creates layout problems */ | 61 | /* not using append because it creates layout problems */ |
61 | QString txt = m_textview->text() + text + "\n"; | 62 | QString txt = m_textview->text() + IRCTab::appendTimestamp( text ); |
62 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | 63 | if (m_maxLines > 0 && m_lines >= m_maxLines) { |
63 | int firstBreak = txt.find('\n'); | 64 | int firstBreak = txt.find('\n'); |
64 | if (firstBreak != -1) { | 65 | if (firstBreak != -1) { |
@@ -72,7 +73,9 @@ void IRCChannelTab::appendText(QString text) { | |||
72 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 73 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
73 | 74 | ||
74 | int p1, p2; | 75 | int p1, p2; |
75 | if ( (p1 = text.find("ping", 0, false) )!= -1 && (p2 = text.find( m_parentTab->server()->nick(), 0,false )) != -1 ) { | 76 | if ( text.contains( IRCMessageParser::tr("Received a CTCP PING from ") ) ) |
77 | emit ping( title() ); | ||
78 | else if ( (p1 = text.find("ping", 0, false) )!= -1 && (p2 = text.find( m_parentTab->server()->nick(), 0,false )) != -1 ) { | ||
76 | int col = text.findRev("color", -1, false); | 79 | int col = text.findRev("color", -1, false); |
77 | if ( col < p2 ) | 80 | if ( col < p2 ) |
78 | emit ping( title() ); | 81 | emit ping( title() ); |
@@ -132,9 +135,9 @@ void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint & | |||
132 | }; | 135 | }; |
133 | } | 136 | } |
134 | 137 | ||
135 | void IRCChannelTab::popupQuery() { | 138 | void IRCChannelTab::popupQuery( QListBoxItem *item) { |
136 | if (m_list->currentItem() != -1) { | 139 | if (item) { |
137 | IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); | 140 | IRCPerson *person = session()->getPerson(item->text()); |
138 | if (person) { | 141 | if (person) { |
139 | IRCQueryTab *tab = m_parentTab->getTabForQuery(person); | 142 | IRCQueryTab *tab = m_parentTab->getTabForQuery(person); |
140 | if (!tab) { | 143 | if (!tab) { |
@@ -146,6 +149,11 @@ void IRCChannelTab::popupQuery() { | |||
146 | } | 149 | } |
147 | } | 150 | } |
148 | 151 | ||
152 | void IRCChannelTab::popupQuery() { | ||
153 | if ( m_list->currentItem() != -1 ) | ||
154 | popupQuery( m_list->item(m_list->currentItem())); | ||
155 | } | ||
156 | |||
149 | void IRCChannelTab::popupPing() { | 157 | void IRCChannelTab::popupPing() { |
150 | //HAHA, no wonder these don't work | 158 | //HAHA, no wonder these don't work |
151 | } | 159 | } |