summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/button/button.pro2
-rw-r--r--core/settings/button/buttonsettings.cpp4
-rw-r--r--core/settings/button/buttonsettings.h5
-rw-r--r--core/settings/button/buttonutils.cpp1
-rw-r--r--core/settings/button/buttonutils.h4
-rw-r--r--core/settings/button/config.in2
-rw-r--r--core/settings/button/main.cpp3
-rw-r--r--core/settings/button/remapdlg.cpp4
-rw-r--r--core/settings/button/remapdlg.h10
-rw-r--r--core/settings/citytime/config.in2
-rw-r--r--core/settings/citytime/main.cpp1
-rw-r--r--core/settings/launcher/config.in2
-rw-r--r--core/settings/launcher/launcher.pro2
-rw-r--r--core/settings/launcher/launchersettings.cpp3
-rw-r--r--core/settings/launcher/main.cpp3
-rw-r--r--core/settings/launcher/tabdialog.cpp13
-rw-r--r--core/settings/launcher/tabdialog.h10
-rw-r--r--core/settings/light-and-power/config.in2
-rw-r--r--core/settings/light-and-power/light.cpp2
-rw-r--r--core/settings/light-and-power/main.cpp1
-rw-r--r--core/settings/light-and-power/sensor.cpp2
-rw-r--r--core/settings/security/config.in2
-rw-r--r--core/settings/security/main.cpp3
23 files changed, 45 insertions, 38 deletions
diff --git a/core/settings/button/button.pro b/core/settings/button/button.pro
index 817eac4..aa47f54 100644
--- a/core/settings/button/button.pro
+++ b/core/settings/button/button.pro
@@ -1,19 +1,19 @@
1CONFIG += qt warn_on release quick-app 1CONFIG += qt warn_on release quick-app
2 2
3HEADERS = buttonsettings.h \ 3HEADERS = buttonsettings.h \
4 buttonutils.h \ 4 buttonutils.h \
5 remapdlg.h 5 remapdlg.h
6 6
7SOURCES = main.cpp \ 7SOURCES = main.cpp \
8 buttonsettings.cpp \ 8 buttonsettings.cpp \
9 buttonutils.cpp \ 9 buttonutils.cpp \
10 remapdlg.cpp 10 remapdlg.cpp
11 11
12INTERFACES = remapdlgbase.ui 12INTERFACES = remapdlgbase.ui
13 13
14INCLUDEPATH += $(OPIEDIR)/include 14INCLUDEPATH += $(OPIEDIR)/include
15DEPENDPATH += $(OPIEDIR)/include 15DEPENDPATH += $(OPIEDIR)/include
16LIBS += -lqpe -lopie 16LIBS += -lqpe -lopiecore2
17 TARGET = buttonsettings 17 TARGET = buttonsettings
18 18
19include ( $(OPIEDIR)/include.pro ) 19include ( $(OPIEDIR)/include.pro )
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp
index d80e496..326554b 100644
--- a/core/settings/button/buttonsettings.cpp
+++ b/core/settings/button/buttonsettings.cpp
@@ -1,231 +1,231 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qtimer.h> 30#include <qtimer.h>
31 31
32 32
33#include <opie/odevice.h> 33#include <opie2/odevice.h>
34 34
35#include "buttonsettings.h" 35#include "buttonsettings.h"
36#include "buttonutils.h" 36#include "buttonutils.h"
37#include "remapdlg.h" 37#include "remapdlg.h"
38 38
39using namespace Opie; 39using namespace Opie::Core;
40 40
41struct buttoninfo { 41struct buttoninfo {
42 const ODeviceButton *m_button; 42 const ODeviceButton *m_button;
43 int m_index; 43 int m_index;
44 44
45 OQCopMessage m_pmsg; 45 OQCopMessage m_pmsg;
46 QLabel *m_picon; 46 QLabel *m_picon;
47 QLabel *m_plabel; 47 QLabel *m_plabel;
48 48
49 OQCopMessage m_hmsg; 49 OQCopMessage m_hmsg;
50 QLabel *m_hicon; 50 QLabel *m_hicon;
51 QLabel *m_hlabel; 51 QLabel *m_hlabel;
52 52
53 bool m_pdirty : 1; 53 bool m_pdirty : 1;
54 bool m_hdirty : 1; 54 bool m_hdirty : 1;
55}; 55};
56 56
57 57
58ButtonSettings::ButtonSettings ( QWidget *parent , const char *name, bool modal, WFlags f ) 58ButtonSettings::ButtonSettings ( QWidget *parent , const char *name, bool modal, WFlags f )
59 : QDialog ( 0, "ButtonSettings", false, WStyle_ContextHelp ) 59 : QDialog ( 0, "ButtonSettings", false, WStyle_ContextHelp )
60{ 60{
61 const QValueList <ODeviceButton> &buttons = ODevice::inst ( )-> buttons ( ); 61 const QValueList <ODeviceButton> &buttons = ODevice::inst ( )-> buttons ( );
62 (void) ButtonUtils::inst ( ); // initialise 62 (void) ButtonUtils::inst ( ); // initialise
63 63
64 setCaption ( tr( "Button Settings" )); 64 setCaption ( tr( "Button Settings" ));
65 65
66 QVBoxLayout *toplay = new QVBoxLayout ( this, 3, 3 ); 66 QVBoxLayout *toplay = new QVBoxLayout ( this, 3, 3 );
67 67
68 QLabel *l = new QLabel ( tr( "<center>Press or hold the button you want to remap.</center>" ), this ); 68 QLabel *l = new QLabel ( tr( "<center>Press or hold the button you want to remap.</center>" ), this );
69 toplay-> addWidget ( l ); 69 toplay-> addWidget ( l );
70 70
71 QGridLayout *lay = new QGridLayout ( toplay ); 71 QGridLayout *lay = new QGridLayout ( toplay );
72 lay-> setMargin ( 0 ); 72 lay-> setMargin ( 0 );
73 lay-> setColStretch ( 0, 0 ); 73 lay-> setColStretch ( 0, 0 );
74 lay-> setColStretch ( 1, 0 ); 74 lay-> setColStretch ( 1, 0 );
75 lay-> setColStretch ( 2, 0 ); 75 lay-> setColStretch ( 2, 0 );
76 lay-> setColStretch ( 3, 10 ); 76 lay-> setColStretch ( 3, 10 );
77 77
78 m_infos. setAutoDelete ( true ); 78 m_infos. setAutoDelete ( true );
79 79
80 int i = 1; 80 int i = 1;
81 int index = 0; 81 int index = 0;
82 for ( QValueList<ODeviceButton>::ConstIterator it = buttons. begin ( ); it != buttons. end ( ); it++ ) { 82 for ( QValueList<ODeviceButton>::ConstIterator it = buttons. begin ( ); it != buttons. end ( ); it++ ) {
83 if ( it != buttons. begin ( )) { 83 if ( it != buttons. begin ( )) {
84 QFrame *f = new QFrame ( this ); 84 QFrame *f = new QFrame ( this );
85 f-> setFrameStyle ( QFrame::Sunken | QFrame::VLine ); 85 f-> setFrameStyle ( QFrame::Sunken | QFrame::VLine );
86 lay-> addMultiCellWidget ( f, i, i, 0, 3 ); 86 lay-> addMultiCellWidget ( f, i, i, 0, 3 );
87 i++; 87 i++;
88 } 88 }
89 89
90 buttoninfo *bi = new buttoninfo ( ); 90 buttoninfo *bi = new buttoninfo ( );
91 bi-> m_button = &(*it); 91 bi-> m_button = &(*it);
92 bi-> m_index = index++; 92 bi-> m_index = index++;
93 bi-> m_pmsg = (*it). pressedAction ( ); 93 bi-> m_pmsg = (*it). pressedAction ( );
94 bi-> m_hmsg = (*it). heldAction ( ); 94 bi-> m_hmsg = (*it). heldAction ( );
95 bi-> m_pdirty = false; 95 bi-> m_pdirty = false;
96 bi-> m_hdirty = false; 96 bi-> m_hdirty = false;
97 97
98 l = new QLabel ( this ); 98 l = new QLabel ( this );
99 l-> setPixmap (( *it ). pixmap ( )); 99 l-> setPixmap (( *it ). pixmap ( ));
100 100
101 lay-> addMultiCellWidget ( l, i, i + 1, 0, 0 ); 101 lay-> addMultiCellWidget ( l, i, i + 1, 0, 0 );
102 102
103 l = new QLabel ( tr( "Press:" ), this ); 103 l = new QLabel ( tr( "Press:" ), this );
104 lay-> addWidget ( l, i, 1, AlignLeft | AlignBottom ); 104 lay-> addWidget ( l, i, 1, AlignLeft | AlignBottom );
105 l = new QLabel ( tr( "Hold:" ), this ); 105 l = new QLabel ( tr( "Hold:" ), this );
106 lay-> addWidget ( l, i + 1, 1, AlignLeft | AlignTop ); 106 lay-> addWidget ( l, i + 1, 1, AlignLeft | AlignTop );
107 107
108 l = new QLabel ( this ); 108 l = new QLabel ( this );
109 l-> setFixedSize ( 16, 16 ); 109 l-> setFixedSize ( 16, 16 );
110 lay-> addWidget ( l, i, 2, AlignLeft | AlignBottom ); 110 lay-> addWidget ( l, i, 2, AlignLeft | AlignBottom );
111 bi-> m_picon = l; 111 bi-> m_picon = l;
112 112
113 l = new QLabel ( this ); 113 l = new QLabel ( this );
114 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); 114 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine );
115 lay-> addWidget ( l, i, 3, AlignLeft | AlignBottom ); 115 lay-> addWidget ( l, i, 3, AlignLeft | AlignBottom );
116 bi-> m_plabel = l; 116 bi-> m_plabel = l;
117 117
118 l = new QLabel ( this ); 118 l = new QLabel ( this );
119 l-> setFixedSize ( 16, 16 ); 119 l-> setFixedSize ( 16, 16 );
120 lay-> addWidget ( l, i + 1, 2, AlignLeft | AlignTop ); 120 lay-> addWidget ( l, i + 1, 2, AlignLeft | AlignTop );
121 bi-> m_hicon = l; 121 bi-> m_hicon = l;
122 122
123 l = new QLabel ( this ); 123 l = new QLabel ( this );
124 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); 124 l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine );
125 lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop ); 125 lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop );
126 bi-> m_hlabel = l; 126 bi-> m_hlabel = l;
127 127
128 i += 2; 128 i += 2;
129 129
130 m_infos. append ( bi ); 130 m_infos. append ( bi );
131 } 131 }
132 132
133 toplay-> addStretch ( 10 ); 133 toplay-> addStretch ( 10 );
134 134
135 m_last_button = 0; 135 m_last_button = 0;
136 m_lock = false; 136 m_lock = false;
137 137
138 m_timer = new QTimer ( this ); 138 m_timer = new QTimer ( this );
139 connect ( m_timer, SIGNAL( timeout()), this, SLOT( keyTimeout())); 139 connect ( m_timer, SIGNAL( timeout()), this, SLOT( keyTimeout()));
140 140
141 updateLabels ( ); 141 updateLabels ( );
142 142
143 QPEApplication::grabKeyboard ( ); 143 QPEApplication::grabKeyboard ( );
144} 144}
145 145
146ButtonSettings::~ButtonSettings ( ) 146ButtonSettings::~ButtonSettings ( )
147{ 147{
148 QPEApplication::ungrabKeyboard ( ); 148 QPEApplication::ungrabKeyboard ( );
149} 149}
150 150
151void ButtonSettings::updateLabels ( ) 151void ButtonSettings::updateLabels ( )
152{ 152{
153 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { 153 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) {
154 qCopInfo cip = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_pmsg ); 154 qCopInfo cip = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_pmsg );
155 155
156 (*it)-> m_picon-> setPixmap ( cip. m_icon ); 156 (*it)-> m_picon-> setPixmap ( cip. m_icon );
157 (*it)-> m_plabel-> setText ( cip. m_name ); 157 (*it)-> m_plabel-> setText ( cip. m_name );
158 158
159 qCopInfo cih = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_hmsg ); 159 qCopInfo cih = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_hmsg );
160 160
161 (*it)-> m_hicon-> setPixmap ( cih. m_icon ); 161 (*it)-> m_hicon-> setPixmap ( cih. m_icon );
162 (*it)-> m_hlabel-> setText ( cih. m_name ); 162 (*it)-> m_hlabel-> setText ( cih. m_name );
163 } 163 }
164} 164}
165 165
166buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key ) 166buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key )
167{ 167{
168 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { 168 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) {
169 if ((*it)-> m_button-> keycode ( ) == key ) 169 if ((*it)-> m_button-> keycode ( ) == key )
170 return *it; 170 return *it;
171 } 171 }
172 return 0; 172 return 0;
173} 173}
174 174
175void ButtonSettings::keyPressEvent ( QKeyEvent *e ) 175void ButtonSettings::keyPressEvent ( QKeyEvent *e )
176{ 176{
177 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); 177 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( ));
178 178
179 if ( bi && !e-> isAutoRepeat ( )) { 179 if ( bi && !e-> isAutoRepeat ( )) {
180 m_timer-> stop ( ); 180 m_timer-> stop ( );
181 m_last_button = bi; 181 m_last_button = bi;
182 m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); 182 m_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true );
183 } 183 }
184 else 184 else
185 QDialog::keyPressEvent ( e ); 185 QDialog::keyPressEvent ( e );
186} 186}
187 187
188void ButtonSettings::keyReleaseEvent ( QKeyEvent *e ) 188void ButtonSettings::keyReleaseEvent ( QKeyEvent *e )
189{ 189{
190 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); 190 buttoninfo *bi = buttonInfoForKeycode ( e-> key ( ));
191 191
192 if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) { 192 if ( bi && !e-> isAutoRepeat ( ) && m_timer-> isActive ( )) {
193 m_timer-> stop ( ); 193 m_timer-> stop ( );
194 edit ( bi, false ); 194 edit ( bi, false );
195 } 195 }
196 else 196 else
197 QDialog::keyReleaseEvent ( e ); 197 QDialog::keyReleaseEvent ( e );
198} 198}
199 199
200void ButtonSettings::keyTimeout ( ) 200void ButtonSettings::keyTimeout ( )
201{ 201{
202 if ( m_last_button ) { 202 if ( m_last_button ) {
203 edit ( m_last_button, true ); 203 edit ( m_last_button, true );
204 m_last_button = false; 204 m_last_button = false;
205 } 205 }
206} 206}
207 207
208void ButtonSettings::edit ( buttoninfo *bi, bool hold ) 208void ButtonSettings::edit ( buttoninfo *bi, bool hold )
209{ 209{
210 210
211 if ( m_lock ) 211 if ( m_lock )
212 return; 212 return;
213 m_lock = true; 213 m_lock = true;
214 214
215 RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); 215 RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this );
216 216
217 if ( QPEApplication::execDialog ( d ) == QDialog::Accepted ) { 217 if ( QPEApplication::execDialog ( d ) == QDialog::Accepted ) {
218 218
219 219
220 if ( hold ) { 220 if ( hold ) {
221 bi-> m_hmsg = d-> message ( ); 221 bi-> m_hmsg = d-> message ( );
222 bi-> m_hdirty = true; 222 bi-> m_hdirty = true;
223 } 223 }
224 else { 224 else {
225 bi-> m_pmsg = d-> message ( ); 225 bi-> m_pmsg = d-> message ( );
226 bi-> m_pdirty = true; 226 bi-> m_pdirty = true;
227 } 227 }
228 228
229 updateLabels ( ); 229 updateLabels ( );
230 } 230 }
231 231
diff --git a/core/settings/button/buttonsettings.h b/core/settings/button/buttonsettings.h
index 67694d3..1127e7c 100644
--- a/core/settings/button/buttonsettings.h
+++ b/core/settings/button/buttonsettings.h
@@ -1,76 +1,75 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#ifndef __BUTTON_SETTINGS_H__ 28#ifndef __BUTTON_SETTINGS_H__
29#define __BUTTON_SETTINGS_H__ 29#define __BUTTON_SETTINGS_H__
30 30
31#include <qdialog.h> 31#include <qdialog.h>
32#include <qlist.h> 32#include <qlist.h>
33#include <opie/odevice.h> 33#include <opie2/odevice.h>
34 34
35class QTimer; 35class QTimer;
36 36
37using namespace Opie;
38 37
39class buttoninfo; 38class buttoninfo;
40 39
41class ButtonSettings : public QDialog { 40class ButtonSettings : public QDialog {
42 Q_OBJECT 41 Q_OBJECT
43 42
44public: 43public:
45 ButtonSettings ( QWidget *parent = 0, const char *name = 0, bool modal = FALSE,WFlags f = 0 ); 44 ButtonSettings ( QWidget *parent = 0, const char *name = 0, bool modal = FALSE,WFlags f = 0 );
46 ~ButtonSettings ( ); 45 ~ButtonSettings ( );
47 46
48 static QString appName() { return QString::fromLatin1("buttonsettings"); } 47 static QString appName() { return QString::fromLatin1("buttonsettings"); }
49 virtual void accept ( ); 48 virtual void accept ( );
50 virtual void done ( int r ); 49 virtual void done ( int r );
51 50
52private slots: 51private slots:
53 void keyTimeout ( ); 52 void keyTimeout ( );
54 void updateLabels ( ); 53 void updateLabels ( );
55 54
56protected: 55protected:
57 virtual void keyPressEvent ( QKeyEvent *e ); 56 virtual void keyPressEvent ( QKeyEvent *e );
58 virtual void keyReleaseEvent ( QKeyEvent *e ); 57 virtual void keyReleaseEvent ( QKeyEvent *e );
59 58
60private: 59private:
61 buttoninfo *buttonInfoForKeycode ( ushort key ); 60 buttoninfo *buttonInfoForKeycode ( ushort key );
62 61
63 void edit ( buttoninfo *bi, bool hold ); 62 void edit ( buttoninfo *bi, bool hold );
64 QString qcopToString ( const OQCopMessage &c ); 63 QString qcopToString ( const Opie::Core::OQCopMessage &c );
65 64
66 private: 65 private:
67 QTimer *m_timer; 66 QTimer *m_timer;
68 buttoninfo *m_last_button; 67 buttoninfo *m_last_button;
69 68
70 QList <buttoninfo> m_infos; 69 QList <buttoninfo> m_infos;
71 bool m_lock; 70 bool m_lock;
72}; 71};
73 72
74#endif 73#endif
75 74
76 75
diff --git a/core/settings/button/buttonutils.cpp b/core/settings/button/buttonutils.cpp
index 27a2f38..9bf4b53 100644
--- a/core/settings/button/buttonutils.cpp
+++ b/core/settings/button/buttonutils.cpp
@@ -1,128 +1,129 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qapplication.h> 3#include <qapplication.h>
4#include <qlistview.h> 4#include <qlistview.h>
5#include <qpe/applnk.h> 5#include <qpe/applnk.h>
6#include <qpe/mimetype.h> 6#include <qpe/mimetype.h>
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8 8
9#include "buttonutils.h" 9#include "buttonutils.h"
10 10
11using namespace Opie; 11using namespace Opie;
12 12
13using namespace Opie::Core;
13struct predef_qcop { 14struct predef_qcop {
14 const char *m_text; 15 const char *m_text;
15 const char *m_pixmap; 16 const char *m_pixmap;
16 const char *m_channel; 17 const char *m_channel;
17 const char *m_function; 18 const char *m_function;
18}; 19};
19 20
20static const predef_qcop predef [] = { 21static const predef_qcop predef [] = {
21 22
22 { QT_TRANSLATE_NOOP( "ButtonSettings", "Beam VCard" ), "beam", "QPE/Application/addressbook", "beamBusinessCard()" }, 23 { QT_TRANSLATE_NOOP( "ButtonSettings", "Beam VCard" ), "beam", "QPE/Application/addressbook", "beamBusinessCard()" },
23 { QT_TRANSLATE_NOOP( "ButtonSettings", "Send eMail" ), "buttonsettings/mail", "QPE/Application/mail", "newMail()" }, 24 { QT_TRANSLATE_NOOP( "ButtonSettings", "Send eMail" ), "buttonsettings/mail", "QPE/Application/mail", "newMail()" },
24 25
25 26
26 { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle Menu" ), "buttonsettings/menu", "QPE/TaskBar", "toggleMenu()" }, 27 { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle Menu" ), "buttonsettings/menu", "QPE/TaskBar", "toggleMenu()" },
27 { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle O-Menu" ), "buttonsettings/omenu", "QPE/TaskBar", "toggleStartMenu()" }, 28 { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle O-Menu" ), "buttonsettings/omenu", "QPE/TaskBar", "toggleStartMenu()" },
28 { QT_TRANSLATE_NOOP( "ButtonSettings", "Show Desktop" ), "home", "QPE/Launcher", "home()" }, 29 { QT_TRANSLATE_NOOP( "ButtonSettings", "Show Desktop" ), "home", "QPE/Launcher", "home()" },
29 { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle Recording" ), "buttonsettings/record", "QPE/VMemo", "toggleRecord()" }, 30 { QT_TRANSLATE_NOOP( "ButtonSettings", "Toggle Recording" ), "buttonsettings/record", "QPE/VMemo", "toggleRecord()" },
30 31
31 { 0, 0, 0, 0 } 32 { 0, 0, 0, 0 }
32}; 33};
33 34
34 35
35 36
36 37
37ButtonUtils *ButtonUtils::ButtonUtils::inst ( ) 38ButtonUtils *ButtonUtils::ButtonUtils::inst ( )
38{ 39{
39 static ButtonUtils *p = 0; 40 static ButtonUtils *p = 0;
40 41
41 if ( !p ) { 42 if ( !p ) {
42 p = new ButtonUtils ( ); 43 p = new ButtonUtils ( );
43 ::atexit ( cleanup ); 44 ::atexit ( cleanup );
44 } 45 }
45 return p; 46 return p;
46} 47}
47 48
48void ButtonUtils::cleanup ( ) 49void ButtonUtils::cleanup ( )
49{ 50{
50 delete inst ( ); 51 delete inst ( );
51} 52}
52 53
53ButtonUtils::ButtonUtils ( ) 54ButtonUtils::ButtonUtils ( )
54{ 55{
55 m_apps = new AppLnkSet( MimeType::appsFolderName ( )); 56 m_apps = new AppLnkSet( MimeType::appsFolderName ( ));
56} 57}
57 58
58ButtonUtils::~ButtonUtils ( ) 59ButtonUtils::~ButtonUtils ( )
59{ 60{
60 delete m_apps; 61 delete m_apps;
61} 62}
62 63
63qCopInfo ButtonUtils::messageToInfo ( const OQCopMessage &c ) 64qCopInfo ButtonUtils::messageToInfo ( const OQCopMessage &c )
64{ 65{
65 QCString ch = c. channel ( ); 66 QCString ch = c. channel ( );
66 QCString f = c. message ( ); 67 QCString f = c. message ( );
67 68
68 69
69 if ( ch == "ignore" ) 70 if ( ch == "ignore" )
70 return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Ignored</nobr>" )); 71 return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Ignored</nobr>" ));
71 72
72 for ( const predef_qcop *p = predef; p-> m_text; p++ ) { 73 for ( const predef_qcop *p = predef; p-> m_text; p++ ) {
73 if (( ch == p-> m_channel ) && ( f == p-> m_function )) 74 if (( ch == p-> m_channel ) && ( f == p-> m_function ))
74 return qCopInfo ( qApp-> translate ( "ButtonSettings", p-> m_text ), Resource::loadPixmap ( p-> m_pixmap )); 75 return qCopInfo ( qApp-> translate ( "ButtonSettings", p-> m_text ), Resource::loadPixmap ( p-> m_pixmap ));
75 } 76 }
76 77
77 if ( ch. left ( 16 ) == "QPE/Application/" ) { 78 if ( ch. left ( 16 ) == "QPE/Application/" ) {
78 QString app = ch. mid ( 16 ); 79 QString app = ch. mid ( 16 );
79 const AppLnk *applnk = m_apps-> findExec ( app ); 80 const AppLnk *applnk = m_apps-> findExec ( app );
80 if ( applnk ) 81 if ( applnk )
81 app = applnk-> name ( ); 82 app = applnk-> name ( );
82 83
83 if (( f == "raise()" ) || ( f == "nextView()" )) 84 if (( f == "raise()" ) || ( f == "nextView()" ))
84 return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Show <b>%1</b></nobr>" ). arg ( app ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); 85 return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Show <b>%1</b></nobr>" ). arg ( app ), applnk ? applnk-> pixmap ( ) : QPixmap ( ));
85 else 86 else
86 return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b>: <i>%2</i></nobr>" ). arg ( app ). arg ( f ), applnk ? applnk-> pixmap ( ) : QPixmap ( )); 87 return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b>: <i>%2</i></nobr>" ). arg ( app ). arg ( f ), applnk ? applnk-> pixmap ( ) : QPixmap ( ));
87 } 88 }
88 else { 89 else {
89 return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b> <i>%2</i></nobr>" ). arg (( ch. left ( 4 ) == "QPE/" ) ? ch. mid ( 4 ) : ch ). arg ( f )); 90 return qCopInfo ( qApp-> translate ( "ButtonSettings", "<nobr>Call <b>%1</b> <i>%2</i></nobr>" ). arg (( ch. left ( 4 ) == "QPE/" ) ? ch. mid ( 4 ) : ch ). arg ( f ));
90 } 91 }
91} 92}
92 93
93 94
94void ButtonUtils::insertActions ( QListViewItem *here ) 95void ButtonUtils::insertActions ( QListViewItem *here )
95{ 96{
96 for ( const predef_qcop *p = predef; p-> m_text; p++ ) { 97 for ( const predef_qcop *p = predef; p-> m_text; p++ ) {
97 QListViewItem *item = new QListViewItem ( here, qApp-> translate ( "ButtonSettings", p-> m_text ), p-> m_channel, p-> m_function ); 98 QListViewItem *item = new QListViewItem ( here, qApp-> translate ( "ButtonSettings", p-> m_text ), p-> m_channel, p-> m_function );
98 item-> setPixmap ( 0, Resource::loadPixmap ( p-> m_pixmap )); 99 item-> setPixmap ( 0, Resource::loadPixmap ( p-> m_pixmap ));
99 } 100 }
100} 101}
101 102
102 103
103void ButtonUtils::insertAppLnks ( QListViewItem *here ) 104void ButtonUtils::insertAppLnks ( QListViewItem *here )
104{ 105{
105 QStringList types = m_apps-> types ( ); 106 QStringList types = m_apps-> types ( );
106 QListViewItem *typeitem [types. count ( )]; 107 QListViewItem *typeitem [types. count ( )];
107 108
108 int i = 0; 109 int i = 0;
109 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 110 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
110 QListViewItem *item = new QListViewItem ( here, m_apps-> typeName ( *it )); 111 QListViewItem *item = new QListViewItem ( here, m_apps-> typeName ( *it ));
111 item-> setPixmap ( 0, m_apps-> typePixmap ( *it )); 112 item-> setPixmap ( 0, m_apps-> typePixmap ( *it ));
112 113
113 typeitem [i++] = item; 114 typeitem [i++] = item;
114 } 115 }
115 116
116 for ( QListIterator <AppLnk> appit ( m_apps-> children ( )); *appit; ++appit ) { 117 for ( QListIterator <AppLnk> appit ( m_apps-> children ( )); *appit; ++appit ) {
117 AppLnk *l = *appit; 118 AppLnk *l = *appit;
118 119
119 int i = 0; 120 int i = 0;
120 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 121 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
121 if ( l-> type ( ) == *it ) { 122 if ( l-> type ( ) == *it ) {
122 QListViewItem *sub = new QListViewItem ( typeitem [i], l-> name ( ), QString ( "QPE/Application/" ) + l-> exec ( ), "raise()" ); 123 QListViewItem *sub = new QListViewItem ( typeitem [i], l-> name ( ), QString ( "QPE/Application/" ) + l-> exec ( ), "raise()" );
123 sub-> setPixmap ( 0, l-> pixmap ( )); 124 sub-> setPixmap ( 0, l-> pixmap ( ));
124 } 125 }
125 i++; 126 i++;
126 } 127 }
127 } 128 }
128} 129}
diff --git a/core/settings/button/buttonutils.h b/core/settings/button/buttonutils.h
index 5ea59bb..79eb8e3 100644
--- a/core/settings/button/buttonutils.h
+++ b/core/settings/button/buttonutils.h
@@ -1,67 +1,67 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#ifndef __BUTTON_UTILS_H__ 28#ifndef __BUTTON_UTILS_H__
29#define __BUTTON_UTILS_H__ 29#define __BUTTON_UTILS_H__
30 30
31#include <opie/odevicebutton.h> 31#include <opie2/odevicebutton.h>
32 32
33class AppLnkSet; 33class AppLnkSet;
34class QListViewItem; 34class QListViewItem;
35 35
36 36
37class qCopInfo { 37class qCopInfo {
38public: 38public:
39 qCopInfo ( const QString &str, const QPixmap &pix = QPixmap ( )) 39 qCopInfo ( const QString &str, const QPixmap &pix = QPixmap ( ))
40 : m_name ( str ), m_icon ( pix ) 40 : m_name ( str ), m_icon ( pix )
41 { } 41 { }
42 42
43 QString m_name; 43 QString m_name;
44 QPixmap m_icon; 44 QPixmap m_icon;
45}; 45};
46 46
47 47
48class ButtonUtils { 48class ButtonUtils {
49public: 49public:
50 ~ButtonUtils ( ); 50 ~ButtonUtils ( );
51 51
52 static ButtonUtils *inst ( ); 52 static ButtonUtils *inst ( );
53 53
54 qCopInfo messageToInfo ( const Opie::OQCopMessage & ); 54 qCopInfo messageToInfo ( const Opie::Core::OQCopMessage & );
55 55
56 void insertActions ( QListViewItem *here ); 56 void insertActions ( QListViewItem *here );
57 void insertAppLnks ( QListViewItem *here ); 57 void insertAppLnks ( QListViewItem *here );
58 58
59private: 59private:
60 ButtonUtils ( ); 60 ButtonUtils ( );
61 static void cleanup ( ); 61 static void cleanup ( );
62 62
63private: 63private:
64 AppLnkSet *m_apps; 64 AppLnkSet *m_apps;
65}; 65};
66 66
67#endif 67#endif
diff --git a/core/settings/button/config.in b/core/settings/button/config.in
index 3eb9155..834c375 100644
--- a/core/settings/button/config.in
+++ b/core/settings/button/config.in
@@ -1,4 +1,4 @@
1 config BUTTON-SETTINGS 1 config BUTTON-SETTINGS
2 boolean "opie-button-settings (application buttons settings)" 2 boolean "opie-button-settings (application buttons settings)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && !TARGET_RAMSES 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2 && !TARGET_RAMSES
diff --git a/core/settings/button/main.cpp b/core/settings/button/main.cpp
index e7c5bf9..6c2539f 100644
--- a/core/settings/button/main.cpp
+++ b/core/settings/button/main.cpp
@@ -1,32 +1,33 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include "buttonsettings.h" 28#include "buttonsettings.h"
29 29
30#include <opie/oapplicationfactory.h> 30#include <opie2/oapplicationfactory.h>
31 31
32using namespace Opie::Core;
32OPIE_EXPORT_APP( OApplicationFactory<ButtonSettings> ) 33OPIE_EXPORT_APP( OApplicationFactory<ButtonSettings> )
diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp
index 121173a..4effebc 100644
--- a/core/settings/button/remapdlg.cpp
+++ b/core/settings/button/remapdlg.cpp
@@ -1,155 +1,155 @@
1#include <qlistview.h> 1#include <qlistview.h>
2#include <qcombobox.h> 2#include <qcombobox.h>
3#include <qtimer.h> 3#include <qtimer.h>
4 4
5#include "remapdlg.h" 5#include "remapdlg.h"
6#include "buttonutils.h" 6#include "buttonutils.h"
7 7
8using namespace Opie;
9 8
9using namespace Opie::Core;
10class NoSortItem : public QListViewItem { 10class NoSortItem : public QListViewItem {
11public: 11public:
12 NoSortItem ( QListView *lv, uint pos, const QString &str, const QCString &s1 = 0, const QCString &s2 = 0 ) 12 NoSortItem ( QListView *lv, uint pos, const QString &str, const QCString &s1 = 0, const QCString &s2 = 0 )
13 : QListViewItem ( lv, str, s1, s2 ) 13 : QListViewItem ( lv, str, s1, s2 )
14 { 14 {
15 m_key = QString ( QChar ( 'a' + pos )); 15 m_key = QString ( QChar ( 'a' + pos ));
16 m_def = false; 16 m_def = false;
17 } 17 }
18 18
19 void setDefault ( bool b ) 19 void setDefault ( bool b )
20 { 20 {
21 m_def = b; 21 m_def = b;
22 } 22 }
23 23
24 virtual QString key ( int /*column*/, bool /*ascending*/ ) const 24 virtual QString key ( int /*column*/, bool /*ascending*/ ) const
25 { 25 {
26 return m_key; 26 return m_key;
27 } 27 }
28 28
29 virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ) 29 virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align )
30 { 30 {
31 if ( m_def ) { 31 if ( m_def ) {
32 QFont f ( listView ( )-> font ( )); 32 QFont f ( listView ( )-> font ( ));
33 f. setBold ( true ); 33 f. setBold ( true );
34 p-> setFont ( f ); 34 p-> setFont ( f );
35 } 35 }
36 QListViewItem::paintCell ( p, cg, column, width, align ); 36 QListViewItem::paintCell ( p, cg, column, width, align );
37 } 37 }
38 38
39private: 39private:
40 QString m_key; 40 QString m_key;
41 bool m_def; 41 bool m_def;
42}; 42};
43 43
44 44
45RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, const char *name ) 45RemapDlg::RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget *parent, const char *name )
46 : RemapDlgBase ( parent, name, true, WStyle_ContextHelp ) 46 : RemapDlgBase ( parent, name, true, WStyle_ContextHelp )
47{ 47{
48 setCaption ( tr( "%1 %2", "(hold|press) buttoname" ). arg( hold ? tr( "Held" ) : tr( "Pressed" )). arg ( b-> userText ( ))); 48 setCaption ( tr( "%1 %2", "(hold|press) buttoname" ). arg( hold ? tr( "Held" ) : tr( "Pressed" )). arg ( b-> userText ( )));
49 49
50 m_current = 0; 50 m_current = 0;
51 51
52 static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 }; 52 static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 };
53 w_channel-> insertStrList ((const char **) def_channels ); 53 w_channel-> insertStrList ((const char **) def_channels );
54 54
55 m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( ); 55 m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( );
56 m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( ); 56 m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( );
57 57
58 m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" )); 58 m_map_none = new NoSortItem ( w_list, 0, tr( "No mapping" ));
59 m_map_preset = new NoSortItem ( w_list, 1, tr( "Default" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); 59 m_map_preset = new NoSortItem ( w_list, 1, tr( "Default" ), m_msg_preset. channel ( ), m_msg_preset. message ( ));
60 ((NoSortItem *) m_map_preset )-> setDefault ( true ); 60 ((NoSortItem *) m_map_preset )-> setDefault ( true );
61 61
62 if (m_msg. channel ( ) == "ignore") 62 if (m_msg. channel ( ) == "ignore")
63 { 63 {
64 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( )); 64 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg_preset. channel ( ), m_msg_preset. message ( ));
65 65
66 m_current = m_map_none; 66 m_current = m_map_none;
67 } 67 }
68 else 68 else
69 { 69 {
70 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( )); 70 m_map_custom = new NoSortItem ( w_list, 2, tr( "Custom" ), m_msg. channel ( ), m_msg. message ( ));
71 m_current = m_map_custom; 71 m_current = m_map_custom;
72 } 72 }
73 73
74 QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" )); 74 QListViewItem *it = new NoSortItem ( w_list, 3, tr( "Actions" ));
75 ButtonUtils::inst ( )-> insertActions ( it ); 75 ButtonUtils::inst ( )-> insertActions ( it );
76 it-> setOpen ( true ); 76 it-> setOpen ( true );
77 77
78 m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); 78 m_map_show = new NoSortItem ( w_list, 4, tr( "Show" ));
79 79
80 w_list-> setCurrentItem ( m_current ); 80 w_list-> setCurrentItem ( m_current );
81 81
82 QTimer::singleShot ( 0, this, SLOT( delayedInit())); 82 QTimer::singleShot ( 0, this, SLOT( delayedInit()));
83} 83}
84 84
85RemapDlg::~RemapDlg ( ) 85RemapDlg::~RemapDlg ( )
86{ 86{
87} 87}
88 88
89void RemapDlg::delayedInit ( ) 89void RemapDlg::delayedInit ( )
90{ 90{
91 bool b = w_list-> viewport ( )-> isUpdatesEnabled ( ); 91 bool b = w_list-> viewport ( )-> isUpdatesEnabled ( );
92 w_list-> viewport ( )-> setUpdatesEnabled ( false ); 92 w_list-> viewport ( )-> setUpdatesEnabled ( false );
93 93
94 ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); 94 ButtonUtils::inst ( )-> insertAppLnks ( m_map_show );
95 95
96 w_list-> viewport ( )-> setUpdatesEnabled ( b ); 96 w_list-> viewport ( )-> setUpdatesEnabled ( b );
97 97
98 m_map_show-> repaint ( ); 98 m_map_show-> repaint ( );
99} 99}
100 100
101void RemapDlg::itemChanged ( QListViewItem *it ) 101void RemapDlg::itemChanged ( QListViewItem *it )
102{ 102{
103 bool enabled = false; 103 bool enabled = false;
104 OQCopMessage m; 104 OQCopMessage m;
105 105
106 m_current = it; 106 m_current = it;
107 107
108 if ( it == m_map_none ) 108 if ( it == m_map_none )
109 { 109 {
110 m_msg = m = OQCopMessage ( "ignore", 0 ); 110 m_msg = m = OQCopMessage ( "ignore", 0 );
111 qDebug ("***ignoring"); 111 qDebug ("***ignoring");
112 } 112 }
113 else if ( it == m_map_preset ) 113 else if ( it == m_map_preset )
114 { 114 {
115 m_msg = m = m_msg_preset; 115 m_msg = m = m_msg_preset;
116 qDebug ("***Preset"); 116 qDebug ("***Preset");
117 } 117 }
118 else if ( it && !it-> childCount ( ) ) 118 else if ( it && !it-> childCount ( ) )
119 { 119 {
120 qDebug ("***Custom: %s %s ",it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); 120 qDebug ("***Custom: %s %s ",it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( ));
121 enabled = ( it == m_map_custom ); 121 enabled = ( it == m_map_custom );
122 m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( )); 122 m_msg = m = OQCopMessage ( it-> text ( 1 ). latin1 ( ), it-> text ( 2 ). latin1 ( ));
123 } 123 }
124 124
125 w_channel-> setEnabled ( enabled ); 125 w_channel-> setEnabled ( enabled );
126 w_message-> setEnabled ( enabled ); 126 w_message-> setEnabled ( enabled );
127 127
128 w_channel-> setEditText ( m. channel ( )); 128 w_channel-> setEditText ( m. channel ( ));
129//hack for if user has typed in a message, such as 'suspend()' 129//hack for if user has typed in a message, such as 'suspend()'
130//so raise() is always present 130//so raise() is always present
131 if(m. message ( ) != "raise()") 131 if(m. message ( ) != "raise()")
132 w_message->insertItem("raise()"); 132 w_message->insertItem("raise()");
133 w_message-> setEditText ( m. message ( )); 133 w_message-> setEditText ( m. message ( ));
134} 134}
135 135
136void RemapDlg::textChanged ( const QString &str ) 136void RemapDlg::textChanged ( const QString &str )
137{ 137{
138 if ( !m_current ) 138 if ( !m_current )
139 return; 139 return;
140 140
141 QComboBox *which = (QComboBox *) sender ( ); 141 QComboBox *which = (QComboBox *) sender ( );
142 142
143 if ( which == w_channel ) 143 if ( which == w_channel )
144 m_current-> setText ( 1, str ); 144 m_current-> setText ( 1, str );
145 else if ( which == w_message ) 145 else if ( which == w_message )
146 m_current-> setText ( 2, str ); 146 m_current-> setText ( 2, str );
147} 147}
148 148
149OQCopMessage RemapDlg::message ( ) 149OQCopMessage RemapDlg::message ( )
150{ 150{
151//make sure to update message if typed in 151//make sure to update message if typed in
152 itemChanged(w_list->currentItem()); 152 itemChanged(w_list->currentItem());
153 return m_msg; 153 return m_msg;
154} 154}
155 155
diff --git a/core/settings/button/remapdlg.h b/core/settings/button/remapdlg.h
index 046a22f..6cdd678 100644
--- a/core/settings/button/remapdlg.h
+++ b/core/settings/button/remapdlg.h
@@ -1,39 +1,39 @@
1#ifndef __REMAPDLG_H__ 1#ifndef __REMAPDLG_H__
2#define __REMAPDLG_H__ 2#define __REMAPDLG_H__
3 3
4#include <opie/odevicebutton.h> 4#include <opie2/odevicebutton.h>
5 5
6#include "remapdlgbase.h" 6#include "remapdlgbase.h"
7 7
8class QListViewItem; 8class QListViewItem;
9 9
10 10
11class RemapDlg : public RemapDlgBase { 11class RemapDlg : public RemapDlgBase {
12 Q_OBJECT 12 Q_OBJECT
13 13
14public: 14public:
15 RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget* parent = 0, const char* name = 0 ); 15 RemapDlg ( const Opie::Core::ODeviceButton *b, bool hold, QWidget* parent = 0, const char* name = 0 );
16 ~RemapDlg ( ); 16 ~RemapDlg ( );
17 17
18 Opie::OQCopMessage message ( ); 18 Opie::Core::OQCopMessage message ( );
19 19
20public slots: 20public slots:
21 virtual void itemChanged ( QListViewItem * ); 21 virtual void itemChanged ( QListViewItem * );
22 virtual void textChanged ( const QString & ); 22 virtual void textChanged ( const QString & );
23 23
24private slots: 24private slots:
25 void delayedInit ( ); 25 void delayedInit ( );
26 26
27private: 27private:
28 Opie::OQCopMessage m_msg; 28 Opie::Core::OQCopMessage m_msg;
29 Opie::OQCopMessage m_msg_preset; 29 Opie::Core::OQCopMessage m_msg_preset;
30 30
31 QListViewItem *m_current; 31 QListViewItem *m_current;
32 32
33 QListViewItem *m_map_none; 33 QListViewItem *m_map_none;
34 QListViewItem *m_map_preset; 34 QListViewItem *m_map_preset;
35 QListViewItem *m_map_custom; 35 QListViewItem *m_map_custom;
36 QListViewItem *m_map_show; 36 QListViewItem *m_map_show;
37}; 37};
38 38
39#endif 39#endif
diff --git a/core/settings/citytime/config.in b/core/settings/citytime/config.in
index 295b8b8..be1bb71 100644
--- a/core/settings/citytime/config.in
+++ b/core/settings/citytime/config.in
@@ -1,4 +1,4 @@
1 config CITYTIME 1 config CITYTIME
2 boolean "opie-citytime (Time-zone / world clock settings)" 2 boolean "opie-citytime (Time-zone / world clock settings)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2
diff --git a/core/settings/citytime/main.cpp b/core/settings/citytime/main.cpp
index 7fb76ec..3f22621 100644
--- a/core/settings/citytime/main.cpp
+++ b/core/settings/citytime/main.cpp
@@ -1,24 +1,25 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "citytime.h" 21#include "citytime.h"
22#include <opie2/oapplicationfactory.h> 22#include <opie2/oapplicationfactory.h>
23 23
24using namespace Opie::Core;
24OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<CityTime> ) 25OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<CityTime> )
diff --git a/core/settings/launcher/config.in b/core/settings/launcher/config.in
index e167313..226da3c 100644
--- a/core/settings/launcher/config.in
+++ b/core/settings/launcher/config.in
@@ -1,4 +1,4 @@
1 config LAUNCHER-SETTINGS 1 config LAUNCHER-SETTINGS
2 boolean "opie-launcher-settings (Opie taskbar settings)" 2 boolean "opie-launcher-settings (Opie taskbar settings)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIEUI2 && LIBQTAUX
diff --git a/core/settings/launcher/launcher.pro b/core/settings/launcher/launcher.pro
index 3261ee8..e3f1060 100644
--- a/core/settings/launcher/launcher.pro
+++ b/core/settings/launcher/launcher.pro
@@ -1,28 +1,28 @@
1CONFIG += qt warn_on release quick-app 1CONFIG += qt warn_on release quick-app
2HEADERS = launchersettings.h \ 2HEADERS = launchersettings.h \
3 tabssettings.h \ 3 tabssettings.h \
4 taskbarsettings.h \ 4 taskbarsettings.h \
5 menusettings.h \ 5 menusettings.h \
6 inputmethodsettings.h \ 6 inputmethodsettings.h \
7 doctabsettings.h \ 7 doctabsettings.h \
8 tabconfig.h \ 8 tabconfig.h \
9 tabdialog.h 9 tabdialog.h
10 10
11SOURCES = main.cpp \ 11SOURCES = main.cpp \
12 launchersettings.cpp \ 12 launchersettings.cpp \
13 tabssettings.cpp \ 13 tabssettings.cpp \
14 taskbarsettings.cpp \ 14 taskbarsettings.cpp \
15 menusettings.cpp \ 15 menusettings.cpp \
16 inputmethodsettings.cpp \ 16 inputmethodsettings.cpp \
17 doctabsettings.cpp \ 17 doctabsettings.cpp \
18 tabdialog.cpp 18 tabdialog.cpp
19 19
20INCLUDEPATH += $(OPIEDIR)/include 20INCLUDEPATH += $(OPIEDIR)/include
21DEPENDPATH += $(OPIEDIR)/include 21DEPENDPATH += $(OPIEDIR)/include
22LIBS += -lqpe -lopie 22LIBS += -lqpe -lopiecore2 -lopieui2 -lqtaux2
23TARGET = launchersettings 23TARGET = launchersettings
24 24
25 25
26 26
27 27
28include ( $(OPIEDIR)/include.pro ) 28include ( $(OPIEDIR)/include.pro )
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp
index 5c11cc8..5efd297 100644
--- a/core/settings/launcher/launchersettings.cpp
+++ b/core/settings/launcher/launchersettings.cpp
@@ -1,79 +1,80 @@
1 1
2/* 2/*
3               =. This file is part of the OPIE Project 3               =. This file is part of the OPIE Project
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <qlayout.h> 29#include <qlayout.h>
30 30
31#include <opie/otabwidget.h> 31#include <opie2/otabwidget.h>
32 32
33#include "launchersettings.h" 33#include "launchersettings.h"
34#include "tabssettings.h" 34#include "tabssettings.h"
35#include "menusettings.h" 35#include "menusettings.h"
36#include "taskbarsettings.h" 36#include "taskbarsettings.h"
37#include "inputmethodsettings.h" 37#include "inputmethodsettings.h"
38#include "doctabsettings.h" 38#include "doctabsettings.h"
39 39
40using namespace Opie::Ui;
40LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags) 41LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags)
41 : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) 42 : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp )
42{ 43{
43 setCaption ( tr( "Launcher Settings" )); 44 setCaption ( tr( "Launcher Settings" ));
44 45
45 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 46 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
46 47
47 OTabWidget *tw = new OTabWidget ( this, "otab" ); 48 OTabWidget *tw = new OTabWidget ( this, "otab" );
48 lay-> addWidget ( tw ); 49 lay-> addWidget ( tw );
49 50
50 m_tabs = new TabsSettings ( tw ); 51 m_tabs = new TabsSettings ( tw );
51 m_taskbar = new TaskbarSettings ( tw ); 52 m_taskbar = new TaskbarSettings ( tw );
52 m_menu = new MenuSettings ( tw ); 53 m_menu = new MenuSettings ( tw );
53 m_imethods = new InputMethodSettings ( tw ); 54 m_imethods = new InputMethodSettings ( tw );
54 m_doctab = new DocTabSettings ( tw ); 55 m_doctab = new DocTabSettings ( tw );
55 56
56 tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" )); 57 tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" ));
57 tw-> addTab ( m_menu, "go", tr( "O-Menu" )); 58 tw-> addTab ( m_menu, "go", tr( "O-Menu" ));
58 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); 59 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" ));
59 tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" )); 60 tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" ));
60 tw-> addTab ( m_doctab, "DocsIcon", tr( "DocTab" ) ); 61 tw-> addTab ( m_doctab, "DocsIcon", tr( "DocTab" ) );
61 tw-> setCurrentTab ( m_taskbar ); 62 tw-> setCurrentTab ( m_taskbar );
62} 63}
63 64
64void LauncherSettings::accept ( ) 65void LauncherSettings::accept ( )
65{ 66{
66 m_taskbar-> accept ( ); 67 m_taskbar-> accept ( );
67 m_menu-> accept ( ); 68 m_menu-> accept ( );
68 m_tabs-> accept ( ); 69 m_tabs-> accept ( );
69 m_imethods-> accept ( ); 70 m_imethods-> accept ( );
70 m_doctab-> accept ( ); 71 m_doctab-> accept ( );
71 72
72 QDialog::accept ( ); 73 QDialog::accept ( );
73} 74}
74 75
75void LauncherSettings::done ( int r ) 76void LauncherSettings::done ( int r )
76{ 77{
77 QDialog::done ( r ); 78 QDialog::done ( r );
78 close ( ); 79 close ( );
79} 80}
diff --git a/core/settings/launcher/main.cpp b/core/settings/launcher/main.cpp
index bcfdcf6..b27381a 100644
--- a/core/settings/launcher/main.cpp
+++ b/core/settings/launcher/main.cpp
@@ -1,34 +1,35 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include "launchersettings.h" 28#include "launchersettings.h"
29 29
30#include <opie/oapplicationfactory.h> 30#include <opie2/oapplicationfactory.h>
31 31
32using namespace Opie::Core;
32OPIE_EXPORT_APP( OApplicationFactory<LauncherSettings> ) 33OPIE_EXPORT_APP( OApplicationFactory<LauncherSettings> )
33 34
34 35
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index c0d1cf2..763b360 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -1,513 +1,514 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include <qpe/resource.h> 28#include <qpe/resource.h>
29 29
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qtabbar.h> 32#include <qtabbar.h>
33#include <qiconview.h> 33#include <qiconview.h>
34#include <qapplication.h> 34#include <qapplication.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qradiobutton.h> 36#include <qradiobutton.h>
37#include <qbuttongroup.h> 37#include <qbuttongroup.h>
38#include <qwhatsthis.h> 38#include <qwhatsthis.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40 40
41#include <opie/ofontselector.h> 41#include <opie2/ofontselector.h>
42#include <opie/otabwidget.h> 42#include <opie2/otabwidget.h>
43#include <opie/ocolorbutton.h> 43#include <opie2/ocolorbutton.h>
44#include <opie/ofiledialog.h> 44#include <opie2/ofiledialog.h>
45 45
46#include "tabdialog.h" 46#include "tabdialog.h"
47 47
48 48
49using namespace Opie::Ui;
49class SampleItem : public QIconViewItem { 50class SampleItem : public QIconViewItem {
50public: 51public:
51 SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) 52 SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text )
52 { 53 {
53 m_large = pix; 54 m_large = pix;
54 m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); 55 m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 ));
55 } 56 }
56 57
57 void sizeChange ( ) 58 void sizeChange ( )
58 { 59 {
59 calcRect ( ); 60 calcRect ( );
60 repaint ( ); 61 repaint ( );
61 } 62 }
62 63
63 QPixmap *pixmap ( ) const 64 QPixmap *pixmap ( ) const
64 { 65 {
65 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) 66 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right )
66 return (QPixmap *) &m_small; 67 return (QPixmap *) &m_small;
67 else 68 else
68 return (QPixmap *) &m_large; 69 return (QPixmap *) &m_large;
69 } 70 }
70 71
71private: 72private:
72 QPixmap m_large, m_small; 73 QPixmap m_large, m_small;
73}; 74};
74 75
75class SampleView : public QIconView { 76class SampleView : public QIconView {
76public: 77public:
77 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) 78 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name )
78 { 79 {
79 setItemsMovable ( false ); 80 setItemsMovable ( false );
80 setAutoArrange ( true ); 81 setAutoArrange ( true );
81 setSorting ( true ); 82 setSorting ( true );
82 setFrameStyle ( QFrame::NoFrame ); 83 setFrameStyle ( QFrame::NoFrame );
83 setSpacing ( 4 ); 84 setSpacing ( 4 );
84 setMargin ( 0 ); 85 setMargin ( 0 );
85 setSelectionMode ( QIconView::NoSelection ); 86 setSelectionMode ( QIconView::NoSelection );
86 setBackgroundMode ( PaletteBase ); 87 setBackgroundMode ( PaletteBase );
87 setViewMode ( TabConfig::Icon ); 88 setViewMode ( TabConfig::Icon );
88 calculateGrid ( Bottom ); 89 calculateGrid ( Bottom );
89 90
90 91
91 new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); 92 new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" ));
92 new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); 93 new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" ));
93 new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); 94 new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" ));
94 95
95 setBackgroundType ( TabConfig::Ruled, QString::null ); 96 setBackgroundType ( TabConfig::Ruled, QString::null );
96 97
97 setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); 98 setMaximumHeight ( firstItem ( )-> height ( ) + 16 );
98 } 99 }
99 100
100 void setViewMode ( TabConfig::ViewMode m ) 101 void setViewMode ( TabConfig::ViewMode m )
101 { 102 {
102 viewport ( )-> setUpdatesEnabled ( false ); 103 viewport ( )-> setUpdatesEnabled ( false );
103 104
104 switch ( m ) { 105 switch ( m ) {
105 case TabConfig::List: 106 case TabConfig::List:
106 setItemTextPos( QIconView::Right ); 107 setItemTextPos( QIconView::Right );
107 break; 108 break;
108 case TabConfig::Icon: 109 case TabConfig::Icon:
109 setItemTextPos( QIconView::Bottom ); 110 setItemTextPos( QIconView::Bottom );
110 break; 111 break;
111 } 112 }
112 // hideOrShowItems ( false ); 113 // hideOrShowItems ( false );
113 114
114 for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) 115 for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( ))
115 ((SampleItem *) it )-> sizeChange ( ); 116 ((SampleItem *) it )-> sizeChange ( );
116 arrangeItemsInGrid ( true ); 117 arrangeItemsInGrid ( true );
117 viewport ( )-> setUpdatesEnabled ( true ); 118 viewport ( )-> setUpdatesEnabled ( true );
118 update ( ); 119 update ( );
119 } 120 }
120 121
121 122
122 void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) 123 void setBackgroundType( TabConfig::BackgroundType t, const QString &val )
123 { 124 {
124 switch ( t ) { 125 switch ( t ) {
125 case TabConfig::Ruled: { 126 case TabConfig::Ruled: {
126 QPixmap bg ( width ( ), 9 ); 127 QPixmap bg ( width ( ), 9 );
127 QPainter painter ( &bg ); 128 QPainter painter ( &bg );
128 for ( int i = 0; i < 3; i++ ) { 129 for ( int i = 0; i < 3; i++ ) {
129 painter. setPen ( white ); 130 painter. setPen ( white );
130 painter. drawLine ( 0, i*3, width()-1, i*3 ); 131 painter. drawLine ( 0, i*3, width()-1, i*3 );
131 painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); 132 painter. drawLine ( 0, i*3+1, width()-1, i*3+1 );
132 painter. setPen ( colorGroup().background().light(105) ); 133 painter. setPen ( colorGroup().background().light(105) );
133 painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); 134 painter. drawLine ( 0, i*3+2, width()-1, i*3+2 );
134 } 135 }
135 painter.end ( ); 136 painter.end ( );
136 setBackgroundPixmap ( bg ); 137 setBackgroundPixmap ( bg );
137 break; 138 break;
138 } 139 }
139 140
140 case TabConfig::SolidColor: { 141 case TabConfig::SolidColor: {
141 setBackgroundPixmap ( QPixmap ( )); 142 setBackgroundPixmap ( QPixmap ( ));
142 if ( val. isEmpty ( )) 143 if ( val. isEmpty ( ))
143 setBackgroundColor ( colorGroup ( ). base ( )); 144 setBackgroundColor ( colorGroup ( ). base ( ));
144 else 145 else
145 setBackgroundColor ( val ); 146 setBackgroundColor ( val );
146 break; 147 break;
147 } 148 }
148 149
149 case TabConfig::Image: { 150 case TabConfig::Image: {
150 qDebug( "Loading image: %s", val.latin1() ); 151 qDebug( "Loading image: %s", val.latin1() );
151 QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); 152 QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val ));
152 if ( bg. isNull ( )) { 153 if ( bg. isNull ( )) {
153 QImageIO imgio; 154 QImageIO imgio;
154 imgio. setFileName ( val ); 155 imgio. setFileName ( val );
155 QSize ds = qApp-> desktop ( )-> size ( ); 156 QSize ds = qApp-> desktop ( )-> size ( );
156 QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr 157 QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr
157 imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); 158 imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( ));
158 imgio. read ( ); 159 imgio. read ( );
159 bg = imgio. image ( ); 160 bg = imgio. image ( );
160 } 161 }
161 setBackgroundPixmap ( bg ); 162 setBackgroundPixmap ( bg );
162 break; 163 break;
163 } 164 }
164 } 165 }
165 m_bgtype = t; 166 m_bgtype = t;
166 viewport ( )-> update ( ); 167 viewport ( )-> update ( );
167 } 168 }
168 169
169 void setTextColor ( const QColor &tc ) 170 void setTextColor ( const QColor &tc )
170 { 171 {
171 m_textcolor = tc; 172 m_textcolor = tc;
172 QColorGroup cg = colorGroup ( ); 173 QColorGroup cg = colorGroup ( );
173 cg. setColor ( QColorGroup::Text, tc ); 174 cg. setColor ( QColorGroup::Text, tc );
174 setPalette ( QPalette ( cg, cg, cg )); 175 setPalette ( QPalette ( cg, cg, cg ));
175 viewport ( )-> update ( ); 176 viewport ( )-> update ( );
176 } 177 }
177 178
178 void setViewFont ( const QFont &f ) 179 void setViewFont ( const QFont &f )
179 { 180 {
180 setFont ( f ); 181 setFont ( f );
181 } 182 }
182 183
183 void setItemTextPos ( ItemTextPos pos ) 184 void setItemTextPos ( ItemTextPos pos )
184 { 185 {
185 calculateGrid ( pos ); 186 calculateGrid ( pos );
186 QIconView::setItemTextPos( pos ); 187 QIconView::setItemTextPos( pos );
187 } 188 }
188 189
189 void calculateGrid ( ItemTextPos pos ) 190 void calculateGrid ( ItemTextPos pos )
190 { 191 {
191 int dw = QApplication::desktop ( )-> width ( ); 192 int dw = QApplication::desktop ( )-> width ( );
192 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); 193 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( );
193 if ( pos == Bottom ) { 194 if ( pos == Bottom ) {
194 int cols = 3; 195 int cols = 3;
195 if ( viewerWidth <= 200 ) 196 if ( viewerWidth <= 200 )
196 cols = 2; 197 cols = 2;
197 else if ( viewerWidth >= 400 ) 198 else if ( viewerWidth >= 400 )
198 cols = viewerWidth/96; 199 cols = viewerWidth/96;
199 setSpacing ( 4 ); 200 setSpacing ( 4 );
200 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 201 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
201 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); 202 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 );
202 } 203 }
203 else { 204 else {
204 int cols = 2; 205 int cols = 2;
205 if ( viewerWidth < 150 ) 206 if ( viewerWidth < 150 )
206 cols = 1; 207 cols = 1;
207 else if ( viewerWidth >= 400 ) 208 else if ( viewerWidth >= 400 )
208 cols = viewerWidth / 150; 209 cols = viewerWidth / 150;
209 setSpacing ( 2 ); 210 setSpacing ( 2 );
210 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 211 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
211 setGridY ( fontMetrics ( ). height ( ) + 2 ); 212 setGridY ( fontMetrics ( ). height ( ) + 2 );
212 } 213 }
213 } 214 }
214 215
215 void paletteChange( const QPalette &p ) 216 void paletteChange( const QPalette &p )
216 { 217 {
217 static bool excllock = false; 218 static bool excllock = false;
218 219
219 if ( excllock ) 220 if ( excllock )
220 return; 221 return;
221 excllock = true; 222 excllock = true;
222 223
223 unsetPalette ( ); 224 unsetPalette ( );
224 QIconView::paletteChange ( p ); 225 QIconView::paletteChange ( p );
225 if ( m_bgtype == TabConfig::Ruled ) 226 if ( m_bgtype == TabConfig::Ruled )
226 setBackgroundType ( TabConfig::Ruled, QString::null ); 227 setBackgroundType ( TabConfig::Ruled, QString::null );
227 QColorGroup cg = colorGroup ( ); 228 QColorGroup cg = colorGroup ( );
228 cg.setColor ( QColorGroup::Text, m_textcolor ); 229 cg.setColor ( QColorGroup::Text, m_textcolor );
229 setPalette ( QPalette ( cg, cg, cg )); 230 setPalette ( QPalette ( cg, cg, cg ));
230 231
231 excllock = false; 232 excllock = false;
232 } 233 }
233 234
234 void setBackgroundPixmap ( const QPixmap &pm ) 235 void setBackgroundPixmap ( const QPixmap &pm )
235 { 236 {
236 m_bgpix = pm; 237 m_bgpix = pm;
237 } 238 }
238 239
239 void setBackgroundColor ( const QColor &c ) 240 void setBackgroundColor ( const QColor &c )
240 { 241 {
241 m_bgcolor = c; 242 m_bgcolor = c;
242 } 243 }
243 244
244 void drawBackground ( QPainter *p, const QRect &r ) 245 void drawBackground ( QPainter *p, const QRect &r )
245 { 246 {
246 if ( !m_bgpix. isNull ( )) { 247 if ( !m_bgpix. isNull ( )) {
247 p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), 248 p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ),
248 ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); 249 ( r. y ( ) + contentsY ( )) % m_bgpix. height ( )));
249 } 250 }
250 else 251 else
251 p-> fillRect ( r, m_bgcolor ); 252 p-> fillRect ( r, m_bgcolor );
252 } 253 }
253 254
254private: 255private:
255 QColor m_textcolor; 256 QColor m_textcolor;
256 QColor m_bgcolor; 257 QColor m_bgcolor;
257 QPixmap m_bgpix; 258 QPixmap m_bgpix;
258 TabConfig::BackgroundType m_bgtype; 259 TabConfig::BackgroundType m_bgtype;
259}; 260};
260 261
261 262
262 263
263TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) 264TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl )
264 : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) 265 : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc )
265{ 266{
266 setCaption ( tr( "Edit Tab" )); 267 setCaption ( tr( "Edit Tab" ));
267 268
268 QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); 269 QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 );
269 270
270 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 271 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
271 QWidget *bgtab; 272 QWidget *bgtab;
272 273
273 tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); 274 tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" ));
274 tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); 275 tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" ));
275 tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); 276 tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) );
276 277
277 tw-> setCurrentTab ( bgtab ); 278 tw-> setCurrentTab ( bgtab );
278 279
279 QWidget *sample = new QVBox ( this ); 280 QWidget *sample = new QVBox ( this );
280 QTabBar *tb = new QTabBar ( sample ); 281 QTabBar *tb = new QTabBar ( sample );
281 QString name ( tr( "Previewing %1" ). arg ( tabname )); 282 QString name ( tr( "Previewing %1" ). arg ( tabname ));
282 283
283 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); 284 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
284 285
285 m_sample = new SampleView ( sample ); 286 m_sample = new SampleView ( sample );
286 287
287 lay-> addWidget ( tw, 10 ); 288 lay-> addWidget ( tw, 10 );
288 lay-> addWidget ( sample, 1 ); 289 lay-> addWidget ( sample, 1 );
289 290
290 m_iconsize-> setButton ( tc. m_view ); 291 m_iconsize-> setButton ( tc. m_view );
291 iconSizeClicked ( tc. m_view ); 292 iconSizeClicked ( tc. m_view );
292 //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); 293 //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color ));
293 iconColorClicked ( m_iconcolor-> color ( )); 294 iconColorClicked ( m_iconcolor-> color ( ));
294 m_bgtype-> setButton ( tc. m_bg_type ); 295 m_bgtype-> setButton ( tc. m_bg_type );
295 //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); 296 //m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
296 m_bgimage = tc. m_bg_image; 297 m_bgimage = tc. m_bg_image;
297 bgTypeClicked ( tc. m_bg_type ); 298 bgTypeClicked ( tc. m_bg_type );
298 m_fontuse-> setChecked ( tc. m_font_use ); 299 m_fontuse-> setChecked ( tc. m_font_use );
299 m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); 300 m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic ));
300 m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); 301 m_fontselect-> setEnabled ( m_fontuse-> isChecked ( ));
301 fontClicked ( m_fontselect-> selectedFont ( )); 302 fontClicked ( m_fontselect-> selectedFont ( ));
302 303
303 QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); 304 QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." ));
304} 305}
305 306
306 307
307TabDialog::~TabDialog ( ) 308TabDialog::~TabDialog ( )
308{ 309{
309} 310}
310 311
311QWidget *TabDialog::createFontTab ( QWidget *parent ) 312QWidget *TabDialog::createFontTab ( QWidget *parent )
312{ 313{
313 QWidget *tab = new QWidget ( parent, "FontTab" ); 314 QWidget *tab = new QWidget ( parent, "FontTab" );
314 QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); 315 QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 );
315 316
316 m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); 317 m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab );
317 vertLayout-> addWidget ( m_fontuse ); 318 vertLayout-> addWidget ( m_fontuse );
318 319
319 m_fontselect = new OFontSelector ( false, tab, "fontsel" ); 320 m_fontselect = new OFontSelector ( false, tab, "fontsel" );
320 vertLayout-> addWidget ( m_fontselect ); 321 vertLayout-> addWidget ( m_fontselect );
321 322
322 connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); 323 connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool)));
323 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), 324 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
324 this, SLOT( fontClicked(const QFont&))); 325 this, SLOT( fontClicked(const QFont&)));
325 326
326 return tab; 327 return tab;
327} 328}
328 329
329QWidget *TabDialog::createBgTab ( QWidget *parent ) 330QWidget *TabDialog::createBgTab ( QWidget *parent )
330{ 331{
331 QWidget *tab = new QWidget( parent, "BgTab" ); 332 QWidget *tab = new QWidget( parent, "BgTab" );
332 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 333 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
333 334
334 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 335 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
335 gridLayout-> setColStretch ( 1, 10 ); 336 gridLayout-> setColStretch ( 1, 10 );
336 337
337 QLabel* label = new QLabel( tr( "Type:" ), tab ); 338 QLabel* label = new QLabel( tr( "Type:" ), tab );
338 gridLayout-> addWidget ( label, 0, 0 ); 339 gridLayout-> addWidget ( label, 0, 0 );
339 m_bgtype = new QButtonGroup( tab, "buttongroup" ); 340 m_bgtype = new QButtonGroup( tab, "buttongroup" );
340 m_bgtype-> hide ( ); 341 m_bgtype-> hide ( );
341 m_bgtype-> setExclusive ( true ); 342 m_bgtype-> setExclusive ( true );
342 343
343 QRadioButton *rb; 344 QRadioButton *rb;
344 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); 345 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" );
345 m_bgtype-> insert ( rb, TabConfig::Ruled ); 346 m_bgtype-> insert ( rb, TabConfig::Ruled );
346 gridLayout-> addWidget( rb, 0, 1 ); 347 gridLayout-> addWidget( rb, 0, 1 );
347 348
348 QHBoxLayout *hb = new QHBoxLayout ( ); 349 QHBoxLayout *hb = new QHBoxLayout ( );
349 hb-> setSpacing ( 3 ); 350 hb-> setSpacing ( 3 );
350 351
351 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); 352 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
352 m_bgtype-> insert ( rb, TabConfig::SolidColor ); 353 m_bgtype-> insert ( rb, TabConfig::SolidColor );
353 hb-> addWidget ( rb ); 354 hb-> addWidget ( rb );
354 hb-> addSpacing ( 10 ); 355 hb-> addSpacing ( 10 );
355 356
356 m_solidcolor = new OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); 357 m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) );
357 connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); 358 connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&)));
358 hb-> addWidget ( m_solidcolor ); 359 hb-> addWidget ( m_solidcolor );
359 hb-> addStretch ( 10 ); 360 hb-> addStretch ( 10 );
360 361
361 gridLayout-> addLayout ( hb, 1, 1 ); 362 gridLayout-> addLayout ( hb, 1, 1 );
362 363
363 hb = new QHBoxLayout ( ); 364 hb = new QHBoxLayout ( );
364 hb-> setSpacing ( 3 ); 365 hb-> setSpacing ( 3 );
365 366
366 rb = new QRadioButton( tr( "Image" ), tab, "image" ); 367 rb = new QRadioButton( tr( "Image" ), tab, "image" );
367 m_bgtype-> insert ( rb, TabConfig::Image ); 368 m_bgtype-> insert ( rb, TabConfig::Image );
368 hb-> addWidget( rb ); 369 hb-> addWidget( rb );
369 hb-> addSpacing ( 10 ); 370 hb-> addSpacing ( 10 );
370 371
371 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); 372 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab );
372 connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked())); 373 connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked()));
373 hb-> addWidget ( m_imagebrowse ); 374 hb-> addWidget ( m_imagebrowse );
374 hb-> addStretch ( 10 ); 375 hb-> addStretch ( 10 );
375 376
376 gridLayout-> addLayout ( hb, 2, 1 ); 377 gridLayout-> addLayout ( hb, 2, 1 );
377 378
378 QPushButton *p = new QPushButton ( tr( "Default" ), tab ); 379 QPushButton *p = new QPushButton ( tr( "Default" ), tab );
379 connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); 380 connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked()));
380 gridLayout-> addWidget ( p, 3, 1 ); 381 gridLayout-> addWidget ( p, 3, 1 );
381 382
382 connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); 383 connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int)));
383 384
384 vertLayout-> addStretch ( 10 ); 385 vertLayout-> addStretch ( 10 );
385 386
386 return tab; 387 return tab;
387} 388}
388 389
389QWidget *TabDialog::createIconTab ( QWidget *parent ) 390QWidget *TabDialog::createIconTab ( QWidget *parent )
390{ 391{
391 QWidget *tab = new QWidget( parent, "IconTab" ); 392 QWidget *tab = new QWidget( parent, "IconTab" );
392 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 393 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
393 394
394 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 395 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
395 gridLayout-> setColStretch ( 1, 10 ); 396 gridLayout-> setColStretch ( 1, 10 );
396 397
397 QLabel* label = new QLabel( tr( "Size:" ), tab ); 398 QLabel* label = new QLabel( tr( "Size:" ), tab );
398 gridLayout-> addWidget ( label, 0, 0 ); 399 gridLayout-> addWidget ( label, 0, 0 );
399 m_iconsize = new QButtonGroup( tab, "buttongroup" ); 400 m_iconsize = new QButtonGroup( tab, "buttongroup" );
400 m_iconsize-> hide ( ); 401 m_iconsize-> hide ( );
401 m_iconsize-> setExclusive ( true ); 402 m_iconsize-> setExclusive ( true );
402 403
403 QRadioButton *rb; 404 QRadioButton *rb;
404 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); 405 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
405 m_iconsize-> insert ( rb, TabConfig::List ); 406 m_iconsize-> insert ( rb, TabConfig::List );
406 gridLayout-> addWidget( rb, 0, 1 ); 407 gridLayout-> addWidget( rb, 0, 1 );
407 408
408 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); 409 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" );
409 m_iconsize-> insert ( rb, TabConfig::Icon ); 410 m_iconsize-> insert ( rb, TabConfig::Icon );
410 gridLayout-> addWidget( rb, 1, 1 ); 411 gridLayout-> addWidget( rb, 1, 1 );
411 412
412 connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); 413 connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int)));
413 414
414 //vertLayout-> addSpacing ( 8 ); 415 //vertLayout-> addSpacing ( 8 );
415 416
416 //gridLayout = new QGridLayout ( vertLayout ); 417 //gridLayout = new QGridLayout ( vertLayout );
417 gridLayout-> addRowSpacing ( 2, 8 ); 418 gridLayout-> addRowSpacing ( 2, 8 );
418 419
419 label = new QLabel ( tr( "Color:" ), tab ); 420 label = new QLabel ( tr( "Color:" ), tab );
420 gridLayout-> addWidget ( label, 3, 0 ); 421 gridLayout-> addWidget ( label, 3, 0 );
421 422
422 m_iconcolor = new OColorButton ( tab, QColor ( m_tc. m_text_color ) ); 423 m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) );
423 connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&))); 424 connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&)));
424 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); 425 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft );
425 426
426 vertLayout-> addStretch ( 10 ); 427 vertLayout-> addStretch ( 10 );
427 428
428 return tab; 429 return tab;
429} 430}
430 431
431 432
432void TabDialog::iconSizeClicked ( int s ) 433void TabDialog::iconSizeClicked ( int s )
433{ 434{
434 m_sample-> setViewMode ((TabConfig::ViewMode) s ); 435 m_sample-> setViewMode ((TabConfig::ViewMode) s );
435} 436}
436 437
437void TabDialog::fontClicked ( const QFont &f ) 438void TabDialog::fontClicked ( const QFont &f )
438{ 439{
439 m_sample-> setViewFont ( f ); 440 m_sample-> setViewFont ( f );
440} 441}
441 442
442void TabDialog::bgTypeClicked ( int t ) 443void TabDialog::bgTypeClicked ( int t )
443{ 444{
444 QString s; 445 QString s;
445 446
446 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) 447 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t )
447 m_bgtype-> setButton ( t ); 448 m_bgtype-> setButton ( t );
448 449
449 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); 450 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor );
450 m_imagebrowse-> setEnabled ( t == TabConfig::Image ); 451 m_imagebrowse-> setEnabled ( t == TabConfig::Image );
451 452
452 if ( t == TabConfig::SolidColor ) 453 if ( t == TabConfig::SolidColor )
453 s = m_solidcolor-> color ( ). name ( ); 454 s = m_solidcolor-> color ( ). name ( );
454 else if ( t == TabConfig::Image ) 455 else if ( t == TabConfig::Image )
455 s = Resource::findPixmap ( m_bgimage ); 456 s = Resource::findPixmap ( m_bgimage );
456 457
457 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); 458 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s );
458} 459}
459 460
460void TabDialog::bgColorClicked ( const QColor & ) 461void TabDialog::bgColorClicked ( const QColor & )
461{ 462{
462 bgTypeClicked ( TabConfig::SolidColor ); 463 bgTypeClicked ( TabConfig::SolidColor );
463} 464}
464 465
465void TabDialog::iconColorClicked ( const QColor &col ) 466void TabDialog::iconColorClicked ( const QColor &col )
466{ 467{
467 m_sample-> setTextColor ( col ); 468 m_sample-> setTextColor ( col );
468} 469}
469 470
470void TabDialog::bgImageClicked ( ) 471void TabDialog::bgImageClicked ( )
471{ 472{
472 // ### use OFileSelector here ### 473 // ### use OFileSelector here ###
473 // this is just a quick c&p from the old appearance app 474 // this is just a quick c&p from the old appearance app
474 475
475 MimeTypes types; 476 MimeTypes types;
476 QStringList list; 477 QStringList list;
477 list << "image/*"; 478 list << "image/*";
478 types. insert ( "Images", list ); 479 types. insert ( "Images", list );
479 480
480 QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); 481 QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types );
481 if ( !file. isEmpty ( )) { 482 if ( !file. isEmpty ( )) {
482 m_bgimage = DocLnk ( file ). file ( ); 483 m_bgimage = DocLnk ( file ). file ( );
483 bgTypeClicked ( TabConfig::Image ); 484 bgTypeClicked ( TabConfig::Image );
484 } 485 }
485} 486}
486 487
487void TabDialog::bgDefaultClicked ( ) 488void TabDialog::bgDefaultClicked ( )
488{ 489{
489 m_bgimage = "launcher/opie-background"; 490 m_bgimage = "launcher/opie-background";
490 bgTypeClicked ( TabConfig::Image ); 491 bgTypeClicked ( TabConfig::Image );
491} 492}
492 493
493void TabDialog::accept ( ) 494void TabDialog::accept ( )
494{ 495{
495 m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); 496 m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( ));
496 m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); 497 m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( ));
497 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); 498 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( );
498 m_tc. m_bg_image = m_bgimage; 499 m_tc. m_bg_image = m_bgimage;
499 m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); 500 m_tc. m_text_color = m_iconcolor-> color ( ). name ( );
500 501
501 m_tc. m_font_use = m_fontuse-> isChecked ( ); 502 m_tc. m_font_use = m_fontuse-> isChecked ( );
502 503
503 if ( m_tc. m_font_use ) { 504 if ( m_tc. m_font_use ) {
504 QFont f = m_fontselect-> selectedFont ( ); 505 QFont f = m_fontselect-> selectedFont ( );
505 506
506 m_tc. m_font_family = f. family ( ); 507 m_tc. m_font_family = f. family ( );
507 m_tc. m_font_size = f. pointSize ( ); 508 m_tc. m_font_size = f. pointSize ( );
508 m_tc. m_font_weight = f. weight ( ); 509 m_tc. m_font_weight = f. weight ( );
509 m_tc. m_font_italic = f. italic ( ); 510 m_tc. m_font_italic = f. italic ( );
510 } 511 }
511 512
512 QDialog::accept ( ); 513 QDialog::accept ( );
513} 514}
diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h
index 4f99d5d..46b7ae9 100644
--- a/core/settings/launcher/tabdialog.h
+++ b/core/settings/launcher/tabdialog.h
@@ -1,81 +1,81 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#ifndef __TABDIALOG_H__ 28#ifndef __TABDIALOG_H__
29#define __TABDIALOG_H__ 29#define __TABDIALOG_H__
30 30
31#include <qdialog.h> 31#include <qdialog.h>
32#include "tabconfig.h" 32#include "tabconfig.h"
33 33
34class QButtonGroup; 34class QButtonGroup;
35class OFontSelector; 35namespace Opie {namespace Ui {class OFontSelector;}}
36class SampleView; 36class SampleView;
37class OColorButton; 37namespace Opie {class OColorButton;}
38class QPushButton; 38class QPushButton;
39class QCheckBox; 39class QCheckBox;
40 40
41 41
42class TabDialog : public QDialog { 42class TabDialog : public QDialog {
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45 TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *dname = 0, bool modal = false, WFlags = 0 ); 45 TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *dname = 0, bool modal = false, WFlags = 0 );
46 virtual ~TabDialog ( ); 46 virtual ~TabDialog ( );
47 47
48public slots: 48public slots:
49 virtual void accept ( ); 49 virtual void accept ( );
50 50
51protected slots: 51protected slots:
52 void iconSizeClicked ( int ); 52 void iconSizeClicked ( int );
53 void fontClicked ( const QFont & ); 53 void fontClicked ( const QFont & );
54 void bgTypeClicked ( int ); 54 void bgTypeClicked ( int );
55 void bgColorClicked ( const QColor & ); 55 void bgColorClicked ( const QColor & );
56 void iconColorClicked ( const QColor & ); 56 void iconColorClicked ( const QColor & );
57 void bgImageClicked ( ); 57 void bgImageClicked ( );
58 void bgDefaultClicked ( ); 58 void bgDefaultClicked ( );
59 59
60private: 60private:
61 QWidget *createBgTab ( QWidget *parent ); 61 QWidget *createBgTab ( QWidget *parent );
62 QWidget *createFontTab ( QWidget *parent ); 62 QWidget *createFontTab ( QWidget *parent );
63 QWidget *createIconTab ( QWidget *parent ); 63 QWidget *createIconTab ( QWidget *parent );
64 64
65 65
66private: 66private:
67 SampleView *m_sample; 67 SampleView *m_sample;
68 QButtonGroup *m_iconsize; 68 QButtonGroup *m_iconsize;
69 OFontSelector *m_fontselect; 69 Opie::Ui::OFontSelector *m_fontselect;
70 OColorButton *m_solidcolor; 70 Opie::OColorButton *m_solidcolor;
71 OColorButton *m_iconcolor; 71 Opie::OColorButton *m_iconcolor;
72 QPushButton *m_imagebrowse; 72 QPushButton *m_imagebrowse;
73 QString m_bgimage; 73 QString m_bgimage;
74 QButtonGroup *m_bgtype; 74 QButtonGroup *m_bgtype;
75 QCheckBox *m_fontuse; 75 QCheckBox *m_fontuse;
76 76
77 TabConfig &m_tc; 77 TabConfig &m_tc;
78}; 78};
79 79
80 80
81#endif 81#endif
diff --git a/core/settings/light-and-power/config.in b/core/settings/light-and-power/config.in
index 96346bb..ef2a42f 100644
--- a/core/settings/light-and-power/config.in
+++ b/core/settings/light-and-power/config.in
@@ -1,4 +1,4 @@
1 config LIGHT-AND-POWER 1 config LIGHT-AND-POWER
2 boolean "opie-light-and-power (apm and energy saving settings)" 2 boolean "opie-light-and-power (apm and energy saving settings)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 09fb767..ebcc25c 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -1,243 +1,243 @@
1/* 1/*
2 This file is part of the OPIE Project 2 This file is part of the OPIE Project
3               =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> 3               =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "light.h" 29#include "light.h"
30#include "sensor.h" 30#include "sensor.h"
31 31
32#include <opie2/odevice.h> 32#include <opie2/odevice.h>
33 33
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/power.h> 35#include <qpe/power.h>
36#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 36#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#endif 38#endif
39 39
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qcheckbox.h> 41#include <qcheckbox.h>
42#include <qtabwidget.h> 42#include <qtabwidget.h>
43#include <qslider.h> 43#include <qslider.h>
44#include <qspinbox.h> 44#include <qspinbox.h>
45#include <qpushbutton.h> 45#include <qpushbutton.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qcombobox.h> 47#include <qcombobox.h>
48 48
49 49
50 50
51using namespace Opie; 51using namespace Opie::Core;
52 52
53LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) 53LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
54 : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) 54 : LightSettingsBase( parent, name, false, WStyle_ContextHelp )
55{ 55{
56 m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); 56 m_bres = ODevice::inst ( )-> displayBrightnessResolution ( );
57 m_cres = ODevice::inst ( )-> displayContrastResolution ( ); 57 m_cres = ODevice::inst ( )-> displayContrastResolution ( );
58 58
59 // check whether to show the light sensor stuff 59 // check whether to show the light sensor stuff
60 60
61 if ( !ODevice::inst ( )-> hasLightSensor ( )) { 61 if ( !ODevice::inst ( )-> hasLightSensor ( )) {
62 auto_brightness-> hide ( ); 62 auto_brightness-> hide ( );
63 CalibrateLightSensor-> hide ( ); 63 CalibrateLightSensor-> hide ( );
64 auto_brightness_ac-> hide ( ); 64 auto_brightness_ac-> hide ( );
65 CalibrateLightSensor_ac-> hide ( ); 65 CalibrateLightSensor_ac-> hide ( );
66 } 66 }
67 67
68 // check whether to show the contrast stuff 68 // check whether to show the contrast stuff
69 69
70 if (m_cres) { 70 if (m_cres) {
71 GroupLight->setTitle(tr("Backlight && Contrast")); 71 GroupLight->setTitle(tr("Backlight && Contrast"));
72 GroupLight_ac->setTitle(GroupLight->title()); 72 GroupLight_ac->setTitle(GroupLight->title());
73 } else { 73 } else {
74 contrast->hide(); 74 contrast->hide();
75 contrast_ac->hide(); 75 contrast_ac->hide();
76 } 76 }
77 77
78 // check whether to show the cpu frequency stuff 78 // check whether to show the cpu frequency stuff
79 79
80 QStrList freq = ODevice::inst()->allowedCpuFrequencies(); 80 QStrList freq = ODevice::inst()->allowedCpuFrequencies();
81 if ( freq.count() ) { 81 if ( freq.count() ) {
82 frequency->insertStrList( freq ); 82 frequency->insertStrList( freq );
83 frequency_ac->insertStrList( freq ); 83 frequency_ac->insertStrList( freq );
84 } else { 84 } else {
85 frequencyLabel->hide(); 85 frequencyLabel->hide();
86 frequency->hide(); 86 frequency->hide();
87 frequencyLabel_ac->hide(); 87 frequencyLabel_ac->hide();
88 frequency_ac->hide(); 88 frequency_ac->hide();
89 } 89 }
90 90
91 // check whether to show the hinge action stuff 91 // check whether to show the hinge action stuff
92 92
93 if ( !ODevice::inst()->hasHingeSensor() ) { 93 if ( !ODevice::inst()->hasHingeSensor() ) {
94 closeHingeLabel->hide(); 94 closeHingeLabel->hide();
95 closeHingeAction->hide(); 95 closeHingeAction->hide();
96 closeHingeLabel_ac->hide(); 96 closeHingeLabel_ac->hide();
97 closeHingeAction_ac->hide(); 97 closeHingeAction_ac->hide();
98 } 98 }
99 99
100 Config config ( "apm" ); 100 Config config ( "apm" );
101 config. setGroup ( "Battery" ); 101 config. setGroup ( "Battery" );
102 102
103 // battery spinboxes 103 // battery spinboxes
104 interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); 104 interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 ));
105 interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); 105 interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 ));
106 interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); 106 interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 ));
107 107
108 // battery check and slider 108 // battery check and slider
109 LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 109 LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
110 110
111 // CPU frequency 111 // CPU frequency
112 frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); 112 frequency->setCurrentItem( config.readNumEntry("Freq", 0) );
113 113
114 // hinge action 114 // hinge action
115 closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); 115 closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
116 116
117 int bright = config. readNumEntry ( "Brightness", 127 ); 117 int bright = config. readNumEntry ( "Brightness", 127 );
118 int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); 118 int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 );
119 brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); 119 brightness-> setTickInterval ( QMAX( 16, 256 / m_bres ));
120 brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); 120 brightness-> setLineStep ( QMAX( 1, 256 / m_bres ));
121 brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); 121 brightness-> setPageStep ( QMAX( 1, 256 / m_bres ));
122 brightness-> setValue ( bright ); 122 brightness-> setValue ( bright );
123 123
124 if (m_cres) { 124 if (m_cres) {
125 contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); 125 contrast-> setTickInterval ( QMAX( 16, 256 / m_cres ));
126 contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); 126 contrast-> setLineStep ( QMAX( 1, 256 / m_cres ));
127 contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); 127 contrast-> setPageStep ( QMAX( 1, 256 / m_cres ));
128 contrast-> setValue ( contr ); 128 contrast-> setValue ( contr );
129 } 129 }
130 130
131 // light sensor 131 // light sensor
132 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 132 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
133 m_sensordata = config. readListEntry ( "LightSensorData", ';' ); 133 m_sensordata = config. readListEntry ( "LightSensorData", ';' );
134 134
135 config. setGroup ( "AC" ); 135 config. setGroup ( "AC" );
136 136
137 // ac spinboxes 137 // ac spinboxes
138 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); 138 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 ));
139 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); 139 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 ));
140 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); 140 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 ));
141 141
142 // ac check and slider 142 // ac check and slider
143 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 143 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
144 144
145 // CPU frequency 145 // CPU frequency
146 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); 146 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) );
147 147
148 // hinge action 148 // hinge action
149 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); 149 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
150 150
151 bright = config. readNumEntry ( "Brightness", 255 ); 151 bright = config. readNumEntry ( "Brightness", 255 );
152 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); 152 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres ));
153 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); 153 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres ));
154 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); 154 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres ));
155 brightness_ac-> setValue ( bright ); 155 brightness_ac-> setValue ( bright );
156 156
157 if (m_cres) { 157 if (m_cres) {
158 contr = config. readNumEntry ( "Contrast", 127); 158 contr = config. readNumEntry ( "Contrast", 127);
159 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); 159 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres ));
160 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); 160 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres ));
161 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); 161 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres ));
162 contrast_ac-> setValue ( contr ); 162 contrast_ac-> setValue ( contr );
163 } 163 }
164 164
165 // light sensor 165 // light sensor
166 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 166 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
167 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); 167 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
168 168
169 // warnings 169 // warnings
170 config. setGroup ( "Warnings" ); 170 config. setGroup ( "Warnings" );
171 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); 171 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 );
172 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); 172 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) );
173 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); 173 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) );
174 174
175 m_resettimer = new QTimer ( this ); 175 m_resettimer = new QTimer ( this );
176 connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); 176 connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight()));
177 177
178 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { 178 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) {
179 tabs-> setCurrentPage ( 0 ); 179 tabs-> setCurrentPage ( 0 );
180 } 180 }
181 else { 181 else {
182 tabs-> setCurrentPage ( 1 ); 182 tabs-> setCurrentPage ( 1 );
183 } 183 }
184 184
185 connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); 185 connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int)));
186 connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); 186 connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int)));
187 if (m_cres) { 187 if (m_cres) {
188 connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); 188 connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int)));
189 connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); 189 connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int)));
190 } 190 }
191 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 191 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
192 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 192 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
193 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 193 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
194 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 194 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
195} 195}
196 196
197LightSettings::~LightSettings ( ) 197LightSettings::~LightSettings ( )
198{ 198{
199} 199}
200 200
201void LightSettings::calibrateSensor ( ) 201void LightSettings::calibrateSensor ( )
202{ 202{
203 Sensor *s = new Sensor ( m_sensordata, this ); 203 Sensor *s = new Sensor ( m_sensordata, this );
204 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); 204 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int)));
205 QPEApplication::execDialog( s ); 205 QPEApplication::execDialog( s );
206 delete s; 206 delete s;
207} 207}
208 208
209void LightSettings::calibrateSensorAC ( ) 209void LightSettings::calibrateSensorAC ( )
210{ 210{
211 Sensor *s = new Sensor ( m_sensordata_ac, this ); 211 Sensor *s = new Sensor ( m_sensordata_ac, this );
212 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); 212 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int)));
213 QPEApplication::execDialog ( s ); 213 QPEApplication::execDialog ( s );
214 delete s; 214 delete s;
215} 215}
216 216
217void LightSettings::setBacklight ( int bright ) 217void LightSettings::setBacklight ( int bright )
218{ 218{
219 QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); 219 QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
220 e << bright; 220 e << bright;
221 221
222 if ( bright != -1 ) { 222 if ( bright != -1 ) {
223 m_resettimer-> stop ( ); 223 m_resettimer-> stop ( );
224 m_resettimer-> start ( 4000, true ); 224 m_resettimer-> start ( 4000, true );
225 } 225 }
226} 226}
227 227
228void LightSettings::setContrast ( int contr ) 228void LightSettings::setContrast ( int contr )
229{ 229{
230 if (contr == -1) contr = m_oldcontrast; 230 if (contr == -1) contr = m_oldcontrast;
231 ODevice::inst ( )-> setDisplayContrast(contr); 231 ODevice::inst ( )-> setDisplayContrast(contr);
232} 232}
233 233
234void LightSettings::setFrequency ( int index ) 234void LightSettings::setFrequency ( int index )
235{ 235{
236 qWarning("LightSettings::setFrequency(%d)", index); 236 qWarning("LightSettings::setFrequency(%d)", index);
237 ODevice::inst ( )-> setCurrentCpuFrequency(index); 237 ODevice::inst ( )-> setCurrentCpuFrequency(index);
238} 238}
239 239
240void LightSettings::resetBacklight ( ) 240void LightSettings::resetBacklight ( )
241{ 241{
242 setBacklight ( -1 ); 242 setBacklight ( -1 );
243 setContrast ( -1 ); 243 setContrast ( -1 );
diff --git a/core/settings/light-and-power/main.cpp b/core/settings/light-and-power/main.cpp
index 7a47b0b..1fc167d 100644
--- a/core/settings/light-and-power/main.cpp
+++ b/core/settings/light-and-power/main.cpp
@@ -1,26 +1,27 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "light.h" 21#include "light.h"
22 22
23#include <opie2/oapplicationfactory.h> 23#include <opie2/oapplicationfactory.h>
24 24
25 25
26using namespace Opie::Core;
26OPIE_EXPORT_APP( OApplicationFactory<LightSettings> ) 27OPIE_EXPORT_APP( OApplicationFactory<LightSettings> )
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp
index 53c3aed..a700a64 100644
--- a/core/settings/light-and-power/sensor.cpp
+++ b/core/settings/light-and-power/sensor.cpp
@@ -1,103 +1,103 @@
1/* 1/*
2 This file is part of the OPIE Project 2 This file is part of the OPIE Project
3               =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> 3               =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "calibration.h" 29#include "calibration.h"
30#include "sensor.h" 30#include "sensor.h"
31 31
32#include <opie2/odevice.h> 32#include <opie2/odevice.h>
33 33
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qslider.h> 35#include <qslider.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37 37
38using namespace Opie; 38using namespace Opie::Core;
39 39
40Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name ) 40Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name )
41 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params ) 41 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params )
42{ 42{
43 int steps = 12; 43 int steps = 12;
44 int inter = 2; 44 int inter = 2;
45 45
46 int smin = 40; 46 int smin = 40;
47 int smax = 215; 47 int smax = 215;
48 int lmin = 1; 48 int lmin = 1;
49 int lmax = 255; 49 int lmax = 255;
50 50
51 switch ( params. count ( )) { 51 switch ( params. count ( )) {
52 case 6: lmax = params [5]. toInt ( ); 52 case 6: lmax = params [5]. toInt ( );
53 case 5: lmin = params [4]. toInt ( ); 53 case 5: lmin = params [4]. toInt ( );
54 case 4: smax = params [3]. toInt ( ); 54 case 4: smax = params [3]. toInt ( );
55 case 3: smin = params [2]. toInt ( ); 55 case 3: smin = params [2]. toInt ( );
56 case 2: steps = params [1]. toInt ( ); 56 case 2: steps = params [1]. toInt ( );
57 case 1: inter = params [0]. toInt ( ) / 1000; 57 case 1: inter = params [0]. toInt ( ) / 1000;
58 } 58 }
59 59
60 int xscale = ODevice::inst ( )-> lightSensorResolution ( ); 60 int xscale = ODevice::inst ( )-> lightSensorResolution ( );
61 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); 61 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
62 62
63 QVBoxLayout *lay = new QVBoxLayout ( frame ); 63 QVBoxLayout *lay = new QVBoxLayout ( frame );
64 lay-> setMargin ( 2 ); 64 lay-> setMargin ( 2 );
65 m_calib = new Calibration ( frame ); 65 m_calib = new Calibration ( frame );
66 lay-> add ( m_calib ); 66 lay-> add ( m_calib );
67 67
68 m_calib-> setScale ( QSize ( xscale, yscale )); 68 m_calib-> setScale ( QSize ( xscale, yscale ));
69 m_calib-> setLineSteps ( steps ); 69 m_calib-> setLineSteps ( steps );
70 m_calib-> setInterval ( inter ); 70 m_calib-> setInterval ( inter );
71 m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 )); 71 m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 ));
72 m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 )); 72 m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 ));
73 73
74 interval-> setValue ( inter ); 74 interval-> setValue ( inter );
75 linesteps-> setValue ( steps ); 75 linesteps-> setValue ( steps );
76 76
77 connect ( interval, SIGNAL( valueChanged(int)), m_calib, SLOT( setInterval(int))); 77 connect ( interval, SIGNAL( valueChanged(int)), m_calib, SLOT( setInterval(int)));
78 connect ( linesteps, SIGNAL( valueChanged(int)), m_calib, SLOT( setLineSteps(int))); 78 connect ( linesteps, SIGNAL( valueChanged(int)), m_calib, SLOT( setLineSteps(int)));
79 79
80 connect ( m_calib, SIGNAL( startPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&))); 80 connect ( m_calib, SIGNAL( startPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&)));
81 connect ( m_calib, SIGNAL( endPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&))); 81 connect ( m_calib, SIGNAL( endPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&)));
82} 82}
83 83
84void Sensor::accept ( ) 84void Sensor::accept ( )
85{ 85{
86 int xscale = ODevice::inst ( )-> lightSensorResolution ( ); 86 int xscale = ODevice::inst ( )-> lightSensorResolution ( );
87 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); 87 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
88 88
89 m_params. clear ( ); 89 m_params. clear ( );
90 m_params << QString::number ( m_calib-> interval ( ) * 1000 ) 90 m_params << QString::number ( m_calib-> interval ( ) * 1000 )
91 << QString::number ( m_calib-> lineSteps ( )) 91 << QString::number ( m_calib-> lineSteps ( ))
92 << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale ) 92 << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale )
93 << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale ) 93 << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale )
94 << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale ) 94 << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale )
95 << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale ); 95 << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale );
96 96
97 QDialog::accept ( ); 97 QDialog::accept ( );
98} 98}
99 99
100void Sensor::pointDrag ( const QPoint &p ) 100void Sensor::pointDrag ( const QPoint &p )
101{ 101{
102 emit viewBacklight ( p. y ( )); 102 emit viewBacklight ( p. y ( ));
103} 103}
diff --git a/core/settings/security/config.in b/core/settings/security/config.in
index 0973349..14876da 100644
--- a/core/settings/security/config.in
+++ b/core/settings/security/config.in
@@ -1,4 +1,4 @@
1 config SECURITY 1 config SECURITY
2 boolean "opie-security (to set a pin for PDA usage protection)" 2 boolean "opie-security (to set a pin for PDA usage protection)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 )
diff --git a/core/settings/security/main.cpp b/core/settings/security/main.cpp
index aed8ab2..200a541 100644
--- a/core/settings/security/main.cpp
+++ b/core/settings/security/main.cpp
@@ -1,29 +1,30 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21 21
22#include "security.h" 22#include "security.h"
23 23
24#include <opie/oapplicationfactory.h> 24#include <opie2/oapplicationfactory.h>
25 25
26using namespace Opie::Core;
26OPIE_EXPORT_APP( OApplicationFactory<Security> ) 27OPIE_EXPORT_APP( OApplicationFactory<Security> )
27 28
28 29
29 30