summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp16
-rw-r--r--noncore/settings/appearance2/appearance.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index d649ed6..82d8931 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -1,692 +1,708 @@
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#include <opie2/odebug.h> 42#include <opie2/odebug.h>
43 43
44#include <qpe/config.h> 44#include <qpe/config.h>
45#include <qpe/global.h> 45#include <qpe/global.h>
46#include <qpe/qpeapplication.h> 46#include <qpe/qpeapplication.h>
47#include <qpe/qpemessagebox.h> 47#include <qpe/qpemessagebox.h>
48#include <qpe/qcopenvelope_qws.h> 48#include <qpe/qcopenvelope_qws.h>
49#include <qpe/qpestyle.h> 49#include <qpe/qpestyle.h>
50#include <qpe/lightstyle.h> 50#include <qpe/lightstyle.h>
51#include <qpe/styleinterface.h> 51#include <qpe/styleinterface.h>
52 52
53/* QT */ 53/* QT */
54#include <qbuttongroup.h> 54#include <qbuttongroup.h>
55#include <qcheckbox.h> 55#include <qcheckbox.h>
56#include <qcombobox.h> 56#include <qcombobox.h>
57#include <qdialog.h> 57#include <qdialog.h>
58#include <qdir.h> 58#include <qdir.h>
59#include <qlabel.h> 59#include <qlabel.h>
60#include <qlayout.h> 60#include <qlayout.h>
61#include <qlineedit.h> 61#include <qlineedit.h>
62#include <qlistbox.h> 62#include <qlistbox.h>
63#include <qmessagebox.h> 63#include <qmessagebox.h>
64#include <qpushbutton.h> 64#include <qpushbutton.h>
65#include <qradiobutton.h> 65#include <qradiobutton.h>
66#if QT_VERSION >= 0x030000 66#if QT_VERSION >= 0x030000
67#include <qstylefactory.h> 67#include <qstylefactory.h>
68#endif 68#endif
69#include <qtoolbutton.h> 69#include <qtoolbutton.h>
70#include <qwindowsstyle.h> 70#include <qwindowsstyle.h>
71#include <qlistview.h> 71#include <qlistview.h>
72#include <qheader.h> 72#include <qheader.h>
73#include <qvbox.h> 73#include <qvbox.h>
74#include <qwhatsthis.h> 74#include <qwhatsthis.h>
75 75
76using namespace Opie; 76using namespace Opie;
77using namespace Opie::Ui; 77using namespace Opie::Ui;
78using namespace Opie::Core; 78using namespace Opie::Core;
79 79
80class DefaultWindowDecoration : public WindowDecorationInterface 80class DefaultWindowDecoration : public WindowDecorationInterface
81{ 81{
82public: 82public:
83 DefaultWindowDecoration() : ref(0) {} 83 DefaultWindowDecoration() : ref(0) {}
84 QString name() const 84 QString name() const
85 { 85 {
86 return "Default"; 86 return "Default";
87 } 87 }
88 QPixmap icon() const 88 QPixmap icon() const
89 { 89 {
90 return QPixmap(); 90 return QPixmap();
91 } 91 }
92 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 92 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface )
93 { 93 {
94 *iface = 0; 94 *iface = 0;
95 if ( uuid == IID_QUnknown ) 95 if ( uuid == IID_QUnknown )
96 *iface = this; 96 *iface = this;
97 else if ( uuid == IID_WindowDecoration ) 97 else if ( uuid == IID_WindowDecoration )
98 *iface = this; 98 *iface = this;
99 99
100 if ( *iface ) 100 if ( *iface )
101 (*iface)->addRef(); 101 (*iface)->addRef();
102 return QS_OK; 102 return QS_OK;
103 } 103 }
104 Q_REFCOUNT 104 Q_REFCOUNT
105 105
106private: 106private:
107 ulong ref; 107 ulong ref;
108}; 108};
109 109
110 110
111 111
112 112
113 113
114 114
115 115
116QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) 116QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
117{ 117{
118 QWidget* tab = new QWidget( parent, "StyleTab" ); 118 QWidget* tab = new QWidget( parent, "StyleTab" );
119 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 119 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
120 120
121 m_style_list = new QListBox( tab, "m_style_list" ); 121 m_style_list = new QListBox( tab, "m_style_list" );
122 vertLayout->addWidget( m_style_list ); 122 vertLayout->addWidget( m_style_list );
123 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 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." ) );
124 124
125 m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); 125 m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
126 connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked())); 126 connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked()));
127 vertLayout-> addWidget ( m_style_settings ); 127 vertLayout-> addWidget ( m_style_settings );
128 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 QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) );
129 129
130 QString s = cfg. readEntry ( "Style", "Light" ); 130 QString s = cfg. readEntry ( "Style", "Light" );
131 131
132 132
133#if QT_VERSION >= 0x030000 133#if QT_VERSION >= 0x030000
134 m_style_list->insertStringList(QStyleFactory::styles()); 134 m_style_list->insertStringList(QStyleFactory::styles());
135#else 135#else
136 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); 136 m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( )));
137 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); 137 m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( )));
138 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); 138 m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( )));
139#endif 139#endif
140 140
141 { 141 {
142 QString path = QPEApplication::qpeDir ( ); 142 QString path = QPEApplication::qpeDir ( );
143 path.append( "/plugins/styles/" ); 143 path.append( "/plugins/styles/" );
144 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 144 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
145 145
146 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 146 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
147 { 147 {
148 QString libstr = path; 148 QString libstr = path;
149 libstr.append( "/" ); 149 libstr.append( "/" );
150 libstr.append( *it ); 150 libstr.append( *it );
151 QLibrary *lib = new QLibrary ( libstr ); 151 QLibrary *lib = new QLibrary ( libstr );
152 StyleInterface *iface; 152 StyleInterface *iface;
153 153
154 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) 154 if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface )
155 { 155 {
156 StyleListItem *slit = new StyleListItem ( lib, iface ); 156 StyleListItem *slit = new StyleListItem ( lib, iface );
157 m_style_list-> insertItem ( slit ); 157 m_style_list-> insertItem ( slit );
158 158
159 if ( slit-> key ( ) == s ) 159 if ( slit-> key ( ) == s )
160 m_style_list-> setCurrentItem ( slit ); 160 m_style_list-> setCurrentItem ( slit );
161 } 161 }
162 else 162 else
163 delete lib; 163 delete lib;
164 } 164 }
165 } 165 }
166 166
167 m_original_style = m_style_list-> currentItem ( ); 167 m_original_style = m_style_list-> currentItem ( );
168 styleClicked ( m_original_style ); 168 styleClicked ( m_original_style );
169 169
170 connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) ); 170 connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) );
171 171
172 return tab; 172 return tab;
173} 173}
174 174
175QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) 175QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
176{ 176{
177 QWidget* tab = new QWidget( parent, "DecoTab" ); 177 QWidget* tab = new QWidget( parent, "DecoTab" );
178 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 178 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
179 179
180 m_deco_list = new QListBox( tab, "m_deco_list" ); 180 m_deco_list = new QListBox( tab, "m_deco_list" );
181 vertLayout->addWidget( m_deco_list ); 181 vertLayout->addWidget( m_deco_list );
182 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 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." ) );
183 183
184 QString s = cfg. readEntry ( "Decoration", "libflat.so" ); 184 QString s = cfg. readEntry ( "Decoration", "libflat.so" );
185 185
186 m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); 186 m_deco_list-> insertItem ( new DecoListItem ( "QPE" ));
187 187
188 { 188 {
189 QString path = QPEApplication::qpeDir(); 189 QString path = QPEApplication::qpeDir();
190 path.append( "/plugins/decorations/" ); 190 path.append( "/plugins/decorations/" );
191 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 191 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
192 192
193 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 193 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
194 { 194 {
195 QString libstr = path; 195 QString libstr = path;
196 libstr.append( "/" ); 196 libstr.append( "/" );
197 libstr.append( *it ); 197 libstr.append( *it );
198 QLibrary *lib = new QLibrary ( libstr ); 198 QLibrary *lib = new QLibrary ( libstr );
199 WindowDecorationInterface *iface; 199 WindowDecorationInterface *iface;
200 200
201 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) 201 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK )
202 { 202 {
203 DecoListItem *dlit = new DecoListItem ( lib, iface ); 203 DecoListItem *dlit = new DecoListItem ( lib, iface );
204 m_deco_list-> insertItem ( dlit ); 204 m_deco_list-> insertItem ( dlit );
205 205
206 if ( dlit-> key ( ) == s ) 206 if ( dlit-> key ( ) == s )
207 m_deco_list-> setCurrentItem ( dlit ); 207 m_deco_list-> setCurrentItem ( dlit );
208 } 208 }
209 else 209 else
210 delete lib; 210 delete lib;
211 } 211 }
212 } 212 }
213 213
214 m_original_deco = m_deco_list-> currentItem ( ); 214 m_original_deco = m_deco_list-> currentItem ( );
215 if ( m_deco_list-> currentItem ( ) < 0 ) 215 if ( m_deco_list-> currentItem ( ) < 0 )
216 m_deco_list-> setCurrentItem ( 0 ); 216 m_deco_list-> setCurrentItem ( 0 );
217 decoClicked ( m_original_deco ); 217 decoClicked ( m_original_deco );
218 218
219 connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); 219 connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) );
220 220
221 return tab; 221 return tab;
222} 222}
223 223
224QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) 224QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg )
225{ 225{
226 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); 226 QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
227 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); 227 QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
228 int size = cfg. readNumEntry ( "FontSize", 10 ); 228 int size = cfg. readNumEntry ( "FontSize", 10 );
229 229
230 m_fontselect = new OFontSelector ( false, parent, "FontTab" ); 230 m_fontselect = new OFontSelector ( false, parent, "FontTab" );
231 m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); 231 m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
232 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); 232 QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) );
233 233
234 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), 234 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
235 this, SLOT( fontClicked(const QFont&))); 235 this, SLOT( fontClicked(const QFont&)));
236 236
237 return m_fontselect; 237 return m_fontselect;
238} 238}
239 239
240QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) 240QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg )
241{ 241{
242 QWidget *tab = new QWidget( parent, "ColorTab" ); 242 QWidget *tab = new QWidget( parent, "ColorTab" );
243 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); 243 QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 );
244 gridLayout->setRowStretch ( 3, 10 ); 244 gridLayout->setRowStretch ( 3, 10 );
245 245
246 m_color_list = new QListBox ( tab ); 246 m_color_list = new QListBox ( tab );
247 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); 247 gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 );
248 connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); 248 connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) );
249 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 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." ) );
250 250
251 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); 251 m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg ));
252 252
253 QString path = QPEApplication::qpeDir ( ); 253 QString path = QPEApplication::qpeDir ( );
254 path.append( "/etc/colors/" ); 254 path.append( "/etc/colors/" );
255 QStringList sl = QDir ( path ). entryList ( "*.scheme" ); 255 QStringList sl = QDir ( path ). entryList ( "*.scheme" );
256 256
257 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) 257 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
258 { 258 {
259 QString name = (*it). left ((*it). find ( ".scheme" )); 259 QString name = (*it). left ((*it). find ( ".scheme" ));
260 QString pathstr = path; 260 QString pathstr = path;
261 pathstr.append( *it ); 261 pathstr.append( *it );
262 Config config ( pathstr, Config::File ); 262 Config config ( pathstr, Config::File );
263 config. setGroup ( "Colors" ); 263 config. setGroup ( "Colors" );
264 264
265 m_color_list-> insertItem ( new ColorListItem ( name, config )); 265 m_color_list-> insertItem ( new ColorListItem ( name, config ));
266 } 266 }
267 267
268 m_color_list-> setCurrentItem ( 0 ); 268 m_color_list-> setCurrentItem ( 0 );
269 269
270 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); 270 QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" );
271 tempButton->setText( tr( "Edit..." ) ); 271 tempButton->setText( tr( "Edit..." ) );
272 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); 272 connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) );
273 gridLayout->addWidget( tempButton, 0, 1 ); 273 gridLayout->addWidget( tempButton, 0, 1 );
274 QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); 274 QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) );
275 275
276 tempButton = new QPushButton( tab, "deleteSchemeButton" ); 276 tempButton = new QPushButton( tab, "deleteSchemeButton" );
277 tempButton->setText( tr( "Delete" ) ); 277 tempButton->setText( tr( "Delete" ) );
278 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); 278 connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) );
279 gridLayout->addWidget( tempButton, 1, 1 ); 279 gridLayout->addWidget( tempButton, 1, 1 );
280 QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); 280 QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) );
281 281
282 tempButton = new QPushButton( tab, "saveSchemeButton" ); 282 tempButton = new QPushButton( tab, "saveSchemeButton" );
283 tempButton->setText( tr( "Save" ) ); 283 tempButton->setText( tr( "Save" ) );
284 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); 284 connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) );
285 gridLayout->addWidget( tempButton, 2, 1 ); 285 gridLayout->addWidget( tempButton, 2, 1 );
286 QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); 286 QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) );
287 287
288 return tab; 288 return tab;
289} 289}
290 290
291QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) 291QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
292{ 292{
293 QWidget *tab = new QWidget ( parent ); 293 QWidget *tab = new QWidget ( parent );
294 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 294 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
295 295
296 /*
297 * show scrollbars on the left?
298 */
299 m_leftHand = new QCheckBox( tr("Show Scrollbars on the left"), tab );
300 m_leftHand->setChecked( cfg.readBoolEntry( "LeftHand", false ) );
301 QWhatsThis::add( m_leftHand, tr( "Click here to display scrollbars on the left side instead of the right." ) );
302 vertLayout->addWidget( m_leftHand );
303
304 QFrame *f = new QFrame ( tab );
305 f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken );
306 vertLayout-> addWidget ( f );
307 vertLayout-> addSpacing ( 3 );
308
309
296 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); 310 QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
297 311
298 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; 312 int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1;
299 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); 313 bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" );
300 314
301 QLabel* label = new QLabel( tr( "Tab style:" ), tab ); 315 QLabel* label = new QLabel( tr( "Tab style:" ), tab );
302 gridLayout-> addWidget ( label, 0, 0 ); 316 gridLayout-> addWidget ( label, 0, 0 );
303 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" ) ); 317 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" ) );
304 318
305 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); 319 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
306 btngrp-> hide ( ); 320 btngrp-> hide ( );
307 btngrp-> setExclusive ( true ); 321 btngrp-> setExclusive ( true );
308 322
309 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); 323 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
310 m_tabstyle_list-> insertItem ( tr( "Tabs" )); 324 m_tabstyle_list-> insertItem ( tr( "Tabs" ));
311 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); 325 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
312 m_tabstyle_list-> insertItem ( tr( "Drop down list" )); 326 m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
313 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); 327 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
314 m_tabstyle_list-> setCurrentItem ( style ); 328 m_tabstyle_list-> setCurrentItem ( style );
315 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); 329 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
316 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" ) ); 330 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" ) );
317 331
318 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); 332 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
319 btngrp-> insert ( m_tabstyle_top ); 333 btngrp-> insert ( m_tabstyle_top );
320 gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); 334 gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
321 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); 335 QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) );
322 336
323 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); 337 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
324 btngrp-> insert ( m_tabstyle_bottom ); 338 btngrp-> insert ( m_tabstyle_bottom );
325 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); 339 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
326 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); 340 QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) );
327 341
328 m_tabstyle_top-> setChecked ( tabtop ); 342 m_tabstyle_top-> setChecked ( tabtop );
329 m_tabstyle_bottom-> setChecked ( !tabtop ); 343 m_tabstyle_bottom-> setChecked ( !tabtop );
330 344
331 m_original_tabstyle = style; 345 m_original_tabstyle = style;
332 m_original_tabpos = tabtop; 346 m_original_tabpos = tabtop;
333 347
334 vertLayout-> addSpacing ( 3 ); 348 vertLayout-> addSpacing ( 3 );
335 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); 349 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
336 350
337 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); 351 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
338 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); 352 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
339 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); 353 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
340 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); 354 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" );
341 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); 355 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 );
342 QPixmap ccw1; 356 QPixmap ccw1;
343 m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); 357 m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" );
344 QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); 358 QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( );
345 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); 359 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" );
346 360
347 rotbtngrp-> hide ( ); 361 rotbtngrp-> hide ( );
348 rotbtngrp-> setExclusive ( true ); 362 rotbtngrp-> setExclusive ( true );
349 rotbtngrp-> insert ( m_rotdir_cw ); 363 rotbtngrp-> insert ( m_rotdir_cw );
350 rotbtngrp-> insert ( m_rotdir_ccw ); 364 rotbtngrp-> insert ( m_rotdir_ccw );
351 rotbtngrp-> insert ( m_rotdir_flip ); 365 rotbtngrp-> insert ( m_rotdir_flip );
352 366
353 ccw1. convertFromImage( ccwImage ); 367 ccw1. convertFromImage( ccwImage );
354 m_rotdir_cw-> setPixmap( cw1 ); 368 m_rotdir_cw-> setPixmap( cw1 );
355 m_rotdir_ccw-> setPixmap( ccw1 ); 369 m_rotdir_ccw-> setPixmap( ccw1 );
356 m_rotdir_flip-> setPixmap( flip1 ); 370 m_rotdir_flip-> setPixmap( flip1 );
357 371
358 rotLay-> addWidget ( rotlabel, 0 ); 372 rotLay-> addWidget ( rotlabel, 0 );
359 rotLay-> addWidget ( m_rotdir_cw, 0 ); 373 rotLay-> addWidget ( m_rotdir_cw, 0 );
360 rotLay-> addWidget ( m_rotdir_ccw, 0 ); 374 rotLay-> addWidget ( m_rotdir_ccw, 0 );
361 rotLay-> addWidget ( m_rotdir_flip, 0 ); 375 rotLay-> addWidget ( m_rotdir_flip, 0 );
362 376
363 int rotDirection = cfg.readNumEntry( "rotatedir" ); 377 int rotDirection = cfg.readNumEntry( "rotatedir" );
364 ODirection rot = CW; 378 ODirection rot = CW;
365 379
366 if (rotDirection == -1) 380 if (rotDirection == -1)
367 { 381 {
368 rot = ODevice::inst ( )-> direction ( ); 382 rot = ODevice::inst ( )-> direction ( );
369 } 383 }
370 else 384 else
371 { 385 {
372 rot = (ODirection)rotDirection; 386 rot = (ODirection)rotDirection;
373 } 387 }
374 388
375 m_rotdir_cw-> setChecked ( rot == CW ); 389 m_rotdir_cw-> setChecked ( rot == CW );
376 m_rotdir_ccw-> setChecked ( rot == CCW ); 390 m_rotdir_ccw-> setChecked ( rot == CCW );
377 m_rotdir_flip-> setChecked ( rot == Flip ); 391 m_rotdir_flip-> setChecked ( rot == Flip );
378 392
379 393
380 /* 394 /*
381 * add a spacing 395 * add a spacing
382 */ 396 */
383 vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); 397 vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );
384 return tab; 398 return tab;
385} 399}
386 400
387 401
388Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 402Appearance::Appearance( QWidget* parent, const char* name, WFlags )
389 : QDialog ( parent, name, true, WStyle_ContextHelp ) 403 : QDialog ( parent, name, true, WStyle_ContextHelp )
390{ 404{
391 setCaption( tr( "Appearance Settings" ) ); 405 setCaption( tr( "Appearance Settings" ) );
392 406
393 Config config( "qpe" ); 407 Config config( "qpe" );
394 config.setGroup( "Appearance" ); 408 config.setGroup( "Appearance" );
395 409
396 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); 410 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
397 411
398 m_sample = new SampleWindow ( this ); 412 m_sample = new SampleWindow ( this );
399 413
400 m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); 414 m_sample-> setDecoration ( new DefaultWindowDecoration ( ) );
401 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); 415 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
402 416
403 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 417 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
404 QWidget *styletab; 418 QWidget *styletab;
405 419
406 m_color_list = 0; 420 m_color_list = 0;
407 421
408 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); 422 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
409 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); 423 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" ));
410 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); 424 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
411 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); 425 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
412 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); 426 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) );
413 427
414 top-> addWidget ( tw, 10 ); 428 top-> addWidget ( tw, 10 );
415 top-> addWidget ( m_sample, 1 ); 429 top-> addWidget ( m_sample, 1 );
416 430
417 tw-> setCurrentTab ( styletab ); 431 tw-> setCurrentTab ( styletab );
418 connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); 432 connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*)));
419 433
420 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; 434 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
421} 435}
422 436
423Appearance::~Appearance() 437Appearance::~Appearance()
424{} 438{}
425 439
426void Appearance::tabChanged ( QWidget *w ) 440void Appearance::tabChanged ( QWidget *w )
427{ 441{
428 if ( w == m_advtab ) 442 if ( w == m_advtab )
429 { 443 {
430 m_sample-> hide ( ); 444 m_sample-> hide ( );
431 updateGeometry ( ); // shouldn't be necessary ... 445 updateGeometry ( ); // shouldn't be necessary ...
432 } 446 }
433 else 447 else
434 m_sample-> show ( ); 448 m_sample-> show ( );
435} 449}
436 450
437void Appearance::accept ( ) 451void Appearance::accept ( )
438{ 452{
439 bool newtabpos = m_tabstyle_top-> isChecked ( ); 453 bool newtabpos = m_tabstyle_top-> isChecked ( );
440 int newtabstyle = m_tabstyle_list-> currentItem ( ); 454 int newtabstyle = m_tabstyle_list-> currentItem ( );
441 455
442 Config config ( "qpe" ); 456 Config config ( "qpe" );
443 config. setGroup ( "Appearance" ); 457 config. setGroup ( "Appearance" );
444 458
445 if ( m_style_changed ) 459 if ( m_style_changed )
446 { 460 {
447 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 461 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
448 if ( item ) 462 if ( item )
449 config.writeEntry( "Style", item-> key ( )); 463 config.writeEntry( "Style", item-> key ( ));
450 } 464 }
451 465
452 if ( m_deco_changed ) 466 if ( m_deco_changed )
453 { 467 {
454 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); 468 DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( ));
455 if ( item ) 469 if ( item )
456 config.writeEntry( "Decoration", item-> key ( )); 470 config.writeEntry( "Decoration", item-> key ( ));
457 } 471 }
458 472
459 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) 473 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos ))
460 { 474 {
461 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 475 config. writeEntry ( "TabStyle", newtabstyle + 1 );
462 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 476 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
463 } 477 }
464 478
465 if ( m_font_changed ) 479 if ( m_font_changed )
466 { 480 {
467 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 481 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
468 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 482 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
469 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 483 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
470 } 484 }
471 485
472 486
473 if ( m_color_changed ) 487 if ( m_color_changed )
474 { 488 {
475 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 489 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
476 490
477 if ( item ) 491 if ( item )
478 item-> save ( config ); 492 item-> save ( config );
479 } 493 }
480 494
481 ODirection rot; 495 ODirection rot;
482 if (m_rotdir_ccw-> isChecked ( )) 496 if (m_rotdir_ccw-> isChecked ( ))
483 { 497 {
484 rot = CCW; 498 rot = CCW;
485 } 499 }
486 else if (m_rotdir_cw-> isChecked ( )) 500 else if (m_rotdir_cw-> isChecked ( ))
487 { 501 {
488 rot = CW; 502 rot = CW;
489 } 503 }
490 else 504 else
491 { 505 {
492 rot = Flip; 506 rot = Flip;
493 } 507 }
494 config. writeEntry ( "rotatedir", (int)rot ); 508 config. writeEntry ( "rotatedir", (int)rot );
495 509
510 config. writeEntry( "LeftHand", m_leftHand->isChecked() );
511
496 config. write ( ); // need to flush the config info first 512 config. write ( ); // need to flush the config info first
497 Global::applyStyle ( ); 513 Global::applyStyle ( );
498 514
499 QDialog::accept ( ); 515 QDialog::accept ( );
500} 516}
501 517
502void Appearance::done ( int r ) 518void Appearance::done ( int r )
503{ 519{
504 QDialog::done ( r ); 520 QDialog::done ( r );
505 close ( ); 521 close ( );
506} 522}
507 523
508 524
509void Appearance::styleClicked ( int index ) 525void Appearance::styleClicked ( int index )
510{ 526{
511 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); 527 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
512 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); 528 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
513 529
514 if ( m_sample && sli && sli-> style ( )) 530 if ( m_sample && sli && sli-> style ( ))
515 { 531 {
516 int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; 532 int ci = m_color_list ? m_color_list-> currentItem ( ) : -1;
517 533
518 m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); 534 m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( ));
519 } 535 }
520 536
521 m_style_changed |= ( index != m_original_style ); 537 m_style_changed |= ( index != m_original_style );
522} 538}
523 539
524void Appearance::styleSettingsClicked ( ) 540void Appearance::styleSettingsClicked ( )
525{ 541{
526 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 542 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
527 543
528 if ( item && item-> hasSettings ( )) 544 if ( item && item-> hasSettings ( ))
529 { 545 {
530 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); 546 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
531 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); 547 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 );
532 548
533 QWidget *w = item-> settings ( d ); 549 QWidget *w = item-> settings ( d );
534 550
535 if ( w ) 551 if ( w )
536 { 552 {
537 vbox-> addWidget ( w ); 553 vbox-> addWidget ( w );
538 554
539 d-> setCaption ( w-> caption ( )); 555 d-> setCaption ( w-> caption ( ));
540 556
541 bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); 557 bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted );
542 558
543 if ( item-> setSettings ( accepted )) 559 if ( item-> setSettings ( accepted ))
544 m_style_changed = true; 560 m_style_changed = true;
545 } 561 }
546 delete d; 562 delete d;
547 } 563 }
548} 564}
549 565
550void Appearance::decoClicked ( int index ) 566void Appearance::decoClicked ( int index )
551{ 567{
552 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); 568 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index );
553 569
554 if ( m_sample ) 570 if ( m_sample )
555 { 571 {
556 if ( dli && dli-> interface ( )) 572 if ( dli && dli-> interface ( ))
557 m_sample-> setDecoration ( dli-> interface ( )); 573 m_sample-> setDecoration ( dli-> interface ( ));
558 else 574 else
559 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 575 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
560 m_sample-> repaint ( ); 576 m_sample-> repaint ( );
561 } 577 }
562 m_deco_changed |= ( index != m_original_deco ); 578 m_deco_changed |= ( index != m_original_deco );
563} 579}
564 580
565void Appearance::fontClicked ( const QFont &f ) 581void Appearance::fontClicked ( const QFont &f )
566{ 582{
567 m_font_changed |= ( f != m_sample-> font ( )); 583 m_font_changed |= ( f != m_sample-> font ( ));
568 m_sample-> setFont ( f ); 584 m_sample-> setFont ( f );
569} 585}
570 586
571void Appearance::colorClicked ( int index ) 587void Appearance::colorClicked ( int index )
572{ 588{
573 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); 589 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index );
574 590
575 if ( item ) 591 if ( item )
576 m_sample-> setPalette ( item-> palette ( )); 592 m_sample-> setPalette ( item-> palette ( ));
577 593
578 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); 594 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( ));
579} 595}
580 596
581 597
582void Appearance::editSchemeClicked ( ) 598void Appearance::editSchemeClicked ( )
583{ 599{
584 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 600 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
585 601
586 int cnt = 0; 602 int cnt = 0;
587 QString labels [QColorGroup::NColorRoles]; 603 QString labels [QColorGroup::NColorRoles];
588 QColor colors [QColorGroup::NColorRoles]; 604 QColor colors [QColorGroup::NColorRoles];
589 605
590 for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) 606 for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role )
591 { 607 {
592 QColor col = item->color( static_cast<QColorGroup::ColorRole>( role ) ); 608 QColor col = item->color( static_cast<QColorGroup::ColorRole>( role ) );
593 609
594 if ( col. isValid ( )) 610 if ( col. isValid ( ))
595 { 611 {
596 labels[cnt] = item->label( static_cast<QColorGroup::ColorRole>( role ) ); 612 labels[cnt] = item->label( static_cast<QColorGroup::ColorRole>( role ) );
597 colors[cnt] = col; 613 colors[cnt] = col;
598 614
599 cnt++; 615 cnt++;
600 } 616 }
601 } 617 }
602 618
603 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); 619 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true );
604 if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) 620 if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted )
605 { 621 {
606 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); 622 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 );
607 cnt = 0; 623 cnt = 0;
608 624
609 for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) 625 for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role )
610 { 626 {
611 if ( item->color( static_cast<QColorGroup::ColorRole>( role ) ).isValid() ) 627 if ( item->color( static_cast<QColorGroup::ColorRole>( role ) ).isValid() )
612 { 628 {
613 citem->setColor( static_cast<QColorGroup::ColorRole>( role ), colors[cnt] ); 629 citem->setColor( static_cast<QColorGroup::ColorRole>( role ), colors[cnt] );
614 cnt++; 630 cnt++;
615 } 631 }
616 } 632 }
617 633
618 m_color_list-> setCurrentItem ( 0 ); 634 m_color_list-> setCurrentItem ( 0 );
619 colorClicked ( 0 ); 635 colorClicked ( 0 );
620 636
621 m_color_changed = true; 637 m_color_changed = true;
622 } 638 }
623 delete editdlg; 639 delete editdlg;
624} 640}
625 641
626 642
627void Appearance::saveSchemeClicked() 643void Appearance::saveSchemeClicked()
628{ 644{
629 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 645 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
630 646
631 if ( !item ) 647 if ( !item )
632 return; 648 return;
633 649
634 QDialog *d = new QDialog ( this, 0, true ); 650 QDialog *d = new QDialog ( this, 0, true );
635 d-> setCaption ( tr( "Save Scheme" )); 651 d-> setCaption ( tr( "Save Scheme" ));
636 QLineEdit *ed = new QLineEdit ( d ); 652 QLineEdit *ed = new QLineEdit ( d );
637 ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); 653 ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed );
638 ed-> setFocus ( ); 654 ed-> setFocus ( );
639 655
640 if ( d-> exec ( ) == QDialog::Accepted ) 656 if ( d-> exec ( ) == QDialog::Accepted )
641 { 657 {
642 QString schemename = ed-> text ( ); 658 QString schemename = ed-> text ( );
643 QString filestr = QPEApplication::qpeDir(); 659 QString filestr = QPEApplication::qpeDir();
644 filestr.append( "/etc/colors/" ); 660 filestr.append( "/etc/colors/" );
645 filestr.append( schemename ); 661 filestr.append( schemename );
646 filestr.append( ".scheme" ); 662 filestr.append( ".scheme" );
647 QFile file ( filestr ); 663 QFile file ( filestr );
648 if ( !file. exists ( )) 664 if ( !file. exists ( ))
649 { 665 {
650 QPalette p = item-> palette ( ); 666 QPalette p = item-> palette ( );
651 667
652 Config config ( file.name(), Config::File ); 668 Config config ( file.name(), Config::File );
653 config. setGroup( "Colors" ); 669 config. setGroup( "Colors" );
654 670
655 item-> save ( config ); 671 item-> save ( config );
656 672
657 config. write ( ); // need to flush the config info first 673 config. write ( ); // need to flush the config info first
658 674
659 m_color_list-> insertItem ( new ColorListItem ( schemename, config )); 675 m_color_list-> insertItem ( new ColorListItem ( schemename, config ));
660 } 676 }
661 else 677 else
662 { 678 {
663 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); 679 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
664 } 680 }
665 } 681 }
666 delete d; 682 delete d;
667} 683}
668 684
669void Appearance::deleteSchemeClicked() 685void Appearance::deleteSchemeClicked()
670{ 686{
671 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 687 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
672 688
673 if ( !item ) 689 if ( !item )
674 return; 690 return;
675 691
676 if ( m_color_list-> currentItem ( ) > 0 ) 692 if ( m_color_list-> currentItem ( ) > 0 )
677 { 693 {
678 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) 694 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) )
679 { 695 {
680 QString filestr = QPEApplication::qpeDir ( ); 696 QString filestr = QPEApplication::qpeDir ( );
681 filestr.append( "/etc/colors/" ); 697 filestr.append( "/etc/colors/" );
682 filestr.append( item-> text ( ) ); 698 filestr.append( item-> text ( ) );
683 filestr.append( ".scheme" ); 699 filestr.append( ".scheme" );
684 QFile::remove ( filestr ); 700 QFile::remove ( filestr );
685 delete item; 701 delete item;
686 } 702 }
687 } 703 }
688 else 704 else
689 { 705 {
690 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); 706 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." ));
691 } 707 }
692} 708}
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h
index de2f1ab..287f9f7 100644
--- a/noncore/settings/appearance2/appearance.h
+++ b/noncore/settings/appearance2/appearance.h
@@ -1,124 +1,125 @@
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::Ui::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;
50namespace Opie {namespace Ui {class 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
81private: 81private:
82 void changeText(); 82 void changeText();
83 83
84 QWidget *createStyleTab ( QWidget *parent, Config &cfg ); 84 QWidget *createStyleTab ( QWidget *parent, Config &cfg );
85 QWidget *createDecoTab ( QWidget *parent, Config &cfg ); 85 QWidget *createDecoTab ( QWidget *parent, Config &cfg );
86 QWidget *createFontTab ( QWidget *parent, Config &cfg ); 86 QWidget *createFontTab ( QWidget *parent, Config &cfg );
87 QWidget *createColorTab ( QWidget *parent, Config &cfg ); 87 QWidget *createColorTab ( QWidget *parent, Config &cfg );
88 QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); 88 QWidget *createAdvancedTab ( QWidget *parent, Config &cfg );
89 89
90private: 90private:
91 bool m_style_changed; 91 bool m_style_changed;
92 bool m_font_changed; 92 bool m_font_changed;
93 bool m_scheme_changed; 93 bool m_scheme_changed;
94 bool m_deco_changed; 94 bool m_deco_changed;
95 bool m_color_changed; 95 bool m_color_changed;
96 96
97 int m_original_style; 97 int m_original_style;
98 int m_original_deco; 98 int m_original_deco;
99 int m_original_tabstyle; 99 int m_original_tabstyle;
100 bool m_original_tabpos; 100 bool m_original_tabpos;
101 101
102 QListBox * m_style_list; 102 QListBox * m_style_list;
103 QPushButton * m_style_settings; 103 QPushButton * m_style_settings;
104 104
105 QListBox * m_deco_list; 105 QListBox * m_deco_list;
106 106
107 QListBox * m_color_list; 107 QListBox * m_color_list;
108 108
109 Opie::Ui::OFontSelector *m_fontselect; 109 Opie::Ui::OFontSelector *m_fontselect;
110 110
111 SampleWindow *m_sample; 111 SampleWindow *m_sample;
112 112
113 QComboBox * m_tabstyle_list; 113 QComboBox * m_tabstyle_list;
114 QRadioButton *m_tabstyle_top; 114 QRadioButton *m_tabstyle_top;
115 QRadioButton *m_tabstyle_bottom; 115 QRadioButton *m_tabstyle_bottom;
116 116
117 QRadioButton *m_rotdir_cw; 117 QRadioButton *m_rotdir_cw;
118 QRadioButton *m_rotdir_ccw; 118 QRadioButton *m_rotdir_ccw;
119 QRadioButton *m_rotdir_flip; 119 QRadioButton *m_rotdir_flip;
120 120
121 QWidget * m_advtab; 121 QWidget * m_advtab;
122 QCheckBox *m_leftHand;
122}; 123};
123 124
124#endif 125#endif