summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp4
-rw-r--r--pics/appearance/font.pngbin351 -> 0 bytes
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 9a3588c..db863d6 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -1,808 +1,808 @@
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 <qbuttongroup.h> 30#include <qbuttongroup.h>
31#include <qcheckbox.h> 31#include <qcheckbox.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qdialog.h> 33#include <qdialog.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qlistbox.h> 38#include <qlistbox.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qradiobutton.h> 41#include <qradiobutton.h>
42#if QT_VERSION >= 300 42#if QT_VERSION >= 300
43#include <qstylefactory.h> 43#include <qstylefactory.h>
44#endif 44#endif
45#include <qtoolbutton.h> 45#include <qtoolbutton.h>
46#include <qwindowsstyle.h> 46#include <qwindowsstyle.h>
47#include <qlistview.h> 47#include <qlistview.h>
48#include <qheader.h> 48#include <qheader.h>
49#include <qvbox.h> 49#include <qvbox.h>
50#include <qwhatsthis.h> 50#include <qwhatsthis.h>
51 51
52#include <qpe/config.h> 52#include <qpe/config.h>
53#include <qpe/global.h> 53#include <qpe/global.h>
54#include <qpe/resource.h> 54#include <qpe/resource.h>
55#include <qpe/qpeapplication.h> 55#include <qpe/qpeapplication.h>
56#include <qpe/qpemessagebox.h> 56#include <qpe/qpemessagebox.h>
57#include <qpe/qcopenvelope_qws.h> 57#include <qpe/qcopenvelope_qws.h>
58#include <qpe/qpestyle.h> 58#include <qpe/qpestyle.h>
59#include <qpe/lightstyle.h> 59#include <qpe/lightstyle.h>
60#include <qpe/qlibrary.h> 60#include <qpe/qlibrary.h>
61#include <qpe/styleinterface.h> 61#include <qpe/styleinterface.h>
62 62
63#include <opie/ofontselector.h> 63#include <opie/ofontselector.h>
64#include <opie/odevice.h> 64#include <opie/odevice.h>
65#include <opie/ofiledialog.h> 65#include <opie/ofiledialog.h>
66#include <opie/otabwidget.h> 66#include <opie/otabwidget.h>
67 67
68#include "appearance.h" 68#include "appearance.h"
69#include "editScheme.h" 69#include "editScheme.h"
70#include "stylelistitem.h" 70#include "stylelistitem.h"
71#include "decolistitem.h" 71#include "decolistitem.h"
72#include "colorlistitem.h" 72#include "colorlistitem.h"
73#include "exceptlistitem.h" 73#include "exceptlistitem.h"
74#include "sample.h" 74#include "sample.h"
75 75
76 76
77using namespace Opie; 77using namespace Opie;
78 78
79 79
80class DefaultWindowDecoration : public WindowDecorationInterface 80class DefaultWindowDecoration : public WindowDecorationInterface
81{ 81{
82public: 82public:
83 DefaultWindowDecoration() : ref(0) {} 83 DefaultWindowDecoration() : ref(0) {}
84 QString name() const { 84 QString name() const {
85 return "Default"; 85 return "Default";
86 } 86 }
87 QPixmap icon() const { 87 QPixmap icon() const {
88 return QPixmap(); 88 return QPixmap();
89 } 89 }
90 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 90 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
91 *iface = 0; 91 *iface = 0;
92 if ( uuid == IID_QUnknown ) 92 if ( uuid == IID_QUnknown )
93 *iface = this; 93 *iface = this;
94 else if ( uuid == IID_WindowDecoration ) 94 else if ( uuid == IID_WindowDecoration )
95 *iface = this; 95 *iface = this;
96 96
97 if ( *iface ) 97 if ( *iface )
98 (*iface)->addRef(); 98 (*iface)->addRef();
99 return QS_OK; 99 return QS_OK;
100 } 100 }
101 Q_REFCOUNT 101 Q_REFCOUNT
102 102
103private: 103private:
104 ulong ref; 104 ulong ref;
105}; 105};
106 106
107 107
108 108
109 109
110 110
111 111
112 112
113QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) 113QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
114{ 114{
115 QWidget* tab = new QWidget( parent, "StyleTab" ); 115 QWidget* tab = new QWidget( parent, "StyleTab" );
116 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 116 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
117 117
118 m_style_list = new QListBox( tab, "m_style_list" ); 118 m_style_list = new QListBox( tab, "m_style_list" );
119 vertLayout->addWidget( m_style_list ); 119 vertLayout->addWidget( m_style_list );
120 QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) ); 120 QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) );
121 121
122 m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); 122 m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
123 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); 123 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( )));
124 vertLayout-> addWidget ( m_style_settings ); 124 vertLayout-> addWidget ( m_style_settings );
125 QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); 125 QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) );
126 126
127 QString s = cfg. readEntry ( "Style", "Light" ); 127 QString s = cfg. readEntry ( "Style", "Light" );
128 128
129 129
130#if QT_VERSION >= 300 130#if QT_VERSION >= 300
131 m_style_list->insertStringList(QStyleFactory::styles()); 131 m_style_list->insertStringList(QStyleFactory::styles());
132#else 132#else
133 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); 133 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( )));
134 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); 134 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( )));
135 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); 135 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( )));
136#endif 136#endif
137 { 137 {
138 QString path = QPEApplication::qpeDir ( ); 138 QString path = QPEApplication::qpeDir ( );
139 path.append( "/plugins/styles/" ); 139 path.append( "/plugins/styles/" );
140 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 140 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
141 141
142 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 142 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
143 QString libstr = path; 143 QString libstr = path;
144 libstr.append( "/" ); 144 libstr.append( "/" );
145 libstr.append( *it ); 145 libstr.append( *it );
146 QLibrary *lib = new QLibrary ( libstr ); 146 QLibrary *lib = new QLibrary ( libstr );
147 StyleInterface *iface; 147 StyleInterface *iface;
148 148
149 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) { 149 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) {
150 StyleListItem *slit = new StyleListItem ( lib, iface ); 150 StyleListItem *slit = new StyleListItem ( lib, iface );
151 m_style_list-> insertItem ( slit ); 151 m_style_list-> insertItem ( slit );
152 152
153 if ( slit-> key ( ) == s ) 153 if ( slit-> key ( ) == s )
154 m_style_list-> setCurrentItem ( slit ); 154 m_style_list-> setCurrentItem ( slit );
155 } 155 }
156 else 156 else
157 delete lib; 157 delete lib;
158 } 158 }
159 } 159 }
160 160
161 m_original_style = m_style_list-> currentItem ( ); 161 m_original_style = m_style_list-> currentItem ( );
162 styleClicked ( m_original_style ); 162 styleClicked ( m_original_style );
163 163
164 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); 164 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) );
165 165
166 return tab; 166 return tab;
167} 167}
168 168
169QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) 169QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
170{ 170{
171 QWidget* tab = new QWidget( parent, "DecoTab" ); 171 QWidget* tab = new QWidget( parent, "DecoTab" );
172 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 172 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
173 173
174 m_deco_list = new QListBox( tab, "m_deco_list" ); 174 m_deco_list = new QListBox( tab, "m_deco_list" );
175 vertLayout->addWidget( m_deco_list ); 175 vertLayout->addWidget( m_deco_list );
176 QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) ); 176 QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) );
177 177
178 QString s = cfg. readEntry ( "Decoration" ); 178 QString s = cfg. readEntry ( "Decoration" );
179 179
180 m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); 180 m_deco_list-> insertItem ( new DecoListItem ( "QPE" ));
181 181
182 { 182 {
183 QString path = QPEApplication::qpeDir(); 183 QString path = QPEApplication::qpeDir();
184 path.append( "/plugins/decorations/" ); 184 path.append( "/plugins/decorations/" );
185 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 185 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
186 186
187 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 187 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
188 QString libstr = path; 188 QString libstr = path;
189 libstr.append( "/" ); 189 libstr.append( "/" );
190 libstr.append( *it ); 190 libstr.append( *it );
191 QLibrary *lib = new QLibrary ( libstr ); 191 QLibrary *lib = new QLibrary ( libstr );
192 WindowDecorationInterface *iface; 192 WindowDecorationInterface *iface;
193 193
194 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) { 194 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) {
195 DecoListItem *dlit = new DecoListItem ( lib, iface ); 195 DecoListItem *dlit = new DecoListItem ( lib, iface );
196 m_deco_list-> insertItem ( dlit ); 196 m_deco_list-> insertItem ( dlit );
197 197
198 if ( dlit-> key ( ) == s ) 198 if ( dlit-> key ( ) == s )
199 m_deco_list-> setCurrentItem ( dlit ); 199 m_deco_list-> setCurrentItem ( dlit );
200 } 200 }
201 else 201 else
202 delete lib; 202 delete lib;
203 } 203 }
204 } 204 }
205 205
206 m_original_deco = m_deco_list-> currentItem ( ); 206 m_original_deco = m_deco_list-> currentItem ( );
207 if ( m_deco_list-> currentItem ( ) < 0 ) 207 if ( m_deco_list-> currentItem ( ) < 0 )
208 m_deco_list-> setCurrentItem ( 0 ); 208 m_deco_list-> setCurrentItem ( 0 );
209 decoClicked ( m_original_deco ); 209 decoClicked ( m_original_deco );
210 210
211 connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); 211 connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) );
212 212
213 return tab; 213 return tab;
214} 214}
215 215
216QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) 216QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
217{ 217{
218 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); 218 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
219 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); 219 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
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 ( "appearance/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 return tab; 403 return tab;
404} 404}
405 405
406 406
407Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 407Appearance::Appearance( QWidget* parent, const char* name, WFlags )
408 : QDialog ( parent, name, true, WStyle_ContextHelp ) 408 : QDialog ( parent, name, true, WStyle_ContextHelp )
409{ 409{
410 setCaption( tr( "Appearance Settings" ) ); 410 setCaption( tr( "Appearance Settings" ) );
411 411
412 Config config( "qpe" ); 412 Config config( "qpe" );
413 config.setGroup( "Appearance" ); 413 config.setGroup( "Appearance" );
414 414
415 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); 415 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
416 416
417 m_sample = new SampleWindow ( this ); 417 m_sample = new SampleWindow ( this );
418 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 418 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
419 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); 419 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
420 420
421 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 421 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
422 QWidget *styletab; 422 QWidget *styletab;
423 423
424 m_color_list = 0; 424 m_color_list = 0;
425 425
426 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); 426 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
427 tw-> addTab ( createFontTab ( tw, config ), "appearance/font", tr( "Font" )); 427 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" ));
428 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); 428 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
429 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); 429 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
430 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); 430 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) );
431 431
432 top-> addWidget ( tw, 10 ); 432 top-> addWidget ( tw, 10 );
433 top-> addWidget ( m_sample, 1 ); 433 top-> addWidget ( m_sample, 1 );
434 434
435 tw-> setCurrentTab ( styletab ); 435 tw-> setCurrentTab ( styletab );
436 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); 436 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
437 437
438 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; 438 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
439} 439}
440 440
441Appearance::~Appearance() 441Appearance::~Appearance()
442{ 442{
443} 443}
444 444
445void Appearance::tabChanged ( QWidget *w ) 445void Appearance::tabChanged ( QWidget *w )
446{ 446{
447 if ( w == m_advtab ) { 447 if ( w == m_advtab ) {
448 m_sample-> hide ( ); 448 m_sample-> hide ( );
449 updateGeometry ( ); // shouldn't be necessary ... 449 updateGeometry ( ); // shouldn't be necessary ...
450 } 450 }
451 else 451 else
452 m_sample-> show ( ); 452 m_sample-> show ( );
453} 453}
454 454
455void Appearance::accept ( ) 455void Appearance::accept ( )
456{ 456{
457 bool newtabpos = m_tabstyle_top-> isChecked ( ); 457 bool newtabpos = m_tabstyle_top-> isChecked ( );
458 int newtabstyle = m_tabstyle_list-> currentItem ( ); 458 int newtabstyle = m_tabstyle_list-> currentItem ( );
459 459
460 Config config ( "qpe" ); 460 Config config ( "qpe" );
461 config. setGroup ( "Appearance" ); 461 config. setGroup ( "Appearance" );
462 462
463 if ( m_style_changed ) { 463 if ( m_style_changed ) {
464 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 464 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
465 if ( item ) 465 if ( item )
466 config.writeEntry( "Style", item-> key ( )); 466 config.writeEntry( "Style", item-> key ( ));
467 } 467 }
468 468
469 if ( m_deco_changed ) { 469 if ( m_deco_changed ) {
470 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); 470 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( ));
471 if ( item ) 471 if ( item )
472 config.writeEntry( "Decoration", item-> key ( )); 472 config.writeEntry( "Decoration", item-> key ( ));
473 } 473 }
474 474
475 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { 475 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) {
476 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 476 config. writeEntry ( "TabStyle", newtabstyle + 1 );
477 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 477 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
478 } 478 }
479 479
480 if ( m_font_changed ) { 480 if ( m_font_changed ) {
481 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 481 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
482 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 482 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
483 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 483 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
484 } 484 }
485 485
486 486
487 if ( m_color_changed ) 487 if ( m_color_changed )
488 { 488 {
489 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 489 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
490 490
491 if ( item ) 491 if ( item )
492 item-> save ( config ); 492 item-> save ( config );
493 } 493 }
494 494
495 495
496 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated 496 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated
497 497
498 QStringList sl; 498 QStringList sl;
499 QString exceptstr; 499 QString exceptstr;
500 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { 500 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) {
501 int fl = 0; 501 int fl = 0;
502 fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); 502 fl |= ( it-> noStyle ( ) ? 0x01 : 0 );
503 fl |= ( it-> noFont ( ) ? 0x02 : 0 ); 503 fl |= ( it-> noFont ( ) ? 0x02 : 0 );
504 fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); 504 fl |= ( it-> noDeco ( ) ? 0x04 : 0 );
505 exceptstr = QString::number ( fl, 32 ); 505 exceptstr = QString::number ( fl, 32 );
506 exceptstr.append( it-> pattern ( )); 506 exceptstr.append( it-> pattern ( ));
507 sl << exceptstr; 507 sl << exceptstr;
508 } 508 }
509 config. writeEntry ( "NoStyle", sl, ';' ); 509 config. writeEntry ( "NoStyle", sl, ';' );
510 config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); 510 config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
511 511
512 config. write ( ); // need to flush the config info first 512 config. write ( ); // need to flush the config info first
513 Global::applyStyle ( ); 513 Global::applyStyle ( );
514 514
515 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 ) { 515 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 ) {
516 QCopEnvelope e( "QPE/System", "restart()" ); 516 QCopEnvelope e( "QPE/System", "restart()" );
517 } 517 }
518 518
519 QDialog::accept ( ); 519 QDialog::accept ( );
520} 520}
521 521
522void Appearance::done ( int r ) 522void Appearance::done ( int r )
523{ 523{
524 QDialog::done ( r ); 524 QDialog::done ( r );
525 close ( ); 525 close ( );
526} 526}
527 527
528 528
529void Appearance::styleClicked ( int index ) 529void Appearance::styleClicked ( int index )
530{ 530{
531 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); 531 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
532 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); 532 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
533 533
534 if ( m_sample && sli && sli-> style ( )) { 534 if ( m_sample && sli && sli-> style ( )) {
535 int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; 535 int ci = m_color_list ? m_color_list-> currentItem ( ) : -1;
536 536
537 m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); 537 m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( ));
538 } 538 }
539 539
540 m_style_changed |= ( index != m_original_style ); 540 m_style_changed |= ( index != m_original_style );
541} 541}
542 542
543void Appearance::styleSettingsClicked ( ) 543void Appearance::styleSettingsClicked ( )
544{ 544{
545 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 545 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
546 546
547 if ( item && item-> hasSettings ( )) { 547 if ( item && item-> hasSettings ( )) {
548 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); 548 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
549 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); 549 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 );
550 550
551 QWidget *w = item-> settings ( d ); 551 QWidget *w = item-> settings ( d );
552 552
553 if ( w ) { 553 if ( w ) {
554 vbox-> addWidget ( w ); 554 vbox-> addWidget ( w );
555 555
556 d-> setCaption ( w-> caption ( )); 556 d-> setCaption ( w-> caption ( ));
557 557
558 d-> showMaximized ( ); 558 d-> showMaximized ( );
559 bool accepted = ( d-> exec ( ) == QDialog::Accepted ); 559 bool accepted = ( d-> exec ( ) == QDialog::Accepted );
560 560
561 if ( item-> setSettings ( accepted )) 561 if ( item-> setSettings ( accepted ))
562 m_style_changed = true; 562 m_style_changed = true;
563 } 563 }
564 delete d; 564 delete d;
565 } 565 }
566} 566}
567 567
568void Appearance::decoClicked ( int index ) 568void Appearance::decoClicked ( int index )
569{ 569{
570 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); 570 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index );
571 571
572 if ( m_sample ) { 572 if ( m_sample ) {
573 if ( dli && dli-> interface ( )) 573 if ( dli && dli-> interface ( ))
574 m_sample-> setDecoration ( dli-> interface ( )); 574 m_sample-> setDecoration ( dli-> interface ( ));
575 else 575 else
576 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 576 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
577 m_sample-> repaint ( ); 577 m_sample-> repaint ( );
578 } 578 }
579 m_deco_changed |= ( index != m_original_deco ); 579 m_deco_changed |= ( index != m_original_deco );
580} 580}
581 581
582void Appearance::fontClicked ( const QFont &f ) 582void Appearance::fontClicked ( const QFont &f )
583{ 583{
584 m_font_changed |= ( f != m_sample-> font ( )); 584 m_font_changed |= ( f != m_sample-> font ( ));
585 m_sample-> setFont ( f ); 585 m_sample-> setFont ( f );
586} 586}
587 587
588void Appearance::colorClicked ( int index ) 588void Appearance::colorClicked ( int index )
589{ 589{
590 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); 590 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index );
591 591
592 if ( item ) 592 if ( item )
593 m_sample-> setPalette ( item-> palette ( )); 593 m_sample-> setPalette ( item-> palette ( ));
594 594
595 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); 595 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( ));
596} 596}
597 597
598 598
599void Appearance::editSchemeClicked ( ) 599void Appearance::editSchemeClicked ( )
600{ 600{
601 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 601 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
602 602
603 int cnt = 0; 603 int cnt = 0;
604 QString labels [QColorGroup::NColorRoles]; 604 QString labels [QColorGroup::NColorRoles];
605 QColor colors [QColorGroup::NColorRoles]; 605 QColor colors [QColorGroup::NColorRoles];
606 606
607 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { 607 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
608 QColor col = item-> color ( role ); 608 QColor col = item-> color ( role );
609 609
610 if ( col. isValid ( )) { 610 if ( col. isValid ( )) {
611 labels [cnt] = item-> label ( role ); 611 labels [cnt] = item-> label ( role );
612 colors [cnt] = col; 612 colors [cnt] = col;
613 613
614 cnt++; 614 cnt++;
615 } 615 }
616 } 616 }
617 617
618 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); 618 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true );
619 editdlg-> showMaximized ( ); 619 editdlg-> showMaximized ( );
620 if ( editdlg-> exec ( ) == QDialog::Accepted ) { 620 if ( editdlg-> exec ( ) == QDialog::Accepted ) {
621 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); 621 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 );
622 cnt = 0; 622 cnt = 0;
623 623
624 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { 624 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
625 if ( item-> color ( role ). isValid ( )) { 625 if ( item-> color ( role ). isValid ( )) {
626 citem-> setColor ( role, colors [cnt] ); 626 citem-> setColor ( role, colors [cnt] );
627 cnt++; 627 cnt++;
628 } 628 }
629 } 629 }
630 630
631 m_color_list-> setCurrentItem ( 0 ); 631 m_color_list-> setCurrentItem ( 0 );
632 colorClicked ( 0 ); 632 colorClicked ( 0 );
633 633
634 m_color_changed = true; 634 m_color_changed = true;
635 } 635 }
636 delete editdlg; 636 delete editdlg;
637} 637}
638 638
639 639
640void Appearance::saveSchemeClicked() 640void Appearance::saveSchemeClicked()
641{ 641{
642 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 642 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
643 643
644 if ( !item ) 644 if ( !item )
645 return; 645 return;
646 646
647 QDialog *d = new QDialog ( this, 0, true ); 647 QDialog *d = new QDialog ( this, 0, true );
648 d-> setCaption ( tr( "Save Scheme" )); 648 d-> setCaption ( tr( "Save Scheme" ));
649 QLineEdit *ed = new QLineEdit ( d ); 649 QLineEdit *ed = new QLineEdit ( d );
650 ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); 650 ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed );
651 ed-> setFocus ( ); 651 ed-> setFocus ( );
652 652
653 if ( d-> exec ( ) == QDialog::Accepted ) { 653 if ( d-> exec ( ) == QDialog::Accepted ) {
654 QString schemename = ed-> text ( ); 654 QString schemename = ed-> text ( );
655 QString filestr = QPEApplication::qpeDir(); 655 QString filestr = QPEApplication::qpeDir();
656 filestr.append( "/etc/colors/" ); 656 filestr.append( "/etc/colors/" );
657 filestr.append( schemename ); 657 filestr.append( schemename );
658 filestr.append( ".scheme" ); 658 filestr.append( ".scheme" );
659 QFile file ( filestr ); 659 QFile file ( filestr );
660 if ( !file. exists ( )) 660 if ( !file. exists ( ))
661 { 661 {
662 QPalette p = item-> palette ( ); 662 QPalette p = item-> palette ( );
663 663
664 Config config ( file.name(), Config::File ); 664 Config config ( file.name(), Config::File );
665 config. setGroup( "Colors" ); 665 config. setGroup( "Colors" );
666 666
667 item-> save ( config ); 667 item-> save ( config );
668 668
669 config. write ( ); // need to flush the config info first 669 config. write ( ); // need to flush the config info first
670 670
671 m_color_list-> insertItem ( new ColorListItem ( schemename, config )); 671 m_color_list-> insertItem ( new ColorListItem ( schemename, config ));
672 } 672 }
673 else 673 else
674 { 674 {
675 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); 675 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
676 } 676 }
677 } 677 }
678 delete d; 678 delete d;
679} 679}
680 680
681void Appearance::deleteSchemeClicked() 681void Appearance::deleteSchemeClicked()
682{ 682{
683 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 683 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
684 684
685 if ( !item ) 685 if ( !item )
686 return; 686 return;
687 687
688 if ( m_color_list-> currentItem ( ) > 0 ) 688 if ( m_color_list-> currentItem ( ) > 0 )
689 { 689 {
690 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) 690 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) )
691 { 691 {
692 QString filestr = QPEApplication::qpeDir ( ); 692 QString filestr = QPEApplication::qpeDir ( );
693 filestr.append( "/etc/colors/" ); 693 filestr.append( "/etc/colors/" );
694 filestr.append( item-> text ( ) ); 694 filestr.append( item-> text ( ) );
695 filestr.append( ".scheme" ); 695 filestr.append( ".scheme" );
696 QFile::remove ( filestr ); 696 QFile::remove ( filestr );
697 delete item; 697 delete item;
698 } 698 }
699 } 699 }
700 else 700 else
701 { 701 {
702 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); 702 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." ));
703 } 703 }
704} 704}
705 705
706 706
707void Appearance::addExcept ( ) 707void Appearance::addExcept ( )
708{ 708{
709 ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); 709 ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true );
710 m_except-> ensureItemVisible ( it ); 710 m_except-> ensureItemVisible ( it );
711 m_except-> setSelected ( it, true ); 711 m_except-> setSelected ( it, true );
712} 712}
713 713
714void Appearance::delExcept ( ) 714void Appearance::delExcept ( )
715{ 715{
716 if ( m_except-> selectedItem ( )) { 716 if ( m_except-> selectedItem ( )) {
717 m_except-> setFocus ( ); 717 m_except-> setFocus ( );
718 delete m_except-> selectedItem ( ); 718 delete m_except-> selectedItem ( );
719 } 719 }
720} 720}
721 721
722void Appearance::upExcept ( ) 722void Appearance::upExcept ( )
723{ 723{
724 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); 724 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
725 725
726 if ( it && it-> itemAbove ( )) 726 if ( it && it-> itemAbove ( ))
727 it-> itemAbove ( )-> moveItem ( it ); 727 it-> itemAbove ( )-> moveItem ( it );
728} 728}
729 729
730void Appearance::downExcept ( ) 730void Appearance::downExcept ( )
731{ 731{
732 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); 732 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
733 733
734 if ( it && it-> itemBelow ( )) 734 if ( it && it-> itemBelow ( ))
735 it-> moveItem ( it-> itemBelow ( )); 735 it-> moveItem ( it-> itemBelow ( ));
736} 736}
737 737
738class ExEdit : public QLineEdit { 738class ExEdit : public QLineEdit {
739public: 739public:
740 ExEdit ( ExceptListItem *item ) 740 ExEdit ( ExceptListItem *item )
741 : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item ) 741 : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item )
742 { 742 {
743 setFrame ( false ); 743 setFrame ( false );
744 744
745 QRect r = it-> listView ( )-> itemRect ( it ); 745 QRect r = it-> listView ( )-> itemRect ( it );
746 746
747 int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1; 747 int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1;
748 int y = r. y ( ); 748 int y = r. y ( );
749 int w = it-> listView ( )-> viewport ( )-> width ( ) - x; 749 int w = it-> listView ( )-> viewport ( )-> width ( ) - x;
750 int h = r. height ( ); // + 2; 750 int h = r. height ( ); // + 2;
751 751
752 setText ( it-> pattern ( )); 752 setText ( it-> pattern ( ));
753 setGeometry ( x, y, w, h ); 753 setGeometry ( x, y, w, h );
754 754
755 qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h); 755 qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h);
756 756
757 m_out = true; 757 m_out = true;
758 758
759 show ( ); 759 show ( );
760 setFocus ( ); 760 setFocus ( );
761 selectAll ( ); 761 selectAll ( );
762 end ( true ); 762 end ( true );
763 } 763 }
764 764
765 virtual void focusOutEvent ( QFocusEvent * ) 765 virtual void focusOutEvent ( QFocusEvent * )
766 { 766 {
767 hide ( ); 767 hide ( );
768 if ( m_out ) 768 if ( m_out )
769 it-> setPattern ( text ( )); 769 it-> setPattern ( text ( ));
770 delete this; 770 delete this;
771 } 771 }
772 772
773 virtual void keyPressEvent ( QKeyEvent *e ) 773 virtual void keyPressEvent ( QKeyEvent *e )
774 { 774 {
775 if ( e-> key ( ) == Key_Return ) 775 if ( e-> key ( ) == Key_Return )
776 it-> listView ( )-> setFocus ( ); 776 it-> listView ( )-> setFocus ( );
777 else if ( e-> key ( ) == Key_Escape ) { 777 else if ( e-> key ( ) == Key_Escape ) {
778 m_out = false; 778 m_out = false;
779 it-> listView ( )-> setFocus ( ); 779 it-> listView ( )-> setFocus ( );
780 } 780 }
781 else 781 else
782 QLineEdit::keyPressEvent ( e ); 782 QLineEdit::keyPressEvent ( e );
783 } 783 }
784 784
785private: 785private:
786 ExceptListItem *it; 786 ExceptListItem *it;
787 bool m_out; 787 bool m_out;
788}; 788};
789 789
790void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c ) 790void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c )
791{ 791{
792 if ( !item || c < 0 || c > 3 ) 792 if ( !item || c < 0 || c > 3 )
793 return; 793 return;
794 794
795 ExceptListItem *it = (ExceptListItem *) item; 795 ExceptListItem *it = (ExceptListItem *) item;
796 796
797 if ( c == 0 ) 797 if ( c == 0 )
798 it-> setNoStyle ( !it-> noStyle ( )); 798 it-> setNoStyle ( !it-> noStyle ( ));
799 else if ( c == 1 ) 799 else if ( c == 1 )
800 it-> setNoFont ( !it-> noFont ( )); 800 it-> setNoFont ( !it-> noFont ( ));
801 else if ( c == 2 ) 801 else if ( c == 2 )
802 it-> setNoDeco ( !it-> noDeco ( )); 802 it-> setNoDeco ( !it-> noDeco ( ));
803 else if ( c == 3 ) { 803 else if ( c == 3 ) {
804 m_except-> ensureItemVisible ( it ); 804 m_except-> ensureItemVisible ( it );
805 new ExEdit ( it ); 805 new ExEdit ( it );
806 } 806 }
807} 807}
808 808
diff --git a/pics/appearance/font.png b/pics/appearance/font.png
deleted file mode 100644
index 2e51cad..0000000
--- a/pics/appearance/font.png
+++ b/dev/null
Binary files differ