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) (side-by-side diff)
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
@@ -12,56 +12,57 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
QHBox *hbox = new QHBox(this);
m_textview = new QTextView(hbox);
m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
m_listVisible = TRUE;
m_listButton = new QPushButton(">", m_textview);
+ m_listButton->setFlat( true );
m_textview->setCornerWidget(m_listButton);
m_textview->setTextFormat(RichText);
QWhatsThis::add(m_textview, tr("Channel discussion"));
connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList()));
m_list = new IRCChannelList(m_channel, hbox);
m_list->update();
m_list->setMaximumWidth(LISTWIDTH);
m_field = new IRCHistoryLineEdit(this);
connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab()));
connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab()));
- connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab()));
+ connect(m_field, SIGNAL(closeTab()), this, SLOT(remove()));
connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus()));
QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion"));
m_popup = new QPopupMenu(m_list);
m_lines = 0;
/* Required so that embedded-style "right" clicks work */
QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold);
connect(m_list, SIGNAL(mouseButtonPressed(int,QListBoxItem*,const QPoint&)), this, SLOT(mouseButtonPressed(int,QListBoxItem*,const QPoint&)));
/* Construct the popup menu */
QPopupMenu *ctcpMenu = new QPopupMenu(m_list);
- m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu);
m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery()));
ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing()));
ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion()));
ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois()));
connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
m_layout->add(hbox);
hbox->show();
m_layout->add(m_field);
m_field->setFocus();
m_field->setActiveWindow();
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
+ connect(m_list, SIGNAL(doubleClicked ( QListBoxItem * ) ), this, SLOT(popupQuery( QListBoxItem * ) ));
settingsChanged();
}
void IRCChannelTab::scrolling(){
m_textview->ensureVisible(0, m_textview->contentsHeight());
}
void IRCChannelTab::appendText(QString text) {
/* not using append because it creates layout problems */
- QString txt = m_textview->text() + text + "\n";
+ QString txt = m_textview->text() + IRCTab::appendTimestamp( text );
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 {
@@ -69,13 +70,15 @@ void IRCChannelTab::appendText(QString text) {
}
m_textview->ensureVisible(0, m_textview->contentsHeight());
m_textview->setText(txt);
m_textview->ensureVisible(0, m_textview->contentsHeight());
int p1, p2;
- if ( (p1 = text.find("ping", 0, false) )!= -1 && (p2 = text.find( m_parentTab->server()->nick(), 0,false )) != -1 ) {
+ if ( text.contains( IRCMessageParser::tr("Received a CTCP PING from ") ) )
+ emit ping( title() );
+ else if ( (p1 = text.find("ping", 0, false) )!= -1 && (p2 = text.find( m_parentTab->server()->nick(), 0,false )) != -1 ) {
int col = text.findRev("color", -1, false);
if ( col < p2 )
emit ping( title() );
}
@@ -129,26 +132,31 @@ void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &
case 2:
m_popup->popup(point);
break;
};
}
-void IRCChannelTab::popupQuery() {
- if (m_list->currentItem() != -1) {
- IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text());
+void IRCChannelTab::popupQuery( QListBoxItem *item) {
+ if (item) {
+ IRCPerson *person = session()->getPerson(item->text());
if (person) {
IRCQueryTab *tab = m_parentTab->getTabForQuery(person);
if (!tab) {
tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent());
m_parentTab->addQueryTab(tab);
m_mainWindow->addTab(tab);
}
}
}
}
+void IRCChannelTab::popupQuery() {
+ if ( m_list->currentItem() != -1 )
+ popupQuery( m_list->item(m_list->currentItem()));
+}
+
void IRCChannelTab::popupPing() {
//HAHA, no wonder these don't work
}
void IRCChannelTab::popupVersion() {
}