summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/rotateapplet/rotate.cpp10
-rw-r--r--noncore/settings/appearance2/appearance.cpp24
-rw-r--r--noncore/settings/appearance2/appearance.h1
3 files changed, 26 insertions, 9 deletions
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
index 0ead016..b490626 100644
--- a/core/applets/rotateapplet/rotate.cpp
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -1,142 +1,144 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org> 3             .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library 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 Library 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 library 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
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .     .: 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  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-= this library; see the file COPYING.LIB. 22    --        :-= this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 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 29
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
32 32
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qiconset.h> 35#include <qiconset.h>
36#include <qpopupmenu.h> 36#include <qpopupmenu.h>
37 37
38#include "rotate.h" 38#include "rotate.h"
39 39
40 40
41RotateApplet::RotateApplet ( ) 41RotateApplet::RotateApplet ( )
42 : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false ) 42 : QObject ( 0, "RotateApplet" ), ref ( 0 ), m_flipped( false )
43{ 43{
44} 44}
45 45
46RotateApplet::~RotateApplet ( ) 46RotateApplet::~RotateApplet ( )
47{ 47{
48} 48}
49 49
50int RotateApplet::position ( ) const 50int RotateApplet::position ( ) const
51{ 51{
52 return 3; 52 return 3;
53} 53}
54 54
55QString RotateApplet::name ( ) const 55QString RotateApplet::name ( ) const
56{ 56{
57 return tr( "Rotate shortcut" ); 57 return tr( "Rotate shortcut" );
58} 58}
59 59
60QString RotateApplet::text ( ) const 60QString RotateApplet::text ( ) const
61{ 61{
62 return tr( "Rotate" ); 62 return tr( "Rotate" );
63} 63}
64 64
65QString RotateApplet::tr( const char* s ) const 65QString RotateApplet::tr( const char* s ) const
66{ 66{
67 return qApp->translate( "RotateApplet", s, 0 ); 67 return qApp->translate( "RotateApplet", s, 0 );
68} 68}
69 69
70QString RotateApplet::tr( const char* s, const char* p ) const 70QString RotateApplet::tr( const char* s, const char* p ) const
71{ 71{
72 return qApp->translate( "RotateApplet", s, p ); 72 return qApp->translate( "RotateApplet", s, p );
73} 73}
74 74
75QIconSet RotateApplet::icon ( ) const 75QIconSet RotateApplet::icon ( ) const
76{ 76{
77 QPixmap pix; 77 QPixmap pix;
78 QImage img = Resource::loadImage ( "Rotation" ); 78 QImage img = Resource::loadImage ( "Rotation" );
79 79
80 if ( !img. isNull ( )) 80 if ( !img. isNull ( ))
81 pix. convertFromImage ( img. smoothScale ( 14, 14 )); 81 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
82 return pix; 82 return pix;
83} 83}
84 84
85QPopupMenu *RotateApplet::popup ( QWidget * ) const 85QPopupMenu *RotateApplet::popup ( QWidget * ) const
86{ 86{
87 return 0; 87 return 0;
88} 88}
89 89
90void RotateApplet::activated ( ) 90void RotateApplet::activated ( )
91{ 91{
92 int defaultRotation = QPEApplication::defaultRotation(); 92 int defaultRotation = QPEApplication::defaultRotation();
93 93
94 int newRotation; 94 int newRotation;
95 95
96 Config cfg( "qpe" ); 96 Config cfg( "qpe" );
97 cfg.setGroup( "Appearance" ); 97 cfg.setGroup( "Appearance" );
98 98
99 // 0 -> 90° clockwise, 1 -> 90° counterclockwise 99 // 0 -> 90° clockwise, 1 -> 90° counterclockwise
100 bool rotDirection = cfg.readBoolEntry( "rotatedir", 0 ); 100 int rotDirection = cfg.readNumEntry( "rotatedir", 0 );
101 101
102 // hide inputs methods before rotation 102 // hide inputs methods before rotation
103 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); 103 QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" );
104 104
105 if ( m_flipped ) { 105 if ( m_flipped ) {
106 // if flipped, flip back to the original state, 106 // if flipped, flip back to the original state,
107 // regardless of rotation direction 107 // regardless of rotation direction
108 newRotation = defaultRotation; 108 newRotation = defaultRotation;
109 } else { 109 } else {
110 if ( rotDirection ) { 110 if ( rotDirection == 1 ) {
111 newRotation = ( defaultRotation + 90 ) % 360; 111 newRotation = ( defaultRotation + 90 ) % 360;
112 } else { 112 } else if ( rotDirection == 0 ) {
113 newRotation = ( defaultRotation + 270 ) % 360; 113 newRotation = ( defaultRotation + 270 ) % 360;
114 } 114 } else {
115 newRotation = ( defaultRotation + 180 ) % 360;
116 }
115 } 117 }
116 118
117 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); 119 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" );
118 env << newRotation; 120 env << newRotation;
119 121
120 m_flipped = !m_flipped; 122 m_flipped = !m_flipped;
121} 123}
122 124
123 125
124QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) 126QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
125{ 127{
126 *iface = 0; 128 *iface = 0;
127 if ( uuid == IID_QUnknown ) 129 if ( uuid == IID_QUnknown )
128 *iface = this; 130 *iface = this;
129 else if ( uuid == IID_MenuApplet ) 131 else if ( uuid == IID_MenuApplet )
130 *iface = this; 132 *iface = this;
131 133
132 if ( *iface ) 134 if ( *iface )
133 (*iface)-> addRef ( ); 135 (*iface)-> addRef ( );
134 return QS_OK; 136 return QS_OK;
135} 137}
136 138
137Q_EXPORT_INTERFACE( ) 139Q_EXPORT_INTERFACE( )
138{ 140{
139 Q_CREATE_INSTANCE( RotateApplet ) 141 Q_CREATE_INSTANCE( RotateApplet )
140} 142}
141 143
142 144
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 32234f0..83532de 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -220,497 +220,511 @@ QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
220 int size = cfg. readNumEntry ( "FontSize", 10 ); 220 int size = cfg. readNumEntry ( "FontSize", 10 );
221 221
222 m_fontselect = new OFontSelector ( false, parent, "FontTab" ); 222 m_fontselect = new OFontSelector ( false, parent, "FontTab" );
223 m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); 223 m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
224 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); 224 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) );
225 225
226 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 226 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
227 this, SLOT( fontClicked ( const QFont & ))); 227 this, SLOT( fontClicked ( const QFont & )));
228 228
229 return m_fontselect; 229 return m_fontselect;
230} 230}
231 231
232QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) 232QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
233{ 233{
234 QWidget *tab = new QWidget( parent, "ColorTab" ); 234 QWidget *tab = new QWidget( parent, "ColorTab" );
235 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); 235 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 );
236 gridLayout->setRowStretch ( 3, 10 ); 236 gridLayout->setRowStretch ( 3, 10 );
237 237
238 m_color_list = new QListBox ( tab ); 238 m_color_list = new QListBox ( tab );
239 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); 239 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 );
240 connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); 240 connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) );
241 QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); 241 QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) );
242 242
243 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); 243 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg ));
244 244
245 QString path = QPEApplication::qpeDir ( ); 245 QString path = QPEApplication::qpeDir ( );
246 path.append( "/etc/colors/" ); 246 path.append( "/etc/colors/" );
247 QStringList sl = QDir ( path ). entryList ( "*.scheme" ); 247 QStringList sl = QDir ( path ). entryList ( "*.scheme" );
248 248
249 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 249 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
250 QString name = (*it). left ((*it). find ( ".scheme" )); 250 QString name = (*it). left ((*it). find ( ".scheme" ));
251 QString pathstr = path; 251 QString pathstr = path;
252 pathstr.append( *it ); 252 pathstr.append( *it );
253 Config config ( pathstr, Config::File ); 253 Config config ( pathstr, Config::File );
254 config. setGroup ( "Colors" ); 254 config. setGroup ( "Colors" );
255 255
256 m_color_list-> insertItem ( new ColorListItem ( name, config )); 256 m_color_list-> insertItem ( new ColorListItem ( name, config ));
257 } 257 }
258 258
259 m_color_list-> setCurrentItem ( 0 ); 259 m_color_list-> setCurrentItem ( 0 );
260 260
261 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); 261 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" );
262 tempButton->setText( tr( "Edit..." ) ); 262 tempButton->setText( tr( "Edit..." ) );
263 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); 263 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) );
264 gridLayout->addWidget( tempButton, 0, 1 ); 264 gridLayout->addWidget( tempButton, 0, 1 );
265 QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); 265 QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) );
266 266
267 tempButton = new QPushButton( tab, "deleteSchemeButton" ); 267 tempButton = new QPushButton( tab, "deleteSchemeButton" );
268 tempButton->setText( tr( "Delete" ) ); 268 tempButton->setText( tr( "Delete" ) );
269 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); 269 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) );
270 gridLayout->addWidget( tempButton, 1, 1 ); 270 gridLayout->addWidget( tempButton, 1, 1 );
271 QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); 271 QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) );
272 272
273 tempButton = new QPushButton( tab, "saveSchemeButton" ); 273 tempButton = new QPushButton( tab, "saveSchemeButton" );
274 tempButton->setText( tr( "Save" ) ); 274 tempButton->setText( tr( "Save" ) );
275 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); 275 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) );
276 gridLayout->addWidget( tempButton, 2, 1 ); 276 gridLayout->addWidget( tempButton, 2, 1 );
277 QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); 277 QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) );
278 278
279 return tab; 279 return tab;
280} 280}
281 281
282QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) 282QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
283{ 283{
284 QWidget *tab = new QWidget ( parent ); 284 QWidget *tab = new QWidget ( parent );
285 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 285 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
286 286
287 QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); 287 QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
288 288
289 m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); 289 m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab );
290 m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); 290 m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" ));
291 lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); 291 lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 );
292 QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); 292 QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) );
293 293
294 QLabel *l = new QLabel ( tab ); 294 QLabel *l = new QLabel ( tab );
295 l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); 295 l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" )));
296 lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); 296 lay-> addMultiCellWidget ( l, 1, 1, 0, 1 );
297 QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); 297 QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) );
298 298
299 m_except = new QListView ( tab ); 299 m_except = new QListView ( tab );
300 m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); 300 m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 );
301 m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); 301 m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 );
302 m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); 302 m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 );
303 m_except-> addColumn ( tr( "Binary file(s)" )); 303 m_except-> addColumn ( tr( "Binary file(s)" ));
304 m_except-> setColumnAlignment ( 0, AlignCenter ); 304 m_except-> setColumnAlignment ( 0, AlignCenter );
305 m_except-> setColumnAlignment ( 1, AlignCenter ); 305 m_except-> setColumnAlignment ( 1, AlignCenter );
306 m_except-> setColumnAlignment ( 2, AlignCenter ); 306 m_except-> setColumnAlignment ( 2, AlignCenter );
307 m_except-> setAllColumnsShowFocus ( true ); 307 m_except-> setAllColumnsShowFocus ( true );
308 m_except-> setMinimumHeight ( 30 ); 308 m_except-> setMinimumHeight ( 30 );
309 m_except-> header ( )-> setClickEnabled ( false ); 309 m_except-> header ( )-> setClickEnabled ( false );
310 m_except-> header ( )-> setResizeEnabled ( false ); 310 m_except-> header ( )-> setResizeEnabled ( false );
311 m_except-> header ( )-> setMovingEnabled ( false ); 311 m_except-> header ( )-> setMovingEnabled ( false );
312 m_except-> setSorting ( -1 ); 312 m_except-> setSorting ( -1 );
313 lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); 313 lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 );
314 QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); 314 QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) );
315 315
316 connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); 316 connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int )));
317 317
318 QToolButton *tb = new QToolButton ( tab ); 318 QToolButton *tb = new QToolButton ( tab );
319 tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); 319 tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" ));
320 tb-> setFocusPolicy ( QWidget::StrongFocus ); 320 tb-> setFocusPolicy ( QWidget::StrongFocus );
321 lay-> addWidget ( tb, 2, 1 ); 321 lay-> addWidget ( tb, 2, 1 );
322 connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); 322 connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( )));
323 QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); 323 QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) );
324 324
325 tb = new QToolButton ( tab ); 325 tb = new QToolButton ( tab );
326 tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); 326 tb-> setIconSet ( Resource::loadIconSet ( "editdelete" ));
327 tb-> setFocusPolicy ( QWidget::StrongFocus ); 327 tb-> setFocusPolicy ( QWidget::StrongFocus );
328 lay-> addWidget ( tb, 3, 1 ); 328 lay-> addWidget ( tb, 3, 1 );
329 connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); 329 connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( )));
330 QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); 330 QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) );
331 331
332 tb = new QToolButton ( tab ); 332 tb = new QToolButton ( tab );
333 tb-> setIconSet ( Resource::loadIconSet ( "up" )); 333 tb-> setIconSet ( Resource::loadIconSet ( "up" ));
334 tb-> setFocusPolicy ( QWidget::StrongFocus ); 334 tb-> setFocusPolicy ( QWidget::StrongFocus );
335 lay-> addWidget ( tb, 4, 1 ); 335 lay-> addWidget ( tb, 4, 1 );
336 connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); 336 connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( )));
337 QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); 337 QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) );
338 338
339 tb = new QToolButton ( tab ); 339 tb = new QToolButton ( tab );
340 tb-> setIconSet ( Resource::loadIconSet ( "down" )); 340 tb-> setIconSet ( Resource::loadIconSet ( "down" ));
341 tb-> setFocusPolicy ( QWidget::StrongFocus ); 341 tb-> setFocusPolicy ( QWidget::StrongFocus );
342 lay-> addWidget ( tb, 5, 1 ); 342 lay-> addWidget ( tb, 5, 1 );
343 connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); 343 connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( )));
344 QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); 344 QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) );
345 345
346 lay-> setRowStretch ( 6, 10 ); 346 lay-> setRowStretch ( 6, 10 );
347 lay-> setColStretch ( 0, 10 ); 347 lay-> setColStretch ( 0, 10 );
348 348
349 QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); 349 QStringList sl = cfg. readListEntry ( "NoStyle", ';' );
350 QListViewItem *lvit = 0; 350 QListViewItem *lvit = 0;
351 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 351 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
352 int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); 352 int fl = ( *it ). left ( 1 ). toInt ( 0, 32 );
353 353
354 lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); 354 lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 );
355 } 355 }
356 356
357 357
358 vertLayout-> addSpacing ( 3 ); 358 vertLayout-> addSpacing ( 3 );
359 QFrame *f = new QFrame ( tab ); 359 QFrame *f = new QFrame ( tab );
360 f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); 360 f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken );
361 vertLayout-> addWidget ( f ); 361 vertLayout-> addWidget ( f );
362 vertLayout-> addSpacing ( 3 ); 362 vertLayout-> addSpacing ( 3 );
363 363
364 364
365 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); 365 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
366 366
367 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; 367 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1;
368 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); 368 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" );
369 369
370 QLabel* label = new QLabel( tr( "Tab style:" ), tab ); 370 QLabel* label = new QLabel( tr( "Tab style:" ), tab );
371 gridLayout-> addWidget ( label, 0, 0 ); 371 gridLayout-> addWidget ( label, 0, 0 );
372 QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); 372 QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
373 373
374 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); 374 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
375 btngrp-> hide ( ); 375 btngrp-> hide ( );
376 btngrp-> setExclusive ( true ); 376 btngrp-> setExclusive ( true );
377 377
378 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); 378 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
379 m_tabstyle_list-> insertItem ( tr( "Tabs" )); 379 m_tabstyle_list-> insertItem ( tr( "Tabs" ));
380 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); 380 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
381 m_tabstyle_list-> insertItem ( tr( "Drop down list" )); 381 m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
382 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); 382 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
383 m_tabstyle_list-> setCurrentItem ( style ); 383 m_tabstyle_list-> setCurrentItem ( style );
384 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); 384 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
385 QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); 385 QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) );
386 386
387 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); 387 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
388 btngrp-> insert ( m_tabstyle_top ); 388 btngrp-> insert ( m_tabstyle_top );
389 gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); 389 gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
390 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); 390 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) );
391 391
392 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); 392 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
393 btngrp-> insert ( m_tabstyle_bottom ); 393 btngrp-> insert ( m_tabstyle_bottom );
394 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); 394 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
395 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); 395 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) );
396 396
397 m_tabstyle_top-> setChecked ( tabtop ); 397 m_tabstyle_top-> setChecked ( tabtop );
398 m_tabstyle_bottom-> setChecked ( !tabtop ); 398 m_tabstyle_bottom-> setChecked ( !tabtop );
399 399
400 m_original_tabstyle = style; 400 m_original_tabstyle = style;
401 m_original_tabpos = tabtop; 401 m_original_tabpos = tabtop;
402 402
403 vertLayout-> addSpacing ( 3 ); 403 vertLayout-> addSpacing ( 3 );
404 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); 404 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
405 405
406 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); 406 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
407 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); 407 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
408 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); 408 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
409 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); 409 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" );
410 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); 410 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 );
411 QPixmap ccw1; 411 QPixmap ccw1;
412 m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" );
413 QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( );
412 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); 414 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" );
413 415
414 rotbtngrp-> hide ( ); 416 rotbtngrp-> hide ( );
415 rotbtngrp-> setExclusive ( true ); 417 rotbtngrp-> setExclusive ( true );
416 rotbtngrp-> insert ( m_rotdir_cw ); 418 rotbtngrp-> insert ( m_rotdir_cw );
417 rotbtngrp-> insert ( m_rotdir_ccw ); 419 rotbtngrp-> insert ( m_rotdir_ccw );
420 rotbtngrp-> insert ( m_rotdir_flip );
418 421
419 ccw1. convertFromImage( ccwImage ); 422 ccw1. convertFromImage( ccwImage );
420 m_rotdir_cw-> setPixmap( cw1 ); 423 m_rotdir_cw-> setPixmap( cw1 );
421 m_rotdir_ccw-> setPixmap( ccw1 ); 424 m_rotdir_ccw-> setPixmap( ccw1 );
425 m_rotdir_flip-> setPixmap( flip1 );
422 426
423 rotLay-> addWidget ( rotlabel, 0 ); 427 rotLay-> addWidget ( rotlabel, 0 );
424 rotLay-> addWidget ( m_rotdir_cw, 0 ); 428 rotLay-> addWidget ( m_rotdir_cw, 0 );
425 rotLay-> addWidget ( m_rotdir_ccw, 0 ); 429 rotLay-> addWidget ( m_rotdir_ccw, 0 );
430 rotLay-> addWidget ( m_rotdir_flip, 0 );
426 431
427 bool rotcw = !(cfg. readBoolEntry ( "rotatedir", 0 )); 432 int rot = cfg. readNumEntry ( "rotatedir", 0 );
428 m_rotdir_cw-> setChecked ( rotcw ); 433 m_rotdir_cw-> setChecked ( rot == 0 );
429 m_rotdir_ccw-> setChecked ( !rotcw ); 434 m_rotdir_ccw-> setChecked ( rot == 1 );
435 m_rotdir_flip-> setChecked ( rot == 2 );
430 436
431 return tab; 437 return tab;
432} 438}
433 439
434 440
435Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 441Appearance::Appearance( QWidget* parent, const char* name, WFlags )
436 : QDialog ( parent, name, true, WStyle_ContextHelp ) 442 : QDialog ( parent, name, true, WStyle_ContextHelp )
437{ 443{
438 setCaption( tr( "Appearance Settings" ) ); 444 setCaption( tr( "Appearance Settings" ) );
439 445
440 Config config( "qpe" ); 446 Config config( "qpe" );
441 config.setGroup( "Appearance" ); 447 config.setGroup( "Appearance" );
442 448
443 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); 449 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
444 450
445 m_sample = new SampleWindow ( this ); 451 m_sample = new SampleWindow ( this );
446 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 452 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
447 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); 453 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
448 454
449 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 455 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
450 QWidget *styletab; 456 QWidget *styletab;
451 457
452 m_color_list = 0; 458 m_color_list = 0;
453 459
454 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); 460 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
455 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); 461 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" ));
456 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); 462 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
457 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); 463 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
458 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); 464 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) );
459 465
460 top-> addWidget ( tw, 10 ); 466 top-> addWidget ( tw, 10 );
461 top-> addWidget ( m_sample, 1 ); 467 top-> addWidget ( m_sample, 1 );
462 468
463 tw-> setCurrentTab ( styletab ); 469 tw-> setCurrentTab ( styletab );
464 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); 470 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
465 471
466 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; 472 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
467} 473}
468 474
469Appearance::~Appearance() 475Appearance::~Appearance()
470{ 476{
471} 477}
472 478
473void Appearance::tabChanged ( QWidget *w ) 479void Appearance::tabChanged ( QWidget *w )
474{ 480{
475 if ( w == m_advtab ) { 481 if ( w == m_advtab ) {
476 m_sample-> hide ( ); 482 m_sample-> hide ( );
477 updateGeometry ( ); // shouldn't be necessary ... 483 updateGeometry ( ); // shouldn't be necessary ...
478 } 484 }
479 else 485 else
480 m_sample-> show ( ); 486 m_sample-> show ( );
481} 487}
482 488
483void Appearance::accept ( ) 489void Appearance::accept ( )
484{ 490{
485 bool newtabpos = m_tabstyle_top-> isChecked ( ); 491 bool newtabpos = m_tabstyle_top-> isChecked ( );
486 bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( );
487 int newtabstyle = m_tabstyle_list-> currentItem ( ); 492 int newtabstyle = m_tabstyle_list-> currentItem ( );
488 493
489 Config config ( "qpe" ); 494 Config config ( "qpe" );
490 config. setGroup ( "Appearance" ); 495 config. setGroup ( "Appearance" );
491 496
492 if ( m_style_changed ) { 497 if ( m_style_changed ) {
493 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 498 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
494 if ( item ) 499 if ( item )
495 config.writeEntry( "Style", item-> key ( )); 500 config.writeEntry( "Style", item-> key ( ));
496 } 501 }
497 502
498 if ( m_deco_changed ) { 503 if ( m_deco_changed ) {
499 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); 504 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( ));
500 if ( item ) 505 if ( item )
501 config.writeEntry( "Decoration", item-> key ( )); 506 config.writeEntry( "Decoration", item-> key ( ));
502 } 507 }
503 508
504 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { 509 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) {
505 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 510 config. writeEntry ( "TabStyle", newtabstyle + 1 );
506 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 511 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
507 } 512 }
508 513
509 if ( m_font_changed ) { 514 if ( m_font_changed ) {
510 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 515 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
511 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 516 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
512 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 517 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
513 } 518 }
514 519
515 520
516 if ( m_color_changed ) 521 if ( m_color_changed )
517 { 522 {
518 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 523 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
519 524
520 if ( item ) 525 if ( item )
521 item-> save ( config ); 526 item-> save ( config );
522 } 527 }
523 528
524 config. writeEntry ( "rotatedir", is_rotdir_ccw ); 529 bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( );
530 int rotval;
531 if (m_rotdir_ccw-> isChecked ( )) {
532 rotval = 1;
533 } else if (m_rotdir_cw-> isChecked ( )) {
534 rotval = 0;
535 } else {
536 rotval = 2;
537 }
538 config. writeEntry ( "rotatedir", rotval );
525 539
526 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated 540 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated
527 541
528 QStringList sl; 542 QStringList sl;
529 QString exceptstr; 543 QString exceptstr;
530 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { 544 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) {
531 int fl = 0; 545 int fl = 0;
532 fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); 546 fl |= ( it-> noStyle ( ) ? 0x01 : 0 );
533 fl |= ( it-> noFont ( ) ? 0x02 : 0 ); 547 fl |= ( it-> noFont ( ) ? 0x02 : 0 );
534 fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); 548 fl |= ( it-> noDeco ( ) ? 0x04 : 0 );
535 exceptstr = QString::number ( fl, 32 ); 549 exceptstr = QString::number ( fl, 32 );
536 exceptstr.append( it-> pattern ( )); 550 exceptstr.append( it-> pattern ( ));
537 sl << exceptstr; 551 sl << exceptstr;
538 } 552 }
539 config. writeEntry ( "NoStyle", sl, ';' ); 553 config. writeEntry ( "NoStyle", sl, ';' );
540 config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); 554 config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
541 555
542 config. write ( ); // need to flush the config info first 556 config. write ( ); // need to flush the config info first
543 Global::applyStyle ( ); 557 Global::applyStyle ( );
544 558
545 if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { 559 if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
546 QCopEnvelope e( "QPE/System", "restart()" ); 560 QCopEnvelope e( "QPE/System", "restart()" );
547 } 561 }
548 562
549 QDialog::accept ( ); 563 QDialog::accept ( );
550} 564}
551 565
552void Appearance::done ( int r ) 566void Appearance::done ( int r )
553{ 567{
554 QDialog::done ( r ); 568 QDialog::done ( r );
555 close ( ); 569 close ( );
556} 570}
557 571
558 572
559void Appearance::styleClicked ( int index ) 573void Appearance::styleClicked ( int index )
560{ 574{
561 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); 575 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
562 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); 576 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
563 577
564 if ( m_sample && sli && sli-> style ( )) { 578 if ( m_sample && sli && sli-> style ( )) {
565 int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; 579 int ci = m_color_list ? m_color_list-> currentItem ( ) : -1;
566 580
567 m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); 581 m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( ));
568 } 582 }
569 583
570 m_style_changed |= ( index != m_original_style ); 584 m_style_changed |= ( index != m_original_style );
571} 585}
572 586
573void Appearance::styleSettingsClicked ( ) 587void Appearance::styleSettingsClicked ( )
574{ 588{
575 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 589 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
576 590
577 if ( item && item-> hasSettings ( )) { 591 if ( item && item-> hasSettings ( )) {
578 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); 592 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
579 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); 593 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 );
580 594
581 QWidget *w = item-> settings ( d ); 595 QWidget *w = item-> settings ( d );
582 596
583 if ( w ) { 597 if ( w ) {
584 vbox-> addWidget ( w ); 598 vbox-> addWidget ( w );
585 599
586 d-> setCaption ( w-> caption ( )); 600 d-> setCaption ( w-> caption ( ));
587 601
588 d-> showMaximized ( ); 602 d-> showMaximized ( );
589 bool accepted = ( d-> exec ( ) == QDialog::Accepted ); 603 bool accepted = ( d-> exec ( ) == QDialog::Accepted );
590 604
591 if ( item-> setSettings ( accepted )) 605 if ( item-> setSettings ( accepted ))
592 m_style_changed = true; 606 m_style_changed = true;
593 } 607 }
594 delete d; 608 delete d;
595 } 609 }
596} 610}
597 611
598void Appearance::decoClicked ( int index ) 612void Appearance::decoClicked ( int index )
599{ 613{
600 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); 614 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index );
601 615
602 if ( m_sample ) { 616 if ( m_sample ) {
603 if ( dli && dli-> interface ( )) 617 if ( dli && dli-> interface ( ))
604 m_sample-> setDecoration ( dli-> interface ( )); 618 m_sample-> setDecoration ( dli-> interface ( ));
605 else 619 else
606 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 620 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
607 m_sample-> repaint ( ); 621 m_sample-> repaint ( );
608 } 622 }
609 m_deco_changed |= ( index != m_original_deco ); 623 m_deco_changed |= ( index != m_original_deco );
610} 624}
611 625
612void Appearance::fontClicked ( const QFont &f ) 626void Appearance::fontClicked ( const QFont &f )
613{ 627{
614 m_font_changed |= ( f != m_sample-> font ( )); 628 m_font_changed |= ( f != m_sample-> font ( ));
615 m_sample-> setFont ( f ); 629 m_sample-> setFont ( f );
616} 630}
617 631
618void Appearance::colorClicked ( int index ) 632void Appearance::colorClicked ( int index )
619{ 633{
620 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); 634 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index );
621 635
622 if ( item ) 636 if ( item )
623 m_sample-> setPalette ( item-> palette ( )); 637 m_sample-> setPalette ( item-> palette ( ));
624 638
625 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); 639 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( ));
626} 640}
627 641
628 642
629void Appearance::editSchemeClicked ( ) 643void Appearance::editSchemeClicked ( )
630{ 644{
631 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 645 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
632 646
633 int cnt = 0; 647 int cnt = 0;
634 QString labels [QColorGroup::NColorRoles]; 648 QString labels [QColorGroup::NColorRoles];
635 QColor colors [QColorGroup::NColorRoles]; 649 QColor colors [QColorGroup::NColorRoles];
636 650
637 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { 651 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
638 QColor col = item-> color ( role ); 652 QColor col = item-> color ( role );
639 653
640 if ( col. isValid ( )) { 654 if ( col. isValid ( )) {
641 labels [cnt] = item-> label ( role ); 655 labels [cnt] = item-> label ( role );
642 colors [cnt] = col; 656 colors [cnt] = col;
643 657
644 cnt++; 658 cnt++;
645 } 659 }
646 } 660 }
647 661
648 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); 662 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true );
649 editdlg-> showMaximized ( ); 663 editdlg-> showMaximized ( );
650 if ( editdlg-> exec ( ) == QDialog::Accepted ) { 664 if ( editdlg-> exec ( ) == QDialog::Accepted ) {
651 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); 665 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 );
652 cnt = 0; 666 cnt = 0;
653 667
654 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { 668 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
655 if ( item-> color ( role ). isValid ( )) { 669 if ( item-> color ( role ). isValid ( )) {
656 citem-> setColor ( role, colors [cnt] ); 670 citem-> setColor ( role, colors [cnt] );
657 cnt++; 671 cnt++;
658 } 672 }
659 } 673 }
660 674
661 m_color_list-> setCurrentItem ( 0 ); 675 m_color_list-> setCurrentItem ( 0 );
662 colorClicked ( 0 ); 676 colorClicked ( 0 );
663 677
664 m_color_changed = true; 678 m_color_changed = true;
665 } 679 }
666 delete editdlg; 680 delete editdlg;
667} 681}
668 682
669 683
670void Appearance::saveSchemeClicked() 684void Appearance::saveSchemeClicked()
671{ 685{
672 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 686 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
673 687
674 if ( !item ) 688 if ( !item )
675 return; 689 return;
676 690
677 QDialog *d = new QDialog ( this, 0, true ); 691 QDialog *d = new QDialog ( this, 0, true );
678 d-> setCaption ( tr( "Save Scheme" )); 692 d-> setCaption ( tr( "Save Scheme" ));
679 QLineEdit *ed = new QLineEdit ( d ); 693 QLineEdit *ed = new QLineEdit ( d );
680 ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); 694 ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed );
681 ed-> setFocus ( ); 695 ed-> setFocus ( );
682 696
683 if ( d-> exec ( ) == QDialog::Accepted ) { 697 if ( d-> exec ( ) == QDialog::Accepted ) {
684 QString schemename = ed-> text ( ); 698 QString schemename = ed-> text ( );
685 QString filestr = QPEApplication::qpeDir(); 699 QString filestr = QPEApplication::qpeDir();
686 filestr.append( "/etc/colors/" ); 700 filestr.append( "/etc/colors/" );
687 filestr.append( schemename ); 701 filestr.append( schemename );
688 filestr.append( ".scheme" ); 702 filestr.append( ".scheme" );
689 QFile file ( filestr ); 703 QFile file ( filestr );
690 if ( !file. exists ( )) 704 if ( !file. exists ( ))
691 { 705 {
692 QPalette p = item-> palette ( ); 706 QPalette p = item-> palette ( );
693 707
694 Config config ( file.name(), Config::File ); 708 Config config ( file.name(), Config::File );
695 config. setGroup( "Colors" ); 709 config. setGroup( "Colors" );
696 710
697 item-> save ( config ); 711 item-> save ( config );
698 712
699 config. write ( ); // need to flush the config info first 713 config. write ( ); // need to flush the config info first
700 714
701 m_color_list-> insertItem ( new ColorListItem ( schemename, config )); 715 m_color_list-> insertItem ( new ColorListItem ( schemename, config ));
702 } 716 }
703 else 717 else
704 { 718 {
705 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); 719 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
706 } 720 }
707 } 721 }
708 delete d; 722 delete d;
709} 723}
710 724
711void Appearance::deleteSchemeClicked() 725void Appearance::deleteSchemeClicked()
712{ 726{
713 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 727 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
714 728
715 if ( !item ) 729 if ( !item )
716 return; 730 return;
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h
index 0e42298..da9e976 100644
--- a/noncore/settings/appearance2/appearance.h
+++ b/noncore/settings/appearance2/appearance.h
@@ -1,126 +1,127 @@
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 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#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 <qdialog.h> 34#include <qdialog.h>
35 35
36class QCheckBox; 36class QCheckBox;
37class QComboBox; 37class QComboBox;
38class QLabel; 38class QLabel;
39class QLineEdit; 39class QLineEdit;
40class QListBox; 40class QListBox;
41class QMultiLineEdit; 41class QMultiLineEdit;
42class QPushButton; 42class QPushButton;
43class QRadioButton; 43class QRadioButton;
44class QToolButton; 44class QToolButton;
45class SampleWindow; 45class SampleWindow;
46class OFontSelector; 46class OFontSelector;
47class QListView; 47class QListView;
48class QListViewItem; 48class QListViewItem;
49class Config; 49class Config;
50 50
51class Appearance : public QDialog 51class Appearance : public QDialog
52{ 52{
53 Q_OBJECT 53 Q_OBJECT
54 54
55public: 55public:
56 Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 56 Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
57 ~Appearance(); 57 ~Appearance();
58 58
59protected: 59protected:
60 virtual void accept ( ); 60 virtual void accept ( );
61 virtual void done ( int r ); 61 virtual void done ( int r );
62 62
63protected slots: 63protected slots:
64 void styleClicked ( int ); 64 void styleClicked ( int );
65 void styleSettingsClicked ( ); 65 void styleSettingsClicked ( );
66 void decoClicked ( int ); 66 void decoClicked ( int );
67 void fontClicked ( const QFont & ); 67 void fontClicked ( const QFont & );
68 void colorClicked ( int ); 68 void colorClicked ( int );
69 69
70 void editSchemeClicked(); 70 void editSchemeClicked();
71 void saveSchemeClicked(); 71 void saveSchemeClicked();
72 void deleteSchemeClicked(); 72 void deleteSchemeClicked();
73 73
74 void tabChanged ( QWidget * ); 74 void tabChanged ( QWidget * );
75 75
76 void addExcept ( ); 76 void addExcept ( );
77 void delExcept ( ); 77 void delExcept ( );
78 void upExcept ( ); 78 void upExcept ( );
79 void downExcept ( ); 79 void downExcept ( );
80 void clickedExcept ( QListViewItem *, const QPoint &, int ); 80 void clickedExcept ( QListViewItem *, const QPoint &, int );
81 81
82private: 82private:
83 void changeText(); 83 void changeText();
84 84
85 QWidget *createStyleTab ( QWidget *parent, Config &cfg ); 85 QWidget *createStyleTab ( QWidget *parent, Config &cfg );
86 QWidget *createDecoTab ( QWidget *parent, Config &cfg ); 86 QWidget *createDecoTab ( QWidget *parent, Config &cfg );
87 QWidget *createFontTab ( QWidget *parent, Config &cfg ); 87 QWidget *createFontTab ( QWidget *parent, Config &cfg );
88 QWidget *createColorTab ( QWidget *parent, Config &cfg ); 88 QWidget *createColorTab ( QWidget *parent, Config &cfg );
89 QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); 89 QWidget *createAdvancedTab ( QWidget *parent, Config &cfg );
90 90
91private: 91private:
92 bool m_style_changed; 92 bool m_style_changed;
93 bool m_font_changed; 93 bool m_font_changed;
94 bool m_scheme_changed; 94 bool m_scheme_changed;
95 bool m_deco_changed; 95 bool m_deco_changed;
96 bool m_color_changed; 96 bool m_color_changed;
97 97
98 int m_original_style; 98 int m_original_style;
99 int m_original_deco; 99 int m_original_deco;
100 int m_original_tabstyle; 100 int m_original_tabstyle;
101 bool m_original_tabpos; 101 bool m_original_tabpos;
102 102
103 QListBox * m_style_list; 103 QListBox * m_style_list;
104 QPushButton * m_style_settings; 104 QPushButton * m_style_settings;
105 105
106 QListBox * m_deco_list; 106 QListBox * m_deco_list;
107 107
108 QListBox * m_color_list; 108 QListBox * m_color_list;
109 109
110 OFontSelector *m_fontselect; 110 OFontSelector *m_fontselect;
111 111
112 SampleWindow *m_sample; 112 SampleWindow *m_sample;
113 113
114 QComboBox * m_tabstyle_list; 114 QComboBox * m_tabstyle_list;
115 QRadioButton *m_tabstyle_top; 115 QRadioButton *m_tabstyle_top;
116 QRadioButton *m_tabstyle_bottom; 116 QRadioButton *m_tabstyle_bottom;
117 117
118 QRadioButton *m_rotdir_cw; 118 QRadioButton *m_rotdir_cw;
119 QRadioButton *m_rotdir_ccw; 119 QRadioButton *m_rotdir_ccw;
120 QRadioButton *m_rotdir_flip;
120 121
121 QWidget * m_advtab; 122 QWidget * m_advtab;
122 QListView * m_except; 123 QListView * m_except;
123 QCheckBox * m_force; 124 QCheckBox * m_force;
124}; 125};
125 126
126#endif 127#endif