author | wazlaf <wazlaf> | 2002-09-23 22:12:39 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-23 22:12:39 (UTC) |
commit | 074769a4adb816153e47d63087e9e326bd3a04bf (patch) (unidiff) | |
tree | cc69651d9e9e5901696a55d9523e343125780705 | |
parent | e0b04701b3c9182ba22f56e329f98c57af4e1fe2 (diff) | |
download | opie-074769a4adb816153e47d63087e9e326bd3a04bf.zip opie-074769a4adb816153e47d63087e9e326bd3a04bf.tar.gz opie-074769a4adb816153e47d63087e9e326bd3a04bf.tar.bz2 |
configuration dialog + color configurability throughout the program + popup menu on the channel person list
-rw-r--r-- | noncore/net/opieirc/ircchannel.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 58 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.h | 10 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.cpp | 31 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.h | 44 | ||||
-rw-r--r-- | noncore/net/opieirc/ircperson.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircquerytab.cpp | 14 | ||||
-rw-r--r-- | noncore/net/opieirc/ircquerytab.h | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservereditor.cpp | 1 | ||||
-rw-r--r-- | noncore/net/opieirc/ircserverlist.cpp | 3 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 43 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.h | 11 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 71 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.h | 46 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.cpp | 9 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.h | 10 | ||||
-rw-r--r-- | noncore/net/opieirc/ircversion.h | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 40 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.h | 7 | ||||
-rw-r--r-- | noncore/net/opieirc/opieirc.pro | 6 |
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,4 +1,3 @@ | |||
1 | #include "ircchannel.h" | 1 | #include "ircchannel.h" |
2 | #include <stdio.h> | ||
3 | 2 | ||
4 | IRCChannel::IRCChannel(QString channelname) { | 3 | IRCChannel::IRCChannel(QString 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,2 +1,5 @@ | |||
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" |
@@ -21,4 +24,16 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
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(); |
@@ -26,5 +41,5 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
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 | ||
@@ -50,8 +65,8 @@ void IRCChannelTab::processCommand() { | |||
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("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+IRCOutput::toHTML(m_field->text())+"<br>"); | 67 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+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 | } |
@@ -59,4 +74,8 @@ void IRCChannelTab::processCommand() { | |||
59 | } | 74 | } |
60 | 75 | ||
76 | void IRCChannelTab::settingsChanged() { | ||
77 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | ||
78 | } | ||
79 | |||
61 | void IRCChannelTab::toggleList() { | 80 | void IRCChannelTab::toggleList() { |
62 | if (m_listVisible) { | 81 | if (m_listVisible) { |
@@ -70,4 +89,37 @@ void IRCChannelTab::toggleList() { | |||
70 | } | 89 | } |
71 | 90 | ||
91 | void 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 | |||
101 | void 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 | |||
115 | void IRCChannelTab::popupPing() { | ||
116 | } | ||
117 | |||
118 | void IRCChannelTab::popupVersion() { | ||
119 | } | ||
120 | |||
121 | void IRCChannelTab::popupWhois() { | ||
122 | } | ||
123 | |||
72 | QString IRCChannelTab::title() { | 124 | QString IRCChannelTab::title() { |
73 | return m_channel->channelname(); | 125 | return m_channel->channelname(); |
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 | |||
@@ -22,4 +22,5 @@ | |||
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" |
@@ -45,6 +46,14 @@ public: | |||
45 | public slots: | 46 | public slots: |
46 | void remove(); | 47 | void remove(); |
48 | void settingsChanged(); | ||
49 | protected 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(); | ||
49 | protected: | 58 | protected: |
50 | IRCServerTab *m_parentTab; | 59 | IRCServerTab *m_parentTab; |
@@ -55,4 +64,5 @@ protected: | |||
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 | }; |
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 | |||
@@ -2,5 +2,4 @@ | |||
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 */ |
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 | |||
5 | IRCColorLabel::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 | |||
13 | void IRCColorLabel::mousePressEvent(QMouseEvent *) { | ||
14 | m_color = OColorDialog::getColor(m_color); | ||
15 | setBackgroundColor(m_color); | ||
16 | } | ||
17 | |||
18 | QColor IRCColorLabel::color() { | ||
19 | return m_color; | ||
20 | } | ||
21 | |||
22 | IRCFramedColorLabel::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 | |||
28 | QColor 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 | |||
27 | class 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 | |||
36 | class 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,4 +1,3 @@ | |||
1 | #include "ircperson.h" | 1 | #include "ircperson.h" |
2 | #include <stdio.h> | ||
3 | 2 | ||
4 | IRCPerson::IRCPerson() { | 3 | IRCPerson::IRCPerson() { |
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 | |||
@@ -19,5 +19,5 @@ IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow | |||
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 | ||
@@ -44,8 +44,8 @@ void IRCQueryTab::processCommand() { | |||
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("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+IRCOutput::toHTML(m_field->text())+"<br>"); | 46 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+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 | } |
@@ -55,8 +55,12 @@ void IRCQueryTab::processCommand() { | |||
55 | void IRCQueryTab::display(IRCOutput output) { | 55 | void IRCQueryTab::display(IRCOutput output) { |
56 | if (output.type() == OUTPUT_QUERYPRIVMSG) { | 56 | if (output.type() == OUTPUT_QUERYPRIVMSG) { |
57 | appendText("<<font color=\"#0000dd\">"+m_person->nick()+"</font>> " + output.htmlMessage() + "<br>"); | 57 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_otherColor + "\">"+m_person->nick()+"</font><font color=\"" + m_textColor + "\">> " + 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 | } |
62 | |||
63 | void IRCQueryTab::settingsChanged() { | ||
64 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | ||
61 | } | 65 | } |
62 | 66 | ||
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 | |||
@@ -40,4 +40,5 @@ public slots: | |||
40 | void processCommand(); | 40 | void processCommand(); |
41 | void display(IRCOutput output); | 41 | void display(IRCOutput output); |
42 | void settingsChanged(); | ||
42 | protected: | 43 | protected: |
43 | bool m_close; | 44 | bool m_close; |
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 | |||
@@ -34,4 +34,5 @@ IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* | |||
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 | } |
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,3 +1,2 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <qlayout.h> | 1 | #include <qlayout.h> |
3 | #include <qlabel.h> | 2 | #include <qlabel.h> |
@@ -6,5 +5,4 @@ | |||
6 | #include "ircserverlist.h" | 5 | #include "ircserverlist.h" |
7 | #include "ircservereditor.h" | 6 | #include "ircservereditor.h" |
8 | #include <stdio.h> | ||
9 | 7 | ||
10 | class IRCListBoxServer : public QListBoxText { | 8 | class IRCListBoxServer : public QListBoxText { |
@@ -103,5 +101,4 @@ int IRCServerList::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++) { |
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,3 +1,3 @@ | |||
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" |
@@ -19,4 +19,5 @@ IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *pa | |||
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 | ||
@@ -39,4 +40,8 @@ void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { | |||
39 | } | 40 | } |
40 | 41 | ||
42 | void IRCServerTab::addQueryTab(IRCQueryTab *tab) { | ||
43 | m_queryTabs.append(tab); | ||
44 | } | ||
45 | |||
41 | QString IRCServerTab::title() { | 46 | QString IRCServerTab::title() { |
42 | return "Server"; | 47 | return "Server"; |
@@ -51,4 +56,8 @@ IRCServer *IRCServerTab::server() { | |||
51 | } | 56 | } |
52 | 57 | ||
58 | void IRCServerTab::settingsChanged() { | ||
59 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | ||
60 | } | ||
61 | |||
53 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | 62 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { |
54 | QTextIStream stream(&line); | 63 | QTextIStream stream(&line); |
@@ -63,5 +72,5 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
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") { |
@@ -69,11 +78,11 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
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 | } |
@@ -86,10 +95,10 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
86 | IRCPerson person; | 95 | IRCPerson person; |
87 | person.setNick(nickname); | 96 | person.setNick(nickname); |
88 | tab->appendText("><font color=\"#0000dd\">"+IRCOutput::toHTML(nickname)+"</font>< "+IRCOutput::toHTML(text)+"<br>"); | 97 | tab->appendText("<font color=\"" + m_textColor + "\">></font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(nickname)+"</font><font color=\"" + m_textColor + "\">< "+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 | } |
@@ -164,8 +173,8 @@ void IRCServerTab::display(IRCOutput output) { | |||
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 | } |
@@ -179,5 +188,5 @@ void IRCServerTab::display(IRCOutput output) { | |||
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("<<font color=\"#0000dd\">"+IRCOutput::toHTML(((IRCChannelPerson *)output.getParam(1))->person->nick())+"</font>> "+output.htmlMessage()+"<br>"); | 190 | channelTab->appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(((IRCChannelPerson *)output.getParam(1))->person->nick())+"</font><font color=\"" + m_textColor + "\">> " + output.htmlMessage()+"</font><br>"); |
182 | } | 191 | } |
183 | break; | 192 | break; |
@@ -200,5 +209,5 @@ void IRCServerTab::display(IRCOutput output) { | |||
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) |
@@ -208,5 +217,5 @@ void IRCServerTab::display(IRCOutput output) { | |||
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; |
@@ -216,5 +225,5 @@ void IRCServerTab::display(IRCOutput output) { | |||
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 | } |
@@ -227,16 +236,16 @@ void IRCServerTab::display(IRCOutput output) { | |||
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 | } |
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 | |||
@@ -43,14 +43,17 @@ public: | |||
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); |
48 | protected: | 52 | protected: |
49 | void appendText(QString text); | 53 | void appendText(QString text); |
50 | IRCChannelTab *getTabForChannel(IRCChannel *channel); | ||
51 | IRCQueryTab *getTabForQuery(IRCPerson *person); | ||
52 | public slots: | 54 | public slots: |
53 | void remove(); | 55 | void remove(); |
54 | void processCommand(); | 56 | void processCommand(); |
57 | void settingsChanged(); | ||
55 | protected slots: | 58 | protected slots: |
56 | void display(IRCOutput output); | 59 | void display(IRCOutput output); |
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 | |||
7 | IRCSettings::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 | |||
44 | QString 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 | |||
51 | void 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 | |||
69 | IRCSettings::~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 | |||
27 | class IRCSettings : public QDialog { | ||
28 | Q_OBJECT | ||
29 | public: | ||
30 | IRCSettings(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0); | ||
31 | QString getColorString(QWidget *widget); | ||
32 | ~IRCSettings(); | ||
33 | protected slots: | ||
34 | void accept(); | ||
35 | protected: | ||
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 | |||
@@ -4,4 +4,13 @@ | |||
4 | #include "irctab.h" | 4 | #include "irctab.h" |
5 | 5 | ||
6 | QString IRCTab::m_errorColor; | ||
7 | QString IRCTab::m_serverColor; | ||
8 | QString IRCTab::m_textColor; | ||
9 | QString IRCTab::m_backgroundColor; | ||
10 | QString IRCTab::m_selfColor; | ||
11 | QString IRCTab::m_otherColor; | ||
12 | QString IRCTab::m_notificationColor; | ||
13 | |||
14 | |||
6 | IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { | 15 | IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { |
7 | m_layout = new QVBoxLayout(this); | 16 | m_layout = new QVBoxLayout(this); |
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 | |||
@@ -41,7 +41,17 @@ public: | |||
41 | public slots: | 41 | public slots: |
42 | virtual void remove() = 0; | 42 | virtual void remove() = 0; |
43 | virtual void settingsChanged() = 0; | ||
43 | protected: | 44 | protected: |
44 | QLabel *m_description; | 45 | QLabel *m_description; |
45 | QVBoxLayout *m_layout; | 46 | QVBoxLayout *m_layout; |
47 | public: | ||
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 | ||
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 | |||
@@ -22,5 +22,5 @@ | |||
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 | ||
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 | |||
@@ -7,9 +7,9 @@ | |||
7 | #include "ircservertab.h" | 7 | #include "ircservertab.h" |
8 | #include "ircserverlist.h" | 8 | #include "ircserverlist.h" |
9 | #include "ircsettings.h" | ||
9 | 10 | ||
10 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { | 11 | MainWindow::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); |
@@ -20,16 +20,20 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindo | |||
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 | ||
24 | void MainWindow::tabSelected(QWidget *) { | 28 | void MainWindow::loadSettings() { |
25 | } | 29 | Config config("OpieIRC"); |
26 | 30 | config.setGroup("OpieIRC"); | |
27 | void 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 | ||
@@ -37,9 +41,10 @@ void 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 | ||
42 | void MainWindow::killTab(IRCTab *tab) { | 46 | void 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; |
@@ -54,2 +59,13 @@ void MainWindow::newConnection() { | |||
54 | } | 59 | } |
55 | } | 60 | } |
61 | |||
62 | void 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 | |||
@@ -24,4 +24,5 @@ | |||
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" |
@@ -37,8 +38,10 @@ public: | |||
37 | protected slots: | 38 | protected slots: |
38 | void newConnection(); | 39 | void newConnection(); |
39 | void closeTab(); | 40 | void settings(); |
40 | void tabSelected(QWidget *widget); | 41 | protected: |
42 | void loadSettings(); | ||
41 | protected: | 43 | protected: |
42 | QTabWidget *m_tabWidget; | 44 | QTabWidget *m_tabWidget; |
45 | QList<IRCTab> m_tabs; | ||
43 | }; | 46 | }; |
44 | 47 | ||
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 | |||
@@ -9,5 +9,5 @@ HEADERS = ircchannel.h ircconnection.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 \ |
@@ -18,7 +18,7 @@ SOURCES = ircchannel.cpp ircconnection.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 |
21 | INCLUDEPATH += $(OPIEDIR)/include | 21 | INCLUDEPATH += $(OPIEDIR)/include |
22 | DEPENDPATH+= $(OPIEDIR)/include | 22 | DEPENDPATH+= $(OPIEDIR)/include |
23 | LIBS += -lqpe | 23 | LIBS += -lqpe -lopie |
24 | 24 | ||