summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-26 01:14:30 (UTC)
committer sandman <sandman>2002-09-26 01:14:30 (UTC)
commit056f01ffc3b32de4dbf4fca79917198951e59d60 (patch) (unidiff)
tree7c3331a038a85480c120b92dddb6277d97fe81da
parent8c831e3a8cc9cf7ee120a3a227b6698aa797f740 (diff)
downloadopie-056f01ffc3b32de4dbf4fca79917198951e59d60.zip
opie-056f01ffc3b32de4dbf4fca79917198951e59d60.tar.gz
opie-056f01ffc3b32de4dbf4fca79917198951e59d60.tar.bz2
Corrected the copyright headers (LGPL -> GPL)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp31
-rw-r--r--noncore/settings/appearance2/appearance.h30
-rw-r--r--noncore/settings/appearance2/colorlistitem.h27
-rw-r--r--noncore/settings/appearance2/decolistitem.h28
-rw-r--r--noncore/settings/appearance2/editScheme.cpp30
-rw-r--r--noncore/settings/appearance2/editScheme.h30
-rw-r--r--noncore/settings/appearance2/main.cpp27
-rw-r--r--noncore/settings/appearance2/sample.cpp27
-rw-r--r--noncore/settings/appearance2/sample.h27
-rw-r--r--noncore/settings/appearance2/stylelistitem.h27
10 files changed, 140 insertions, 144 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 66cf2c3..a5d216c 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -1,408 +1,409 @@
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>
4 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 5             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 6           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 13    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: details. 20++=   -.     .`     .:
19 :     =  ...= . :.=- 21 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` Free Software Foundation, Inc.,
23 If not, write to the Free Software Foundation, 25 59 Temple Place - Suite 330,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
26 27
27*/ 28*/
28 29
29#include "appearance.h" 30#include "appearance.h"
30#include "editScheme.h" 31#include "editScheme.h"
31 32
32#include <opie/ofiledialog.h> 33#include <opie/ofiledialog.h>
33#include <opie/otabwidget.h> 34#include <opie/otabwidget.h>
34 35
35#include <qpe/applnk.h> 36#include <qpe/applnk.h>
36#include <qpe/config.h> 37#include <qpe/config.h>
37#include <qpe/global.h> 38#include <qpe/global.h>
38#include <qpe/resource.h> 39#include <qpe/resource.h>
39#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
40#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 41#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
41#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
42#endif 43#endif
43 44
44#include <qaction.h> 45#include <qaction.h>
45#include <qbuttongroup.h> 46#include <qbuttongroup.h>
46#include <qcheckbox.h> 47#include <qcheckbox.h>
47#include <qcombobox.h> 48#include <qcombobox.h>
48#include <qdialog.h> 49#include <qdialog.h>
49#include <qdir.h> 50#include <qdir.h>
50#include <qlabel.h> 51#include <qlabel.h>
51#include <qlayout.h> 52#include <qlayout.h>
52#include <qlineedit.h> 53#include <qlineedit.h>
53#include <qlistbox.h> 54#include <qlistbox.h>
54#include <qmessagebox.h> 55#include <qmessagebox.h>
55#include <qmultilineedit.h> 56#include <qmultilineedit.h>
56#include <qpopupmenu.h> 57#include <qpopupmenu.h>
57#include <qpushbutton.h> 58#include <qpushbutton.h>
58#include <qradiobutton.h> 59#include <qradiobutton.h>
59#if QT_VERSION >= 300 60#if QT_VERSION >= 300
60#include <qstylefactory.h> 61#include <qstylefactory.h>
61#else 62#else
62#include <qwindowsstyle.h> 63#include <qwindowsstyle.h>
63#include <qpe/qpestyle.h> 64#include <qpe/qpestyle.h>
64#include <qpe/lightstyle.h> 65#include <qpe/lightstyle.h>
65#include <qpe/qlibrary.h> 66#include <qpe/qlibrary.h>
66#include <qpe/styleinterface.h> 67#include <qpe/styleinterface.h>
67#endif 68#endif
68#include <qtabwidget.h> 69#include <qtabwidget.h>
69#include <qtoolbutton.h> 70#include <qtoolbutton.h>
70#include <qvgroupbox.h> 71#include <qvgroupbox.h>
71#include <qwidget.h> 72#include <qwidget.h>
72 73
73#include "stylelistitem.h" 74#include "stylelistitem.h"
74#include "decolistitem.h" 75#include "decolistitem.h"
75#include "colorlistitem.h" 76#include "colorlistitem.h"
76 77
77#include "sample.h" 78#include "sample.h"
78 79
79#include <opie/ofontselector.h> 80#include <opie/ofontselector.h>
80 81
81 82
82class DefaultWindowDecoration : public WindowDecorationInterface 83class DefaultWindowDecoration : public WindowDecorationInterface
83{ 84{
84public: 85public:
85 DefaultWindowDecoration() : ref(0) {} 86 DefaultWindowDecoration() : ref(0) {}
86 QString name() const { 87 QString name() const {
87 return "Default"; 88 return "Default";
88 } 89 }
89 QPixmap icon() const { 90 QPixmap icon() const {
90 return QPixmap(); 91 return QPixmap();
91 } 92 }
92 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 93 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
93 *iface = 0; 94 *iface = 0;
94 if ( uuid == IID_QUnknown ) 95 if ( uuid == IID_QUnknown )
95 *iface = this; 96 *iface = this;
96 else if ( uuid == IID_WindowDecoration ) 97 else if ( uuid == IID_WindowDecoration )
97 *iface = this; 98 *iface = this;
98 99
99 if ( *iface ) 100 if ( *iface )
100 (*iface)->addRef(); 101 (*iface)->addRef();
101 return QS_OK; 102 return QS_OK;
102 } 103 }
103 Q_REFCOUNT 104 Q_REFCOUNT
104 105
105private: 106private:
106 ulong ref; 107 ulong ref;
107}; 108};
108 109
109 110
110 111
111void Appearance::loadStyles ( QListBox *list ) 112void Appearance::loadStyles ( QListBox *list )
112{ 113{
113#if QT_VERSION >= 300 114#if QT_VERSION >= 300
114 list->insertStringList(QStyleFactory::styles()); 115 list->insertStringList(QStyleFactory::styles());
115#else 116#else
116 list->insertItem( new StyleListItem ( "Windows", new QWindowsStyle ( ))); 117 list->insertItem( new StyleListItem ( "Windows", new QWindowsStyle ( )));
117 list->insertItem( new StyleListItem ( "Light", new LightStyle ( ))); 118 list->insertItem( new StyleListItem ( "Light", new LightStyle ( )));
118#ifndef QT_NO_STYLE_MOTIF 119#ifndef QT_NO_STYLE_MOTIF
119 list->insertItem( new StyleListItem ( "Motif", new QMotifStyle ( ))); 120 list->insertItem( new StyleListItem ( "Motif", new QMotifStyle ( )));
120#endif 121#endif
121#ifndef QT_NO_STYLE_MOTIFPLUS 122#ifndef QT_NO_STYLE_MOTIFPLUS
122 list->insertItem( new StyleListItem ( "MotifPlus", new QMotifPlusStyle ( ))); 123 list->insertItem( new StyleListItem ( "MotifPlus", new QMotifPlusStyle ( )));
123#endif 124#endif
124#ifndef QT_NO_STYLE_PLATINUM 125#ifndef QT_NO_STYLE_PLATINUM
125 list->insertItem( new StyleListItem ( "Platinum", new QPlatinumStyle ( ))); 126 list->insertItem( new StyleListItem ( "Platinum", new QPlatinumStyle ( )));
126#endif 127#endif
127#endif 128#endif
128 list->insertItem( new StyleListItem ( "QPE", new QPEStyle ( ))); 129 list->insertItem( new StyleListItem ( "QPE", new QPEStyle ( )));
129 130
130#if QT_VERSION < 300 131#if QT_VERSION < 300
131 { 132 {
132 QString path = QPEApplication::qpeDir() + "/plugins/styles/"; 133 QString path = QPEApplication::qpeDir() + "/plugins/styles/";
133 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 134 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
134 135
135 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 136 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
136 QLibrary *lib = new QLibrary ( path + "/" + *it ); 137 QLibrary *lib = new QLibrary ( path + "/" + *it );
137 StyleInterface *iface; 138 StyleInterface *iface;
138 139
139 if ( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) 140 if ( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK )
140 list-> insertItem ( new StyleListItem ( lib, iface )); 141 list-> insertItem ( new StyleListItem ( lib, iface ));
141 else 142 else
142 delete lib; 143 delete lib;
143 } 144 }
144 } 145 }
145 146
146#endif 147#endif
147} 148}
148 149
149void Appearance::loadDecos ( QListBox *list ) 150void Appearance::loadDecos ( QListBox *list )
150{ 151{
151 list-> insertItem ( new DecoListItem ( tr( "Default" ))); 152 list-> insertItem ( new DecoListItem ( tr( "Default" )));
152 153
153 { 154 {
154 QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; 155 QString path = QPEApplication::qpeDir() + "/plugins/decorations/";
155 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 156 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
156 157
157 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 158 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
158 QLibrary *lib = new QLibrary ( path + "/" + *it ); 159 QLibrary *lib = new QLibrary ( path + "/" + *it );
159 WindowDecorationInterface *iface; 160 WindowDecorationInterface *iface;
160 161
161 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) 162 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK )
162 list-> insertItem ( new DecoListItem ( lib, iface )); 163 list-> insertItem ( new DecoListItem ( lib, iface ));
163 else 164 else
164 delete lib; 165 delete lib;
165 } 166 }
166 } 167 }
167} 168}
168 169
169void Appearance::loadColors ( QListBox *list ) 170void Appearance::loadColors ( QListBox *list )
170{ 171{
171 list-> clear ( ); 172 list-> clear ( );
172 { 173 {
173 Config config ( "qpe" ); 174 Config config ( "qpe" );
174 config. setGroup ( "Appearance" ); 175 config. setGroup ( "Appearance" );
175 176
176 list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), config )); 177 list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), config ));
177 } 178 }
178 179
179 QString path = QPEApplication::qpeDir ( ) + "/etc/colors/"; 180 QString path = QPEApplication::qpeDir ( ) + "/etc/colors/";
180 QStringList sl = QDir ( path ). entryList ( "*.scheme" ); 181 QStringList sl = QDir ( path ). entryList ( "*.scheme" );
181 182
182 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 183 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
183 QString name = (*it). left ((*it). find ( ".scheme" )); 184 QString name = (*it). left ((*it). find ( ".scheme" ));
184 Config config ( path + *it, Config::File ); 185 Config config ( path + *it, Config::File );
185 config. setGroup ( "Colors" ); 186 config. setGroup ( "Colors" );
186 187
187 list-> insertItem ( new ColorListItem ( name, config )); 188 list-> insertItem ( new ColorListItem ( name, config ));
188 } 189 }
189} 190}
190 191
191 192
192QWidget *Appearance::createStyleTab ( QWidget *parent ) 193QWidget *Appearance::createStyleTab ( QWidget *parent )
193{ 194{
194 Config config ( "qpe" ); 195 Config config ( "qpe" );
195 config. setGroup ( "Appearance" ); 196 config. setGroup ( "Appearance" );
196 197
197 QWidget* tab = new QWidget( parent, "StyleTab" ); 198 QWidget* tab = new QWidget( parent, "StyleTab" );
198 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 ); 199 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 );
199 200
200 m_style_list = new QListBox( tab, "m_style_list" ); 201 m_style_list = new QListBox( tab, "m_style_list" );
201 vertLayout->addWidget( m_style_list ); 202 vertLayout->addWidget( m_style_list );
202 203
203 m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); 204 m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
204 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); 205 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( )));
205 vertLayout-> addWidget ( m_style_settings ); 206 vertLayout-> addWidget ( m_style_settings );
206 207
207 loadStyles ( m_style_list ); 208 loadStyles ( m_style_list );
208 209
209 QString s = config. readEntry ( "Style", "Light" ); 210 QString s = config. readEntry ( "Style", "Light" );
210 m_style_list-> setCurrentItem ( m_style_list-> findItem ( s )); 211 m_style_list-> setCurrentItem ( m_style_list-> findItem ( s ));
211 m_original_style = m_style_list-> currentItem ( ); 212 m_original_style = m_style_list-> currentItem ( );
212 styleClicked ( m_original_style ); 213 styleClicked ( m_original_style );
213 214
214 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); 215 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) );
215 216
216 return tab; 217 return tab;
217} 218}
218 219
219QWidget *Appearance::createDecoTab ( QWidget *parent ) 220QWidget *Appearance::createDecoTab ( QWidget *parent )
220{ 221{
221 Config config ( "qpe" ); 222 Config config ( "qpe" );
222 config. setGroup ( "Appearance" ); 223 config. setGroup ( "Appearance" );
223 224
224 QWidget* tab = new QWidget( parent, "DecoTab" ); 225 QWidget* tab = new QWidget( parent, "DecoTab" );
225 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 ); 226 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 );
226 227
227 m_deco_list = new QListBox( tab, "m_deco_list" ); 228 m_deco_list = new QListBox( tab, "m_deco_list" );
228 vertLayout->addWidget( m_deco_list ); 229 vertLayout->addWidget( m_deco_list );
229 230
230 loadDecos ( m_deco_list ); 231 loadDecos ( m_deco_list );
231 232
232 QString s = config. readEntry ( "Decoration" ); 233 QString s = config. readEntry ( "Decoration" );
233 m_deco_list-> setCurrentItem ( m_deco_list-> findItem ( s )); 234 m_deco_list-> setCurrentItem ( m_deco_list-> findItem ( s ));
234 m_original_deco = m_deco_list-> currentItem ( ); 235 m_original_deco = m_deco_list-> currentItem ( );
235 if ( m_deco_list-> currentItem ( ) < 0 ) 236 if ( m_deco_list-> currentItem ( ) < 0 )
236 m_deco_list-> setCurrentItem ( 0 ); 237 m_deco_list-> setCurrentItem ( 0 );
237 decoClicked ( m_original_deco ); 238 decoClicked ( m_original_deco );
238 239
239 connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); 240 connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) );
240 241
241 return tab; 242 return tab;
242} 243}
243 244
244QWidget *Appearance::createFontTab ( QWidget *parent ) 245QWidget *Appearance::createFontTab ( QWidget *parent )
245{ 246{
246 Config config ( "qpe" ); 247 Config config ( "qpe" );
247 config. setGroup ( "Appearance" ); 248 config. setGroup ( "Appearance" );
248 249
249 QString familyStr = config.readEntry( "FontFamily", "Helvetica" ); 250 QString familyStr = config.readEntry( "FontFamily", "Helvetica" );
250 QString styleStr = config.readEntry( "FontStyle", "Regular" ); 251 QString styleStr = config.readEntry( "FontStyle", "Regular" );
251 int size = config.readNumEntry( "FontSize", 10 ); 252 int size = config.readNumEntry( "FontSize", 10 );
252 253
253 m_fontselect = new OFontSelector ( parent, "FontTab" ); 254 m_fontselect = new OFontSelector ( parent, "FontTab" );
254 m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); 255 m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
255 256
256 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 257 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
257 this, SLOT( fontClicked ( const QFont & ))); 258 this, SLOT( fontClicked ( const QFont & )));
258 259
259 return m_fontselect; 260 return m_fontselect;
260} 261}
261 262
262QWidget *Appearance::createColorTab ( QWidget *parent ) 263QWidget *Appearance::createColorTab ( QWidget *parent )
263{ 264{
264 Config config ( "qpe" ); 265 Config config ( "qpe" );
265 config. setGroup ( "Appearance" ); 266 config. setGroup ( "Appearance" );
266 267
267 268
268 QWidget *tab = new QWidget( parent, "ColorTab" ); 269 QWidget *tab = new QWidget( parent, "ColorTab" );
269 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 4, 4 ); 270 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 4, 4 );
270 gridLayout->setRowStretch ( 3, 10 ); 271 gridLayout->setRowStretch ( 3, 10 );
271 272
272 m_color_list = new QListBox ( tab ); 273 m_color_list = new QListBox ( tab );
273 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); 274 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 );
274 connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); 275 connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) );
275 276
276 loadColors ( m_color_list ); 277 loadColors ( m_color_list );
277 m_color_list-> setCurrentItem ( 0 ); 278 m_color_list-> setCurrentItem ( 0 );
278 279
279 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); 280 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" );
280 tempButton->setText( tr( "Edit..." ) ); 281 tempButton->setText( tr( "Edit..." ) );
281 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); 282 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) );
282 gridLayout->addWidget( tempButton, 0, 1 ); 283 gridLayout->addWidget( tempButton, 0, 1 );
283 284
284 tempButton = new QPushButton( tab, "deleteSchemeButton" ); 285 tempButton = new QPushButton( tab, "deleteSchemeButton" );
285 tempButton->setText( tr( "Delete" ) ); 286 tempButton->setText( tr( "Delete" ) );
286 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); 287 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) );
287 gridLayout->addWidget( tempButton, 1, 1 ); 288 gridLayout->addWidget( tempButton, 1, 1 );
288 289
289 tempButton = new QPushButton( tab, "saveSchemeButton" ); 290 tempButton = new QPushButton( tab, "saveSchemeButton" );
290 tempButton->setText( tr( "Save" ) ); 291 tempButton->setText( tr( "Save" ) );
291 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); 292 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) );
292 gridLayout->addWidget( tempButton, 2, 1 ); 293 gridLayout->addWidget( tempButton, 2, 1 );
293 294
294 return tab; 295 return tab;
295} 296}
296 297
297QWidget *Appearance::createGuiTab ( QWidget *parent ) 298QWidget *Appearance::createGuiTab ( QWidget *parent )
298{ 299{
299 Config config ( "qpe" ); 300 Config config ( "qpe" );
300 config. setGroup ( "Appearance" ); 301 config. setGroup ( "Appearance" );
301 302
302 QWidget *tab = new QWidget( parent, "AdvancedTab" ); 303 QWidget *tab = new QWidget( parent, "AdvancedTab" );
303 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); 304 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
304 305
305 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 306 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
306 307
307 int style = config. readNumEntry ( "TabStyle", 2 ) - 1; 308 int style = config. readNumEntry ( "TabStyle", 2 ) - 1;
308 bool tabtop = ( config. readEntry ( "TabPosition", "Top" ) == "Top" ); 309 bool tabtop = ( config. readEntry ( "TabPosition", "Top" ) == "Top" );
309 310
310 QLabel* label = new QLabel( tr( "Tab style:" ), tab ); 311 QLabel* label = new QLabel( tr( "Tab style:" ), tab );
311 gridLayout-> addWidget ( label, 0, 0 ); 312 gridLayout-> addWidget ( label, 0, 0 );
312 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); 313 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
313 btngrp-> hide ( ); 314 btngrp-> hide ( );
314 btngrp-> setExclusive ( true ); 315 btngrp-> setExclusive ( true );
315 316
316 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); 317 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
317 m_tabstyle_list-> insertItem ( tr( "Tabs" )); 318 m_tabstyle_list-> insertItem ( tr( "Tabs" ));
318 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); 319 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
319 m_tabstyle_list-> insertItem ( tr( "Drop down list" )); 320 m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
320 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); 321 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
321 m_tabstyle_list-> setCurrentItem ( style ); 322 m_tabstyle_list-> setCurrentItem ( style );
322 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); 323 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
323 324
324 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); 325 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
325 btngrp-> insert ( m_tabstyle_top ); 326 btngrp-> insert ( m_tabstyle_top );
326 gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); 327 gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
327 328
328 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); 329 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
329 btngrp-> insert ( m_tabstyle_bottom ); 330 btngrp-> insert ( m_tabstyle_bottom );
330 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); 331 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
331 332
332 m_tabstyle_top-> setChecked ( tabtop ); 333 m_tabstyle_top-> setChecked ( tabtop );
333 m_tabstyle_bottom-> setChecked ( !tabtop ); 334 m_tabstyle_bottom-> setChecked ( !tabtop );
334 335
335 m_original_tabstyle = style; 336 m_original_tabstyle = style;
336 m_original_tabpos = tabtop; 337 m_original_tabpos = tabtop;
337 338
338 return tab; 339 return tab;
339} 340}
340 341
341 342
342Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 343Appearance::Appearance( QWidget* parent, const char* name, WFlags )
343 : QDialog ( parent, name, true ) 344 : QDialog ( parent, name, true )
344{ 345{
345 setCaption( tr( "Appearance" ) ); 346 setCaption( tr( "Appearance" ) );
346 347
347 Config config( "qpe" ); 348 Config config( "qpe" );
348 config.setGroup( "Appearance" ); 349 config.setGroup( "Appearance" );
349 350
350 QVBoxLayout *top = new QVBoxLayout ( this, 4, 4 ); 351 QVBoxLayout *top = new QVBoxLayout ( this, 4, 4 );
351 352
352 m_sample = new SampleWindow ( this ); 353 m_sample = new SampleWindow ( this );
353 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 354 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
354 355
355 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 356 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
356 QWidget *styletab; 357 QWidget *styletab;
357 358
358 tw-> addTab ( styletab = createStyleTab ( tw ), "appearance/styletabicon.png", tr( "Style" )); 359 tw-> addTab ( styletab = createStyleTab ( tw ), "appearance/styletabicon.png", tr( "Style" ));
359 tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); 360 tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" ));
360 tw-> addTab ( createColorTab ( tw ), "appearance/colorstabicon.png", tr( "Colors" ) ); 361 tw-> addTab ( createColorTab ( tw ), "appearance/colorstabicon.png", tr( "Colors" ) );
361 tw-> addTab ( createDecoTab ( tw ), "appearance/styletabicon.png", tr( "Windows" ) ); 362 tw-> addTab ( createDecoTab ( tw ), "appearance/styletabicon.png", tr( "Windows" ) );
362 tw-> addTab ( createGuiTab ( tw ), "appearance/backgroundtabicon.png", tr( "Gui" ) ); 363 tw-> addTab ( createGuiTab ( tw ), "appearance/backgroundtabicon.png", tr( "Gui" ) );
363 364
364 top-> addWidget ( tw, 10 ); 365 top-> addWidget ( tw, 10 );
365 top-> addWidget ( m_sample, 1 ); 366 top-> addWidget ( m_sample, 1 );
366 367
367 tw-> setCurrentTab ( styletab ); 368 tw-> setCurrentTab ( styletab );
368} 369}
369 370
370Appearance::~Appearance() 371Appearance::~Appearance()
371{ 372{
372} 373}
373 374
374void Appearance::accept ( ) 375void Appearance::accept ( )
375{ 376{
376 Config config("qpe"); 377 Config config("qpe");
377 config.setGroup( "Appearance" ); 378 config.setGroup( "Appearance" );
378 379
379 int newtabstyle = m_tabstyle_list-> currentItem ( ); 380 int newtabstyle = m_tabstyle_list-> currentItem ( );
380 bool newtabpos = m_tabstyle_top-> isChecked ( ); 381 bool newtabpos = m_tabstyle_top-> isChecked ( );
381 382
382 383
383 if ( m_style_changed ) { 384 if ( m_style_changed ) {
384 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 385 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
385 if ( item ) 386 if ( item )
386 config.writeEntry( "Style", item-> key ( )); 387 config.writeEntry( "Style", item-> key ( ));
387 } 388 }
388 389
389 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { 390 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) {
390 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 391 config. writeEntry ( "TabStyle", newtabstyle + 1 );
391 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 392 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
392 } 393 }
393 394
394 if ( m_font_changed ) { 395 if ( m_font_changed ) {
395 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 396 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
396 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 397 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
397 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 398 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
398 } 399 }
399 400
400 401
401 if ( m_color_changed ) 402 if ( m_color_changed )
402 { 403 {
403 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 404 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
404 405
405 if ( item ) 406 if ( item )
406 item-> save ( config ); 407 item-> save ( config );
407 } 408 }
408 409
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h
index ddf94f2..a392aa7 100644
--- a/noncore/settings/appearance2/appearance.h
+++ b/noncore/settings/appearance2/appearance.h
@@ -1,113 +1,113 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 5           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 12    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 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  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` Free Software Foundation, Inc.,
23 If not, write to the Free Software Foundation, 24 59 Temple Place - Suite 330,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef APPEARANCESETTINGS_H 29#ifndef APPEARANCESETTINGS_H
30#define APPEARANCESETTINGS_H 30#define APPEARANCESETTINGS_H
31 31
32#include <qpe/fontdatabase.h> 32#include <qpe/fontdatabase.h>
33 33
34#include <qmainwindow.h> 34#include <qmainwindow.h>
35#include <qdialog.h> 35#include <qdialog.h>
36 36
37class QCheckBox; 37class QCheckBox;
38class QComboBox; 38class QComboBox;
39class QLabel; 39class QLabel;
40class QLineEdit; 40class QLineEdit;
41class QListBox; 41class QListBox;
42class QMultiLineEdit; 42class QMultiLineEdit;
43class QPushButton; 43class QPushButton;
44class QRadioButton; 44class QRadioButton;
45class QToolButton; 45class QToolButton;
46class SampleWindow; 46class SampleWindow;
47class OFontSelector; 47class OFontSelector;
48 48
49class Appearance : public QDialog 49class Appearance : public QDialog
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 52
53public: 53public:
54 Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 54 Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
55 ~Appearance(); 55 ~Appearance();
56 56
57protected: 57protected:
58 virtual void accept ( ); 58 virtual void accept ( );
59 virtual void done ( int r ); 59 virtual void done ( int r );
60 60
61protected slots: 61protected slots:
62 void styleClicked ( int ); 62 void styleClicked ( int );
63 void styleSettingsClicked ( ); 63 void styleSettingsClicked ( );
64 void decoClicked ( int ); 64 void decoClicked ( int );
65 void fontClicked ( const QFont & ); 65 void fontClicked ( const QFont & );
66 void colorClicked ( int ); 66 void colorClicked ( int );
67 67
68 void editSchemeClicked(); 68 void editSchemeClicked();
69 void saveSchemeClicked(); 69 void saveSchemeClicked();
70 void deleteSchemeClicked(); 70 void deleteSchemeClicked();
71 71
72private: 72private:
73 void loadStyles ( QListBox * ); 73 void loadStyles ( QListBox * );
74 void loadDecos ( QListBox * ); 74 void loadDecos ( QListBox * );
75 void loadColors ( QListBox * ); 75 void loadColors ( QListBox * );
76 76
77 void changeText(); 77 void changeText();
78 78
79 QWidget *createStyleTab ( QWidget *parent ); 79 QWidget *createStyleTab ( QWidget *parent );
80 QWidget *createDecoTab ( QWidget *parent ); 80 QWidget *createDecoTab ( QWidget *parent );
81 QWidget *createFontTab ( QWidget *parent ); 81 QWidget *createFontTab ( QWidget *parent );
82 QWidget *createColorTab ( QWidget *parent ); 82 QWidget *createColorTab ( QWidget *parent );
83 QWidget *createGuiTab ( QWidget *parent ); 83 QWidget *createGuiTab ( QWidget *parent );
84 84
85private: 85private:
86 bool m_style_changed; 86 bool m_style_changed;
87 bool m_font_changed; 87 bool m_font_changed;
88 bool m_scheme_changed; 88 bool m_scheme_changed;
89 bool m_deco_changed; 89 bool m_deco_changed;
90 bool m_color_changed; 90 bool m_color_changed;
91 91
92 int m_original_style; 92 int m_original_style;
93 int m_original_deco; 93 int m_original_deco;
94 int m_original_tabstyle; 94 int m_original_tabstyle;
95 bool m_original_tabpos; 95 bool m_original_tabpos;
96 96
97 QListBox * m_style_list; 97 QListBox * m_style_list;
98 QPushButton * m_style_settings; 98 QPushButton * m_style_settings;
99 99
100 QListBox * m_deco_list; 100 QListBox * m_deco_list;
101 101
102 QListBox * m_color_list; 102 QListBox * m_color_list;
103 103
104 OFontSelector *m_fontselect; 104 OFontSelector *m_fontselect;
105 105
106 SampleWindow *m_sample; 106 SampleWindow *m_sample;
107 107
108 QComboBox * m_tabstyle_list; 108 QComboBox * m_tabstyle_list;
109 QRadioButton *m_tabstyle_top; 109 QRadioButton *m_tabstyle_top;
110 QRadioButton *m_tabstyle_bottom; 110 QRadioButton *m_tabstyle_bottom;
111}; 111};
112 112
113#endif 113#endif
diff --git a/noncore/settings/appearance2/colorlistitem.h b/noncore/settings/appearance2/colorlistitem.h
index 1df541b..10e4468 100644
--- a/noncore/settings/appearance2/colorlistitem.h
+++ b/noncore/settings/appearance2/colorlistitem.h
@@ -1,141 +1,140 @@
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 library 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 Library 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 library 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 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: details. 18++=   -.     .`     .:
19 :     =  ...= . :.=- 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` Free Software Foundation, Inc.,
23 If not, write to the Free Software Foundation, 23 59 Temple Place - Suite 330,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
26 25
27*/ 26*/
28 27
29#ifndef COLORLISTITEM_H 28#ifndef COLORLISTITEM_H
30#define COLORLISTITEM_H 29#define COLORLISTITEM_H
31 30
32#include <qlistbox.h> 31#include <qlistbox.h>
33#include <qpalette.h> 32#include <qpalette.h>
34#include <qapplication.h> 33#include <qapplication.h>
35 34
36#include <qpe/config.h> 35#include <qpe/config.h>
37 36
38class Appearance; 37class Appearance;
39 38
40class ColorListItem : public QListBoxText { 39class ColorListItem : public QListBoxText {
41public: 40public:
42 ColorListItem ( const QString &t, Config &cfg ) : QListBoxText ( t ) 41 ColorListItem ( const QString &t, Config &cfg ) : QListBoxText ( t )
43 { 42 {
44 m_colors = new QColor [s_colorcount]; 43 m_colors = new QColor [s_colorcount];
45 load ( cfg ); 44 load ( cfg );
46 } 45 }
47 46
48 virtual ~ColorListItem ( ) 47 virtual ~ColorListItem ( )
49 { 48 {
50 delete [] m_colors; 49 delete [] m_colors;
51 } 50 }
52 51
53 QPalette palette ( ) 52 QPalette palette ( )
54 { 53 {
55 return m_palette; 54 return m_palette;
56 } 55 }
57 56
58 bool load ( Config &cfg ) 57 bool load ( Config &cfg )
59 { 58 {
60 for ( int i = 0; i < s_colorcount; i++ ) 59 for ( int i = 0; i < s_colorcount; i++ )
61 m_colors [i] = QColor ( cfg. readEntry ( s_colorlut [i]. m_key, s_colorlut [i]. m_def )); 60 m_colors [i] = QColor ( cfg. readEntry ( s_colorlut [i]. m_key, s_colorlut [i]. m_def ));
62 61
63 buildPalette ( ); 62 buildPalette ( );
64 return true; 63 return true;
65 } 64 }
66 65
67 void buildPalette ( ) 66 void buildPalette ( )
68 { 67 {
69 m_palette = QPalette ( m_colors [r2i(QColorGroup::Button)], m_colors [r2i(QColorGroup::Background)] ); 68 m_palette = QPalette ( m_colors [r2i(QColorGroup::Button)], m_colors [r2i(QColorGroup::Background)] );
70 m_palette. setColor ( QColorGroup::Highlight, m_colors [r2i(QColorGroup::Highlight)] ); 69 m_palette. setColor ( QColorGroup::Highlight, m_colors [r2i(QColorGroup::Highlight)] );
71 m_palette. setColor ( QColorGroup::HighlightedText, m_colors [r2i(QColorGroup::HighlightedText)] ); 70 m_palette. setColor ( QColorGroup::HighlightedText, m_colors [r2i(QColorGroup::HighlightedText)] );
72 m_palette. setColor ( QColorGroup::Text, m_colors [r2i(QColorGroup::Text)] ); 71 m_palette. setColor ( QColorGroup::Text, m_colors [r2i(QColorGroup::Text)] );
73 m_palette. setColor ( QPalette::Active, QColorGroup::ButtonText, m_colors [r2i(QColorGroup::ButtonText)] ); 72 m_palette. setColor ( QPalette::Active, QColorGroup::ButtonText, m_colors [r2i(QColorGroup::ButtonText)] );
74 m_palette. setColor ( QColorGroup::Base, m_colors [r2i(QColorGroup::Base)] ); 73 m_palette. setColor ( QColorGroup::Base, m_colors [r2i(QColorGroup::Base)] );
75 m_palette. setColor ( QPalette::Disabled, QColorGroup::Text, m_palette. color ( QPalette::Active, QColorGroup::Background ). dark ( )); 74 m_palette. setColor ( QPalette::Disabled, QColorGroup::Text, m_palette. color ( QPalette::Active, QColorGroup::Background ). dark ( ));
76 } 75 }
77 76
78 bool save ( Config &cfg ) 77 bool save ( Config &cfg )
79 { 78 {
80 for ( int i = 0; i < s_colorcount; i++ ) 79 for ( int i = 0; i < s_colorcount; i++ )
81 cfg. writeEntry ( s_colorlut [i]. m_key, m_colors [i]. name ( )); 80 cfg. writeEntry ( s_colorlut [i]. m_key, m_colors [i]. name ( ));
82 return true; 81 return true;
83 } 82 }
84 83
85 QColor color ( QColorGroup::ColorRole role ) 84 QColor color ( QColorGroup::ColorRole role )
86 { 85 {
87 int i = r2i ( role ); 86 int i = r2i ( role );
88 return i >= 0 ? m_colors [i] : QColor ( ); 87 return i >= 0 ? m_colors [i] : QColor ( );
89 } 88 }
90 89
91 void setColor ( QColorGroup::ColorRole role, QColor c ) 90 void setColor ( QColorGroup::ColorRole role, QColor c )
92 { 91 {
93 int i = r2i ( role ); 92 int i = r2i ( role );
94 if ( i >= 0 ) { 93 if ( i >= 0 ) {
95 m_colors [i] = c; 94 m_colors [i] = c;
96 buildPalette ( ); 95 buildPalette ( );
97 } 96 }
98 } 97 }
99 98
100 QString label ( QColorGroup::ColorRole role ) 99 QString label ( QColorGroup::ColorRole role )
101 { 100 {
102 int i = r2i ( role ); 101 int i = r2i ( role );
103 return i >= 0 ? qApp-> translate ( "Appearance", s_colorlut [i]. m_label ) : QString::null; 102 return i >= 0 ? qApp-> translate ( "Appearance", s_colorlut [i]. m_label ) : QString::null;
104 } 103 }
105 104
106private: 105private:
107 QPalette m_palette; 106 QPalette m_palette;
108 QColor *m_colors; 107 QColor *m_colors;
109 108
110 static struct colorlut { 109 static struct colorlut {
111 QColorGroup::ColorRole m_role; 110 QColorGroup::ColorRole m_role;
112 const char * m_key; 111 const char * m_key;
113 const char * m_def; 112 const char * m_def;
114 const char * m_label; 113 const char * m_label;
115 } const s_colorlut []; 114 } const s_colorlut [];
116 static const int s_colorcount; 115 static const int s_colorcount;
117 116
118 static int r2i ( QColorGroup::ColorRole role ) 117 static int r2i ( QColorGroup::ColorRole role )
119 { 118 {
120 for ( int i = 0; i < s_colorcount; i++ ) { 119 for ( int i = 0; i < s_colorcount; i++ ) {
121 if ( s_colorlut [i]. m_role == role ) 120 if ( s_colorlut [i]. m_role == role )
122 return i; 121 return i;
123 } 122 }
124 return -1; 123 return -1;
125 } 124 }
126}; 125};
127 126
128const ColorListItem::colorlut ColorListItem::s_colorlut [] = { 127const ColorListItem::colorlut ColorListItem::s_colorlut [] = {
129 { QColorGroup::Base, "Base", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Base" ) }, 128 { QColorGroup::Base, "Base", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Base" ) },
130 { QColorGroup::Background, "Background", "#E5E1D5", QT_TRANSLATE_NOOP( "Appearance", "Background" ) }, 129 { QColorGroup::Background, "Background", "#E5E1D5", QT_TRANSLATE_NOOP( "Appearance", "Background" ) },
131 { QColorGroup::Button, "Button", "#D6CDBB", QT_TRANSLATE_NOOP( "Appearance", "Button" ) }, 130 { QColorGroup::Button, "Button", "#D6CDBB", QT_TRANSLATE_NOOP( "Appearance", "Button" ) },
132 { QColorGroup::ButtonText, "ButtonText", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Button Text" ) }, 131 { QColorGroup::ButtonText, "ButtonText", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Button Text" ) },
133 { QColorGroup::Highlight, "Highlight", "#800000", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) }, 132 { QColorGroup::Highlight, "Highlight", "#800000", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) },
134 { QColorGroup::HighlightedText, "HighlightedText", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Highlighted Text" ) }, 133 { QColorGroup::HighlightedText, "HighlightedText", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Highlighted Text" ) },
135 { QColorGroup::Text, "Text", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Text" ) } 134 { QColorGroup::Text, "Text", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Text" ) }
136}; 135};
137 136
138const int ColorListItem::s_colorcount = sizeof( s_colorlut ) / sizeof ( s_colorlut [0] ); 137const int ColorListItem::s_colorcount = sizeof( s_colorlut ) / sizeof ( s_colorlut [0] );
139 138
140 139
141#endif 140#endif
diff --git a/noncore/settings/appearance2/decolistitem.h b/noncore/settings/appearance2/decolistitem.h
index 953a939..23261b1 100644
--- a/noncore/settings/appearance2/decolistitem.h
+++ b/noncore/settings/appearance2/decolistitem.h
@@ -1,106 +1,106 @@
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 library 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 Library 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 library 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 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: details. 18++=   -.     .`     .:
19 :     =  ...= . :.=- 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` Free Software Foundation, Inc.,
23 If not, write to the Free Software Foundation, 23 59 Temple Place - Suite 330,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
26 25
27*/ 26*/
27
28#ifndef DECOLISTITEM_H 28#ifndef DECOLISTITEM_H
29#define DECOLISTITEM_H 29#define DECOLISTITEM_H
30 30
31#include <qpe/windowdecorationinterface.h> 31#include <qpe/windowdecorationinterface.h>
32#include <qlistbox.h> 32#include <qlistbox.h>
33 33
34class DecoListItem : public QListBoxText { 34class DecoListItem : public QListBoxText {
35public: 35public:
36 DecoListItem ( const QString &t ) : QListBoxText ( t ) 36 DecoListItem ( const QString &t ) : QListBoxText ( t )
37 { 37 {
38 m_lib = 0; 38 m_lib = 0;
39 m_window_if = 0; 39 m_window_if = 0;
40 // m_settings_if = 0; 40 // m_settings_if = 0;
41 } 41 }
42 42
43 DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxText ( iface-> name ( )) 43 DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxText ( iface-> name ( ))
44 { 44 {
45 m_lib = lib; 45 m_lib = lib;
46 m_window_if = iface; 46 m_window_if = iface;
47 47
48 // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if ); 48 // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if );
49 } 49 }
50 50
51 virtual ~DecoListItem ( ) 51 virtual ~DecoListItem ( )
52 { 52 {
53 // if ( m_settings_if ) 53 // if ( m_settings_if )
54 // m_settings_if-> release ( ); 54 // m_settings_if-> release ( );
55 if ( m_window_if ) 55 if ( m_window_if )
56 m_window_if-> release ( ); 56 m_window_if-> release ( );
57 delete m_lib; 57 delete m_lib;
58 } 58 }
59 59
60 bool hasSettings ( ) const 60 bool hasSettings ( ) const
61 { 61 {
62 // return ( m_settings_if ); 62 // return ( m_settings_if );
63 return false; 63 return false;
64 } 64 }
65 65
66 QWidget *settings ( QWidget * /*parent*/ ) 66 QWidget *settings ( QWidget * /*parent*/ )
67 { 67 {
68 // return m_settings_if ? m_settings_if-> create ( parent ) : 0; 68 // return m_settings_if ? m_settings_if-> create ( parent ) : 0;
69 return 0; 69 return 0;
70 } 70 }
71 71
72 bool setSettings ( bool /*accepted*/ ) 72 bool setSettings ( bool /*accepted*/ )
73 { 73 {
74 // if ( !m_settings_if ) 74 // if ( !m_settings_if )
75 // return false; 75 // return false;
76 76
77 // if ( accepted ) 77 // if ( accepted )
78 // return m_settings_if-> accept ( ); 78 // return m_settings_if-> accept ( );
79 // else { 79 // else {
80 // m_settings_if-> reject ( ); 80 // m_settings_if-> reject ( );
81 // return false; 81 // return false;
82 // } 82 // }
83 return false; 83 return false;
84 } 84 }
85 85
86 QString key ( ) 86 QString key ( )
87 { 87 {
88 if ( m_window_if ) 88 if ( m_window_if )
89 return QString ( m_window_if-> name ( )); 89 return QString ( m_window_if-> name ( ));
90 else 90 else
91 return text ( ); 91 return text ( );
92 } 92 }
93 93
94 WindowDecorationInterface *interface ( ) 94 WindowDecorationInterface *interface ( )
95 { 95 {
96 return m_window_if; 96 return m_window_if;
97 } 97 }
98 98
99private: 99private:
100 QLibrary *m_lib; 100 QLibrary *m_lib;
101 WindowDecorationInterface *m_window_if; 101 WindowDecorationInterface *m_window_if;
102 //WindowDecorationSettingsInterface *m_settings_if; 102 //WindowDecorationSettingsInterface *m_settings_if;
103 103
104}; 104};
105 105
106#endif \ No newline at end of file 106#endif \ No newline at end of file
diff --git a/noncore/settings/appearance2/editScheme.cpp b/noncore/settings/appearance2/editScheme.cpp
index 8cb0f1c..c2e5355 100644
--- a/noncore/settings/appearance2/editScheme.cpp
+++ b/noncore/settings/appearance2/editScheme.cpp
@@ -1,73 +1,73 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 5           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 12    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 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  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` Free Software Foundation, Inc.,
23 If not, write to the Free Software Foundation, 24 59 Temple Place - Suite 330,
24 Inc., 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 "editScheme.h" 29#include "editScheme.h"
30 30
31#include <opie/ocolorbutton.h> 31#include <opie/ocolorbutton.h>
32 32
33#include <qaction.h> 33#include <qaction.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qpopupmenu.h> 36#include <qpopupmenu.h>
37#include <qscrollview.h> 37#include <qscrollview.h>
38#include <qtoolbutton.h> 38#include <qtoolbutton.h>
39 39
40EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags fl ) 40EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags fl )
41 : QDialog ( parent, name, modal, fl ) 41 : QDialog ( parent, name, modal, fl )
42{ 42{
43 setCaption ( tr( "Edit scheme" ) ); 43 setCaption ( tr( "Edit scheme" ) );
44 QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 ); 44 QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 );
45 45
46 m_count = cnt; 46 m_count = cnt;
47 m_buttons = new OColorButton * [cnt]; 47 m_buttons = new OColorButton * [cnt];
48 m_colors = colors; 48 m_colors = colors;
49 49
50 for ( int i = 0; i < cnt; i++ ) 50 for ( int i = 0; i < cnt; i++ )
51 { 51 {
52 QLabel *l = new QLabel ( labels [i], this ); 52 QLabel *l = new QLabel ( labels [i], this );
53 layout-> addWidget ( l, i, 0 ); 53 layout-> addWidget ( l, i, 0 );
54 54
55 m_buttons [i] = new OColorButton ( this ); 55 m_buttons [i] = new OColorButton ( this );
56 m_buttons [i]-> setColor ( colors [i] ); 56 m_buttons [i]-> setColor ( colors [i] );
57 layout-> addWidget ( m_buttons [i], i, 1 ); 57 layout-> addWidget ( m_buttons [i], i, 1 );
58 } 58 }
59} 59}
60 60
61EditScheme::~EditScheme ( ) 61EditScheme::~EditScheme ( )
62{ 62{
63 delete [] m_buttons; 63 delete [] m_buttons;
64} 64}
65 65
66void EditScheme::accept ( ) 66void EditScheme::accept ( )
67{ 67{
68 for ( int i = 0; i < m_count; i++ ) 68 for ( int i = 0; i < m_count; i++ )
69 m_colors [i] = m_buttons [i]-> color ( ); 69 m_colors [i] = m_buttons [i]-> color ( );
70 70
71 QDialog::accept ( ); 71 QDialog::accept ( );
72} 72}
73 73
diff --git a/noncore/settings/appearance2/editScheme.h b/noncore/settings/appearance2/editScheme.h
index 0a025bd..93dc50d 100644
--- a/noncore/settings/appearance2/editScheme.h
+++ b/noncore/settings/appearance2/editScheme.h
@@ -1,53 +1,53 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 5           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 12    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 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  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` Free Software Foundation, Inc.,
23 If not, write to the Free Software Foundation, 24 59 Temple Place - Suite 330,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef EDITSCHEME_H 29#ifndef EDITSCHEME_H
30#define EDITSCHEME_H 30#define EDITSCHEME_H
31 31
32#include <qdialog.h> 32#include <qdialog.h>
33 33
34class QColor; 34class QColor;
35class OColorButton; 35class OColorButton;
36 36
37class EditScheme : public QDialog { 37class EditScheme : public QDialog {
38 Q_OBJECT 38 Q_OBJECT
39 39
40public: 40public:
41 EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 41 EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
42 virtual ~EditScheme ( ); 42 virtual ~EditScheme ( );
43 43
44protected slots: 44protected slots:
45 virtual void accept ( ); 45 virtual void accept ( );
46 46
47private: 47private:
48 int m_count; 48 int m_count;
49 QColor *m_colors; 49 QColor *m_colors;
50 OColorButton **m_buttons; 50 OColorButton **m_buttons;
51}; 51};
52 52
53#endif 53#endif
diff --git a/noncore/settings/appearance2/main.cpp b/noncore/settings/appearance2/main.cpp
index 3afec46..ad24cf3 100644
--- a/noncore/settings/appearance2/main.cpp
+++ b/noncore/settings/appearance2/main.cpp
@@ -1,43 +1,42 @@
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 library 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 Library 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 library 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 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: details. 18++=   -.     .`     .:
19 :     =  ...= . :.=- 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` Free Software Foundation, Inc.,
23 If not, write to the Free Software Foundation, 23 59 Temple Place - Suite 330,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
26 25
27*/ 26*/
28 27
29#include "appearance.h" 28#include "appearance.h"
30 29
31#include <qpe/qpeapplication.h> 30#include <qpe/qpeapplication.h>
32 31
33 32
34int main ( int argc, char **argv ) 33int main ( int argc, char **argv )
35{ 34{
36 QPEApplication app ( argc, argv ); 35 QPEApplication app ( argc, argv );
37 36
38 Appearance m; 37 Appearance m;
39 app. showMainDocumentWidget ( &m ); 38 app. showMainDocumentWidget ( &m );
40 39
41 return app. exec ( ); 40 return app. exec ( );
42} 41}
43 42
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp
index 0d8b003..6bbed4b 100644
--- a/noncore/settings/appearance2/sample.cpp
+++ b/noncore/settings/appearance2/sample.cpp
@@ -1,272 +1,271 @@
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 library 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 Library 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 library 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 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: details. 19++=   -.     .`     .:
20 :     =  ...= . :.=- 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` Free Software Foundation, Inc.,
24 If not, write to the Free Software Foundation, 24 59 Temple Place - Suite 330,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
27 26
28*/ 27*/
29 28
30#include <qvbox.h> 29#include <qvbox.h>
31#include <qpopupmenu.h> 30#include <qpopupmenu.h>
32#include <qpainter.h> 31#include <qpainter.h>
33#include <qmenubar.h> 32#include <qmenubar.h>
34#include <qcheckbox.h> 33#include <qcheckbox.h>
35#include <qpushbutton.h> 34#include <qpushbutton.h>
36#include <qscrollbar.h> 35#include <qscrollbar.h>
37#include <qlayout.h> 36#include <qlayout.h>
38#include <qwhatsthis.h> 37#include <qwhatsthis.h>
39#include <qpixmapcache.h> 38#include <qpixmapcache.h>
40#include <qtimer.h> 39#include <qtimer.h>
41#include <qobjectlist.h> 40#include <qobjectlist.h>
42#include <qcommonstyle.h> 41#include <qcommonstyle.h>
43 42
44#include "sample.h" 43#include "sample.h"
45 44
46 45
47class SampleText : public QWidget 46class SampleText : public QWidget
48{ 47{
49public: 48public:
50 SampleText( const QString &t, bool h, QWidget *parent ) 49 SampleText( const QString &t, bool h, QWidget *parent )
51 : QWidget( parent ), hl(h), text(t) 50 : QWidget( parent ), hl(h), text(t)
52 { 51 {
53 if ( hl ) 52 if ( hl )
54 setBackgroundMode( PaletteHighlight ); 53 setBackgroundMode( PaletteHighlight );
55 else 54 else
56 setBackgroundMode( PaletteBase ); 55 setBackgroundMode( PaletteBase );
57 } 56 }
58 57
59 QSize sizeHint() const 58 QSize sizeHint() const
60 { 59 {
61 QFontMetrics fm(font()); 60 QFontMetrics fm(font());
62 return QSize( fm.width(text)+10, fm.height()+4 ); 61 return QSize( fm.width(text)+10, fm.height()+4 );
63 } 62 }
64 63
65 void paintEvent( QPaintEvent * ) 64 void paintEvent( QPaintEvent * )
66 { 65 {
67 QPainter p(this); 66 QPainter p(this);
68 if ( hl ) 67 if ( hl )
69 p.setPen( colorGroup().highlightedText() ); 68 p.setPen( colorGroup().highlightedText() );
70 else 69 else
71 p.setPen( colorGroup().text() ); 70 p.setPen( colorGroup().text() );
72 p.drawText( rect(), AlignCenter, text ); 71 p.drawText( rect(), AlignCenter, text );
73 } 72 }
74 73
75private: 74private:
76 bool hl; 75 bool hl;
77 QString text; 76 QString text;
78}; 77};
79 78
80 79
81SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0) 80SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0)
82{ 81{
83 init(); 82 init();
84} 83}
85 84
86QSize SampleWindow::sizeHint() const 85QSize SampleWindow::sizeHint() const
87{ 86{
88 return container->sizeHint() + QSize( 10, 35 ); 87 return container->sizeHint() + QSize( 10, 35 );
89} 88}
90 89
91void SampleWindow::setFont( const QFont &f ) 90void SampleWindow::setFont( const QFont &f )
92{ 91{
93 QWidget::setFont( f ); 92 QWidget::setFont( f );
94 popup->setFont( f ); 93 popup->setFont( f );
95 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); 94 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( )));
96} 95}
97 96
98static void setStyleRecursive ( QWidget *w, QStyle *s ) 97static void setStyleRecursive ( QWidget *w, QStyle *s )
99{ 98{
100 w->setStyle( s ); 99 w->setStyle( s );
101 QObjectList *childObjects=(QObjectList*)w->children(); 100 QObjectList *childObjects=(QObjectList*)w->children();
102 if ( childObjects ) { 101 if ( childObjects ) {
103 QObject * o; 102 QObject * o;
104 for(o=childObjects->first();o!=0;o=childObjects->next()) { 103 for(o=childObjects->first();o!=0;o=childObjects->next()) {
105 if( o->isWidgetType() ) { 104 if( o->isWidgetType() ) {
106 setStyleRecursive((QWidget *)o,s); 105 setStyleRecursive((QWidget *)o,s);
107 } 106 }
108 } 107 }
109 } 108 }
110} 109}
111 110
112 111
113void SampleWindow::setStyle2 ( QStyle *sty ) 112void SampleWindow::setStyle2 ( QStyle *sty )
114{ 113{
115 typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); 114 typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool);
116 115
117 extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); 116 extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl);
118 117
119 QPixmapCache::clear ( ); 118 QPixmapCache::clear ( );
120 QPalette p = palette ( ); 119 QPalette p = palette ( );
121 sty-> polish ( p ); 120 sty-> polish ( p );
122 qt_set_draw_menu_bar_impl ( 0 ); 121 qt_set_draw_menu_bar_impl ( 0 );
123 setStyleRecursive ( this, sty ); 122 setStyleRecursive ( this, sty );
124 setPalette ( p ); 123 setPalette ( p );
125 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); 124 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( )));
126} 125}
127 126
128 127
129void SampleWindow::setDecoration( WindowDecorationInterface *i ) 128void SampleWindow::setDecoration( WindowDecorationInterface *i )
130{ 129{
131 iface = i; 130 iface = i;
132 wd.rect = QRect( 0, 0, 150, 75 ); 131 wd.rect = QRect( 0, 0, 150, 75 );
133 wd.caption = tr("Sample"); 132 wd.caption = tr("Sample");
134 wd.palette = palette(); 133 wd.palette = palette();
135 wd.flags = WindowDecorationInterface::WindowData::Dialog | 134 wd.flags = WindowDecorationInterface::WindowData::Dialog |
136 WindowDecorationInterface::WindowData::Active; 135 WindowDecorationInterface::WindowData::Active;
137 wd.reserved = 1; 136 wd.reserved = 1;
138 137
139 th = iface->metric(WindowDecorationInterface::TitleHeight, &wd); 138 th = iface->metric(WindowDecorationInterface::TitleHeight, &wd);
140 tb = iface->metric(WindowDecorationInterface::TopBorder, &wd); 139 tb = iface->metric(WindowDecorationInterface::TopBorder, &wd);
141 lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd); 140 lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd);
142 rb = iface->metric(WindowDecorationInterface::RightBorder, &wd); 141 rb = iface->metric(WindowDecorationInterface::RightBorder, &wd);
143 bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd); 142 bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd);
144 143
145 int yoff = th + tb; 144 int yoff = th + tb;
146 int xoff = lb; 145 int xoff = lb;
147 146
148 wd.rect.setX( 0 ); 147 wd.rect.setX( 0 );
149 wd.rect.setWidth( width() - lb - rb ); 148 wd.rect.setWidth( width() - lb - rb );
150 wd.rect.setY( 0 ); 149 wd.rect.setY( 0 );
151 wd.rect.setHeight( height() - yoff - bb ); 150 wd.rect.setHeight( height() - yoff - bb );
152 151
153 container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() ); 152 container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() );
154 setMinimumSize( container->sizeHint().width()+lb+rb, 153 setMinimumSize( container->sizeHint().width()+lb+rb,
155 container->sizeHint().height()+tb+th+bb ); 154 container->sizeHint().height()+tb+th+bb );
156} 155}
157 156
158void SampleWindow::paintEvent( QPaintEvent * ) 157void SampleWindow::paintEvent( QPaintEvent * )
159{ 158{
160 if ( !iface ) 159 if ( !iface )
161 return; 160 return;
162 161
163 QPainter p( this ); 162 QPainter p( this );
164 163
165 p.translate( lb, th+tb ); 164 p.translate( lb, th+tb );
166 165
167 iface->drawArea(WindowDecorationInterface::Border, &p, &wd); 166 iface->drawArea(WindowDecorationInterface::Border, &p, &wd);
168 iface->drawArea(WindowDecorationInterface::Title, &p, &wd); 167 iface->drawArea(WindowDecorationInterface::Title, &p, &wd);
169 168
170 p.setPen(palette().active().color(QColorGroup::HighlightedText)); 169 p.setPen(palette().active().color(QColorGroup::HighlightedText));
171 QFont f( font() ); 170 QFont f( font() );
172 f.setWeight( QFont::Bold ); 171 f.setWeight( QFont::Bold );
173 p.setFont(f); 172 p.setFont(f);
174 iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd); 173 iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd);
175 174
176 QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th ); 175 QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th );
177 iface->drawButton( WindowDecorationInterface::Help, &p, &wd, 176 iface->drawButton( WindowDecorationInterface::Help, &p, &wd,
178 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); 177 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
179 brect.moveBy( wd.rect.width() - 178 brect.moveBy( wd.rect.width() -
180 iface->metric(WindowDecorationInterface::OKWidth,&wd) - 179 iface->metric(WindowDecorationInterface::OKWidth,&wd) -
181 iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); 180 iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 );
182 iface->drawButton( WindowDecorationInterface::Close, &p, &wd, 181 iface->drawButton( WindowDecorationInterface::Close, &p, &wd,
183 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); 182 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
184 brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); 183 brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 );
185 iface->drawButton( WindowDecorationInterface::OK, &p, &wd, 184 iface->drawButton( WindowDecorationInterface::OK, &p, &wd,
186 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); 185 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
187} 186}
188 187
189void SampleWindow::init() 188void SampleWindow::init()
190{ 189{
191 container = new QVBox( this ); 190 container = new QVBox( this );
192 popup = new QPopupMenu( this ); 191 popup = new QPopupMenu( this );
193 popup->insertItem( tr("Normal Item"), 1 ); 192 popup->insertItem( tr("Normal Item"), 1 );
194 popup->insertItem( tr("Disabled Item"), 2 ); 193 popup->insertItem( tr("Disabled Item"), 2 );
195 popup->setItemEnabled(2, FALSE); 194 popup->setItemEnabled(2, FALSE);
196 QMenuBar *mb = new QMenuBar( container ); 195 QMenuBar *mb = new QMenuBar( container );
197 mb->insertItem( tr("Menu"), popup ); 196 mb->insertItem( tr("Menu"), popup );
198 QHBox *hb = new QHBox( container ); 197 QHBox *hb = new QHBox( container );
199 QWidget *w = new QWidget( hb ); 198 QWidget *w = new QWidget( hb );
200 (void)new QScrollBar( 0, 0, 0, 0, 0, Vertical, hb ); 199 (void)new QScrollBar( 0, 0, 0, 0, 0, Vertical, hb );
201 200
202 QGridLayout *gl = new QGridLayout( w, 2, 2, 4 ); 201 QGridLayout *gl = new QGridLayout( w, 2, 2, 4 );
203 SampleText *l = new SampleText( tr("Normal Text"), FALSE, w ); 202 SampleText *l = new SampleText( tr("Normal Text"), FALSE, w );
204 gl->addWidget( l, 0, 0 ); 203 gl->addWidget( l, 0, 0 );
205 204
206 l = new SampleText( tr("Highlighted Text"), TRUE, w ); 205 l = new SampleText( tr("Highlighted Text"), TRUE, w );
207 gl->addWidget( l, 1, 0 ); 206 gl->addWidget( l, 1, 0 );
208 207
209 QPushButton *pb = new QPushButton( tr("Button"), w ); 208 QPushButton *pb = new QPushButton( tr("Button"), w );
210 gl->addWidget( pb, 0, 1 ); 209 gl->addWidget( pb, 0, 1 );
211 pb->setFocusPolicy( NoFocus ); 210 pb->setFocusPolicy( NoFocus );
212 211
213 QCheckBox *cb = new QCheckBox( tr("Check Box"), w ); 212 QCheckBox *cb = new QCheckBox( tr("Check Box"), w );
214 gl->addWidget( cb, 1, 1 ); 213 gl->addWidget( cb, 1, 1 );
215 cb->setFocusPolicy( NoFocus ); 214 cb->setFocusPolicy( NoFocus );
216 cb->setChecked( TRUE ); 215 cb->setChecked( TRUE );
217 216
218 QWhatsThis::add( this, tr("Sample window using the selected settings.") ); 217 QWhatsThis::add( this, tr("Sample window using the selected settings.") );
219} 218}
220 219
221bool SampleWindow::eventFilter( QObject *, QEvent *e ) 220bool SampleWindow::eventFilter( QObject *, QEvent *e )
222{ 221{
223 switch ( e->type() ) { 222 switch ( e->type() ) {
224 case QEvent::MouseButtonPress: 223 case QEvent::MouseButtonPress:
225 case QEvent::MouseButtonRelease: 224 case QEvent::MouseButtonRelease:
226 case QEvent::MouseButtonDblClick: 225 case QEvent::MouseButtonDblClick:
227 case QEvent::MouseMove: 226 case QEvent::MouseMove:
228 case QEvent::KeyPress: 227 case QEvent::KeyPress:
229 case QEvent::KeyRelease: 228 case QEvent::KeyRelease:
230 return TRUE; 229 return TRUE;
231 default: 230 default:
232 break; 231 break;
233 } 232 }
234 233
235 return FALSE; 234 return FALSE;
236} 235}
237 236
238void SampleWindow::paletteChange( const QPalette &old ) 237void SampleWindow::paletteChange( const QPalette &old )
239{ 238{
240 QWidget::paletteChange ( old ); 239 QWidget::paletteChange ( old );
241 wd. palette = palette ( ); 240 wd. palette = palette ( );
242 popup-> setPalette ( palette ( )); 241 popup-> setPalette ( palette ( ));
243} 242}
244 243
245 244
246void SampleWindow::setPalette ( const QPalette &pal ) 245void SampleWindow::setPalette ( const QPalette &pal )
247{ 246{
248 QPixmapCache::clear ( ); 247 QPixmapCache::clear ( );
249 QPalette p = pal; 248 QPalette p = pal;
250 style ( ). polish ( p ); 249 style ( ). polish ( p );
251 QWidget::setPalette ( p ); 250 QWidget::setPalette ( p );
252} 251}
253 252
254void SampleWindow::resizeEvent( QResizeEvent *re ) 253void SampleWindow::resizeEvent( QResizeEvent *re )
255{ 254{
256 wd.rect = QRect( 0, 0, 150, 75 ); 255 wd.rect = QRect( 0, 0, 150, 75 );
257 256
258 wd.rect.setX( 0 ); 257 wd.rect.setX( 0 );
259 wd.rect.setWidth( width() - lb - rb ); 258 wd.rect.setWidth( width() - lb - rb );
260 wd.rect.setY( 0 ); 259 wd.rect.setY( 0 );
261 wd.rect.setHeight( height() - th - tb - bb ); 260 wd.rect.setHeight( height() - th - tb - bb );
262 261
263 container->setGeometry( lb, th+tb, wd.rect.width(), wd.rect.height() ); 262 container->setGeometry( lb, th+tb, wd.rect.width(), wd.rect.height() );
264 QWidget::resizeEvent( re ); 263 QWidget::resizeEvent( re );
265} 264}
266 265
267void SampleWindow::fixGeometry() 266void SampleWindow::fixGeometry()
268{ 267{
269 setMinimumSize( container->sizeHint().width()+lb+rb, 268 setMinimumSize( container->sizeHint().width()+lb+rb,
270 container->sizeHint().height()+tb+th+bb ); 269 container->sizeHint().height()+tb+th+bb );
271} 270}
272 271
diff --git a/noncore/settings/appearance2/sample.h b/noncore/settings/appearance2/sample.h
index a189f69..c861228 100644
--- a/noncore/settings/appearance2/sample.h
+++ b/noncore/settings/appearance2/sample.h
@@ -1,78 +1,77 @@
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 library 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 Library 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 library 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 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Library General Public License for more 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: details. 19++=   -.     .`     .:
20 :     =  ...= . :.=- 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; You should have received a copy of the GNU 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = Library General Public License along with 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` this library; see the file COPYING.LIB. 23    --        :-=` Free Software Foundation, Inc.,
24 If not, write to the Free Software Foundation, 24 59 Temple Place - Suite 330,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
27 26
28*/ 27*/
29 28
30#ifndef __PREVIEW_H__ 29#ifndef __PREVIEW_H__
31#define __PREVIEW_H__ 30#define __PREVIEW_H__
32 31
33#include <qwidget.h> 32#include <qwidget.h>
34 33
35#include <qpe/windowdecorationinterface.h> 34#include <qpe/windowdecorationinterface.h>
36 35
37class QVBox; 36class QVBox;
38class QPopupMenu; 37class QPopupMenu;
39class SampleText; 38class SampleText;
40 39
41class SampleWindow : public QWidget 40class SampleWindow : public QWidget
42{ 41{
43 Q_OBJECT 42 Q_OBJECT
44public: 43public:
45 SampleWindow( QWidget *parent ); 44 SampleWindow( QWidget *parent );
46 45
47 QSize sizeHint() const; 46 QSize sizeHint() const;
48 47
49 virtual void setFont( const QFont &f ); 48 virtual void setFont( const QFont &f );
50 49
51 void setStyle2 ( QStyle *sty ); 50 void setStyle2 ( QStyle *sty );
52 void setDecoration( WindowDecorationInterface *i ); 51 void setDecoration( WindowDecorationInterface *i );
53 void setPalette ( const QPalette & ); 52 void setPalette ( const QPalette & );
54 53
55 virtual void paintEvent( QPaintEvent * ); 54 virtual void paintEvent( QPaintEvent * );
56 55
57 void init(); 56 void init();
58 57
59 virtual bool eventFilter( QObject *, QEvent *e ); 58 virtual bool eventFilter( QObject *, QEvent *e );
60 virtual void paletteChange( const QPalette &old ); 59 virtual void paletteChange( const QPalette &old );
61 virtual void resizeEvent( QResizeEvent *re ); 60 virtual void resizeEvent( QResizeEvent *re );
62 61
63public slots: 62public slots:
64 void fixGeometry(); 63 void fixGeometry();
65 64
66protected: 65protected:
67 WindowDecorationInterface *iface; 66 WindowDecorationInterface *iface;
68 WindowDecorationInterface::WindowData wd; 67 WindowDecorationInterface::WindowData wd;
69 QVBox *container; 68 QVBox *container;
70 QPopupMenu *popup; 69 QPopupMenu *popup;
71 int th; 70 int th;
72 int tb; 71 int tb;
73 int lb; 72 int lb;
74 int rb; 73 int rb;
75 int bb; 74 int bb;
76}; 75};
77 76
78#endif 77#endif
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h
index bbfbd41..c0258e0 100644
--- a/noncore/settings/appearance2/stylelistitem.h
+++ b/noncore/settings/appearance2/stylelistitem.h
@@ -1,113 +1,112 @@
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 library 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 Library 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 library 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 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: details. 18++=   -.     .`     .:
19 :     =  ...= . :.=- 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` Free Software Foundation, Inc.,
23 If not, write to the Free Software Foundation, 23 59 Temple Place - Suite 330,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
26 25
27*/ 26*/
28 27
29#ifndef STYLELISTITEM_H 28#ifndef STYLELISTITEM_H
30#define STYLELISTITEM_H 29#define STYLELISTITEM_H
31 30
32#include <qlistbox.h> 31#include <qlistbox.h>
33#include <qpe/styleinterface.h> 32#include <qpe/styleinterface.h>
34 33
35#include <stdio.h> 34#include <stdio.h>
36 35
37class StyleListItem : public QListBoxText { 36class StyleListItem : public QListBoxText {
38public: 37public:
39 StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) 38 StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t )
40 { 39 {
41 m_lib = 0; 40 m_lib = 0;
42 m_style_if = 0; 41 m_style_if = 0;
43 m_settings_if = 0; 42 m_settings_if = 0;
44 m_style = sty; 43 m_style = sty;
45 } 44 }
46 45
47 StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( )) 46 StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( ))
48 { 47 {
49 m_lib = lib; 48 m_lib = lib;
50 m_style_if = iface; 49 m_style_if = iface;
51 m_settings_if = 0; 50 m_settings_if = 0;
52 m_style = iface-> create ( ); 51 m_style = iface-> create ( );
53 52
54 iface-> queryInterface ( IID_StyleSettings, (QUnknownInterface **) &m_settings_if ); 53 iface-> queryInterface ( IID_StyleSettings, (QUnknownInterface **) &m_settings_if );
55 } 54 }
56 55
57 virtual ~StyleListItem ( ) 56 virtual ~StyleListItem ( )
58 { 57 {
59 delete m_style; 58 delete m_style;
60 59
61 if ( m_settings_if ) 60 if ( m_settings_if )
62 m_settings_if-> release ( ); 61 m_settings_if-> release ( );
63 if ( m_style_if ) 62 if ( m_style_if )
64 m_style_if-> release ( ); 63 m_style_if-> release ( );
65 delete m_lib; 64 delete m_lib;
66 } 65 }
67 66
68 bool hasSettings ( ) const 67 bool hasSettings ( ) const
69 { 68 {
70 return ( m_settings_if ); 69 return ( m_settings_if );
71 } 70 }
72 71
73 QWidget *settings ( QWidget *parent ) 72 QWidget *settings ( QWidget *parent )
74 { 73 {
75 return m_settings_if ? m_settings_if-> create ( parent ) : 0; 74 return m_settings_if ? m_settings_if-> create ( parent ) : 0;
76 } 75 }
77 76
78 bool setSettings ( bool accepted ) 77 bool setSettings ( bool accepted )
79 { 78 {
80 if ( !m_settings_if ) 79 if ( !m_settings_if )
81 return false; 80 return false;
82 81
83 if ( accepted ) 82 if ( accepted )
84 return m_settings_if-> accept ( ); 83 return m_settings_if-> accept ( );
85 else { 84 else {
86 m_settings_if-> reject ( ); 85 m_settings_if-> reject ( );
87 return false; 86 return false;
88 } 87 }
89 } 88 }
90 89
91 QString key ( ) 90 QString key ( )
92 { 91 {
93 if ( m_style_if ) 92 if ( m_style_if )
94 return QString ( m_style_if-> key ( )); 93 return QString ( m_style_if-> key ( ));
95 else 94 else
96 return text ( ); 95 return text ( );
97 } 96 }
98 97
99 QStyle *style ( ) 98 QStyle *style ( )
100 { 99 {
101 return m_style; 100 return m_style;
102 } 101 }
103 102
104private: 103private:
105 QLibrary *m_lib; 104 QLibrary *m_lib;
106 QStyle *m_style; 105 QStyle *m_style;
107 StyleInterface *m_style_if; 106 StyleInterface *m_style_if;
108 StyleSettingsInterface *m_settings_if; 107 StyleSettingsInterface *m_settings_if;
109 108
110}; 109};
111 110
112 111
113#endif 112#endif