summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp7
-rw-r--r--noncore/settings/appearance2/appearance.h38
-rw-r--r--noncore/settings/appearance2/appearance2.pro6
-rw-r--r--noncore/settings/appearance2/editScheme.cpp22
-rw-r--r--noncore/settings/appearance2/editScheme.h20
5 files changed, 48 insertions, 45 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index ba12e55..b39203b 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -1,890 +1,889 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 4 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 5             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .: 20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "appearance.h" 30#include "appearance.h"
31#include "editScheme.h" 31#include "editScheme.h"
32#include "stylelistitem.h" 32#include "stylelistitem.h"
33#include "decolistitem.h" 33#include "decolistitem.h"
34#include "colorlistitem.h" 34#include "colorlistitem.h"
35#include "exceptlistitem.h" 35#include "exceptlistitem.h"
36#include "sample.h" 36#include "sample.h"
37 37
38/* OPIE */ 38/* OPIE */
39#include <opie/ofontselector.h> 39#include <opie2/odevice.h>
40#include <opie/odevice.h> 40#include <opie2/ofiledialog.h>
41#include <opie/ofiledialog.h> 41#include <opie2/otabwidget.h>
42#include <opie/otabwidget.h>
43 42
44#include <qpe/config.h> 43#include <qpe/config.h>
45#include <qpe/global.h> 44#include <qpe/global.h>
46#include <qpe/qpeapplication.h> 45#include <qpe/qpeapplication.h>
47#include <qpe/qpemessagebox.h> 46#include <qpe/qpemessagebox.h>
48#include <qpe/qcopenvelope_qws.h> 47#include <qpe/qcopenvelope_qws.h>
49#include <qpe/qpestyle.h> 48#include <qpe/qpestyle.h>
50#include <qpe/lightstyle.h> 49#include <qpe/lightstyle.h>
51#include <qpe/styleinterface.h> 50#include <qpe/styleinterface.h>
52 51
53/* QT */ 52/* QT */
54#include <qbuttongroup.h> 53#include <qbuttongroup.h>
55#include <qcheckbox.h> 54#include <qcheckbox.h>
56#include <qcombobox.h> 55#include <qcombobox.h>
57#include <qdialog.h> 56#include <qdialog.h>
58#include <qdir.h> 57#include <qdir.h>
59#include <qlabel.h> 58#include <qlabel.h>
60#include <qlayout.h> 59#include <qlayout.h>
61#include <qlineedit.h> 60#include <qlineedit.h>
62#include <qlistbox.h> 61#include <qlistbox.h>
63#include <qmessagebox.h> 62#include <qmessagebox.h>
64#include <qpushbutton.h> 63#include <qpushbutton.h>
65#include <qradiobutton.h> 64#include <qradiobutton.h>
66#if QT_VERSION >= 300 65#if QT_VERSION >= 300
67#include <qstylefactory.h> 66#include <qstylefactory.h>
68#endif 67#endif
69#include <qtoolbutton.h> 68#include <qtoolbutton.h>
70#include <qwindowsstyle.h> 69#include <qwindowsstyle.h>
71#include <qlistview.h> 70#include <qlistview.h>
72#include <qheader.h> 71#include <qheader.h>
73#include <qvbox.h> 72#include <qvbox.h>
74#include <qwhatsthis.h> 73#include <qwhatsthis.h>
75 74
76using namespace Opie; 75using namespace Opie;
77 76
78 77
79class DefaultWindowDecoration : public WindowDecorationInterface 78class DefaultWindowDecoration : public WindowDecorationInterface
80{ 79{
81public: 80public:
82 DefaultWindowDecoration() : ref(0) {} 81 DefaultWindowDecoration() : ref(0) {}
83 QString name() const 82 QString name() const
84 { 83 {
85 return "Default"; 84 return "Default";
86 } 85 }
87 QPixmap icon() const 86 QPixmap icon() const
88 { 87 {
89 return QPixmap(); 88 return QPixmap();
90 } 89 }
91 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 90 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface )
92 { 91 {
93 *iface = 0; 92 *iface = 0;
94 if ( uuid == IID_QUnknown ) 93 if ( uuid == IID_QUnknown )
95 *iface = this; 94 *iface = this;
96 else if ( uuid == IID_WindowDecoration ) 95 else if ( uuid == IID_WindowDecoration )
97 *iface = this; 96 *iface = this;
98 97
99 if ( *iface ) 98 if ( *iface )
100 (*iface)->addRef(); 99 (*iface)->addRef();
101 return QS_OK; 100 return QS_OK;
102 } 101 }
103 Q_REFCOUNT 102 Q_REFCOUNT
104 103
105private: 104private:
106 ulong ref; 105 ulong ref;
107}; 106};
108 107
109 108
110 109
111 110
112 111
113 112
114 113
115QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) 114QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
116{ 115{
117 QWidget* tab = new QWidget( parent, "StyleTab" ); 116 QWidget* tab = new QWidget( parent, "StyleTab" );
118 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 117 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
119 118
120 m_style_list = new QListBox( tab, "m_style_list" ); 119 m_style_list = new QListBox( tab, "m_style_list" );
121 vertLayout->addWidget( m_style_list ); 120 vertLayout->addWidget( m_style_list );
122 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 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." ) );
123 122
124 m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); 123 m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
125 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); 124 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( )));
126 vertLayout-> addWidget ( m_style_settings ); 125 vertLayout-> addWidget ( m_style_settings );
127 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 QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) );
128 127
129 QString s = cfg. readEntry ( "Style", "Light" ); 128 QString s = cfg. readEntry ( "Style", "Light" );
130 129
131 130
132#if QT_VERSION >= 300 131#if QT_VERSION >= 300
133 m_style_list->insertStringList(QStyleFactory::styles()); 132 m_style_list->insertStringList(QStyleFactory::styles());
134#else 133#else
135 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); 134 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( )));
136 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); 135 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( )));
137 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); 136 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( )));
138#endif 137#endif
139 138
140 { 139 {
141 QString path = QPEApplication::qpeDir ( ); 140 QString path = QPEApplication::qpeDir ( );
142 path.append( "/plugins/styles/" ); 141 path.append( "/plugins/styles/" );
143 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 142 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
144 143
145 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 144 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
146 { 145 {
147 QString libstr = path; 146 QString libstr = path;
148 libstr.append( "/" ); 147 libstr.append( "/" );
149 libstr.append( *it ); 148 libstr.append( *it );
150 QLibrary *lib = new QLibrary ( libstr ); 149 QLibrary *lib = new QLibrary ( libstr );
151 StyleInterface *iface; 150 StyleInterface *iface;
152 151
153 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) 152 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface )
154 { 153 {
155 StyleListItem *slit = new StyleListItem ( lib, iface ); 154 StyleListItem *slit = new StyleListItem ( lib, iface );
156 m_style_list-> insertItem ( slit ); 155 m_style_list-> insertItem ( slit );
157 156
158 if ( slit-> key ( ) == s ) 157 if ( slit-> key ( ) == s )
159 m_style_list-> setCurrentItem ( slit ); 158 m_style_list-> setCurrentItem ( slit );
160 } 159 }
161 else 160 else
162 delete lib; 161 delete lib;
163 } 162 }
164 } 163 }
165 164
166 m_original_style = m_style_list-> currentItem ( ); 165 m_original_style = m_style_list-> currentItem ( );
167 styleClicked ( m_original_style ); 166 styleClicked ( m_original_style );
168 167
169 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); 168 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) );
170 169
171 return tab; 170 return tab;
172} 171}
173 172
174QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) 173QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
175{ 174{
176 QWidget* tab = new QWidget( parent, "DecoTab" ); 175 QWidget* tab = new QWidget( parent, "DecoTab" );
177 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 176 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
178 177
179 m_deco_list = new QListBox( tab, "m_deco_list" ); 178 m_deco_list = new QListBox( tab, "m_deco_list" );
180 vertLayout->addWidget( m_deco_list ); 179 vertLayout->addWidget( m_deco_list );
181 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." ) ); 180 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." ) );
182 181
183 QString s = cfg. readEntry ( "Decoration", "libflat.so" ); 182 QString s = cfg. readEntry ( "Decoration", "libflat.so" );
184 183
185 m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); 184 m_deco_list-> insertItem ( new DecoListItem ( "QPE" ));
186 185
187 { 186 {
188 QString path = QPEApplication::qpeDir(); 187 QString path = QPEApplication::qpeDir();
189 path.append( "/plugins/decorations/" ); 188 path.append( "/plugins/decorations/" );
190 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 189 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
191 190
192 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 191 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
193 { 192 {
194 QString libstr = path; 193 QString libstr = path;
195 libstr.append( "/" ); 194 libstr.append( "/" );
196 libstr.append( *it ); 195 libstr.append( *it );
197 QLibrary *lib = new QLibrary ( libstr ); 196 QLibrary *lib = new QLibrary ( libstr );
198 WindowDecorationInterface *iface; 197 WindowDecorationInterface *iface;
199 198
200 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) 199 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK )
201 { 200 {
202 DecoListItem *dlit = new DecoListItem ( lib, iface ); 201 DecoListItem *dlit = new DecoListItem ( lib, iface );
203 m_deco_list-> insertItem ( dlit ); 202 m_deco_list-> insertItem ( dlit );
204 203
205 if ( dlit-> key ( ) == s ) 204 if ( dlit-> key ( ) == s )
206 m_deco_list-> setCurrentItem ( dlit ); 205 m_deco_list-> setCurrentItem ( dlit );
207 } 206 }
208 else 207 else
209 delete lib; 208 delete lib;
210 } 209 }
211 } 210 }
212 211
213 m_original_deco = m_deco_list-> currentItem ( ); 212 m_original_deco = m_deco_list-> currentItem ( );
214 if ( m_deco_list-> currentItem ( ) < 0 ) 213 if ( m_deco_list-> currentItem ( ) < 0 )
215 m_deco_list-> setCurrentItem ( 0 ); 214 m_deco_list-> setCurrentItem ( 0 );
216 decoClicked ( m_original_deco ); 215 decoClicked ( m_original_deco );
217 216
218 connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); 217 connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) );
219 218
220 return tab; 219 return tab;
221} 220}
222 221
223QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) 222QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
224{ 223{
225 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); 224 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
226 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); 225 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
227 int size = cfg. readNumEntry ( "FontSize", 10 ); 226 int size = cfg. readNumEntry ( "FontSize", 10 );
228 227
229 m_fontselect = new OFontSelector ( false, parent, "FontTab" ); 228 m_fontselect = new OFontSelector ( false, parent, "FontTab" );
230 m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); 229 m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
231 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); 230 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) );
232 231
233 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 232 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
234 this, SLOT( fontClicked ( const QFont & ))); 233 this, SLOT( fontClicked ( const QFont & )));
235 234
236 return m_fontselect; 235 return m_fontselect;
237} 236}
238 237
239QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) 238QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
240{ 239{
241 QWidget *tab = new QWidget( parent, "ColorTab" ); 240 QWidget *tab = new QWidget( parent, "ColorTab" );
242 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); 241 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 );
243 gridLayout->setRowStretch ( 3, 10 ); 242 gridLayout->setRowStretch ( 3, 10 );
244 243
245 m_color_list = new QListBox ( tab ); 244 m_color_list = new QListBox ( tab );
246 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); 245 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 );
247 connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); 246 connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) );
248 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." ) ); 247 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." ) );
249 248
250 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); 249 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg ));
251 250
252 QString path = QPEApplication::qpeDir ( ); 251 QString path = QPEApplication::qpeDir ( );
253 path.append( "/etc/colors/" ); 252 path.append( "/etc/colors/" );
254 QStringList sl = QDir ( path ). entryList ( "*.scheme" ); 253 QStringList sl = QDir ( path ). entryList ( "*.scheme" );
255 254
256 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 255 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
257 { 256 {
258 QString name = (*it). left ((*it). find ( ".scheme" )); 257 QString name = (*it). left ((*it). find ( ".scheme" ));
259 QString pathstr = path; 258 QString pathstr = path;
260 pathstr.append( *it ); 259 pathstr.append( *it );
261 Config config ( pathstr, Config::File ); 260 Config config ( pathstr, Config::File );
262 config. setGroup ( "Colors" ); 261 config. setGroup ( "Colors" );
263 262
264 m_color_list-> insertItem ( new ColorListItem ( name, config )); 263 m_color_list-> insertItem ( new ColorListItem ( name, config ));
265 } 264 }
266 265
267 m_color_list-> setCurrentItem ( 0 ); 266 m_color_list-> setCurrentItem ( 0 );
268 267
269 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); 268 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" );
270 tempButton->setText( tr( "Edit..." ) ); 269 tempButton->setText( tr( "Edit..." ) );
271 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); 270 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) );
272 gridLayout->addWidget( tempButton, 0, 1 ); 271 gridLayout->addWidget( tempButton, 0, 1 );
273 QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); 272 QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) );
274 273
275 tempButton = new QPushButton( tab, "deleteSchemeButton" ); 274 tempButton = new QPushButton( tab, "deleteSchemeButton" );
276 tempButton->setText( tr( "Delete" ) ); 275 tempButton->setText( tr( "Delete" ) );
277 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); 276 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) );
278 gridLayout->addWidget( tempButton, 1, 1 ); 277 gridLayout->addWidget( tempButton, 1, 1 );
279 QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); 278 QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) );
280 279
281 tempButton = new QPushButton( tab, "saveSchemeButton" ); 280 tempButton = new QPushButton( tab, "saveSchemeButton" );
282 tempButton->setText( tr( "Save" ) ); 281 tempButton->setText( tr( "Save" ) );
283 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); 282 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) );
284 gridLayout->addWidget( tempButton, 2, 1 ); 283 gridLayout->addWidget( tempButton, 2, 1 );
285 QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); 284 QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) );
286 285
287 return tab; 286 return tab;
288} 287}
289 288
290QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) 289QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
291{ 290{
292 QWidget *tab = new QWidget ( parent ); 291 QWidget *tab = new QWidget ( parent );
293 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 292 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
294 293
295 QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); 294 QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
296 295
297 m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); 296 m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab );
298 m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); 297 m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" ));
299 lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); 298 lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 );
300 QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); 299 QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) );
301 300
302 QLabel *l = new QLabel ( tab ); 301 QLabel *l = new QLabel ( tab );
303 l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); 302 l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" )));
304 lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); 303 lay-> addMultiCellWidget ( l, 1, 1, 0, 1 );
305 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." ) ); 304 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." ) );
306 305
307 m_except = new QListView ( tab ); 306 m_except = new QListView ( tab );
308 m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); 307 m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 );
309 m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); 308 m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 );
310 m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); 309 m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 );
311 m_except-> addColumn ( tr( "Binary file(s)" )); 310 m_except-> addColumn ( tr( "Binary file(s)" ));
312 m_except-> setColumnAlignment ( 0, AlignCenter ); 311 m_except-> setColumnAlignment ( 0, AlignCenter );
313 m_except-> setColumnAlignment ( 1, AlignCenter ); 312 m_except-> setColumnAlignment ( 1, AlignCenter );
314 m_except-> setColumnAlignment ( 2, AlignCenter ); 313 m_except-> setColumnAlignment ( 2, AlignCenter );
315 m_except-> setAllColumnsShowFocus ( true ); 314 m_except-> setAllColumnsShowFocus ( true );
316 m_except-> setMinimumHeight ( 30 ); 315 m_except-> setMinimumHeight ( 30 );
317 m_except-> header ( )-> setClickEnabled ( false ); 316 m_except-> header ( )-> setClickEnabled ( false );
318 m_except-> header ( )-> setResizeEnabled ( false ); 317 m_except-> header ( )-> setResizeEnabled ( false );
319 m_except-> header ( )-> setMovingEnabled ( false ); 318 m_except-> header ( )-> setMovingEnabled ( false );
320 m_except-> setSorting ( -1 ); 319 m_except-> setSorting ( -1 );
321 lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); 320 lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 );
322 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." ) ); 321 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." ) );
323 322
324 connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); 323 connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int )));
325 324
326 QToolButton *tb = new QToolButton ( tab ); 325 QToolButton *tb = new QToolButton ( tab );
327 tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); 326 tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" ));
328 tb-> setFocusPolicy ( QWidget::StrongFocus ); 327 tb-> setFocusPolicy ( QWidget::StrongFocus );
329 lay-> addWidget ( tb, 2, 1 ); 328 lay-> addWidget ( tb, 2, 1 );
330 connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); 329 connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( )));
331 QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); 330 QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) );
332 331
333 tb = new QToolButton ( tab ); 332 tb = new QToolButton ( tab );
334 tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); 333 tb-> setIconSet ( Resource::loadIconSet ( "editdelete" ));
335 tb-> setFocusPolicy ( QWidget::StrongFocus ); 334 tb-> setFocusPolicy ( QWidget::StrongFocus );
336 lay-> addWidget ( tb, 3, 1 ); 335 lay-> addWidget ( tb, 3, 1 );
337 connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); 336 connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( )));
338 QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); 337 QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) );
339 338
340 tb = new QToolButton ( tab ); 339 tb = new QToolButton ( tab );
341 tb-> setIconSet ( Resource::loadIconSet ( "up" )); 340 tb-> setIconSet ( Resource::loadIconSet ( "up" ));
342 tb-> setFocusPolicy ( QWidget::StrongFocus ); 341 tb-> setFocusPolicy ( QWidget::StrongFocus );
343 lay-> addWidget ( tb, 4, 1 ); 342 lay-> addWidget ( tb, 4, 1 );
344 connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); 343 connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( )));
345 QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); 344 QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) );
346 345
347 tb = new QToolButton ( tab ); 346 tb = new QToolButton ( tab );
348 tb-> setIconSet ( Resource::loadIconSet ( "down" )); 347 tb-> setIconSet ( Resource::loadIconSet ( "down" ));
349 tb-> setFocusPolicy ( QWidget::StrongFocus ); 348 tb-> setFocusPolicy ( QWidget::StrongFocus );
350 lay-> addWidget ( tb, 5, 1 ); 349 lay-> addWidget ( tb, 5, 1 );
351 connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); 350 connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( )));
352 QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); 351 QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) );
353 352
354 lay-> setRowStretch ( 6, 10 ); 353 lay-> setRowStretch ( 6, 10 );
355 lay-> setColStretch ( 0, 10 ); 354 lay-> setColStretch ( 0, 10 );
356 355
357 QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); 356 QStringList sl = cfg. readListEntry ( "NoStyle", ';' );
358 QListViewItem *lvit = 0; 357 QListViewItem *lvit = 0;
359 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 358 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
360 { 359 {
361 int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); 360 int fl = ( *it ). left ( 1 ). toInt ( 0, 32 );
362 361
363 lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); 362 lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 );
364 } 363 }
365 364
366 365
367 vertLayout-> addSpacing ( 3 ); 366 vertLayout-> addSpacing ( 3 );
368 QFrame *f = new QFrame ( tab ); 367 QFrame *f = new QFrame ( tab );
369 f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); 368 f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken );
370 vertLayout-> addWidget ( f ); 369 vertLayout-> addWidget ( f );
371 vertLayout-> addSpacing ( 3 ); 370 vertLayout-> addSpacing ( 3 );
372 371
373 372
374 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); 373 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
375 374
376 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; 375 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1;
377 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); 376 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" );
378 377
379 QLabel* label = new QLabel( tr( "Tab style:" ), tab ); 378 QLabel* label = new QLabel( tr( "Tab style:" ), tab );
380 gridLayout-> addWidget ( label, 0, 0 ); 379 gridLayout-> addWidget ( label, 0, 0 );
381 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" ) ); 380 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" ) );
382 381
383 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); 382 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
384 btngrp-> hide ( ); 383 btngrp-> hide ( );
385 btngrp-> setExclusive ( true ); 384 btngrp-> setExclusive ( true );
386 385
387 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); 386 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
388 m_tabstyle_list-> insertItem ( tr( "Tabs" )); 387 m_tabstyle_list-> insertItem ( tr( "Tabs" ));
389 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); 388 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
390 m_tabstyle_list-> insertItem ( tr( "Drop down list" )); 389 m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
391 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); 390 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
392 m_tabstyle_list-> setCurrentItem ( style ); 391 m_tabstyle_list-> setCurrentItem ( style );
393 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); 392 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
394 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" ) ); 393 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" ) );
395 394
396 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); 395 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
397 btngrp-> insert ( m_tabstyle_top ); 396 btngrp-> insert ( m_tabstyle_top );
398 gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); 397 gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
399 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); 398 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) );
400 399
401 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); 400 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
402 btngrp-> insert ( m_tabstyle_bottom ); 401 btngrp-> insert ( m_tabstyle_bottom );
403 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); 402 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
404 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); 403 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) );
405 404
406 m_tabstyle_top-> setChecked ( tabtop ); 405 m_tabstyle_top-> setChecked ( tabtop );
407 m_tabstyle_bottom-> setChecked ( !tabtop ); 406 m_tabstyle_bottom-> setChecked ( !tabtop );
408 407
409 m_original_tabstyle = style; 408 m_original_tabstyle = style;
410 m_original_tabpos = tabtop; 409 m_original_tabpos = tabtop;
411 410
412 vertLayout-> addSpacing ( 3 ); 411 vertLayout-> addSpacing ( 3 );
413 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); 412 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
414 413
415 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); 414 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
416 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); 415 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
417 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); 416 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
418 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); 417 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" );
419 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); 418 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 );
420 QPixmap ccw1; 419 QPixmap ccw1;
421 m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); 420 m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" );
422 QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); 421 QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( );
423 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); 422 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" );
424 423
425 rotbtngrp-> hide ( ); 424 rotbtngrp-> hide ( );
426 rotbtngrp-> setExclusive ( true ); 425 rotbtngrp-> setExclusive ( true );
427 rotbtngrp-> insert ( m_rotdir_cw ); 426 rotbtngrp-> insert ( m_rotdir_cw );
428 rotbtngrp-> insert ( m_rotdir_ccw ); 427 rotbtngrp-> insert ( m_rotdir_ccw );
429 rotbtngrp-> insert ( m_rotdir_flip ); 428 rotbtngrp-> insert ( m_rotdir_flip );
430 429
431 ccw1. convertFromImage( ccwImage ); 430 ccw1. convertFromImage( ccwImage );
432 m_rotdir_cw-> setPixmap( cw1 ); 431 m_rotdir_cw-> setPixmap( cw1 );
433 m_rotdir_ccw-> setPixmap( ccw1 ); 432 m_rotdir_ccw-> setPixmap( ccw1 );
434 m_rotdir_flip-> setPixmap( flip1 ); 433 m_rotdir_flip-> setPixmap( flip1 );
435 434
436 rotLay-> addWidget ( rotlabel, 0 ); 435 rotLay-> addWidget ( rotlabel, 0 );
437 rotLay-> addWidget ( m_rotdir_cw, 0 ); 436 rotLay-> addWidget ( m_rotdir_cw, 0 );
438 rotLay-> addWidget ( m_rotdir_ccw, 0 ); 437 rotLay-> addWidget ( m_rotdir_ccw, 0 );
439 rotLay-> addWidget ( m_rotdir_flip, 0 ); 438 rotLay-> addWidget ( m_rotdir_flip, 0 );
440 439
441 int rotDirection = cfg.readNumEntry( "rotatedir" ); 440 int rotDirection = cfg.readNumEntry( "rotatedir" );
442 ODirection rot = CW; 441 ODirection rot = CW;
443 442
444 if (rotDirection == -1) 443 if (rotDirection == -1)
445 { 444 {
446 rot = ODevice::inst ( )-> direction ( ); 445 rot = ODevice::inst ( )-> direction ( );
447 } 446 }
448 else 447 else
449 { 448 {
450 rot = (ODirection)rotDirection; 449 rot = (ODirection)rotDirection;
451 } 450 }
452 451
453 m_rotdir_cw-> setChecked ( rot == CW ); 452 m_rotdir_cw-> setChecked ( rot == CW );
454 m_rotdir_ccw-> setChecked ( rot == CCW ); 453 m_rotdir_ccw-> setChecked ( rot == CCW );
455 m_rotdir_flip-> setChecked ( rot == Flip ); 454 m_rotdir_flip-> setChecked ( rot == Flip );
456 455
457 return tab; 456 return tab;
458} 457}
459 458
460 459
461Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 460Appearance::Appearance( QWidget* parent, const char* name, WFlags )
462 : QDialog ( parent, name, true, WStyle_ContextHelp ) 461 : QDialog ( parent, name, true, WStyle_ContextHelp )
463{ 462{
464 setCaption( tr( "Appearance Settings" ) ); 463 setCaption( tr( "Appearance Settings" ) );
465 464
466 Config config( "qpe" ); 465 Config config( "qpe" );
467 config.setGroup( "Appearance" ); 466 config.setGroup( "Appearance" );
468 467
469 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); 468 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
470 469
471 m_sample = new SampleWindow ( this ); 470 m_sample = new SampleWindow ( this );
472 471
473 m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); 472 m_sample-> setDecoration ( new DefaultWindowDecoration ( ) );
474 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); 473 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
475 474
476 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 475 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
477 QWidget *styletab; 476 QWidget *styletab;
478 477
479 m_color_list = 0; 478 m_color_list = 0;
480 479
481 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); 480 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
482 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); 481 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" ));
483 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); 482 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
484 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); 483 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
485 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); 484 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) );
486 485
487 top-> addWidget ( tw, 10 ); 486 top-> addWidget ( tw, 10 );
488 top-> addWidget ( m_sample, 1 ); 487 top-> addWidget ( m_sample, 1 );
489 488
490 tw-> setCurrentTab ( styletab ); 489 tw-> setCurrentTab ( styletab );
491 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); 490 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
492 491
493 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; 492 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
494} 493}
495 494
496Appearance::~Appearance() 495Appearance::~Appearance()
497{} 496{}
498 497
499void Appearance::tabChanged ( QWidget *w ) 498void Appearance::tabChanged ( QWidget *w )
500{ 499{
501 if ( w == m_advtab ) 500 if ( w == m_advtab )
502 { 501 {
503 m_sample-> hide ( ); 502 m_sample-> hide ( );
504 updateGeometry ( ); // shouldn't be necessary ... 503 updateGeometry ( ); // shouldn't be necessary ...
505 } 504 }
506 else 505 else
507 m_sample-> show ( ); 506 m_sample-> show ( );
508} 507}
509 508
510void Appearance::accept ( ) 509void Appearance::accept ( )
511{ 510{
512 bool newtabpos = m_tabstyle_top-> isChecked ( ); 511 bool newtabpos = m_tabstyle_top-> isChecked ( );
513 int newtabstyle = m_tabstyle_list-> currentItem ( ); 512 int newtabstyle = m_tabstyle_list-> currentItem ( );
514 513
515 Config config ( "qpe" ); 514 Config config ( "qpe" );
516 config. setGroup ( "Appearance" ); 515 config. setGroup ( "Appearance" );
517 516
518 if ( m_style_changed ) 517 if ( m_style_changed )
519 { 518 {
520 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 519 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
521 if ( item ) 520 if ( item )
522 config.writeEntry( "Style", item-> key ( )); 521 config.writeEntry( "Style", item-> key ( ));
523 } 522 }
524 523
525 if ( m_deco_changed ) 524 if ( m_deco_changed )
526 { 525 {
527 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); 526 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( ));
528 if ( item ) 527 if ( item )
529 config.writeEntry( "Decoration", item-> key ( )); 528 config.writeEntry( "Decoration", item-> key ( ));
530 } 529 }
531 530
532 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) 531 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos ))
533 { 532 {
534 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 533 config. writeEntry ( "TabStyle", newtabstyle + 1 );
535 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 534 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
536 } 535 }
537 536
538 if ( m_font_changed ) 537 if ( m_font_changed )
539 { 538 {
540 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 539 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
541 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 540 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
542 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 541 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
543 } 542 }
544 543
545 544
546 if ( m_color_changed ) 545 if ( m_color_changed )
547 { 546 {
548 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 547 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
549 548
550 if ( item ) 549 if ( item )
551 item-> save ( config ); 550 item-> save ( config );
552 } 551 }
553 552
554 ODirection rot; 553 ODirection rot;
555 if (m_rotdir_ccw-> isChecked ( )) 554 if (m_rotdir_ccw-> isChecked ( ))
556 { 555 {
557 rot = CCW; 556 rot = CCW;
558 } 557 }
559 else if (m_rotdir_cw-> isChecked ( )) 558 else if (m_rotdir_cw-> isChecked ( ))
560 { 559 {
561 rot = CW; 560 rot = CW;
562 } 561 }
563 else 562 else
564 { 563 {
565 rot = Flip; 564 rot = Flip;
566 } 565 }
567 config. writeEntry ( "rotatedir", (int)rot ); 566 config. writeEntry ( "rotatedir", (int)rot );
568 567
569 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated 568 m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated
570 569
571 QStringList sl; 570 QStringList sl;
572 QString exceptstr; 571 QString exceptstr;
573 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) 572 for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( ))
574 { 573 {
575 int fl = 0; 574 int fl = 0;
576 fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); 575 fl |= ( it-> noStyle ( ) ? 0x01 : 0 );
577 fl |= ( it-> noFont ( ) ? 0x02 : 0 ); 576 fl |= ( it-> noFont ( ) ? 0x02 : 0 );
578 fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); 577 fl |= ( it-> noDeco ( ) ? 0x04 : 0 );
579 exceptstr = QString::number ( fl, 32 ); 578 exceptstr = QString::number ( fl, 32 );
580 exceptstr.append( it-> pattern ( )); 579 exceptstr.append( it-> pattern ( ));
581 sl << exceptstr; 580 sl << exceptstr;
582 } 581 }
583 config. writeEntry ( "NoStyle", sl, ';' ); 582 config. writeEntry ( "NoStyle", sl, ';' );
584 config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); 583 config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
585 584
586 config. write ( ); // need to flush the config info first 585 config. write ( ); // need to flush the config info first
587 Global::applyStyle ( ); 586 Global::applyStyle ( );
588 587
589 QDialog::accept ( ); 588 QDialog::accept ( );
590} 589}
591 590
592void Appearance::done ( int r ) 591void Appearance::done ( int r )
593{ 592{
594 QDialog::done ( r ); 593 QDialog::done ( r );
595 close ( ); 594 close ( );
596} 595}
597 596
598 597
599void Appearance::styleClicked ( int index ) 598void Appearance::styleClicked ( int index )
600{ 599{
601 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); 600 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
602 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); 601 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
603 602
604 if ( m_sample && sli && sli-> style ( )) 603 if ( m_sample && sli && sli-> style ( ))
605 { 604 {
606 int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; 605 int ci = m_color_list ? m_color_list-> currentItem ( ) : -1;
607 606
608 m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); 607 m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( ));
609 } 608 }
610 609
611 m_style_changed |= ( index != m_original_style ); 610 m_style_changed |= ( index != m_original_style );
612} 611}
613 612
614void Appearance::styleSettingsClicked ( ) 613void Appearance::styleSettingsClicked ( )
615{ 614{
616 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 615 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
617 616
618 if ( item && item-> hasSettings ( )) 617 if ( item && item-> hasSettings ( ))
619 { 618 {
620 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); 619 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
621 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); 620 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 );
622 621
623 QWidget *w = item-> settings ( d ); 622 QWidget *w = item-> settings ( d );
624 623
625 if ( w ) 624 if ( w )
626 { 625 {
627 vbox-> addWidget ( w ); 626 vbox-> addWidget ( w );
628 627
629 d-> setCaption ( w-> caption ( )); 628 d-> setCaption ( w-> caption ( ));
630 629
631 bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); 630 bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted );
632 631
633 if ( item-> setSettings ( accepted )) 632 if ( item-> setSettings ( accepted ))
634 m_style_changed = true; 633 m_style_changed = true;
635 } 634 }
636 delete d; 635 delete d;
637 } 636 }
638} 637}
639 638
640void Appearance::decoClicked ( int index ) 639void Appearance::decoClicked ( int index )
641{ 640{
642 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); 641 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index );
643 642
644 if ( m_sample ) 643 if ( m_sample )
645 { 644 {
646 if ( dli && dli-> interface ( )) 645 if ( dli && dli-> interface ( ))
647 m_sample-> setDecoration ( dli-> interface ( )); 646 m_sample-> setDecoration ( dli-> interface ( ));
648 else 647 else
649 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 648 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
650 m_sample-> repaint ( ); 649 m_sample-> repaint ( );
651 } 650 }
652 m_deco_changed |= ( index != m_original_deco ); 651 m_deco_changed |= ( index != m_original_deco );
653} 652}
654 653
655void Appearance::fontClicked ( const QFont &f ) 654void Appearance::fontClicked ( const QFont &f )
656{ 655{
657 m_font_changed |= ( f != m_sample-> font ( )); 656 m_font_changed |= ( f != m_sample-> font ( ));
658 m_sample-> setFont ( f ); 657 m_sample-> setFont ( f );
659} 658}
660 659
661void Appearance::colorClicked ( int index ) 660void Appearance::colorClicked ( int index )
662{ 661{
663 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); 662 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index );
664 663
665 if ( item ) 664 if ( item )
666 m_sample-> setPalette ( item-> palette ( )); 665 m_sample-> setPalette ( item-> palette ( ));
667 666
668 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); 667 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( ));
669} 668}
670 669
671 670
672void Appearance::editSchemeClicked ( ) 671void Appearance::editSchemeClicked ( )
673{ 672{
674 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 673 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
675 674
676 int cnt = 0; 675 int cnt = 0;
677 QString labels [QColorGroup::NColorRoles]; 676 QString labels [QColorGroup::NColorRoles];
678 QColor colors [QColorGroup::NColorRoles]; 677 QColor colors [QColorGroup::NColorRoles];
679 678
680 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) 679 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ )
681 { 680 {
682 QColor col = item-> color ( role ); 681 QColor col = item-> color ( role );
683 682
684 if ( col. isValid ( )) 683 if ( col. isValid ( ))
685 { 684 {
686 labels [cnt] = item-> label ( role ); 685 labels [cnt] = item-> label ( role );
687 colors [cnt] = col; 686 colors [cnt] = col;
688 687
689 cnt++; 688 cnt++;
690 } 689 }
691 } 690 }
692 691
693 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); 692 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true );
694 if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) 693 if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted )
695 { 694 {
696 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); 695 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 );
697 cnt = 0; 696 cnt = 0;
698 697
699 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) 698 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ )
700 { 699 {
701 if ( item-> color ( role ). isValid ( )) 700 if ( item-> color ( role ). isValid ( ))
702 { 701 {
703 citem-> setColor ( role, colors [cnt] ); 702 citem-> setColor ( role, colors [cnt] );
704 cnt++; 703 cnt++;
705 } 704 }
706 } 705 }
707 706
708 m_color_list-> setCurrentItem ( 0 ); 707 m_color_list-> setCurrentItem ( 0 );
709 colorClicked ( 0 ); 708 colorClicked ( 0 );
710 709
711 m_color_changed = true; 710 m_color_changed = true;
712 } 711 }
713 delete editdlg; 712 delete editdlg;
714} 713}
715 714
716 715
717void Appearance::saveSchemeClicked() 716void Appearance::saveSchemeClicked()
718{ 717{
719 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 718 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
720 719
721 if ( !item ) 720 if ( !item )
722 return; 721 return;
723 722
724 QDialog *d = new QDialog ( this, 0, true ); 723 QDialog *d = new QDialog ( this, 0, true );
725 d-> setCaption ( tr( "Save Scheme" )); 724 d-> setCaption ( tr( "Save Scheme" ));
726 QLineEdit *ed = new QLineEdit ( d ); 725 QLineEdit *ed = new QLineEdit ( d );
727 ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); 726 ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed );
728 ed-> setFocus ( ); 727 ed-> setFocus ( );
729 728
730 if ( d-> exec ( ) == QDialog::Accepted ) 729 if ( d-> exec ( ) == QDialog::Accepted )
731 { 730 {
732 QString schemename = ed-> text ( ); 731 QString schemename = ed-> text ( );
733 QString filestr = QPEApplication::qpeDir(); 732 QString filestr = QPEApplication::qpeDir();
734 filestr.append( "/etc/colors/" ); 733 filestr.append( "/etc/colors/" );
735 filestr.append( schemename ); 734 filestr.append( schemename );
736 filestr.append( ".scheme" ); 735 filestr.append( ".scheme" );
737 QFile file ( filestr ); 736 QFile file ( filestr );
738 if ( !file. exists ( )) 737 if ( !file. exists ( ))
739 { 738 {
740 QPalette p = item-> palette ( ); 739 QPalette p = item-> palette ( );
741 740
742 Config config ( file.name(), Config::File ); 741 Config config ( file.name(), Config::File );
743 config. setGroup( "Colors" ); 742 config. setGroup( "Colors" );
744 743
745 item-> save ( config ); 744 item-> save ( config );
746 745
747 config. write ( ); // need to flush the config info first 746 config. write ( ); // need to flush the config info first
748 747
749 m_color_list-> insertItem ( new ColorListItem ( schemename, config )); 748 m_color_list-> insertItem ( new ColorListItem ( schemename, config ));
750 } 749 }
751 else 750 else
752 { 751 {
753 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); 752 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
754 } 753 }
755 } 754 }
756 delete d; 755 delete d;
757} 756}
758 757
759void Appearance::deleteSchemeClicked() 758void Appearance::deleteSchemeClicked()
760{ 759{
761 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 760 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
762 761
763 if ( !item ) 762 if ( !item )
764 return; 763 return;
765 764
766 if ( m_color_list-> currentItem ( ) > 0 ) 765 if ( m_color_list-> currentItem ( ) > 0 )
767 { 766 {
768 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) 767 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) )
769 { 768 {
770 QString filestr = QPEApplication::qpeDir ( ); 769 QString filestr = QPEApplication::qpeDir ( );
771 filestr.append( "/etc/colors/" ); 770 filestr.append( "/etc/colors/" );
772 filestr.append( item-> text ( ) ); 771 filestr.append( item-> text ( ) );
773 filestr.append( ".scheme" ); 772 filestr.append( ".scheme" );
774 QFile::remove ( filestr ); 773 QFile::remove ( filestr );
775 delete item; 774 delete item;
776 } 775 }
777 } 776 }
778 else 777 else
779 { 778 {
780 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); 779 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." ));
781 } 780 }
782} 781}
783 782
784 783
785void Appearance::addExcept ( ) 784void Appearance::addExcept ( )
786{ 785{
787 ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); 786 ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true );
788 m_except-> ensureItemVisible ( it ); 787 m_except-> ensureItemVisible ( it );
789 m_except-> setSelected ( it, true ); 788 m_except-> setSelected ( it, true );
790} 789}
791 790
792void Appearance::delExcept ( ) 791void Appearance::delExcept ( )
793{ 792{
794 if ( m_except-> selectedItem ( )) 793 if ( m_except-> selectedItem ( ))
795 { 794 {
796 m_except-> setFocus ( ); 795 m_except-> setFocus ( );
797 delete m_except-> selectedItem ( ); 796 delete m_except-> selectedItem ( );
798 } 797 }
799} 798}
800 799
801void Appearance::upExcept ( ) 800void Appearance::upExcept ( )
802{ 801{
803 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); 802 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
804 803
805 if ( it && it-> itemAbove ( )) 804 if ( it && it-> itemAbove ( ))
806 it-> itemAbove ( )-> moveItem ( it ); 805 it-> itemAbove ( )-> moveItem ( it );
807} 806}
808 807
809void Appearance::downExcept ( ) 808void Appearance::downExcept ( )
810{ 809{
811 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); 810 ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
812 811
813 if ( it && it-> itemBelow ( )) 812 if ( it && it-> itemBelow ( ))
814 it-> moveItem ( it-> itemBelow ( )); 813 it-> moveItem ( it-> itemBelow ( ));
815} 814}
816 815
817class ExEdit : public QLineEdit 816class ExEdit : public QLineEdit
818{ 817{
819public: 818public:
820 ExEdit ( ExceptListItem *item ) 819 ExEdit ( ExceptListItem *item )
821 : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item ) 820 : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item )
822 { 821 {
823 setFrame ( false ); 822 setFrame ( false );
824 823
825 QRect r = it-> listView ( )-> itemRect ( it ); 824 QRect r = it-> listView ( )-> itemRect ( it );
826 825
827 int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1; 826 int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1;
828 int y = r. y ( ); 827 int y = r. y ( );
829 int w = it-> listView ( )-> viewport ( )-> width ( ) - x; 828 int w = it-> listView ( )-> viewport ( )-> width ( ) - x;
830 int h = r. height ( ); // + 2; 829 int h = r. height ( ); // + 2;
831 830
832 setText ( it-> pattern ( )); 831 setText ( it-> pattern ( ));
833 setGeometry ( x, y, w, h ); 832 setGeometry ( x, y, w, h );
834 833
835 qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h); 834 qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h);
836 835
837 m_out = true; 836 m_out = true;
838 837
839 show ( ); 838 show ( );
840 setFocus ( ); 839 setFocus ( );
841 selectAll ( ); 840 selectAll ( );
842 end ( true ); 841 end ( true );
843 } 842 }
844 843
845 virtual void focusOutEvent ( QFocusEvent * ) 844 virtual void focusOutEvent ( QFocusEvent * )
846 { 845 {
847 hide ( ); 846 hide ( );
848 if ( m_out ) 847 if ( m_out )
849 it-> setPattern ( text ( )); 848 it-> setPattern ( text ( ));
850 delete this; 849 delete this;
851 } 850 }
852 851
853 virtual void keyPressEvent ( QKeyEvent *e ) 852 virtual void keyPressEvent ( QKeyEvent *e )
854 { 853 {
855 if ( e-> key ( ) == Key_Return ) 854 if ( e-> key ( ) == Key_Return )
856 it-> listView ( )-> setFocus ( ); 855 it-> listView ( )-> setFocus ( );
857 else if ( e-> key ( ) == Key_Escape ) 856 else if ( e-> key ( ) == Key_Escape )
858 { 857 {
859 m_out = false; 858 m_out = false;
860 it-> listView ( )-> setFocus ( ); 859 it-> listView ( )-> setFocus ( );
861 } 860 }
862 else 861 else
863 QLineEdit::keyPressEvent ( e ); 862 QLineEdit::keyPressEvent ( e );
864 } 863 }
865 864
866private: 865private:
867 ExceptListItem *it; 866 ExceptListItem *it;
868 bool m_out; 867 bool m_out;
869}; 868};
870 869
871void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c ) 870void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c )
872{ 871{
873 if ( !item || c < 0 || c > 3 ) 872 if ( !item || c < 0 || c > 3 )
874 return; 873 return;
875 874
876 ExceptListItem *it = (ExceptListItem *) item; 875 ExceptListItem *it = (ExceptListItem *) item;
877 876
878 if ( c == 0 ) 877 if ( c == 0 )
879 it-> setNoStyle ( !it-> noStyle ( )); 878 it-> setNoStyle ( !it-> noStyle ( ));
880 else if ( c == 1 ) 879 else if ( c == 1 )
881 it-> setNoFont ( !it-> noFont ( )); 880 it-> setNoFont ( !it-> noFont ( ));
882 else if ( c == 2 ) 881 else if ( c == 2 )
883 it-> setNoDeco ( !it-> noDeco ( )); 882 it-> setNoDeco ( !it-> noDeco ( ));
884 else if ( c == 3 ) 883 else if ( c == 3 )
885 { 884 {
886 m_except-> ensureItemVisible ( it ); 885 m_except-> ensureItemVisible ( it );
887 new ExEdit ( it ); 886 new ExEdit ( it );
888 } 887 }
889} 888}
890 889
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h
index 51e9636..f45f549 100644
--- a/noncore/settings/appearance2/appearance.h
+++ b/noncore/settings/appearance2/appearance.h
@@ -1,128 +1,132 @@
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 <opie2/ofontselector.h>
33
32#include <qpe/fontdatabase.h> 34#include <qpe/fontdatabase.h>
33 35
34#include <qdialog.h> 36#include <qdialog.h>
35 37
38using Opie::OFontSelector;
39
36class QCheckBox; 40class QCheckBox;
37class QComboBox; 41class QComboBox;
38class QLabel; 42class QLabel;
39class QLineEdit; 43class QLineEdit;
40class QListBox; 44class QListBox;
41class QMultiLineEdit; 45class QMultiLineEdit;
42class QPushButton; 46class QPushButton;
43class QRadioButton; 47class QRadioButton;
44class QToolButton; 48class QToolButton;
45class SampleWindow; 49class SampleWindow;
46class OFontSelector; 50class OFontSelector;
47class QListView; 51class QListView;
48class QListViewItem; 52class QListViewItem;
49class Config; 53class Config;
50 54
51class Appearance : public QDialog 55class Appearance : public QDialog
52{ 56{
53 Q_OBJECT 57 Q_OBJECT
54 58
55public: 59public:
56 Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 60 Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
57 ~Appearance(); 61 ~Appearance();
58 static QString appName() { return QString::fromLatin1("appearance"); } 62 static QString appName() { return QString::fromLatin1("appearance"); }
59 63
60protected: 64protected:
61 virtual void accept ( ); 65 virtual void accept ( );
62 virtual void done ( int r ); 66 virtual void done ( int r );
63 67
64protected slots: 68protected slots:
65 void styleClicked ( int ); 69 void styleClicked ( int );
66 void styleSettingsClicked ( ); 70 void styleSettingsClicked ( );
67 void decoClicked ( int ); 71 void decoClicked ( int );
68 void fontClicked ( const QFont & ); 72 void fontClicked ( const QFont & );
69 void colorClicked ( int ); 73 void colorClicked ( int );
70 74
71 void editSchemeClicked(); 75 void editSchemeClicked();
72 void saveSchemeClicked(); 76 void saveSchemeClicked();
73 void deleteSchemeClicked(); 77 void deleteSchemeClicked();
74 78
75 void tabChanged ( QWidget * ); 79 void tabChanged ( QWidget * );
76 80
77 void addExcept ( ); 81 void addExcept ( );
78 void delExcept ( ); 82 void delExcept ( );
79 void upExcept ( ); 83 void upExcept ( );
80 void downExcept ( ); 84 void downExcept ( );
81 void clickedExcept ( QListViewItem *, const QPoint &, int ); 85 void clickedExcept ( QListViewItem *, const QPoint &, int );
82 86
83private: 87private:
84 void changeText(); 88 void changeText();
85 89
86 QWidget *createStyleTab ( QWidget *parent, Config &cfg ); 90 QWidget *createStyleTab ( QWidget *parent, Config &cfg );
87 QWidget *createDecoTab ( QWidget *parent, Config &cfg ); 91 QWidget *createDecoTab ( QWidget *parent, Config &cfg );
88 QWidget *createFontTab ( QWidget *parent, Config &cfg ); 92 QWidget *createFontTab ( QWidget *parent, Config &cfg );
89 QWidget *createColorTab ( QWidget *parent, Config &cfg ); 93 QWidget *createColorTab ( QWidget *parent, Config &cfg );
90 QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); 94 QWidget *createAdvancedTab ( QWidget *parent, Config &cfg );
91 95
92private: 96private:
93 bool m_style_changed; 97 bool m_style_changed;
94 bool m_font_changed; 98 bool m_font_changed;
95 bool m_scheme_changed; 99 bool m_scheme_changed;
96 bool m_deco_changed; 100 bool m_deco_changed;
97 bool m_color_changed; 101 bool m_color_changed;
98 102
99 int m_original_style; 103 int m_original_style;
100 int m_original_deco; 104 int m_original_deco;
101 int m_original_tabstyle; 105 int m_original_tabstyle;
102 bool m_original_tabpos; 106 bool m_original_tabpos;
103 107
104 QListBox * m_style_list; 108 QListBox * m_style_list;
105 QPushButton * m_style_settings; 109 QPushButton * m_style_settings;
106 110
107 QListBox * m_deco_list; 111 QListBox * m_deco_list;
108 112
109 QListBox * m_color_list; 113 QListBox * m_color_list;
110 114
111 OFontSelector *m_fontselect; 115 OFontSelector *m_fontselect;
116
117 SampleWindow *m_sample;
112 118
113 SampleWindow *m_sample;
114
115 QComboBox * m_tabstyle_list; 119 QComboBox * m_tabstyle_list;
116 QRadioButton *m_tabstyle_top; 120 QRadioButton *m_tabstyle_top;
117 QRadioButton *m_tabstyle_bottom; 121 QRadioButton *m_tabstyle_bottom;
118 122
119 QRadioButton *m_rotdir_cw; 123 QRadioButton *m_rotdir_cw;
120 QRadioButton *m_rotdir_ccw; 124 QRadioButton *m_rotdir_ccw;
121 QRadioButton *m_rotdir_flip; 125 QRadioButton *m_rotdir_flip;
122 126
123 QWidget * m_advtab; 127 QWidget * m_advtab;
124 QListView * m_except; 128 QListView * m_except;
125 QCheckBox * m_force; 129 QCheckBox * m_force;
126}; 130};
127 131
128#endif 132#endif
diff --git a/noncore/settings/appearance2/appearance2.pro b/noncore/settings/appearance2/appearance2.pro
index ca5a4ec..e2d73c2 100644
--- a/noncore/settings/appearance2/appearance2.pro
+++ b/noncore/settings/appearance2/appearance2.pro
@@ -1,12 +1,10 @@
1CONFIG = qt warn_on release quick-app 1CONFIG = qt warn_on release quick-app
2HEADERS = appearance.h editScheme.h sample.h 2HEADERS = appearance.h editScheme.h sample.h
3SOURCES = appearance.cpp editScheme.cpp main.cpp sample.cpp 3SOURCES = appearance.cpp editScheme.cpp main.cpp sample.cpp
4INCLUDEPATH += $(OPIEDIR)/include 4INCLUDEPATH += $(OPIEDIR)/include
5DEPENDPATH += ../$(OPIEDIR)/include
6LIBS += -lqpe -lopie
7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 5DEPENDPATH += $(OPIEDIR)/include
6LIBS += -lqpe -lopiecore2 -lopieui2 -lqtaux2
9 7
10 TARGET = appearance 8TARGET = appearance
11 9
12include ( $(OPIEDIR)/include.pro ) 10include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/appearance2/editScheme.cpp b/noncore/settings/appearance2/editScheme.cpp
index 7e5225f..0f3702f 100644
--- a/noncore/settings/appearance2/editScheme.cpp
+++ b/noncore/settings/appearance2/editScheme.cpp
@@ -1,75 +1,73 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> 3 =. 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#include "editScheme.h" 29#include "editScheme.h"
30 30
31#include <opie/ocolorbutton.h>
32
33#include <qaction.h> 31#include <qaction.h>
34#include <qlabel.h> 32#include <qlabel.h>
35#include <qlayout.h> 33#include <qlayout.h>
36#include <qpopupmenu.h> 34#include <qpopupmenu.h>
37#include <qscrollview.h> 35#include <qscrollview.h>
38#include <qtoolbutton.h> 36#include <qtoolbutton.h>
39#include <qwhatsthis.h> 37#include <qwhatsthis.h>
40 38
41EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags ) 39EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags )
42 : QDialog ( parent, name, modal, WStyle_ContextHelp ) 40 : QDialog ( parent, name, modal, WStyle_ContextHelp )
43{ 41{
44 setCaption ( tr( "Edit scheme" ) ); 42 setCaption ( tr( "Edit scheme" ) );
45 QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 ); 43 QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 );
46 44
47 m_count = cnt; 45 m_count = cnt;
48 m_buttons = new OColorButton * [cnt]; 46 m_buttons = new OColorButton * [cnt];
49 m_colors = colors; 47 m_colors = colors;
50 48
51 for ( int i = 0; i < cnt; i++ ) 49 for ( int i = 0; i < cnt; i++ )
52 { 50 {
53 QLabel *l = new QLabel ( labels [i], this ); 51 QLabel *l = new QLabel ( labels [i], this );
54 layout-> addWidget ( l, i, 0 ); 52 layout-> addWidget ( l, i, 0 );
55 QWhatsThis::add( l, tr( "Click here to select a color for: " ).arg( labels [i] ) ); 53 QWhatsThis::add( l, tr( "Click here to select a color for: " ).arg( labels [i] ) );
56 54
57 m_buttons [i] = new OColorButton ( this, colors [i] ); 55 m_buttons [i] = new OColorButton ( this, colors [i] );
58 layout-> addWidget ( m_buttons [i], i, 1 ); 56 layout-> addWidget ( m_buttons [i], i, 1 );
59 QWhatsThis::add( m_buttons [i], tr( "Click here to select a color for: " ).arg( labels [i] ) ); 57 QWhatsThis::add( m_buttons [i], tr( "Click here to select a color for: " ).arg( labels [i] ) );
60 } 58 }
61} 59}
62 60
63EditScheme::~EditScheme ( ) 61EditScheme::~EditScheme ( )
64{ 62{
65 delete [] m_buttons; 63 delete [] m_buttons;
66} 64}
67 65
68void EditScheme::accept ( ) 66void EditScheme::accept ( )
69{ 67{
70 for ( int i = 0; i < m_count; i++ ) 68 for ( int i = 0; i < m_count; i++ )
71 m_colors [i] = m_buttons [i]-> color ( ); 69 m_colors [i] = m_buttons [i]-> color ( );
72 70
73 QDialog::accept ( ); 71 QDialog::accept ( );
74} 72}
75 73
diff --git a/noncore/settings/appearance2/editScheme.h b/noncore/settings/appearance2/editScheme.h
index 93dc50d..c7539cb 100644
--- a/noncore/settings/appearance2/editScheme.h
+++ b/noncore/settings/appearance2/editScheme.h
@@ -1,53 +1,57 @@
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 EDITSCHEME_H 29#ifndef EDITSCHEME_H
30#define EDITSCHEME_H 30#define EDITSCHEME_H
31 31
32#include <opie2/ocolorbutton.h>
33
32#include <qdialog.h> 34#include <qdialog.h>
33 35
36using Opie::OColorButton;
37
34class QColor; 38class QColor;
35class OColorButton; 39class OColorButton;
36 40
37class EditScheme : public QDialog { 41class EditScheme : public QDialog {
38 Q_OBJECT 42 Q_OBJECT
39 43
40public: 44public:
41 EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 45 EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
42 virtual ~EditScheme ( ); 46 virtual ~EditScheme ( );
43 47
44protected slots: 48protected slots:
45 virtual void accept ( ); 49 virtual void accept ( );
46 50
47private: 51private:
48 int m_count; 52 int m_count;
49 QColor *m_colors; 53 QColor *m_colors;
50 OColorButton **m_buttons; 54 OColorButton **m_buttons;
51}; 55};
52 56
53#endif 57#endif