summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp16
-rw-r--r--noncore/net/opieirc/ircmisc.h3
-rw-r--r--noncore/net/opieirc/ircservereditor.cpp10
-rw-r--r--noncore/net/opieirc/ircserverlist.cpp7
-rw-r--r--noncore/net/opieirc/ircsettings.cpp11
-rw-r--r--noncore/net/opieirc/mainwindow.cpp6
6 files changed, 48 insertions, 5 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index 2e7f316..c8e6190 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -42,56 +42,72 @@ int IRCTabBar::insertTab(QTab *tab, int index = -1) {
42 ext->r = tab->rect(); 42 ext->r = tab->rect();
43 ext->enabled = tab->isEnabled(); 43 ext->enabled = tab->isEnabled();
44 ext->iconset = tab->iconSet(); 44 ext->iconset = tab->iconSet();
45 delete tab; 45 delete tab;
46 return QTabBar::insertTab(ext, index); 46 return QTabBar::insertTab(ext, index);
47} 47}
48 48
49void IRCTabBar::setTabColor(int index, QColor color) { 49void IRCTabBar::setTabColor(int index, QColor color) {
50 ((QExtTab *)tab(index))->color = color; 50 ((QExtTab *)tab(index))->color = color;
51 update(); 51 update();
52} 52}
53 53
54void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { 54void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const {
55 QRect r = br; 55 QRect r = br;
56 QTabBar::paintLabel(p, br, t, focus); 56 QTabBar::paintLabel(p, br, t, focus);
57 if (t->id == currentTab()) 57 if (t->id == currentTab())
58 r.setBottom(r.bottom() - style().defaultFrameWidth()); 58 r.setBottom(r.bottom() - style().defaultFrameWidth());
59 p->setPen(((QExtTab *)t)->color); 59 p->setPen(((QExtTab *)t)->color);
60 p->drawText(r, AlignCenter | ShowPrefix, t->label); 60 p->drawText(r, AlignCenter | ShowPrefix, t->label);
61} 61}
62 62
63IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { 63IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) {
64 setTabBar(new IRCTabBar(this, "tab control")); 64 setTabBar(new IRCTabBar(this, "tab control"));
65} 65}
66 66
67void IRCTabWidget::setTabColor(int index, QColor color) { 67void IRCTabWidget::setTabColor(int index, QColor color) {
68 ((IRCTabBar *)tabBar())->setTabColor(index, color); 68 ((IRCTabBar *)tabBar())->setTabColor(index, color);
69} 69}
70 70
71 71
72IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { 72IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) {
73 m_index = -1; 73 m_index = -1;
74 installEventFilter(this);
74} 75}
75 76
76void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { 77void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
77 int key = event->key(); 78 int key = event->key();
78 if (key == Key_Up) { 79 if (key == Key_Up) {
79 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { 80 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) {
80 m_index++; 81 m_index++;
81 setText(m_history[m_index]); 82 setText(m_history[m_index]);
82 } 83 }
83 } else if (key == Key_Down) { 84 } else if (key == Key_Down) {
84 if (m_history.count() > 0 && m_index > 0) { 85 if (m_history.count() > 0 && m_index > 0) {
85 m_index--; 86 m_index--;
86 setText(m_history[m_index]); 87 setText(m_history[m_index]);
87 } 88 }
88 if (m_index == 0) { 89 if (m_index == 0) {
89 m_index = -1; 90 m_index = -1;
90 setText(""); 91 setText("");
91 } 92 }
92 } else if (key == Key_Return) { 93 } else if (key == Key_Return) {
93 m_history.prepend(text()); 94 m_history.prepend(text());
94 m_index = -1; 95 m_index = -1;
96 } else if (key == Key_Tab) {
97 printf("got tab\n");
98 return;
95 } 99 }
96 QLineEdit::keyPressEvent(event); 100 QLineEdit::keyPressEvent(event);
97} 101}
102
103bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
104 if (event->type() == QEvent::KeyPress) {
105 QKeyEvent *k = (QKeyEvent *) event;
106 /* Catch tab characters */
107 if (k->key() == Key_Tab) {
108 qDebug("tab!");
109 return TRUE;
110 }
111 }
112 return QLineEdit::eventFilter(object, event);
113}
diff --git a/noncore/net/opieirc/ircmisc.h b/noncore/net/opieirc/ircmisc.h
index 7151e6b..6a8db50 100644
--- a/noncore/net/opieirc/ircmisc.h
+++ b/noncore/net/opieirc/ircmisc.h
@@ -46,46 +46,47 @@ public:
46 IRCFramedColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0); 46 IRCFramedColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0);
47 QColor color(); 47 QColor color();
48protected: 48protected:
49 IRCColorLabel *m_label; 49 IRCColorLabel *m_label;
50}; 50};
51 51
52/* Custom colored QTabWidget */ 52/* Custom colored QTabWidget */
53 53
54class QExtTab : public QTab { 54class QExtTab : public QTab {
55public: 55public:
56 QColor color; 56 QColor color;
57}; 57};
58 58
59class IRCTabWidget : public QTabWidget { 59class IRCTabWidget : public QTabWidget {
60 Q_OBJECT 60 Q_OBJECT
61public: 61public:
62 IRCTabWidget(QWidget *parent = 0, const char *name = 0); 62 IRCTabWidget(QWidget *parent = 0, const char *name = 0);
63 void setTabColor(int index, QColor color); 63 void setTabColor(int index, QColor color);
64}; 64};
65 65
66class IRCTabBar : public QTabBar { 66class IRCTabBar : public QTabBar {
67 Q_OBJECT 67 Q_OBJECT
68public: 68public:
69 IRCTabBar(QWidget *parent = 0, const char *name = 0); 69 IRCTabBar(QWidget *parent = 0, const char *name = 0);
70 void setTabColor(int index, QColor color); 70 void setTabColor(int index, QColor color);
71protected: 71protected:
72 void paintLabel(QPainter*, const QRect&, QTab*, bool) const; 72 void paintLabel(QPainter*, const QRect&, QTab*, bool) const;
73 int insertTab(QTab *, int index = -1); 73 int insertTab(QTab *, int index = -1);
74protected: 74protected:
75 QArray<QColor> m_colors; 75 QArray<QColor> m_colors;
76}; 76};
77 77
78/* A QLineEdit with history functionality */ 78/* A QLineEdit with history functionality and tab completion */
79 79
80class IRCHistoryLineEdit : public QLineEdit { 80class IRCHistoryLineEdit : public QLineEdit {
81 Q_OBJECT 81 Q_OBJECT
82public: 82public:
83 IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); 83 IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0);
84 virtual bool eventFilter(QObject *object, QEvent *event);
84protected: 85protected:
85 void keyPressEvent(QKeyEvent *); 86 void keyPressEvent(QKeyEvent *);
86protected: 87protected:
87 QStringList m_history; 88 QStringList m_history;
88 int m_index; 89 int m_index;
89}; 90};
90 91
91#endif /* __IRCMISC_H */ 92#endif /* __IRCMISC_H */
diff --git a/noncore/net/opieirc/ircservereditor.cpp b/noncore/net/opieirc/ircservereditor.cpp
index f976c84..8604835 100644
--- a/noncore/net/opieirc/ircservereditor.cpp
+++ b/noncore/net/opieirc/ircservereditor.cpp
@@ -1,65 +1,73 @@
1#include <qmessagebox.h> 1#include <qmessagebox.h>
2#include <qlayout.h> 2#include <qlayout.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qwhatsthis.h>
4#include "ircservereditor.h" 5#include "ircservereditor.h"
5 6
6IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal = FALSE, WFlags f) : QDialog(parent, name, modal, f) { 7IRCServerEditor::IRCServerEditor(IRCServer server, QWidget* parent, const char* name, bool modal = FALSE, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
7 QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5); 8 QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 5);
8 QLabel *label = new QLabel(tr("Profile name :"), this); 9 QLabel *label = new QLabel(tr("Profile name :"), this);
9 m_name = new QLineEdit(server.name(), this); 10 m_name = new QLineEdit(server.name(), this);
11 QWhatsThis::add(m_name, tr("The name of this server profile in the overview"));
10 layout->addWidget(label, 0, 0); 12 layout->addWidget(label, 0, 0);
11 layout->addWidget(m_name, 0, 1); 13 layout->addWidget(m_name, 0, 1);
12 label = new QLabel(tr("Hostname :"), this); 14 label = new QLabel(tr("Hostname :"), this);
13 m_hostname = new QLineEdit(server.hostname(), this); 15 m_hostname = new QLineEdit(server.hostname(), this);
16 QWhatsThis::add(m_hostname, tr("The server to connect to - can be any valid host name or IP address"));
14 layout->addWidget(label, 1, 0); 17 layout->addWidget(label, 1, 0);
15 layout->addWidget(m_hostname, 1, 1); 18 layout->addWidget(m_hostname, 1, 1);
16 label = new QLabel(tr("Port :"), this); 19 label = new QLabel(tr("Port :"), this);
17 m_port = new QLineEdit(QString::number(server.port()), this); 20 m_port = new QLineEdit(QString::number(server.port()), this);
21 QWhatsThis::add(m_port, tr("The server port to connect to. Usually 6667"));
18 layout->addWidget(label, 2, 0); 22 layout->addWidget(label, 2, 0);
19 layout->addWidget(m_port, 2, 1); 23 layout->addWidget(m_port, 2, 1);
20 label = new QLabel(tr("Nickname :"), this); 24 label = new QLabel(tr("Nickname :"), this);
21 m_nickname = new QLineEdit(server.nick(), this); 25 m_nickname = new QLineEdit(server.nick(), this);
26 QWhatsThis::add(m_nickname, tr("Your nick name on the IRC network"));
22 layout->addWidget(label, 3, 0); 27 layout->addWidget(label, 3, 0);
23 layout->addWidget(m_nickname, 3, 1); 28 layout->addWidget(m_nickname, 3, 1);
24 label = new QLabel(tr("Realname :"), this); 29 label = new QLabel(tr("Realname :"), this);
25 m_realname = new QLineEdit(server.realname(), this); 30 m_realname = new QLineEdit(server.realname(), this);
31 QWhatsThis::add(m_realname, tr("Your real name"));
26 layout->addWidget(label, 4, 0); 32 layout->addWidget(label, 4, 0);
27 layout->addWidget(m_realname, 4, 1); 33 layout->addWidget(m_realname, 4, 1);
28 label = new QLabel(tr("Password :"), this); 34 label = new QLabel(tr("Password :"), this);
29 m_password = new QLineEdit(server.password(), this); 35 m_password = new QLineEdit(server.password(), this);
36 QWhatsThis::add(m_password, tr("Password to connect to the server (if required)"));
30 layout->addWidget(label, 5, 0); 37 layout->addWidget(label, 5, 0);
31 layout->addWidget(m_password, 5, 1); 38 layout->addWidget(m_password, 5, 1);
32 label = new QLabel(tr("Channels :"), this); 39 label = new QLabel(tr("Channels :"), this);
33 m_channels = new QLineEdit(server.channels(), this); 40 m_channels = new QLineEdit(server.channels(), this);
41 QWhatsThis::add(m_channels, tr("Comma-Separated list of all channels you would like to join automatically"));
34 layout->addWidget(label, 6, 0); 42 layout->addWidget(label, 6, 0);
35 layout->addWidget(m_channels, 6, 1); 43 layout->addWidget(m_channels, 6, 1);
36 setCaption(tr("Edit server information")); 44 setCaption(tr("Edit server information"));
37 showMaximized(); 45 showMaximized();
38} 46}
39 47
40 48
41void IRCServerEditor::accept() { 49void IRCServerEditor::accept() {
42 if (m_name->text().length()==0) 50 if (m_name->text().length()==0)
43 QMessageBox::critical(this, tr("Error"), tr("Profile name required")); 51 QMessageBox::critical(this, tr("Error"), tr("Profile name required"));
44 else if (m_hostname->text().length()==0) 52 else if (m_hostname->text().length()==0)
45 QMessageBox::critical(this, tr("Error"), tr("Host name required")); 53 QMessageBox::critical(this, tr("Error"), tr("Host name required"));
46 else if (m_port->text().toInt()<=0) 54 else if (m_port->text().toInt()<=0)
47 QMessageBox::critical(this, tr("Error"), tr("Port required")); 55 QMessageBox::critical(this, tr("Error"), tr("Port required"));
48 else if (m_nickname->text().length()==0) 56 else if (m_nickname->text().length()==0)
49 QMessageBox::critical(this, tr("Error"), tr("Nickname required")); 57 QMessageBox::critical(this, tr("Error"), tr("Nickname required"));
50 else if (m_realname->text().length()==0) 58 else if (m_realname->text().length()==0)
51 QMessageBox::critical(this, tr("Error"), tr("Realname required")); 59 QMessageBox::critical(this, tr("Error"), tr("Realname required"));
52 else { 60 else {
53 /* Now verify whether the channel list has a valid format */ 61 /* Now verify whether the channel list has a valid format */
54 QStringList channels = QStringList::split(QChar(','), m_channels->text()); 62 QStringList channels = QStringList::split(QChar(','), m_channels->text());
55 for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { 63 for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) {
56 QString channelName = (*it).stripWhiteSpace(); 64 QString channelName = (*it).stripWhiteSpace();
57 if (!channelName.startsWith("#") && !channelName.startsWith("+")) { 65 if (!channelName.startsWith("#") && !channelName.startsWith("+")) {
58 QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with either '#' or '+'")); 66 QMessageBox::critical(this, tr("Error"), tr("The channel list needs to contain a\ncomma separated list of channel\n names which start with either '#' or '+'"));
59 return; 67 return;
60 } 68 }
61 } 69 }
62 QDialog::accept(); 70 QDialog::accept();
63 } 71 }
64} 72}
65 73
diff --git a/noncore/net/opieirc/ircserverlist.cpp b/noncore/net/opieirc/ircserverlist.cpp
index 3293591..595ae3e 100644
--- a/noncore/net/opieirc/ircserverlist.cpp
+++ b/noncore/net/opieirc/ircserverlist.cpp
@@ -1,69 +1,74 @@
1#include <qlayout.h> 1#include <qlayout.h>
2#include <qlabel.h> 2#include <qlabel.h>
3#include <qhbox.h> 3#include <qhbox.h>
4#include <qpushbutton.h> 4#include <qpushbutton.h>
5#include <qwhatsthis.h>
5#include "ircserverlist.h" 6#include "ircserverlist.h"
6#include "ircservereditor.h" 7#include "ircservereditor.h"
7 8
8class IRCListBoxServer : public QListBoxText { 9class IRCListBoxServer : public QListBoxText {
9public: 10public:
10 IRCListBoxServer(IRCServer server) : QListBoxText(server.name()) { 11 IRCListBoxServer(IRCServer server) : QListBoxText(server.name()) {
11 m_server = server; 12 m_server = server;
12 } 13 }
13 14
14 IRCServer server() { 15 IRCServer server() {
15 return m_server; 16 return m_server;
16 } 17 }
17 18
18 void setServer(IRCServer server) { 19 void setServer(IRCServer server) {
19 m_server = server; 20 m_server = server;
20 setText(m_server.name()); 21 setText(m_server.name());
21 } 22 }
22protected: 23protected:
23 IRCServer m_server; 24 IRCServer m_server;
24}; 25};
25 26
26IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFlags f) : QDialog(parent, name, modal, f) { 27IRCServerList::IRCServerList(QWidget* parent, const char *name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
27 QVBoxLayout *layout = new QVBoxLayout(this, 5, 5); 28 QVBoxLayout *layout = new QVBoxLayout(this, 5, 5);
28 setCaption(tr("Serverlist Browser")); 29 setCaption(tr("Serverlist Browser"));
29 QLabel *label = new QLabel(tr("Please choose a server profile"), this); 30 QLabel *label = new QLabel(tr("Please choose a server profile"), this);
30 label->setAlignment(AlignHCenter); 31 label->setAlignment(AlignHCenter);
31 layout->addWidget(label); 32 layout->addWidget(label);
32 m_list = new QListBox(this); 33 m_list = new QListBox(this);
34 QWhatsThis::add(m_list, tr("Select a server profile from this list and then tap on OK in the upper-right corner"));
33 layout->addWidget(m_list); 35 layout->addWidget(m_list);
34 QHBox *buttons = new QHBox(this); 36 QHBox *buttons = new QHBox(this);
35 QPushButton *del = new QPushButton(tr("Delete"), buttons); 37 QPushButton *del = new QPushButton(tr("Delete"), buttons);
36 QPushButton *edit = new QPushButton(tr("Edit"), buttons); 38 QPushButton *edit = new QPushButton(tr("Edit"), buttons);
37 QPushButton *add = new QPushButton(tr("Add"), buttons); 39 QPushButton *add = new QPushButton(tr("Add"), buttons);
40 QWhatsThis::add(del, tr("Delete the currently selected server profile"));
41 QWhatsThis::add(edit, tr("Edit the currently selected server profile"));
42 QWhatsThis::add(add, tr("Add a new server profile"));
38 connect(del, SIGNAL(clicked()), this, SLOT(delServer())); 43 connect(del, SIGNAL(clicked()), this, SLOT(delServer()));
39 connect(edit, SIGNAL(clicked()), this, SLOT(editServer())); 44 connect(edit, SIGNAL(clicked()), this, SLOT(editServer()));
40 connect(add, SIGNAL(clicked()), this, SLOT(addServer())); 45 connect(add, SIGNAL(clicked()), this, SLOT(addServer()));
41 layout->addWidget(buttons); 46 layout->addWidget(buttons);
42 /* Load the configuration file */ 47 /* Load the configuration file */
43 m_config = new Config("OpieIRC"); 48 m_config = new Config("OpieIRC");
44 m_config->setGroup("OpieIRC"); 49 m_config->setGroup("OpieIRC");
45 int count = m_config->readNumEntry("ServerCount", 0); 50 int count = m_config->readNumEntry("ServerCount", 0);
46 if (count) { 51 if (count) {
47 for (int i=0; i<count; i++) { 52 for (int i=0; i<count; i++) {
48 m_config->setGroup("OpieIRC"); 53 m_config->setGroup("OpieIRC");
49 QString name = m_config->readEntry("Server"+QString::number(i)); 54 QString name = m_config->readEntry("Server"+QString::number(i));
50 if (name.length() > 0) { 55 if (name.length() > 0) {
51 IRCServer server; 56 IRCServer server;
52 m_config->setGroup(name); 57 m_config->setGroup(name);
53 server.setName(name); 58 server.setName(name);
54 server.setHostname(m_config->readEntry("Hostname")); 59 server.setHostname(m_config->readEntry("Hostname"));
55 server.setPort(m_config->readNumEntry("Port")); 60 server.setPort(m_config->readNumEntry("Port"));
56 server.setUsername(m_config->readEntry("Username")); 61 server.setUsername(m_config->readEntry("Username"));
57 server.setPassword(m_config->readEntry("Password")); 62 server.setPassword(m_config->readEntry("Password"));
58 server.setNick(m_config->readEntry("Nick")); 63 server.setNick(m_config->readEntry("Nick"));
59 server.setRealname(m_config->readEntry("Realname")); 64 server.setRealname(m_config->readEntry("Realname"));
60 server.setChannels(m_config->readEntry("Channels")); 65 server.setChannels(m_config->readEntry("Channels"));
61 m_list->insertItem(new IRCListBoxServer(server)); 66 m_list->insertItem(new IRCListBoxServer(server));
62 } 67 }
63 } 68 }
64 } 69 }
65 70
66 showMaximized(); 71 showMaximized();
67} 72}
68 73
69void IRCServerList::addServer() { 74void IRCServerList::addServer() {
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp
index 1903e87..78eaed3 100644
--- a/noncore/net/opieirc/ircsettings.cpp
+++ b/noncore/net/opieirc/ircsettings.cpp
@@ -1,92 +1,101 @@
1#include <qlayout.h> 1#include <qlayout.h>
2#include <qvalidator.h> 2#include <qvalidator.h>
3#include <qscrollview.h> 3#include <qscrollview.h>
4#include <qwhatsthis.h>
4#include "ircsettings.h" 5#include "ircsettings.h"
5#include "irctab.h" 6#include "irctab.h"
6#include "ircmisc.h" 7#include "ircmisc.h"
7 8
8IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags f) : QDialog(parent, name, modal, f) { 9IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
9 setCaption("Settings"); 10 setCaption("Settings");
10 m_config = new Config("OpieIRC"); 11 m_config = new Config("OpieIRC");
11 m_config->setGroup("OpieIRC"); 12 m_config->setGroup("OpieIRC");
12 QHBoxLayout *l = new QHBoxLayout(this, 2, 2); 13 QHBoxLayout *l = new QHBoxLayout(this, 2, 2);
13 QTabWidget *tw = new QTabWidget(this); 14 QTabWidget *tw = new QTabWidget(this);
14 l->addWidget(tw); 15 l->addWidget(tw);
15 /* General Configuration */ 16 /* General Configuration */
16 QWidget *widget = new QWidget(tw); 17 QWidget *widget = new QWidget(tw);
17 QGridLayout *layout = new QGridLayout(widget, 1, 2, 5, 0); 18 QGridLayout *layout = new QGridLayout(widget, 1, 2, 5, 0);
18 QLabel *label = new QLabel(tr("Lines displayed :"), widget); 19 QLabel *label = new QLabel(tr("Lines displayed :"), widget);
19 layout->addWidget(label, 0, 0); 20 layout->addWidget(label, 0, 0);
20 m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), widget); 21 m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), widget);
22 QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this"));
21 QIntValidator *validator = new QIntValidator(this); 23 QIntValidator *validator = new QIntValidator(this);
22 validator->setTop(10000); 24 validator->setTop(10000);
23 validator->setBottom(0); 25 validator->setBottom(0);
24 m_lines->setValidator(validator); 26 m_lines->setValidator(validator);
25 layout->addWidget(m_lines, 0, 1); 27 layout->addWidget(m_lines, 0, 1);
26 tw->addTab(widget, tr("General")); 28 tw->addTab(widget, tr("General"));
27 29
28 /* Color configuration */ 30 /* Color configuration */
29 QScrollView *view = new QScrollView(tw); 31 QScrollView *view = new QScrollView(tw);
30 view->setResizePolicy(QScrollView::AutoOneFit); 32 view->setResizePolicy(QScrollView::AutoOneFit);
31 widget = new QWidget(view->viewport()); 33 widget = new QWidget(view->viewport());
32 view->addChild(widget); 34 view->addChild(widget);
33 layout = new QGridLayout(widget, 7, 2, 5, 0); 35 layout = new QGridLayout(widget, 7, 2, 5, 0);
34 label = new QLabel(tr("Background color :"), widget); 36 label = new QLabel(tr("Background color :"), widget);
35 layout->addWidget(label, 0, 0); 37 layout->addWidget(label, 0, 0);
36 m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), widget); 38 m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), widget);
39 QWhatsThis::add(m_background, tr("Background color to be used in chats"));
37 layout->addWidget(m_background, 0, 1); 40 layout->addWidget(m_background, 0, 1);
38 label = new QLabel(tr("Normal text color :"), widget); 41 label = new QLabel(tr("Normal text color :"), widget);
39 layout->addWidget(label, 1, 0); 42 layout->addWidget(label, 1, 0);
40 m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), widget); 43 m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), widget);
44 QWhatsThis::add(m_text, tr("Text color to be used in chats"));
41 layout->addWidget(m_text, 1, 1); 45 layout->addWidget(m_text, 1, 1);
42 label = new QLabel(tr("Error color :"), widget); 46 label = new QLabel(tr("Error color :"), widget);
43 layout->addWidget(label, 2, 0); 47 layout->addWidget(label, 2, 0);
44 m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), widget); 48 m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), widget);
49 QWhatsThis::add(m_error, tr("Text color to be used to display errors"));
45 layout->addWidget(m_error, 2, 1); 50 layout->addWidget(m_error, 2, 1);
46 label = new QLabel(tr("Text written by yourself :"), widget); 51 label = new QLabel(tr("Text written by yourself :"), widget);
47 layout->addWidget(label, 3, 0); 52 layout->addWidget(label, 3, 0);
48 m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), widget); 53 m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), widget);
54 QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself"));
49 layout->addWidget(m_self, 3, 1); 55 layout->addWidget(m_self, 3, 1);
50 label = new QLabel(tr("Text written by others :"), widget); 56 label = new QLabel(tr("Text written by others :"), widget);
51 layout->addWidget(label, 4, 0); 57 layout->addWidget(label, 4, 0);
52 m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), widget); 58 m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), widget);
59 QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others"));
53 layout->addWidget(m_other, 4, 1); 60 layout->addWidget(m_other, 4, 1);
54 label = new QLabel(tr("Text written by the server :"), widget); 61 label = new QLabel(tr("Text written by the server :"), widget);
55 layout->addWidget(label, 5, 0); 62 layout->addWidget(label, 5, 0);
56 m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), widget); 63 m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), widget);
64 QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server"));
57 layout->addWidget(m_server, 5, 1); 65 layout->addWidget(m_server, 5, 1);
58 label = new QLabel(tr("Notifications :"), widget); 66 label = new QLabel(tr("Notifications :"), widget);
59 layout->addWidget(label, 6, 0); 67 layout->addWidget(label, 6, 0);
60 m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), widget); 68 m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), widget);
69 QWhatsThis::add(m_notification, tr("Text color to be used to display notifications"));
61 layout->addWidget(m_notification, 6, 1); 70 layout->addWidget(m_notification, 6, 1);
62 tw->addTab(view, tr("Colors")); 71 tw->addTab(view, tr("Colors"));
63 showMaximized(); 72 showMaximized();
64} 73}
65 74
66QString IRCSettings::getColorString(QWidget *widget) { 75QString IRCSettings::getColorString(QWidget *widget) {
67 QColor color = ((IRCFramedColorLabel *)widget)->color(); 76 QColor color = ((IRCFramedColorLabel *)widget)->color();
68 QString temp; 77 QString temp;
69 temp.sprintf("#%02x%02x%02x", color.red(), color.green(), color.blue()); 78 temp.sprintf("#%02x%02x%02x", color.red(), color.green(), color.blue());
70 return temp; 79 return temp;
71} 80}
72 81
73void IRCSettings::accept() { 82void IRCSettings::accept() {
74 IRCTab::m_backgroundColor = getColorString(m_background); 83 IRCTab::m_backgroundColor = getColorString(m_background);
75 IRCTab::m_textColor = getColorString(m_text); 84 IRCTab::m_textColor = getColorString(m_text);
76 IRCTab::m_errorColor = getColorString(m_error); 85 IRCTab::m_errorColor = getColorString(m_error);
77 IRCTab::m_selfColor = getColorString(m_self); 86 IRCTab::m_selfColor = getColorString(m_self);
78 IRCTab::m_otherColor = getColorString(m_other); 87 IRCTab::m_otherColor = getColorString(m_other);
79 IRCTab::m_serverColor = getColorString(m_server); 88 IRCTab::m_serverColor = getColorString(m_server);
80 IRCTab::m_notificationColor = getColorString(m_notification); 89 IRCTab::m_notificationColor = getColorString(m_notification);
81 IRCTab::m_maxLines = m_lines->text().toInt(); 90 IRCTab::m_maxLines = m_lines->text().toInt();
82 m_config->writeEntry("BackgroundColor", getColorString(m_background)); 91 m_config->writeEntry("BackgroundColor", getColorString(m_background));
83 m_config->writeEntry("TextColor", getColorString(m_text)); 92 m_config->writeEntry("TextColor", getColorString(m_text));
84 m_config->writeEntry("ErrorColor", getColorString(m_error)); 93 m_config->writeEntry("ErrorColor", getColorString(m_error));
85 m_config->writeEntry("SelfColor", getColorString(m_self)); 94 m_config->writeEntry("SelfColor", getColorString(m_self));
86 m_config->writeEntry("OtherColor", getColorString(m_other)); 95 m_config->writeEntry("OtherColor", getColorString(m_other));
87 m_config->writeEntry("ServerColor", getColorString(m_server)); 96 m_config->writeEntry("ServerColor", getColorString(m_server));
88 m_config->writeEntry("NotificationColor", getColorString(m_notification)); 97 m_config->writeEntry("NotificationColor", getColorString(m_notification));
89 m_config->writeEntry("Lines", m_lines->text()); 98 m_config->writeEntry("Lines", m_lines->text());
90 QDialog::accept(); 99 QDialog::accept();
91} 100}
92 101
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index bb03a1c..7928310 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -1,55 +1,59 @@
1#include <qpe/qpemenubar.h> 1#include <qpe/qpemenubar.h>
2#include <qpe/resource.h> 2#include <qpe/resource.h>
3#include <qpe/config.h> 3#include <qpe/config.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qwhatsthis.h>
5 6
6#include "mainwindow.h" 7#include "mainwindow.h"
7#include "ircservertab.h" 8#include "ircservertab.h"
8#include "ircserverlist.h" 9#include "ircserverlist.h"
9#include "ircsettings.h" 10#include "ircsettings.h"
10 11
11MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { 12MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
12 setCaption(tr("IRC Client")); 13 setCaption(tr("IRC Client"));
13 m_tabWidget = new IRCTabWidget(this); 14 m_tabWidget = new IRCTabWidget(this);
15 QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here"));
14 connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); 16 connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *)));
15 setCentralWidget(m_tabWidget); 17 setCentralWidget(m_tabWidget);
16 setToolBarsMovable(FALSE); 18 setToolBarsMovable(FALSE);
17 QPEMenuBar *menuBar = new QPEMenuBar(this); 19 QPEMenuBar *menuBar = new QPEMenuBar(this);
18 QPopupMenu *irc = new QPopupMenu(this); 20 QPopupMenu *irc = new QPopupMenu(this);
19 menuBar->insertItem(tr("IRC"), irc); 21 menuBar->insertItem(tr("IRC"), irc);
20 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); 22 QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0);
21 connect(a, SIGNAL(activated()), this, SLOT(newConnection())); 23 connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
24 a->setWhatsThis(tr("Create a new connection to an IRC server"));
22 a->addTo(irc); 25 a->addTo(irc);
23 a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); 26 a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0);
27 a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
24 connect(a, SIGNAL(activated()), this, SLOT(settings())); 28 connect(a, SIGNAL(activated()), this, SLOT(settings()));
25 a->addTo(irc); 29 a->addTo(irc);
26 loadSettings(); 30 loadSettings();
27} 31}
28 32
29void MainWindow::loadSettings() { 33void MainWindow::loadSettings() {
30 Config config("OpieIRC"); 34 Config config("OpieIRC");
31 config.setGroup("OpieIRC"); 35 config.setGroup("OpieIRC");
32 IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); 36 IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF");
33 IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); 37 IRCTab::m_textColor = config.readEntry("TextColor", "#000000");
34 IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); 38 IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000");
35 IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); 39 IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000");
36 IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); 40 IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB");
37 IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); 41 IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF");
38 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); 42 IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300");
39 IRCTab::m_maxLines = config.readNumEntry("Lines", 100); 43 IRCTab::m_maxLines = config.readNumEntry("Lines", 100);
40} 44}
41 45
42void MainWindow::selected(QWidget *) { 46void MainWindow::selected(QWidget *) {
43 m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); 47 m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
44} 48}
45 49
46void MainWindow::addTab(IRCTab *tab) { 50void MainWindow::addTab(IRCTab *tab) {
47 connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); 51 connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *)));
48 m_tabWidget->addTab(tab, tab->title()); 52 m_tabWidget->addTab(tab, tab->title());
49 m_tabWidget->showPage(tab); 53 m_tabWidget->showPage(tab);
50 tab->setID(m_tabWidget->currentPageIndex()); 54 tab->setID(m_tabWidget->currentPageIndex());
51 m_tabs.append(tab); 55 m_tabs.append(tab);
52} 56}
53 57
54void MainWindow::changeEvent(IRCTab *tab) { 58void MainWindow::changeEvent(IRCTab *tab) {
55 if (tab->id() != m_tabWidget->currentPageIndex()) 59 if (tab->id() != m_tabWidget->currentPageIndex())