summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-06 22:47:48 (UTC)
committer zecke <zecke>2004-09-06 22:47:48 (UTC)
commit8f18e8b46dfaaa7e03b9ed1f3faed12da5b30cd5 (patch) (side-by-side diff)
tree39158cd8abe423cf2df95b5038cdc7848de2e3dc
parent8bf99aaa1b31e770b21b7bf50407a650a8f5d646 (diff)
downloadopie-8f18e8b46dfaaa7e03b9ed1f3faed12da5b30cd5.zip
opie-8f18e8b46dfaaa7e03b9ed1f3faed12da5b30cd5.tar.gz
opie-8f18e8b46dfaaa7e03b9ed1f3faed12da5b30cd5.tar.bz2
-Some keyboard handling
-ping notification merge of zautrixs work
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp18
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp24
-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.cpp15
-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, 138 insertions, 18 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
@@ -20,12 +20,17 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
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(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&)));
@@ -38,12 +43,14 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
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()));
settingsChanged();
}
void IRCChannelTab::scrolling(){
m_textview->ensureVisible(0, m_textview->contentsHeight());
@@ -60,12 +67,21 @@ void IRCChannelTab::appendText(QString text) {
} else {
m_lines++;
}
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 ) {
+ int col = text.findRev("color", -1, false);
+ if ( col < p2 )
+ emit ping( title() );
+
+ }
+
emit changed(this);
}
IRCChannelTab::~IRCChannelTab() {
m_parentTab->removeChannelTab(this);
}
@@ -119,13 +135,13 @@ void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &
void IRCChannelTab::popupQuery() {
if (m_list->currentItem() != -1) {
IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text());
if (person) {
IRCQueryTab *tab = m_parentTab->getTabForQuery(person);
if (!tab) {
- tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent());
+ tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent());
m_parentTab->addQueryTab(tab);
m_mainWindow->addTab(tab);
}
}
}
}
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
@@ -1,12 +1,12 @@
#include <qtextstream.h>
#include "ircmessageparser.h"
#include "ircversion.h"
/* Lookup table for literal commands */
-IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = {
+IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = {
{ "PING", FUNC(parseLiteralPing) },
{ "NOTICE", FUNC(parseLiteralNotice) },
{ "JOIN", FUNC(parseLiteralJoin) },
{ "PRIVMSG", FUNC(parseLiteralPrivMsg) },
{ "NICK", FUNC(parseLiteralNick) },
{ "PART", FUNC(parseLiteralPart) },
@@ -17,21 +17,21 @@ IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = {
{ "KICK", FUNC(parseLiteralKick) },
{ "TOPIC", FUNC(parseLiteralTopic) },
{ 0 , 0 }
};
/* Lookup table for literal commands */
-IRCCTCPMessageParserStruct IRCMessageParser::ctcpParserProcTable[] = {
+IRCCTCPMessageParserStruct IRCMessageParser::ctcpParserProcTable[] = {
{ "PING", FUNC(parseCTCPPing) },
{ "VERSION", FUNC(parseCTCPVersion) },
{ "ACTION", FUNC(parseCTCPAction) },
{ 0 , 0 }
};
/* Lookup table for numerical commands */
-IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
+IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
{ 1, FUNC(parseNumerical001) }, // RPL_WELCOME
{ 2, FUNC(parseNumerical002) }, // RPL_YOURHOST
{ 3, FUNC(parseNumerical003) }, // RPL_CREATED
{ 4, FUNC(parseNumerical004) }, // RPL_MYINFO
{ 5, FUNC(parseNumerical005) }, // RPL_BOUNCE, RPL_PROTOCTL
{ 251, FUNC(parseNumericalStats) }, // RPL_LUSERCLIENT
@@ -168,13 +168,13 @@ void IRCMessageParser::parseLiteralPart(IRCMessage *message) {
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel for part not found - desynchronized?")));
}
}
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 */
IRCPerson mask(message->prefix());
IRCPerson *person = m_session->getPerson(mask.nick());
if (!person) {
/* Person not yet known, create and add to the current session */
person = new IRCPerson(message->prefix());
@@ -203,13 +203,13 @@ void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) {
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type")));
}
}
void IRCMessageParser::parseLiteralNick(IRCMessage *message) {
-
+
IRCPerson mask(message->prefix());
/* this way of handling nick changes really sucks */
if (mask.nick() == m_session->m_server->nick()) {
/* We are changing our nickname */
m_session->m_server->setNick(message->param(0));
IRCOutput output(OUTPUT_NICKCHANGE, tr("You are now known as %1").arg( message->param(0)));
@@ -217,13 +217,13 @@ void IRCMessageParser::parseLiteralNick(IRCMessage *message) {
emit outputReady(output);
} else {
/* Someone else is */
IRCPerson *person = m_session->getPerson(mask.nick());
if (person) {
//IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0)));
-
+
/* new code starts here -- this removes the person from all channels */
QList<IRCChannel> channels;
m_session->getChannelsByPerson(person, channels);
QListIterator<IRCChannel> it(channels);
for (;it.current(); ++it) {
IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick());
@@ -231,13 +231,13 @@ void IRCMessageParser::parseLiteralNick(IRCMessage *message) {
chanperson->person->setNick(message->param(0));
it.current()->addPerson(chanperson);
IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0)));
output.addParam(person);
emit outputReady(output);
}
- /* new code ends here */
+ /* new code ends here */
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname change of an unknown person")));
}
}
}
@@ -245,13 +245,13 @@ void IRCMessageParser::parseLiteralQuit(IRCMessage *message) {
IRCPerson mask(message->prefix());
IRCPerson *person = m_session->getPerson(mask.nick());
if (person) {
QList<IRCChannel> channels;
m_session->getChannelsByPerson(person, channels);
QListIterator<IRCChannel> it(channels);
- for (;it.current(); ++it) {
+ for (;it.current(); ++it) {
IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick());
it.current()->removePerson(chanperson);
delete chanperson;
}
m_session->removePerson(person);
IRCOutput output(OUTPUT_QUIT, tr("%1 has quit (%2)" ).arg( mask.nick() ).arg( message->param(0) ));
@@ -322,13 +322,13 @@ void IRCMessageParser::parseCTCPAction(IRCMessage *message) {
emit outputReady(output);
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("CTCP ACTION with bad recipient")));
}
}
}
-
+
void IRCMessageParser::parseLiteralMode(IRCMessage *message) {
IRCPerson mask(message->prefix());
if (message->param(0).startsWith("#")) {
IRCChannel *channel = m_session->getChannel(message->param(0).lower());
if (channel) {
@@ -458,30 +458,30 @@ void IRCMessageParser::parseNumericalNames(IRCMessage *message) {
QString people = message->param(3);
QTextIStream stream(&people);
QString temp;
while (!stream.atEnd()) {
stream >> temp;
-
+
char flagch = temp.at(0).latin1();
int flag = 0;
QString nick;
/* Parse person flags */
if (flagch == '@' || flagch == '+' || flagch=='%' || flagch == '*') {
-
+
nick = temp.right(temp.length()-1);
switch (flagch) {
case '@': flag = PERSON_FLAG_OP; break;
case '+': flag = PERSON_FLAG_VOICE; break;
case '%': flag = PERSON_FLAG_HALFOP; break;
default : flag = 0; break;
}
} else {
nick = temp;
}
-
+
IRCChannelPerson *chan_person = new IRCChannelPerson();
IRCPerson *person = m_session->getPerson(nick);
if (person == 0) {
person = new IRCPerson();
person->setNick(nick);
m_session->addPerson(person);
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
@@ -63,24 +63,37 @@ void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
m_index = -1;
setText("");
}
} else if (key == Key_Return) {
m_history.prepend(text());
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);
}
bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *k = (QKeyEvent *) event;
/* Catch tab characters */
if (k->key() == Key_Tab) {
- odebug << "tab!" << oendl;
+ emit nextTab();
return TRUE;
}
}
return QLineEdit::eventFilter(object, 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
@@ -58,12 +58,20 @@ protected:
class IRCHistoryLineEdit : public QLineEdit {
Q_OBJECT
public:
IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0);
virtual bool eventFilter(QObject *object, QEvent *event);
+public slots:
+ void setEditFocus();
+signals:
+ void nextTab();
+ void prevTab();
+ void closeTab();
+
+
protected:
void keyPressEvent(QKeyEvent *);
protected:
QStringList m_history;
int m_index;
};
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
@@ -13,12 +13,17 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow
m_textview = new QTextView(hbox);
m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
m_textview->setTextFormat(RichText);
QWhatsThis::add(m_textview, tr("Private discussion"));
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"));
m_layout->add(hbox);
hbox->show();
m_layout->add(m_field);
m_field->setFocus();
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
@@ -41,12 +46,16 @@ void IRCQueryTab::appendText(QString text) {
}
} else {
m_lines++;
}
m_textview->setText(txt);
m_textview->ensureVisible(0, m_textview->contentsHeight());
+
+ if ( IRCServerTab::containsPing( text, m_parentTab ) )
+ emit ping( title() );
+
emit changed(this);
}
IRCQueryTab::~IRCQueryTab() {
m_parentTab->removeQueryTab(this);
delete m_person;
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
@@ -1,10 +1,16 @@
#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));
+}
+
+
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;
@@ -13,12 +19,17 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
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()));
@@ -118,20 +129,20 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
}
}
else if (command == "OP"){
QString nickname;
stream >> nickname;
- if (nickname.length() > 0) {
+ if (nickname.length() > 0) {
QString text = line.right(line.length()-nickname.length()-5);
IRCPerson person;
person.setNick(nickname);
m_session->op(((IRCChannelTab *)tab)->channel(), &person);
}
}
-
+
//SEND MODES
else if (command == "MODE"){
QString text = line.right(line.length()-6);
if (text.length() > 0) {
m_session->mode(text);
} else {
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
@@ -30,12 +30,14 @@
#include "ircmisc.h"
class IRCServerTab : public IRCTab {
Q_OBJECT
public:
+ static bool containsPing(const QString& text, IRCServerTab *tab);
+
/* IRCTab implementation */
IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0);
~IRCServerTab();
QString title();
IRCSession *session();
IRCServer *server();
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
@@ -1,10 +1,11 @@
#include <qpe/resource.h>
#include <qpushbutton.h>
#include <qwhatsthis.h>
#include "irctab.h"
+#include "mainwindow.h"
QString IRCTab::m_errorColor;
QString IRCTab::m_serverColor;
QString IRCTab::m_textColor;
QString IRCTab::m_backgroundColor;
QString IRCTab::m_selfColor;
@@ -33,6 +34,12 @@ void IRCTab::setID(int id) {
m_id = id;
}
int IRCTab::id() {
return m_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
@@ -40,15 +40,25 @@ public:
int id();
virtual QString title() = 0;
virtual IRCSession *session() = 0;
virtual void appendText(QString text) = 0;
signals:
void changed(IRCTab *);
+ void ping(const QString& );
+ void nextTab();
+ void prevTab();
+ void closeTab();
+ void editFocus();
+
public slots:
virtual void remove() = 0;
virtual void settingsChanged() = 0;
+
+protected:
+ void showEvent( QShowEvent* );
+
protected:
QLabel *m_description;
QVBoxLayout *m_layout;
int m_id;
public:
/* Configuration shared accross all instances - contains HTML style colors (#rrggbb) */
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
@@ -4,12 +4,17 @@
#include "mainwindow.h"
#include "ircservertab.h"
#include "ircserverlist.h"
#include "ircsettings.h"
+QString MainWindow::appCaption() {
+ return QObject::tr("Opie IRC");
+}
+
+
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
setCaption(tr("IRC Client"));
m_tabWidget = new IRCTabWidget(this);
QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here"));
connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*)));
setCentralWidget(m_tabWidget);
@@ -49,12 +54,17 @@ void MainWindow::selected(QWidget *) {
m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
emit updateScroll();
}
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());
m_tabWidget->showPage(tab);
tab->setID(m_tabWidget->currentPageIndex());
m_tabs.append(tab);
}
@@ -86,6 +96,33 @@ void MainWindow::settings() {
for (; it.current(); ++it) {
/* Inform all tabs about the new settings */
it.current()->settingsChanged();
}
}
}
+
+
+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
@@ -33,19 +33,26 @@ class MainWindow : public QMainWindow {
public:
MainWindow(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
// IRCTabWidget getTabWidget();
void addTab(IRCTab *tab);
void killTab(IRCTab *tab);
static QString appName() { return QString::fromLatin1("opieirc"); }
+ static QString appCaption();
signals:
void updateScroll();
protected slots:
void newConnection();
void settings();
void selected(QWidget *);
void changeEvent(IRCTab *);
+
+ void slotNextTab();
+ void slotPrevTab();
+ void slotCloseTab();
+ void slotPing(const QString&);
+
protected:
void loadSettings();
protected:
IRCTabWidget *m_tabWidget;
QList<IRCTab> m_tabs;
};