-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 16 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.cpp | 19 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.h | 8 | ||||
-rw-r--r-- | noncore/net/opieirc/ircquerytab.cpp | 9 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 11 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.h | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.cpp | 7 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.h | 10 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 37 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.h | 7 |
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 | |||
@@ -23,6 +23,11 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
23 | m_list->update(); | 23 | m_list->update(); |
24 | m_list->setMaximumWidth(LISTWIDTH); | 24 | m_list->setMaximumWidth(LISTWIDTH); |
25 | m_field = new IRCHistoryLineEdit(this); | 25 | m_field = new IRCHistoryLineEdit(this); |
26 | connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); | ||
27 | connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); | ||
28 | connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab())); | ||
29 | connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); | ||
30 | |||
26 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); | 31 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); |
27 | m_popup = new QPopupMenu(m_list); | 32 | m_popup = new QPopupMenu(m_list); |
28 | m_lines = 0; | 33 | m_lines = 0; |
@@ -41,6 +46,8 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
41 | hbox->show(); | 46 | hbox->show(); |
42 | m_layout->add(m_field); | 47 | m_layout->add(m_field); |
43 | m_field->setFocus(); | 48 | m_field->setFocus(); |
49 | m_field->setActiveWindow(); | ||
50 | |||
44 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 51 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
45 | settingsChanged(); | 52 | settingsChanged(); |
46 | } | 53 | } |
@@ -63,6 +70,15 @@ void IRCChannelTab::appendText(QString text) { | |||
63 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 70 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
64 | m_textview->setText(txt); | 71 | m_textview->setText(txt); |
65 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 72 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
73 | |||
74 | int p1, p2; | ||
75 | 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); | ||
77 | if ( col < p2 ) | ||
78 | emit ping( title() ); | ||
79 | |||
80 | } | ||
81 | |||
66 | emit changed(this); | 82 | emit changed(this); |
67 | } | 83 | } |
68 | 84 | ||
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 | |||
@@ -171,7 +171,7 @@ void IRCMessageParser::parseLiteralPart(IRCMessage *message) { | |||
171 | } | 171 | } |
172 | 172 | ||
173 | void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) { | 173 | void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) { |
174 | if (m_session->m_server->nick() == message->param(0)) { | 174 | if (m_session->m_server->nick().lower() == message->param(0).lower() ) { |
175 | /* IRC Query message detected, verify sender and display it */ | 175 | /* IRC Query message detected, verify sender and display it */ |
176 | IRCPerson mask(message->prefix()); | 176 | IRCPerson mask(message->prefix()); |
177 | IRCPerson *person = m_session->getPerson(mask.nick()); | 177 | IRCPerson *person = m_session->getPerson(mask.nick()); |
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 | |||
@@ -66,10 +66,17 @@ void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { | |||
66 | } else if (key == Key_Return) { | 66 | } else if (key == Key_Return) { |
67 | m_history.prepend(text()); | 67 | m_history.prepend(text()); |
68 | m_index = -1; | 68 | m_index = -1; |
69 | } else if (key == Key_Tab) { | 69 | } else if (key == Key_N && event->state() == Qt::ControlButton) { |
70 | odebug << "got tab" << oendl; | 70 | emit nextTab(); |
71 | return; | ||
72 | } else if ( ( key == Key_Y || key == Key_Z ) && event->state() == Qt::ControlButton) { | ||
73 | emit closeTab(); | ||
74 | return; | ||
75 | } else if (key == Key_P && event->state() == Qt::ControlButton) { | ||
76 | emit prevTab(); | ||
71 | return; | 77 | return; |
72 | } | 78 | } |
79 | |||
73 | QLineEdit::keyPressEvent(event); | 80 | QLineEdit::keyPressEvent(event); |
74 | } | 81 | } |
75 | 82 | ||
@@ -78,9 +85,15 @@ bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { | |||
78 | QKeyEvent *k = (QKeyEvent *) event; | 85 | QKeyEvent *k = (QKeyEvent *) event; |
79 | /* Catch tab characters */ | 86 | /* Catch tab characters */ |
80 | if (k->key() == Key_Tab) { | 87 | if (k->key() == Key_Tab) { |
81 | odebug << "tab!" << oendl; | 88 | emit nextTab(); |
82 | return TRUE; | 89 | return TRUE; |
83 | } | 90 | } |
84 | } | 91 | } |
85 | return QLineEdit::eventFilter(object, event); | 92 | return QLineEdit::eventFilter(object, event); |
86 | } | 93 | } |
94 | |||
95 | |||
96 | void IRCHistoryLineEdit::setEditFocus() { | ||
97 | setActiveWindow(); | ||
98 | setFocus(); | ||
99 | } | ||
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 | |||
@@ -61,6 +61,14 @@ class IRCHistoryLineEdit : public QLineEdit { | |||
61 | public: | 61 | public: |
62 | IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); | 62 | IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); |
63 | virtual bool eventFilter(QObject *object, QEvent *event); | 63 | virtual bool eventFilter(QObject *object, QEvent *event); |
64 | public slots: | ||
65 | void setEditFocus(); | ||
66 | signals: | ||
67 | void nextTab(); | ||
68 | void prevTab(); | ||
69 | void closeTab(); | ||
70 | |||
71 | |||
64 | protected: | 72 | protected: |
65 | void keyPressEvent(QKeyEvent *); | 73 | void keyPressEvent(QKeyEvent *); |
66 | protected: | 74 | 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 | |||
@@ -16,6 +16,11 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow | |||
16 | m_textview->setTextFormat(RichText); | 16 | m_textview->setTextFormat(RichText); |
17 | QWhatsThis::add(m_textview, tr("Private discussion")); | 17 | QWhatsThis::add(m_textview, tr("Private discussion")); |
18 | m_field = new IRCHistoryLineEdit(this); | 18 | m_field = new IRCHistoryLineEdit(this); |
19 | connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); | ||
20 | connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); | ||
21 | connect(m_field, SIGNAL(closeTab()),this, SIGNAL(closeTab())); | ||
22 | |||
23 | |||
19 | QWhatsThis::add(m_field, tr("Type your text here in order to send a message to the other person")); | 24 | QWhatsThis::add(m_field, tr("Type your text here in order to send a message to the other person")); |
20 | m_layout->add(hbox); | 25 | m_layout->add(hbox); |
21 | hbox->show(); | 26 | hbox->show(); |
@@ -44,6 +49,10 @@ void IRCQueryTab::appendText(QString text) { | |||
44 | } | 49 | } |
45 | m_textview->setText(txt); | 50 | m_textview->setText(txt); |
46 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 51 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
52 | |||
53 | if ( IRCServerTab::containsPing( text, m_parentTab ) ) | ||
54 | emit ping( title() ); | ||
55 | |||
47 | emit changed(this); | 56 | emit changed(this); |
48 | } | 57 | } |
49 | 58 | ||
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 | |||
@@ -2,6 +2,12 @@ | |||
2 | #include <qwhatsthis.h> | 2 | #include <qwhatsthis.h> |
3 | #include "ircservertab.h" | 3 | #include "ircservertab.h" |
4 | 4 | ||
5 | |||
6 | bool IRCServerTab::containsPing( const QString& text, IRCServerTab* tab ) { | ||
7 | return (text.find("ping") != -1 && text.find( tab->server()->nick() != -1)); | ||
8 | } | ||
9 | |||
10 | |||
5 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 11 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
6 | m_server = server; | 12 | m_server = server; |
7 | m_session = new IRCSession(&m_server); | 13 | m_session = new IRCSession(&m_server); |
@@ -16,6 +22,11 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa | |||
16 | QWhatsThis::add(m_textview, tr("Server messages")); | 22 | QWhatsThis::add(m_textview, tr("Server messages")); |
17 | m_layout->add(m_textview); | 23 | m_layout->add(m_textview); |
18 | m_field = new IRCHistoryLineEdit(this); | 24 | m_field = new IRCHistoryLineEdit(this); |
25 | connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); | ||
26 | connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); | ||
27 | connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab())); | ||
28 | connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); | ||
29 | |||
19 | QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); | 30 | QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); |
20 | m_layout->add(m_field); | 31 | m_layout->add(m_field); |
21 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 32 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
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 | |||
@@ -33,6 +33,8 @@ | |||
33 | class IRCServerTab : public IRCTab { | 33 | class IRCServerTab : public IRCTab { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | static bool containsPing(const QString& text, IRCServerTab *tab); | ||
37 | |||
36 | /* IRCTab implementation */ | 38 | /* IRCTab implementation */ |
37 | IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 39 | IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
38 | ~IRCServerTab(); | 40 | ~IRCServerTab(); |
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 | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | #include <qwhatsthis.h> | 3 | #include <qwhatsthis.h> |
4 | #include "irctab.h" | 4 | #include "irctab.h" |
5 | #include "mainwindow.h" | ||
5 | 6 | ||
6 | QString IRCTab::m_errorColor; | 7 | QString IRCTab::m_errorColor; |
7 | QString IRCTab::m_serverColor; | 8 | QString IRCTab::m_serverColor; |
@@ -36,3 +37,9 @@ void IRCTab::setID(int id) { | |||
36 | int IRCTab::id() { | 37 | int IRCTab::id() { |
37 | return m_id; | 38 | return m_id; |
38 | } | 39 | } |
40 | |||
41 | void IRCTab::showEvent( QShowEvent *ev ) { | ||
42 | topLevelWidget()->setCaption( MainWindow::appCaption() + " " + title() ); | ||
43 | QWidget::showEvent( ev ); | ||
44 | emit editFocus(); | ||
45 | } | ||
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 | |||
@@ -43,9 +43,19 @@ public: | |||
43 | virtual void appendText(QString text) = 0; | 43 | virtual void appendText(QString text) = 0; |
44 | signals: | 44 | signals: |
45 | void changed(IRCTab *); | 45 | void changed(IRCTab *); |
46 | void ping(const QString& ); | ||
47 | void nextTab(); | ||
48 | void prevTab(); | ||
49 | void closeTab(); | ||
50 | void editFocus(); | ||
51 | |||
46 | public slots: | 52 | public slots: |
47 | virtual void remove() = 0; | 53 | virtual void remove() = 0; |
48 | virtual void settingsChanged() = 0; | 54 | virtual void settingsChanged() = 0; |
55 | |||
56 | protected: | ||
57 | void showEvent( QShowEvent* ); | ||
58 | |||
49 | protected: | 59 | protected: |
50 | QLabel *m_description; | 60 | QLabel *m_description; |
51 | QVBoxLayout *m_layout; | 61 | QVBoxLayout *m_layout; |
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 | |||
@@ -7,6 +7,11 @@ | |||
7 | #include "ircserverlist.h" | 7 | #include "ircserverlist.h" |
8 | #include "ircsettings.h" | 8 | #include "ircsettings.h" |
9 | 9 | ||
10 | QString MainWindow::appCaption() { | ||
11 | return QObject::tr("Opie IRC"); | ||
12 | } | ||
13 | |||
14 | |||
10 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 15 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
11 | setCaption(tr("IRC Client")); | 16 | setCaption(tr("IRC Client")); |
12 | m_tabWidget = new IRCTabWidget(this); | 17 | m_tabWidget = new IRCTabWidget(this); |
@@ -52,6 +57,11 @@ void MainWindow::selected(QWidget *) { | |||
52 | 57 | ||
53 | void MainWindow::addTab(IRCTab *tab) { | 58 | void MainWindow::addTab(IRCTab *tab) { |
54 | connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*))); | 59 | connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*))); |
60 | connect(tab, SIGNAL(ping (const QString&)), this, SLOT(slotPing(const QString&))); | ||
61 | connect(tab, SIGNAL(nextTab()), this, SLOT(slotNextTab())); | ||
62 | connect(tab, SIGNAL(prevTab()), this, SLOT(slotPrevTab())); | ||
63 | connect(tab, SIGNAL(closeTab()), this, SLOT(slotCloseTab())); | ||
64 | |||
55 | m_tabWidget->addTab(tab, tab->title()); | 65 | m_tabWidget->addTab(tab, tab->title()); |
56 | m_tabWidget->showPage(tab); | 66 | m_tabWidget->showPage(tab); |
57 | tab->setID(m_tabWidget->currentPageIndex()); | 67 | tab->setID(m_tabWidget->currentPageIndex()); |
@@ -89,3 +99,30 @@ void MainWindow::settings() { | |||
89 | } | 99 | } |
90 | } | 100 | } |
91 | } | 101 | } |
102 | |||
103 | |||
104 | void MainWindow::slotNextTab() { | ||
105 | int i = m_tabWidget->currentPageIndex (); | ||
106 | m_tabWidget->setCurrentPage ( i+1 ); | ||
107 | |||
108 | int j = m_tabWidget->currentPageIndex (); | ||
109 | if ( i == j ) | ||
110 | m_tabWidget->setCurrentPage ( 1 ); | ||
111 | } | ||
112 | |||
113 | void MainWindow::slotPrevTab() { | ||
114 | int i = m_tabWidget->currentPageIndex (); | ||
115 | if ( i > 1 ) | ||
116 | m_tabWidget->setCurrentPage ( i-1 ); | ||
117 | } | ||
118 | |||
119 | void MainWindow::slotCloseTab() { | ||
120 | IRCTab *tab = (IRCTab *) m_tabWidget->currentPage (); | ||
121 | if ( tab ) | ||
122 | killTab ( tab ); | ||
123 | } | ||
124 | |||
125 | void MainWindow::slotPing( const QString& channel ) { | ||
126 | raise(); | ||
127 | } | ||
128 | |||
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 | |||
@@ -36,6 +36,7 @@ public: | |||
36 | void addTab(IRCTab *tab); | 36 | void addTab(IRCTab *tab); |
37 | void killTab(IRCTab *tab); | 37 | void killTab(IRCTab *tab); |
38 | static QString appName() { return QString::fromLatin1("opieirc"); } | 38 | static QString appName() { return QString::fromLatin1("opieirc"); } |
39 | static QString appCaption(); | ||
39 | signals: | 40 | signals: |
40 | void updateScroll(); | 41 | void updateScroll(); |
41 | protected slots: | 42 | protected slots: |
@@ -43,6 +44,12 @@ protected slots: | |||
43 | void settings(); | 44 | void settings(); |
44 | void selected(QWidget *); | 45 | void selected(QWidget *); |
45 | void changeEvent(IRCTab *); | 46 | void changeEvent(IRCTab *); |
47 | |||
48 | void slotNextTab(); | ||
49 | void slotPrevTab(); | ||
50 | void slotCloseTab(); | ||
51 | void slotPing(const QString&); | ||
52 | |||
46 | protected: | 53 | protected: |
47 | void loadSettings(); | 54 | void loadSettings(); |
48 | protected: | 55 | protected: |