summaryrefslogtreecommitdiff
path: root/core/settings
authoralwin <alwin>2004-03-02 12:14:15 (UTC)
committer alwin <alwin>2004-03-02 12:14:15 (UTC)
commit0d59c780513da78033f4d9040475dee9db0256d4 (patch) (unidiff)
tree503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /core/settings
parenta0981652d61776d70f25980f035748b21339e946 (diff)
downloadopie-0d59c780513da78033f4d9040475dee9db0256d4.zip
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz
opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you can check the diff (but it had compiled and run here)
Diffstat (limited to 'core/settings') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/button/buttonsettings.cpp2
-rw-r--r--core/settings/button/remapdlg.cpp2
-rw-r--r--core/settings/citytime/citytime.cpp4
-rw-r--r--core/settings/citytime/citytimebase.cpp2
-rw-r--r--core/settings/citytime/zonemap.cpp16
-rw-r--r--core/settings/launcher/menusettings.cpp4
-rw-r--r--core/settings/launcher/tabdialog.cpp18
-rw-r--r--core/settings/launcher/tabssettings.cpp6
-rw-r--r--core/settings/launcher/taskbarsettings.cpp2
-rw-r--r--core/settings/light-and-power/light.cpp14
-rw-r--r--core/settings/light-and-power/sensor.cpp8
11 files changed, 39 insertions, 39 deletions
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp
index 141e0f6..d80e496 100644
--- a/core/settings/button/buttonsettings.cpp
+++ b/core/settings/button/buttonsettings.cpp
@@ -1,254 +1,254 @@
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 <opie/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;
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
232 delete d; 232 delete d;
233 233
234 m_lock = false; 234 m_lock = false;
235} 235}
236 236
237void ButtonSettings::accept ( ) 237void ButtonSettings::accept ( )
238{ 238{
239 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { 239 for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) {
240 buttoninfo *bi = *it; 240 buttoninfo *bi = *it;
241 241
242 if ( bi-> m_pdirty ) 242 if ( bi-> m_pdirty )
243 ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg ); 243 ODevice::inst ( )-> remapPressedAction ( bi-> m_index, bi-> m_pmsg );
244 if ( bi-> m_hdirty ) 244 if ( bi-> m_hdirty )
245 ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg ); 245 ODevice::inst ( )-> remapHeldAction ( bi-> m_index, bi-> m_hmsg );
246 } 246 }
247 QDialog::accept ( ); 247 QDialog::accept ( );
248} 248}
249 249
250void ButtonSettings::done ( int r ) 250void ButtonSettings::done ( int r )
251{ 251{
252 QDialog::done ( r ); 252 QDialog::done ( r );
253 close ( ); 253 close ( );
254} 254}
diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp
index 7dabe68..121173a 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; 8using namespace Opie;
9 9
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::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/citytime/citytime.cpp b/core/settings/citytime/citytime.cpp
index e7f0c46..721285d 100644
--- a/core/settings/citytime/citytime.cpp
+++ b/core/settings/citytime/citytime.cpp
@@ -1,279 +1,279 @@
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// changes by Maximilian Reiss <harlekin@handhelds.org> 21// changes by Maximilian Reiss <harlekin@handhelds.org>
22 22
23#include "zonemap.h" 23#include "zonemap.h"
24#include "citytime.h" 24#include "citytime.h"
25 25
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/config.h> 27#include <qpe/config.h>
28#include <qpe/tzselect.h> 28#include <qpe/tzselect.h>
29#if !defined(QT_NO_COP) 29#if !defined(QT_NO_COP)
30#include <qpe/qcopenvelope_qws.h> 30#include <qpe/qcopenvelope_qws.h>
31#endif 31#endif
32 32
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qmessagebox.h> 34#include <qmessagebox.h>
35#include <qtoolbutton.h> 35#include <qtoolbutton.h>
36#include <qlayout.h> 36#include <qlayout.h>
37 37
38#include <stdlib.h> 38#include <stdlib.h>
39 39
40CityTime::CityTime( QWidget *parent, const char* name, 40CityTime::CityTime( QWidget *parent, const char* name,
41 WFlags fl ) 41 WFlags fl )
42 : CityTimeBase( parent, name, fl ), 42 : CityTimeBase( parent, name, fl ),
43 strRealTz(0), 43 strRealTz(0),
44 bAdded(false) 44 bAdded(false)
45{ 45{
46 Config config( "qpe" ); 46 Config config( "qpe" );
47 config.setGroup( "Time" ); 47 config.setGroup( "Time" );
48 bWhichClock = config.readBoolEntry( "AMPM", TRUE ); 48 bWhichClock = config.readBoolEntry( "AMPM", TRUE );
49 qDebug( QString("%1").arg(bWhichClock) ); 49 qDebug( QString("%1").arg(bWhichClock) );
50 frmMap->changeClock( bWhichClock ); 50 frmMap->changeClock( bWhichClock );
51 51
52 char *pEnv; 52 char *pEnv;
53 pEnv = NULL; 53 pEnv = NULL;
54 pEnv = getenv("TZ"); 54 pEnv = getenv("TZ");
55 if ( pEnv ) 55 if ( pEnv )
56 strRealTz = pEnv; 56 strRealTz = pEnv;
57 pEnv = NULL; 57 pEnv = NULL;
58 pEnv = getenv("HOME"); 58 pEnv = getenv("HOME");
59 if ( pEnv ) 59 if ( pEnv )
60 strHome = pEnv; 60 strHome = pEnv;
61 // append the labels to their respective lists... 61 // append the labels to their respective lists...
62 listCities.setAutoDelete( true ); 62 listCities.setAutoDelete( true );
63 listTimes.setAutoDelete( true ); 63 listTimes.setAutoDelete( true );
64 64
65 listCities.append( cmdCity1 ); 65 listCities.append( cmdCity1 );
66 listCities.append( cmdCity2 ); 66 listCities.append( cmdCity2 );
67 listCities.append( cmdCity3 ); 67 listCities.append( cmdCity3 );
68 68
69 listTimes.append( lblCTime1 ); 69 listTimes.append( lblCTime1 );
70 listTimes.append( lblCTime2 ); 70 listTimes.append( lblCTime2 );
71 listTimes.append( lblCTime3 ); 71 listTimes.append( lblCTime3 );
72 72
73 73
74 // kludgy way of getting the screen size so we don't have to depend 74 // kludgy way of getting the screen size so we don't have to depend
75 // on a resize event... 75 // on a resize event...
76 QWidget *d = QApplication::desktop(); 76 QWidget *d = QApplication::desktop();
77 if ( d->width() < d->height() ) { 77 if ( d->width() < d->height() ) {
78 // append for that 4 down look 78 // append for that 4 down look
79 listCities.append( cmdCity4 ); 79 listCities.append( cmdCity4 );
80 listCities.append( cmdCity5 ); 80 listCities.append( cmdCity5 );
81 listCities.append( cmdCity6 ); 81 listCities.append( cmdCity6 );
82 listTimes.append( lblCTime4 ); 82 listTimes.append( lblCTime4 );
83 listTimes.append( lblCTime5 ); 83 listTimes.append( lblCTime5 );
84 listTimes.append( lblCTime6 ); 84 listTimes.append( lblCTime6 );
85 lblCTime7->hide(); 85 lblCTime7->hide();
86 lblCTime8->hide(); 86 lblCTime8->hide();
87 lblCTime9->hide(); 87 lblCTime9->hide();
88 cmdCity7->hide(); 88 cmdCity7->hide();
89 cmdCity8->hide(); 89 cmdCity8->hide();
90 cmdCity9->hide(); 90 cmdCity9->hide();
91 } else { 91 } else {
92 listCities.append( cmdCity7 ); 92 listCities.append( cmdCity7 );
93 listCities.append( cmdCity8 ); 93 listCities.append( cmdCity8 );
94 listCities.append( cmdCity9 ); 94 listCities.append( cmdCity9 );
95 listTimes.append( lblCTime7 ); 95 listTimes.append( lblCTime7 );
96 listTimes.append( lblCTime8 ); 96 listTimes.append( lblCTime8 );
97 listTimes.append( lblCTime9 ); 97 listTimes.append( lblCTime9 );
98 lblCTime4->hide(); 98 lblCTime4->hide();
99 lblCTime5->hide(); 99 lblCTime5->hide();
100 lblCTime6->hide(); 100 lblCTime6->hide();
101 cmdCity4->hide(); 101 cmdCity4->hide();
102 cmdCity5->hide(); 102 cmdCity5->hide();
103 cmdCity6->hide(); 103 cmdCity6->hide();
104 } 104 }
105 105
106 selWidget = frmMap->selectionWidget( this ); 106 selWidget = frmMap->selectionWidget( this );
107 selWidget->hide(); 107 selWidget->hide();
108 CityTimeBaseLayout->addWidget( selWidget ); 108 CityTimeBaseLayout->addWidget( selWidget );
109 bAdded = true; 109 bAdded = true;
110 readInTimes(); 110 readInTimes();
111 changed = FALSE; 111 changed = FALSE;
112 QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), 112 QObject::connect( qApp, SIGNAL( clockChanged(bool) ),
113 this, SLOT( changeClock( bool ) ) ); 113 this, SLOT( changeClock(bool) ) );
114 // now start the timer so we can update the time quickly every second 114 // now start the timer so we can update the time quickly every second
115 timerEvent( 0 ); 115 timerEvent( 0 );
116} 116}
117 117
118CityTime::~CityTime() 118CityTime::~CityTime()
119{ 119{
120 if ( changed ) { 120 if ( changed ) {
121 Config cfg("CityTime"); 121 Config cfg("CityTime");
122 cfg.setGroup("TimeZones"); 122 cfg.setGroup("TimeZones");
123 QListIterator<QToolButton> itCity( listCities ); 123 QListIterator<QToolButton> itCity( listCities );
124 int i; 124 int i;
125 bool realTzWritten = FALSE; 125 bool realTzWritten = FALSE;
126 for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) { 126 for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) {
127 if ( !strCityTz[i].isNull() ) { 127 if ( !strCityTz[i].isNull() ) {
128 cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]); 128 cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]);
129 cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text()); 129 cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text());
130 if ( strCityTz[i] == strRealTz ) 130 if ( strCityTz[i] == strRealTz )
131 realTzWritten = TRUE; 131 realTzWritten = TRUE;
132 } 132 }
133 } 133 }
134 if ( realTzWritten ) { 134 if ( realTzWritten ) {
135 cfg.removeEntry("Zone"+QString::number(CITIES)); 135 cfg.removeEntry("Zone"+QString::number(CITIES));
136 cfg.removeEntry("ZoneName"+QString::number(CITIES)); 136 cfg.removeEntry("ZoneName"+QString::number(CITIES));
137 } else { 137 } else {
138 cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz); 138 cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz);
139 if ( nameRealTz.isEmpty() ) { 139 if ( nameRealTz.isEmpty() ) {
140 int i = strRealTz.find( '/' ); 140 int i = strRealTz.find( '/' );
141 nameRealTz = strRealTz.mid( i+1 ); 141 nameRealTz = strRealTz.mid( i+1 );
142 } 142 }
143 cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz); 143 cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz);
144 } 144 }
145 QCopEnvelope ( "QPE/System", "timeZoneListChange()" ); 145 QCopEnvelope ( "QPE/System", "timeZoneListChange()" );
146 146
147 changed = FALSE; 147 changed = FALSE;
148 } 148 }
149 // restore the timezone, just in case we messed with it and 149 // restore the timezone, just in case we messed with it and
150 // are destroyed at an inoppurtune moment 150 // are destroyed at an inoppurtune moment
151 if ( !strRealTz.isNull() ) { 151 if ( !strRealTz.isNull() ) {
152 // this should be checked, but there is not much that can done at this 152 // this should be checked, but there is not much that can done at this
153 //point if it fails 153 //point if it fails
154 setenv( "TZ", strRealTz, true ); 154 setenv( "TZ", strRealTz, true );
155 } 155 }
156} 156}
157 157
158void CityTime::timerEvent( QTimerEvent *e ) 158void CityTime::timerEvent( QTimerEvent *e )
159{ 159{
160 if ( e ) 160 if ( e )
161 killTimer( timerId ); 161 killTimer( timerId );
162 // change the time again!! 162 // change the time again!!
163 showTime(); 163 showTime();
164 int ms = 1000 - QTime::currentTime().msec(); 164 int ms = 1000 - QTime::currentTime().msec();
165 timerId = startTimer( ms ); 165 timerId = startTimer( ms );
166} 166}
167 167
168void CityTime::mousePressEvent( QMouseEvent * ) 168void CityTime::mousePressEvent( QMouseEvent * )
169{ 169{
170 // DEBUG enable this to get a look at the zone information DEBUG 170 // DEBUG enable this to get a look at the zone information DEBUG
171// frmMap->showZones(); 171// frmMap->showZones();
172} 172}
173 173
174void CityTime::showTime( void ) 174void CityTime::showTime( void )
175{ 175{
176 int i; 176 int i;
177 QListIterator<QLabel> itTime(listTimes); 177 QListIterator<QLabel> itTime(listTimes);
178 178
179 // traverse the list... 179 // traverse the list...
180 for ( i = 0, itTime.toFirst(); i < CITIES; i++, ++itTime) { 180 for ( i = 0, itTime.toFirst(); i < CITIES; i++, ++itTime) {
181 if ( !strCityTz[i].isNull() ) { 181 if ( !strCityTz[i].isNull() ) {
182 if ( setenv( "TZ", strCityTz[i], true ) == 0 ) { 182 if ( setenv( "TZ", strCityTz[i], true ) == 0 ) {
183 itTime.current()->setText( TimeString::shortTime( bWhichClock ) ); 183 itTime.current()->setText( TimeString::shortTime( bWhichClock ) );
184 } else { 184 } else {
185 QMessageBox::critical( this, tr( "Time Changing" ), 185 QMessageBox::critical( this, tr( "Time Changing" ),
186 tr( "There was a problem setting timezone %1" ) 186 tr( "There was a problem setting timezone %1" )
187 .arg( QString::number( i + 1 ) ) ); 187 .arg( QString::number( i + 1 ) ) );
188 } 188 }
189 } 189 }
190 } 190 }
191 // done playing around... put it all back 191 // done playing around... put it all back
192 unsetenv( "TZ" ); 192 unsetenv( "TZ" );
193 if ( !strRealTz.isNull() ) { 193 if ( !strRealTz.isNull() ) {
194 if ( setenv( "TZ", strRealTz, true ) != 0 ) { 194 if ( setenv( "TZ", strRealTz, true ) != 0 ) {
195 QMessageBox::critical( this, tr( "Restore Time Zone" ), 195 QMessageBox::critical( this, tr( "Restore Time Zone" ),
196 tr( "There was a problem setting your timezone." 196 tr( "There was a problem setting your timezone."
197 "Your time may be wrong now..." ) ); 197 "Your time may be wrong now..." ) );
198 } 198 }
199 } 199 }
200} 200}
201 201
202void CityTime::beginNewTz() 202void CityTime::beginNewTz()
203{ 203{
204 buttonWidget->hide(); 204 buttonWidget->hide();
205 frmMap->setFocus(); 205 frmMap->setFocus();
206 selWidget->show(); 206 selWidget->show();
207 // CityTimeBaseLayout->addWidget( selWidget ); 207 // CityTimeBaseLayout->addWidget( selWidget );
208} 208}
209 209
210void CityTime::slotNewTz( const QString & strNewCountry, 210void CityTime::slotNewTz( const QString & strNewCountry,
211 const QString & strNewCity ) 211 const QString & strNewCity )
212{ 212{
213 // determine what to do based on what putton is pressed... 213 // determine what to do based on what putton is pressed...
214 QListIterator<QToolButton> itCity(listCities); 214 QListIterator<QToolButton> itCity(listCities);
215 int i; 215 int i;
216 // go through the list and make adjustments based on which button is on 216 // go through the list and make adjustments based on which button is on
217 for ( i = 0, itCity.toFirst(); itCity.current(), i < CITIES; i++, ++itCity ) { 217 for ( i = 0, itCity.toFirst(); itCity.current(), i < CITIES; i++, ++itCity ) {
218 QToolButton *cmdTmp = itCity.current(); 218 QToolButton *cmdTmp = itCity.current();
219 if ( cmdTmp->isOn() ) { 219 if ( cmdTmp->isOn() ) {
220 strCityTz[i] = strNewCountry + strNewCity; 220 strCityTz[i] = strNewCountry + strNewCity;
221 QString s = strNewCity; 221 QString s = strNewCity;
222 cmdTmp->setText( s.replace( QRegExp("_"), " " ) ); 222 cmdTmp->setText( s.replace( QRegExp("_"), " " ) );
223 cmdTmp->toggle(); 223 cmdTmp->toggle();
224 // we can actually break, since there is only one button 224 // we can actually break, since there is only one button
225 // that is ever pressed! 225 // that is ever pressed!
226 changed = TRUE; 226 changed = TRUE;
227 break; 227 break;
228 } 228 }
229 } 229 }
230 showTime(); 230 showTime();
231 buttonWidget->show(); 231 buttonWidget->show();
232 selWidget->hide(); 232 selWidget->hide();
233} 233}
234 234
235void CityTime::readInTimes( void ) 235void CityTime::readInTimes( void )
236{ 236{
237 Config cfg("CityTime"); 237 Config cfg("CityTime");
238 cfg.setGroup("TimeZones"); 238 cfg.setGroup("TimeZones");
239 QListIterator<QToolButton> itCity( listCities ); 239 QListIterator<QToolButton> itCity( listCities );
240 int i=0; 240 int i=0;
241 nameRealTz = QString::null; 241 nameRealTz = QString::null;
242 QString zn; 242 QString zn;
243 for ( ; i < CITIES ; i++ ) { 243 for ( ; i < CITIES ; i++ ) {
244 zn = cfg.readEntry("Zone"+QString::number(i), QString::null); 244 zn = cfg.readEntry("Zone"+QString::number(i), QString::null);
245 if ( zn.isNull() ) 245 if ( zn.isNull() )
246 break; 246 break;
247 QString nm = cfg.readEntry("ZoneName"+QString::number(i)); 247 QString nm = cfg.readEntry("ZoneName"+QString::number(i));
248 strCityTz[i] = zn; 248 strCityTz[i] = zn;
249 itCity.current()->setText(nm); 249 itCity.current()->setText(nm);
250 if ( zn == strRealTz ) 250 if ( zn == strRealTz )
251 nameRealTz = nm; 251 nameRealTz = nm;
252 ++itCity; 252 ++itCity;
253 } 253 }
254 if ( i == 0 ) { 254 if ( i == 0 ) {
255 // write in our own in a shameless self promotion and some humor 255 // write in our own in a shameless self promotion and some humor
256 QStringList list = timezoneDefaults(); 256 QStringList list = timezoneDefaults();
257 int i; 257 int i;
258 QStringList::Iterator it = list.begin(); 258 QStringList::Iterator it = list.begin();
259 for ( i = 0, itCity.toFirst(); i < CITIES && itCity.current(); 259 for ( i = 0, itCity.toFirst(); i < CITIES && itCity.current();
260 i++, ++itCity ) { 260 i++, ++itCity ) {
261 strCityTz[i] = *it++; 261 strCityTz[i] = *it++;
262 itCity.current()->setText( *it++ ); 262 itCity.current()->setText( *it++ );
263 } 263 }
264 } 264 }
265 if ( nameRealTz.isEmpty() ) { 265 if ( nameRealTz.isEmpty() ) {
266 //remember the current time zone even if we don't have room 266 //remember the current time zone even if we don't have room
267 //to show it. 267 //to show it.
268 zn = cfg.readEntry("Zone"+QString::number(CITIES), QString::null); 268 zn = cfg.readEntry("Zone"+QString::number(CITIES), QString::null);
269 if ( zn == strRealTz ) 269 if ( zn == strRealTz )
270 nameRealTz = cfg.readEntry("ZoneName"+QString::number(CITIES)); 270 nameRealTz = cfg.readEntry("ZoneName"+QString::number(CITIES));
271 i++; 271 i++;
272 } 272 }
273} 273}
274 274
275void CityTime::changeClock( bool newClock ) 275void CityTime::changeClock( bool newClock )
276{ 276{
277 bWhichClock = newClock; 277 bWhichClock = newClock;
278 showTime(); 278 showTime();
279} 279}
diff --git a/core/settings/citytime/citytimebase.cpp b/core/settings/citytime/citytimebase.cpp
index a3483cc..323929b 100644
--- a/core/settings/citytime/citytimebase.cpp
+++ b/core/settings/citytime/citytimebase.cpp
@@ -1,411 +1,411 @@
1 1
2 2
3// changes by Maximilian Reiss <harlekin@handhelds.org> 3// changes by Maximilian Reiss <harlekin@handhelds.org>
4 4
5#include "citytimebase.h" 5#include "citytimebase.h"
6 6
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qtoolbutton.h> 8#include <qtoolbutton.h>
9#include "zonemap.h" 9#include "zonemap.h"
10#include <qlayout.h> 10#include <qlayout.h>
11#include <qwhatsthis.h> 11#include <qwhatsthis.h>
12 12
13 13
14/* 14/*
15 * Constructs a CityTimeBase which is a child of 'parent', with the 15 * Constructs a CityTimeBase which is a child of 'parent', with the
16 * name 'name' and widget flags set to 'f' 16 * name 'name' and widget flags set to 'f'
17 */ 17 */
18CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags ) 18CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags )
19 : QWidget( parent, name, WStyle_ContextHelp ) 19 : QWidget( parent, name, WStyle_ContextHelp )
20{ 20{
21 if ( !name ) 21 if ( !name )
22 setName( "CityTimeBase" ); 22 setName( "CityTimeBase" );
23 setCaption( tr( "City Time" ) ); 23 setCaption( tr( "City Time" ) );
24 CityTimeBaseLayout = new QVBoxLayout( this ); 24 CityTimeBaseLayout = new QVBoxLayout( this );
25 CityTimeBaseLayout->setSpacing( 3 ); 25 CityTimeBaseLayout->setSpacing( 3 );
26 CityTimeBaseLayout->setMargin( 0 ); 26 CityTimeBaseLayout->setMargin( 0 );
27 27
28 frmMap = new ZoneMap( this, "frmMap" ); 28 frmMap = new ZoneMap( this, "frmMap" );
29 frmMap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, frmMap->sizePolicy().hasHeightForWidth() ) ); 29 frmMap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, frmMap->sizePolicy().hasHeightForWidth() ) );
30 CityTimeBaseLayout->addWidget( frmMap ); 30 CityTimeBaseLayout->addWidget( frmMap );
31 31
32 buttonWidget = new QWidget( this ); 32 buttonWidget = new QWidget( this );
33 QWhatsThis::add( buttonWidget, tr( "Click on one of the set cities to replace it" ) ); 33 QWhatsThis::add( buttonWidget, tr( "Click on one of the set cities to replace it" ) );
34 Layout2 = new QGridLayout( buttonWidget ); 34 Layout2 = new QGridLayout( buttonWidget );
35 Layout2->setSpacing( 3 ); 35 Layout2->setSpacing( 3 );
36 Layout2->setMargin( 4 ); 36 Layout2->setMargin( 4 );
37 37
38 cmdCity7 = new QToolButton( buttonWidget, "cmdCity7" ); 38 cmdCity7 = new QToolButton( buttonWidget, "cmdCity7" );
39 cmdCity7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity7->sizePolicy().hasHeightForWidth() ) ); 39 cmdCity7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity7->sizePolicy().hasHeightForWidth() ) );
40 QFont cmdCity7_font( cmdCity7->font() ); 40 QFont cmdCity7_font( cmdCity7->font() );
41 cmdCity7_font.setBold( TRUE ); 41 cmdCity7_font.setBold( TRUE );
42 cmdCity7->setFont( cmdCity7_font ); 42 cmdCity7->setFont( cmdCity7_font );
43 cmdCity7->setFocusPolicy( QToolButton::TabFocus ); 43 cmdCity7->setFocusPolicy( QToolButton::TabFocus );
44 cmdCity7->setText( tr( "" ) ); 44 cmdCity7->setText( tr( "" ) );
45 cmdCity7->setToggleButton( TRUE ); 45 cmdCity7->setToggleButton( TRUE );
46 cmdCity7->setToggleButton( TRUE ); 46 cmdCity7->setToggleButton( TRUE );
47 47
48 Layout2->addWidget( cmdCity7, 0, 2 ); 48 Layout2->addWidget( cmdCity7, 0, 2 );
49 49
50 lblCTime9 = new QLabel( buttonWidget, "lblCTime9" ); 50 lblCTime9 = new QLabel( buttonWidget, "lblCTime9" );
51 lblCTime9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime9->sizePolicy().hasHeightForWidth() ) ); 51 lblCTime9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime9->sizePolicy().hasHeightForWidth() ) );
52 QFont lblCTime9_font( lblCTime9->font() ); 52 QFont lblCTime9_font( lblCTime9->font() );
53 lblCTime9_font.setPointSize( 10 ); 53 lblCTime9_font.setPointSize( 10 );
54 lblCTime9->setFont( lblCTime9_font ); 54 lblCTime9->setFont( lblCTime9_font );
55 lblCTime9->setText( tr( "" ) ); 55 lblCTime9->setText( tr( "" ) );
56 lblCTime9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 56 lblCTime9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
57 57
58 Layout2->addWidget( lblCTime9, 2, 3 ); 58 Layout2->addWidget( lblCTime9, 2, 3 );
59 59
60 cmdCity8 = new QToolButton( buttonWidget, "cmdCity8" ); 60 cmdCity8 = new QToolButton( buttonWidget, "cmdCity8" );
61 cmdCity8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity8->sizePolicy().hasHeightForWidth() ) ); 61 cmdCity8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity8->sizePolicy().hasHeightForWidth() ) );
62 QFont cmdCity8_font( cmdCity8->font() ); 62 QFont cmdCity8_font( cmdCity8->font() );
63 cmdCity8_font.setBold( TRUE ); 63 cmdCity8_font.setBold( TRUE );
64 cmdCity8->setFont( cmdCity8_font ); 64 cmdCity8->setFont( cmdCity8_font );
65 cmdCity8->setFocusPolicy( QToolButton::TabFocus ); 65 cmdCity8->setFocusPolicy( QToolButton::TabFocus );
66 cmdCity8->setText( tr( "" ) ); 66 cmdCity8->setText( tr( "" ) );
67 cmdCity8->setToggleButton( TRUE ); 67 cmdCity8->setToggleButton( TRUE );
68 cmdCity8->setToggleButton( TRUE ); 68 cmdCity8->setToggleButton( TRUE );
69 69
70 Layout2->addWidget( cmdCity8, 1, 2 ); 70 Layout2->addWidget( cmdCity8, 1, 2 );
71 71
72 cmdCity2 = new QToolButton( buttonWidget, "cmdCity2" ); 72 cmdCity2 = new QToolButton( buttonWidget, "cmdCity2" );
73 QFont cmdCity2_font( cmdCity2->font() ); 73 QFont cmdCity2_font( cmdCity2->font() );
74 cmdCity2_font.setBold( TRUE ); 74 cmdCity2_font.setBold( TRUE );
75 cmdCity2->setFont( cmdCity2_font ); 75 cmdCity2->setFont( cmdCity2_font );
76 cmdCity2->setFocusPolicy( QToolButton::TabFocus ); 76 cmdCity2->setFocusPolicy( QToolButton::TabFocus );
77 cmdCity2->setText( tr( "" ) ); 77 cmdCity2->setText( tr( "" ) );
78 cmdCity2->setToggleButton( TRUE ); 78 cmdCity2->setToggleButton( TRUE );
79 cmdCity2->setToggleButton( TRUE ); 79 cmdCity2->setToggleButton( TRUE );
80 80
81 Layout2->addWidget( cmdCity2, 1, 0 ); 81 Layout2->addWidget( cmdCity2, 1, 0 );
82 82
83 lblCTime6 = new QLabel( buttonWidget, "lblCTime6" ); 83 lblCTime6 = new QLabel( buttonWidget, "lblCTime6" );
84 QFont lblCTime6_font( lblCTime6->font() ); 84 QFont lblCTime6_font( lblCTime6->font() );
85 lblCTime6_font.setPointSize( 10 ); 85 lblCTime6_font.setPointSize( 10 );
86 lblCTime6->setFont( lblCTime6_font ); 86 lblCTime6->setFont( lblCTime6_font );
87 lblCTime6->setText( tr( "" ) ); 87 lblCTime6->setText( tr( "" ) );
88 lblCTime6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 88 lblCTime6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
89 89
90 Layout2->addWidget( lblCTime6, 5, 1 ); 90 Layout2->addWidget( lblCTime6, 5, 1 );
91 91
92 cmdCity6 = new QToolButton( buttonWidget, "cmdCity6" ); 92 cmdCity6 = new QToolButton( buttonWidget, "cmdCity6" );
93 cmdCity6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity6->sizePolicy().hasHeightForWidth() ) ); 93 cmdCity6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity6->sizePolicy().hasHeightForWidth() ) );
94 QFont cmdCity6_font( cmdCity6->font() ); 94 QFont cmdCity6_font( cmdCity6->font() );
95 cmdCity6_font.setBold( TRUE ); 95 cmdCity6_font.setBold( TRUE );
96 cmdCity6->setFont( cmdCity6_font ); 96 cmdCity6->setFont( cmdCity6_font );
97 cmdCity6->setFocusPolicy( QToolButton::TabFocus ); 97 cmdCity6->setFocusPolicy( QToolButton::TabFocus );
98 cmdCity6->setText( tr( "" ) ); 98 cmdCity6->setText( tr( "" ) );
99 cmdCity6->setToggleButton( TRUE ); 99 cmdCity6->setToggleButton( TRUE );
100 cmdCity6->setToggleButton( TRUE ); 100 cmdCity6->setToggleButton( TRUE );
101 101
102 Layout2->addWidget( cmdCity6, 5, 0 ); 102 Layout2->addWidget( cmdCity6, 5, 0 );
103 103
104 cmdCity4 = new QToolButton( buttonWidget, "cmdCity4" ); 104 cmdCity4 = new QToolButton( buttonWidget, "cmdCity4" );
105 cmdCity4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity4->sizePolicy().hasHeightForWidth() ) ); 105 cmdCity4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity4->sizePolicy().hasHeightForWidth() ) );
106 QFont cmdCity4_font( cmdCity4->font() ); 106 QFont cmdCity4_font( cmdCity4->font() );
107 cmdCity4_font.setBold( TRUE ); 107 cmdCity4_font.setBold( TRUE );
108 cmdCity4->setFont( cmdCity4_font ); 108 cmdCity4->setFont( cmdCity4_font );
109 cmdCity4->setFocusPolicy( QToolButton::TabFocus ); 109 cmdCity4->setFocusPolicy( QToolButton::TabFocus );
110 cmdCity4->setText( tr( "" ) ); 110 cmdCity4->setText( tr( "" ) );
111 cmdCity4->setToggleButton( TRUE ); 111 cmdCity4->setToggleButton( TRUE );
112 cmdCity4->setToggleButton( TRUE ); 112 cmdCity4->setToggleButton( TRUE );
113 113
114 Layout2->addWidget( cmdCity4, 3, 0 ); 114 Layout2->addWidget( cmdCity4, 3, 0 );
115 115
116 lblCTime5 = new QLabel( buttonWidget, "lblCTime5" ); 116 lblCTime5 = new QLabel( buttonWidget, "lblCTime5" );
117 QFont lblCTime5_font( lblCTime5->font() ); 117 QFont lblCTime5_font( lblCTime5->font() );
118 lblCTime5_font.setPointSize( 10 ); 118 lblCTime5_font.setPointSize( 10 );
119 lblCTime5->setFont( lblCTime5_font ); 119 lblCTime5->setFont( lblCTime5_font );
120 lblCTime5->setText( tr( "" ) ); 120 lblCTime5->setText( tr( "" ) );
121 lblCTime5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 121 lblCTime5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
122 122
123 Layout2->addWidget( lblCTime5, 4, 1 ); 123 Layout2->addWidget( lblCTime5, 4, 1 );
124 124
125 lblCTime2 = new QLabel( buttonWidget, "lblCTime2" ); 125 lblCTime2 = new QLabel( buttonWidget, "lblCTime2" );
126 lblCTime2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime2->sizePolicy().hasHeightForWidth() ) ); 126 lblCTime2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime2->sizePolicy().hasHeightForWidth() ) );
127 QFont lblCTime2_font( lblCTime2->font() ); 127 QFont lblCTime2_font( lblCTime2->font() );
128 lblCTime2_font.setPointSize( 10 ); 128 lblCTime2_font.setPointSize( 10 );
129 lblCTime2->setFont( lblCTime2_font ); 129 lblCTime2->setFont( lblCTime2_font );
130 lblCTime2->setText( tr( "" ) ); 130 lblCTime2->setText( tr( "" ) );
131 lblCTime2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 131 lblCTime2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
132 132
133 Layout2->addWidget( lblCTime2, 1, 1 ); 133 Layout2->addWidget( lblCTime2, 1, 1 );
134 134
135 lblCTime1 = new QLabel( buttonWidget, "lblCTime1" ); 135 lblCTime1 = new QLabel( buttonWidget, "lblCTime1" );
136 lblCTime1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime1->sizePolicy().hasHeightForWidth() ) ); 136 lblCTime1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, lblCTime1->sizePolicy().hasHeightForWidth() ) );
137 QFont lblCTime1_font( lblCTime1->font() ); 137 QFont lblCTime1_font( lblCTime1->font() );
138 lblCTime1_font.setPointSize( 10 ); 138 lblCTime1_font.setPointSize( 10 );
139 lblCTime1->setFont( lblCTime1_font ); 139 lblCTime1->setFont( lblCTime1_font );
140 lblCTime1->setText( tr( "" ) ); 140 lblCTime1->setText( tr( "" ) );
141 lblCTime1->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 141 lblCTime1->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
142 142
143 Layout2->addWidget( lblCTime1, 0, 1 ); 143 Layout2->addWidget( lblCTime1, 0, 1 );
144 144
145 cmdCity3 = new QToolButton( buttonWidget, "cmdCity3" ); 145 cmdCity3 = new QToolButton( buttonWidget, "cmdCity3" );
146 cmdCity3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity3->sizePolicy().hasHeightForWidth() ) ); 146 cmdCity3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity3->sizePolicy().hasHeightForWidth() ) );
147 QFont cmdCity3_font( cmdCity3->font() ); 147 QFont cmdCity3_font( cmdCity3->font() );
148 cmdCity3_font.setBold( TRUE ); 148 cmdCity3_font.setBold( TRUE );
149 cmdCity3->setFont( cmdCity3_font ); 149 cmdCity3->setFont( cmdCity3_font );
150 cmdCity3->setFocusPolicy( QToolButton::TabFocus ); 150 cmdCity3->setFocusPolicy( QToolButton::TabFocus );
151 cmdCity3->setText( tr( "" ) ); 151 cmdCity3->setText( tr( "" ) );
152 cmdCity3->setToggleButton( TRUE ); 152 cmdCity3->setToggleButton( TRUE );
153 cmdCity3->setToggleButton( TRUE ); 153 cmdCity3->setToggleButton( TRUE );
154 154
155 Layout2->addWidget( cmdCity3, 2, 0 ); 155 Layout2->addWidget( cmdCity3, 2, 0 );
156 156
157 lblCTime8 = new QLabel( buttonWidget, "lblCTime8" ); 157 lblCTime8 = new QLabel( buttonWidget, "lblCTime8" );
158 lblCTime8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime8->sizePolicy().hasHeightForWidth() ) ); 158 lblCTime8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime8->sizePolicy().hasHeightForWidth() ) );
159 QFont lblCTime8_font( lblCTime8->font() ); 159 QFont lblCTime8_font( lblCTime8->font() );
160 lblCTime8_font.setPointSize( 10 ); 160 lblCTime8_font.setPointSize( 10 );
161 lblCTime8->setFont( lblCTime8_font ); 161 lblCTime8->setFont( lblCTime8_font );
162 lblCTime8->setText( tr( "" ) ); 162 lblCTime8->setText( tr( "" ) );
163 lblCTime8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 163 lblCTime8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
164 164
165 Layout2->addWidget( lblCTime8, 1, 3 ); 165 Layout2->addWidget( lblCTime8, 1, 3 );
166 166
167 cmdCity1 = new QToolButton( buttonWidget, "cmdCity1" ); 167 cmdCity1 = new QToolButton( buttonWidget, "cmdCity1" );
168 cmdCity1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity1->sizePolicy().hasHeightForWidth() ) ); 168 cmdCity1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity1->sizePolicy().hasHeightForWidth() ) );
169 QFont cmdCity1_font( cmdCity1->font() ); 169 QFont cmdCity1_font( cmdCity1->font() );
170 cmdCity1_font.setBold( TRUE ); 170 cmdCity1_font.setBold( TRUE );
171 cmdCity1->setFont( cmdCity1_font ); 171 cmdCity1->setFont( cmdCity1_font );
172 cmdCity1->setFocusPolicy( QToolButton::TabFocus ); 172 cmdCity1->setFocusPolicy( QToolButton::TabFocus );
173 cmdCity1->setText( tr( "" ) ); 173 cmdCity1->setText( tr( "" ) );
174 cmdCity1->setToggleButton( TRUE ); 174 cmdCity1->setToggleButton( TRUE );
175 cmdCity1->setToggleButton( TRUE ); 175 cmdCity1->setToggleButton( TRUE );
176 176
177 Layout2->addWidget( cmdCity1, 0, 0 ); 177 Layout2->addWidget( cmdCity1, 0, 0 );
178 178
179 lblCTime7 = new QLabel( buttonWidget, "lblCTime7" ); 179 lblCTime7 = new QLabel( buttonWidget, "lblCTime7" );
180 lblCTime7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime7->sizePolicy().hasHeightForWidth() ) ); 180 lblCTime7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime7->sizePolicy().hasHeightForWidth() ) );
181 QFont lblCTime7_font( lblCTime7->font() ); 181 QFont lblCTime7_font( lblCTime7->font() );
182 lblCTime7_font.setPointSize( 10 ); 182 lblCTime7_font.setPointSize( 10 );
183 lblCTime7->setFont( lblCTime7_font ); 183 lblCTime7->setFont( lblCTime7_font );
184 lblCTime7->setText( tr( "" ) ); 184 lblCTime7->setText( tr( "" ) );
185 lblCTime7->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 185 lblCTime7->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
186 186
187 Layout2->addWidget( lblCTime7, 0, 3 ); 187 Layout2->addWidget( lblCTime7, 0, 3 );
188 188
189 lblCTime4 = new QLabel( buttonWidget, "lblCTime4" ); 189 lblCTime4 = new QLabel( buttonWidget, "lblCTime4" );
190 QFont lblCTime4_font( lblCTime4->font() ); 190 QFont lblCTime4_font( lblCTime4->font() );
191 lblCTime4_font.setPointSize( 10 ); 191 lblCTime4_font.setPointSize( 10 );
192 lblCTime4->setFont( lblCTime4_font ); 192 lblCTime4->setFont( lblCTime4_font );
193 lblCTime4->setText( tr( "" ) ); 193 lblCTime4->setText( tr( "" ) );
194 lblCTime4->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 194 lblCTime4->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
195 195
196 Layout2->addWidget( lblCTime4, 3, 1 ); 196 Layout2->addWidget( lblCTime4, 3, 1 );
197 197
198 cmdCity5 = new QToolButton( buttonWidget, "cmdCity5" ); 198 cmdCity5 = new QToolButton( buttonWidget, "cmdCity5" );
199 cmdCity5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity5->sizePolicy().hasHeightForWidth() ) ); 199 cmdCity5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity5->sizePolicy().hasHeightForWidth() ) );
200 QFont cmdCity5_font( cmdCity5->font() ); 200 QFont cmdCity5_font( cmdCity5->font() );
201 cmdCity5_font.setBold( TRUE ); 201 cmdCity5_font.setBold( TRUE );
202 cmdCity5->setFont( cmdCity5_font ); 202 cmdCity5->setFont( cmdCity5_font );
203 cmdCity5->setFocusPolicy( QToolButton::TabFocus ); 203 cmdCity5->setFocusPolicy( QToolButton::TabFocus );
204 cmdCity5->setText( tr( "" ) ); 204 cmdCity5->setText( tr( "" ) );
205 cmdCity5->setToggleButton( TRUE ); 205 cmdCity5->setToggleButton( TRUE );
206 cmdCity5->setToggleButton( TRUE ); 206 cmdCity5->setToggleButton( TRUE );
207 207
208 Layout2->addWidget( cmdCity5, 4, 0 ); 208 Layout2->addWidget( cmdCity5, 4, 0 );
209 209
210 lblCTime3 = new QLabel( buttonWidget, "lblCTime3" ); 210 lblCTime3 = new QLabel( buttonWidget, "lblCTime3" );
211 QFont lblCTime3_font( lblCTime3->font() ); 211 QFont lblCTime3_font( lblCTime3->font() );
212 lblCTime3_font.setPointSize( 10 ); 212 lblCTime3_font.setPointSize( 10 );
213 lblCTime3->setFont( lblCTime3_font ); 213 lblCTime3->setFont( lblCTime3_font );
214 lblCTime3->setText( tr( "" ) ); 214 lblCTime3->setText( tr( "" ) );
215 lblCTime3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); 215 lblCTime3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
216 216
217 Layout2->addWidget( lblCTime3, 2, 1 ); 217 Layout2->addWidget( lblCTime3, 2, 1 );
218 218
219 cmdCity9 = new QToolButton( buttonWidget, "cmdCity9" ); 219 cmdCity9 = new QToolButton( buttonWidget, "cmdCity9" );
220 cmdCity9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity9->sizePolicy().hasHeightForWidth() ) ); 220 cmdCity9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity9->sizePolicy().hasHeightForWidth() ) );
221 QFont cmdCity9_font( cmdCity9->font() ); 221 QFont cmdCity9_font( cmdCity9->font() );
222 cmdCity9_font.setBold( TRUE ); 222 cmdCity9_font.setBold( TRUE );
223 cmdCity9->setFont( cmdCity9_font ); 223 cmdCity9->setFont( cmdCity9_font );
224 cmdCity9->setFocusPolicy( QToolButton::TabFocus ); 224 cmdCity9->setFocusPolicy( QToolButton::TabFocus );
225 cmdCity9->setText( tr( "" ) ); 225 cmdCity9->setText( tr( "" ) );
226 cmdCity9->setToggleButton( TRUE ); 226 cmdCity9->setToggleButton( TRUE );
227 cmdCity9->setToggleButton( TRUE ); 227 cmdCity9->setToggleButton( TRUE );
228 228
229 Layout2->addWidget( cmdCity9, 2, 2 ); 229 Layout2->addWidget( cmdCity9, 2, 2 );
230 CityTimeBaseLayout->addWidget( buttonWidget ); 230 CityTimeBaseLayout->addWidget( buttonWidget );
231 231
232 // signals and slots connections 232 // signals and slots connections
233 connect( frmMap, SIGNAL( signalTz(const QString &, const QString &) ), this, SLOT( slotNewTz(const QString &, const QString &) ) ); 233 connect( frmMap, SIGNAL( signalTz(const QString&,const QString&) ), this, SLOT( slotNewTz(const QString&,const QString&) ) );
234 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 234 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
235 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 235 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
236 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 236 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
237 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 237 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
238 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 238 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
239 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 239 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
240 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 240 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
241 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 241 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
242 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 242 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
243 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 243 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
244 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 244 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
245 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 245 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
246 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 246 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
247 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 247 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
248 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 248 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
249 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 249 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
250 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 250 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
251 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 251 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
252 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 252 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
253 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 253 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
254 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 254 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
255 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 255 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
256 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 256 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
257 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 257 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
258 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 258 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
259 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 259 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
260 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 260 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
261 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 261 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
262 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 262 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
263 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 263 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
264 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 264 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
265 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 265 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
266 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 266 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
267 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 267 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
268 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 268 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
269 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 269 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
270 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 270 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
271 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 271 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
272 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 272 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
273 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 273 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
274 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 274 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
275 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 275 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
276 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 276 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
277 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 277 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
278 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 278 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
279 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 279 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
280 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 280 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
281 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 281 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
282 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 282 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
283 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 283 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
284 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 284 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
285 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 285 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
286 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 286 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
287 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 287 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
288 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 288 connect( cmdCity6, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
289 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 289 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
290 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 290 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
291 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) ); 291 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity1, SLOT( setDisabled(bool) ) );
292 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) ); 292 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity3, SLOT( setDisabled(bool) ) );
293 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) ); 293 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity4, SLOT( setDisabled(bool) ) );
294 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) ); 294 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity5, SLOT( setDisabled(bool) ) );
295 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) ); 295 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity6, SLOT( setDisabled(bool) ) );
296 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) ); 296 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity7, SLOT( setDisabled(bool) ) );
297 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) ); 297 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity8, SLOT( setDisabled(bool) ) );
298 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 298 connect( cmdCity1, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
299 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 299 connect( cmdCity2, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
300 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 300 connect( cmdCity3, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
301 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 301 connect( cmdCity4, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
302 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 302 connect( cmdCity5, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
303 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 303 connect( cmdCity7, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
304 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) ); 304 connect( cmdCity8, SIGNAL( toggled(bool) ), cmdCity9, SLOT( setDisabled(bool) ) );
305 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) ); 305 connect( cmdCity9, SIGNAL( toggled(bool) ), cmdCity2, SLOT( setDisabled(bool) ) );
306 connect( cmdCity1, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 306 connect( cmdCity1, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
307 connect( cmdCity2, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 307 connect( cmdCity2, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
308 connect( cmdCity7, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 308 connect( cmdCity7, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
309 connect( cmdCity3, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 309 connect( cmdCity3, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
310 connect( cmdCity4, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 310 connect( cmdCity4, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
311 connect( cmdCity5, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 311 connect( cmdCity5, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
312 connect( cmdCity6, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 312 connect( cmdCity6, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
313 connect( cmdCity8, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 313 connect( cmdCity8, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
314 connect( cmdCity9, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) ); 314 connect( cmdCity9, SIGNAL( toggled(bool) ), this, SLOT( beginNewTz() ) );
315 315
316 // tab order 316 // tab order
317 setTabOrder( cmdCity1, cmdCity2 ); 317 setTabOrder( cmdCity1, cmdCity2 );
318 setTabOrder( cmdCity2, cmdCity3 ); 318 setTabOrder( cmdCity2, cmdCity3 );
319 setTabOrder( cmdCity3, cmdCity4 ); 319 setTabOrder( cmdCity3, cmdCity4 );
320 setTabOrder( cmdCity4, cmdCity5 ); 320 setTabOrder( cmdCity4, cmdCity5 );
321 setTabOrder( cmdCity5, cmdCity6 ); 321 setTabOrder( cmdCity5, cmdCity6 );
322 setTabOrder( cmdCity6, cmdCity7 ); 322 setTabOrder( cmdCity6, cmdCity7 );
323 setTabOrder( cmdCity7, cmdCity8 ); 323 setTabOrder( cmdCity7, cmdCity8 );
324 setTabOrder( cmdCity8, cmdCity9 ); 324 setTabOrder( cmdCity8, cmdCity9 );
325 setTabOrder( cmdCity9, frmMap ); 325 setTabOrder( cmdCity9, frmMap );
326} 326}
327 327
328/* 328/*
329 * Destroys the object and frees any allocated resources 329 * Destroys the object and frees any allocated resources
330 */ 330 */
331CityTimeBase::~CityTimeBase() 331CityTimeBase::~CityTimeBase()
332{ 332{
333 // no need to delete child widgets, Qt does it all for us 333 // no need to delete child widgets, Qt does it all for us
334} 334}
335 335
336/* 336/*
337 * Main event handler. Reimplemented to handle application 337 * Main event handler. Reimplemented to handle application
338 * font changes 338 * font changes
339 */ 339 */
340bool CityTimeBase::event( QEvent* ev ) 340bool CityTimeBase::event( QEvent* ev )
341{ 341{
342 bool ret = QWidget::event( ev ); 342 bool ret = QWidget::event( ev );
343 if ( ev->type() == QEvent::ApplicationFontChange ) { 343 if ( ev->type() == QEvent::ApplicationFontChange ) {
344 QFont cmdCity7_font( cmdCity7->font() ); 344 QFont cmdCity7_font( cmdCity7->font() );
345 cmdCity7_font.setBold( TRUE ); 345 cmdCity7_font.setBold( TRUE );
346 cmdCity7->setFont( cmdCity7_font ); 346 cmdCity7->setFont( cmdCity7_font );
347 QFont lblCTime9_font( lblCTime9->font() ); 347 QFont lblCTime9_font( lblCTime9->font() );
348 lblCTime9_font.setPointSize( 10 ); 348 lblCTime9_font.setPointSize( 10 );
349 lblCTime9->setFont( lblCTime9_font ); 349 lblCTime9->setFont( lblCTime9_font );
350 QFont cmdCity8_font( cmdCity8->font() ); 350 QFont cmdCity8_font( cmdCity8->font() );
351 cmdCity8_font.setBold( TRUE ); 351 cmdCity8_font.setBold( TRUE );
352 cmdCity8->setFont( cmdCity8_font ); 352 cmdCity8->setFont( cmdCity8_font );
353 QFont cmdCity2_font( cmdCity2->font() ); 353 QFont cmdCity2_font( cmdCity2->font() );
354 cmdCity2_font.setBold( TRUE ); 354 cmdCity2_font.setBold( TRUE );
355 cmdCity2->setFont( cmdCity2_font ); 355 cmdCity2->setFont( cmdCity2_font );
356 QFont lblCTime6_font( lblCTime6->font() ); 356 QFont lblCTime6_font( lblCTime6->font() );
357 lblCTime6_font.setPointSize( 10 ); 357 lblCTime6_font.setPointSize( 10 );
358 lblCTime6->setFont( lblCTime6_font ); 358 lblCTime6->setFont( lblCTime6_font );
359 QFont cmdCity6_font( cmdCity6->font() ); 359 QFont cmdCity6_font( cmdCity6->font() );
360 cmdCity6_font.setBold( TRUE ); 360 cmdCity6_font.setBold( TRUE );
361 cmdCity6->setFont( cmdCity6_font ); 361 cmdCity6->setFont( cmdCity6_font );
362 QFont cmdCity4_font( cmdCity4->font() ); 362 QFont cmdCity4_font( cmdCity4->font() );
363 cmdCity4_font.setBold( TRUE ); 363 cmdCity4_font.setBold( TRUE );
364 cmdCity4->setFont( cmdCity4_font ); 364 cmdCity4->setFont( cmdCity4_font );
365 QFont lblCTime5_font( lblCTime5->font() ); 365 QFont lblCTime5_font( lblCTime5->font() );
366 lblCTime5_font.setPointSize( 10 ); 366 lblCTime5_font.setPointSize( 10 );
367 lblCTime5->setFont( lblCTime5_font ); 367 lblCTime5->setFont( lblCTime5_font );
368 QFont lblCTime2_font( lblCTime2->font() ); 368 QFont lblCTime2_font( lblCTime2->font() );
369 lblCTime2_font.setPointSize( 10 ); 369 lblCTime2_font.setPointSize( 10 );
370 lblCTime2->setFont( lblCTime2_font ); 370 lblCTime2->setFont( lblCTime2_font );
371 QFont lblCTime1_font( lblCTime1->font() ); 371 QFont lblCTime1_font( lblCTime1->font() );
372 lblCTime1_font.setPointSize( 10 ); 372 lblCTime1_font.setPointSize( 10 );
373 lblCTime1->setFont( lblCTime1_font ); 373 lblCTime1->setFont( lblCTime1_font );
374 QFont cmdCity3_font( cmdCity3->font() ); 374 QFont cmdCity3_font( cmdCity3->font() );
375 cmdCity3_font.setBold( TRUE ); 375 cmdCity3_font.setBold( TRUE );
376 cmdCity3->setFont( cmdCity3_font ); 376 cmdCity3->setFont( cmdCity3_font );
377 QFont lblCTime8_font( lblCTime8->font() ); 377 QFont lblCTime8_font( lblCTime8->font() );
378 lblCTime8_font.setPointSize( 10 ); 378 lblCTime8_font.setPointSize( 10 );
379 lblCTime8->setFont( lblCTime8_font ); 379 lblCTime8->setFont( lblCTime8_font );
380 QFont cmdCity1_font( cmdCity1->font() ); 380 QFont cmdCity1_font( cmdCity1->font() );
381 cmdCity1_font.setBold( TRUE ); 381 cmdCity1_font.setBold( TRUE );
382 cmdCity1->setFont( cmdCity1_font ); 382 cmdCity1->setFont( cmdCity1_font );
383 QFont lblCTime7_font( lblCTime7->font() ); 383 QFont lblCTime7_font( lblCTime7->font() );
384 lblCTime7_font.setPointSize( 10 ); 384 lblCTime7_font.setPointSize( 10 );
385 lblCTime7->setFont( lblCTime7_font ); 385 lblCTime7->setFont( lblCTime7_font );
386 QFont lblCTime4_font( lblCTime4->font() ); 386 QFont lblCTime4_font( lblCTime4->font() );
387 lblCTime4_font.setPointSize( 10 ); 387 lblCTime4_font.setPointSize( 10 );
388 lblCTime4->setFont( lblCTime4_font ); 388 lblCTime4->setFont( lblCTime4_font );
389 QFont cmdCity5_font( cmdCity5->font() ); 389 QFont cmdCity5_font( cmdCity5->font() );
390 cmdCity5_font.setBold( TRUE ); 390 cmdCity5_font.setBold( TRUE );
391 cmdCity5->setFont( cmdCity5_font ); 391 cmdCity5->setFont( cmdCity5_font );
392 QFont lblCTime3_font( lblCTime3->font() ); 392 QFont lblCTime3_font( lblCTime3->font() );
393 lblCTime3_font.setPointSize( 10 ); 393 lblCTime3_font.setPointSize( 10 );
394 lblCTime3->setFont( lblCTime3_font ); 394 lblCTime3->setFont( lblCTime3_font );
395 QFont cmdCity9_font( cmdCity9->font() ); 395 QFont cmdCity9_font( cmdCity9->font() );
396 cmdCity9_font.setBold( TRUE ); 396 cmdCity9_font.setBold( TRUE );
397 cmdCity9->setFont( cmdCity9_font ); 397 cmdCity9->setFont( cmdCity9_font );
398 } 398 }
399 return ret; 399 return ret;
400} 400}
401 401
402void CityTimeBase::beginNewTz() 402void CityTimeBase::beginNewTz()
403{ 403{
404 qWarning( "CityTimeBase::beginNewTz(): Not implemented yet!" ); 404 qWarning( "CityTimeBase::beginNewTz(): Not implemented yet!" );
405} 405}
406 406
407void CityTimeBase::slotNewTz(const QString &, const QString &) 407void CityTimeBase::slotNewTz(const QString &, const QString &)
408{ 408{
409 qWarning( "CityTimeBase::slotNewTz(const QString &, const QString &): Not implemented yet!" ); 409 qWarning( "CityTimeBase::slotNewTz(const QString &, const QString &): Not implemented yet!" );
410} 410}
411 411
diff --git a/core/settings/citytime/zonemap.cpp b/core/settings/citytime/zonemap.cpp
index b83da59..b6843d2 100644
--- a/core/settings/citytime/zonemap.cpp
+++ b/core/settings/citytime/zonemap.cpp
@@ -1,724 +1,724 @@
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// changes by Maximilian Reiss <harlekin@handhelds.org> 21// changes by Maximilian Reiss <harlekin@handhelds.org>
22 22
23#include "sun.h" 23#include "sun.h"
24#include "zonemap.h" 24#include "zonemap.h"
25 25
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28 28
29#include <qfile.h> 29#include <qfile.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qtoolbutton.h> 34#include <qtoolbutton.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qhbox.h> 36#include <qhbox.h>
37#include <qlistview.h> 37#include <qlistview.h>
38#include <qwhatsthis.h> 38#include <qwhatsthis.h>
39 39
40#include <limits.h> 40#include <limits.h>
41 41
42// the map file... 42// the map file...
43static const char strZONEINFO[] = "/usr/share/zoneinfo/zone.tab"; 43static const char strZONEINFO[] = "/usr/share/zoneinfo/zone.tab";
44static const char strMAP[] = "citytime/simple_grid_400"; 44static const char strMAP[] = "citytime/simple_grid_400";
45 45
46// the maximum distance we'll allow the pointer to be away from a city 46// the maximum distance we'll allow the pointer to be away from a city
47// and still show the city's time 47// and still show the city's time
48static const int iTHRESHOLD = 50000; 48static const int iTHRESHOLD = 50000;
49 49
50// The label offset (how far away from pointer) 50// The label offset (how far away from pointer)
51static const int iLABELOFFSET = 8; 51static const int iLABELOFFSET = 8;
52 52
53// the size of the dot to draw, and where to start it 53// the size of the dot to draw, and where to start it
54static const int iCITYSIZE = 3; 54static const int iCITYSIZE = 3;
55const int iCITYOFFSET = 2; 55const int iCITYOFFSET = 2;
56 56
57// the darkening function 57// the darkening function
58static inline void darken( QImage *pImage, int start, int stop, int row ); 58static inline void darken( QImage *pImage, int start, int stop, int row );
59static void dayNight( QImage *pImage ); 59static void dayNight( QImage *pImage );
60 60
61ZoneField::ZoneField( const QString& strLine ) 61ZoneField::ZoneField( const QString& strLine )
62{ 62{
63 // make a bunch of RegExp's to match the data from the line 63 // make a bunch of RegExp's to match the data from the line
64 QRegExp regCoord( "[-+][0-9]+" );// the latitude 64 QRegExp regCoord( "[-+][0-9]+" );// the latitude
65 QRegExp regCountry( "[A-Za-z]+/" ); // the country (not good enough) 65 QRegExp regCountry( "[A-Za-z]+/" ); // the country (not good enough)
66 QRegExp regCity( "[A-Za-z_-]*" ); // the city 66 QRegExp regCity( "[A-Za-z_-]*" ); // the city
67 67
68 int iStart, 68 int iStart,
69 iStop, 69 iStop,
70 iLen, 70 iLen,
71 tmp; 71 tmp;
72 QString strTmp; 72 QString strTmp;
73 // we should be able to assume that the country code is always the first 73 // we should be able to assume that the country code is always the first
74 // two chars, so just grap them and let it go... 74 // two chars, so just grap them and let it go...
75 strCountryCode = strLine.left( 2 ); 75 strCountryCode = strLine.left( 2 );
76 iStart = regCoord.match( strLine, 0, &iLen ); 76 iStart = regCoord.match( strLine, 0, &iLen );
77 if ( iStart >= 0 ) { 77 if ( iStart >= 0 ) {
78 strTmp = strLine.mid( iStart, iLen ); 78 strTmp = strLine.mid( iStart, iLen );
79 tmp = strTmp.toInt(); 79 tmp = strTmp.toInt();
80 // okay, there are two versions of the format, make a decision based on 80 // okay, there are two versions of the format, make a decision based on
81 // the size... 81 // the size...
82 // Oh BTW, we are storing everything in seconds! 82 // Oh BTW, we are storing everything in seconds!
83 if ( iLen < 7 ) { 83 if ( iLen < 7 ) {
84 _y = tmp / 100; 84 _y = tmp / 100;
85 _y *= 60; 85 _y *= 60;
86 _y += tmp % 100; 86 _y += tmp % 100;
87 _y *= 60; 87 _y *= 60;
88 } else { 88 } else {
89 _y = tmp / 10000; 89 _y = tmp / 10000;
90 _y *= 60; 90 _y *= 60;
91 tmp %= 10000; 91 tmp %= 10000;
92 _y += tmp / 100; 92 _y += tmp / 100;
93 _y *= 60; 93 _y *= 60;
94 tmp %= 100; 94 tmp %= 100;
95 _y += tmp; 95 _y += tmp;
96 } 96 }
97 } 97 }
98 iStart = regCoord.match( strLine, iStart + iLen, &iLen ); 98 iStart = regCoord.match( strLine, iStart + iLen, &iLen );
99 if ( iStart >= 0 ) { 99 if ( iStart >= 0 ) {
100 strTmp = strLine.mid( iStart, iLen ); 100 strTmp = strLine.mid( iStart, iLen );
101 tmp = strTmp.toInt(); 101 tmp = strTmp.toInt();
102 if ( iLen < 8 ) { 102 if ( iLen < 8 ) {
103 _x = tmp / 100; 103 _x = tmp / 100;
104 _x *= 60; 104 _x *= 60;
105 _x += tmp % 100; 105 _x += tmp % 100;
106 _x *= 60; 106 _x *= 60;
107 } else { 107 } else {
108 _x = tmp / 10000; 108 _x = tmp / 10000;
109 _x *= 60; 109 _x *= 60;
110 tmp %= 10000; 110 tmp %= 10000;
111 _x += tmp / 100; 111 _x += tmp / 100;
112 _x *= 60; 112 _x *= 60;
113 tmp %= 100; 113 tmp %= 100;
114 _x += tmp; 114 _x += tmp;
115 } 115 }
116 } 116 }
117 iStart = regCountry.match( strLine, 0, &iLen ); 117 iStart = regCountry.match( strLine, 0, &iLen );
118 // help with the shortcoming in 2.x regexp... 118 // help with the shortcoming in 2.x regexp...
119 iStop = strLine.findRev( '/' ); 119 iStop = strLine.findRev( '/' );
120 if ( iStart >= 0 ) { 120 if ( iStart >= 0 ) {
121 iLen = (iStop - iStart) + 1; 121 iLen = (iStop - iStart) + 1;
122 strCountry = strLine.mid( iStart, iLen ); 122 strCountry = strLine.mid( iStart, iLen );
123 } 123 }
124 // now match the city... 124 // now match the city...
125 iStart = regCity.match( strLine, iStart + iLen, &iLen ); 125 iStart = regCity.match( strLine, iStart + iLen, &iLen );
126 if ( iStart >= 0 ) { 126 if ( iStart >= 0 ) {
127 strCity = strLine.mid( iStart, iLen ); 127 strCity = strLine.mid( iStart, iLen );
128 } 128 }
129} 129}
130 130
131void ZoneField::showStructure( void ) const 131void ZoneField::showStructure( void ) const
132{ 132{
133 qDebug( "Country: %s", strCountry.latin1() ); 133 qDebug( "Country: %s", strCountry.latin1() );
134 qDebug( "City: %s", strCity.latin1() ); 134 qDebug( "City: %s", strCity.latin1() );
135 qDebug( "x: %d", _x ); 135 qDebug( "x: %d", _x );
136 qDebug( "y: %d\n", _y ); 136 qDebug( "y: %d\n", _y );
137} 137}
138 138
139ZoneMap::ZoneMap( QWidget *parent, const char* name ) 139ZoneMap::ZoneMap( QWidget *parent, const char* name )
140 : QScrollView( parent, name ), 140 : QScrollView( parent, name ),
141 pLast( 0 ), 141 pLast( 0 ),
142 pRepaint( 0 ), 142 pRepaint( 0 ),
143 ox( 0 ), 143 ox( 0 ),
144 oy( 0 ), 144 oy( 0 ),
145 drawableW( -1 ), 145 drawableW( -1 ),
146 drawableH( -1 ), 146 drawableH( -1 ),
147 bZoom( FALSE ), 147 bZoom( FALSE ),
148 bIllum( TRUE ), 148 bIllum( TRUE ),
149 cursor( 0 ) 149 cursor( 0 )
150{ 150{
151 viewport()->setFocusPolicy( StrongFocus ); 151 viewport()->setFocusPolicy( StrongFocus );
152 152
153 // set mouse tracking so we can use the mouse move event 153 // set mouse tracking so we can use the mouse move event
154 zones.setAutoDelete( true ); 154 zones.setAutoDelete( true );
155 // get the map loaded 155 // get the map loaded
156 // just set the current image to point 156 // just set the current image to point
157 pixCurr = new QPixmap(); 157 pixCurr = new QPixmap();
158 158
159 QPixmap pixZoom = Resource::loadPixmap( "mag" ); 159 QPixmap pixZoom = Resource::loadPixmap( "mag" );
160 160
161 cmdZoom = new QToolButton( this, "Zoom command" ); 161 cmdZoom = new QToolButton( this, "Zoom command" );
162 cmdZoom->setPixmap( pixZoom ); 162 cmdZoom->setPixmap( pixZoom );
163 cmdZoom->setToggleButton( true ); 163 cmdZoom->setToggleButton( true );
164 164
165 cmdZoom->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, 165 cmdZoom->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0,
166 (QSizePolicy::SizeType)0, 166 (QSizePolicy::SizeType)0,
167 cmdZoom->sizePolicy().hasHeightForWidth() ) ); 167 cmdZoom->sizePolicy().hasHeightForWidth() ) );
168 cmdZoom->setMaximumSize( cmdZoom->sizeHint() ); 168 cmdZoom->setMaximumSize( cmdZoom->sizeHint() );
169 // probably don't need this, but just in case... 169 // probably don't need this, but just in case...
170 cmdZoom->move( width() - cmdZoom->width(), height() - cmdZoom->height() ); 170 cmdZoom->move( width() - cmdZoom->width(), height() - cmdZoom->height() );
171 171
172 172
173 lblCity = new QLabel( tr( "CITY" ), this, "City Label" ); 173 lblCity = new QLabel( tr( "CITY" ), this, "City Label" );
174 lblCity->setMinimumSize( lblCity->sizeHint() ); 174 lblCity->setMinimumSize( lblCity->sizeHint() );
175 lblCity->setFrameStyle( QFrame::Plain | QFrame::Box ); 175 lblCity->setFrameStyle( QFrame::Plain | QFrame::Box );
176 lblCity->setBackgroundColor( yellow ); 176 lblCity->setBackgroundColor( yellow );
177 lblCity->hide(); 177 lblCity->hide();
178 178
179 // A timer to make sure the label gets hidden 179 // A timer to make sure the label gets hidden
180 tHide = new QTimer( this, "Label Timer" ); 180 tHide = new QTimer( this, "Label Timer" );
181 QObject::connect( tHide, SIGNAL( timeout() ), 181 QObject::connect( tHide, SIGNAL( timeout() ),
182 lblCity, SLOT( hide() ) ); 182 lblCity, SLOT( hide() ) );
183 QObject::connect( tHide, SIGNAL( timeout() ), 183 QObject::connect( tHide, SIGNAL( timeout() ),
184 this, SLOT( slotRedraw() ) ); 184 this, SLOT( slotRedraw() ) );
185 QTimer *tUpdate = new QTimer( this, "Update Timer" ); 185 QTimer *tUpdate = new QTimer( this, "Update Timer" );
186 QObject::connect( tUpdate, SIGNAL( timeout() ), 186 QObject::connect( tUpdate, SIGNAL( timeout() ),
187 this, SLOT( slotUpdate() ) ); 187 this, SLOT( slotUpdate() ) );
188 QObject::connect( qApp, SIGNAL( timeChanged() ), 188 QObject::connect( qApp, SIGNAL( timeChanged() ),
189 this, SLOT( slotUpdate() ) ); 189 this, SLOT( slotUpdate() ) );
190 QObject::connect( cmdZoom, SIGNAL( toggled( bool ) ), 190 QObject::connect( cmdZoom, SIGNAL( toggled(bool) ),
191 this, SLOT( slotZoom( bool ) ) ); 191 this, SLOT( slotZoom(bool) ) );
192 QObject::connect( &norm, SIGNAL( signalNewPoint( const QPoint& ) ), 192 QObject::connect( &norm, SIGNAL( signalNewPoint(const QPoint&) ),
193 this, SLOT( slotFindCity( const QPoint& ) ) ); 193 this, SLOT( slotFindCity(const QPoint&) ) );
194 QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), 194 QObject::connect( qApp, SIGNAL( clockChanged(bool) ),
195 this, SLOT( changeClock( bool ) ) ); 195 this, SLOT( changeClock(bool) ) );
196 // update the sun's movement every 5 minutes 196 // update the sun's movement every 5 minutes
197 tUpdate->start( 5 * 60 * 1000 ); 197 tUpdate->start( 5 * 60 * 1000 );
198 // May as well read in the timezone information too... 198 // May as well read in the timezone information too...
199 readZones(); 199 readZones();
200} 200}
201 201
202ZoneMap::~ZoneMap() 202ZoneMap::~ZoneMap()
203{ 203{
204} 204}
205 205
206void ZoneMap::readZones( void ) 206void ZoneMap::readZones( void )
207{ 207{
208 QFile fZone( strZONEINFO ); 208 QFile fZone( strZONEINFO );
209 if ( !fZone.open( IO_ReadOnly ) ) { 209 if ( !fZone.open( IO_ReadOnly ) ) {
210 QMessageBox::warning (this, 210 QMessageBox::warning (this,
211 tr( "Unable to Find Timezone Info" ), 211 tr( "Unable to Find Timezone Info" ),
212 tr( "<p>Unable to find any timezone information in %1" ) 212 tr( "<p>Unable to find any timezone information in %1" )
213 .arg( strZONEINFO )); 213 .arg( strZONEINFO ));
214 exit(-1); 214 exit(-1);
215 } else { 215 } else {
216 QTextStream tZone( &fZone ); 216 QTextStream tZone( &fZone );
217 while ( !tZone.atEnd() ) { 217 while ( !tZone.atEnd() ) {
218 QString strLine = tZone.readLine(); 218 QString strLine = tZone.readLine();
219 // only pass on lines that aren't comments 219 // only pass on lines that aren't comments
220 if ( strLine[0] != '#' ) { 220 if ( strLine[0] != '#' ) {
221 zones.append( new ZoneField( strLine ) ); 221 zones.append( new ZoneField( strLine ) );
222 } 222 }
223 } 223 }
224 fZone.close(); 224 fZone.close();
225 } 225 }
226} 226}
227 227
228void ZoneMap::viewportMousePressEvent( QMouseEvent* event ) 228void ZoneMap::viewportMousePressEvent( QMouseEvent* event )
229{ 229{
230 // add the mouse event into the normalizer, and get the average, 230 // add the mouse event into the normalizer, and get the average,
231 // pass it along 231 // pass it along
232 slotRedraw(); 232 slotRedraw();
233 norm.start(); 233 norm.start();
234 norm.addEvent( event->pos() ); 234 norm.addEvent( event->pos() );
235} 235}
236 236
237void ZoneMap::viewportMouseMoveEvent( QMouseEvent* event ) 237void ZoneMap::viewportMouseMoveEvent( QMouseEvent* event )
238{ 238{
239 norm.addEvent( event->pos() ); 239 norm.addEvent( event->pos() );
240} 240}
241 241
242void ZoneMap::viewportMouseReleaseEvent( QMouseEvent* ) 242void ZoneMap::viewportMouseReleaseEvent( QMouseEvent* )
243{ 243{
244 // get the averaged points in case a timeout hasn't occurred, 244 // get the averaged points in case a timeout hasn't occurred,
245 // more for "mouse clicks" 245 // more for "mouse clicks"
246 norm.stop(); 246 norm.stop();
247 if ( pLast != NULL ) { 247 if ( pLast != NULL ) {
248 emit signalTz( pLast->country(), pLast->city() ); 248 emit signalTz( pLast->country(), pLast->city() );
249 pLast = NULL; 249 pLast = NULL;
250 } 250 }
251 tHide->start( 2000, true ); 251 tHide->start( 2000, true );
252} 252}
253 253
254void ZoneMap::keyPressEvent( QKeyEvent *ke ) 254void ZoneMap::keyPressEvent( QKeyEvent *ke )
255{ 255{
256 switch ( ke->key() ) { 256 switch ( ke->key() ) {
257 case Key_Left: 257 case Key_Left:
258 case Key_Right: 258 case Key_Right:
259 case Key_Up: 259 case Key_Up:
260 case Key_Down: { 260 case Key_Down: {
261 tHide->stop(); 261 tHide->stop();
262 if ( !cursor ) 262 if ( !cursor )
263 slotFindCity( QPoint( contentsWidth(), contentsHeight() ) / 2 ); 263 slotFindCity( QPoint( contentsWidth(), contentsHeight() ) / 2 );
264 ZoneField *city = findCityNear( cursor, ke->key() ); 264 ZoneField *city = findCityNear( cursor, ke->key() );
265 if ( city ) { 265 if ( city ) {
266 cursor = city; 266 cursor = city;
267 int tmpx, tmpy; 267 int tmpx, tmpy;
268 zoneToWin( cursor->x(), cursor->y(), tmpx, tmpy ); 268 zoneToWin( cursor->x(), cursor->y(), tmpx, tmpy );
269 ensureVisible( tmpx, tmpy ); 269 ensureVisible( tmpx, tmpy );
270 showCity( cursor ); 270 showCity( cursor );
271 tHide->start( 3000, true ); 271 tHide->start( 3000, true );
272 } 272 }
273 } 273 }
274 break; 274 break;
275 275
276 case Key_Space: 276 case Key_Space:
277 case Key_Enter: 277 case Key_Enter:
278 case Key_Return: 278 case Key_Return:
279 if ( cursor ) { 279 if ( cursor ) {
280 emit signalTz( cursor->country(), cursor->city() ); 280 emit signalTz( cursor->country(), cursor->city() );
281 tHide->start( 0, true ); 281 tHide->start( 0, true );
282 } 282 }
283 break; 283 break;
284 } 284 }
285} 285}
286 286
287ZoneField *ZoneMap::findCityNear( ZoneField *city, int key ) 287ZoneField *ZoneMap::findCityNear( ZoneField *city, int key )
288{ 288{
289 ZoneField *pZone; 289 ZoneField *pZone;
290 ZoneField *pClosest = 0; 290 ZoneField *pClosest = 0;
291 long ddist = LONG_MAX; 291 long ddist = LONG_MAX;
292 292
293 QListIterator<ZoneField> it( zones ); 293 QListIterator<ZoneField> it( zones );
294 for (; it.current(); ++it) { 294 for (; it.current(); ++it) {
295 pZone = it.current(); 295 pZone = it.current();
296 long dx = (pZone->x() - city->x())/100; 296 long dx = (pZone->x() - city->x())/100;
297 long dy = (pZone->y() - city->y())/100; 297 long dy = (pZone->y() - city->y())/100;
298 switch ( key ) { 298 switch ( key ) {
299 case Key_Right: 299 case Key_Right:
300 case Key_Left: 300 case Key_Left:
301 if ( key == Key_Left ) 301 if ( key == Key_Left )
302 dx = -dx; 302 dx = -dx;
303 if ( dx > 0 ) { 303 if ( dx > 0 ) {
304 long dist = QABS(dy)*4 + dx; 304 long dist = QABS(dy)*4 + dx;
305 if ( dist < ddist ) { 305 if ( dist < ddist ) {
306 ddist = dist; 306 ddist = dist;
307 pClosest = pZone; 307 pClosest = pZone;
308 } 308 }
309 } 309 }
310 break; 310 break;
311 case Key_Down: 311 case Key_Down:
312 case Key_Up: 312 case Key_Up:
313 if ( key == Key_Down ) 313 if ( key == Key_Down )
314 dy = -dy; 314 dy = -dy;
315 if ( dy > 0 ) { 315 if ( dy > 0 ) {
316 long dist = QABS(dx)*4 + dy; 316 long dist = QABS(dx)*4 + dy;
317 if ( dist < ddist ) { 317 if ( dist < ddist ) {
318 ddist = dist; 318 ddist = dist;
319 pClosest = pZone; 319 pClosest = pZone;
320 } 320 }
321 } 321 }
322 break; 322 break;
323 } 323 }
324 } 324 }
325 325
326 return pClosest; 326 return pClosest;
327} 327}
328 328
329void ZoneMap::slotFindCity( const QPoint &pos ) 329void ZoneMap::slotFindCity( const QPoint &pos )
330{ 330{
331 lblCity->hide(); 331 lblCity->hide();
332 // given coordinates on the screen find the closest city and display the 332 // given coordinates on the screen find the closest city and display the
333 // label close to it 333 // label close to it
334 int tmpx, tmpy, x, y; 334 int tmpx, tmpy, x, y;
335 long lDistance, 335 long lDistance,
336 lClosest; 336 lClosest;
337 ZoneField *pZone, 337 ZoneField *pZone,
338 *pClosest; 338 *pClosest;
339 339
340 if ( tHide->isActive() ) { 340 if ( tHide->isActive() ) {
341 tHide->stop(); 341 tHide->stop();
342 } 342 }
343 viewportToContents(pos.x(), pos.y(), tmpx, tmpy); 343 viewportToContents(pos.x(), pos.y(), tmpx, tmpy);
344 winToZone( tmpx, tmpy, x, y ); 344 winToZone( tmpx, tmpy, x, y );
345 // Find city alogorithim: start out at an (near) infinite distance away and 345 // Find city alogorithim: start out at an (near) infinite distance away and
346 // then find the closest city, (similar to the Z-buffer technique, I guess) 346 // then find the closest city, (similar to the Z-buffer technique, I guess)
347 // the only problem is that this is all done with doubles, but I don't know 347 // the only problem is that this is all done with doubles, but I don't know
348 // another way to do it at the moment. Another problem is a linked list is 348 // another way to do it at the moment. Another problem is a linked list is
349 // used obviously something indexed would help 349 // used obviously something indexed would help
350 QListIterator<ZoneField> it( zones ); 350 QListIterator<ZoneField> it( zones );
351 pClosest = 0; 351 pClosest = 0;
352 lClosest = LONG_MAX; 352 lClosest = LONG_MAX;
353 for (; it.current(); ++it) { 353 for (; it.current(); ++it) {
354 pZone = it.current(); 354 pZone = it.current();
355 // use the manhattenLength, a good enough of an appoximation here 355 // use the manhattenLength, a good enough of an appoximation here
356 lDistance = QABS( x - pZone->x() ) + QABS( y - pZone->y() ); 356 lDistance = QABS( x - pZone->x() ) + QABS( y - pZone->y() );
357 // first to zero wins! 357 // first to zero wins!
358 if ( lDistance < lClosest ) { 358 if ( lDistance < lClosest ) {
359 lClosest = lDistance; 359 lClosest = lDistance;
360 pClosest = pZone; 360 pClosest = pZone;
361 } 361 }
362 } 362 }
363 363
364 // Okay, we found the closest city, but it might still be too far away. 364 // Okay, we found the closest city, but it might still be too far away.
365 if ( lClosest <= iTHRESHOLD ) { 365 if ( lClosest <= iTHRESHOLD ) {
366 showCity( pClosest ); 366 showCity( pClosest );
367 cursor = pClosest; 367 cursor = pClosest;
368 } 368 }
369} 369}
370 370
371void ZoneMap::showCity( ZoneField *city ) 371void ZoneMap::showCity( ZoneField *city )
372{ 372{
373 pLast = city; 373 pLast = city;
374 // we'll use city and country a couple of times, get them to save some 374 // we'll use city and country a couple of times, get them to save some
375 // time 375 // time
376 QString strCity = pLast->city(); 376 QString strCity = pLast->city();
377 QString strCountry = pLast->country(); 377 QString strCountry = pLast->country();
378 // Display the time at this location by setting the environment timezone 378 // Display the time at this location by setting the environment timezone
379 // getting the current time [there] and then swapping back the variable 379 // getting the current time [there] and then swapping back the variable
380 // so no one notices... 380 // so no one notices...
381 QString strSave; 381 QString strSave;
382 char *p = getenv( "TZ" ); 382 char *p = getenv( "TZ" );
383 if ( p ) { 383 if ( p ) {
384 strSave = p; 384 strSave = p;
385 } 385 }
386 // set the timezone :) 386 // set the timezone :)
387 setenv( "TZ", strCountry + strCity, true ); 387 setenv( "TZ", strCountry + strCity, true );
388 lblCity->setText( strCity.replace( QRegExp("_"), " ") + "\n" + 388 lblCity->setText( strCity.replace( QRegExp("_"), " ") + "\n" +
389 TimeString::shortTime( ampm ) ); 389 TimeString::shortTime( ampm ) );
390 lblCity->setMinimumSize( lblCity->sizeHint() ); 390 lblCity->setMinimumSize( lblCity->sizeHint() );
391 // undue our damage... 391 // undue our damage...
392 unsetenv( "TZ" ); 392 unsetenv( "TZ" );
393 if ( p ) 393 if ( p )
394 setenv( "TZ", strSave, true ); 394 setenv( "TZ", strSave, true );
395 // Now decide where to move the label, x & y can be reused 395 // Now decide where to move the label, x & y can be reused
396 int tmpx, tmpy, x, y; 396 int tmpx, tmpy, x, y;
397 zoneToWin( pLast->x(), pLast->y(), tmpx, tmpy ); 397 zoneToWin( pLast->x(), pLast->y(), tmpx, tmpy );
398 contentsToViewport(tmpx, tmpy, x, y); 398 contentsToViewport(tmpx, tmpy, x, y);
399 if ( lblCity->width() > drawableW - x ) { 399 if ( lblCity->width() > drawableW - x ) {
400 // oops... try putting it on the right 400 // oops... try putting it on the right
401 x = x - lblCity->width() - iLABELOFFSET; 401 x = x - lblCity->width() - iLABELOFFSET;
402 } else { 402 } else {
403 // the default... 403 // the default...
404 x += iLABELOFFSET; 404 x += iLABELOFFSET;
405 } 405 }
406 if ( lblCity->height() > drawableH - y ) { 406 if ( lblCity->height() > drawableH - y ) {
407 // move it up... 407 // move it up...
408 y = y - lblCity->height() - iLABELOFFSET; 408 y = y - lblCity->height() - iLABELOFFSET;
409 } else if ( y < 0 ) { 409 } else if ( y < 0 ) {
410 // the city is actually off the screen... 410 // the city is actually off the screen...
411 // this only happens on the a zoom when you are near the top, 411 // this only happens on the a zoom when you are near the top,
412 // a quick workaround.. 412 // a quick workaround..
413 y = iLABELOFFSET; 413 y = iLABELOFFSET;
414 } else { 414 } else {
415 // the default 415 // the default
416 y += iLABELOFFSET; 416 y += iLABELOFFSET;
417 } 417 }
418 418
419 // draw in the city and the label 419 // draw in the city and the label
420 if ( pRepaint ) { 420 if ( pRepaint ) {
421 int repx, 421 int repx,
422 repy; 422 repy;
423 zoneToWin( pRepaint->x(), pRepaint->y(), repx, repy ); 423 zoneToWin( pRepaint->x(), pRepaint->y(), repx, repy );
424 updateContents( repx - iCITYOFFSET, repy - iCITYOFFSET, 424 updateContents( repx - iCITYOFFSET, repy - iCITYOFFSET,
425 iCITYSIZE, iCITYSIZE ); 425 iCITYSIZE, iCITYSIZE );
426 } 426 }
427 updateContents( tmpx - iCITYOFFSET, tmpy - iCITYOFFSET, iCITYSIZE, 427 updateContents( tmpx - iCITYOFFSET, tmpy - iCITYOFFSET, iCITYSIZE,
428 iCITYSIZE ); 428 iCITYSIZE );
429 pRepaint = pLast; 429 pRepaint = pLast;
430 430
431 lblCity->move( x, y ); 431 lblCity->move( x, y );
432 lblCity->show(); 432 lblCity->show();
433} 433}
434 434
435void ZoneMap::resizeEvent( QResizeEvent *e ) 435void ZoneMap::resizeEvent( QResizeEvent *e )
436{ 436{
437 // keep the zoom button down in the corner 437 // keep the zoom button down in the corner
438 QSize _size = e->size(); 438 QSize _size = e->size();
439 cmdZoom->move( _size.width() - cmdZoom->width(), 439 cmdZoom->move( _size.width() - cmdZoom->width(),
440 _size.height() - cmdZoom->height() ); 440 _size.height() - cmdZoom->height() );
441 if ( !bZoom ) { 441 if ( !bZoom ) {
442 drawableW = width() - 2 * frameWidth(); 442 drawableW = width() - 2 * frameWidth();
443 drawableH = height() - 2 * frameWidth(); 443 drawableH = height() - 2 * frameWidth();
444 makeMap( drawableW, drawableH ); 444 makeMap( drawableW, drawableH );
445 resizeContents( drawableW, drawableH ); 445 resizeContents( drawableW, drawableH );
446 } 446 }
447} 447}
448 448
449void ZoneMap::showZones( void ) const 449void ZoneMap::showZones( void ) const
450{ 450{
451 // go through the zones in the list and just display the values... 451 // go through the zones in the list and just display the values...
452 QListIterator<ZoneField> itZone( zones ); 452 QListIterator<ZoneField> itZone( zones );
453 for ( itZone.toFirst(); itZone.current(); ++itZone ) { 453 for ( itZone.toFirst(); itZone.current(); ++itZone ) {
454 ZoneField *pZone = itZone.current(); 454 ZoneField *pZone = itZone.current();
455 pZone->showStructure(); 455 pZone->showStructure();
456 } 456 }
457} 457}
458 458
459 459
460QWidget* ZoneMap::selectionWidget( QWidget *parent) { 460QWidget* ZoneMap::selectionWidget( QWidget *parent) {
461 461
462 QWidget *returnWidget = new QWidget( parent ); 462 QWidget *returnWidget = new QWidget( parent );
463 463
464 QVBoxLayout *layout = new QVBoxLayout( returnWidget ); 464 QVBoxLayout *layout = new QVBoxLayout( returnWidget );
465 QHBox *hBox = new QHBox( returnWidget ); 465 QHBox *hBox = new QHBox( returnWidget );
466 QListView *continentView = new QListView( hBox ); 466 QListView *continentView = new QListView( hBox );
467 continentView->addColumn( tr("Continent") ); 467 continentView->addColumn( tr("Continent") );
468 QWhatsThis::add( continentView, tr("Select a continent/country here, then select a city") ); 468 QWhatsThis::add( continentView, tr("Select a continent/country here, then select a city") );
469 connect ( continentView, SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( slotGetCities( QListViewItem * ) ) ); 469 connect ( continentView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( slotGetCities(QListViewItem*) ) );
470 470
471 QStringList continentList; 471 QStringList continentList;
472 QListIterator<ZoneField> itZone( zones ); 472 QListIterator<ZoneField> itZone( zones );
473 for ( itZone.toFirst(); itZone.current(); ++itZone ) { 473 for ( itZone.toFirst(); itZone.current(); ++itZone ) {
474 ZoneField *pZone = itZone.current(); 474 ZoneField *pZone = itZone.current();
475 if ( continentList.contains( pZone->country() ) == 0 ) { 475 if ( continentList.contains( pZone->country() ) == 0 ) {
476 QString name; 476 QString name;
477 QListViewItem *item; 477 QListViewItem *item;
478 if ( !(pZone->country().length() > 24) ) { 478 if ( !(pZone->country().length() > 24) ) {
479 name = pZone->country().left(pZone->country().length()-1 ); 479 name = pZone->country().left(pZone->country().length()-1 );
480 } else { 480 } else {
481 name = pZone->country().left( 24 ); 481 name = pZone->country().left( 24 );
482 } 482 }
483 item = new QListViewItem( continentView, name, pZone->country() ); 483 item = new QListViewItem( continentView, name, pZone->country() );
484 continentList.append( pZone->country() ); 484 continentList.append( pZone->country() );
485 } 485 }
486 } 486 }
487 487
488 cityView = new QListView( hBox ); 488 cityView = new QListView( hBox );
489 cityView->addColumn( tr("City") ); 489 cityView->addColumn( tr("City") );
490 490
491 layout->addWidget( hBox ); 491 layout->addWidget( hBox );
492 return returnWidget; 492 return returnWidget;
493} 493}
494 494
495void ZoneMap::slotGetCities( QListViewItem * contItem) { 495void ZoneMap::slotGetCities( QListViewItem * contItem) {
496 496
497 cityView->clear(); 497 cityView->clear();
498 selectedCont = contItem->text( 1 ); 498 selectedCont = contItem->text( 1 );
499 QListIterator<ZoneField> itZone( zones ); 499 QListIterator<ZoneField> itZone( zones );
500 for ( itZone.toFirst(); itZone.current(); ++itZone ) { 500 for ( itZone.toFirst(); itZone.current(); ++itZone ) {
501 ZoneField *pZone = itZone.current(); 501 ZoneField *pZone = itZone.current();
502 if ( pZone->country() == contItem->text( 1 ) ) { 502 if ( pZone->country() == contItem->text( 1 ) ) {
503 QListViewItem *item; 503 QListViewItem *item;
504 item = new QListViewItem( cityView, pZone->city() ); 504 item = new QListViewItem( cityView, pZone->city() );
505 connect ( cityView, SIGNAL( clicked ( QListViewItem* ) ), this, SLOT( slotCitySelected( QListViewItem* ) ) ); 505 connect ( cityView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( slotCitySelected(QListViewItem*) ) );
506 } 506 }
507 } 507 }
508} 508}
509 509
510void ZoneMap::slotCitySelected( QListViewItem *cityItem ) { 510void ZoneMap::slotCitySelected( QListViewItem *cityItem ) {
511 if ( cityItem ) { 511 if ( cityItem ) {
512 emit signalTz( selectedCont, cityItem->text( 0 ) ); 512 emit signalTz( selectedCont, cityItem->text( 0 ) );
513 } 513 }
514} 514}
515 515
516void ZoneMap::drawCities( QPainter *p ) 516void ZoneMap::drawCities( QPainter *p )
517{ 517{
518 int x, y, j; 518 int x, y, j;
519 // draw in the cities 519 // draw in the cities
520 // for testing only as when you put it 520 // for testing only as when you put it
521 // on the small screen it looks awful and not to mention useless 521 // on the small screen it looks awful and not to mention useless
522 p->setPen( red ); 522 p->setPen( red );
523 QListIterator<ZoneField> itZone( zones ); 523 QListIterator<ZoneField> itZone( zones );
524 for ( itZone.toFirst(), j = 0; itZone.current(); ++itZone, j++ ) { 524 for ( itZone.toFirst(), j = 0; itZone.current(); ++itZone, j++ ) {
525 ZoneField *pZone = itZone.current(); 525 ZoneField *pZone = itZone.current();
526 zoneToWin( pZone->x(), pZone->y(), x, y ); 526 zoneToWin( pZone->x(), pZone->y(), x, y );
527 if ( x > wImg ) 527 if ( x > wImg )
528 x = x - wImg; 528 x = x - wImg;
529 p->drawRect( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE); 529 p->drawRect( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE);
530 } 530 }
531} 531}
532 532
533static void dayNight(QImage *pImage) 533static void dayNight(QImage *pImage)
534{ 534{
535 // create a mask the functions from sun.h 535 // create a mask the functions from sun.h
536 double dJulian, 536 double dJulian,
537 dSunRad, 537 dSunRad,
538 dSunDecl, 538 dSunDecl,
539 dSunRadius, 539 dSunRadius,
540 dSunLong; 540 dSunLong;
541 int wImage = pImage->width(), 541 int wImage = pImage->width(),
542 hImage = pImage->height(), 542 hImage = pImage->height(),
543 iStart, 543 iStart,
544 iStop, 544 iStop,
545 iMid, 545 iMid,
546 relw, 546 relw,
547 i; 547 i;
548 short wtab[ wImage ]; 548 short wtab[ wImage ];
549 time_t tCurrent; 549 time_t tCurrent;
550 struct tm *pTm; 550 struct tm *pTm;
551 551
552 // get the position of the sun bassed on our current time... 552 // get the position of the sun bassed on our current time...
553 tCurrent = time( NULL ); 553 tCurrent = time( NULL );
554 pTm = gmtime( &tCurrent ); 554 pTm = gmtime( &tCurrent );
555 dJulian = jtime( pTm ); 555 dJulian = jtime( pTm );
556 sunpos( dJulian, 0, &dSunRad, &dSunDecl, &dSunRadius, &dSunLong ); 556 sunpos( dJulian, 0, &dSunRad, &dSunDecl, &dSunRadius, &dSunLong );
557 557
558 // now get the projected illumination 558 // now get the projected illumination
559 projillum( wtab, wImage, hImage, dSunDecl ); 559 projillum( wtab, wImage, hImage, dSunDecl );
560 relw = wImage - int( wImage * 0.0275 ); 560 relw = wImage - int( wImage * 0.0275 );
561 561
562 // draw the map, keeping in mind that we may go too far off the map... 562 // draw the map, keeping in mind that we may go too far off the map...
563 iMid = ( relw * ( 24*60 - pTm->tm_hour * 60 - pTm->tm_min ) ) / ( 24*60 ); 563 iMid = ( relw * ( 24*60 - pTm->tm_hour * 60 - pTm->tm_min ) ) / ( 24*60 );
564 564
565 for ( i = 0; i < hImage; i++ ) { 565 for ( i = 0; i < hImage; i++ ) {
566 if ( wtab[i] > 0 ) { 566 if ( wtab[i] > 0 ) {
567 iStart = iMid - wtab[i]; 567 iStart = iMid - wtab[i];
568 iStop = iMid + wtab[i]; 568 iStop = iMid + wtab[i];
569 if ( iStart < 0 ) { 569 if ( iStart < 0 ) {
570 darken( pImage, iStop, wImage + iStart, i ); 570 darken( pImage, iStop, wImage + iStart, i );
571 } else if ( iStop > wImage ) { 571 } else if ( iStop > wImage ) {
572 darken( pImage, iStop - wImage, iStart, i ); 572 darken( pImage, iStop - wImage, iStart, i );
573 } else { 573 } else {
574 darken( pImage, 0, iStart, i ); 574 darken( pImage, 0, iStart, i );
575 darken( pImage, iStop, wImage, i ); 575 darken( pImage, iStop, wImage, i );
576 } 576 }
577 } else { 577 } else {
578 darken( pImage, 0, wImage, i ); 578 darken( pImage, 0, wImage, i );
579 } 579 }
580 } 580 }
581} 581}
582 582
583static inline void darken( QImage *pImage, int start, int stop, int row ) 583static inline void darken( QImage *pImage, int start, int stop, int row )
584{ 584{
585 int colors, 585 int colors,
586 j; 586 j;
587 uchar *p; 587 uchar *p;
588 588
589 // assume that the image is similar to the one we have... 589 // assume that the image is similar to the one we have...
590 colors = pImage->numColors() / 2; 590 colors = pImage->numColors() / 2;
591 591
592 p = pImage->scanLine( row ); 592 p = pImage->scanLine( row );
593 for ( j = start; j <= stop; j++ ) { 593 for ( j = start; j <= stop; j++ ) {
594 if ( p[j] < colors ) 594 if ( p[j] < colors )
595 p[j] += colors; 595 p[j] += colors;
596 } 596 }
597} 597}
598 598
599void ZoneMap::makeMap( int w, int h ) 599void ZoneMap::makeMap( int w, int h )
600{ 600{
601 QImage imgOrig = Resource::loadImage( strMAP ); 601 QImage imgOrig = Resource::loadImage( strMAP );
602 if ( imgOrig.isNull() ) { 602 if ( imgOrig.isNull() ) {
603 QMessageBox::warning( this, 603 QMessageBox::warning( this,
604 tr( "Couldn't Find Map" ), 604 tr( "Couldn't Find Map" ),
605 tr( "<p>Couldn't load map: %1, exiting") 605 tr( "<p>Couldn't load map: %1, exiting")
606 .arg( strMAP ) ); 606 .arg( strMAP ) );
607 exit(-1); 607 exit(-1);
608 } 608 }
609 609
610 // set up the color table for darkening... 610 // set up the color table for darkening...
611 imgOrig = imgOrig.convertDepth( 8 ); 611 imgOrig = imgOrig.convertDepth( 8 );
612 int numColors = imgOrig.numColors(); 612 int numColors = imgOrig.numColors();
613 // double the colors 613 // double the colors
614 imgOrig.setNumColors( 2 * numColors ); 614 imgOrig.setNumColors( 2 * numColors );
615 // darken the new ones... 615 // darken the new ones...
616 for ( int i = 0; i < numColors; i++ ) { 616 for ( int i = 0; i < numColors; i++ ) {
617 QRgb rgb = imgOrig.color( i ); 617 QRgb rgb = imgOrig.color( i );
618 imgOrig.setColor ( i + numColors, qRgb( 2 * qRed( rgb ) / 3, 618 imgOrig.setColor ( i + numColors, qRgb( 2 * qRed( rgb ) / 3,
619 2 * qGreen( rgb ) / 3, 2 * qBlue( rgb ) / 3 ) ); 619 2 * qGreen( rgb ) / 3, 2 * qBlue( rgb ) / 3 ) );
620 } 620 }
621 621
622 // else go one with making the map... 622 // else go one with making the map...
623 if ( bIllum ) { 623 if ( bIllum ) {
624 // do a daylight mask 624 // do a daylight mask
625 dayNight(&imgOrig); 625 dayNight(&imgOrig);
626 } 626 }
627 // redo the width and height 627 // redo the width and height
628 wImg = w; 628 wImg = w;
629 hImg = h; 629 hImg = h;
630 ox = ( wImg / 2 ) - int( wImg * 0.0275 ); 630 ox = ( wImg / 2 ) - int( wImg * 0.0275 );
631 oy = hImg / 2; 631 oy = hImg / 2;
632 pixCurr->convertFromImage( imgOrig.smoothScale(w, h), 632 pixCurr->convertFromImage( imgOrig.smoothScale(w, h),
633 QPixmap::ThresholdDither ); 633 QPixmap::ThresholdDither );
634} 634}
635 635
636void ZoneMap::drawCity( QPainter *p, const ZoneField *pCity ) 636void ZoneMap::drawCity( QPainter *p, const ZoneField *pCity )
637{ 637{
638 int x, 638 int x,
639 y; 639 y;
640 640
641 p->setPen( red ); 641 p->setPen( red );
642 zoneToWin( pCity->x(), pCity->y(), x, y ); 642 zoneToWin( pCity->x(), pCity->y(), x, y );
643 p->drawRect( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE ); 643 p->drawRect( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE );
644} 644}
645 645
646void ZoneMap::drawContents( QPainter *p, int cx, int cy, int cw, int ch ) 646void ZoneMap::drawContents( QPainter *p, int cx, int cy, int cw, int ch )
647{ 647{
648 // if there is a need to resize, then do it... 648 // if there is a need to resize, then do it...
649 // get our drawable area 649 // get our drawable area
650 drawableW = width() - 2 * frameWidth(); 650 drawableW = width() - 2 * frameWidth();
651 drawableH = height() - 2 * frameWidth(); 651 drawableH = height() - 2 * frameWidth();
652 652
653 int pixmapW = pixCurr->width(), 653 int pixmapW = pixCurr->width(),
654 pixmapH = pixCurr->height(); 654 pixmapH = pixCurr->height();
655 if ( !bZoom && ( ( pixmapW != drawableW ) || 655 if ( !bZoom && ( ( pixmapW != drawableW ) ||
656 ( pixmapH != drawableH) ) ) { 656 ( pixmapH != drawableH) ) ) {
657 makeMap( drawableW, drawableH ); 657 makeMap( drawableW, drawableH );
658 } 658 }
659 659
660 // taken from the scrollview example... 660 // taken from the scrollview example...
661 int rowheight = pixCurr->height(); 661 int rowheight = pixCurr->height();
662 int toprow = cy / rowheight; 662 int toprow = cy / rowheight;
663 int bottomrow = ( cy + ch + rowheight - 1 ) / rowheight; 663 int bottomrow = ( cy + ch + rowheight - 1 ) / rowheight;
664 int colwidth = pixCurr->width(); 664 int colwidth = pixCurr->width();
665 int leftcol= cx / colwidth; 665 int leftcol= cx / colwidth;
666 int rightcol= ( cx + cw + colwidth - 1 ) / colwidth; 666 int rightcol= ( cx + cw + colwidth - 1 ) / colwidth;
667 for ( int r = toprow; r <= bottomrow; r++ ) { 667 for ( int r = toprow; r <= bottomrow; r++ ) {
668 int py = r * rowheight; 668 int py = r * rowheight;
669 for ( int c = leftcol; c <= rightcol; c++ ) { 669 for ( int c = leftcol; c <= rightcol; c++ ) {
670 int px = c * colwidth; 670 int px = c * colwidth;
671 p->drawPixmap( px, py, *pixCurr ); 671 p->drawPixmap( px, py, *pixCurr );
672 } 672 }
673 } 673 }
674 674
675 // Draw that city! 675 // Draw that city!
676 if ( pLast ) 676 if ( pLast )
677 drawCity( p, pLast ); 677 drawCity( p, pLast );
678} 678}
679 679
680void ZoneMap::slotZoom( bool setZoom ) 680void ZoneMap::slotZoom( bool setZoom )
681{ 681{
682 bZoom = setZoom; 682 bZoom = setZoom;
683 if ( bZoom ) { 683 if ( bZoom ) {
684 makeMap( 2 * wImg , 2 * hImg ); 684 makeMap( 2 * wImg , 2 * hImg );
685 resizeContents( wImg, hImg ); 685 resizeContents( wImg, hImg );
686 } else { 686 } else {
687 makeMap( drawableW, drawableH ); 687 makeMap( drawableW, drawableH );
688 resizeContents( drawableW, drawableH ); 688 resizeContents( drawableW, drawableH );
689 } 689 }
690} 690}
691 691
692void ZoneMap::slotIllum( bool setIllum ) 692void ZoneMap::slotIllum( bool setIllum )
693{ 693{
694 bIllum = !setIllum; 694 bIllum = !setIllum;
695 // make the map... 695 // make the map...
696 makeMap( pixCurr->width(), pixCurr->height() ); 696 makeMap( pixCurr->width(), pixCurr->height() );
697 updateContents( 0, 0, wImg, hImg ); 697 updateContents( 0, 0, wImg, hImg );
698} 698}
699 699
700void ZoneMap::slotUpdate( void ) 700void ZoneMap::slotUpdate( void )
701{ 701{
702 // recalculate the light, most people will never see this, 702 // recalculate the light, most people will never see this,
703 // but it is good to be complete 703 // but it is good to be complete
704 makeMap ( pixCurr->width(), pixCurr->height() ); 704 makeMap ( pixCurr->width(), pixCurr->height() );
705 updateContents( contentsX(), contentsY(), drawableW, drawableH ); 705 updateContents( contentsX(), contentsY(), drawableW, drawableH );
706} 706}
707 707
708void ZoneMap::slotRedraw( void ) 708void ZoneMap::slotRedraw( void )
709{ 709{
710 // paint over that pesky city... 710 // paint over that pesky city...
711 int x, 711 int x,
712 y; 712 y;
713 if ( pRepaint ) { 713 if ( pRepaint ) {
714 pLast = 0; 714 pLast = 0;
715 zoneToWin(pRepaint->x(), pRepaint->y(), x, y); 715 zoneToWin(pRepaint->x(), pRepaint->y(), x, y);
716 updateContents( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE); 716 updateContents( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE);
717 pRepaint = 0; 717 pRepaint = 0;
718 } 718 }
719} 719}
720 720
721void ZoneMap::changeClock( bool whichClock ) 721void ZoneMap::changeClock( bool whichClock )
722{ 722{
723 ampm = whichClock; 723 ampm = whichClock;
724} 724}
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp
index dc8e993..2b64c47 100644
--- a/core/settings/launcher/menusettings.cpp
+++ b/core/settings/launcher/menusettings.cpp
@@ -1,178 +1,178 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
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 "menusettings.h" 29#include "menusettings.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qlibrary.h> 32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/menuappletinterface.h> 34#include <qpe/menuappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qlistview.h> 38#include <qlistview.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qheader.h> 40#include <qheader.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qwhatsthis.h> 43#include <qwhatsthis.h>
44 44
45#include <stdlib.h> 45#include <stdlib.h>
46 46
47 47
48MenuSettings::MenuSettings ( QWidget *parent, const char *name ) 48MenuSettings::MenuSettings ( QWidget *parent, const char *name )
49 : QWidget ( parent, name ) 49 : QWidget ( parent, name )
50{ 50{
51 m_applets_changed = false; 51 m_applets_changed = false;
52 52
53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
54 54
55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); 55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this );
56 lay-> addWidget ( l ); 56 lay-> addWidget ( l );
57 57
58 m_list = new QListView ( this ); 58 m_list = new QListView ( this );
59 m_list-> addColumn ( "foobar" ); 59 m_list-> addColumn ( "foobar" );
60 m_list-> header ( )-> hide ( ); 60 m_list-> header ( )-> hide ( );
61 61
62 lay-> addWidget ( m_list ); 62 lay-> addWidget ( m_list );
63 63
64 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); 64 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this );
65 lay-> addWidget ( m_menutabs ); 65 lay-> addWidget ( m_menutabs );
66 66
67 m_menusubpopup = new QCheckBox ( tr( "Show Applications in Subpopups" ), this ); 67 m_menusubpopup = new QCheckBox ( tr( "Show Applications in Subpopups" ), this );
68 lay-> addWidget ( m_menusubpopup ); 68 lay-> addWidget ( m_menusubpopup );
69 69
70 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); 70 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." ));
71 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); 71 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." ));
72 72
73 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); 73 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
74 74
75 init ( ); 75 init ( );
76} 76}
77 77
78void MenuSettings::init ( ) 78void MenuSettings::init ( )
79{ 79{
80 Config cfg ( "StartMenu" ); 80 Config cfg ( "StartMenu" );
81 cfg. setGroup ( "Applets" ); 81 cfg. setGroup ( "Applets" );
82 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 82 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
83 83
84 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 84 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
85#ifdef Q_OS_MACX 85#ifdef Q_OS_MACX
86 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 86 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
87#else 87#else
88 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 88 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
89#endif /* Q_OS_MACX */ 89#endif /* Q_OS_MACX */
90 90
91 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 91 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
92 QString name; 92 QString name;
93 QPixmap icon; 93 QPixmap icon;
94 MenuAppletInterface *iface = 0; 94 MenuAppletInterface *iface = 0;
95 95
96 QLibrary *lib = new QLibrary ( path + "/" + *it ); 96 QLibrary *lib = new QLibrary ( path + "/" + *it );
97 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); 97 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface );
98 if ( iface ) { 98 if ( iface ) {
99 QString lang = getenv( "LANG" ); 99 QString lang = getenv( "LANG" );
100 QTranslator *trans = new QTranslator ( qApp ); 100 QTranslator *trans = new QTranslator ( qApp );
101 QString type = (*it). left ((*it). find (".")); 101 QString type = (*it). left ((*it). find ("."));
102 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 102 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
103 if ( trans-> load ( tfn )) 103 if ( trans-> load ( tfn ))
104 qApp-> installTranslator ( trans ); 104 qApp-> installTranslator ( trans );
105 else 105 else
106 delete trans; 106 delete trans;
107 name = iface-> name ( ); 107 name = iface-> name ( );
108 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); 108 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal );
109 iface-> release ( ); 109 iface-> release ( );
110 lib-> unload ( ); 110 lib-> unload ( );
111 111
112 QCheckListItem *item; 112 QCheckListItem *item;
113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
114 if ( !icon. isNull ( )) 114 if ( !icon. isNull ( ))
115 item-> setPixmap ( 0, icon ); 115 item-> setPixmap ( 0, icon );
116 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 116 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
117 m_applets [*it] = item; 117 m_applets [*it] = item;
118 } else { 118 } else {
119 delete lib; 119 delete lib;
120 } 120 }
121 } 121 }
122 122
123 cfg. setGroup ( "Menu" ); 123 cfg. setGroup ( "Menu" );
124 m_menutabs->setChecked( cfg.readBoolEntry( "LauncherTabs", true ) ); 124 m_menutabs->setChecked( cfg.readBoolEntry( "LauncherTabs", true ) );
125 m_menusubpopup->setChecked( cfg.readBoolEntry( "LauncherSubPopup", true ) ); 125 m_menusubpopup->setChecked( cfg.readBoolEntry( "LauncherSubPopup", true ) );
126 m_menusubpopup->setEnabled( m_menutabs->isChecked() ); 126 m_menusubpopup->setEnabled( m_menutabs->isChecked() );
127 connect( m_menutabs, SIGNAL( stateChanged( int ) ), m_menusubpopup, SLOT( setEnabled( bool ) ) ); 127 connect( m_menutabs, SIGNAL( stateChanged(int) ), m_menusubpopup, SLOT( setEnabled(bool) ) );
128 128
129} 129}
130 130
131void MenuSettings::appletChanged() 131void MenuSettings::appletChanged()
132{ 132{
133 m_applets_changed = true; 133 m_applets_changed = true;
134} 134}
135 135
136void MenuSettings::accept ( ) 136void MenuSettings::accept ( )
137{ 137{
138 bool apps_changed = false; 138 bool apps_changed = false;
139 139
140 Config cfg ( "StartMenu" ); 140 Config cfg ( "StartMenu" );
141 cfg. setGroup ( "Applets" ); 141 cfg. setGroup ( "Applets" );
142 if ( m_applets_changed ) { 142 if ( m_applets_changed ) {
143 QStringList exclude; 143 QStringList exclude;
144 QMap <QString, QCheckListItem *>::Iterator it; 144 QMap <QString, QCheckListItem *>::Iterator it;
145 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 145 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
146 if ( !(*it)-> isOn ( )) 146 if ( !(*it)-> isOn ( ))
147 exclude << it. key ( ); 147 exclude << it. key ( );
148 } 148 }
149 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 149 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
150 } 150 }
151 cfg. writeEntry ( "SafeMode", false ); 151 cfg. writeEntry ( "SafeMode", false );
152 152
153 cfg. setGroup ( "Menu" ); 153 cfg. setGroup ( "Menu" );
154 154
155 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { 155 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) {
156 apps_changed = true; 156 apps_changed = true;
157 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( )); 157 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( ));
158 } 158 }
159 159
160 if ( m_menusubpopup-> isChecked ( ) != cfg. readBoolEntry ( "LauncherSubPopup", true )) { 160 if ( m_menusubpopup-> isChecked ( ) != cfg. readBoolEntry ( "LauncherSubPopup", true )) {
161 apps_changed = true; 161 apps_changed = true;
162 cfg. writeEntry ( "LauncherSubPopup", m_menusubpopup-> isChecked ( )); 162 cfg. writeEntry ( "LauncherSubPopup", m_menusubpopup-> isChecked ( ));
163 } 163 }
164 164
165 cfg. write ( ); 165 cfg. write ( );
166 166
167 if ( m_applets_changed ) { 167 if ( m_applets_changed ) {
168 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); 168 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
169 m_applets_changed = false; 169 m_applets_changed = false;
170 } 170 }
171 if ( apps_changed ) { 171 if ( apps_changed ) {
172 // currently use reloadApplets() since reloadApps is now used exclusive for server 172 // currently use reloadApplets() since reloadApps is now used exclusive for server
173 // to refresh the tabs. But what we want here is also a refresh of the startmenu entries 173 // to refresh the tabs. But what we want here is also a refresh of the startmenu entries
174 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" ); 174 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" );
175 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); 175 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
176 } 176 }
177} 177}
178 178
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index f79ad40..c0d1cf2 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -1,513 +1,513 @@
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 <opie/ofontselector.h>
42#include <opie/otabwidget.h> 42#include <opie/otabwidget.h>
43#include <opie/ocolorbutton.h> 43#include <opie/ocolorbutton.h>
44#include <opie/ofiledialog.h> 44#include <opie/ofiledialog.h>
45 45
46#include "tabdialog.h" 46#include "tabdialog.h"
47 47
48 48
49class SampleItem : public QIconViewItem { 49class SampleItem : public QIconViewItem {
50public: 50public:
51 SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) 51 SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text )
52 { 52 {
53 m_large = pix; 53 m_large = pix;
54 m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); 54 m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 ));
55 } 55 }
56 56
57 void sizeChange ( ) 57 void sizeChange ( )
58 { 58 {
59 calcRect ( ); 59 calcRect ( );
60 repaint ( ); 60 repaint ( );
61 } 61 }
62 62
63 QPixmap *pixmap ( ) const 63 QPixmap *pixmap ( ) const
64 { 64 {
65 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) 65 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right )
66 return (QPixmap *) &m_small; 66 return (QPixmap *) &m_small;
67 else 67 else
68 return (QPixmap *) &m_large; 68 return (QPixmap *) &m_large;
69 } 69 }
70 70
71private: 71private:
72 QPixmap m_large, m_small; 72 QPixmap m_large, m_small;
73}; 73};
74 74
75class SampleView : public QIconView { 75class SampleView : public QIconView {
76public: 76public:
77 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) 77 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name )
78 { 78 {
79 setItemsMovable ( false ); 79 setItemsMovable ( false );
80 setAutoArrange ( true ); 80 setAutoArrange ( true );
81 setSorting ( true ); 81 setSorting ( true );
82 setFrameStyle ( QFrame::NoFrame ); 82 setFrameStyle ( QFrame::NoFrame );
83 setSpacing ( 4 ); 83 setSpacing ( 4 );
84 setMargin ( 0 ); 84 setMargin ( 0 );
85 setSelectionMode ( QIconView::NoSelection ); 85 setSelectionMode ( QIconView::NoSelection );
86 setBackgroundMode ( PaletteBase ); 86 setBackgroundMode ( PaletteBase );
87 setViewMode ( TabConfig::Icon ); 87 setViewMode ( TabConfig::Icon );
88 calculateGrid ( Bottom ); 88 calculateGrid ( Bottom );
89 89
90 90
91 new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); 91 new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" ));
92 new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); 92 new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" ));
93 new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); 93 new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" ));
94 94
95 setBackgroundType ( TabConfig::Ruled, QString::null ); 95 setBackgroundType ( TabConfig::Ruled, QString::null );
96 96
97 setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); 97 setMaximumHeight ( firstItem ( )-> height ( ) + 16 );
98 } 98 }
99 99
100 void setViewMode ( TabConfig::ViewMode m ) 100 void setViewMode ( TabConfig::ViewMode m )
101 { 101 {
102 viewport ( )-> setUpdatesEnabled ( false ); 102 viewport ( )-> setUpdatesEnabled ( false );
103 103
104 switch ( m ) { 104 switch ( m ) {
105 case TabConfig::List: 105 case TabConfig::List:
106 setItemTextPos( QIconView::Right ); 106 setItemTextPos( QIconView::Right );
107 break; 107 break;
108 case TabConfig::Icon: 108 case TabConfig::Icon:
109 setItemTextPos( QIconView::Bottom ); 109 setItemTextPos( QIconView::Bottom );
110 break; 110 break;
111 } 111 }
112 // hideOrShowItems ( false ); 112 // hideOrShowItems ( false );
113 113
114 for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) 114 for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( ))
115 ((SampleItem *) it )-> sizeChange ( ); 115 ((SampleItem *) it )-> sizeChange ( );
116 arrangeItemsInGrid ( true ); 116 arrangeItemsInGrid ( true );
117 viewport ( )-> setUpdatesEnabled ( true ); 117 viewport ( )-> setUpdatesEnabled ( true );
118 update ( ); 118 update ( );
119 } 119 }
120 120
121 121
122 void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) 122 void setBackgroundType( TabConfig::BackgroundType t, const QString &val )
123 { 123 {
124 switch ( t ) { 124 switch ( t ) {
125 case TabConfig::Ruled: { 125 case TabConfig::Ruled: {
126 QPixmap bg ( width ( ), 9 ); 126 QPixmap bg ( width ( ), 9 );
127 QPainter painter ( &bg ); 127 QPainter painter ( &bg );
128 for ( int i = 0; i < 3; i++ ) { 128 for ( int i = 0; i < 3; i++ ) {
129 painter. setPen ( white ); 129 painter. setPen ( white );
130 painter. drawLine ( 0, i*3, width()-1, i*3 ); 130 painter. drawLine ( 0, i*3, width()-1, i*3 );
131 painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); 131 painter. drawLine ( 0, i*3+1, width()-1, i*3+1 );
132 painter. setPen ( colorGroup().background().light(105) ); 132 painter. setPen ( colorGroup().background().light(105) );
133 painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); 133 painter. drawLine ( 0, i*3+2, width()-1, i*3+2 );
134 } 134 }
135 painter.end ( ); 135 painter.end ( );
136 setBackgroundPixmap ( bg ); 136 setBackgroundPixmap ( bg );
137 break; 137 break;
138 } 138 }
139 139
140 case TabConfig::SolidColor: { 140 case TabConfig::SolidColor: {
141 setBackgroundPixmap ( QPixmap ( )); 141 setBackgroundPixmap ( QPixmap ( ));
142 if ( val. isEmpty ( )) 142 if ( val. isEmpty ( ))
143 setBackgroundColor ( colorGroup ( ). base ( )); 143 setBackgroundColor ( colorGroup ( ). base ( ));
144 else 144 else
145 setBackgroundColor ( val ); 145 setBackgroundColor ( val );
146 break; 146 break;
147 } 147 }
148 148
149 case TabConfig::Image: { 149 case TabConfig::Image: {
150 qDebug( "Loading image: %s", val.latin1() ); 150 qDebug( "Loading image: %s", val.latin1() );
151 QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); 151 QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val ));
152 if ( bg. isNull ( )) { 152 if ( bg. isNull ( )) {
153 QImageIO imgio; 153 QImageIO imgio;
154 imgio. setFileName ( val ); 154 imgio. setFileName ( val );
155 QSize ds = qApp-> desktop ( )-> size ( ); 155 QSize ds = qApp-> desktop ( )-> size ( );
156 QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr 156 QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr
157 imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); 157 imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( ));
158 imgio. read ( ); 158 imgio. read ( );
159 bg = imgio. image ( ); 159 bg = imgio. image ( );
160 } 160 }
161 setBackgroundPixmap ( bg ); 161 setBackgroundPixmap ( bg );
162 break; 162 break;
163 } 163 }
164 } 164 }
165 m_bgtype = t; 165 m_bgtype = t;
166 viewport ( )-> update ( ); 166 viewport ( )-> update ( );
167 } 167 }
168 168
169 void setTextColor ( const QColor &tc ) 169 void setTextColor ( const QColor &tc )
170 { 170 {
171 m_textcolor = tc; 171 m_textcolor = tc;
172 QColorGroup cg = colorGroup ( ); 172 QColorGroup cg = colorGroup ( );
173 cg. setColor ( QColorGroup::Text, tc ); 173 cg. setColor ( QColorGroup::Text, tc );
174 setPalette ( QPalette ( cg, cg, cg )); 174 setPalette ( QPalette ( cg, cg, cg ));
175 viewport ( )-> update ( ); 175 viewport ( )-> update ( );
176 } 176 }
177 177
178 void setViewFont ( const QFont &f ) 178 void setViewFont ( const QFont &f )
179 { 179 {
180 setFont ( f ); 180 setFont ( f );
181 } 181 }
182 182
183 void setItemTextPos ( ItemTextPos pos ) 183 void setItemTextPos ( ItemTextPos pos )
184 { 184 {
185 calculateGrid ( pos ); 185 calculateGrid ( pos );
186 QIconView::setItemTextPos( pos ); 186 QIconView::setItemTextPos( pos );
187 } 187 }
188 188
189 void calculateGrid ( ItemTextPos pos ) 189 void calculateGrid ( ItemTextPos pos )
190 { 190 {
191 int dw = QApplication::desktop ( )-> width ( ); 191 int dw = QApplication::desktop ( )-> width ( );
192 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); 192 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( );
193 if ( pos == Bottom ) { 193 if ( pos == Bottom ) {
194 int cols = 3; 194 int cols = 3;
195 if ( viewerWidth <= 200 ) 195 if ( viewerWidth <= 200 )
196 cols = 2; 196 cols = 2;
197 else if ( viewerWidth >= 400 ) 197 else if ( viewerWidth >= 400 )
198 cols = viewerWidth/96; 198 cols = viewerWidth/96;
199 setSpacing ( 4 ); 199 setSpacing ( 4 );
200 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 200 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
201 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); 201 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 );
202 } 202 }
203 else { 203 else {
204 int cols = 2; 204 int cols = 2;
205 if ( viewerWidth < 150 ) 205 if ( viewerWidth < 150 )
206 cols = 1; 206 cols = 1;
207 else if ( viewerWidth >= 400 ) 207 else if ( viewerWidth >= 400 )
208 cols = viewerWidth / 150; 208 cols = viewerWidth / 150;
209 setSpacing ( 2 ); 209 setSpacing ( 2 );
210 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 210 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
211 setGridY ( fontMetrics ( ). height ( ) + 2 ); 211 setGridY ( fontMetrics ( ). height ( ) + 2 );
212 } 212 }
213 } 213 }
214 214
215 void paletteChange( const QPalette &p ) 215 void paletteChange( const QPalette &p )
216 { 216 {
217 static bool excllock = false; 217 static bool excllock = false;
218 218
219 if ( excllock ) 219 if ( excllock )
220 return; 220 return;
221 excllock = true; 221 excllock = true;
222 222
223 unsetPalette ( ); 223 unsetPalette ( );
224 QIconView::paletteChange ( p ); 224 QIconView::paletteChange ( p );
225 if ( m_bgtype == TabConfig::Ruled ) 225 if ( m_bgtype == TabConfig::Ruled )
226 setBackgroundType ( TabConfig::Ruled, QString::null ); 226 setBackgroundType ( TabConfig::Ruled, QString::null );
227 QColorGroup cg = colorGroup ( ); 227 QColorGroup cg = colorGroup ( );
228 cg.setColor ( QColorGroup::Text, m_textcolor ); 228 cg.setColor ( QColorGroup::Text, m_textcolor );
229 setPalette ( QPalette ( cg, cg, cg )); 229 setPalette ( QPalette ( cg, cg, cg ));
230 230
231 excllock = false; 231 excllock = false;
232 } 232 }
233 233
234 void setBackgroundPixmap ( const QPixmap &pm ) 234 void setBackgroundPixmap ( const QPixmap &pm )
235 { 235 {
236 m_bgpix = pm; 236 m_bgpix = pm;
237 } 237 }
238 238
239 void setBackgroundColor ( const QColor &c ) 239 void setBackgroundColor ( const QColor &c )
240 { 240 {
241 m_bgcolor = c; 241 m_bgcolor = c;
242 } 242 }
243 243
244 void drawBackground ( QPainter *p, const QRect &r ) 244 void drawBackground ( QPainter *p, const QRect &r )
245 { 245 {
246 if ( !m_bgpix. isNull ( )) { 246 if ( !m_bgpix. isNull ( )) {
247 p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), 247 p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ),
248 ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); 248 ( r. y ( ) + contentsY ( )) % m_bgpix. height ( )));
249 } 249 }
250 else 250 else
251 p-> fillRect ( r, m_bgcolor ); 251 p-> fillRect ( r, m_bgcolor );
252 } 252 }
253 253
254private: 254private:
255 QColor m_textcolor; 255 QColor m_textcolor;
256 QColor m_bgcolor; 256 QColor m_bgcolor;
257 QPixmap m_bgpix; 257 QPixmap m_bgpix;
258 TabConfig::BackgroundType m_bgtype; 258 TabConfig::BackgroundType m_bgtype;
259}; 259};
260 260
261 261
262 262
263TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) 263TabDialog::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 ) 264 : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc )
265{ 265{
266 setCaption ( tr( "Edit Tab" )); 266 setCaption ( tr( "Edit Tab" ));
267 267
268 QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); 268 QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 );
269 269
270 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 270 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
271 QWidget *bgtab; 271 QWidget *bgtab;
272 272
273 tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); 273 tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" ));
274 tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); 274 tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" ));
275 tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); 275 tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) );
276 276
277 tw-> setCurrentTab ( bgtab ); 277 tw-> setCurrentTab ( bgtab );
278 278
279 QWidget *sample = new QVBox ( this ); 279 QWidget *sample = new QVBox ( this );
280 QTabBar *tb = new QTabBar ( sample ); 280 QTabBar *tb = new QTabBar ( sample );
281 QString name ( tr( "Previewing %1" ). arg ( tabname )); 281 QString name ( tr( "Previewing %1" ). arg ( tabname ));
282 282
283 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); 283 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
284 284
285 m_sample = new SampleView ( sample ); 285 m_sample = new SampleView ( sample );
286 286
287 lay-> addWidget ( tw, 10 ); 287 lay-> addWidget ( tw, 10 );
288 lay-> addWidget ( sample, 1 ); 288 lay-> addWidget ( sample, 1 );
289 289
290 m_iconsize-> setButton ( tc. m_view ); 290 m_iconsize-> setButton ( tc. m_view );
291 iconSizeClicked ( tc. m_view ); 291 iconSizeClicked ( tc. m_view );
292 //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); 292 //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color ));
293 iconColorClicked ( m_iconcolor-> color ( )); 293 iconColorClicked ( m_iconcolor-> color ( ));
294 m_bgtype-> setButton ( tc. m_bg_type ); 294 m_bgtype-> setButton ( tc. m_bg_type );
295 //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); 295 //m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
296 m_bgimage = tc. m_bg_image; 296 m_bgimage = tc. m_bg_image;
297 bgTypeClicked ( tc. m_bg_type ); 297 bgTypeClicked ( tc. m_bg_type );
298 m_fontuse-> setChecked ( tc. m_font_use ); 298 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 )); 299 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 ( )); 300 m_fontselect-> setEnabled ( m_fontuse-> isChecked ( ));
301 fontClicked ( m_fontselect-> selectedFont ( )); 301 fontClicked ( m_fontselect-> selectedFont ( ));
302 302
303 QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); 303 QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." ));
304} 304}
305 305
306 306
307TabDialog::~TabDialog ( ) 307TabDialog::~TabDialog ( )
308{ 308{
309} 309}
310 310
311QWidget *TabDialog::createFontTab ( QWidget *parent ) 311QWidget *TabDialog::createFontTab ( QWidget *parent )
312{ 312{
313 QWidget *tab = new QWidget ( parent, "FontTab" ); 313 QWidget *tab = new QWidget ( parent, "FontTab" );
314 QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); 314 QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 );
315 315
316 m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); 316 m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab );
317 vertLayout-> addWidget ( m_fontuse ); 317 vertLayout-> addWidget ( m_fontuse );
318 318
319 m_fontselect = new OFontSelector ( false, tab, "fontsel" ); 319 m_fontselect = new OFontSelector ( false, tab, "fontsel" );
320 vertLayout-> addWidget ( m_fontselect ); 320 vertLayout-> addWidget ( m_fontselect );
321 321
322 connect ( m_fontuse, SIGNAL( toggled ( bool )), m_fontselect, SLOT( setEnabled ( bool ))); 322 connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool)));
323 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 323 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
324 this, SLOT( fontClicked ( const QFont & ))); 324 this, SLOT( fontClicked(const QFont&)));
325 325
326 return tab; 326 return tab;
327} 327}
328 328
329QWidget *TabDialog::createBgTab ( QWidget *parent ) 329QWidget *TabDialog::createBgTab ( QWidget *parent )
330{ 330{
331 QWidget *tab = new QWidget( parent, "BgTab" ); 331 QWidget *tab = new QWidget( parent, "BgTab" );
332 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 332 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
333 333
334 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 334 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
335 gridLayout-> setColStretch ( 1, 10 ); 335 gridLayout-> setColStretch ( 1, 10 );
336 336
337 QLabel* label = new QLabel( tr( "Type:" ), tab ); 337 QLabel* label = new QLabel( tr( "Type:" ), tab );
338 gridLayout-> addWidget ( label, 0, 0 ); 338 gridLayout-> addWidget ( label, 0, 0 );
339 m_bgtype = new QButtonGroup( tab, "buttongroup" ); 339 m_bgtype = new QButtonGroup( tab, "buttongroup" );
340 m_bgtype-> hide ( ); 340 m_bgtype-> hide ( );
341 m_bgtype-> setExclusive ( true ); 341 m_bgtype-> setExclusive ( true );
342 342
343 QRadioButton *rb; 343 QRadioButton *rb;
344 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); 344 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" );
345 m_bgtype-> insert ( rb, TabConfig::Ruled ); 345 m_bgtype-> insert ( rb, TabConfig::Ruled );
346 gridLayout-> addWidget( rb, 0, 1 ); 346 gridLayout-> addWidget( rb, 0, 1 );
347 347
348 QHBoxLayout *hb = new QHBoxLayout ( ); 348 QHBoxLayout *hb = new QHBoxLayout ( );
349 hb-> setSpacing ( 3 ); 349 hb-> setSpacing ( 3 );
350 350
351 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); 351 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
352 m_bgtype-> insert ( rb, TabConfig::SolidColor ); 352 m_bgtype-> insert ( rb, TabConfig::SolidColor );
353 hb-> addWidget ( rb ); 353 hb-> addWidget ( rb );
354 hb-> addSpacing ( 10 ); 354 hb-> addSpacing ( 10 );
355 355
356 m_solidcolor = new OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); 356 m_solidcolor = new OColorButton ( tab, QColor ( m_tc. m_bg_color ) );
357 connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); 357 connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&)));
358 hb-> addWidget ( m_solidcolor ); 358 hb-> addWidget ( m_solidcolor );
359 hb-> addStretch ( 10 ); 359 hb-> addStretch ( 10 );
360 360
361 gridLayout-> addLayout ( hb, 1, 1 ); 361 gridLayout-> addLayout ( hb, 1, 1 );
362 362
363 hb = new QHBoxLayout ( ); 363 hb = new QHBoxLayout ( );
364 hb-> setSpacing ( 3 ); 364 hb-> setSpacing ( 3 );
365 365
366 rb = new QRadioButton( tr( "Image" ), tab, "image" ); 366 rb = new QRadioButton( tr( "Image" ), tab, "image" );
367 m_bgtype-> insert ( rb, TabConfig::Image ); 367 m_bgtype-> insert ( rb, TabConfig::Image );
368 hb-> addWidget( rb ); 368 hb-> addWidget( rb );
369 hb-> addSpacing ( 10 ); 369 hb-> addSpacing ( 10 );
370 370
371 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); 371 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab );
372 connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); 372 connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked()));
373 hb-> addWidget ( m_imagebrowse ); 373 hb-> addWidget ( m_imagebrowse );
374 hb-> addStretch ( 10 ); 374 hb-> addStretch ( 10 );
375 375
376 gridLayout-> addLayout ( hb, 2, 1 ); 376 gridLayout-> addLayout ( hb, 2, 1 );
377 377
378 QPushButton *p = new QPushButton ( tr( "Default" ), tab ); 378 QPushButton *p = new QPushButton ( tr( "Default" ), tab );
379 connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); 379 connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked()));
380 gridLayout-> addWidget ( p, 3, 1 ); 380 gridLayout-> addWidget ( p, 3, 1 );
381 381
382 connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); 382 connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int)));
383 383
384 vertLayout-> addStretch ( 10 ); 384 vertLayout-> addStretch ( 10 );
385 385
386 return tab; 386 return tab;
387} 387}
388 388
389QWidget *TabDialog::createIconTab ( QWidget *parent ) 389QWidget *TabDialog::createIconTab ( QWidget *parent )
390{ 390{
391 QWidget *tab = new QWidget( parent, "IconTab" ); 391 QWidget *tab = new QWidget( parent, "IconTab" );
392 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 392 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
393 393
394 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 394 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
395 gridLayout-> setColStretch ( 1, 10 ); 395 gridLayout-> setColStretch ( 1, 10 );
396 396
397 QLabel* label = new QLabel( tr( "Size:" ), tab ); 397 QLabel* label = new QLabel( tr( "Size:" ), tab );
398 gridLayout-> addWidget ( label, 0, 0 ); 398 gridLayout-> addWidget ( label, 0, 0 );
399 m_iconsize = new QButtonGroup( tab, "buttongroup" ); 399 m_iconsize = new QButtonGroup( tab, "buttongroup" );
400 m_iconsize-> hide ( ); 400 m_iconsize-> hide ( );
401 m_iconsize-> setExclusive ( true ); 401 m_iconsize-> setExclusive ( true );
402 402
403 QRadioButton *rb; 403 QRadioButton *rb;
404 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); 404 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
405 m_iconsize-> insert ( rb, TabConfig::List ); 405 m_iconsize-> insert ( rb, TabConfig::List );
406 gridLayout-> addWidget( rb, 0, 1 ); 406 gridLayout-> addWidget( rb, 0, 1 );
407 407
408 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); 408 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" );
409 m_iconsize-> insert ( rb, TabConfig::Icon ); 409 m_iconsize-> insert ( rb, TabConfig::Icon );
410 gridLayout-> addWidget( rb, 1, 1 ); 410 gridLayout-> addWidget( rb, 1, 1 );
411 411
412 connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); 412 connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int)));
413 413
414 //vertLayout-> addSpacing ( 8 ); 414 //vertLayout-> addSpacing ( 8 );
415 415
416 //gridLayout = new QGridLayout ( vertLayout ); 416 //gridLayout = new QGridLayout ( vertLayout );
417 gridLayout-> addRowSpacing ( 2, 8 ); 417 gridLayout-> addRowSpacing ( 2, 8 );
418 418
419 label = new QLabel ( tr( "Color:" ), tab ); 419 label = new QLabel ( tr( "Color:" ), tab );
420 gridLayout-> addWidget ( label, 3, 0 ); 420 gridLayout-> addWidget ( label, 3, 0 );
421 421
422 m_iconcolor = new OColorButton ( tab, QColor ( m_tc. m_text_color ) ); 422 m_iconcolor = new OColorButton ( tab, QColor ( m_tc. m_text_color ) );
423 connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); 423 connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&)));
424 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); 424 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft );
425 425
426 vertLayout-> addStretch ( 10 ); 426 vertLayout-> addStretch ( 10 );
427 427
428 return tab; 428 return tab;
429} 429}
430 430
431 431
432void TabDialog::iconSizeClicked ( int s ) 432void TabDialog::iconSizeClicked ( int s )
433{ 433{
434 m_sample-> setViewMode ((TabConfig::ViewMode) s ); 434 m_sample-> setViewMode ((TabConfig::ViewMode) s );
435} 435}
436 436
437void TabDialog::fontClicked ( const QFont &f ) 437void TabDialog::fontClicked ( const QFont &f )
438{ 438{
439 m_sample-> setViewFont ( f ); 439 m_sample-> setViewFont ( f );
440} 440}
441 441
442void TabDialog::bgTypeClicked ( int t ) 442void TabDialog::bgTypeClicked ( int t )
443{ 443{
444 QString s; 444 QString s;
445 445
446 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) 446 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t )
447 m_bgtype-> setButton ( t ); 447 m_bgtype-> setButton ( t );
448 448
449 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); 449 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor );
450 m_imagebrowse-> setEnabled ( t == TabConfig::Image ); 450 m_imagebrowse-> setEnabled ( t == TabConfig::Image );
451 451
452 if ( t == TabConfig::SolidColor ) 452 if ( t == TabConfig::SolidColor )
453 s = m_solidcolor-> color ( ). name ( ); 453 s = m_solidcolor-> color ( ). name ( );
454 else if ( t == TabConfig::Image ) 454 else if ( t == TabConfig::Image )
455 s = Resource::findPixmap ( m_bgimage ); 455 s = Resource::findPixmap ( m_bgimage );
456 456
457 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); 457 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s );
458} 458}
459 459
460void TabDialog::bgColorClicked ( const QColor & ) 460void TabDialog::bgColorClicked ( const QColor & )
461{ 461{
462 bgTypeClicked ( TabConfig::SolidColor ); 462 bgTypeClicked ( TabConfig::SolidColor );
463} 463}
464 464
465void TabDialog::iconColorClicked ( const QColor &col ) 465void TabDialog::iconColorClicked ( const QColor &col )
466{ 466{
467 m_sample-> setTextColor ( col ); 467 m_sample-> setTextColor ( col );
468} 468}
469 469
470void TabDialog::bgImageClicked ( ) 470void TabDialog::bgImageClicked ( )
471{ 471{
472 // ### use OFileSelector here ### 472 // ### use OFileSelector here ###
473 // this is just a quick c&p from the old appearance app 473 // this is just a quick c&p from the old appearance app
474 474
475 MimeTypes types; 475 MimeTypes types;
476 QStringList list; 476 QStringList list;
477 list << "image/*"; 477 list << "image/*";
478 types. insert ( "Images", list ); 478 types. insert ( "Images", list );
479 479
480 QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); 480 QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types );
481 if ( !file. isEmpty ( )) { 481 if ( !file. isEmpty ( )) {
482 m_bgimage = DocLnk ( file ). file ( ); 482 m_bgimage = DocLnk ( file ). file ( );
483 bgTypeClicked ( TabConfig::Image ); 483 bgTypeClicked ( TabConfig::Image );
484 } 484 }
485} 485}
486 486
487void TabDialog::bgDefaultClicked ( ) 487void TabDialog::bgDefaultClicked ( )
488{ 488{
489 m_bgimage = "launcher/opie-background"; 489 m_bgimage = "launcher/opie-background";
490 bgTypeClicked ( TabConfig::Image ); 490 bgTypeClicked ( TabConfig::Image );
491} 491}
492 492
493void TabDialog::accept ( ) 493void TabDialog::accept ( )
494{ 494{
495 m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); 495 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 ( )); 496 m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( ));
497 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); 497 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( );
498 m_tc. m_bg_image = m_bgimage; 498 m_tc. m_bg_image = m_bgimage;
499 m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); 499 m_tc. m_text_color = m_iconcolor-> color ( ). name ( );
500 500
501 m_tc. m_font_use = m_fontuse-> isChecked ( ); 501 m_tc. m_font_use = m_fontuse-> isChecked ( );
502 502
503 if ( m_tc. m_font_use ) { 503 if ( m_tc. m_font_use ) {
504 QFont f = m_fontselect-> selectedFont ( ); 504 QFont f = m_fontselect-> selectedFont ( );
505 505
506 m_tc. m_font_family = f. family ( ); 506 m_tc. m_font_family = f. family ( );
507 m_tc. m_font_size = f. pointSize ( ); 507 m_tc. m_font_size = f. pointSize ( );
508 m_tc. m_font_weight = f. weight ( ); 508 m_tc. m_font_weight = f. weight ( );
509 m_tc. m_font_italic = f. italic ( ); 509 m_tc. m_font_italic = f. italic ( );
510 } 510 }
511 511
512 QDialog::accept ( ); 512 QDialog::accept ( );
513} 513}
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index 17a1609..e5a7087 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -1,317 +1,317 @@
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 "tabssettings.h" 28#include "tabssettings.h"
29 29
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qpe/applnk.h> 31#include <qpe/applnk.h>
32#include <qpe/mimetype.h> 32#include <qpe/mimetype.h>
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36 36
37#include <qlistbox.h> 37#include <qlistbox.h>
38#include <qpushbutton.h> 38#include <qpushbutton.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qwhatsthis.h> 41#include <qwhatsthis.h>
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43 43
44#include "tabdialog.h" 44#include "tabdialog.h"
45 45
46#include <stdlib.h> 46#include <stdlib.h>
47#include <qmessagebox.h> 47#include <qmessagebox.h>
48 48
49 49
50 #define GLOBALID ".global." 50 #define GLOBALID ".global."
51 51
52 52
53TabsSettings::TabsSettings ( QWidget *parent, const char *name ) 53TabsSettings::TabsSettings ( QWidget *parent, const char *name )
54 : QWidget ( parent, name ) 54 : QWidget ( parent, name )
55{ 55{
56 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); 56 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
57 57
58 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); 58 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
59 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); 59 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
60 60
61 m_list = new QListBox ( this ); 61 m_list = new QListBox ( this );
62 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); 62 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
63 63
64 QWhatsThis::add ( m_list, tr( "foobar" )); 64 QWhatsThis::add ( m_list, tr( "foobar" ));
65 65
66 QPushButton *p1, *p2, *p3; 66 QPushButton *p1, *p2, *p3;
67 p1 = new QPushButton ( tr( "New" ), this ); 67 p1 = new QPushButton ( tr( "New" ), this );
68 lay-> addWidget ( p1, 1, 1 ); 68 lay-> addWidget ( p1, 1, 1 );
69 connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); 69 connect ( p1, SIGNAL( clicked()), this, SLOT( newClicked()));
70 70
71 p2 = new QPushButton ( tr( "Edit" ), this ); 71 p2 = new QPushButton ( tr( "Edit" ), this );
72 lay-> addWidget ( p2, 2, 1 ); 72 lay-> addWidget ( p2, 2, 1 );
73 connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); 73 connect ( p2, SIGNAL( clicked()), this, SLOT( editClicked()));
74 74
75 p3 = new QPushButton ( tr( "Delete" ), this ); 75 p3 = new QPushButton ( tr( "Delete" ), this );
76 lay-> addWidget ( p3, 3, 1 ); 76 lay-> addWidget ( p3, 3, 1 );
77 connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); 77 connect ( p3, SIGNAL( clicked()), this, SLOT( deleteClicked()));
78 78
79 lay-> setRowStretch ( 4, 10 ); 79 lay-> setRowStretch ( 4, 10 );
80 80
81 m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); 81 m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this );
82 lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); 82 lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 );
83 83
84 m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); 84 m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this );
85 lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); 85 lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 );
86 86
87 p1-> setEnabled ( false ); 87 p1-> setEnabled ( false );
88 p3-> setEnabled ( false ); 88 p3-> setEnabled ( false );
89 89
90 init ( ); 90 init ( );
91 91
92 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); 92 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." ));
93 QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); 93 QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
94 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); 94 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." ));
95 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); 95 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
96 QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); 96 QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." ));
97 QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); 97 QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." ));
98} 98}
99 99
100void TabsSettings::init ( ) 100void TabsSettings::init ( )
101{ 101{
102 AppLnkSet rootFolder( MimeType::appsFolderName ( )); 102 AppLnkSet rootFolder( MimeType::appsFolderName ( ));
103 QStringList types = rootFolder. types ( ); 103 QStringList types = rootFolder. types ( );
104 104
105 m_list-> insertItem ( tr( "All Tabs" )); 105 m_list-> insertItem ( tr( "All Tabs" ));
106 m_ids << GLOBALID; 106 m_ids << GLOBALID;
107 107
108 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 108 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
109 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); 109 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
110 m_ids << *it; 110 m_ids << *it;
111 } 111 }
112 QImage img ( Resource::loadImage ( "DocsIcon" )); 112 QImage img ( Resource::loadImage ( "DocsIcon" ));
113 QPixmap pix; 113 QPixmap pix;
114 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); 114 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
115 m_list-> insertItem ( pix, tr( "Documents" )); 115 m_list-> insertItem ( pix, tr( "Documents" ));
116 m_ids += "Documents"; // No tr 116 m_ids += "Documents"; // No tr
117 117
118 Config cfg ( "Launcher" ); 118 Config cfg ( "Launcher" );
119 119
120 readTabSettings ( cfg ); 120 readTabSettings ( cfg );
121 121
122 cfg. setGroup ( "GUI" ); 122 cfg. setGroup ( "GUI" );
123 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); 123 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" );
124 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); 124 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) );
125} 125}
126 126
127 127
128void TabsSettings::readTabSettings ( Config &cfg ) 128void TabsSettings::readTabSettings ( Config &cfg )
129{ 129{
130 QString grp ( "Tab %1" ); // No tr 130 QString grp ( "Tab %1" ); // No tr
131 m_tabs. clear ( ); 131 m_tabs. clear ( );
132 132
133 TabConfig global_def; 133 TabConfig global_def;
134 global_def. m_view = TabConfig::Icon; 134 global_def. m_view = TabConfig::Icon;
135 global_def. m_bg_type = TabConfig::Ruled; 135 global_def. m_bg_type = TabConfig::Ruled;
136 global_def. m_bg_image = "launcher/opie-background"; 136 global_def. m_bg_image = "launcher/opie-background";
137 global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); 137 global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( );
138 global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); 138 global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( );
139 global_def. m_font_use = false; 139 global_def. m_font_use = false;
140 global_def. m_font_family = font ( ). family ( ); 140 global_def. m_font_family = font ( ). family ( );
141 global_def. m_font_size = font ( ). pointSize ( ); 141 global_def. m_font_size = font ( ). pointSize ( );
142 global_def. m_font_weight = 50; 142 global_def. m_font_weight = 50;
143 global_def. m_font_italic = false; 143 global_def. m_font_italic = false;
144 global_def. m_changed = false; 144 global_def. m_changed = false;
145 145
146 146
147 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 147 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
148 TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; 148 TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def;
149 149
150 cfg. setGroup ( grp. arg ( *it )); 150 cfg. setGroup ( grp. arg ( *it ));
151 151
152 QString view = cfg. readEntry ( "View" ); 152 QString view = cfg. readEntry ( "View" );
153 if ( view == "Icon" ) // No tr 153 if ( view == "Icon" ) // No tr
154 tc. m_view = TabConfig::Icon; 154 tc. m_view = TabConfig::Icon;
155 if ( view == "List" ) // No tr 155 if ( view == "List" ) // No tr
156 tc. m_view = TabConfig::List; 156 tc. m_view = TabConfig::List;
157 157
158 QString bgType = cfg. readEntry ( "BackgroundType" ); 158 QString bgType = cfg. readEntry ( "BackgroundType" );
159 if ( bgType == "Image" ) 159 if ( bgType == "Image" )
160 tc. m_bg_type = TabConfig::Image; 160 tc. m_bg_type = TabConfig::Image;
161 else if ( bgType == "SolidColor" ) 161 else if ( bgType == "SolidColor" )
162 tc. m_bg_type = TabConfig::SolidColor; 162 tc. m_bg_type = TabConfig::SolidColor;
163 else if ( bgType == "Image" ) // No tr 163 else if ( bgType == "Image" ) // No tr
164 tc. m_bg_type = TabConfig::Image; 164 tc. m_bg_type = TabConfig::Image;
165 165
166 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); 166 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image );
167 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); 167 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color );
168 tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); 168 tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color );
169 QStringList f = cfg. readListEntry ( "Font", ',' ); 169 QStringList f = cfg. readListEntry ( "Font", ',' );
170 if ( f. count ( ) == 4 ) { 170 if ( f. count ( ) == 4 ) {
171 tc. m_font_use = true; 171 tc. m_font_use = true;
172 tc. m_font_family = f [0]; 172 tc. m_font_family = f [0];
173 tc. m_font_size = f [1]. toInt ( ); 173 tc. m_font_size = f [1]. toInt ( );
174 tc. m_font_weight = f [2]. toInt ( ); 174 tc. m_font_weight = f [2]. toInt ( );
175 tc. m_font_italic = ( f [3]. toInt ( )); 175 tc. m_font_italic = ( f [3]. toInt ( ));
176 } 176 }
177 m_tabs [*it] = tc; 177 m_tabs [*it] = tc;
178 } 178 }
179 179
180 // if all tabs have the same config, then initialize the GLOBALID tab to these values 180 // if all tabs have the same config, then initialize the GLOBALID tab to these values
181 181
182 TabConfig *first = 0; 182 TabConfig *first = 0;
183 bool same = true; 183 bool same = true;
184 184
185 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 185 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
186 if ( *it == GLOBALID ) 186 if ( *it == GLOBALID )
187 continue; 187 continue;
188 else if ( !first ) 188 else if ( !first )
189 first = &m_tabs [*it]; 189 first = &m_tabs [*it];
190 else 190 else
191 same &= ( *first == m_tabs [*it] ); 191 same &= ( *first == m_tabs [*it] );
192 } 192 }
193 if ( same ) { 193 if ( same ) {
194 m_tabs [GLOBALID] = *first; 194 m_tabs [GLOBALID] = *first;
195 m_tabs [GLOBALID]. m_changed = true; 195 m_tabs [GLOBALID]. m_changed = true;
196 } 196 }
197} 197}
198 198
199 199
200void TabsSettings::accept ( ) 200void TabsSettings::accept ( )
201{ 201{
202 Config cfg ( "Launcher" ); 202 Config cfg ( "Launcher" );
203 203
204 // Launcher Tab 204 // Launcher Tab
205 QString grp ( "Tab %1" ); // No tr 205 QString grp ( "Tab %1" ); // No tr
206 206
207 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 207 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
208 TabConfig &tc = m_tabs [*it]; 208 TabConfig &tc = m_tabs [*it];
209 209
210 if ( !tc. m_changed ) 210 if ( !tc. m_changed )
211 continue; 211 continue;
212 212
213 cfg. setGroup ( grp. arg ( *it )); 213 cfg. setGroup ( grp. arg ( *it ));
214 switch ( tc. m_view ) { 214 switch ( tc. m_view ) {
215 case TabConfig::Icon: 215 case TabConfig::Icon:
216 cfg.writeEntry ( "View", "Icon" ); 216 cfg.writeEntry ( "View", "Icon" );
217 break; 217 break;
218 case TabConfig::List: 218 case TabConfig::List:
219 cfg.writeEntry ( "View", "List" ); 219 cfg.writeEntry ( "View", "List" );
220 break; 220 break;
221 } 221 }
222 222
223 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); 223 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
224 e << *it << tc. m_view; 224 e << *it << tc. m_view;
225 225
226 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); 226 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
227 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); 227 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
228 cfg. writeEntry ( "TextColor", tc. m_text_color ); 228 cfg. writeEntry ( "TextColor", tc. m_text_color );
229 229
230 if ( tc. m_font_use ) { 230 if ( tc. m_font_use ) {
231 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); 231 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" );
232 cfg. writeEntry ( "Font", f ); 232 cfg. writeEntry ( "Font", f );
233 } 233 }
234 else 234 else
235 cfg. removeEntry ( "Font" ); 235 cfg. removeEntry ( "Font" );
236 236
237 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); 237 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
238 238
239 switch ( tc. m_bg_type ) { 239 switch ( tc. m_bg_type ) {
240 case TabConfig::Ruled: 240 case TabConfig::Ruled:
241 cfg.writeEntry( "BackgroundType", "Ruled" ); 241 cfg.writeEntry( "BackgroundType", "Ruled" );
242 be << *it << tc. m_bg_type << QString(""); 242 be << *it << tc. m_bg_type << QString("");
243 break; 243 break;
244 case TabConfig::SolidColor: 244 case TabConfig::SolidColor:
245 cfg.writeEntry( "BackgroundType", "SolidColor" ); 245 cfg.writeEntry( "BackgroundType", "SolidColor" );
246 be << *it << tc. m_bg_type << tc. m_bg_color; 246 be << *it << tc. m_bg_type << tc. m_bg_color;
247 break; 247 break;
248 case TabConfig::Image: 248 case TabConfig::Image:
249 cfg.writeEntry( "BackgroundType", "Image" ); 249 cfg.writeEntry( "BackgroundType", "Image" );
250 be << *it << tc. m_bg_type << tc. m_bg_image; 250 be << *it << tc. m_bg_type << tc. m_bg_image;
251 break; 251 break;
252 } 252 }
253 253
254 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); 254 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
255 te << *it << tc. m_text_color; 255 te << *it << tc. m_text_color;
256 256
257 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); 257 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
258 fe << *it; 258 fe << *it;
259 fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); 259 fe << ( tc. m_font_use ? tc. m_font_family : QString::null );
260 fe << tc. m_font_size; 260 fe << tc. m_font_size;
261 fe << tc. m_font_weight; 261 fe << tc. m_font_weight;
262 fe << ( tc. m_font_italic ? 1 : 0 ); 262 fe << ( tc. m_font_italic ? 1 : 0 );
263 263
264 tc. m_changed = false; 264 tc. m_changed = false;
265 } 265 }
266 cfg. setGroup ( "GUI" ); 266 cfg. setGroup ( "GUI" );
267 QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); 267 QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" );
268 cfg. writeEntry ( "BusyType", busytype ); 268 cfg. writeEntry ( "BusyType", busytype );
269 269
270 cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); 270 cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) );
271 271
272 { 272 {
273 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); 273 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
274 e << busytype; 274 e << busytype;
275 } 275 }
276} 276}
277 277
278void TabsSettings::newClicked ( ) 278void TabsSettings::newClicked ( )
279{ 279{
280 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 280 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
281} 281}
282 282
283void TabsSettings::deleteClicked ( ) 283void TabsSettings::deleteClicked ( )
284{ 284{
285 int ind = m_list-> currentItem ( ); 285 int ind = m_list-> currentItem ( );
286 286
287 if ( ind < 0 ) 287 if ( ind < 0 )
288 return; 288 return;
289 289
290 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 290 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
291} 291}
292 292
293void TabsSettings::editClicked ( ) 293void TabsSettings::editClicked ( )
294{ 294{
295 int ind = m_list-> currentItem ( ); 295 int ind = m_list-> currentItem ( );
296 296
297 if ( ind < 0 ) 297 if ( ind < 0 )
298 return; 298 return;
299 299
300 TabConfig tc = m_tabs [m_ids [ind]]; 300 TabConfig tc = m_tabs [m_ids [ind]];
301 301
302 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); 302 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true );
303 303
304 if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) { 304 if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) {
305 tc. m_changed = true; 305 tc. m_changed = true;
306 m_tabs [m_ids [ind]] = tc; 306 m_tabs [m_ids [ind]] = tc;
307 307
308 if ( m_ids [ind] == GLOBALID ) { 308 if ( m_ids [ind] == GLOBALID ) {
309 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 309 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
310 if ( *it != GLOBALID ) 310 if ( *it != GLOBALID )
311 m_tabs [*it] = tc; 311 m_tabs [*it] = tc;
312 } 312 }
313 } 313 }
314 } 314 }
315 315
316 delete d; 316 delete d;
317} 317}
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index badb98f..43886c9 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -1,172 +1,172 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
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 "taskbarsettings.h" 29#include "taskbarsettings.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qlibrary.h> 32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/taskbarappletinterface.h> 34#include <qpe/taskbarappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qlistview.h> 38#include <qlistview.h>
39#include <qheader.h> 39#include <qheader.h>
40#include <qlayout.h> 40#include <qlayout.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qwhatsthis.h> 42#include <qwhatsthis.h>
43 43
44#include <stdlib.h> 44#include <stdlib.h>
45 45
46 46
47TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) 47TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name )
48 : QWidget ( parent, name ) 48 : QWidget ( parent, name )
49{ 49{
50 m_applets_changed = false; 50 m_applets_changed = false;
51 51
52 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 52 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
53 53
54 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); 54 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this );
55 lay-> addWidget ( l ); 55 lay-> addWidget ( l );
56 56
57 m_list = new QListView ( this ); 57 m_list = new QListView ( this );
58 m_list-> addColumn ( "foobar" ); 58 m_list-> addColumn ( "foobar" );
59 m_list-> header ( )-> hide ( ); 59 m_list-> header ( )-> hide ( );
60 60
61 lay-> addWidget ( m_list ); 61 lay-> addWidget ( m_list );
62 62
63 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); 63 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
64 64
65 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); 65 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
66 66
67 init ( ); 67 init ( );
68} 68}
69 69
70void TaskbarSettings::init ( ) 70void TaskbarSettings::init ( )
71{ 71{
72 Config cfg ( "Taskbar" ); 72 Config cfg ( "Taskbar" );
73 cfg. setGroup ( "Applets" ); 73 cfg. setGroup ( "Applets" );
74 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 74 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
75 75
76 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 76 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
77#ifdef Q_OS_MACX 77#ifdef Q_OS_MACX
78 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 78 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
79#else 79#else
80 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 80 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
81#endif /* Q_OS_MACX */ 81#endif /* Q_OS_MACX */
82 82
83 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 83 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
84 QString name; 84 QString name;
85 QPixmap icon; 85 QPixmap icon;
86 TaskbarNamedAppletInterface *iface = 0; 86 TaskbarNamedAppletInterface *iface = 0;
87 87
88 qWarning("Load applet: %s", (*it).latin1() ); 88 qWarning("Load applet: %s", (*it).latin1() );
89 QLibrary *lib = new QLibrary ( path + "/" + *it ); 89 QLibrary *lib = new QLibrary ( path + "/" + *it );
90 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); 90 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
91 qWarning("<1>"); 91 qWarning("<1>");
92 if ( iface ) { 92 if ( iface ) {
93 qWarning("<2>"); 93 qWarning("<2>");
94 QString lang = getenv( "LANG" ); 94 QString lang = getenv( "LANG" );
95 QTranslator *trans = new QTranslator ( qApp ); 95 QTranslator *trans = new QTranslator ( qApp );
96 QString type = (*it). left ((*it). find (".")); 96 QString type = (*it). left ((*it). find ("."));
97 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 97 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
98 if ( trans-> load ( tfn )) 98 if ( trans-> load ( tfn ))
99 qApp-> installTranslator ( trans ); 99 qApp-> installTranslator ( trans );
100 else 100 else
101 delete trans; 101 delete trans;
102 name = iface-> name ( ); 102 name = iface-> name ( );
103 icon = iface-> icon ( ); 103 icon = iface-> icon ( );
104 iface-> release ( ); 104 iface-> release ( );
105 } 105 }
106 qWarning("<3>"); 106 qWarning("<3>");
107 if ( !iface ) { 107 if ( !iface ) {
108 qWarning("<4>"); 108 qWarning("<4>");
109 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); 109 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
110 110
111 if ( iface ) { 111 if ( iface ) {
112 qWarning("<5>"); 112 qWarning("<5>");
113 name = (*it). mid ( 3 ); 113 name = (*it). mid ( 3 );
114 qWarning("Found applet: %s", name.latin1() ); 114 qWarning("Found applet: %s", name.latin1() );
115#ifdef Q_OS_MACX 115#ifdef Q_OS_MACX
116 int sep = name. find( ".dylib" ); 116 int sep = name. find( ".dylib" );
117#else 117#else
118 int sep = name. find( ".so" ); 118 int sep = name. find( ".so" );
119#endif /* Q_OS_MACX */ 119#endif /* Q_OS_MACX */
120 if ( sep > 0 ) 120 if ( sep > 0 )
121 name. truncate ( sep ); 121 name. truncate ( sep );
122 sep = name. find ( "applet" ); 122 sep = name. find ( "applet" );
123 if ( sep == (int) name.length ( ) - 6 ) 123 if ( sep == (int) name.length ( ) - 6 )
124 name. truncate ( sep ); 124 name. truncate ( sep );
125 name[0] = name[0]. upper ( ); 125 name[0] = name[0]. upper ( );
126 iface-> release ( ); 126 iface-> release ( );
127 } 127 }
128 } 128 }
129 qWarning("<6>"); 129 qWarning("<6>");
130 130
131 if ( iface ) { 131 if ( iface ) {
132 qWarning("<7>"); 132 qWarning("<7>");
133 QCheckListItem *item; 133 QCheckListItem *item;
134 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 134 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
135 if ( !icon. isNull ( )) 135 if ( !icon. isNull ( ))
136 item-> setPixmap ( 0, icon ); 136 item-> setPixmap ( 0, icon );
137 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 137 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
138 m_applets [*it] = item; 138 m_applets [*it] = item;
139 } 139 }
140 lib-> unload ( ); 140 lib-> unload ( );
141 delete lib; 141 delete lib;
142 } 142 }
143} 143}
144 144
145void TaskbarSettings::appletChanged() 145void TaskbarSettings::appletChanged()
146{ 146{
147 m_applets_changed = true; 147 m_applets_changed = true;
148} 148}
149 149
150void TaskbarSettings::accept ( ) 150void TaskbarSettings::accept ( )
151{ 151{
152 Config cfg ( "Taskbar" ); 152 Config cfg ( "Taskbar" );
153 cfg. setGroup ( "Applets" ); 153 cfg. setGroup ( "Applets" );
154 154
155 if ( m_applets_changed ) { 155 if ( m_applets_changed ) {
156 QStringList exclude; 156 QStringList exclude;
157 QMap <QString, QCheckListItem *>::Iterator it; 157 QMap <QString, QCheckListItem *>::Iterator it;
158 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 158 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
159 if ( !(*it)-> isOn ( )) 159 if ( !(*it)-> isOn ( ))
160 exclude << it. key ( ); 160 exclude << it. key ( );
161 } 161 }
162 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 162 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
163 } 163 }
164 cfg. writeEntry ( "SafeMode", false ); 164 cfg. writeEntry ( "SafeMode", false );
165 cfg. write ( ); 165 cfg. write ( );
166 166
167 if ( m_applets_changed ) { 167 if ( m_applets_changed ) {
168 QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); 168 QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" );
169 m_applets_changed = false; 169 m_applets_changed = false;
170 } 170 }
171} 171}
172 172
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 4baff8e..ce45836 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -1,313 +1,313 @@
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 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/power.h> 32#include <qpe/power.h>
33#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 33#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
34#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
35#endif 35#endif
36 36
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qcheckbox.h> 38#include <qcheckbox.h>
39#include <qtabwidget.h> 39#include <qtabwidget.h>
40#include <qslider.h> 40#include <qslider.h>
41#include <qspinbox.h> 41#include <qspinbox.h>
42#include <qpushbutton.h> 42#include <qpushbutton.h>
43#include <qgroupbox.h> 43#include <qgroupbox.h>
44#include <qcombobox.h> 44#include <qcombobox.h>
45 45
46#include <opie/odevice.h> 46#include <opie/odevice.h>
47 47
48#include "sensor.h" 48#include "sensor.h"
49 49
50using namespace Opie; 50using namespace Opie;
51 51
52LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) 52LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
53 : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) 53 : LightSettingsBase( parent, name, false, WStyle_ContextHelp )
54{ 54{
55 m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); 55 m_bres = ODevice::inst ( )-> displayBrightnessResolution ( );
56 m_cres = ODevice::inst ( )-> displayContrastResolution ( ); 56 m_cres = ODevice::inst ( )-> displayContrastResolution ( );
57 57
58 // check whether to show the light sensor stuff 58 // check whether to show the light sensor stuff
59 59
60 if ( !ODevice::inst ( )-> hasLightSensor ( )) { 60 if ( !ODevice::inst ( )-> hasLightSensor ( )) {
61 auto_brightness-> hide ( ); 61 auto_brightness-> hide ( );
62 CalibrateLightSensor-> hide ( ); 62 CalibrateLightSensor-> hide ( );
63 auto_brightness_ac-> hide ( ); 63 auto_brightness_ac-> hide ( );
64 CalibrateLightSensor_ac-> hide ( ); 64 CalibrateLightSensor_ac-> hide ( );
65 } 65 }
66 66
67 // check whether to show the contrast stuff 67 // check whether to show the contrast stuff
68 68
69 if (m_cres) { 69 if (m_cres) {
70 GroupLight->setTitle(tr("Backlight && Contrast")); 70 GroupLight->setTitle(tr("Backlight && Contrast"));
71 GroupLight_ac->setTitle(GroupLight->title()); 71 GroupLight_ac->setTitle(GroupLight->title());
72 } else { 72 } else {
73 contrast->hide(); 73 contrast->hide();
74 contrast_ac->hide(); 74 contrast_ac->hide();
75 } 75 }
76 76
77 // check whether to show the cpu frequency stuff 77 // check whether to show the cpu frequency stuff
78 78
79 QStrList freq = ODevice::inst()->allowedCpuFrequencies(); 79 QStrList freq = ODevice::inst()->allowedCpuFrequencies();
80 if ( freq.count() ) { 80 if ( freq.count() ) {
81 frequency->insertStrList( freq ); 81 frequency->insertStrList( freq );
82 frequency_ac->insertStrList( freq ); 82 frequency_ac->insertStrList( freq );
83 } else { 83 } else {
84 frequencyLabel->hide(); 84 frequencyLabel->hide();
85 frequency->hide(); 85 frequency->hide();
86 frequencyLabel_ac->hide(); 86 frequencyLabel_ac->hide();
87 frequency_ac->hide(); 87 frequency_ac->hide();
88 } 88 }
89 89
90 // check whether to show the hinge action stuff 90 // check whether to show the hinge action stuff
91 91
92 if ( !ODevice::inst()->hasHingeSensor() ) { 92 if ( !ODevice::inst()->hasHingeSensor() ) {
93 closeHingeLabel->hide(); 93 closeHingeLabel->hide();
94 closeHingeAction->hide(); 94 closeHingeAction->hide();
95 closeHingeLabel_ac->hide(); 95 closeHingeLabel_ac->hide();
96 closeHingeAction_ac->hide(); 96 closeHingeAction_ac->hide();
97 } 97 }
98 98
99 Config config ( "apm" ); 99 Config config ( "apm" );
100 config. setGroup ( "Battery" ); 100 config. setGroup ( "Battery" );
101 101
102 // battery spinboxes 102 // battery spinboxes
103 interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); 103 interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 ));
104 interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); 104 interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 ));
105 interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); 105 interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 ));
106 106
107 // battery check and slider 107 // battery check and slider
108 LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 108 LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
109 109
110 // CPU frequency 110 // CPU frequency
111 frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); 111 frequency->setCurrentItem( config.readNumEntry("Freq", 0) );
112 112
113 // hinge action 113 // hinge action
114 closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); 114 closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
115 115
116 int bright = config. readNumEntry ( "Brightness", 127 ); 116 int bright = config. readNumEntry ( "Brightness", 127 );
117 int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); 117 int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 );
118 brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); 118 brightness-> setTickInterval ( QMAX( 16, 256 / m_bres ));
119 brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); 119 brightness-> setLineStep ( QMAX( 1, 256 / m_bres ));
120 brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); 120 brightness-> setPageStep ( QMAX( 1, 256 / m_bres ));
121 brightness-> setValue ( bright ); 121 brightness-> setValue ( bright );
122 122
123 if (m_cres) { 123 if (m_cres) {
124 contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); 124 contrast-> setTickInterval ( QMAX( 16, 256 / m_cres ));
125 contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); 125 contrast-> setLineStep ( QMAX( 1, 256 / m_cres ));
126 contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); 126 contrast-> setPageStep ( QMAX( 1, 256 / m_cres ));
127 contrast-> setValue ( contr ); 127 contrast-> setValue ( contr );
128 } 128 }
129 129
130 // light sensor 130 // light sensor
131 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 131 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
132 m_sensordata = config. readListEntry ( "LightSensorData", ';' ); 132 m_sensordata = config. readListEntry ( "LightSensorData", ';' );
133 133
134 config. setGroup ( "AC" ); 134 config. setGroup ( "AC" );
135 135
136 // ac spinboxes 136 // ac spinboxes
137 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); 137 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 ));
138 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); 138 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 ));
139 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); 139 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 ));
140 140
141 // ac check and slider 141 // ac check and slider
142 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 142 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
143 143
144 // CPU frequency 144 // CPU frequency
145 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); 145 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) );
146 146
147 // hinge action 147 // hinge action
148 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); 148 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
149 149
150 bright = config. readNumEntry ( "Brightness", 255 ); 150 bright = config. readNumEntry ( "Brightness", 255 );
151 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); 151 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres ));
152 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); 152 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres ));
153 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); 153 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres ));
154 brightness_ac-> setValue ( bright ); 154 brightness_ac-> setValue ( bright );
155 155
156 if (m_cres) { 156 if (m_cres) {
157 contr = config. readNumEntry ( "Contrast", 127); 157 contr = config. readNumEntry ( "Contrast", 127);
158 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); 158 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres ));
159 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); 159 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres ));
160 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); 160 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres ));
161 contrast_ac-> setValue ( contr ); 161 contrast_ac-> setValue ( contr );
162 } 162 }
163 163
164 // light sensor 164 // light sensor
165 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 165 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
166 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); 166 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
167 167
168 // warnings 168 // warnings
169 config. setGroup ( "Warnings" ); 169 config. setGroup ( "Warnings" );
170 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); 170 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 );
171 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); 171 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) );
172 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); 172 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) );
173 173
174 m_resettimer = new QTimer ( this ); 174 m_resettimer = new QTimer ( this );
175 connect ( m_resettimer, SIGNAL( timeout ( )), this, SLOT( resetBacklight ( ))); 175 connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight()));
176 176
177 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { 177 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) {
178 tabs-> setCurrentPage ( 0 ); 178 tabs-> setCurrentPage ( 0 );
179 } 179 }
180 else { 180 else {
181 tabs-> setCurrentPage ( 1 ); 181 tabs-> setCurrentPage ( 1 );
182 } 182 }
183 183
184 connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 184 connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int)));
185 connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 185 connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int)));
186 if (m_cres) { 186 if (m_cres) {
187 connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); 187 connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int)));
188 connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); 188 connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int)));
189 } 189 }
190 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 190 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
191 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 191 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
192 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 192 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
193 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 193 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
194} 194}
195 195
196LightSettings::~LightSettings ( ) 196LightSettings::~LightSettings ( )
197{ 197{
198} 198}
199 199
200void LightSettings::calibrateSensor ( ) 200void LightSettings::calibrateSensor ( )
201{ 201{
202 Sensor *s = new Sensor ( m_sensordata, this ); 202 Sensor *s = new Sensor ( m_sensordata, this );
203 connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); 203 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int)));
204 QPEApplication::execDialog( s ); 204 QPEApplication::execDialog( s );
205 delete s; 205 delete s;
206} 206}
207 207
208void LightSettings::calibrateSensorAC ( ) 208void LightSettings::calibrateSensorAC ( )
209{ 209{
210 Sensor *s = new Sensor ( m_sensordata_ac, this ); 210 Sensor *s = new Sensor ( m_sensordata_ac, this );
211 connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); 211 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int)));
212 QPEApplication::execDialog ( s ); 212 QPEApplication::execDialog ( s );
213 delete s; 213 delete s;
214} 214}
215 215
216void LightSettings::setBacklight ( int bright ) 216void LightSettings::setBacklight ( int bright )
217{ 217{
218 QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); 218 QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
219 e << bright; 219 e << bright;
220 220
221 if ( bright != -1 ) { 221 if ( bright != -1 ) {
222 m_resettimer-> stop ( ); 222 m_resettimer-> stop ( );
223 m_resettimer-> start ( 4000, true ); 223 m_resettimer-> start ( 4000, true );
224 } 224 }
225} 225}
226 226
227void LightSettings::setContrast ( int contr ) 227void LightSettings::setContrast ( int contr )
228{ 228{
229 if (contr == -1) contr = m_oldcontrast; 229 if (contr == -1) contr = m_oldcontrast;
230 ODevice::inst ( )-> setDisplayContrast(contr); 230 ODevice::inst ( )-> setDisplayContrast(contr);
231} 231}
232 232
233void LightSettings::setFrequency ( int index ) 233void LightSettings::setFrequency ( int index )
234{ 234{
235 qWarning("LightSettings::setFrequency(%d)", index); 235 qWarning("LightSettings::setFrequency(%d)", index);
236 ODevice::inst ( )-> setCurrentCpuFrequency(index); 236 ODevice::inst ( )-> setCurrentCpuFrequency(index);
237} 237}
238 238
239void LightSettings::resetBacklight ( ) 239void LightSettings::resetBacklight ( )
240{ 240{
241 setBacklight ( -1 ); 241 setBacklight ( -1 );
242 setContrast ( -1 ); 242 setContrast ( -1 );
243} 243}
244 244
245void LightSettings::setCloseHingeAction ( int index ) 245void LightSettings::setCloseHingeAction ( int index )
246{ 246{
247 qWarning("LightSettings::setCloseHingeStatus(%d)", index); 247 qWarning("LightSettings::setCloseHingeStatus(%d)", index);
248} 248}
249 249
250void LightSettings::accept ( ) 250void LightSettings::accept ( )
251{ 251{
252 Config config ( "apm" ); 252 Config config ( "apm" );
253 253
254 // bat 254 // bat
255 config. setGroup ( "Battery" ); 255 config. setGroup ( "Battery" );
256 config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); 256 config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( ));
257 config. writeEntry ( "Dim", interval_dim-> value ( )); 257 config. writeEntry ( "Dim", interval_dim-> value ( ));
258 config. writeEntry ( "LightOff", interval_lightoff-> value ( )); 258 config. writeEntry ( "LightOff", interval_lightoff-> value ( ));
259 config. writeEntry ( "Suspend", interval_suspend-> value ( )); 259 config. writeEntry ( "Suspend", interval_suspend-> value ( ));
260 config. writeEntry ( "Brightness", brightness-> value () ); 260 config. writeEntry ( "Brightness", brightness-> value () );
261 if (m_cres) 261 if (m_cres)
262 config. writeEntry ( "Contrast", contrast-> value () ); 262 config. writeEntry ( "Contrast", contrast-> value () );
263 config. writeEntry ( "Freq", frequency->currentItem() ); 263 config. writeEntry ( "Freq", frequency->currentItem() );
264 config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); 264 config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() );
265 265
266 // ac 266 // ac
267 config. setGroup ( "AC" ); 267 config. setGroup ( "AC" );
268 config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); 268 config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( ));
269 config. writeEntry ( "Dim", interval_dim_ac-> value ( )); 269 config. writeEntry ( "Dim", interval_dim_ac-> value ( ));
270 config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); 270 config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( ));
271 config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); 271 config. writeEntry ( "Suspend", interval_suspend_ac-> value ( ));
272 config. writeEntry ( "Brightness", brightness_ac-> value () ); 272 config. writeEntry ( "Brightness", brightness_ac-> value () );
273 if (m_cres) 273 if (m_cres)
274 config. writeEntry ( "Contrast", contrast_ac-> value () ); 274 config. writeEntry ( "Contrast", contrast_ac-> value () );
275 config. writeEntry ( "Freq", frequency_ac->currentItem() ); 275 config. writeEntry ( "Freq", frequency_ac->currentItem() );
276 config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); 276 config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() );
277 277
278 // only make light sensor stuff appear if the unit has a sensor 278 // only make light sensor stuff appear if the unit has a sensor
279 if ( ODevice::inst ( )-> hasLightSensor ( )) { 279 if ( ODevice::inst ( )-> hasLightSensor ( )) {
280 config. setGroup ( "Battery" ); 280 config. setGroup ( "Battery" );
281 config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); 281 config. writeEntry ( "LightSensor", auto_brightness->isChecked() );
282 config. writeEntry ( "LightSensorData", m_sensordata, ';' ); 282 config. writeEntry ( "LightSensorData", m_sensordata, ';' );
283 config. setGroup ( "AC" ); 283 config. setGroup ( "AC" );
284 config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); 284 config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() );
285 config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); 285 config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' );
286 } 286 }
287 287
288 // advanced 288 // advanced
289 config. setGroup ( "Warnings" ); 289 config. setGroup ( "Warnings" );
290 config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); 290 config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 );
291 config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); 291 config. writeEntry ( "power_verylow", lowSpinBox-> value ( ));
292 config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); 292 config. writeEntry ( "power_critical", criticalSpinBox-> value ( ));
293 config. write ( ); 293 config. write ( );
294 294
295 // notify the launcher 295 // notify the launcher
296 { 296 {
297 QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); 297 QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" );
298 } 298 }
299 { 299 {
300 QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); 300 QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" );
301 e << -1; 301 e << -1;
302 } 302 }
303 LightSettingsBase::accept ( ); 303 LightSettingsBase::accept ( );
304} 304}
305 305
306void LightSettings::done ( int r ) 306void LightSettings::done ( int r )
307{ 307{
308 m_resettimer-> stop ( ); 308 m_resettimer-> stop ( );
309 resetBacklight ( ); 309 resetBacklight ( );
310 310
311 LightSettingsBase::done ( r ); 311 LightSettingsBase::done ( r );
312 close ( ); 312 close ( );
313} 313}
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp
index 41de851..013e655 100644
--- a/core/settings/light-and-power/sensor.cpp
+++ b/core/settings/light-and-power/sensor.cpp
@@ -1,102 +1,102 @@
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#include <qlayout.h> 28#include <qlayout.h>
29#include <qslider.h> 29#include <qslider.h>
30#include <qspinbox.h> 30#include <qspinbox.h>
31 31
32#include <opie/odevice.h> 32#include <opie/odevice.h>
33 33
34using namespace Opie; 34using namespace Opie;
35 35
36#include "calibration.h" 36#include "calibration.h"
37#include "sensor.h" 37#include "sensor.h"
38 38
39Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name ) 39Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name )
40 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params ) 40 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params )
41{ 41{
42 int steps = 12; 42 int steps = 12;
43 int inter = 2; 43 int inter = 2;
44 44
45 int smin = 40; 45 int smin = 40;
46 int smax = 215; 46 int smax = 215;
47 int lmin = 1; 47 int lmin = 1;
48 int lmax = 255; 48 int lmax = 255;
49 49
50 switch ( params. count ( )) { 50 switch ( params. count ( )) {
51 case 6: lmax = params [5]. toInt ( ); 51 case 6: lmax = params [5]. toInt ( );
52 case 5: lmin = params [4]. toInt ( ); 52 case 5: lmin = params [4]. toInt ( );
53 case 4: smax = params [3]. toInt ( ); 53 case 4: smax = params [3]. toInt ( );
54 case 3: smin = params [2]. toInt ( ); 54 case 3: smin = params [2]. toInt ( );
55 case 2: steps = params [1]. toInt ( ); 55 case 2: steps = params [1]. toInt ( );
56 case 1: inter = params [0]. toInt ( ) / 1000; 56 case 1: inter = params [0]. toInt ( ) / 1000;
57 } 57 }
58 58
59 int xscale = ODevice::inst ( )-> lightSensorResolution ( ); 59 int xscale = ODevice::inst ( )-> lightSensorResolution ( );
60 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); 60 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
61 61
62 QVBoxLayout *lay = new QVBoxLayout ( frame ); 62 QVBoxLayout *lay = new QVBoxLayout ( frame );
63 lay-> setMargin ( 2 ); 63 lay-> setMargin ( 2 );
64 m_calib = new Calibration ( frame ); 64 m_calib = new Calibration ( frame );
65 lay-> add ( m_calib ); 65 lay-> add ( m_calib );
66 66
67 m_calib-> setScale ( QSize ( xscale, yscale )); 67 m_calib-> setScale ( QSize ( xscale, yscale ));
68 m_calib-> setLineSteps ( steps ); 68 m_calib-> setLineSteps ( steps );
69 m_calib-> setInterval ( inter ); 69 m_calib-> setInterval ( inter );
70 m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 )); 70 m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 ));
71 m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 )); 71 m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 ));
72 72
73 interval-> setValue ( inter ); 73 interval-> setValue ( inter );
74 linesteps-> setValue ( steps ); 74 linesteps-> setValue ( steps );
75 75
76 connect ( interval, SIGNAL( valueChanged ( int )), m_calib, SLOT( setInterval ( int ))); 76 connect ( interval, SIGNAL( valueChanged(int)), m_calib, SLOT( setInterval(int)));
77 connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int ))); 77 connect ( linesteps, SIGNAL( valueChanged(int)), m_calib, SLOT( setLineSteps(int)));
78 78
79 connect ( m_calib, SIGNAL( startPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & ))); 79 connect ( m_calib, SIGNAL( startPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&)));
80 connect ( m_calib, SIGNAL( endPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & ))); 80 connect ( m_calib, SIGNAL( endPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&)));
81} 81}
82 82
83void Sensor::accept ( ) 83void Sensor::accept ( )
84{ 84{
85 int xscale = ODevice::inst ( )-> lightSensorResolution ( ); 85 int xscale = ODevice::inst ( )-> lightSensorResolution ( );
86 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); 86 int yscale = ODevice::inst ( )-> displayBrightnessResolution ( );
87 87
88 m_params. clear ( ); 88 m_params. clear ( );
89 m_params << QString::number ( m_calib-> interval ( ) * 1000 ) 89 m_params << QString::number ( m_calib-> interval ( ) * 1000 )
90 << QString::number ( m_calib-> lineSteps ( )) 90 << QString::number ( m_calib-> lineSteps ( ))
91 << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale ) 91 << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale )
92 << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale ) 92 << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale )
93 << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale ) 93 << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale )
94 << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale ); 94 << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale );
95 95
96 QDialog::accept ( ); 96 QDialog::accept ( );
97} 97}
98 98
99void Sensor::pointDrag ( const QPoint &p ) 99void Sensor::pointDrag ( const QPoint &p )
100{ 100{
101 emit viewBacklight ( p. y ( )); 101 emit viewBacklight ( p. y ( ));
102} 102}