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