author | zecke <zecke> | 2004-09-08 21:51:06 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-08 21:51:06 (UTC) |
commit | ebb830522c9662bda4c4453e532bcc29631c5d60 (patch) (side-by-side diff) | |
tree | 5cf95975e91cb2db78be5cdf47c01a340109c1f4 /noncore/net/opieirc/ircservertab.cpp | |
parent | f0fdb800d57e9a1d95ba593185e9462300539eea (diff) | |
download | opie-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/ircservertab.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 2a34c0b..5ca7a29 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp @@ -1,19 +1,20 @@ #include <qtextstream.h> #include <qwhatsthis.h> #include "ircservertab.h" bool IRCServerTab::containsPing( const QString& text, IRCServerTab* tab ) { - return (text.find("ping") != -1 && text.find( tab->server()->nick() != -1)); + return (text.contains(IRCMessageParser::tr("Received a CTCP PING from "))) || + (text.find("ping") != -1 && text.find( tab->server()->nick() != -1)); } IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { m_server = server; m_session = new IRCSession(&m_server); m_mainWindow = mainWindow; m_close = FALSE; m_lines = 0; m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); m_textview = new QTextView(this); m_textview->setHScrollBarMode(QScrollView::AlwaysOff); @@ -21,38 +22,44 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa m_textview->setTextFormat(RichText); QWhatsThis::add(m_textview, tr("Server messages")); m_layout->add(m_textview); 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(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); m_layout->add(m_field); connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); - m_field->setFocus(); connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); settingsChanged(); + + m_field->setFocus(); + m_field->setActiveWindow(); + } void IRCServerTab::scrolling(){ m_textview->ensureVisible(0, m_textview->contentsHeight()); } void IRCServerTab::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 { m_lines++; } m_textview->setText(txt); m_textview->ensureVisible(0, m_textview->contentsHeight()); emit changed(this); } @@ -225,29 +232,29 @@ void IRCServerTab::doConnect() { } void IRCServerTab::remove() { /* Close requested */ if (m_session->isSessionActive()) { /* While there is a running session */ m_close = TRUE; m_session->endSession(); } else { /* Session has previously been closed */ m_channelTabs.first(); while (m_channelTabs.current() != 0) { - m_mainWindow->killTab(m_channelTabs.current()); + m_mainWindow->killTab(m_channelTabs.current(), true); } m_queryTabs.first(); while (m_queryTabs.current() != 0) { - m_mainWindow->killTab(m_queryTabs.current()); + m_mainWindow->killTab(m_queryTabs.current(), true); } m_mainWindow->killTab(this); } } IRCChannelTab *IRCServerTab::getTabForChannel(IRCChannel *channel) { QListIterator<IRCChannelTab> it(m_channelTabs); for (; it.current(); ++it) { if (it.current()->channel() == channel) return it.current(); } @@ -263,29 +270,29 @@ IRCQueryTab *IRCServerTab::getTabForQuery(IRCPerson *person) { } return 0; } void IRCServerTab::display(IRCOutput output) { /* All messages to be displayed inside the GUI get here */ switch (output.type()) { case OUTPUT_CONNCLOSE: if (m_close) { m_channelTabs.first(); while (m_channelTabs.current() != 0) { - m_mainWindow->killTab(m_channelTabs.current()); + m_mainWindow->killTab(m_channelTabs.current(), true); } m_queryTabs.first(); while (m_queryTabs.current() != 0) { - m_mainWindow->killTab(m_queryTabs.current()); + m_mainWindow->killTab(m_queryTabs.current(), true); } m_mainWindow->killTab(this); } else { appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() +"</font><br>"); QListIterator<IRCChannelTab> it(m_channelTabs); for (; it.current(); ++it) { it.current()->appendText("<font color=\"" + m_serverColor + "\">" + output.htmlMessage() +"</font><br>"); } } break; case OUTPUT_SELFJOIN: { IRCChannelTab *channeltab = new IRCChannelTab((IRCChannel *)output.getParam(0), this, m_mainWindow, (QWidget *)parent()); @@ -303,32 +310,32 @@ void IRCServerTab::display(IRCOutput output) { IRCQueryTab *queryTab = getTabForQuery((IRCPerson *)output.getParam(0)); if (!queryTab) { queryTab = new IRCQueryTab((IRCPerson *)output.getParam(0), this, m_mainWindow, (QWidget *)parent()); m_queryTabs.append(queryTab); m_mainWindow->addTab(queryTab); } queryTab->display(output); } break; case OUTPUT_SELFPART: { IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); if (channelTab) - m_mainWindow->killTab(channelTab); + m_mainWindow->killTab(channelTab, true); } break; case OUTPUT_SELFKICK: { appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>"); IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); if (channelTab) - m_mainWindow->killTab(channelTab); + m_mainWindow->killTab(channelTab, true); } break; case OUTPUT_CHANACTION: { IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); channelTab->appendText("<font color=\"" + m_otherColor + "\">"+output.htmlMessage()+"</font><br>"); } break; case OUTPUT_TOPIC: { IRCChannel *channel = (IRCChannel *) output.getParam(0); if (channel) { IRCChannelTab *channelTab = getTabForChannel(channel); if (channelTab) { |