summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-01 22:39:41 (UTC)
committer sandman <sandman>2002-10-01 22:39:41 (UTC)
commit73f578b88919d8f7220c3f647c4173ffa4e4512b (patch) (unidiff)
treeb925ef79ffafa54d8e9f81e4a3f1bcc100f6babd
parent536fffa98e7fb205fe1851caaf29011e3fad79cc (diff)
downloadopie-73f578b88919d8f7220c3f647c4173ffa4e4512b.zip
opie-73f578b88919d8f7220c3f647c4173ffa4e4512b.tar.gz
opie-73f578b88919d8f7220c3f647c4173ffa4e4512b.tar.bz2
fixed the missing/wrong icons in the tabbar
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index e269aec..43ff24c 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -1,589 +1,589 @@
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 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 5             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .: 20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "appearance.h" 30#include "appearance.h"
31#include "editScheme.h" 31#include "editScheme.h"
32 32
33#include <opie/ofiledialog.h> 33#include <opie/ofiledialog.h>
34#include <opie/otabwidget.h> 34#include <opie/otabwidget.h>
35 35
36#include <qpe/applnk.h> 36#include <qpe/applnk.h>
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
41#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 41#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43#endif 43#endif
44 44
45#include <qaction.h> 45#include <qaction.h>
46#include <qbuttongroup.h> 46#include <qbuttongroup.h>
47#include <qcheckbox.h> 47#include <qcheckbox.h>
48#include <qcombobox.h> 48#include <qcombobox.h>
49#include <qdialog.h> 49#include <qdialog.h>
50#include <qdir.h> 50#include <qdir.h>
51#include <qlabel.h> 51#include <qlabel.h>
52#include <qlayout.h> 52#include <qlayout.h>
53#include <qlineedit.h> 53#include <qlineedit.h>
54#include <qlistbox.h> 54#include <qlistbox.h>
55#include <qmessagebox.h> 55#include <qmessagebox.h>
56#include <qmultilineedit.h> 56#include <qmultilineedit.h>
57#include <qpopupmenu.h> 57#include <qpopupmenu.h>
58#include <qpushbutton.h> 58#include <qpushbutton.h>
59#include <qradiobutton.h> 59#include <qradiobutton.h>
60#if QT_VERSION >= 300 60#if QT_VERSION >= 300
61#include <qstylefactory.h> 61#include <qstylefactory.h>
62#else 62#else
63#include <qwindowsstyle.h> 63#include <qwindowsstyle.h>
64#include <qpe/qpestyle.h> 64#include <qpe/qpestyle.h>
65#include <qpe/lightstyle.h> 65#include <qpe/lightstyle.h>
66#include <qpe/qlibrary.h> 66#include <qpe/qlibrary.h>
67#include <qpe/styleinterface.h> 67#include <qpe/styleinterface.h>
68#endif 68#endif
69#include <qtabwidget.h> 69#include <qtabwidget.h>
70#include <qtoolbutton.h> 70#include <qtoolbutton.h>
71#include <qvgroupbox.h> 71#include <qvgroupbox.h>
72#include <qwidget.h> 72#include <qwidget.h>
73 73
74#include "stylelistitem.h" 74#include "stylelistitem.h"
75#include "decolistitem.h" 75#include "decolistitem.h"
76#include "colorlistitem.h" 76#include "colorlistitem.h"
77 77
78#include "sample.h" 78#include "sample.h"
79 79
80#include <opie/ofontselector.h> 80#include <opie/ofontselector.h>
81 81
82 82
83class DefaultWindowDecoration : public WindowDecorationInterface 83class DefaultWindowDecoration : public WindowDecorationInterface
84{ 84{
85public: 85public:
86 DefaultWindowDecoration() : ref(0) {} 86 DefaultWindowDecoration() : ref(0) {}
87 QString name() const { 87 QString name() const {
88 return "Default"; 88 return "Default";
89 } 89 }
90 QPixmap icon() const { 90 QPixmap icon() const {
91 return QPixmap(); 91 return QPixmap();
92 } 92 }
93 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 93 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
94 *iface = 0; 94 *iface = 0;
95 if ( uuid == IID_QUnknown ) 95 if ( uuid == IID_QUnknown )
96 *iface = this; 96 *iface = this;
97 else if ( uuid == IID_WindowDecoration ) 97 else if ( uuid == IID_WindowDecoration )
98 *iface = this; 98 *iface = this;
99 99
100 if ( *iface ) 100 if ( *iface )
101 (*iface)->addRef(); 101 (*iface)->addRef();
102 return QS_OK; 102 return QS_OK;
103 } 103 }
104 Q_REFCOUNT 104 Q_REFCOUNT
105 105
106private: 106private:
107 ulong ref; 107 ulong ref;
108}; 108};
109 109
110 110
111 111
112void Appearance::loadStyles ( QListBox *list ) 112void Appearance::loadStyles ( QListBox *list )
113{ 113{
114#if QT_VERSION >= 300 114#if QT_VERSION >= 300
115 list->insertStringList(QStyleFactory::styles()); 115 list->insertStringList(QStyleFactory::styles());
116#else 116#else
117 list->insertItem( new StyleListItem ( "Windows", new QWindowsStyle ( ))); 117 list->insertItem( new StyleListItem ( "Windows", new QWindowsStyle ( )));
118 list->insertItem( new StyleListItem ( "Light", new LightStyle ( ))); 118 list->insertItem( new StyleListItem ( "Light", new LightStyle ( )));
119#ifndef QT_NO_STYLE_MOTIF 119#ifndef QT_NO_STYLE_MOTIF
120 list->insertItem( new StyleListItem ( "Motif", new QMotifStyle ( ))); 120 list->insertItem( new StyleListItem ( "Motif", new QMotifStyle ( )));
121#endif 121#endif
122#ifndef QT_NO_STYLE_MOTIFPLUS 122#ifndef QT_NO_STYLE_MOTIFPLUS
123 list->insertItem( new StyleListItem ( "MotifPlus", new QMotifPlusStyle ( ))); 123 list->insertItem( new StyleListItem ( "MotifPlus", new QMotifPlusStyle ( )));
124#endif 124#endif
125#ifndef QT_NO_STYLE_PLATINUM 125#ifndef QT_NO_STYLE_PLATINUM
126 list->insertItem( new StyleListItem ( "Platinum", new QPlatinumStyle ( ))); 126 list->insertItem( new StyleListItem ( "Platinum", new QPlatinumStyle ( )));
127#endif 127#endif
128#endif 128#endif
129 list->insertItem( new StyleListItem ( "QPE", new QPEStyle ( ))); 129 list->insertItem( new StyleListItem ( "QPE", new QPEStyle ( )));
130 130
131#if QT_VERSION < 300 131#if QT_VERSION < 300
132 { 132 {
133 QString path = QPEApplication::qpeDir() + "/plugins/styles/"; 133 QString path = QPEApplication::qpeDir() + "/plugins/styles/";
134 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 134 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
135 135
136 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 136 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
137 QLibrary *lib = new QLibrary ( path + "/" + *it ); 137 QLibrary *lib = new QLibrary ( path + "/" + *it );
138 StyleInterface *iface; 138 StyleInterface *iface;
139 139
140 if ( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) 140 if ( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK )
141 list-> insertItem ( new StyleListItem ( lib, iface )); 141 list-> insertItem ( new StyleListItem ( lib, iface ));
142 else 142 else
143 delete lib; 143 delete lib;
144 } 144 }
145 } 145 }
146 146
147#endif 147#endif
148} 148}
149 149
150void Appearance::loadDecos ( QListBox *list ) 150void Appearance::loadDecos ( QListBox *list )
151{ 151{
152 list-> insertItem ( new DecoListItem ( tr( "Default" ))); 152 list-> insertItem ( new DecoListItem ( tr( "Default" )));
153 153
154 { 154 {
155 QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; 155 QString path = QPEApplication::qpeDir() + "/plugins/decorations/";
156 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 156 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
157 157
158 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 158 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
159 QLibrary *lib = new QLibrary ( path + "/" + *it ); 159 QLibrary *lib = new QLibrary ( path + "/" + *it );
160 WindowDecorationInterface *iface; 160 WindowDecorationInterface *iface;
161 161
162 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) 162 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK )
163 list-> insertItem ( new DecoListItem ( lib, iface )); 163 list-> insertItem ( new DecoListItem ( lib, iface ));
164 else 164 else
165 delete lib; 165 delete lib;
166 } 166 }
167 } 167 }
168} 168}
169 169
170void Appearance::loadColors ( QListBox *list ) 170void Appearance::loadColors ( QListBox *list )
171{ 171{
172 list-> clear ( ); 172 list-> clear ( );
173 { 173 {
174 Config config ( "qpe" ); 174 Config config ( "qpe" );
175 config. setGroup ( "Appearance" ); 175 config. setGroup ( "Appearance" );
176 176
177 list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), config )); 177 list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), config ));
178 } 178 }
179 179
180 QString path = QPEApplication::qpeDir ( ) + "/etc/colors/"; 180 QString path = QPEApplication::qpeDir ( ) + "/etc/colors/";
181 QStringList sl = QDir ( path ). entryList ( "*.scheme" ); 181 QStringList sl = QDir ( path ). entryList ( "*.scheme" );
182 182
183 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 183 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
184 QString name = (*it). left ((*it). find ( ".scheme" )); 184 QString name = (*it). left ((*it). find ( ".scheme" ));
185 Config config ( path + *it, Config::File ); 185 Config config ( path + *it, Config::File );
186 config. setGroup ( "Colors" ); 186 config. setGroup ( "Colors" );
187 187
188 list-> insertItem ( new ColorListItem ( name, config )); 188 list-> insertItem ( new ColorListItem ( name, config ));
189 } 189 }
190} 190}
191 191
192 192
193QWidget *Appearance::createStyleTab ( QWidget *parent ) 193QWidget *Appearance::createStyleTab ( QWidget *parent )
194{ 194{
195 Config config ( "qpe" ); 195 Config config ( "qpe" );
196 config. setGroup ( "Appearance" ); 196 config. setGroup ( "Appearance" );
197 197
198 QWidget* tab = new QWidget( parent, "StyleTab" ); 198 QWidget* tab = new QWidget( parent, "StyleTab" );
199 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 ); 199 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 );
200 200
201 m_style_list = new QListBox( tab, "m_style_list" ); 201 m_style_list = new QListBox( tab, "m_style_list" );
202 vertLayout->addWidget( m_style_list ); 202 vertLayout->addWidget( m_style_list );
203 203
204 m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); 204 m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
205 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); 205 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( )));
206 vertLayout-> addWidget ( m_style_settings ); 206 vertLayout-> addWidget ( m_style_settings );
207 207
208 loadStyles ( m_style_list ); 208 loadStyles ( m_style_list );
209 209
210 QString s = config. readEntry ( "Style", "Light" ); 210 QString s = config. readEntry ( "Style", "Light" );
211 m_style_list-> setCurrentItem ( m_style_list-> findItem ( s )); 211 m_style_list-> setCurrentItem ( m_style_list-> findItem ( s ));
212 m_original_style = m_style_list-> currentItem ( ); 212 m_original_style = m_style_list-> currentItem ( );
213 styleClicked ( m_original_style ); 213 styleClicked ( m_original_style );
214 214
215 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); 215 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) );
216 216
217 return tab; 217 return tab;
218} 218}
219 219
220QWidget *Appearance::createDecoTab ( QWidget *parent ) 220QWidget *Appearance::createDecoTab ( QWidget *parent )
221{ 221{
222 Config config ( "qpe" ); 222 Config config ( "qpe" );
223 config. setGroup ( "Appearance" ); 223 config. setGroup ( "Appearance" );
224 224
225 QWidget* tab = new QWidget( parent, "DecoTab" ); 225 QWidget* tab = new QWidget( parent, "DecoTab" );
226 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 ); 226 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 );
227 227
228 m_deco_list = new QListBox( tab, "m_deco_list" ); 228 m_deco_list = new QListBox( tab, "m_deco_list" );
229 vertLayout->addWidget( m_deco_list ); 229 vertLayout->addWidget( m_deco_list );
230 230
231 loadDecos ( m_deco_list ); 231 loadDecos ( m_deco_list );
232 232
233 QString s = config. readEntry ( "Decoration" ); 233 QString s = config. readEntry ( "Decoration" );
234 m_deco_list-> setCurrentItem ( m_deco_list-> findItem ( s )); 234 m_deco_list-> setCurrentItem ( m_deco_list-> findItem ( s ));
235 m_original_deco = m_deco_list-> currentItem ( ); 235 m_original_deco = m_deco_list-> currentItem ( );
236 if ( m_deco_list-> currentItem ( ) < 0 ) 236 if ( m_deco_list-> currentItem ( ) < 0 )
237 m_deco_list-> setCurrentItem ( 0 ); 237 m_deco_list-> setCurrentItem ( 0 );
238 decoClicked ( m_original_deco ); 238 decoClicked ( m_original_deco );
239 239
240 connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); 240 connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) );
241 241
242 return tab; 242 return tab;
243} 243}
244 244
245QWidget *Appearance::createFontTab ( QWidget *parent ) 245QWidget *Appearance::createFontTab ( QWidget *parent )
246{ 246{
247 Config config ( "qpe" ); 247 Config config ( "qpe" );
248 config. setGroup ( "Appearance" ); 248 config. setGroup ( "Appearance" );
249 249
250 QString familyStr = config.readEntry( "FontFamily", "Helvetica" ); 250 QString familyStr = config.readEntry( "FontFamily", "Helvetica" );
251 QString styleStr = config.readEntry( "FontStyle", "Regular" ); 251 QString styleStr = config.readEntry( "FontStyle", "Regular" );
252 int size = config.readNumEntry( "FontSize", 10 ); 252 int size = config.readNumEntry( "FontSize", 10 );
253 253
254 m_fontselect = new OFontSelector ( false, parent, "FontTab" ); 254 m_fontselect = new OFontSelector ( false, parent, "FontTab" );
255 m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); 255 m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
256 256
257 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 257 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
258 this, SLOT( fontClicked ( const QFont & ))); 258 this, SLOT( fontClicked ( const QFont & )));
259 259
260 return m_fontselect; 260 return m_fontselect;
261} 261}
262 262
263QWidget *Appearance::createColorTab ( QWidget *parent ) 263QWidget *Appearance::createColorTab ( QWidget *parent )
264{ 264{
265 Config config ( "qpe" ); 265 Config config ( "qpe" );
266 config. setGroup ( "Appearance" ); 266 config. setGroup ( "Appearance" );
267 267
268 268
269 QWidget *tab = new QWidget( parent, "ColorTab" ); 269 QWidget *tab = new QWidget( parent, "ColorTab" );
270 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 4, 4 ); 270 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 4, 4 );
271 gridLayout->setRowStretch ( 3, 10 ); 271 gridLayout->setRowStretch ( 3, 10 );
272 272
273 m_color_list = new QListBox ( tab ); 273 m_color_list = new QListBox ( tab );
274 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); 274 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 );
275 connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); 275 connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) );
276 276
277 loadColors ( m_color_list ); 277 loadColors ( m_color_list );
278 m_color_list-> setCurrentItem ( 0 ); 278 m_color_list-> setCurrentItem ( 0 );
279 279
280 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); 280 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" );
281 tempButton->setText( tr( "Edit..." ) ); 281 tempButton->setText( tr( "Edit..." ) );
282 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); 282 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) );
283 gridLayout->addWidget( tempButton, 0, 1 ); 283 gridLayout->addWidget( tempButton, 0, 1 );
284 284
285 tempButton = new QPushButton( tab, "deleteSchemeButton" ); 285 tempButton = new QPushButton( tab, "deleteSchemeButton" );
286 tempButton->setText( tr( "Delete" ) ); 286 tempButton->setText( tr( "Delete" ) );
287 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); 287 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) );
288 gridLayout->addWidget( tempButton, 1, 1 ); 288 gridLayout->addWidget( tempButton, 1, 1 );
289 289
290 tempButton = new QPushButton( tab, "saveSchemeButton" ); 290 tempButton = new QPushButton( tab, "saveSchemeButton" );
291 tempButton->setText( tr( "Save" ) ); 291 tempButton->setText( tr( "Save" ) );
292 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); 292 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) );
293 gridLayout->addWidget( tempButton, 2, 1 ); 293 gridLayout->addWidget( tempButton, 2, 1 );
294 294
295 return tab; 295 return tab;
296} 296}
297 297
298QWidget *Appearance::createGuiTab ( QWidget *parent ) 298QWidget *Appearance::createGuiTab ( QWidget *parent )
299{ 299{
300 Config config ( "qpe" ); 300 Config config ( "qpe" );
301 config. setGroup ( "Appearance" ); 301 config. setGroup ( "Appearance" );
302 302
303 QWidget *tab = new QWidget( parent, "AdvancedTab" ); 303 QWidget *tab = new QWidget( parent, "AdvancedTab" );
304 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); 304 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
305 305
306 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 306 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
307 307
308 int style = config. readNumEntry ( "TabStyle", 2 ) - 1; 308 int style = config. readNumEntry ( "TabStyle", 2 ) - 1;
309 bool tabtop = ( config. readEntry ( "TabPosition", "Top" ) == "Top" ); 309 bool tabtop = ( config. readEntry ( "TabPosition", "Top" ) == "Top" );
310 310
311 QLabel* label = new QLabel( tr( "Tab style:" ), tab ); 311 QLabel* label = new QLabel( tr( "Tab style:" ), tab );
312 gridLayout-> addWidget ( label, 0, 0 ); 312 gridLayout-> addWidget ( label, 0, 0 );
313 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); 313 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
314 btngrp-> hide ( ); 314 btngrp-> hide ( );
315 btngrp-> setExclusive ( true ); 315 btngrp-> setExclusive ( true );
316 316
317 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); 317 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
318 m_tabstyle_list-> insertItem ( tr( "Tabs" )); 318 m_tabstyle_list-> insertItem ( tr( "Tabs" ));
319 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); 319 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
320 m_tabstyle_list-> insertItem ( tr( "Drop down list" )); 320 m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
321 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); 321 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
322 m_tabstyle_list-> setCurrentItem ( style ); 322 m_tabstyle_list-> setCurrentItem ( style );
323 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); 323 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
324 324
325 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); 325 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
326 btngrp-> insert ( m_tabstyle_top ); 326 btngrp-> insert ( m_tabstyle_top );
327 gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); 327 gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
328 328
329 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); 329 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
330 btngrp-> insert ( m_tabstyle_bottom ); 330 btngrp-> insert ( m_tabstyle_bottom );
331 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); 331 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
332 332
333 m_tabstyle_top-> setChecked ( tabtop ); 333 m_tabstyle_top-> setChecked ( tabtop );
334 m_tabstyle_bottom-> setChecked ( !tabtop ); 334 m_tabstyle_bottom-> setChecked ( !tabtop );
335 335
336 m_original_tabstyle = style; 336 m_original_tabstyle = style;
337 m_original_tabpos = tabtop; 337 m_original_tabpos = tabtop;
338 338
339 return tab; 339 return tab;
340} 340}
341 341
342 342
343Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 343Appearance::Appearance( QWidget* parent, const char* name, WFlags )
344 : QDialog ( parent, name, true ) 344 : QDialog ( parent, name, true )
345{ 345{
346 setCaption( tr( "Appearance" ) ); 346 setCaption( tr( "Appearance" ) );
347 347
348 Config config( "qpe" ); 348 Config config( "qpe" );
349 config.setGroup( "Appearance" ); 349 config.setGroup( "Appearance" );
350 350
351 QVBoxLayout *top = new QVBoxLayout ( this, 4, 4 ); 351 QVBoxLayout *top = new QVBoxLayout ( this, 4, 4 );
352 352
353 m_sample = new SampleWindow ( this ); 353 m_sample = new SampleWindow ( this );
354 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 354 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
355 355
356 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 356 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
357 QWidget *styletab; 357 QWidget *styletab;
358 358
359 tw-> addTab ( styletab = createStyleTab ( tw ), "appearance/styletabicon.png", tr( "Style" )); 359 tw-> addTab ( styletab = createStyleTab ( tw ), "appearance/styletabicon.png", tr( "Style" ));
360 tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); 360 tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" ));
361 tw-> addTab ( createColorTab ( tw ), "appearance/colorstabicon.png", tr( "Colors" ) ); 361 tw-> addTab ( createColorTab ( tw ), "appearance/colorstabicon.png", tr( "Colors" ) );
362 tw-> addTab ( createDecoTab ( tw ), "appearance/styletabicon.png", tr( "Windows" ) ); 362 tw-> addTab ( createDecoTab ( tw ), "appearance/decotabicon.png", tr( "Windows" ) );
363 tw-> addTab ( createGuiTab ( tw ), "appearance/backgroundtabicon.png", tr( "Gui" ) ); 363 tw-> addTab ( createGuiTab ( tw ), "appearance/advancedtabicon.png", tr( "Gui" ) );
364 364
365 top-> addWidget ( tw, 10 ); 365 top-> addWidget ( tw, 10 );
366 top-> addWidget ( m_sample, 1 ); 366 top-> addWidget ( m_sample, 1 );
367 367
368 tw-> setCurrentTab ( styletab ); 368 tw-> setCurrentTab ( styletab );
369} 369}
370 370
371Appearance::~Appearance() 371Appearance::~Appearance()
372{ 372{
373} 373}
374 374
375void Appearance::accept ( ) 375void Appearance::accept ( )
376{ 376{
377 Config config("qpe"); 377 Config config("qpe");
378 config.setGroup( "Appearance" ); 378 config.setGroup( "Appearance" );
379 379
380 int newtabstyle = m_tabstyle_list-> currentItem ( ); 380 int newtabstyle = m_tabstyle_list-> currentItem ( );
381 bool newtabpos = m_tabstyle_top-> isChecked ( ); 381 bool newtabpos = m_tabstyle_top-> isChecked ( );
382 382
383 383
384 if ( m_style_changed ) { 384 if ( m_style_changed ) {
385 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 385 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
386 if ( item ) 386 if ( item )
387 config.writeEntry( "Style", item-> key ( )); 387 config.writeEntry( "Style", item-> key ( ));
388 } 388 }
389 389
390 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { 390 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) {
391 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 391 config. writeEntry ( "TabStyle", newtabstyle + 1 );
392 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 392 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
393 } 393 }
394 394
395 if ( m_font_changed ) { 395 if ( m_font_changed ) {
396 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 396 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
397 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 397 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
398 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 398 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
399 } 399 }
400 400
401 401
402 if ( m_color_changed ) 402 if ( m_color_changed )
403 { 403 {
404 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 404 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
405 405
406 if ( item ) 406 if ( item )
407 item-> save ( config ); 407 item-> save ( config );
408 } 408 }
409 409
410 config. write ( ); // need to flush the config info first 410 config. write ( ); // need to flush the config info first
411 Global::applyStyle ( ); 411 Global::applyStyle ( );
412 412
413 if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart Opie now?" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { 413 if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart Opie now?" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
414 QCopEnvelope e( "QPE/System", "restart()" ); 414 QCopEnvelope e( "QPE/System", "restart()" );
415 } 415 }
416 416
417 QDialog::accept ( ); 417 QDialog::accept ( );
418} 418}
419 419
420void Appearance::done ( int r ) 420void Appearance::done ( int r )
421{ 421{
422 QDialog::done ( r ); 422 QDialog::done ( r );
423 close ( ); 423 close ( );
424} 424}
425 425
426 426
427void Appearance::styleClicked ( int index ) 427void Appearance::styleClicked ( int index )
428{ 428{
429 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); 429 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
430 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); 430 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
431 431
432 if ( m_sample && sli && sli-> style ( )) 432 if ( m_sample && sli && sli-> style ( ))
433 m_sample-> setStyle2 ( sli-> style ( )); 433 m_sample-> setStyle2 ( sli-> style ( ));
434 434
435 m_style_changed |= ( index != m_original_style ); 435 m_style_changed |= ( index != m_original_style );
436} 436}
437 437
438void Appearance::styleSettingsClicked ( ) 438void Appearance::styleSettingsClicked ( )
439{ 439{
440 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 440 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
441 441
442 if ( item && item-> hasSettings ( )) { 442 if ( item && item-> hasSettings ( )) {
443 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); 443 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
444 QVBoxLayout *vbox = new QVBoxLayout ( d, 4, 0 ); 444 QVBoxLayout *vbox = new QVBoxLayout ( d, 4, 0 );
445 445
446 QWidget *w = item-> settings ( d ); 446 QWidget *w = item-> settings ( d );
447 447
448 if ( w ) { 448 if ( w ) {
449 vbox-> addWidget ( w ); 449 vbox-> addWidget ( w );
450 450
451 d-> setCaption ( w-> caption ( )); 451 d-> setCaption ( w-> caption ( ));
452 452
453 d-> showMaximized ( ); 453 d-> showMaximized ( );
454 bool accepted = ( d-> exec ( ) == QDialog::Accepted ); 454 bool accepted = ( d-> exec ( ) == QDialog::Accepted );
455 455
456 if ( item-> setSettings ( accepted )) 456 if ( item-> setSettings ( accepted ))
457 m_style_changed = true; 457 m_style_changed = true;
458 } 458 }
459 delete d; 459 delete d;
460 } 460 }
461} 461}
462 462
463void Appearance::decoClicked ( int index ) 463void Appearance::decoClicked ( int index )
464{ 464{
465 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); 465 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index );
466 466
467 if ( m_sample ) { 467 if ( m_sample ) {
468 if ( dli && dli-> interface ( )) 468 if ( dli && dli-> interface ( ))
469 m_sample-> setDecoration ( dli-> interface ( )); 469 m_sample-> setDecoration ( dli-> interface ( ));
470 else 470 else
471 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 471 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
472 } 472 }
473 m_deco_changed |= ( index != m_original_deco ); 473 m_deco_changed |= ( index != m_original_deco );
474} 474}
475 475
476void Appearance::fontClicked ( const QFont &f ) 476void Appearance::fontClicked ( const QFont &f )
477{ 477{
478 m_font_changed |= ( f != m_sample-> font ( )); 478 m_font_changed |= ( f != m_sample-> font ( ));
479 m_sample-> setFont ( f ); 479 m_sample-> setFont ( f );
480} 480}
481 481
482void Appearance::colorClicked ( int index ) 482void Appearance::colorClicked ( int index )
483{ 483{
484 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); 484 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index );
485 485
486 if ( item ) 486 if ( item )
487 m_sample-> setPalette ( item-> palette ( )); 487 m_sample-> setPalette ( item-> palette ( ));
488 488
489 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); 489 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( ));
490} 490}
491 491
492 492
493void Appearance::editSchemeClicked ( ) 493void Appearance::editSchemeClicked ( )
494{ 494{
495 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 495 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
496 496
497 int cnt = 0; 497 int cnt = 0;
498 QString labels [QColorGroup::NColorRoles]; 498 QString labels [QColorGroup::NColorRoles];
499 QColor colors [QColorGroup::NColorRoles]; 499 QColor colors [QColorGroup::NColorRoles];
500 500
501 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { 501 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
502 QColor col = item-> color ( role ); 502 QColor col = item-> color ( role );
503 503
504 if ( col. isValid ( )) { 504 if ( col. isValid ( )) {
505 labels [cnt] = item-> label ( role ); 505 labels [cnt] = item-> label ( role );
506 colors [cnt] = col; 506 colors [cnt] = col;
507 507
508 cnt++; 508 cnt++;
509 } 509 }
510 } 510 }
511 511
512 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); 512 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true );
513 editdlg-> showMaximized ( ); 513 editdlg-> showMaximized ( );
514 if ( editdlg-> exec ( ) == QDialog::Accepted ) { 514 if ( editdlg-> exec ( ) == QDialog::Accepted ) {
515 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); 515 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 );
516 cnt = 0; 516 cnt = 0;
517 517
518 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { 518 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
519 if ( item-> color ( role ). isValid ( )) { 519 if ( item-> color ( role ). isValid ( )) {
520 citem-> setColor ( role, colors [cnt] ); 520 citem-> setColor ( role, colors [cnt] );
521 cnt++; 521 cnt++;
522 } 522 }
523 } 523 }
524 524
525 m_color_list-> setCurrentItem ( 0 ); 525 m_color_list-> setCurrentItem ( 0 );
526 colorClicked ( 0 ); 526 colorClicked ( 0 );
527 527
528 m_color_changed = true; 528 m_color_changed = true;
529 } 529 }
530 delete editdlg; 530 delete editdlg;
531} 531}
532 532
533 533
534void Appearance::saveSchemeClicked() 534void Appearance::saveSchemeClicked()
535{ 535{
536 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 536 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
537 537
538 if ( !item ) 538 if ( !item )
539 return; 539 return;
540 540
541 QDialog *d = new QDialog ( this, 0, true ); 541 QDialog *d = new QDialog ( this, 0, true );
542 d-> setCaption ( tr( "Save Scheme" )); 542 d-> setCaption ( tr( "Save Scheme" ));
543 QLineEdit *ed = new QLineEdit ( this ); 543 QLineEdit *ed = new QLineEdit ( this );
544 ( new QVBoxLayout ( d, 4, 4 ))-> addWidget ( ed ); 544 ( new QVBoxLayout ( d, 4, 4 ))-> addWidget ( ed );
545 545
546 if ( d-> exec ( ) == QDialog::Accepted ) { 546 if ( d-> exec ( ) == QDialog::Accepted ) {
547 QString schemename = ed-> text ( ); 547 QString schemename = ed-> text ( );
548 QFile file ( QPEApplication::qpeDir() + "/etc/colors/" + schemename + ".scheme" ); 548 QFile file ( QPEApplication::qpeDir() + "/etc/colors/" + schemename + ".scheme" );
549 if ( !file. exists ( )) 549 if ( !file. exists ( ))
550 { 550 {
551 QPalette p = item-> palette ( ); 551 QPalette p = item-> palette ( );
552 552
553 Config config ( file.name(), Config::File ); 553 Config config ( file.name(), Config::File );
554 config. setGroup( "Colors" ); 554 config. setGroup( "Colors" );
555 555
556 item-> save ( config ); 556 item-> save ( config );
557 557
558 config. write ( ); // need to flush the config info first 558 config. write ( ); // need to flush the config info first
559 loadColors ( m_color_list ); 559 loadColors ( m_color_list );
560 } 560 }
561 else 561 else
562 { 562 {
563 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); 563 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
564 } 564 }
565 } 565 }
566 delete d; 566 delete d;
567} 567}
568 568
569void Appearance::deleteSchemeClicked() 569void Appearance::deleteSchemeClicked()
570{ 570{
571 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 571 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
572 572
573 if ( !item ) 573 if ( !item )
574 return; 574 return;
575 575
576 if ( m_color_list-> currentItem ( ) > 0 ) 576 if ( m_color_list-> currentItem ( ) > 0 )
577 { 577 {
578 if ( QMessageBox::warning ( this, tr( "Delete scheme" ), tr( "Do you really want to delete\n" ) + item-> text ( ) + "?", 578 if ( QMessageBox::warning ( this, tr( "Delete scheme" ), tr( "Do you really want to delete\n" ) + item-> text ( ) + "?",
579 tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { 579 tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
580 QFile::remove ( QPEApplication::qpeDir ( ) + "/etc/colors/" + item-> text ( ) + ".scheme" ); 580 QFile::remove ( QPEApplication::qpeDir ( ) + "/etc/colors/" + item-> text ( ) + ".scheme" );
581 loadColors ( m_color_list ); 581 loadColors ( m_color_list );
582 } 582 }
583 } 583 }
584 else 584 else
585 { 585 {
586 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); 586 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." ));
587 } 587 }
588} 588}
589 589