author | eilers <eilers> | 2003-08-08 14:45:49 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-08-08 14:45:49 (UTC) |
commit | 14d394e6c107b037a09a31a92605034fe50f7813 (patch) (unidiff) | |
tree | 800699cf4dc9681c3eb023340634dd6a15fd04c8 /library/qpeapplication.cpp | |
parent | dbc6ea35f5535a1f69deb7ebbafc0f721721dbf2 (diff) | |
download | opie-14d394e6c107b037a09a31a92605034fe50f7813.zip opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.gz opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.bz2 |
Merged branches from BRANCH_1_0
-rw-r--r-- | library/qpeapplication.cpp | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 619b4cb..4e08a1f 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -177,217 +177,225 @@ public: | |||
177 | // This works but disable it for now until it is safe to apply | 177 | // This works but disable it for now until it is safe to apply |
178 | // What is does is scan the .desktop files of all the apps for | 178 | // What is does is scan the .desktop files of all the apps for |
179 | // the applnk that has the corresponding argv[0] as this program | 179 | // the applnk that has the corresponding argv[0] as this program |
180 | // then it uses the name stored in the .desktop file as the caption | 180 | // then it uses the name stored in the .desktop file as the caption |
181 | // for the main widget. This saves duplicating translations for | 181 | // for the main widget. This saves duplicating translations for |
182 | // the app name in the program and in the .desktop files. | 182 | // the app name in the program and in the .desktop files. |
183 | 183 | ||
184 | AppLnkSet apps( appsPath ); | 184 | AppLnkSet apps( appsPath ); |
185 | 185 | ||
186 | QList<AppLnk> appsList = apps.children(); | 186 | QList<AppLnk> appsList = apps.children(); |
187 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { | 187 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { |
188 | if ( (*it)->exec() == appName ) { | 188 | if ( (*it)->exec() == appName ) { |
189 | mw->setCaption( (*it)->name() ); | 189 | mw->setCaption( (*it)->name() ); |
190 | return TRUE; | 190 | return TRUE; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | */ | 193 | */ |
194 | return FALSE; | 194 | return FALSE; |
195 | } | 195 | } |
196 | 196 | ||
197 | 197 | ||
198 | void show(QWidget* mw, bool nomax) | 198 | void show(QWidget* mw, bool nomax) |
199 | { | 199 | { |
200 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); | 200 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); |
201 | nomaximize = nomax; | 201 | nomaximize = nomax; |
202 | qpe_main_widget = mw; | 202 | qpe_main_widget = mw; |
203 | #ifndef QT_NO_COP | 203 | #ifndef QT_NO_COP |
204 | 204 | ||
205 | sendQCopQ(); | 205 | sendQCopQ(); |
206 | #endif | 206 | #endif |
207 | 207 | ||
208 | if ( preloaded ) { | 208 | if ( preloaded ) { |
209 | if (forceshow) | 209 | if (forceshow) |
210 | show_mx(mw, nomax); | 210 | show_mx(mw, nomax); |
211 | } | 211 | } |
212 | else if ( keep_running ) { | 212 | else if ( keep_running ) { |
213 | show_mx(mw, nomax); | 213 | show_mx(mw, nomax); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | void loadTextCodecs() | 217 | void loadTextCodecs() |
218 | { | 218 | { |
219 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; | 219 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; |
220 | QDir dir( path, "lib*.so" ); | 220 | QDir dir( path, "lib*.so" ); |
221 | QStringList list; | 221 | QStringList list; |
222 | if ( dir. exists ( )) | 222 | if ( dir. exists ( )) |
223 | list = dir.entryList(); | 223 | list = dir.entryList(); |
224 | QStringList::Iterator it; | 224 | QStringList::Iterator it; |
225 | for ( it = list.begin(); it != list.end(); ++it ) { | 225 | for ( it = list.begin(); it != list.end(); ++it ) { |
226 | TextCodecInterface *iface = 0; | 226 | TextCodecInterface *iface = 0; |
227 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 227 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
228 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 228 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
229 | QValueList<int> mibs = iface->mibEnums(); | 229 | QValueList<int> mibs = iface->mibEnums(); |
230 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { | 230 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { |
231 | (void)iface->createForMib(*i); | 231 | (void)iface->createForMib(*i); |
232 | // ### it exists now; need to remember if we can delete it | 232 | // ### it exists now; need to remember if we can delete it |
233 | } | 233 | } |
234 | } | 234 | } |
235 | else { | 235 | else { |
236 | lib->unload(); | 236 | lib->unload(); |
237 | delete lib; | 237 | delete lib; |
238 | } | 238 | } |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | void loadImageCodecs() | 242 | void loadImageCodecs() |
243 | { | 243 | { |
244 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; | 244 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; |
245 | QDir dir( path, "lib*.so" ); | 245 | QDir dir( path, "lib*.so" ); |
246 | QStringList list; | 246 | QStringList list; |
247 | if ( dir. exists ( )) | 247 | if ( dir. exists ( )) |
248 | list = dir.entryList(); | 248 | list = dir.entryList(); |
249 | QStringList::Iterator it; | 249 | QStringList::Iterator it; |
250 | for ( it = list.begin(); it != list.end(); ++it ) { | 250 | for ( it = list.begin(); it != list.end(); ++it ) { |
251 | ImageCodecInterface *iface = 0; | 251 | ImageCodecInterface *iface = 0; |
252 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 252 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
253 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 253 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
254 | QStringList formats = iface->keys(); | 254 | QStringList formats = iface->keys(); |
255 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { | 255 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { |
256 | (void)iface->installIOHandler(*i); | 256 | (void)iface->installIOHandler(*i); |
257 | // ### it exists now; need to remember if we can delete it | 257 | // ### it exists now; need to remember if we can delete it |
258 | } | 258 | } |
259 | } | 259 | } |
260 | else { | 260 | else { |
261 | lib->unload(); | 261 | lib->unload(); |
262 | delete lib; | 262 | delete lib; |
263 | } | 263 | } |
264 | } | 264 | } |
265 | } | 265 | } |
266 | QString styleName; | 266 | QString styleName; |
267 | QString decorationName; | 267 | QString decorationName; |
268 | }; | 268 | }; |
269 | 269 | ||
270 | class ResourceMimeFactory : public QMimeSourceFactory | 270 | class ResourceMimeFactory : public QMimeSourceFactory |
271 | { | 271 | { |
272 | public: | 272 | public: |
273 | ResourceMimeFactory() | 273 | ResourceMimeFactory() : resImage( 0 ) |
274 | { | 274 | { |
275 | setFilePath( Global::helpPath() ); | 275 | setFilePath( Global::helpPath() ); |
276 | setExtensionType( "html", "text/html;charset=UTF-8" ); | 276 | setExtensionType( "html", "text/html;charset=UTF-8" ); |
277 | } | 277 | } |
278 | ~ResourceMimeFactory() { | ||
279 | delete resImage; | ||
280 | } | ||
278 | 281 | ||
279 | const QMimeSource* data( const QString& abs_name ) const | 282 | const QMimeSource* data( const QString& abs_name ) const |
280 | { | 283 | { |
281 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); | 284 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); |
282 | if ( !r ) { | 285 | if ( !r ) { |
283 | int sl = abs_name.length(); | 286 | int sl = abs_name.length(); |
284 | do { | 287 | do { |
285 | sl = abs_name.findRev( '/', sl - 1 ); | 288 | sl = abs_name.findRev( '/', sl - 1 ); |
286 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; | 289 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; |
287 | int dot = name.findRev( '.' ); | 290 | int dot = name.findRev( '.' ); |
288 | if ( dot >= 0 ) | 291 | if ( dot >= 0 ) |
289 | name = name.left( dot ); | 292 | name = name.left( dot ); |
290 | QImage img = Resource::loadImage( name ); | 293 | QImage img = Resource::loadImage( name ); |
291 | if ( !img.isNull() ) | 294 | if ( !img.isNull() ) { |
292 | r = new QImageDrag( img ); | 295 | delete resImage; |
296 | resImage = new QImageDrag( img ); | ||
297 | r = resImage; | ||
298 | } | ||
293 | } | 299 | } |
294 | while ( !r && sl > 0 ); | 300 | while ( !r && sl > 0 ); |
295 | } | 301 | } |
296 | return r; | 302 | return r; |
297 | } | 303 | } |
304 | private: | ||
305 | mutable QImageDrag *resImage; | ||
298 | }; | 306 | }; |
299 | 307 | ||
300 | static int muted = 0; | 308 | static int muted = 0; |
301 | static int micMuted = 0; | 309 | static int micMuted = 0; |
302 | 310 | ||
303 | static void setVolume( int t = 0, int percent = -1 ) | 311 | static void setVolume( int t = 0, int percent = -1 ) |
304 | { | 312 | { |
305 | switch ( t ) { | 313 | switch ( t ) { |
306 | case 0: { | 314 | case 0: { |
307 | Config cfg( "qpe" ); | 315 | Config cfg( "qpe" ); |
308 | cfg.setGroup( "Volume" ); | 316 | cfg.setGroup( "Volume" ); |
309 | if ( percent < 0 ) | 317 | if ( percent < 0 ) |
310 | percent = cfg.readNumEntry( "VolumePercent", 50 ); | 318 | percent = cfg.readNumEntry( "VolumePercent", 50 ); |
311 | int fd = 0; | 319 | int fd = 0; |
312 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 320 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
313 | int vol = muted ? 0 : percent; | 321 | int vol = muted ? 0 : percent; |
314 | // set both channels to same volume | 322 | // set both channels to same volume |
315 | vol |= vol << 8; | 323 | vol |= vol << 8; |
316 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); | 324 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); |
317 | ::close( fd ); | 325 | ::close( fd ); |
318 | } | 326 | } |
319 | } | 327 | } |
320 | break; | 328 | break; |
321 | } | 329 | } |
322 | } | 330 | } |
323 | 331 | ||
324 | static void setMic( int t = 0, int percent = -1 ) | 332 | static void setMic( int t = 0, int percent = -1 ) |
325 | { | 333 | { |
326 | switch ( t ) { | 334 | switch ( t ) { |
327 | case 0: { | 335 | case 0: { |
328 | Config cfg( "qpe" ); | 336 | Config cfg( "qpe" ); |
329 | cfg.setGroup( "Volume" ); | 337 | cfg.setGroup( "Volume" ); |
330 | if ( percent < 0 ) | 338 | if ( percent < 0 ) |
331 | percent = cfg.readNumEntry( "Mic", 50 ); | 339 | percent = cfg.readNumEntry( "Mic", 50 ); |
332 | 340 | ||
333 | int fd = 0; | 341 | int fd = 0; |
334 | int mic = micMuted ? 0 : percent; | 342 | int mic = micMuted ? 0 : percent; |
335 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 343 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
336 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); | 344 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); |
337 | ::close( fd ); | 345 | ::close( fd ); |
338 | } | 346 | } |
339 | } | 347 | } |
340 | break; | 348 | break; |
341 | } | 349 | } |
342 | } | 350 | } |
343 | 351 | ||
344 | 352 | ||
345 | static void setBass( int t = 0, int percent = -1 ) | 353 | static void setBass( int t = 0, int percent = -1 ) |
346 | { | 354 | { |
347 | switch ( t ) { | 355 | switch ( t ) { |
348 | case 0: { | 356 | case 0: { |
349 | Config cfg( "qpe" ); | 357 | Config cfg( "qpe" ); |
350 | cfg.setGroup( "Volume" ); | 358 | cfg.setGroup( "Volume" ); |
351 | if ( percent < 0 ) | 359 | if ( percent < 0 ) |
352 | percent = cfg.readNumEntry( "BassPercent", 50 ); | 360 | percent = cfg.readNumEntry( "BassPercent", 50 ); |
353 | 361 | ||
354 | int fd = 0; | 362 | int fd = 0; |
355 | int bass = percent; | 363 | int bass = percent; |
356 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 364 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
357 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | 365 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); |
358 | ::close( fd ); | 366 | ::close( fd ); |
359 | } | 367 | } |
360 | } | 368 | } |
361 | break; | 369 | break; |
362 | } | 370 | } |
363 | } | 371 | } |
364 | 372 | ||
365 | 373 | ||
366 | static void setTreble( int t = 0, int percent = -1 ) | 374 | static void setTreble( int t = 0, int percent = -1 ) |
367 | { | 375 | { |
368 | switch ( t ) { | 376 | switch ( t ) { |
369 | case 0: { | 377 | case 0: { |
370 | Config cfg( "qpe" ); | 378 | Config cfg( "qpe" ); |
371 | cfg.setGroup( "Volume" ); | 379 | cfg.setGroup( "Volume" ); |
372 | if ( percent < 0 ) | 380 | if ( percent < 0 ) |
373 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | 381 | percent = cfg.readNumEntry( "TreblePercent", 50 ); |
374 | 382 | ||
375 | int fd = 0; | 383 | int fd = 0; |
376 | int treble = percent; | 384 | int treble = percent; |
377 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 385 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
378 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | 386 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); |
379 | ::close( fd ); | 387 | ::close( fd ); |
380 | } | 388 | } |
381 | } | 389 | } |
382 | break; | 390 | break; |
383 | } | 391 | } |
384 | } | 392 | } |
385 | 393 | ||
386 | 394 | ||
387 | /*! | 395 | /*! |
388 | \class QPEApplication qpeapplication.h | 396 | \class QPEApplication qpeapplication.h |
389 | \brief The QPEApplication class implements various system services | 397 | \brief The QPEApplication class implements various system services |
390 | that are available to all Qtopia applications. | 398 | that are available to all Qtopia applications. |
391 | 399 | ||
392 | Simply by using QPEApplication instead of QApplication, a standard Qt | 400 | Simply by using QPEApplication instead of QApplication, a standard Qt |
393 | application becomes a Qtopia application. It automatically follows | 401 | application becomes a Qtopia application. It automatically follows |
@@ -890,222 +898,222 @@ QPEApplication::~QPEApplication() | |||
890 | Returns <tt>$OPIEDIR/</tt>. | 898 | Returns <tt>$OPIEDIR/</tt>. |
891 | */ | 899 | */ |
892 | QString QPEApplication::qpeDir() | 900 | QString QPEApplication::qpeDir() |
893 | { | 901 | { |
894 | const char * base = getenv( "OPIEDIR" ); | 902 | const char * base = getenv( "OPIEDIR" ); |
895 | if ( base ) | 903 | if ( base ) |
896 | return QString( base ) + "/"; | 904 | return QString( base ) + "/"; |
897 | 905 | ||
898 | return QString( "../" ); | 906 | return QString( "../" ); |
899 | } | 907 | } |
900 | 908 | ||
901 | /*! | 909 | /*! |
902 | Returns the user's current Document directory. There is a trailing "/". | 910 | Returns the user's current Document directory. There is a trailing "/". |
903 | .. well, it does now,, and there's no trailing '/' | 911 | .. well, it does now,, and there's no trailing '/' |
904 | */ | 912 | */ |
905 | QString QPEApplication::documentDir() | 913 | QString QPEApplication::documentDir() |
906 | { | 914 | { |
907 | const char* base = getenv( "HOME"); | 915 | const char* base = getenv( "HOME"); |
908 | if ( base ) | 916 | if ( base ) |
909 | return QString( base ) + "/Documents"; | 917 | return QString( base ) + "/Documents"; |
910 | 918 | ||
911 | return QString( "../Documents" ); | 919 | return QString( "../Documents" ); |
912 | } | 920 | } |
913 | 921 | ||
914 | static int deforient = -1; | 922 | static int deforient = -1; |
915 | 923 | ||
916 | /*! | 924 | /*! |
917 | \internal | 925 | \internal |
918 | */ | 926 | */ |
919 | int QPEApplication::defaultRotation() | 927 | int QPEApplication::defaultRotation() |
920 | { | 928 | { |
921 | if ( deforient < 0 ) { | 929 | if ( deforient < 0 ) { |
922 | QString d = getenv( "QWS_DISPLAY" ); | 930 | QString d = getenv( "QWS_DISPLAY" ); |
923 | if ( d.contains( "Rot90" ) ) { | 931 | if ( d.contains( "Rot90" ) ) { |
924 | deforient = 90; | 932 | deforient = 90; |
925 | } | 933 | } |
926 | else if ( d.contains( "Rot180" ) ) { | 934 | else if ( d.contains( "Rot180" ) ) { |
927 | deforient = 180; | 935 | deforient = 180; |
928 | } | 936 | } |
929 | else if ( d.contains( "Rot270" ) ) { | 937 | else if ( d.contains( "Rot270" ) ) { |
930 | deforient = 270; | 938 | deforient = 270; |
931 | } | 939 | } |
932 | else { | 940 | else { |
933 | deforient = 0; | 941 | deforient = 0; |
934 | } | 942 | } |
935 | } | 943 | } |
936 | return deforient; | 944 | return deforient; |
937 | } | 945 | } |
938 | 946 | ||
939 | /*! | 947 | /*! |
940 | \internal | 948 | \internal |
941 | */ | 949 | */ |
942 | void QPEApplication::setDefaultRotation( int r ) | 950 | void QPEApplication::setDefaultRotation( int r ) |
943 | { | 951 | { |
944 | if ( qApp->type() == GuiServer ) { | 952 | if ( qApp->type() == GuiServer ) { |
945 | deforient = r; | 953 | deforient = r; |
946 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 954 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
947 | Config config("qpe"); | 955 | Config config("qpe"); |
948 | config.setGroup( "Rotation" ); | 956 | config.setGroup( "Rotation" ); |
949 | config.writeEntry( "Rot", r ); | 957 | config.writeEntry( "Rot", r ); |
950 | } | 958 | } |
951 | else { | 959 | else { |
952 | #ifndef QT_NO_COP | 960 | #ifndef QT_NO_COP |
953 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 961 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
954 | e << r; | 962 | e << r; |
955 | } | 963 | } |
956 | #endif | 964 | #endif |
957 | 965 | ||
958 | } | 966 | } |
959 | } | 967 | } |
960 | 968 | ||
961 | 969 | ||
962 | /*! | 970 | /*! |
963 | \internal | 971 | \internal |
964 | */ | 972 | */ |
965 | void QPEApplication::applyStyle() | 973 | void QPEApplication::applyStyle() |
966 | { | 974 | { |
967 | Config config( "qpe" ); | 975 | Config config( "qpe" ); |
968 | config.setGroup( "Appearance" ); | 976 | config.setGroup( "Appearance" ); |
969 | 977 | ||
970 | #if QT_VERSION > 233 | 978 | #if QT_VERSION > 233 |
971 | // don't block ourselves ... | 979 | // don't block ourselves ... |
972 | Opie::force_appearance = 0; | 980 | Opie::force_appearance = 0; |
973 | 981 | ||
974 | static QString appname = Opie::binaryName ( ); | 982 | static QString appname = Opie::binaryName ( ); |
975 | 983 | ||
976 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 984 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
977 | int nostyle = 0; | 985 | int nostyle = 0; |
978 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 986 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
979 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 987 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
980 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 988 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
981 | break; | 989 | break; |
982 | } | 990 | } |
983 | } | 991 | } |
984 | 992 | ||
985 | // Widget style | 993 | // Widget style |
986 | QString style = config.readEntry( "Style", "Light" ); | 994 | QString style = config.readEntry( "Style", "FlatStyle" ); |
987 | 995 | ||
988 | // don't set a custom style | 996 | // don't set a custom style |
989 | if ( nostyle & Opie::Force_Style ) | 997 | if ( nostyle & Opie::Force_Style ) |
990 | style = "Light"; | 998 | style = "FlatStyle"; |
991 | 999 | ||
992 | internalSetStyle ( style ); | 1000 | internalSetStyle ( style ); |
993 | 1001 | ||
994 | // Colors | 1002 | // Colors - from /etc/colors/Liquid.scheme |
995 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); | 1003 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); |
996 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); | 1004 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); |
997 | QPalette pal( btncolor, bgcolor ); | 1005 | QPalette pal( btncolor, bgcolor ); |
998 | QString color = config.readEntry( "Highlight", "#800000" ); | 1006 | QString color = config.readEntry( "Highlight", "#73adef" ); |
999 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1007 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1000 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1008 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1001 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1009 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1002 | color = config.readEntry( "Text", "#000000" ); | 1010 | color = config.readEntry( "Text", "#000000" ); |
1003 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1011 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1004 | color = config.readEntry( "ButtonText", "#000000" ); | 1012 | color = config.readEntry( "ButtonText", "#000000" ); |
1005 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1013 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1006 | color = config.readEntry( "Base", "#FFFFFF" ); | 1014 | color = config.readEntry( "Base", "#FFFFFF" ); |
1007 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1015 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1008 | 1016 | ||
1009 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1017 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1010 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1018 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1011 | 1019 | ||
1012 | setPalette( pal, TRUE ); | 1020 | setPalette( pal, TRUE ); |
1013 | 1021 | ||
1014 | // Window Decoration | 1022 | // Window Decoration |
1015 | QString dec = config.readEntry( "Decoration", "Qtopia" ); | 1023 | QString dec = config.readEntry( "Decoration", "Flat" ); |
1016 | 1024 | ||
1017 | // don't set a custom deco | 1025 | // don't set a custom deco |
1018 | if ( nostyle & Opie::Force_Decoration ) | 1026 | if ( nostyle & Opie::Force_Decoration ) |
1019 | dec = ""; | 1027 | dec = ""; |
1020 | 1028 | ||
1021 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1029 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1022 | 1030 | ||
1023 | if ( dec != d->decorationName ) { | 1031 | if ( dec != d->decorationName ) { |
1024 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1032 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1025 | d->decorationName = dec; | 1033 | d->decorationName = dec; |
1026 | } | 1034 | } |
1027 | 1035 | ||
1028 | // Font | 1036 | // Font |
1029 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1037 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1030 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1038 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1031 | 1039 | ||
1032 | // don't set a custom font | 1040 | // don't set a custom font |
1033 | if ( nostyle & Opie::Force_Font ) { | 1041 | if ( nostyle & Opie::Force_Font ) { |
1034 | ff = "Vera"; | 1042 | ff = "Vera"; |
1035 | fs = 10; | 1043 | fs = 10; |
1036 | } | 1044 | } |
1037 | 1045 | ||
1038 | setFont ( QFont ( ff, fs ), true ); | 1046 | setFont ( QFont ( ff, fs ), true ); |
1039 | 1047 | ||
1040 | // revert to global blocking policy ... | 1048 | // revert to global blocking policy ... |
1041 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1049 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1042 | Opie::force_appearance &= ~nostyle; | 1050 | Opie::force_appearance &= ~nostyle; |
1043 | #endif | 1051 | #endif |
1044 | } | 1052 | } |
1045 | 1053 | ||
1046 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1054 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1047 | { | 1055 | { |
1048 | #ifdef Q_WS_QWS | 1056 | #ifdef Q_WS_QWS |
1049 | QDataStream stream( data, IO_ReadOnly ); | 1057 | QDataStream stream( data, IO_ReadOnly ); |
1050 | if ( msg == "applyStyle()" ) { | 1058 | if ( msg == "applyStyle()" ) { |
1051 | applyStyle(); | 1059 | applyStyle(); |
1052 | } | 1060 | } |
1053 | else if ( msg == "toggleApplicationMenu()" ) { | 1061 | else if ( msg == "toggleApplicationMenu()" ) { |
1054 | QWidget *active = activeWindow ( ); | 1062 | QWidget *active = activeWindow ( ); |
1055 | 1063 | ||
1056 | if ( active ) { | 1064 | if ( active ) { |
1057 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1065 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1058 | bool oldactive = man-> isActive ( ); | 1066 | bool oldactive = man-> isActive ( ); |
1059 | 1067 | ||
1060 | man-> setActive( !man-> isActive() ); | 1068 | man-> setActive( !man-> isActive() ); |
1061 | 1069 | ||
1062 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1070 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1063 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1071 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1064 | } | 1072 | } |
1065 | } | 1073 | } |
1066 | } | 1074 | } |
1067 | else if ( msg == "setDefaultRotation(int)" ) { | 1075 | else if ( msg == "setDefaultRotation(int)" ) { |
1068 | if ( type() == GuiServer ) { | 1076 | if ( type() == GuiServer ) { |
1069 | int r; | 1077 | int r; |
1070 | stream >> r; | 1078 | stream >> r; |
1071 | setDefaultRotation( r ); | 1079 | setDefaultRotation( r ); |
1072 | } | 1080 | } |
1073 | } | 1081 | } |
1074 | else if ( msg == "setCurrentRotation(int)" ) { | 1082 | else if ( msg == "setCurrentRotation(int)" ) { |
1075 | int r; | 1083 | int r; |
1076 | stream >> r; | 1084 | stream >> r; |
1077 | setCurrentRotation( r ); | 1085 | setCurrentRotation( r ); |
1078 | } | 1086 | } |
1079 | else if ( msg == "shutdown()" ) { | 1087 | else if ( msg == "shutdown()" ) { |
1080 | if ( type() == GuiServer ) | 1088 | if ( type() == GuiServer ) |
1081 | shutdown(); | 1089 | shutdown(); |
1082 | } | 1090 | } |
1083 | else if ( msg == "quit()" ) { | 1091 | else if ( msg == "quit()" ) { |
1084 | if ( type() != GuiServer ) | 1092 | if ( type() != GuiServer ) |
1085 | tryQuit(); | 1093 | tryQuit(); |
1086 | } | 1094 | } |
1087 | else if ( msg == "forceQuit()" ) { | 1095 | else if ( msg == "forceQuit()" ) { |
1088 | if ( type() != GuiServer ) | 1096 | if ( type() != GuiServer ) |
1089 | quit(); | 1097 | quit(); |
1090 | } | 1098 | } |
1091 | else if ( msg == "restart()" ) { | 1099 | else if ( msg == "restart()" ) { |
1092 | if ( type() == GuiServer ) | 1100 | if ( type() == GuiServer ) |
1093 | restart(); | 1101 | restart(); |
1094 | } | 1102 | } |
1095 | else if ( msg == "language(QString)" ) { | 1103 | else if ( msg == "language(QString)" ) { |
1096 | if ( type() == GuiServer ) { | 1104 | if ( type() == GuiServer ) { |
1097 | QString l; | 1105 | QString l; |
1098 | stream >> l; | 1106 | stream >> l; |
1099 | QString cl = getenv( "LANG" ); | 1107 | QString cl = getenv( "LANG" ); |
1100 | if ( cl != l ) { | 1108 | if ( cl != l ) { |
1101 | if ( l.isNull() ) | 1109 | if ( l.isNull() ) |
1102 | unsetenv( "LANG" ); | 1110 | unsetenv( "LANG" ); |
1103 | else | 1111 | else |
1104 | setenv( "LANG", l.latin1(), 1 ); | 1112 | setenv( "LANG", l.latin1(), 1 ); |
1105 | restart(); | 1113 | restart(); |
1106 | } | 1114 | } |
1107 | } | 1115 | } |
1108 | } | 1116 | } |
1109 | else if ( msg == "timeChange(QString)" ) { | 1117 | else if ( msg == "timeChange(QString)" ) { |
1110 | QString t; | 1118 | QString t; |
1111 | stream >> t; | 1119 | stream >> t; |
@@ -1205,204 +1213,210 @@ void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data | |||
1205 | 1213 | ||
1206 | 1214 | ||
1207 | #endif | 1215 | #endif |
1208 | } | 1216 | } |
1209 | 1217 | ||
1210 | /*! | 1218 | /*! |
1211 | \internal | 1219 | \internal |
1212 | */ | 1220 | */ |
1213 | bool QPEApplication::raiseAppropriateWindow() | 1221 | bool QPEApplication::raiseAppropriateWindow() |
1214 | { | 1222 | { |
1215 | bool r = FALSE; | 1223 | bool r = FALSE; |
1216 | // ########## raise()ing main window should raise and set active | 1224 | // ########## raise()ing main window should raise and set active |
1217 | // ########## it and then all childen. This belongs in Qt/Embedded | 1225 | // ########## it and then all childen. This belongs in Qt/Embedded |
1218 | QWidget *top = d->qpe_main_widget; | 1226 | QWidget *top = d->qpe_main_widget; |
1219 | if ( !top ) | 1227 | if ( !top ) |
1220 | top = mainWidget(); | 1228 | top = mainWidget(); |
1221 | if ( top && d->keep_running ) { | 1229 | if ( top && d->keep_running ) { |
1222 | if ( top->isVisible() ) | 1230 | if ( top->isVisible() ) |
1223 | r = TRUE; | 1231 | r = TRUE; |
1224 | else if (d->preloaded) { | 1232 | else if (d->preloaded) { |
1225 | // We are preloaded and not visible.. pretend we just started.. | 1233 | // We are preloaded and not visible.. pretend we just started.. |
1226 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1234 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1227 | e << d->appName; | 1235 | e << d->appName; |
1228 | } | 1236 | } |
1229 | 1237 | ||
1230 | d->show_mx(top, d->nomaximize); | 1238 | d->show_mx(top, d->nomaximize); |
1231 | top->raise(); | 1239 | top->raise(); |
1232 | top->setActiveWindow(); | 1240 | top->setActiveWindow(); |
1233 | } | 1241 | } |
1234 | QWidget *topm = activeModalWidget(); | 1242 | QWidget *topm = activeModalWidget(); |
1235 | if ( topm && topm != top ) { | 1243 | if ( topm && topm != top ) { |
1236 | topm->show(); | 1244 | topm->show(); |
1237 | topm->raise(); | 1245 | topm->raise(); |
1238 | topm->setActiveWindow(); | 1246 | topm->setActiveWindow(); |
1239 | // If we haven't already handled the fastAppShowing message | 1247 | // If we haven't already handled the fastAppShowing message |
1240 | if (!top && d->preloaded) { | 1248 | if (!top && d->preloaded) { |
1241 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1249 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1242 | e << d->appName; | 1250 | e << d->appName; |
1243 | } | 1251 | } |
1244 | r = FALSE; | 1252 | r = FALSE; |
1245 | } | 1253 | } |
1246 | return r; | 1254 | return r; |
1247 | } | 1255 | } |
1248 | 1256 | ||
1249 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | 1257 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) |
1250 | { | 1258 | { |
1251 | #ifdef Q_WS_QWS | 1259 | #ifdef Q_WS_QWS |
1252 | 1260 | ||
1253 | if ( msg == "quit()" ) { | 1261 | if ( msg == "quit()" ) { |
1254 | tryQuit(); | 1262 | tryQuit(); |
1255 | } | 1263 | } |
1256 | else if ( msg == "quitIfInvisible()" ) { | 1264 | else if ( msg == "quitIfInvisible()" ) { |
1257 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) | 1265 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) |
1258 | quit(); | 1266 | quit(); |
1259 | } | 1267 | } |
1260 | else if ( msg == "close()" ) { | 1268 | else if ( msg == "close()" ) { |
1261 | hideOrQuit(); | 1269 | hideOrQuit(); |
1262 | } | 1270 | } |
1263 | else if ( msg == "disablePreload()" ) { | 1271 | else if ( msg == "disablePreload()" ) { |
1264 | d->preloaded = FALSE; | 1272 | d->preloaded = FALSE; |
1265 | d->keep_running = TRUE; | 1273 | d->keep_running = TRUE; |
1266 | /* so that quit will quit */ | 1274 | /* so that quit will quit */ |
1267 | } | 1275 | } |
1268 | else if ( msg == "enablePreload()" ) { | 1276 | else if ( msg == "enablePreload()" ) { |
1269 | if (d->qpe_main_widget) | 1277 | if (d->qpe_main_widget) |
1270 | d->preloaded = TRUE; | 1278 | d->preloaded = TRUE; |
1271 | d->keep_running = TRUE; | 1279 | d->keep_running = TRUE; |
1272 | /* so next quit won't quit */ | 1280 | /* so next quit won't quit */ |
1273 | } | 1281 | } |
1274 | else if ( msg == "raise()" ) { | 1282 | else if ( msg == "raise()" ) { |
1275 | d->keep_running = TRUE; | 1283 | d->keep_running = TRUE; |
1276 | d->notbusysent = FALSE; | 1284 | d->notbusysent = FALSE; |
1277 | raiseAppropriateWindow(); | 1285 | raiseAppropriateWindow(); |
1278 | // Tell the system we're still chugging along... | 1286 | // Tell the system we're still chugging along... |
1279 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1287 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1280 | e << d->appName; | 1288 | e << d->appName; |
1281 | } | 1289 | } |
1282 | else if ( msg == "flush()" ) { | 1290 | else if ( msg == "flush()" ) { |
1283 | emit flush(); | 1291 | emit flush(); |
1284 | // we need to tell the desktop | 1292 | // we need to tell the desktop |
1285 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); | 1293 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); |
1286 | e << d->appName; | 1294 | e << d->appName; |
1287 | } | 1295 | } |
1288 | else if ( msg == "reload()" ) { | 1296 | else if ( msg == "reload()" ) { |
1289 | emit reload(); | 1297 | emit reload(); |
1290 | } | 1298 | } |
1291 | else if ( msg == "setDocument(QString)" ) { | 1299 | else if ( msg == "setDocument(QString)" ) { |
1292 | d->keep_running = TRUE; | 1300 | d->keep_running = TRUE; |
1293 | QDataStream stream( data, IO_ReadOnly ); | 1301 | QDataStream stream( data, IO_ReadOnly ); |
1294 | QString doc; | 1302 | QString doc; |
1295 | stream >> doc; | 1303 | stream >> doc; |
1296 | QWidget *mw = mainWidget(); | 1304 | QWidget *mw = mainWidget(); |
1297 | if ( !mw ) | 1305 | if ( !mw ) |
1298 | mw = d->qpe_main_widget; | 1306 | mw = d->qpe_main_widget; |
1299 | if ( mw ) | 1307 | if ( mw ) |
1300 | Global::setDocument( mw, doc ); | 1308 | Global::setDocument( mw, doc ); |
1309 | } else { | ||
1310 | bool p = d->keep_running; | ||
1311 | d->keep_running = FALSE; | ||
1312 | emit appMessage( msg, data); | ||
1313 | if ( d->keep_running ) { | ||
1314 | d->notbusysent = FALSE; | ||
1315 | raiseAppropriateWindow(); | ||
1316 | if ( !p ) { | ||
1317 | // Tell the system we're still chugging along... | ||
1318 | #ifndef QT_NO_COP | ||
1319 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | ||
1320 | e << d->appName; | ||
1321 | #endif | ||
1322 | } | ||
1323 | } | ||
1324 | if ( p ) | ||
1325 | d->keep_running = p; | ||
1301 | } | 1326 | } |
1302 | else if ( msg == "nextView()" ) { | ||
1303 | qDebug("got nextView()"); | ||
1304 | /* | ||
1305 | if ( raiseAppropriateWindow() ) | ||
1306 | */ | ||
1307 | emit appMessage( msg, data); | ||
1308 | } | ||
1309 | else { | ||
1310 | emit appMessage( msg, data); | ||
1311 | } | ||
1312 | |||
1313 | #endif | 1327 | #endif |
1314 | } | 1328 | } |
1315 | 1329 | ||
1316 | 1330 | ||
1317 | /*! | 1331 | /*! |
1318 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1332 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1319 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1333 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1320 | 1334 | ||
1321 | \sa showMainDocumentWidget() | 1335 | \sa showMainDocumentWidget() |
1322 | */ | 1336 | */ |
1323 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | 1337 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) |
1324 | { | 1338 | { |
1325 | d->show(mw, nomaximize ); | 1339 | d->show(mw, nomaximize ); |
1326 | } | 1340 | } |
1327 | 1341 | ||
1328 | /*! | 1342 | /*! |
1329 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1343 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1330 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1344 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1331 | 1345 | ||
1332 | This calls designates the application as | 1346 | This calls designates the application as |
1333 | a \link docwidget.html document-oriented\endlink application. | 1347 | a \link docwidget.html document-oriented\endlink application. |
1334 | 1348 | ||
1335 | The \a mw widget \e must have this slot: setDocument(const QString&). | 1349 | The \a mw widget \e must have this slot: setDocument(const QString&). |
1336 | 1350 | ||
1337 | \sa showMainWidget() | 1351 | \sa showMainWidget() |
1338 | */ | 1352 | */ |
1339 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | 1353 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) |
1340 | { | 1354 | { |
1341 | if ( mw && argc() == 2 ) | 1355 | if ( mw && argc() == 2 ) |
1342 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); | 1356 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); |
1343 | 1357 | ||
1344 | 1358 | ||
1345 | d->show(mw, nomaximize ); | 1359 | d->show(mw, nomaximize ); |
1346 | } | 1360 | } |
1347 | 1361 | ||
1348 | 1362 | ||
1349 | /*! | 1363 | /*! |
1350 | If an application is started via a \link qcop.html QCop\endlink | 1364 | If an application is started via a \link qcop.html QCop\endlink |
1351 | message, the application will process the \link qcop.html | 1365 | message, the application will process the \link qcop.html |
1352 | QCop\endlink message and then quit. If the application calls this | 1366 | QCop\endlink message and then quit. If the application calls this |
1353 | function while processing a \link qcop.html QCop\endlink message, | 1367 | function while processing a \link qcop.html QCop\endlink message, |
1354 | after processing its outstanding \link qcop.html QCop\endlink | 1368 | after processing its outstanding \link qcop.html QCop\endlink |
1355 | messages the application will start 'properly' and show itself. | 1369 | messages the application will start 'properly' and show itself. |
1356 | 1370 | ||
1357 | \sa keepRunning() | 1371 | \sa keepRunning() |
1358 | */ | 1372 | */ |
1359 | void QPEApplication::setKeepRunning() | 1373 | void QPEApplication::setKeepRunning() |
1360 | { | 1374 | { |
1361 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 1375 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
1362 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 1376 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
1363 | qpeApp->d->keep_running = TRUE; | 1377 | qpeApp->d->keep_running = TRUE; |
1364 | } | 1378 | } |
1365 | } | 1379 | } |
1366 | 1380 | ||
1367 | /*! | 1381 | /*! |
1368 | Returns TRUE if the application will quit after processing the | 1382 | Returns TRUE if the application will quit after processing the |
1369 | current list of qcop messages; otherwise returns FALSE. | 1383 | current list of qcop messages; otherwise returns FALSE. |
1370 | 1384 | ||
1371 | \sa setKeepRunning() | 1385 | \sa setKeepRunning() |
1372 | */ | 1386 | */ |
1373 | bool QPEApplication::keepRunning() const | 1387 | bool QPEApplication::keepRunning() const |
1374 | { | 1388 | { |
1375 | return d->keep_running; | 1389 | return d->keep_running; |
1376 | } | 1390 | } |
1377 | 1391 | ||
1378 | /*! | 1392 | /*! |
1379 | \internal | 1393 | \internal |
1380 | */ | 1394 | */ |
1381 | void QPEApplication::internalSetStyle( const QString &style ) | 1395 | void QPEApplication::internalSetStyle( const QString &style ) |
1382 | { | 1396 | { |
1383 | #if QT_VERSION >= 300 | 1397 | #if QT_VERSION >= 300 |
1384 | if ( style == "QPE" ) { | 1398 | if ( style == "QPE" ) { |
1385 | setStyle( new QPEStyle ); | 1399 | setStyle( new QPEStyle ); |
1386 | } | 1400 | } |
1387 | else { | 1401 | else { |
1388 | QStyle *s = QStyleFactory::create( style ); | 1402 | QStyle *s = QStyleFactory::create( style ); |
1389 | if ( s ) | 1403 | if ( s ) |
1390 | setStyle( s ); | 1404 | setStyle( s ); |
1391 | } | 1405 | } |
1392 | #else | 1406 | #else |
1393 | if ( style == "Windows" ) { | 1407 | if ( style == "Windows" ) { |
1394 | setStyle( new QWindowsStyle ); | 1408 | setStyle( new QWindowsStyle ); |
1395 | } | 1409 | } |
1396 | else if ( style == "QPE" ) { | 1410 | else if ( style == "QPE" ) { |
1397 | setStyle( new QPEStyle ); | 1411 | setStyle( new QPEStyle ); |
1398 | } | 1412 | } |
1399 | else if ( style == "Light" ) { | 1413 | else if ( style == "Light" ) { |
1400 | setStyle( new LightStyle ); | 1414 | setStyle( new LightStyle ); |
1401 | } | 1415 | } |
1402 | #ifndef QT_NO_STYLE_PLATINUM | 1416 | #ifndef QT_NO_STYLE_PLATINUM |
1403 | else if ( style == "Platinum" ) { | 1417 | else if ( style == "Platinum" ) { |
1404 | setStyle( new QPlatinumStyle ); | 1418 | setStyle( new QPlatinumStyle ); |
1405 | } | 1419 | } |
1406 | #endif | 1420 | #endif |
1407 | #ifndef QT_NO_STYLE_MOTIF | 1421 | #ifndef QT_NO_STYLE_MOTIF |
1408 | else if ( style == "Motif" ) { | 1422 | else if ( style == "Motif" ) { |