summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircchanneltab.cpp
authorzecke <zecke>2004-09-08 21:51:06 (UTC)
committer zecke <zecke>2004-09-08 21:51:06 (UTC)
commitebb830522c9662bda4c4453e532bcc29631c5d60 (patch) (unidiff)
tree5cf95975e91cb2db78be5cdf47c01a340109c1f4 /noncore/net/opieirc/ircchanneltab.cpp
parentf0fdb800d57e9a1d95ba593185e9462300539eea (diff)
downloadopie-ebb830522c9662bda4c4453e532bcc29631c5d60.zip
opie-ebb830522c9662bda4c4453e532bcc29631c5d60.tar.gz
opie-ebb830522c9662bda4c4453e532bcc29631c5d60.tar.bz2
-Close Tab Keyboard Accelerator with delayed deletion of the tab
-Optionally add a TimeStamp to the Tab -Remove not implemented CTCP actions from the Channel PopupMenu -Give Focus to the Edit Line -Some more ping handling patch inspired and copied from zautrix fork
Diffstat (limited to 'noncore/net/opieirc/ircchanneltab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp22
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
59void IRCChannelTab::appendText(QString text) { 60void 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
135void IRCChannelTab::popupQuery() { 138void 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
152void IRCChannelTab::popupQuery() {
153 if ( m_list->currentItem() != -1 )
154 popupQuery( m_list->item(m_list->currentItem()));
155}
156
149void IRCChannelTab::popupPing() { 157void IRCChannelTab::popupPing() {
150 //HAHA, no wonder these don't work 158 //HAHA, no wonder these don't work
151} 159}