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