summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-06 23:51:20 (UTC)
committer zecke <zecke>2004-09-06 23:51:20 (UTC)
commite6798d7ec0a3b86e412bd67faad24a737a67aa5f (patch) (unidiff)
treeff10e927aff440d8dca2e0fe8976aadb3ff011d2
parent8f18e8b46dfaaa7e03b9ed1f3faed12da5b30cd5 (diff)
downloadopie-e6798d7ec0a3b86e412bd67faad24a737a67aa5f.zip
opie-e6798d7ec0a3b86e412bd67faad24a737a67aa5f.tar.gz
opie-e6798d7ec0a3b86e412bd67faad24a737a67aa5f.tar.bz2
Use OKeyConfigWidget/Manager for managing next and prev tab
keyboard shortcuts
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmisc.cpp44
-rw-r--r--noncore/net/opieirc/ircmisc.h14
-rw-r--r--noncore/net/opieirc/ircsettings.cpp20
-rw-r--r--noncore/net/opieirc/ircsettings.h4
-rw-r--r--noncore/net/opieirc/irctab.cpp9
-rw-r--r--noncore/net/opieirc/mainwindow.cpp1
6 files changed, 84 insertions, 8 deletions
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp
index df6f874..9b9bff8 100644
--- a/noncore/net/opieirc/ircmisc.cpp
+++ b/noncore/net/opieirc/ircmisc.cpp
@@ -1,99 +1,133 @@
1#include "ircmisc.h" 1#include "ircmisc.h"
2 2
3/* OPIE */ 3/* OPIE */
4#include <opie2/odebug.h> 4#include <opie2/odebug.h>
5#include <opie2/oconfig.h>
6#include <opie2/okeyconfigmanager.h>
5using namespace Opie::Core; 7using namespace Opie::Core;
6 8
9
7IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { 10IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
8} 11}
9 12
10int IRCTabBar::insertTab(QTab *tab, int index) { 13int IRCTabBar::insertTab(QTab *tab, int index) {
11 /* FIXME: find some nicer way to do this */ 14 /* FIXME: find some nicer way to do this */
12 QExtTab *ext = new QExtTab(); 15 QExtTab *ext = new QExtTab();
13 ext->color = black; 16 ext->color = black;
14 ext->label = tab->text(); 17 ext->label = tab->text();
15 ext->r = tab->rect(); 18 ext->r = tab->rect();
16 ext->enabled = tab->isEnabled(); 19 ext->enabled = tab->isEnabled();
17 ext->iconset = tab->iconSet(); 20 ext->iconset = tab->iconSet();
18 delete tab; 21 delete tab;
19 return QTabBar::insertTab(ext, index); 22 return QTabBar::insertTab(ext, index);
20} 23}
21 24
22void IRCTabBar::setTabColor(int index, QColor color) { 25void IRCTabBar::setTabColor(int index, QColor color) {
23 ((QExtTab *)tab(index))->color = color; 26 ((QExtTab *)tab(index))->color = color;
24 update(); 27 update();
25} 28}
26 29
27void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { 30void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const {
28 QRect r = br; 31 QRect r = br;
29 QTabBar::paintLabel(p, br, t, focus); 32 QTabBar::paintLabel(p, br, t, focus);
30 if (t->id == currentTab()) 33 if (t->id == currentTab())
31 r.setBottom(r.bottom() - style().defaultFrameWidth()); 34 r.setBottom(r.bottom() - style().defaultFrameWidth());
32 p->setPen(((QExtTab *)t)->color); 35 p->setPen(((QExtTab *)t)->color);
33 p->drawText(r, AlignCenter | ShowPrefix, t->label); 36 p->drawText(r, AlignCenter | ShowPrefix, t->label);
34} 37}
35 38
36IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { 39IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) {
37 setTabBar(new IRCTabBar(this, "tab control")); 40 setTabBar(new IRCTabBar(this, "tab control"));
38} 41}
39 42
40void IRCTabWidget::setTabColor(int index, QColor color) { 43void IRCTabWidget::setTabColor(int index, QColor color) {
41 ((IRCTabBar *)tabBar())->setTabColor(index, color); 44 ((IRCTabBar *)tabBar())->setTabColor(index, color);
42} 45}
43 46
44 47
48
49static OKeyConfigManager* s_manager = 0;
50OKeyConfigManager* IRCHistoryLineEdit::keyConfigInstance() {
51 if ( !s_manager ) {
52 /*
53 * black list with the DeviceButtons as default
54 * because we do not grab the keyboard and they
55 * wouldn't work
56 */
57 OKeyPair::List blackList = OKeyPair::hardwareKeys();
58 blackList.append( OKeyPair::returnKey() );
59 blackList.append( OKeyPair::leftArrowKey() );
60 blackList.append( OKeyPair::upArrowKey() );
61 blackList.append( OKeyPair::downArrowKey() );
62
63 s_manager = new OKeyConfigManager(new OConfig("opieirc-keys"),
64 "keys", blackList,
65 false, 0, "irc_history_line_keyconfigm" );
66 s_manager->addKeyConfig( OKeyConfigItem( tr("Next Tab"), "next_tab", QPixmap(),
67 KeyNextTab, OKeyPair(Qt::Key_N, Qt::ControlButton) ));
68 s_manager->addKeyConfig( OKeyConfigItem( tr("Previous Tab"), "prev_tab", QPixmap(),
69 KeyPrevTab, OKeyPair(Qt::Key_P, Qt::ControlButton) ));
70 s_manager->load();
71 }
72
73 return s_manager;
74}
75
76
45IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { 77IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) {
46 m_index = -1; 78 m_index = -1;
47 installEventFilter(this); 79 installEventFilter(this);
48} 80}
49 81
50void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { 82void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
51 int key = event->key(); 83 int key = event->key();
52 if (key == Key_Up) { 84 if (key == Key_Up) {
53 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { 85 if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) {
54 m_index++; 86 m_index++;
55 setText(m_history[m_index]); 87 setText(m_history[m_index]);
56 } 88 }
57 } else if (key == Key_Down) { 89 } else if (key == Key_Down) {
58 if (m_history.count() > 0 && m_index > 0) { 90 if (m_history.count() > 0 && m_index > 0) {
59 m_index--; 91 m_index--;
60 setText(m_history[m_index]); 92 setText(m_history[m_index]);
61 } 93 }
62 if (m_index == 0) { 94 if (m_index == 0) {
63 m_index = -1; 95 m_index = -1;
64 setText(""); 96 setText("");
65 } 97 }
66 } else if (key == Key_Return) { 98 } else if (key == Key_Return) {
67 m_history.prepend(text()); 99 m_history.prepend(text());
68 m_index = -1; 100 m_index = -1;
69 } else if (key == Key_N && event->state() == Qt::ControlButton) { 101 }
102
103 switch( keyConfigInstance()->handleKeyEventId( event ) ) {
104 case KeyNextTab:
70 emit nextTab(); 105 emit nextTab();
71 return; 106 return;
72 } else if ( ( key == Key_Y || key == Key_Z ) && event->state() == Qt::ControlButton) { 107 case KeyPrevTab:
73 emit closeTab();
74 return;
75 } else if (key == Key_P && event->state() == Qt::ControlButton) {
76 emit prevTab(); 108 emit prevTab();
77 return; 109 return;
110 default:
111 break;
78 } 112 }
79 113
80 QLineEdit::keyPressEvent(event); 114 QLineEdit::keyPressEvent(event);
81} 115}
82 116
83bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { 117bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
84 if (event->type() == QEvent::KeyPress) { 118 if (event->type() == QEvent::KeyPress) {
85 QKeyEvent *k = (QKeyEvent *) event; 119 QKeyEvent *k = (QKeyEvent *) event;
86 /* Catch tab characters */ 120 /* Catch tab characters */
87 if (k->key() == Key_Tab) { 121 if (k->key() == Key_Tab) {
88 emit nextTab(); 122 emit nextTab();
89 return TRUE; 123 return TRUE;
90 } 124 }
91 } 125 }
92 return QLineEdit::eventFilter(object, event); 126 return QLineEdit::eventFilter(object, event);
93} 127}
94 128
95 129
96void IRCHistoryLineEdit::setEditFocus() { 130void IRCHistoryLineEdit::setEditFocus() {
97 setActiveWindow(); 131 setActiveWindow();
98 setFocus(); 132 setFocus();
99} 133}
diff --git a/noncore/net/opieirc/ircmisc.h b/noncore/net/opieirc/ircmisc.h
index c42dcbd..37eed28 100644
--- a/noncore/net/opieirc/ircmisc.h
+++ b/noncore/net/opieirc/ircmisc.h
@@ -7,73 +7,87 @@
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 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 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 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18
19*/ 19*/
20 20
21#ifndef __IRCMISC_H 21#ifndef __IRCMISC_H
22#define __IRCMISC_H 22#define __IRCMISC_H
23 23
24#include <qtabwidget.h> 24#include <qtabwidget.h>
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qtabbar.h> 26#include <qtabbar.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qcolor.h> 28#include <qcolor.h>
29#include <qarray.h> 29#include <qarray.h>
30 30
31namespace Opie {
32namespace Core {
33class OKeyConfigManager;
34}
35}
36
37
31/* Custom colored QTabWidget */ 38/* Custom colored QTabWidget */
32 39
33class QExtTab : public QTab { 40class QExtTab : public QTab {
34public: 41public:
35 QColor color; 42 QColor color;
36}; 43};
37 44
38class IRCTabWidget : public QTabWidget { 45class IRCTabWidget : public QTabWidget {
39 Q_OBJECT 46 Q_OBJECT
40public: 47public:
41 IRCTabWidget(QWidget *parent = 0, const char *name = 0); 48 IRCTabWidget(QWidget *parent = 0, const char *name = 0);
42 void setTabColor(int index, QColor color); 49 void setTabColor(int index, QColor color);
43}; 50};
44 51
45class IRCTabBar : public QTabBar { 52class IRCTabBar : public QTabBar {
46 Q_OBJECT 53 Q_OBJECT
47public: 54public:
48 IRCTabBar(QWidget *parent = 0, const char *name = 0); 55 IRCTabBar(QWidget *parent = 0, const char *name = 0);
49 void setTabColor(int index, QColor color); 56 void setTabColor(int index, QColor color);
50protected: 57protected:
51 void paintLabel(QPainter*, const QRect&, QTab*, bool) const; 58 void paintLabel(QPainter*, const QRect&, QTab*, bool) const;
52 int insertTab(QTab *, int index = -1); 59 int insertTab(QTab *, int index = -1);
53protected: 60protected:
54 QArray<QColor> m_colors; 61 QArray<QColor> m_colors;
55}; 62};
56 63
57/* A QLineEdit with history functionality and tab completion */ 64/* A QLineEdit with history functionality and tab completion */
58 65
59class IRCHistoryLineEdit : public QLineEdit { 66class IRCHistoryLineEdit : public QLineEdit {
60 Q_OBJECT 67 Q_OBJECT
61public: 68public:
69 enum KeyMode {
70 KeyNextTab,
71 KeyPrevTab
72 };
73
74 static Opie::Core::OKeyConfigManager* keyConfigInstance();
75
62 IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); 76 IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0);
63 virtual bool eventFilter(QObject *object, QEvent *event); 77 virtual bool eventFilter(QObject *object, QEvent *event);
64public slots: 78public slots:
65 void setEditFocus(); 79 void setEditFocus();
66signals: 80signals:
67 void nextTab(); 81 void nextTab();
68 void prevTab(); 82 void prevTab();
69 void closeTab(); 83 void closeTab();
70 84
71 85
72protected: 86protected:
73 void keyPressEvent(QKeyEvent *); 87 void keyPressEvent(QKeyEvent *);
74protected: 88protected:
75 QStringList m_history; 89 QStringList m_history;
76 int m_index; 90 int m_index;
77}; 91};
78 92
79#endif /* __IRCMISC_H */ 93#endif /* __IRCMISC_H */
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp
index 13fcc24..1fba030 100644
--- a/noncore/net/opieirc/ircsettings.cpp
+++ b/noncore/net/opieirc/ircsettings.cpp
@@ -1,31 +1,33 @@
1 1
2#include "ircsettings.h" 2#include "ircsettings.h"
3#include "irctab.h" 3#include "irctab.h"
4#include "ircmisc.h"
4 5
5/* OPIE */ 6/* OPIE */
6#include <opie2/ocolorbutton.h> 7#include <opie2/ocolorbutton.h>
7#include <opie2/otabwidget.h> 8#include <opie2/otabwidget.h>
9#include <opie2/okeyconfigwidget.h>
8#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
9 11
10/* QT */ 12/* QT */
11#include <qvalidator.h> 13#include <qvalidator.h>
12#include <qwhatsthis.h> 14#include <qwhatsthis.h>
13 15
14using namespace Opie; 16using namespace Opie;
15using namespace Opie::Ui; 17using namespace Opie::Ui;
16IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) 18IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp)
17{ 19{
18 setCaption(tr("Settings") ); 20 setCaption(tr("Settings") );
19 m_config = new Config("OpieIRC"); 21 m_config = new Config("OpieIRC");
20 m_config->setGroup("OpieIRC"); 22 m_config->setGroup("OpieIRC");
21 QHBoxLayout *l = new QHBoxLayout(this, 2, 2); 23 QHBoxLayout *l = new QHBoxLayout(this, 2, 2);
22 OTabWidget *tw = new OTabWidget(this); 24 OTabWidget *tw = new OTabWidget(this);
23 l->addWidget(tw); 25 l->addWidget(tw);
24 /* General Configuration */ 26 /* General Configuration */
25 QWidget *genwidget = new QWidget(tw); 27 QWidget *genwidget = new QWidget(tw);
26 QGridLayout *layout = new QGridLayout(genwidget, 1, 2, 5, 0); 28 QGridLayout *layout = new QGridLayout(genwidget, 1, 2, 5, 0);
27 QLabel *label = new QLabel(tr("Lines displayed :"), genwidget); 29 QLabel *label = new QLabel(tr("Lines displayed :"), genwidget);
28 layout->addWidget(label, 0, 0); 30 layout->addWidget(label, 0, 0);
29 m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget); 31 m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget);
30 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")); 32 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"));
31 QIntValidator *validator = new QIntValidator(this); 33 QIntValidator *validator = new QIntValidator(this);
@@ -57,54 +59,70 @@ IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags)
57 m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000")); 59 m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000"));
58 QWhatsThis::add(m_error, tr("Text color to be used to display errors")); 60 QWhatsThis::add(m_error, tr("Text color to be used to display errors"));
59 layout->addWidget(m_error, 2, 1); 61 layout->addWidget(m_error, 2, 1);
60 label = new QLabel(tr("Text written by yourself :"), widget); 62 label = new QLabel(tr("Text written by yourself :"), widget);
61 layout->addWidget(label, 3, 0); 63 layout->addWidget(label, 3, 0);
62 m_self = new OColorButton(widget, m_config->readEntry("SelfColor", "#CC0000")); 64 m_self = new OColorButton(widget, m_config->readEntry("SelfColor", "#CC0000"));
63 QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself")); 65 QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself"));
64 layout->addWidget(m_self, 3, 1); 66 layout->addWidget(m_self, 3, 1);
65 label = new QLabel(tr("Text written by others :"), widget); 67 label = new QLabel(tr("Text written by others :"), widget);
66 layout->addWidget(label, 4, 0); 68 layout->addWidget(label, 4, 0);
67 m_other = new OColorButton(widget, m_config->readEntry("OtherColor", "#0000BB")); 69 m_other = new OColorButton(widget, m_config->readEntry("OtherColor", "#0000BB"));
68 QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others")); 70 QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others"));
69 layout->addWidget(m_other, 4, 1); 71 layout->addWidget(m_other, 4, 1);
70 label = new QLabel(tr("Text written by the server :"), widget); 72 label = new QLabel(tr("Text written by the server :"), widget);
71 layout->addWidget(label, 5, 0); 73 layout->addWidget(label, 5, 0);
72 m_server = new OColorButton(widget, m_config->readEntry("ServerColor", "#0000FF")); 74 m_server = new OColorButton(widget, m_config->readEntry("ServerColor", "#0000FF"));
73 QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server")); 75 QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server"));
74 layout->addWidget(m_server, 5, 1); 76 layout->addWidget(m_server, 5, 1);
75 label = new QLabel(tr("Notifications :"), widget); 77 label = new QLabel(tr("Notifications :"), widget);
76 layout->addWidget(label, 6, 0); 78 layout->addWidget(label, 6, 0);
77 m_notification = new OColorButton(widget, m_config->readEntry("NotificationColor", "#AAE300")); 79 m_notification = new OColorButton(widget, m_config->readEntry("NotificationColor", "#AAE300"));
78 QWhatsThis::add(m_notification, tr("Text color to be used to display notifications")); 80 QWhatsThis::add(m_notification, tr("Text color to be used to display notifications"));
79 layout->addWidget(m_notification, 6, 1); 81 layout->addWidget(m_notification, 6, 1);
80 tw->addTab(view, "opieirc/colors", tr("Colors")); 82 tw->addTab(view, "opieirc/colors", tr("Colors"));
81 tw->setCurrentTab( genwidget );
82 83
84
85 /*
86 * IRC EditLine KeyConfiguration
87 */
88 m_keyConf = new Opie::Ui::OKeyConfigWidget(tw, "KEyConfig GUI" );
89 m_keyConf->setChangeMode( OKeyConfigWidget::Queue );
90 m_keyConf->insert( tr("Keyboard Shortcuts"),
91 IRCHistoryLineEdit::keyConfigInstance() );
92 m_keyConf->load();
93 tw->addTab(m_keyConf, "SettingsIcon", tr("Keyboard Shortcuts") );
94
95 tw->setCurrentTab( genwidget );
83 QPEApplication::showDialog( this ); 96 QPEApplication::showDialog( this );
84} 97}
85 98
86void IRCSettings::accept() 99void IRCSettings::accept()
87{ 100{
88 IRCTab::m_backgroundColor = m_background->color().name(); 101 IRCTab::m_backgroundColor = m_background->color().name();
89 IRCTab::m_textColor = m_text->color().name(); 102 IRCTab::m_textColor = m_text->color().name();
90 IRCTab::m_errorColor = m_error->color().name(); 103 IRCTab::m_errorColor = m_error->color().name();
91 IRCTab::m_selfColor = m_self->color().name(); 104 IRCTab::m_selfColor = m_self->color().name();
92 IRCTab::m_otherColor = m_other->color().name(); 105 IRCTab::m_otherColor = m_other->color().name();
93 IRCTab::m_serverColor = m_server->color().name(); 106 IRCTab::m_serverColor = m_server->color().name();
94 IRCTab::m_notificationColor = m_notification->color().name(); 107 IRCTab::m_notificationColor = m_notification->color().name();
95 IRCTab::m_maxLines = m_lines->text().toInt(); 108 IRCTab::m_maxLines = m_lines->text().toInt();
109 m_keyConf->save();
110
111
96 m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor); 112 m_config->writeEntry("BackgroundColor", IRCTab::m_backgroundColor);
97 m_config->writeEntry("TextColor", IRCTab::m_textColor); 113 m_config->writeEntry("TextColor", IRCTab::m_textColor);
98 m_config->writeEntry("ErrorColor", IRCTab::m_errorColor); 114 m_config->writeEntry("ErrorColor", IRCTab::m_errorColor);
99 m_config->writeEntry("SelfColor", IRCTab::m_selfColor); 115 m_config->writeEntry("SelfColor", IRCTab::m_selfColor);
100 m_config->writeEntry("OtherColor", IRCTab::m_otherColor); 116 m_config->writeEntry("OtherColor", IRCTab::m_otherColor);
101 m_config->writeEntry("ServerColor", IRCTab::m_serverColor); 117 m_config->writeEntry("ServerColor", IRCTab::m_serverColor);
102 m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor); 118 m_config->writeEntry("NotificationColor", IRCTab::m_notificationColor);
103 m_config->writeEntry("Lines", m_lines->text()); 119 m_config->writeEntry("Lines", m_lines->text());
120 IRCHistoryLineEdit::keyConfigInstance()->save();
121
104 QDialog::accept(); 122 QDialog::accept();
105} 123}
106 124
107IRCSettings::~IRCSettings() 125IRCSettings::~IRCSettings()
108{ 126{
109 delete m_config; 127 delete m_config;
110} 128}
diff --git a/noncore/net/opieirc/ircsettings.h b/noncore/net/opieirc/ircsettings.h
index 56e667b..a032aff 100644
--- a/noncore/net/opieirc/ircsettings.h
+++ b/noncore/net/opieirc/ircsettings.h
@@ -6,46 +6,50 @@
6 it under the terms of the GNU General Public License as published by 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 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 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 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18
19*/ 19*/
20 20
21#ifndef __IRCSETTINGS_H 21#ifndef __IRCSETTINGS_H
22#define __IRCSETTINGS_H 22#define __IRCSETTINGS_H
23 23
24#include <qpe/config.h> 24#include <qpe/config.h>
25#include <qdialog.h> 25#include <qdialog.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27 27
28namespace Opie { 28namespace Opie {
29class OColorButton; 29class OColorButton;
30namespace Ui {
31class OKeyConfigWidget;
32}
30} 33}
31 34
32class IRCSettings : public QDialog { 35class IRCSettings : public QDialog {
33 Q_OBJECT 36 Q_OBJECT
34public: 37public:
35 IRCSettings(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0); 38 IRCSettings(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0);
36 ~IRCSettings(); 39 ~IRCSettings();
37protected slots: 40protected slots:
38 void accept(); 41 void accept();
39protected: 42protected:
40 Config *m_config; 43 Config *m_config;
41 Opie::OColorButton *m_background; 44 Opie::OColorButton *m_background;
42 Opie::OColorButton *m_text; 45 Opie::OColorButton *m_text;
43 Opie::OColorButton *m_error; 46 Opie::OColorButton *m_error;
44 Opie::OColorButton *m_self; 47 Opie::OColorButton *m_self;
45 Opie::OColorButton *m_server; 48 Opie::OColorButton *m_server;
46 Opie::OColorButton *m_other; 49 Opie::OColorButton *m_other;
47 Opie::OColorButton *m_notification; 50 Opie::OColorButton *m_notification;
51 Opie::Ui::OKeyConfigWidget *m_keyConf;
48 QLineEdit *m_lines; 52 QLineEdit *m_lines;
49}; 53};
50 54
51#endif /* __IRCSETTINGS_H */ 55#endif /* __IRCSETTINGS_H */
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp
index 8e1dc16..2b3ecd4 100644
--- a/noncore/net/opieirc/irctab.cpp
+++ b/noncore/net/opieirc/irctab.cpp
@@ -1,29 +1,34 @@
1#include "irctab.h"
2#include "mainwindow.h"
3
4#include <opie2/okeyconfigmanager.h>
1#include <qpe/resource.h> 5#include <qpe/resource.h>
6
7
2#include <qpushbutton.h> 8#include <qpushbutton.h>
3#include <qwhatsthis.h> 9#include <qwhatsthis.h>
4#include "irctab.h" 10
5#include "mainwindow.h"
6 11
7QString IRCTab::m_errorColor; 12QString IRCTab::m_errorColor;
8QString IRCTab::m_serverColor; 13QString IRCTab::m_serverColor;
9QString IRCTab::m_textColor; 14QString IRCTab::m_textColor;
10QString IRCTab::m_backgroundColor; 15QString IRCTab::m_backgroundColor;
11QString IRCTab::m_selfColor; 16QString IRCTab::m_selfColor;
12QString IRCTab::m_otherColor; 17QString IRCTab::m_otherColor;
13QString IRCTab::m_notificationColor; 18QString IRCTab::m_notificationColor;
14int IRCTab::m_maxLines; 19int IRCTab::m_maxLines;
15 20
16IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { 21IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
17 m_layout = new QVBoxLayout(this); 22 m_layout = new QVBoxLayout(this);
18 QHBoxLayout *descLayout = new QHBoxLayout(m_layout); 23 QHBoxLayout *descLayout = new QHBoxLayout(m_layout);
19 descLayout->setMargin(5); 24 descLayout->setMargin(5);
20 m_description = new QLabel(tr("Missing description"), this); 25 m_description = new QLabel(tr("Missing description"), this);
21 QWhatsThis::add(m_description, tr("Description of the tab's content")); 26 QWhatsThis::add(m_description, tr("Description of the tab's content"));
22 descLayout->addWidget(m_description); 27 descLayout->addWidget(m_description);
23 descLayout->setStretchFactor(m_description, 5); 28 descLayout->setStretchFactor(m_description, 5);
24 QPushButton *close = new QPushButton(this); 29 QPushButton *close = new QPushButton(this);
25 QWhatsThis::add(close, tr("Close this tab")); 30 QWhatsThis::add(close, tr("Close this tab"));
26 close->setPixmap(Resource::loadPixmap("close")); 31 close->setPixmap(Resource::loadPixmap("close"));
27 connect(close, SIGNAL(clicked()), this, SLOT(remove())); 32 connect(close, SIGNAL(clicked()), this, SLOT(remove()));
28 descLayout->addWidget(close); 33 descLayout->addWidget(close);
29 descLayout->setStretchFactor(m_description, 1); 34 descLayout->setStretchFactor(m_description, 1);
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 1143213..2e674c5 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -55,48 +55,49 @@ void MainWindow::selected(QWidget *) {
55 emit updateScroll(); 55 emit updateScroll();
56} 56}
57 57
58void MainWindow::addTab(IRCTab *tab) { 58void MainWindow::addTab(IRCTab *tab) {
59 connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*))); 59 connect(tab, SIGNAL(changed(IRCTab*)), this, SLOT(changeEvent(IRCTab*)));
60 connect(tab, SIGNAL(ping (const QString&)), this, SLOT(slotPing(const QString&))); 60 connect(tab, SIGNAL(ping (const QString&)), this, SLOT(slotPing(const QString&)));
61 connect(tab, SIGNAL(nextTab()), this, SLOT(slotNextTab())); 61 connect(tab, SIGNAL(nextTab()), this, SLOT(slotNextTab()));
62 connect(tab, SIGNAL(prevTab()), this, SLOT(slotPrevTab())); 62 connect(tab, SIGNAL(prevTab()), this, SLOT(slotPrevTab()));
63 connect(tab, SIGNAL(closeTab()), this, SLOT(slotCloseTab())); 63 connect(tab, SIGNAL(closeTab()), this, SLOT(slotCloseTab()));
64 64
65 m_tabWidget->addTab(tab, tab->title()); 65 m_tabWidget->addTab(tab, tab->title());
66 m_tabWidget->showPage(tab); 66 m_tabWidget->showPage(tab);
67 tab->setID(m_tabWidget->currentPageIndex()); 67 tab->setID(m_tabWidget->currentPageIndex());
68 m_tabs.append(tab); 68 m_tabs.append(tab);
69} 69}
70 70
71void MainWindow::changeEvent(IRCTab *tab) { 71void MainWindow::changeEvent(IRCTab *tab) {
72 if (tab->id() != m_tabWidget->currentPageIndex()) 72 if (tab->id() != m_tabWidget->currentPageIndex())
73 m_tabWidget->setTabColor(tab->id(), blue); 73 m_tabWidget->setTabColor(tab->id(), blue);
74} 74}
75 75
76void MainWindow::killTab(IRCTab *tab) { 76void MainWindow::killTab(IRCTab *tab) {
77 m_tabWidget->removePage(tab); 77 m_tabWidget->removePage(tab);
78 m_tabs.remove(tab); 78 m_tabs.remove(tab);
79
79 /* there might be nicer ways to do this .. */ 80 /* there might be nicer ways to do this .. */
80 delete tab; 81 delete tab;
81} 82}
82 83
83void MainWindow::newConnection() { 84void MainWindow::newConnection() {
84 IRCServerList list(this, "ServerList", TRUE); 85 IRCServerList list(this, "ServerList", TRUE);
85 if (list.exec() == QDialog::Accepted && list.hasServer()) { 86 if (list.exec() == QDialog::Accepted && list.hasServer()) {
86 IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); 87 IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget);
87 addTab(serverTab); 88 addTab(serverTab);
88 serverTab->doConnect(); 89 serverTab->doConnect();
89 } 90 }
90} 91}
91 92
92void MainWindow::settings() { 93void MainWindow::settings() {
93 IRCSettings settings(this, "Settings", TRUE); 94 IRCSettings settings(this, "Settings", TRUE);
94 if (settings.exec() == QDialog::Accepted) { 95 if (settings.exec() == QDialog::Accepted) {
95 QListIterator<IRCTab> it(m_tabs); 96 QListIterator<IRCTab> it(m_tabs);
96 for (; it.current(); ++it) { 97 for (; it.current(); ++it) {
97 /* Inform all tabs about the new settings */ 98 /* Inform all tabs about the new settings */
98 it.current()->settingsChanged(); 99 it.current()->settingsChanged();
99 } 100 }
100 } 101 }
101} 102}
102 103