summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchannel.cpp1
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp58
-rw-r--r--noncore/net/opieirc/ircchanneltab.h10
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp1
-rw-r--r--noncore/net/opieirc/ircmisc.cpp31
-rw-r--r--noncore/net/opieirc/ircmisc.h44
-rw-r--r--noncore/net/opieirc/ircperson.cpp1
-rw-r--r--noncore/net/opieirc/ircquerytab.cpp14
-rw-r--r--noncore/net/opieirc/ircquerytab.h1
-rw-r--r--noncore/net/opieirc/ircservereditor.cpp1
-rw-r--r--noncore/net/opieirc/ircserverlist.cpp3
-rw-r--r--noncore/net/opieirc/ircservertab.cpp43
-rw-r--r--noncore/net/opieirc/ircservertab.h11
-rw-r--r--noncore/net/opieirc/ircsettings.cpp71
-rw-r--r--noncore/net/opieirc/ircsettings.h46
-rw-r--r--noncore/net/opieirc/irctab.cpp9
-rw-r--r--noncore/net/opieirc/irctab.h10
-rw-r--r--noncore/net/opieirc/ircversion.h2
-rw-r--r--noncore/net/opieirc/mainwindow.cpp40
-rw-r--r--noncore/net/opieirc/mainwindow.h7
-rw-r--r--noncore/net/opieirc/opieirc.pro6
21 files changed, 357 insertions, 53 deletions
diff --git a/noncore/net/opieirc/ircchannel.cpp b/noncore/net/opieirc/ircchannel.cpp
index 9814a26..5c380e5 100644
--- a/noncore/net/opieirc/ircchannel.cpp
+++ b/noncore/net/opieirc/ircchannel.cpp
@@ -1,6 +1,5 @@
1#include "ircchannel.h" 1#include "ircchannel.h"
2#include <stdio.h>
3 2
4IRCChannel::IRCChannel(QString channelname) { 3IRCChannel::IRCChannel(QString channelname) {
5 m_hasPeople = FALSE; 4 m_hasPeople = FALSE;
6 m_channelname = channelname; 5 m_channelname = channelname;
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp
index 4675265..c1695db 100644
--- a/noncore/net/opieirc/ircchanneltab.cpp
+++ b/noncore/net/opieirc/ircchanneltab.cpp
@@ -1,4 +1,7 @@
1#include <qpe/qpeapplication.h>
2#include <qpe/resource.h>
3#include <qcursor.h>
1#include <qhbox.h> 4#include <qhbox.h>
2#include "ircchanneltab.h" 5#include "ircchanneltab.h"
3#include "ircservertab.h" 6#include "ircservertab.h"
4 7
@@ -19,14 +22,26 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW
19 m_list = new IRCChannelList(m_channel, hbox); 22 m_list = new IRCChannelList(m_channel, hbox);
20 m_list->update(); 23 m_list->update();
21 m_list->setMaximumWidth(LISTWIDTH); 24 m_list->setMaximumWidth(LISTWIDTH);
22 m_field = new QLineEdit(this); 25 m_field = new QLineEdit(this);
26 m_popup = new QPopupMenu(m_list);
27 /* Required so that embedded-style "right" clicks work */
28 QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold);
29 connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &)));
30 /* Construct the popup menu */
31 QPopupMenu *ctcpMenu = new QPopupMenu(m_list);
32 m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu);
33 m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery()));
34 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing()));
35 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion()));
36 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois()));
37
23 m_layout->add(hbox); 38 m_layout->add(hbox);
24 hbox->show(); 39 hbox->show();
25 m_layout->add(m_field); 40 m_layout->add(m_field);
26 m_field->setFocus(); 41 m_field->setFocus();
27 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 42 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
28 43 settingsChanged();
29} 44}
30 45
31void IRCChannelTab::appendText(QString text) { 46void IRCChannelTab::appendText(QString text) {
32 /* not using append because it creates layout problems */ 47 /* not using append because it creates layout problems */
@@ -48,17 +63,21 @@ void IRCChannelTab::processCommand() {
48 } else { 63 } else {
49 if (text.startsWith("//")) 64 if (text.startsWith("//"))
50 text = text.right(text.length()-1); 65 text = text.right(text.length()-1);
51 session()->sendMessage(m_channel, m_field->text()); 66 session()->sendMessage(m_channel, m_field->text());
52 appendText("&lt;<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>&gt; "+IRCOutput::toHTML(m_field->text())+"<br>"); 67 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">&gt; "+IRCOutput::toHTML(m_field->text())+"</font><br>");
53 } 68 }
54 } else { 69 } else {
55 appendText("<font color=\"#ff0000\">"+tr("Disconnected")+"</font><br>"); 70 appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>");
56 } 71 }
57 } 72 }
58 m_field->clear(); 73 m_field->clear();
59} 74}
60 75
76void IRCChannelTab::settingsChanged() {
77 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
78}
79
61void IRCChannelTab::toggleList() { 80void IRCChannelTab::toggleList() {
62 if (m_listVisible) { 81 if (m_listVisible) {
63 m_list->setMaximumWidth(0); 82 m_list->setMaximumWidth(0);
64 m_listButton->setText("<"); 83 m_listButton->setText("<");
@@ -68,8 +87,41 @@ void IRCChannelTab::toggleList() {
68 } 87 }
69 m_listVisible = !m_listVisible; 88 m_listVisible = !m_listVisible;
70} 89}
71 90
91void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) {
92 switch (mouse) {
93 case 1:
94 break;
95 case 2:
96 m_popup->popup(point);
97 break;
98 };
99}
100
101void IRCChannelTab::popupQuery() {
102 if (m_list->currentItem() != -1) {
103 IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text());
104 if (person) {
105 IRCQueryTab *tab = m_parentTab->getTabForQuery(person);
106 if (!tab) {
107 tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent());
108 m_parentTab->addQueryTab(tab);
109 m_mainWindow->addTab(tab);
110 }
111 }
112 }
113}
114
115void IRCChannelTab::popupPing() {
116}
117
118void IRCChannelTab::popupVersion() {
119}
120
121void IRCChannelTab::popupWhois() {
122}
123
72QString IRCChannelTab::title() { 124QString IRCChannelTab::title() {
73 return m_channel->channelname(); 125 return m_channel->channelname();
74} 126}
75 127
diff --git a/noncore/net/opieirc/ircchanneltab.h b/noncore/net/opieirc/ircchanneltab.h
index 2127c4d..971614b 100644
--- a/noncore/net/opieirc/ircchanneltab.h
+++ b/noncore/net/opieirc/ircchanneltab.h
@@ -20,8 +20,9 @@
20 20
21#ifndef __IRCCHANNELTAB_H 21#ifndef __IRCCHANNELTAB_H
22#define __IRCCHANNELTAB_H 22#define __IRCCHANNELTAB_H
23 23
24#include <qpopupmenu.h>
24#include <qpushbutton.h> 25#include <qpushbutton.h>
25#include "irctab.h" 26#include "irctab.h"
26#include "ircsession.h" 27#include "ircsession.h"
27#include "mainwindow.h" 28#include "mainwindow.h"
@@ -43,18 +44,27 @@ public:
43public: 44public:
44 void appendText(QString text); 45 void appendText(QString text);
45public slots: 46public slots:
46 void remove(); 47 void remove();
48 void settingsChanged();
49protected slots:
47 void processCommand(); 50 void processCommand();
48 void toggleList(); 51 void toggleList();
52 void mouseButtonPressed(int mouse, QListBoxItem *item, const QPoint &point);
53 /* Popup slots */
54 void popupQuery();
55 void popupPing();
56 void popupVersion();
57 void popupWhois();
49protected: 58protected:
50 IRCServerTab *m_parentTab; 59 IRCServerTab *m_parentTab;
51 IRCChannel *m_channel; 60 IRCChannel *m_channel;
52 IRCChannelList *m_list; 61 IRCChannelList *m_list;
53 QPushButton *m_listButton; 62 QPushButton *m_listButton;
54 MainWindow *m_mainWindow; 63 MainWindow *m_mainWindow;
55 QTextView *m_textview; 64 QTextView *m_textview;
56 QLineEdit *m_field; 65 QLineEdit *m_field;
66 QPopupMenu *m_popup;
57 bool m_listVisible; 67 bool m_listVisible;
58}; 68};
59 69
60#endif /* __IRCCHANNELTAB_H */ 70#endif /* __IRCCHANNELTAB_H */
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index 3063741..5c70753 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -1,8 +1,7 @@
1#include <qtextstream.h> 1#include <qtextstream.h>
2#include "ircmessageparser.h" 2#include "ircmessageparser.h"
3#include "ircversion.h" 3#include "ircversion.h"
4#include <stdio.h>
5 4
6/* Lookup table for literal commands */ 5/* Lookup table for literal commands */
7IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = { 6IRCLiteralMessageParserStruct IRCMessageParser::literalParserProcTable[] = {
8 { "PING", FUNC(parseLiteralPing) }, 7 { "PING", FUNC(parseLiteralPing) },
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
new file mode 100644
index 0000000..f41a89a
--- a/dev/null
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -0,0 +1,31 @@
1#include <opie/colordialog.h>
2#include <qlayout.h>
3#include "ircmisc.h"
4
5IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) {
6 m_color = color;
7 setAlignment(AlignVCenter | AlignCenter);
8 setFrameStyle(QFrame::StyledPanel);
9 setFrameShadow(QFrame::Sunken);
10 setBackgroundColor(m_color);
11}
12
13void IRCColorLabel::mousePressEvent(QMouseEvent *) {
14 m_color = OColorDialog::getColor(m_color);
15 setBackgroundColor(m_color);
16}
17
18QColor IRCColorLabel::color() {
19 return m_color;
20}
21
22IRCFramedColorLabel::IRCFramedColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
23 QVBoxLayout *layout = new QVBoxLayout(this, 10, 0);
24 m_label = new IRCColorLabel(color, this);
25 layout->addWidget(m_label);
26}
27
28QColor IRCFramedColorLabel::color() {
29 return m_label->color();
30}
31
diff --git a/noncore/net/opieirc/ircmisc.h b/noncore/net/opieirc/ircmisc.h
new file mode 100644
index 0000000..1ea04c8
--- a/dev/null
+++ b/noncore/net/opieirc/ircmisc.h
@@ -0,0 +1,44 @@
1/*
2 OpieIRC - An embedded IRC client
3 Copyright (C) 2002 Wenzel Jakob
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19*/
20
21#ifndef __IRCMISC_H
22#define __IRCMISC_H
23
24#include <qlabel.h>
25#include <qcolor.h>
26
27class IRCColorLabel : public QLabel {
28 public:
29 IRCColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0);
30 QColor color();
31 void mousePressEvent(QMouseEvent *event);
32 protected:
33 QColor m_color;
34};
35
36class IRCFramedColorLabel : public QWidget {
37 public:
38 IRCFramedColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0);
39 QColor color();
40 protected:
41 IRCColorLabel *m_label;
42};
43
44#endif /* __IRCMISC_H */
diff --git a/noncore/net/opieirc/ircperson.cpp b/noncore/net/opieirc/ircperson.cpp
index bd341f1..2f5b435 100644
--- a/noncore/net/opieirc/ircperson.cpp
+++ b/noncore/net/opieirc/ircperson.cpp
@@ -1,6 +1,5 @@
1#include "ircperson.h" 1#include "ircperson.h"
2#include <stdio.h>
3 2
4IRCPerson::IRCPerson() { 3IRCPerson::IRCPerson() {
5 m_nick = ""; 4 m_nick = "";
6 m_user = ""; 5 m_user = "";
diff --git a/noncore/net/opieirc/ircquerytab.cpp b/noncore/net/opieirc/ircquerytab.cpp
index 642cc5b..c6b8211 100644
--- a/noncore/net/opieirc/ircquerytab.cpp
+++ b/noncore/net/opieirc/ircquerytab.cpp
@@ -17,9 +17,9 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow
17 hbox->show(); 17 hbox->show();
18 m_layout->add(m_field); 18 m_layout->add(m_field);
19 m_field->setFocus(); 19 m_field->setFocus();
20 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 20 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
21 21 settingsChanged();
22} 22}
23 23
24void IRCQueryTab::appendText(QString text) { 24void IRCQueryTab::appendText(QString text) {
25 /* not using append because it creates layout problems */ 25 /* not using append because it creates layout problems */
@@ -42,25 +42,29 @@ void IRCQueryTab::processCommand() {
42 } else { 42 } else {
43 if (text.startsWith("//")) 43 if (text.startsWith("//"))
44 text = text.right(text.length()-1); 44 text = text.right(text.length()-1);
45 session()->sendMessage(m_person, m_field->text()); 45 session()->sendMessage(m_person, m_field->text());
46 appendText("&lt;<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>&gt; "+IRCOutput::toHTML(m_field->text())+"<br>"); 46 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">&gt; "+IRCOutput::toHTML(m_field->text())+"</font><br>");
47 } 47 }
48 } else { 48 } else {
49 appendText("<font color=\"#ff0000\">"+tr("Disconnected")+"</font><br>"); 49 appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>");
50 } 50 }
51 } 51 }
52 m_field->clear(); 52 m_field->clear();
53} 53}
54 54
55void IRCQueryTab::display(IRCOutput output) { 55void IRCQueryTab::display(IRCOutput output) {
56 if (output.type() == OUTPUT_QUERYPRIVMSG) { 56 if (output.type() == OUTPUT_QUERYPRIVMSG) {
57 appendText("&lt;<font color=\"#0000dd\">"+m_person->nick()+"</font>&gt; " + output.htmlMessage() + "<br>"); 57 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_otherColor + "\">"+m_person->nick()+"</font><font color=\"" + m_textColor + "\">&gt; " + output.htmlMessage() + "</font><br>");
58 } else if (output.type() == OUTPUT_QUERYACTION) { 58 } else if (output.type() == OUTPUT_QUERYACTION) {
59 appendText("<font color=\"#0000dd\">" + output.htmlMessage() + "<br>"); 59 appendText("<font color=\"" + m_otherColor + "\">" + output.htmlMessage() + "<br>");
60 } 60 }
61} 61}
62 62
63void IRCQueryTab::settingsChanged() {
64 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
65}
66
63QString IRCQueryTab::title() { 67QString IRCQueryTab::title() {
64 return m_person->nick(); 68 return m_person->nick();
65} 69}
66 70
diff --git a/noncore/net/opieirc/ircquerytab.h b/noncore/net/opieirc/ircquerytab.h
index ea777f4..07fa57f 100644
--- a/noncore/net/opieirc/ircquerytab.h
+++ b/noncore/net/opieirc/ircquerytab.h
@@ -38,8 +38,9 @@ public:
38public slots: 38public slots:
39 void remove(); 39 void remove();
40 void processCommand(); 40 void processCommand();
41 void display(IRCOutput output); 41 void display(IRCOutput output);
42 void settingsChanged();
42protected: 43protected:
43 bool m_close; 44 bool m_close;
44 MainWindow *m_mainWindow; 45 MainWindow *m_mainWindow;
45 IRCServerTab *m_parentTab; 46 IRCServerTab *m_parentTab;
diff --git a/noncore/net/opieirc/ircservereditor.cpp b/noncore/net/opieirc/ircservereditor.cpp
index c3a444d..5e916ae 100644
--- a/noncore/net/opieirc/ircservereditor.cpp
+++ b/noncore/net/opieirc/ircservereditor.cpp
@@ -32,8 +32,9 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char*
32 label = new QLabel(tr("Channels :"), this); 32 label = new QLabel(tr("Channels :"), this);
33 m_channels = new QLineEdit(server.channels(), this); 33 m_channels = new QLineEdit(server.channels(), this);
34 layout->addWidget(label, 6, 0); 34 layout->addWidget(label, 6, 0);
35 layout->addWidget(m_channels, 6, 1); 35 layout->addWidget(m_channels, 6, 1);
36 setCaption(tr("Edit server information"));
36 showMaximized(); 37 showMaximized();
37} 38}
38 39
39 40
diff --git a/noncore/net/opieirc/ircserverlist.cpp b/noncore/net/opieirc/ircserverlist.cpp
index e664ba1..3293591 100644
--- a/noncore/net/opieirc/ircserverlist.cpp
+++ b/noncore/net/opieirc/ircserverlist.cpp
@@ -1,12 +1,10 @@
1#include <stdio.h>
2#include <qlayout.h> 1#include <qlayout.h>
3#include <qlabel.h> 2#include <qlabel.h>
4#include <qhbox.h> 3#include <qhbox.h>
5#include <qpushbutton.h> 4#include <qpushbutton.h>
6#include "ircserverlist.h" 5#include "ircserverlist.h"
7#include "ircservereditor.h" 6#include "ircservereditor.h"
8#include <stdio.h>
9 7
10class IRCListBoxServer : public QListBoxText { 8class IRCListBoxServer : public QListBoxText {
11public: 9public:
12 IRCListBoxServer(IRCServer server) : QListBoxText(server.name()) { 10 IRCListBoxServer(IRCServer server) : QListBoxText(server.name()) {
@@ -101,9 +99,8 @@ void IRCServerList::editServer() {
101int IRCServerList::exec() { 99int IRCServerList::exec() {
102 int returncode = QDialog::exec(); 100 int returncode = QDialog::exec();
103 /* Now save the changes */ 101 /* Now save the changes */
104 m_config->setGroup("OpieIRC"); 102 m_config->setGroup("OpieIRC");
105 m_config->clearGroup();
106 m_config->writeEntry("ServerCount", QString::number(m_list->count())); 103 m_config->writeEntry("ServerCount", QString::number(m_list->count()));
107 for (unsigned int i=0; i<m_list->count(); i++) { 104 for (unsigned int i=0; i<m_list->count(); i++) {
108 IRCServer server = ((IRCListBoxServer *)m_list->item(i))->server(); 105 IRCServer server = ((IRCListBoxServer *)m_list->item(i))->server();
109 m_config->setGroup("OpieIRC"); 106 m_config->setGroup("OpieIRC");
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index 8b8771f..4be60ef 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -1,5 +1,5 @@
1#include <stdio.h> 1#include <qpe/config.h>
2#include <qtextstream.h> 2#include <qtextstream.h>
3#include "ircservertab.h" 3#include "ircservertab.h"
4 4
5IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { 5IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
@@ -17,8 +17,9 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa
17 m_layout->add(m_field); 17 m_layout->add(m_field);
18 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 18 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
19 m_field->setFocus(); 19 m_field->setFocus();
20 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); 20 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput)));
21 settingsChanged();
21} 22}
22 23
23void IRCServerTab::appendText(QString text) { 24void IRCServerTab::appendText(QString text) {
24 /* not using append because it creates layout problems */ 25 /* not using append because it creates layout problems */
@@ -37,8 +38,12 @@ void IRCServerTab::removeChannelTab(IRCChannelTab *tab) {
37void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { 38void IRCServerTab::removeQueryTab(IRCQueryTab *tab) {
38 m_queryTabs.remove(tab); 39 m_queryTabs.remove(tab);
39} 40}
40 41
42void IRCServerTab::addQueryTab(IRCQueryTab *tab) {
43 m_queryTabs.append(tab);
44}
45
41QString IRCServerTab::title() { 46QString IRCServerTab::title() {
42 return "Server"; 47 return "Server";
43} 48}
44 49
@@ -49,8 +54,12 @@ IRCSession *IRCServerTab::session() {
49IRCServer *IRCServerTab::server() { 54IRCServer *IRCServerTab::server() {
50 return &m_server; 55 return &m_server;
51} 56}
52 57
58void IRCServerTab::settingsChanged() {
59 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
60}
61
53void IRCServerTab::executeCommand(IRCTab *tab, QString line) { 62void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
54 QTextIStream stream(&line); 63 QTextIStream stream(&line);
55 QString command; 64 QString command;
56 stream >> command; 65 stream >> command;
@@ -61,21 +70,21 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
61 stream >> channel; 70 stream >> channel;
62 if (channel.length() > 0 && channel.startsWith("#")) { 71 if (channel.length() > 0 && channel.startsWith("#")) {
63 m_session->join(channel); 72 m_session->join(channel);
64 } else { 73 } else {
65 tab->appendText("<font color=\"#ff0000\">Unknown channel format!</font><br>"); 74 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>");
66 } 75 }
67 } else if (command == "ME") { 76 } else if (command == "ME") {
68 QString text = line.right(line.length()-4); 77 QString text = line.right(line.length()-4);
69 if (text.length() > 0) { 78 if (text.length() > 0) {
70 if (tab->isA("IRCChannelTab")) { 79 if (tab->isA("IRCChannelTab")) {
71 tab->appendText("<font color=\"#cc0000\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); 80 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>");
72 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); 81 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text);
73 } else if (tab->isA("IRCQueryTab")) { 82 } else if (tab->isA("IRCQueryTab")) {
74 tab->appendText("<font color=\"#cc0000\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); 83 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>");
75 m_session->sendAction(((IRCQueryTab *)tab)->person(), text); 84 m_session->sendAction(((IRCQueryTab *)tab)->person(), text);
76 } else { 85 } else {
77 tab->appendText("<font color=\"#ff0000\">Invalid tab for this command</font><br>"); 86 tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>");
78 } 87 }
79 } 88 }
80 } else if (command == "MSG") { 89 } else if (command == "MSG") {
81 QString nickname; 90 QString nickname;
@@ -84,14 +93,14 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
84 if (line.length() > 6 + nickname.length()) { 93 if (line.length() > 6 + nickname.length()) {
85 QString text = line.right(line.length()-nickname.length()-6); 94 QString text = line.right(line.length()-nickname.length()-6);
86 IRCPerson person; 95 IRCPerson person;
87 person.setNick(nickname); 96 person.setNick(nickname);
88 tab->appendText("&gt;<font color=\"#0000dd\">"+IRCOutput::toHTML(nickname)+"</font>&lt; "+IRCOutput::toHTML(text)+"<br>"); 97 tab->appendText("<font color=\"" + m_textColor + "\">&gt;</font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(nickname)+"</font><font color=\"" + m_textColor + "\">&lt; "+IRCOutput::toHTML(text)+"</font><br>");
89 m_session->sendMessage(&person, text); 98 m_session->sendMessage(&person, text);
90 } 99 }
91 } 100 }
92 } else { 101 } else {
93 tab->appendText("<font color=\"#ff0000\">Unknown command</font><br>"); 102 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>");
94 } 103 }
95} 104}
96 105
97void IRCServerTab::processCommand() { 106void IRCServerTab::processCommand() {
@@ -162,12 +171,12 @@ void IRCServerTab::display(IRCOutput output) {
162 m_mainWindow->killTab(m_queryTabs.current()); 171 m_mainWindow->killTab(m_queryTabs.current());
163 } 172 }
164 m_mainWindow->killTab(this); 173 m_mainWindow->killTab(this);
165 } else { 174 } else {
166 appendText("<font color=\"#0000dd\">" + output.htmlMessage() +"</font><br>"); 175 appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() +"</font><br>");
167 QListIterator<IRCChannelTab> it(m_channelTabs); 176 QListIterator<IRCChannelTab> it(m_channelTabs);
168 for (; it.current(); ++it) { 177 for (; it.current(); ++it) {
169 it.current()->appendText("<font color=\"#0000dd\">" + output.htmlMessage() +"</font><br>"); 178 it.current()->appendText("<font color=\"" + m_serverColor + "\">" + output.htmlMessage() +"</font><br>");
170 } 179 }
171 } 180 }
172 break; 181 break;
173 case OUTPUT_SELFJOIN: { 182 case OUTPUT_SELFJOIN: {
@@ -177,9 +186,9 @@ void IRCServerTab::display(IRCOutput output) {
177 } 186 }
178 break; 187 break;
179 case OUTPUT_CHANPRIVMSG: { 188 case OUTPUT_CHANPRIVMSG: {
180 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 189 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
181 channelTab->appendText("&lt;<font color=\"#0000dd\">"+IRCOutput::toHTML(((IRCChannelPerson *)output.getParam(1))->person->nick())+"</font>&gt; "+output.htmlMessage()+"<br>"); 190 channelTab->appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(((IRCChannelPerson *)output.getParam(1))->person->nick())+"</font><font color=\"" + m_textColor + "\">&gt; " + output.htmlMessage()+"</font><br>");
182 } 191 }
183 break; 192 break;
184 case OUTPUT_QUERYACTION: 193 case OUTPUT_QUERYACTION:
185 case OUTPUT_QUERYPRIVMSG: { 194 case OUTPUT_QUERYPRIVMSG: {
@@ -198,25 +207,25 @@ void IRCServerTab::display(IRCOutput output) {
198 m_mainWindow->killTab(channelTab); 207 m_mainWindow->killTab(channelTab);
199 } 208 }
200 break; 209 break;
201 case OUTPUT_SELFKICK: { 210 case OUTPUT_SELFKICK: {
202 appendText("<font color=\"#ff0000\">" + output.htmlMessage() + "</font><br>"); 211 appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>");
203 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 212 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
204 if (channelTab) 213 if (channelTab)
205 m_mainWindow->killTab(channelTab); 214 m_mainWindow->killTab(channelTab);
206 } 215 }
207 break; 216 break;
208 case OUTPUT_CHANACTION: { 217 case OUTPUT_CHANACTION: {
209 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 218 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
210 channelTab->appendText("<font color=\"#cc0000\">"+output.htmlMessage()+"</font><br>"); 219 channelTab->appendText("<font color=\"" + m_otherColor + "\">"+output.htmlMessage()+"</font><br>");
211 } 220 }
212 break; 221 break;
213 case OUTPUT_QUIT: { 222 case OUTPUT_QUIT: {
214 QString nick = ((IRCPerson *)output.getParam(0))->nick(); 223 QString nick = ((IRCPerson *)output.getParam(0))->nick();
215 QListIterator<IRCChannelTab> it(m_channelTabs); 224 QListIterator<IRCChannelTab> it(m_channelTabs);
216 for (; it.current(); ++it) { 225 for (; it.current(); ++it) {
217 if (it.current()->list()->hasPerson(nick)) { 226 if (it.current()->list()->hasPerson(nick)) {
218 it.current()->appendText("<font color=\"#aa3e00\">"+output.htmlMessage()+"</font><br>"); 227 it.current()->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
219 it.current()->list()->update(); 228 it.current()->list()->update();
220 } 229 }
221 } 230 }
222 } 231 }
@@ -225,19 +234,19 @@ void IRCServerTab::display(IRCOutput output) {
225 case OUTPUT_OTHERKICK: 234 case OUTPUT_OTHERKICK:
226 case OUTPUT_CHANPERSONMODE: 235 case OUTPUT_CHANPERSONMODE:
227 case OUTPUT_OTHERPART: { 236 case OUTPUT_OTHERPART: {
228 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0)); 237 IRCChannelTab *channelTab = getTabForChannel((IRCChannel *)output.getParam(0));
229 channelTab->appendText("<font color=\"#aa3e00\">"+output.htmlMessage()+"</font><br>"); 238 channelTab->appendText("<font color=\"" + m_notificationColor + "\">"+output.htmlMessage()+"</font><br>");
230 channelTab->list()->update(); 239 channelTab->list()->update();
231 } 240 }
232 break; 241 break;
233 case OUTPUT_CTCP: 242 case OUTPUT_CTCP:
234 appendText("<font color=\"#00bb00\">" + output.htmlMessage() + "</font><br>"); 243 appendText("<font color=\"" + m_notificationColor + "\">" + output.htmlMessage() + "</font><br>");
235 break; 244 break;
236 case OUTPUT_ERROR: 245 case OUTPUT_ERROR:
237 appendText("<font color=\"#ff0000\">" + output.htmlMessage() + "</font><br>"); 246 appendText("<font color=\"" + m_errorColor + "\">" + output.htmlMessage() + "</font><br>");
238 break; 247 break;
239 default: 248 default:
240 appendText("<font color=\"#0000dd\">" + output.htmlMessage() + "</font><br>"); 249 appendText("<font color=\"" + m_serverColor + "\">" + output.htmlMessage() + "</font><br>");
241 break; 250 break;
242 } 251 }
243} 252}
diff --git a/noncore/net/opieirc/ircservertab.h b/noncore/net/opieirc/ircservertab.h
index e439d84..698689a 100644
--- a/noncore/net/opieirc/ircservertab.h
+++ b/noncore/net/opieirc/ircservertab.h
@@ -41,18 +41,21 @@ public:
41 void doConnect(); 41 void doConnect();
42 /* Remove tabs from the internal tab lists */ 42 /* Remove tabs from the internal tab lists */
43 void removeChannelTab(IRCChannelTab *tab); 43 void removeChannelTab(IRCChannelTab *tab);
44 void removeQueryTab(IRCQueryTab *tab); 44 void removeQueryTab(IRCQueryTab *tab);
45 45 /* Return tabs from the internal tab lists */
46 /* Execute a user command such as /join */ 46 IRCChannelTab *getTabForChannel(IRCChannel *channel);
47 IRCQueryTab *getTabForQuery(IRCPerson *person);
48 /* Add tabs to the internal tab lists */
49 void addQueryTab(IRCQueryTab *tab);
50 /* Execute a user command such as /join, /msg etc */
47 void executeCommand(IRCTab *tab, QString line); 51 void executeCommand(IRCTab *tab, QString line);
48protected: 52protected:
49 void appendText(QString text); 53 void appendText(QString text);
50 IRCChannelTab *getTabForChannel(IRCChannel *channel);
51 IRCQueryTab *getTabForQuery(IRCPerson *person);
52public slots: 54public slots:
53 void remove(); 55 void remove();
54 void processCommand(); 56 void processCommand();
57 void settingsChanged();
55protected slots: 58protected slots:
56 void display(IRCOutput output); 59 void display(IRCOutput output);
57protected: 60protected:
58 bool m_close; 61 bool m_close;
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp
new file mode 100644
index 0000000..d1fef67
--- a/dev/null
+++ b/noncore/net/opieirc/ircsettings.cpp
@@ -0,0 +1,71 @@
1#include <qlayout.h>
2#include "ircsettings.h"
3#include "irctab.h"
4#include "ircmisc.h"
5#include <stdio.h>
6
7IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags f) : QDialog(parent, name, modal, f) {
8 m_config = new Config("OpieIRC");
9 m_config->setGroup("OpieIRC");
10
11 setCaption("Settings");
12 QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 0);
13 QLabel *label = new QLabel(tr("Background color :"), this);
14 layout->addWidget(label, 0, 0);
15 m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), this);
16 layout->addWidget(m_background, 0, 1);
17 label = new QLabel(tr("Normal text color :"), this);
18 layout->addWidget(label, 1, 0);
19 m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), this);
20 layout->addWidget(m_text, 1, 1);
21 label = new QLabel(tr("Error color :"), this);
22 layout->addWidget(label, 2, 0);
23 m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), this);
24 layout->addWidget(m_error, 2, 1);
25 label = new QLabel(tr("Text written by yourself :"), this);
26 layout->addWidget(label, 3, 0);
27 m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), this);
28 layout->addWidget(m_self, 3, 1);
29 label = new QLabel(tr("Text written by others :"), this);
30 layout->addWidget(label, 4, 0);
31 m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), this);
32 layout->addWidget(m_other, 4, 1);
33 label = new QLabel(tr("Text written by the server :"), this);
34 layout->addWidget(label, 5, 0);
35 m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), this);
36 layout->addWidget(m_server, 5, 1);
37 label = new QLabel(tr("Notifications :"), this);
38 layout->addWidget(label, 6, 0);
39 m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), this);
40 layout->addWidget(m_notification, 6, 1);
41 showMaximized();
42}
43
44QString IRCSettings::getColorString(QWidget *widget) {
45 QColor color = ((IRCFramedColorLabel *)widget)->color();
46 QString temp;
47 temp.sprintf("#%02x%02x%02x", color.red(), color.green(), color.blue());
48 return temp;
49}
50
51void IRCSettings::accept() {
52 IRCTab::m_backgroundColor = getColorString(m_background);
53 IRCTab::m_textColor = getColorString(m_text);
54 IRCTab::m_errorColor = getColorString(m_error);
55 IRCTab::m_selfColor = getColorString(m_self);
56 IRCTab::m_otherColor = getColorString(m_other);
57 IRCTab::m_serverColor = getColorString(m_server);
58 IRCTab::m_notificationColor = getColorString(m_notification);
59 m_config->writeEntry("BackgroundColor", getColorString(m_background));
60 m_config->writeEntry("TextColor", getColorString(m_text));
61 m_config->writeEntry("ErrorColor", getColorString(m_error));
62 m_config->writeEntry("SelfColor", getColorString(m_self));
63 m_config->writeEntry("OtherColor", getColorString(m_other));
64 m_config->writeEntry("ServerColor", getColorString(m_server));
65 m_config->writeEntry("NotificationColor", getColorString(m_notification));
66 QDialog::accept();
67}
68
69IRCSettings::~IRCSettings() {
70 delete m_config;
71}
diff --git a/noncore/net/opieirc/ircsettings.h b/noncore/net/opieirc/ircsettings.h
new file mode 100644
index 0000000..1d3aeb7
--- a/dev/null
+++ b/noncore/net/opieirc/ircsettings.h
@@ -0,0 +1,46 @@
1/*
2 OpieIRC - An embedded IRC client
3 Copyright (C) 2002 Wenzel Jakob
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19*/
20
21#ifndef __IRCSETTINGS_H
22#define __IRCSETTINGS_H
23
24#include <qpe/config.h>
25#include <qdialog.h>
26
27class IRCSettings : public QDialog {
28 Q_OBJECT
29public:
30 IRCSettings(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0);
31 QString getColorString(QWidget *widget);
32 ~IRCSettings();
33protected slots:
34 void accept();
35protected:
36 Config *m_config;
37 QWidget *m_background;
38 QWidget *m_text;
39 QWidget *m_error;
40 QWidget *m_self;
41 QWidget *m_server;
42 QWidget *m_other;
43 QWidget *m_notification;
44};
45
46#endif /* __IRCSETTINGS_H */
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp
index 653a5de..6b578d1 100644
--- a/noncore/net/opieirc/irctab.cpp
+++ b/noncore/net/opieirc/irctab.cpp
@@ -2,8 +2,17 @@
2#include <qpixmap.h> 2#include <qpixmap.h>
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include "irctab.h" 4#include "irctab.h"
5 5
6QString IRCTab::m_errorColor;
7QString IRCTab::m_serverColor;
8QString IRCTab::m_textColor;
9QString IRCTab::m_backgroundColor;
10QString IRCTab::m_selfColor;
11QString IRCTab::m_otherColor;
12QString IRCTab::m_notificationColor;
13
14
6IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { 15IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
7 m_layout = new QVBoxLayout(this); 16 m_layout = new QVBoxLayout(this);
8 QHBoxLayout *descLayout = new QHBoxLayout(m_layout); 17 QHBoxLayout *descLayout = new QHBoxLayout(m_layout);
9 descLayout->setMargin(5); 18 descLayout->setMargin(5);
diff --git a/noncore/net/opieirc/irctab.h b/noncore/net/opieirc/irctab.h
index 0ce9777..248ea13 100644
--- a/noncore/net/opieirc/irctab.h
+++ b/noncore/net/opieirc/irctab.h
@@ -39,10 +39,20 @@ public:
39 virtual IRCSession *session() = 0; 39 virtual IRCSession *session() = 0;
40 virtual void appendText(QString text) = 0; 40 virtual void appendText(QString text) = 0;
41public slots: 41public slots:
42 virtual void remove() = 0; 42 virtual void remove() = 0;
43 virtual void settingsChanged() = 0;
43protected: 44protected:
44 QLabel *m_description; 45 QLabel *m_description;
45 QVBoxLayout *m_layout; 46 QVBoxLayout *m_layout;
47public:
48 /* Configuration shared accross all instances - contains HTML style colors (#rrggbb) */
49 static QString m_errorColor;
50 static QString m_serverColor;
51 static QString m_textColor;
52 static QString m_backgroundColor;
53 static QString m_selfColor;
54 static QString m_otherColor;
55 static QString m_notificationColor;
46}; 56};
47 57
48#endif /* __IRCTAB_H */ 58#endif /* __IRCTAB_H */
diff --git a/noncore/net/opieirc/ircversion.h b/noncore/net/opieirc/ircversion.h
index f8510e6..f0f196e 100644
--- a/noncore/net/opieirc/ircversion.h
+++ b/noncore/net/opieirc/ircversion.h
@@ -20,8 +20,8 @@
20 20
21#ifndef __IRCVERSION_H 21#ifndef __IRCVERSION_H
22#define __IRCVERSION_H 22#define __IRCVERSION_H
23 23
24#define APP_VERSION "OpieIRC 0.2" 24#define APP_VERSION "OpieIRC 0.3"
25#define APP_COPYSTR "(c) 2002 by Wenzel Jakob" 25#define APP_COPYSTR "(c) 2002 by Wenzel Jakob"
26 26
27#endif /* __IRCVERSION_H */ 27#endif /* __IRCVERSION_H */
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index af4ce78..d78e5ab 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -5,43 +5,48 @@
5 5
6#include "mainwindow.h" 6#include "mainwindow.h"
7#include "ircservertab.h" 7#include "ircservertab.h"
8#include "ircserverlist.h" 8#include "ircserverlist.h"
9#include "ircsettings.h"
9 10
10MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { 11MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) {
11 setCaption(tr("IRC Client")); 12 setCaption(tr("IRC Client"));
12 m_tabWidget = new QTabWidget(this); 13 m_tabWidget = new QTabWidget(this);
13 connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(tabSelected(QWidget *)));
14 setCentralWidget(m_tabWidget); 14 setCentralWidget(m_tabWidget);
15 setToolBarsMovable(FALSE); 15 setToolBarsMovable(FALSE);
16 QPEMenuBar *menuBar = new QPEMenuBar(this); 16 QPEMenuBar *menuBar = new QPEMenuBar(this);
17 QPopupMenu *irc = new QPopupMenu(this); 17 QPopupMenu *irc = new QPopupMenu(this);
18 menuBar->insertItem(tr("IRC"), irc); 18 menuBar->insertItem(tr("IRC"), irc);
19 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); 19 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0);
20 connect(a, SIGNAL(activated()), this, SLOT(newConnection())); 20 connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
21 a->addTo(irc); 21 a->addTo(irc);
22 a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0);
23 connect(a, SIGNAL(activated()), this, SLOT(settings()));
24 a->addTo(irc);
25 loadSettings();
22} 26}
23 27
24void MainWindow::tabSelected(QWidget *) { 28void MainWindow::loadSettings() {
25} 29 Config config("OpieIRC");
26 30 config.setGroup("OpieIRC");
27void MainWindow::closeTab() { 31 IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF");
28 /* Does not directly close the tab but triggers an action 32 IRCTab::m_textColor = config.readEntry("TextColor", "#000000");
29 which at some point will close the tab using a callback */ 33 IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000");
30 IRCTab *tab = (IRCTab *)m_tabWidget->currentPage(); 34 IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000");
31 if (tab) { 35 IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB");
32 tab->remove(); 36 IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF");
33 } 37 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300");
34} 38}
35 39
36void MainWindow::addTab(IRCTab *tab) { 40void MainWindow::addTab(IRCTab *tab) {
37 m_tabWidget->addTab(tab, tab->title()); 41 m_tabWidget->addTab(tab, tab->title());
38 m_tabWidget->showPage(tab); 42 m_tabWidget->showPage(tab);
39 tabSelected(tab); 43 m_tabs.append(tab);
40} 44}
41 45
42void MainWindow::killTab(IRCTab *tab) { 46void MainWindow::killTab(IRCTab *tab) {
43 m_tabWidget->removePage(tab); 47 m_tabWidget->removePage(tab);
48 m_tabs.remove(tab);
44 /* there might be nicer ways to do this .. */ 49 /* there might be nicer ways to do this .. */
45 delete tab; 50 delete tab;
46} 51}
47 52
@@ -52,4 +57,15 @@ void MainWindow::newConnection() {
52 addTab(serverTab); 57 addTab(serverTab);
53 serverTab->doConnect(); 58 serverTab->doConnect();
54 } 59 }
55} 60}
61
62void MainWindow::settings() {
63 IRCSettings settings(this, "Settings", TRUE);
64 if (settings.exec() == QDialog::Accepted) {
65 QListIterator<IRCTab> it(m_tabs);
66 for (; it.current(); ++it) {
67 /* Inform all tabs about the new settings */
68 it.current()->settingsChanged();
69 }
70 }
71}
diff --git a/noncore/net/opieirc/mainwindow.h b/noncore/net/opieirc/mainwindow.h
index dcb782f..d057178 100644
--- a/noncore/net/opieirc/mainwindow.h
+++ b/noncore/net/opieirc/mainwindow.h
@@ -22,8 +22,9 @@
22#define __MAINWINDOW_H 22#define __MAINWINDOW_H
23 23
24#include <qmainwindow.h> 24#include <qmainwindow.h>
25#include <qaction.h> 25#include <qaction.h>
26#include <qlist.h>
26#include <qtabwidget.h> 27#include <qtabwidget.h>
27#include "mainwindow.h" 28#include "mainwindow.h"
28#include "irctab.h" 29#include "irctab.h"
29 30
@@ -35,11 +36,13 @@ public:
35 void addTab(IRCTab *tab); 36 void addTab(IRCTab *tab);
36 void killTab(IRCTab *tab); 37 void killTab(IRCTab *tab);
37protected slots: 38protected slots:
38 void newConnection(); 39 void newConnection();
39 void closeTab(); 40 void settings();
40 void tabSelected(QWidget *widget); 41protected:
42 void loadSettings();
41protected: 43protected:
42 QTabWidget *m_tabWidget; 44 QTabWidget *m_tabWidget;
45 QList<IRCTab> m_tabs;
43}; 46};
44 47
45#endif /* __MAINWINDOW_H */ 48#endif /* __MAINWINDOW_H */
diff --git a/noncore/net/opieirc/opieirc.pro b/noncore/net/opieirc/opieirc.pro
index 0e188e4..37742f5 100644
--- a/noncore/net/opieirc/opieirc.pro
+++ b/noncore/net/opieirc/opieirc.pro
@@ -7,18 +7,18 @@ HEADERS = ircchannel.h ircconnection.h \
7 ircperson.h ircserver.h ircsession.h \ 7 ircperson.h ircserver.h ircsession.h \
8 mainwindow.h irctab.h ircservertab.h \ 8 mainwindow.h irctab.h ircservertab.h \
9 ircchanneltab.h ircchannellist.h \ 9 ircchanneltab.h ircchannellist.h \
10 ircserverlist.h ircservereditor.h \ 10 ircserverlist.h ircservereditor.h \
11 ircquerytab.h 11 ircquerytab.h ircsettings.h ircmisc.h
12 SOURCES = ircchannel.cpp ircconnection.cpp \ 12 SOURCES = ircchannel.cpp ircconnection.cpp \
13 ircmessage.cpp \ 13 ircmessage.cpp \
14 ircmessageparser.cpp ircoutput.cpp \ 14 ircmessageparser.cpp ircoutput.cpp \
15 ircperson.cpp ircserver.cpp \ 15 ircperson.cpp ircserver.cpp \
16 ircsession.cpp main.cpp mainwindow.cpp \ 16 ircsession.cpp main.cpp mainwindow.cpp \
17 irctab.cpp ircservertab.cpp \ 17 irctab.cpp ircservertab.cpp \
18 ircchanneltab.cpp ircchannellist.cpp \ 18 ircchanneltab.cpp ircchannellist.cpp \
19 ircserverlist.cpp ircservereditor.cpp \ 19 ircserverlist.cpp ircservereditor.cpp \
20 ircquerytab.cpp 20 ircquerytab.cpp ircsettings.cpp ircmisc.cpp
21INCLUDEPATH += $(OPIEDIR)/include 21INCLUDEPATH += $(OPIEDIR)/include
22 DEPENDPATH+= $(OPIEDIR)/include 22 DEPENDPATH+= $(OPIEDIR)/include
23LIBS += -lqpe 23LIBS += -lqpe -lopie
24 24