summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp16
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp2
-rw-r--r--noncore/net/opieirc/ircmisc.cpp19
-rw-r--r--noncore/net/opieirc/ircmisc.h8
-rw-r--r--noncore/net/opieirc/ircquerytab.cpp9
-rw-r--r--noncore/net/opieirc/ircservertab.cpp11
-rw-r--r--noncore/net/opieirc/ircservertab.h2
-rw-r--r--noncore/net/opieirc/irctab.cpp7
-rw-r--r--noncore/net/opieirc/irctab.h10
-rw-r--r--noncore/net/opieirc/mainwindow.cpp37
-rw-r--r--noncore/net/opieirc/mainwindow.h7
11 files changed, 124 insertions, 4 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp
index 667e977..b6e3954 100644
--- a/noncore/net/opieirc/ircchanneltab.cpp
+++ b/noncore/net/opieirc/ircchanneltab.cpp
@@ -25,2 +25,7 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
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 your message here to participate in the channel discussion"));
@@ -43,2 +48,4 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
m_field->setFocus();
+ m_field->setActiveWindow();
+
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
@@ -65,2 +72,11 @@ void IRCChannelTab::appendText(QString text) {
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 ) {
+ int col = text.findRev("color", -1, false);
+ if ( col < p2 )
+ emit ping( title() );
+
+ }
+
emit changed(this);
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index 400ff41..90280d7 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -173,3 +173,3 @@ void IRCMessageParser::parseLiteralPart(IRCMessage *message) {
void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) {
- if (m_session->m_server->nick() == message->param(0)) {
+ if (m_session->m_server->nick().lower() == message->param(0).lower() ) {
/* IRC Query message detected, verify sender and display it */
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index 6d93a34..df6f874 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -68,6 +68,13 @@ void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
m_index = -1;
- } else if (key == Key_Tab) {
- odebug << "got tab" << oendl;
+ } else if (key == Key_N && event->state() == Qt::ControlButton) {
+ emit nextTab();
+ return;
+ } else if ( ( key == Key_Y || key == Key_Z ) && event->state() == Qt::ControlButton) {
+ emit closeTab();
+ return;
+ } else if (key == Key_P && event->state() == Qt::ControlButton) {
+ emit prevTab();
return;
}
+
QLineEdit::keyPressEvent(event);
@@ -80,3 +87,3 @@ bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
if (k->key() == Key_Tab) {
- odebug << "tab!" << oendl;
+ emit nextTab();
return TRUE;
@@ -86 +93,7 @@ bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
}
+
+
+void IRCHistoryLineEdit::setEditFocus() {
+ setActiveWindow();
+ setFocus();
+}
diff --git a/noncore/net/opieirc/ircmisc.h b/noncore/net/opieirc/ircmisc.h
index b4a5b06..c42dcbd 100644
--- a/noncore/net/opieirc/ircmisc.h
+++ b/noncore/net/opieirc/ircmisc.h
@@ -63,2 +63,10 @@ public:
virtual bool eventFilter(QObject *object, QEvent *event);
+public slots:
+ void setEditFocus();
+signals:
+ void nextTab();
+ void prevTab();
+ void closeTab();
+
+
protected:
diff --git a/noncore/net/opieirc/ircquerytab.cpp b/noncore/net/opieirc/ircquerytab.cpp
index a113b04..1fddc6d 100644
--- a/noncore/net/opieirc/ircquerytab.cpp
+++ b/noncore/net/opieirc/ircquerytab.cpp
@@ -18,2 +18,7 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow
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()));
+
+
QWhatsThis::add(m_field, tr("Type your text here in order to send a message to the other person"));
@@ -46,2 +51,6 @@ void IRCQueryTab::appendText(QString text) {
m_textview->ensureVisible(0, m_textview->contentsHeight());
+
+ if ( IRCServerTab::containsPing( text, m_parentTab ) )
+ emit ping( title() );
+
emit changed(this);
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index d1aab40..2a34c0b 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -4,2 +4,8 @@
+
+bool IRCServerTab::containsPing( const QString& text, IRCServerTab* tab ) {
+ return (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) {
@@ -18,2 +24,7 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
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"));
diff --git a/noncore/net/opieirc/ircservertab.h b/noncore/net/opieirc/ircservertab.h
index 48200d7..69543fc 100644
--- a/noncore/net/opieirc/ircservertab.h
+++ b/noncore/net/opieirc/ircservertab.h
@@ -35,2 +35,4 @@ class IRCServerTab : public IRCTab {
public:
+ static bool containsPing(const QString& text, IRCServerTab *tab);
+
/* IRCTab implementation */
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp
index 3351c3b..8e1dc16 100644
--- a/noncore/net/opieirc/irctab.cpp
+++ b/noncore/net/opieirc/irctab.cpp
@@ -4,2 +4,3 @@
#include "irctab.h"
+#include "mainwindow.h"
@@ -38 +39,7 @@ int IRCTab::id() {
}
+
+void IRCTab::showEvent( QShowEvent *ev ) {
+ topLevelWidget()->setCaption( MainWindow::appCaption() + " " + title() );
+ QWidget::showEvent( ev );
+ emit editFocus();
+}
diff --git a/noncore/net/opieirc/irctab.h b/noncore/net/opieirc/irctab.h
index 7a2d0a2..6c29ea5 100644
--- a/noncore/net/opieirc/irctab.h
+++ b/noncore/net/opieirc/irctab.h
@@ -45,2 +45,8 @@ signals:
void changed(IRCTab *);
+ void ping(const QString& );
+ void nextTab();
+ void prevTab();
+ void closeTab();
+ void editFocus();
+
public slots:
@@ -48,2 +54,6 @@ public slots:
virtual void settingsChanged() = 0;
+
+protected:
+ void showEvent( QShowEvent* );
+
protected:
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 0923a11..1143213 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -9,2 +9,7 @@
+QString MainWindow::appCaption() {
+ return QObject::tr("Opie IRC");
+}
+
+
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
@@ -54,2 +59,7 @@ void MainWindow::addTab(IRCTab *tab) {
connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*)));
+ connect(tab, SIGNAL(ping (const QString&)), this, SLOT(slotPing(const QString&)));
+ connect(tab, SIGNAL(nextTab()), this, SLOT(slotNextTab()));
+ connect(tab, SIGNAL(prevTab()), this, SLOT(slotPrevTab()));
+ connect(tab, SIGNAL(closeTab()), this, SLOT(slotCloseTab()));
+
m_tabWidget->addTab(tab, tab->title());
@@ -91 +101,28 @@ void MainWindow::settings() {
}
+
+
+void MainWindow::slotNextTab() {
+ int i = m_tabWidget->currentPageIndex ();
+ m_tabWidget->setCurrentPage ( i+1 );
+
+ int j = m_tabWidget->currentPageIndex ();
+ if ( i == j )
+ m_tabWidget->setCurrentPage ( 1 );
+}
+
+void MainWindow::slotPrevTab() {
+ int i = m_tabWidget->currentPageIndex ();
+ if ( i > 1 )
+ m_tabWidget->setCurrentPage ( i-1 );
+}
+
+void MainWindow::slotCloseTab() {
+ IRCTab *tab = (IRCTab *) m_tabWidget->currentPage ();
+ if ( tab )
+ killTab ( tab );
+}
+
+void MainWindow::slotPing( const QString& channel ) {
+ raise();
+}
+
diff --git a/noncore/net/opieirc/mainwindow.h b/noncore/net/opieirc/mainwindow.h
index 0f60855..945fc71 100644
--- a/noncore/net/opieirc/mainwindow.h
+++ b/noncore/net/opieirc/mainwindow.h
@@ -38,2 +38,3 @@ public:
static QString appName() { return QString::fromLatin1("opieirc"); }
+ static QString appCaption();
signals:
@@ -45,2 +46,8 @@ protected slots:
void changeEvent(IRCTab *);
+
+ void slotNextTab();
+ void slotPrevTab();
+ void slotCloseTab();
+ void slotPing(const QString&);
+
protected: