-rw-r--r-- | library/qpeapplication.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index f4db1ab..19adb00 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -196,1608 +196,1610 @@ public: | |||
196 | nomaximize = nomax; | 196 | nomaximize = nomax; |
197 | qpe_main_widget = mw; | 197 | qpe_main_widget = mw; |
198 | #ifndef QT_NO_COP | 198 | #ifndef QT_NO_COP |
199 | 199 | ||
200 | sendQCopQ(); | 200 | sendQCopQ(); |
201 | #endif | 201 | #endif |
202 | 202 | ||
203 | if ( preloaded ) { | 203 | if ( preloaded ) { |
204 | if (forceshow) | 204 | if (forceshow) |
205 | show_mx(mw, nomax); | 205 | show_mx(mw, nomax); |
206 | } | 206 | } |
207 | else if ( keep_running ) { | 207 | else if ( keep_running ) { |
208 | show_mx(mw, nomax); | 208 | show_mx(mw, nomax); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | void loadTextCodecs() | 212 | void loadTextCodecs() |
213 | { | 213 | { |
214 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; | 214 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; |
215 | QDir dir( path, "lib*.so" ); | 215 | QDir dir( path, "lib*.so" ); |
216 | QStringList list; | 216 | QStringList list; |
217 | if ( dir. exists ( )) | 217 | if ( dir. exists ( )) |
218 | list = dir.entryList(); | 218 | list = dir.entryList(); |
219 | QStringList::Iterator it; | 219 | QStringList::Iterator it; |
220 | for ( it = list.begin(); it != list.end(); ++it ) { | 220 | for ( it = list.begin(); it != list.end(); ++it ) { |
221 | TextCodecInterface *iface = 0; | 221 | TextCodecInterface *iface = 0; |
222 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 222 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
223 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 223 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
224 | QValueList<int> mibs = iface->mibEnums(); | 224 | QValueList<int> mibs = iface->mibEnums(); |
225 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { | 225 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { |
226 | (void)iface->createForMib(*i); | 226 | (void)iface->createForMib(*i); |
227 | // ### it exists now; need to remember if we can delete it | 227 | // ### it exists now; need to remember if we can delete it |
228 | } | 228 | } |
229 | } | 229 | } |
230 | else { | 230 | else { |
231 | lib->unload(); | 231 | lib->unload(); |
232 | delete lib; | 232 | delete lib; |
233 | } | 233 | } |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | void loadImageCodecs() | 237 | void loadImageCodecs() |
238 | { | 238 | { |
239 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; | 239 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; |
240 | QDir dir( path, "lib*.so" ); | 240 | QDir dir( path, "lib*.so" ); |
241 | QStringList list; | 241 | QStringList list; |
242 | if ( dir. exists ( )) | 242 | if ( dir. exists ( )) |
243 | list = dir.entryList(); | 243 | list = dir.entryList(); |
244 | QStringList::Iterator it; | 244 | QStringList::Iterator it; |
245 | for ( it = list.begin(); it != list.end(); ++it ) { | 245 | for ( it = list.begin(); it != list.end(); ++it ) { |
246 | ImageCodecInterface *iface = 0; | 246 | ImageCodecInterface *iface = 0; |
247 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 247 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
248 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 248 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
249 | QStringList formats = iface->keys(); | 249 | QStringList formats = iface->keys(); |
250 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { | 250 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { |
251 | (void)iface->installIOHandler(*i); | 251 | (void)iface->installIOHandler(*i); |
252 | // ### it exists now; need to remember if we can delete it | 252 | // ### it exists now; need to remember if we can delete it |
253 | } | 253 | } |
254 | } | 254 | } |
255 | else { | 255 | else { |
256 | lib->unload(); | 256 | lib->unload(); |
257 | delete lib; | 257 | delete lib; |
258 | } | 258 | } |
259 | } | 259 | } |
260 | } | 260 | } |
261 | QString styleName; | 261 | QString styleName; |
262 | QString decorationName; | 262 | QString decorationName; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | class ResourceMimeFactory : public QMimeSourceFactory | 265 | class ResourceMimeFactory : public QMimeSourceFactory |
266 | { | 266 | { |
267 | public: | 267 | public: |
268 | ResourceMimeFactory() | 268 | ResourceMimeFactory() |
269 | { | 269 | { |
270 | setFilePath( Global::helpPath() ); | 270 | setFilePath( Global::helpPath() ); |
271 | setExtensionType( "html", "text/html;charset=UTF-8" ); | 271 | setExtensionType( "html", "text/html;charset=UTF-8" ); |
272 | } | 272 | } |
273 | 273 | ||
274 | const QMimeSource* data( const QString& abs_name ) const | 274 | const QMimeSource* data( const QString& abs_name ) const |
275 | { | 275 | { |
276 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); | 276 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); |
277 | if ( !r ) { | 277 | if ( !r ) { |
278 | int sl = abs_name.length(); | 278 | int sl = abs_name.length(); |
279 | do { | 279 | do { |
280 | sl = abs_name.findRev( '/', sl - 1 ); | 280 | sl = abs_name.findRev( '/', sl - 1 ); |
281 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; | 281 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; |
282 | int dot = name.findRev( '.' ); | 282 | int dot = name.findRev( '.' ); |
283 | if ( dot >= 0 ) | 283 | if ( dot >= 0 ) |
284 | name = name.left( dot ); | 284 | name = name.left( dot ); |
285 | QImage img = Resource::loadImage( name ); | 285 | QImage img = Resource::loadImage( name ); |
286 | if ( !img.isNull() ) | 286 | if ( !img.isNull() ) |
287 | r = new QImageDrag( img ); | 287 | r = new QImageDrag( img ); |
288 | } | 288 | } |
289 | while ( !r && sl > 0 ); | 289 | while ( !r && sl > 0 ); |
290 | } | 290 | } |
291 | return r; | 291 | return r; |
292 | } | 292 | } |
293 | }; | 293 | }; |
294 | 294 | ||
295 | static int muted = 0; | 295 | static int muted = 0; |
296 | static int micMuted = 0; | 296 | static int micMuted = 0; |
297 | 297 | ||
298 | static void setVolume( int t = 0, int percent = -1 ) | 298 | static void setVolume( int t = 0, int percent = -1 ) |
299 | { | 299 | { |
300 | switch ( t ) { | 300 | switch ( t ) { |
301 | case 0: { | 301 | case 0: { |
302 | Config cfg( "qpe" ); | 302 | Config cfg( "qpe" ); |
303 | cfg.setGroup( "Volume" ); | 303 | cfg.setGroup( "Volume" ); |
304 | if ( percent < 0 ) | 304 | if ( percent < 0 ) |
305 | percent = cfg.readNumEntry( "VolumePercent", 50 ); | 305 | percent = cfg.readNumEntry( "VolumePercent", 50 ); |
306 | int fd = 0; | 306 | int fd = 0; |
307 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 307 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
308 | int vol = muted ? 0 : percent; | 308 | int vol = muted ? 0 : percent; |
309 | // set both channels to same volume | 309 | // set both channels to same volume |
310 | vol |= vol << 8; | 310 | vol |= vol << 8; |
311 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); | 311 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); |
312 | ::close( fd ); | 312 | ::close( fd ); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | break; | 315 | break; |
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
319 | static void setMic( int t = 0, int percent = -1 ) | 319 | static void setMic( int t = 0, int percent = -1 ) |
320 | { | 320 | { |
321 | switch ( t ) { | 321 | switch ( t ) { |
322 | case 0: { | 322 | case 0: { |
323 | Config cfg( "qpe" ); | 323 | Config cfg( "qpe" ); |
324 | cfg.setGroup( "Volume" ); | 324 | cfg.setGroup( "Volume" ); |
325 | if ( percent < 0 ) | 325 | if ( percent < 0 ) |
326 | percent = cfg.readNumEntry( "Mic", 50 ); | 326 | percent = cfg.readNumEntry( "Mic", 50 ); |
327 | 327 | ||
328 | int fd = 0; | 328 | int fd = 0; |
329 | int mic = micMuted ? 0 : percent; | 329 | int mic = micMuted ? 0 : percent; |
330 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 330 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
331 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); | 331 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); |
332 | ::close( fd ); | 332 | ::close( fd ); |
333 | } | 333 | } |
334 | } | 334 | } |
335 | break; | 335 | break; |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | 339 | ||
340 | static void setBass( int t = 0, int percent = -1 ) | 340 | static void setBass( int t = 0, int percent = -1 ) |
341 | { | 341 | { |
342 | switch ( t ) { | 342 | switch ( t ) { |
343 | case 0: { | 343 | case 0: { |
344 | Config cfg( "qpe" ); | 344 | Config cfg( "qpe" ); |
345 | cfg.setGroup( "Volume" ); | 345 | cfg.setGroup( "Volume" ); |
346 | if ( percent < 0 ) | 346 | if ( percent < 0 ) |
347 | percent = cfg.readNumEntry( "BassPercent", 50 ); | 347 | percent = cfg.readNumEntry( "BassPercent", 50 ); |
348 | 348 | ||
349 | int fd = 0; | 349 | int fd = 0; |
350 | int bass = percent; | 350 | int bass = percent; |
351 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 351 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
352 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | 352 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); |
353 | ::close( fd ); | 353 | ::close( fd ); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | break; | 356 | break; |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | 360 | ||
361 | static void setTreble( int t = 0, int percent = -1 ) | 361 | static void setTreble( int t = 0, int percent = -1 ) |
362 | { | 362 | { |
363 | switch ( t ) { | 363 | switch ( t ) { |
364 | case 0: { | 364 | case 0: { |
365 | Config cfg( "qpe" ); | 365 | Config cfg( "qpe" ); |
366 | cfg.setGroup( "Volume" ); | 366 | cfg.setGroup( "Volume" ); |
367 | if ( percent < 0 ) | 367 | if ( percent < 0 ) |
368 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | 368 | percent = cfg.readNumEntry( "TreblePercent", 50 ); |
369 | 369 | ||
370 | int fd = 0; | 370 | int fd = 0; |
371 | int treble = percent; | 371 | int treble = percent; |
372 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 372 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
373 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | 373 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); |
374 | ::close( fd ); | 374 | ::close( fd ); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | break; | 377 | break; |
378 | } | 378 | } |
379 | } | 379 | } |
380 | 380 | ||
381 | 381 | ||
382 | /*! | 382 | /*! |
383 | \class QPEApplication qpeapplication.h | 383 | \class QPEApplication qpeapplication.h |
384 | \brief The QPEApplication class implements various system services | 384 | \brief The QPEApplication class implements various system services |
385 | that are available to all Qtopia applications. | 385 | that are available to all Qtopia applications. |
386 | 386 | ||
387 | Simply by using QPEApplication instead of QApplication, a standard Qt | 387 | Simply by using QPEApplication instead of QApplication, a standard Qt |
388 | application becomes a Qtopia application. It automatically follows | 388 | application becomes a Qtopia application. It automatically follows |
389 | style changes, quits and raises, and in the | 389 | style changes, quits and raises, and in the |
390 | case of \link docwidget.html document-oriented\endlink applications, | 390 | case of \link docwidget.html document-oriented\endlink applications, |
391 | changes the currently displayed document in response to the environment. | 391 | changes the currently displayed document in response to the environment. |
392 | 392 | ||
393 | To create a \link docwidget.html document-oriented\endlink | 393 | To create a \link docwidget.html document-oriented\endlink |
394 | application use showMainDocumentWidget(); to create a | 394 | application use showMainDocumentWidget(); to create a |
395 | non-document-oriented application use showMainWidget(). The | 395 | non-document-oriented application use showMainWidget(). The |
396 | keepRunning() function indicates whether the application will | 396 | keepRunning() function indicates whether the application will |
397 | continue running after it's processed the last \link qcop.html | 397 | continue running after it's processed the last \link qcop.html |
398 | QCop\endlink message. This can be changed using setKeepRunning(). | 398 | QCop\endlink message. This can be changed using setKeepRunning(). |
399 | 399 | ||
400 | A variety of signals are emitted when certain events occur, for | 400 | A variety of signals are emitted when certain events occur, for |
401 | example, timeChanged(), clockChanged(), weekChanged(), | 401 | example, timeChanged(), clockChanged(), weekChanged(), |
402 | dateFormatChanged() and volumeChanged(). If the application receives | 402 | dateFormatChanged() and volumeChanged(). If the application receives |
403 | a \link qcop.html QCop\endlink message on the application's | 403 | a \link qcop.html QCop\endlink message on the application's |
404 | QPE/Application/\e{appname} channel, the appMessage() signal is | 404 | QPE/Application/\e{appname} channel, the appMessage() signal is |
405 | emitted. There are also flush() and reload() signals, which | 405 | emitted. There are also flush() and reload() signals, which |
406 | are emitted when synching begins and ends respectively - upon these | 406 | are emitted when synching begins and ends respectively - upon these |
407 | signals, the application should save and reload any data | 407 | signals, the application should save and reload any data |
408 | files that are involved in synching. Most of these signals will initially | 408 | files that are involved in synching. Most of these signals will initially |
409 | be received and unfiltered through the appMessage() signal. | 409 | be received and unfiltered through the appMessage() signal. |
410 | 410 | ||
411 | This class also provides a set of useful static functions. The | 411 | This class also provides a set of useful static functions. The |
412 | qpeDir() and documentDir() functions return the respective paths. | 412 | qpeDir() and documentDir() functions return the respective paths. |
413 | The grabKeyboard() and ungrabKeyboard() functions are used to | 413 | The grabKeyboard() and ungrabKeyboard() functions are used to |
414 | control whether the application takes control of the device's | 414 | control whether the application takes control of the device's |
415 | physical buttons (e.g. application launch keys). The stylus' mode of | 415 | physical buttons (e.g. application launch keys). The stylus' mode of |
416 | operation is set with setStylusOperation() and retrieved with | 416 | operation is set with setStylusOperation() and retrieved with |
417 | stylusOperation(). There are also setInputMethodHint() and | 417 | stylusOperation(). There are also setInputMethodHint() and |
418 | inputMethodHint() functions. | 418 | inputMethodHint() functions. |
419 | 419 | ||
420 | \ingroup qtopiaemb | 420 | \ingroup qtopiaemb |
421 | */ | 421 | */ |
422 | 422 | ||
423 | /*! | 423 | /*! |
424 | \fn void QPEApplication::clientMoused() | 424 | \fn void QPEApplication::clientMoused() |
425 | 425 | ||
426 | \internal | 426 | \internal |
427 | */ | 427 | */ |
428 | 428 | ||
429 | /*! | 429 | /*! |
430 | \fn void QPEApplication::timeChanged(); | 430 | \fn void QPEApplication::timeChanged(); |
431 | This signal is emitted when the time changes outside the normal | 431 | This signal is emitted when the time changes outside the normal |
432 | passage of time, i.e. if the time is set backwards or forwards. | 432 | passage of time, i.e. if the time is set backwards or forwards. |
433 | */ | 433 | */ |
434 | 434 | ||
435 | /*! | 435 | /*! |
436 | \fn void QPEApplication::clockChanged( bool ampm ); | 436 | \fn void QPEApplication::clockChanged( bool ampm ); |
437 | 437 | ||
438 | This signal is emitted when the user changes the clock's style. If | 438 | This signal is emitted when the user changes the clock's style. If |
439 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 439 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
440 | they want a 24-hour clock. | 440 | they want a 24-hour clock. |
441 | */ | 441 | */ |
442 | 442 | ||
443 | /*! | 443 | /*! |
444 | \fn void QPEApplication::volumeChanged( bool muted ) | 444 | \fn void QPEApplication::volumeChanged( bool muted ) |
445 | 445 | ||
446 | This signal is emitted whenever the mute state is changed. If \a | 446 | This signal is emitted whenever the mute state is changed. If \a |
447 | muted is TRUE, then sound output has been muted. | 447 | muted is TRUE, then sound output has been muted. |
448 | */ | 448 | */ |
449 | 449 | ||
450 | /*! | 450 | /*! |
451 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 451 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
452 | 452 | ||
453 | This signal is emitted if the week start day is changed. If \a | 453 | This signal is emitted if the week start day is changed. If \a |
454 | startOnMonday is TRUE then the first day of the week is Monday; if | 454 | startOnMonday is TRUE then the first day of the week is Monday; if |
455 | \a startOnMonday is FALSE then the first day of the week is | 455 | \a startOnMonday is FALSE then the first day of the week is |
456 | Sunday. | 456 | Sunday. |
457 | */ | 457 | */ |
458 | 458 | ||
459 | /*! | 459 | /*! |
460 | \fn void QPEApplication::dateFormatChanged(DateFormat) | 460 | \fn void QPEApplication::dateFormatChanged(DateFormat) |
461 | 461 | ||
462 | This signal is emitted whenever the date format is changed. | 462 | This signal is emitted whenever the date format is changed. |
463 | */ | 463 | */ |
464 | 464 | ||
465 | /*! | 465 | /*! |
466 | \fn void QPEApplication::flush() | 466 | \fn void QPEApplication::flush() |
467 | 467 | ||
468 | ### | 468 | ### |
469 | */ | 469 | */ |
470 | 470 | ||
471 | /*! | 471 | /*! |
472 | \fn void QPEApplication::reload() | 472 | \fn void QPEApplication::reload() |
473 | 473 | ||
474 | */ | 474 | */ |
475 | 475 | ||
476 | /*! | 476 | /*! |
477 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 477 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
478 | 478 | ||
479 | This signal is emitted when a message is received on this | 479 | This signal is emitted when a message is received on this |
480 | application's QPE/Application/<i>appname</i> \link qcop.html | 480 | application's QPE/Application/<i>appname</i> \link qcop.html |
481 | QCop\endlink channel. | 481 | QCop\endlink channel. |
482 | 482 | ||
483 | The slot to which you connect this signal uses \a msg and \a data | 483 | The slot to which you connect this signal uses \a msg and \a data |
484 | in the following way: | 484 | in the following way: |
485 | 485 | ||
486 | \code | 486 | \code |
487 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 487 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
488 | { | 488 | { |
489 | QDataStream stream( data, IO_ReadOnly ); | 489 | QDataStream stream( data, IO_ReadOnly ); |
490 | if ( msg == "someMessage(int,int,int)" ) { | 490 | if ( msg == "someMessage(int,int,int)" ) { |
491 | int a,b,c; | 491 | int a,b,c; |
492 | stream >> a >> b >> c; | 492 | stream >> a >> b >> c; |
493 | ... | 493 | ... |
494 | } else if ( msg == "otherMessage(QString)" ) { | 494 | } else if ( msg == "otherMessage(QString)" ) { |
495 | ... | 495 | ... |
496 | } | 496 | } |
497 | } | 497 | } |
498 | \endcode | 498 | \endcode |
499 | 499 | ||
500 | \sa qcop.html | 500 | \sa qcop.html |
501 | Note that messages received here may be processed by qpe application | 501 | Note that messages received here may be processed by qpe application |
502 | and emitted as signals, such as flush() and reload(). | 502 | and emitted as signals, such as flush() and reload(). |
503 | */ | 503 | */ |
504 | 504 | ||
505 | /*! | 505 | /*! |
506 | Constructs a QPEApplication just as you would construct | 506 | Constructs a QPEApplication just as you would construct |
507 | a QApplication, passing \a argc, \a argv, and \a t. | 507 | a QApplication, passing \a argc, \a argv, and \a t. |
508 | 508 | ||
509 | For applications, \a t should be the default, GuiClient. Only | 509 | For applications, \a t should be the default, GuiClient. Only |
510 | the Qtopia server passes GuiServer. | 510 | the Qtopia server passes GuiServer. |
511 | */ | 511 | */ |
512 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 512 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
513 | : QApplication( argc, argv, t ) | 513 | : QApplication( argc, argv, t ) |
514 | { | 514 | { |
515 | d = new QPEApplicationData; | 515 | d = new QPEApplicationData; |
516 | d->loadTextCodecs(); | 516 | d->loadTextCodecs(); |
517 | d->loadImageCodecs(); | 517 | d->loadImageCodecs(); |
518 | int dw = desktop() ->width(); | 518 | int dw = desktop() ->width(); |
519 | 519 | ||
520 | if ( dw < 200 ) { | 520 | if ( dw < 200 ) { |
521 | setFont( QFont( "vera", 8 ) ); | 521 | setFont( QFont( "vera", 8 ) ); |
522 | AppLnk::setSmallIconSize( 10 ); | 522 | AppLnk::setSmallIconSize( 10 ); |
523 | AppLnk::setBigIconSize( 28 ); | 523 | AppLnk::setBigIconSize( 28 ); |
524 | } | 524 | } |
525 | else if ( dw > 600 ) { | 525 | else if ( dw > 600 ) { |
526 | setFont( QFont( "vera", 16 ) ); | 526 | setFont( QFont( "vera", 16 ) ); |
527 | AppLnk::setSmallIconSize( 24 ); | 527 | AppLnk::setSmallIconSize( 24 ); |
528 | AppLnk::setBigIconSize( 48 ); | 528 | AppLnk::setBigIconSize( 48 ); |
529 | } | 529 | } |
530 | else if ( dw > 200 ) { | 530 | else if ( dw > 200 ) { |
531 | setFont( QFont( "vera", 10 ) ); | 531 | setFont( QFont( "vera", 10 ) ); |
532 | AppLnk::setSmallIconSize( 14 ); | 532 | AppLnk::setSmallIconSize( 14 ); |
533 | AppLnk::setBigIconSize( 32 ); | 533 | AppLnk::setBigIconSize( 32 ); |
534 | } | 534 | } |
535 | 535 | ||
536 | 536 | ||
537 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 537 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
538 | 538 | ||
539 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 539 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
540 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 540 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
541 | 541 | ||
542 | QString qcopfn( "/tmp/qcop-msg-" ); | 542 | QString qcopfn( "/tmp/qcop-msg-" ); |
543 | qcopfn += QString( argv[ 0 ] ); // append command name | 543 | qcopfn += QString( argv[ 0 ] ); // append command name |
544 | 544 | ||
545 | QFile f( qcopfn ); | 545 | QFile f( qcopfn ); |
546 | if ( f.open( IO_ReadOnly ) ) { | 546 | if ( f.open( IO_ReadOnly ) ) { |
547 | flock( f.handle(), LOCK_EX ); | 547 | flock( f.handle(), LOCK_EX ); |
548 | } | 548 | } |
549 | 549 | ||
550 | sysChannel = new QCopChannel( "QPE/System", this ); | 550 | sysChannel = new QCopChannel( "QPE/System", this ); |
551 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 551 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
552 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 552 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); |
553 | 553 | ||
554 | QCString channel = QCString( argv[ 0 ] ); | 554 | QCString channel = QCString( argv[ 0 ] ); |
555 | channel.replace( QRegExp( ".*/" ), "" ); | 555 | channel.replace( QRegExp( ".*/" ), "" ); |
556 | d->appName = channel; | 556 | d->appName = channel; |
557 | channel = "QPE/Application/" + channel; | 557 | channel = "QPE/Application/" + channel; |
558 | pidChannel = new QCopChannel( channel, this ); | 558 | pidChannel = new QCopChannel( channel, this ); |
559 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 559 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
560 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 560 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); |
561 | 561 | ||
562 | if ( f.isOpen() ) { | 562 | if ( f.isOpen() ) { |
563 | d->keep_running = FALSE; | 563 | d->keep_running = FALSE; |
564 | QDataStream ds( &f ); | 564 | QDataStream ds( &f ); |
565 | QCString channel, message; | 565 | QCString channel, message; |
566 | QByteArray data; | 566 | QByteArray data; |
567 | while ( !ds.atEnd() ) { | 567 | while ( !ds.atEnd() ) { |
568 | ds >> channel >> message >> data; | 568 | ds >> channel >> message >> data; |
569 | d->enqueueQCop( channel, message, data ); | 569 | d->enqueueQCop( channel, message, data ); |
570 | } | 570 | } |
571 | 571 | ||
572 | flock( f.handle(), LOCK_UN ); | 572 | flock( f.handle(), LOCK_UN ); |
573 | f.close(); | 573 | f.close(); |
574 | f.remove(); | 574 | f.remove(); |
575 | } | 575 | } |
576 | 576 | ||
577 | for ( int a = 0; a < argc; a++ ) { | 577 | for ( int a = 0; a < argc; a++ ) { |
578 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 578 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
579 | argv[ a ] = argv[ a + 1 ]; | 579 | argv[ a ] = argv[ a + 1 ]; |
580 | a++; | 580 | a++; |
581 | d->preloaded = TRUE; | 581 | d->preloaded = TRUE; |
582 | argc -= 1; | 582 | argc -= 1; |
583 | } | 583 | } |
584 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { | 584 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { |
585 | argv[ a ] = argv[ a + 1 ]; | 585 | argv[ a ] = argv[ a + 1 ]; |
586 | a++; | 586 | a++; |
587 | d->preloaded = TRUE; | 587 | d->preloaded = TRUE; |
588 | d->forceshow = TRUE; | 588 | d->forceshow = TRUE; |
589 | argc -= 1; | 589 | argc -= 1; |
590 | } | 590 | } |
591 | } | 591 | } |
592 | 592 | ||
593 | /* overide stored arguments */ | 593 | /* overide stored arguments */ |
594 | setArgs( argc, argv ); | 594 | setArgs( argc, argv ); |
595 | 595 | ||
596 | #endif | 596 | #endif |
597 | 597 | ||
598 | // qwsSetDecoration( new QPEDecoration() ); | 598 | // qwsSetDecoration( new QPEDecoration() ); |
599 | 599 | ||
600 | #ifndef QT_NO_TRANSLATION | 600 | #ifndef QT_NO_TRANSLATION |
601 | 601 | ||
602 | QStringList langs = Global::languageList(); | 602 | QStringList langs = Global::languageList(); |
603 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { | 603 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { |
604 | QString lang = *it; | 604 | QString lang = *it; |
605 | 605 | ||
606 | installTranslation( lang + "/libopie.qm"); | 606 | installTranslation( lang + "/libopie.qm"); |
607 | installTranslation( lang + "/libqpe.qm" ); | 607 | installTranslation( lang + "/libqpe.qm" ); |
608 | installTranslation( lang + "/" + d->appName + ".qm" ); | 608 | installTranslation( lang + "/" + d->appName + ".qm" ); |
609 | 609 | ||
610 | 610 | ||
611 | //###language/font hack; should look it up somewhere | 611 | //###language/font hack; should look it up somewhere |
612 | #ifdef QWS | 612 | #ifdef QWS |
613 | 613 | ||
614 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 614 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
615 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 615 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
616 | setFont( fn ); | 616 | setFont( fn ); |
617 | } | 617 | } |
618 | #endif | 618 | #endif |
619 | 619 | ||
620 | } | 620 | } |
621 | #endif | 621 | #endif |
622 | 622 | ||
623 | applyStyle(); | 623 | applyStyle(); |
624 | 624 | ||
625 | if ( type() == GuiServer ) { | 625 | if ( type() == GuiServer ) { |
626 | setVolume(); | 626 | setVolume(); |
627 | } | 627 | } |
628 | 628 | ||
629 | installEventFilter( this ); | 629 | installEventFilter( this ); |
630 | 630 | ||
631 | QPEMenuToolFocusManager::initialize(); | 631 | QPEMenuToolFocusManager::initialize(); |
632 | 632 | ||
633 | #ifdef QT_NO_QWS_CURSOR | 633 | #ifdef QT_NO_QWS_CURSOR |
634 | // if we have no cursor, probably don't want tooltips | 634 | // if we have no cursor, probably don't want tooltips |
635 | QToolTip::setEnabled( FALSE ); | 635 | QToolTip::setEnabled( FALSE ); |
636 | #endif | 636 | #endif |
637 | } | 637 | } |
638 | 638 | ||
639 | static QPtrDict<void>* inputMethodDict = 0; | 639 | static QPtrDict<void>* inputMethodDict = 0; |
640 | static void createInputMethodDict() | 640 | static void createInputMethodDict() |
641 | { | 641 | { |
642 | if ( !inputMethodDict ) | 642 | if ( !inputMethodDict ) |
643 | inputMethodDict = new QPtrDict<void>; | 643 | inputMethodDict = new QPtrDict<void>; |
644 | } | 644 | } |
645 | 645 | ||
646 | /*! | 646 | /*! |
647 | Returns the currently set hint to the system as to whether | 647 | Returns the currently set hint to the system as to whether |
648 | widget \a w has any use for text input methods. | 648 | widget \a w has any use for text input methods. |
649 | 649 | ||
650 | 650 | ||
651 | \sa setInputMethodHint() InputMethodHint | 651 | \sa setInputMethodHint() InputMethodHint |
652 | */ | 652 | */ |
653 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | 653 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) |
654 | { | 654 | { |
655 | if ( inputMethodDict && w ) | 655 | if ( inputMethodDict && w ) |
656 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); | 656 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); |
657 | return Normal; | 657 | return Normal; |
658 | } | 658 | } |
659 | 659 | ||
660 | /*! | 660 | /*! |
661 | \enum QPEApplication::InputMethodHint | 661 | \enum QPEApplication::InputMethodHint |
662 | 662 | ||
663 | \value Normal the application sometimes needs text input (the default). | 663 | \value Normal the application sometimes needs text input (the default). |
664 | \value AlwaysOff the application never needs text input. | 664 | \value AlwaysOff the application never needs text input. |
665 | \value AlwaysOn the application always needs text input. | 665 | \value AlwaysOn the application always needs text input. |
666 | */ | 666 | */ |
667 | 667 | ||
668 | /*! | 668 | /*! |
669 | Hints to the system that widget \a w has use for text input methods | 669 | Hints to the system that widget \a w has use for text input methods |
670 | as specified by \a mode. | 670 | as specified by \a mode. |
671 | 671 | ||
672 | \sa inputMethodHint() InputMethodHint | 672 | \sa inputMethodHint() InputMethodHint |
673 | */ | 673 | */ |
674 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) | 674 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) |
675 | { | 675 | { |
676 | createInputMethodDict(); | 676 | createInputMethodDict(); |
677 | if ( mode == Normal ) { | 677 | if ( mode == Normal ) { |
678 | inputMethodDict->remove | 678 | inputMethodDict->remove |
679 | ( w ); | 679 | ( w ); |
680 | } | 680 | } |
681 | else { | 681 | else { |
682 | inputMethodDict->insert( w, ( void* ) mode ); | 682 | inputMethodDict->insert( w, ( void* ) mode ); |
683 | } | 683 | } |
684 | } | 684 | } |
685 | 685 | ||
686 | class HackDialog : public QDialog | 686 | class HackDialog : public QDialog |
687 | { | 687 | { |
688 | public: | 688 | public: |
689 | void acceptIt() | 689 | void acceptIt() |
690 | { | 690 | { |
691 | accept(); | 691 | accept(); |
692 | } | 692 | } |
693 | void rejectIt() | 693 | void rejectIt() |
694 | { | 694 | { |
695 | reject(); | 695 | reject(); |
696 | } | 696 | } |
697 | }; | 697 | }; |
698 | 698 | ||
699 | 699 | ||
700 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) | 700 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) |
701 | { | 701 | { |
702 | // specialised actions for certain widgets. May want to | 702 | // specialised actions for certain widgets. May want to |
703 | // add more stuff here. | 703 | // add more stuff here. |
704 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) | 704 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) |
705 | && activePopupWidget() ->parentWidget() | 705 | && activePopupWidget() ->parentWidget() |
706 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) | 706 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) |
707 | key = Qt::Key_Return; | 707 | key = Qt::Key_Return; |
708 | 708 | ||
709 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) | 709 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) |
710 | key = Qt::Key_Return; | 710 | key = Qt::Key_Return; |
711 | 711 | ||
712 | #ifdef QWS | 712 | #ifdef QWS |
713 | 713 | ||
714 | ke->simpleData.keycode = key; | 714 | ke->simpleData.keycode = key; |
715 | #endif | 715 | #endif |
716 | } | 716 | } |
717 | 717 | ||
718 | class HackWidget : public QWidget | 718 | class HackWidget : public QWidget |
719 | { | 719 | { |
720 | public: | 720 | public: |
721 | bool needsOk() | 721 | bool needsOk() |
722 | { | 722 | { |
723 | return ( getWState() & WState_Reserved1 ); | 723 | return ( getWState() & WState_Reserved1 ); |
724 | } | 724 | } |
725 | }; | 725 | }; |
726 | 726 | ||
727 | /*! | 727 | /*! |
728 | \internal | 728 | \internal |
729 | */ | 729 | */ |
730 | 730 | ||
731 | #ifdef QWS | 731 | #ifdef QWS |
732 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) | 732 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) |
733 | { | 733 | { |
734 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { | 734 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { |
735 | if ( qApp->type() != QApplication::GuiServer ) { | 735 | if ( qApp->type() != QApplication::GuiServer ) { |
736 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); | 736 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); |
737 | e << d->appName; | 737 | e << d->appName; |
738 | } | 738 | } |
739 | d->notbusysent = TRUE; | 739 | d->notbusysent = TRUE; |
740 | } | 740 | } |
741 | if ( type() == GuiServer ) { | 741 | if ( type() == GuiServer ) { |
742 | switch ( e->type ) { | 742 | switch ( e->type ) { |
743 | case QWSEvent::Mouse: | 743 | case QWSEvent::Mouse: |
744 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) | 744 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) |
745 | emit clientMoused(); | 745 | emit clientMoused(); |
746 | break; | 746 | break; |
747 | default: | 747 | default: |
748 | break; | 748 | break; |
749 | } | 749 | } |
750 | } | 750 | } |
751 | if ( e->type == QWSEvent::Key ) { | 751 | if ( e->type == QWSEvent::Key ) { |
752 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; | 752 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; |
753 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { | 753 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { |
754 | // Use special "OK" key to press "OK" on top level widgets | 754 | // Use special "OK" key to press "OK" on top level widgets |
755 | QWidget * active = activeWindow(); | 755 | QWidget * active = activeWindow(); |
756 | QWidget *popup = 0; | 756 | QWidget *popup = 0; |
757 | if ( active && active->isPopup() ) { | 757 | if ( active && active->isPopup() ) { |
758 | popup = active; | 758 | popup = active; |
759 | active = active->parentWidget(); | 759 | active = active->parentWidget(); |
760 | } | 760 | } |
761 | if ( active && ( int ) active->winId() == ke->simpleData.window && | 761 | if ( active && ( int ) active->winId() == ke->simpleData.window && |
762 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 762 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
763 | if ( ke->simpleData.is_press ) { | 763 | if ( ke->simpleData.is_press ) { |
764 | if ( popup ) | 764 | if ( popup ) |
765 | popup->close(); | 765 | popup->close(); |
766 | if ( active->inherits( "QDialog" ) ) { | 766 | if ( active->inherits( "QDialog" ) ) { |
767 | HackDialog * d = ( HackDialog * ) active; | 767 | HackDialog * d = ( HackDialog * ) active; |
768 | d->acceptIt(); | 768 | d->acceptIt(); |
769 | return TRUE; | 769 | return TRUE; |
770 | } | 770 | } |
771 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { | 771 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { |
772 | QSignal s; | 772 | QSignal s; |
773 | s.connect( active, SLOT( accept() ) ); | 773 | s.connect( active, SLOT( accept() ) ); |
774 | s.activate(); | 774 | s.activate(); |
775 | } | 775 | } |
776 | else { | 776 | else { |
777 | // do the same as with the select key: Map to the default action of the widget: | 777 | // do the same as with the select key: Map to the default action of the widget: |
778 | mapToDefaultAction( ke, Qt::Key_Return ); | 778 | mapToDefaultAction( ke, Qt::Key_Return ); |
779 | } | 779 | } |
780 | } | 780 | } |
781 | } | 781 | } |
782 | } | 782 | } |
783 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 783 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
784 | // Use special "select" key to do whatever default action a widget has | 784 | // Use special "select" key to do whatever default action a widget has |
785 | mapToDefaultAction( ke, Qt::Key_Space ); | 785 | mapToDefaultAction( ke, Qt::Key_Space ); |
786 | } | 786 | } |
787 | else if ( ke->simpleData.keycode == Qt::Key_Escape && | 787 | else if ( ke->simpleData.keycode == Qt::Key_Escape && |
788 | ke->simpleData.is_press ) { | 788 | ke->simpleData.is_press ) { |
789 | // Escape key closes app if focus on toplevel | 789 | // Escape key closes app if focus on toplevel |
790 | QWidget * active = activeWindow(); | 790 | QWidget * active = activeWindow(); |
791 | if ( active && active->testWFlags( WType_TopLevel ) && | 791 | if ( active && active->testWFlags( WType_TopLevel ) && |
792 | ( int ) active->winId() == ke->simpleData.window && | 792 | ( int ) active->winId() == ke->simpleData.window && |
793 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 793 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
794 | if ( active->inherits( "QDialog" ) ) { | 794 | if ( active->inherits( "QDialog" ) ) { |
795 | HackDialog * d = ( HackDialog * ) active; | 795 | HackDialog * d = ( HackDialog * ) active; |
796 | d->rejectIt(); | 796 | d->rejectIt(); |
797 | return TRUE; | 797 | return TRUE; |
798 | } | 798 | } |
799 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { | 799 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { |
800 | active->close(); | 800 | active->close(); |
801 | } | 801 | } |
802 | } | 802 | } |
803 | } | 803 | } |
804 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { | 804 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { |
805 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) | 805 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) |
806 | // but we cannot access libopie function within libqpe :( | 806 | // but we cannot access libopie function within libqpe :( |
807 | 807 | ||
808 | QWidget * active = activeWindow ( ); | 808 | QWidget * active = activeWindow ( ); |
809 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 809 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
810 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 810 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
811 | QChar ch ( ke-> simpleData.unicode ); | 811 | QChar ch ( ke-> simpleData.unicode ); |
812 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 812 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
813 | ke-> simpleData.keycode, | 813 | ke-> simpleData.keycode, |
814 | ch. latin1 ( ), | 814 | ch. latin1 ( ), |
815 | ke-> simpleData.modifiers, | 815 | ke-> simpleData.modifiers, |
816 | QString ( ch ), | 816 | QString ( ch ), |
817 | ke-> simpleData.is_auto_repeat, 1 ); | 817 | ke-> simpleData.is_auto_repeat, 1 ); |
818 | 818 | ||
819 | QObject *which = QWidget::keyboardGrabber ( ); | 819 | QObject *which = QWidget::keyboardGrabber ( ); |
820 | if ( !which ) | 820 | if ( !which ) |
821 | which = QApplication::focusWidget ( ); | 821 | which = QApplication::focusWidget ( ); |
822 | if ( !which ) | 822 | if ( !which ) |
823 | which = QApplication::activeWindow ( ); | 823 | which = QApplication::activeWindow ( ); |
824 | if ( !which ) | 824 | if ( !which ) |
825 | which = qApp; | 825 | which = qApp; |
826 | 826 | ||
827 | QApplication::sendEvent ( which, &qke ); | 827 | QApplication::sendEvent ( which, &qke ); |
828 | } | 828 | } |
829 | else { // we didn't grab the keyboard, so send the event to the launcher | 829 | else { // we didn't grab the keyboard, so send the event to the launcher |
830 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 830 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); |
831 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); | 831 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); |
832 | } | 832 | } |
833 | } | 833 | } |
834 | return true; | 834 | return true; |
835 | } | 835 | } |
836 | } | 836 | } |
837 | if ( e->type == QWSEvent::Focus ) { | 837 | if ( e->type == QWSEvent::Focus ) { |
838 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 838 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
839 | if ( !fe->simpleData.get_focus ) { | 839 | if ( !fe->simpleData.get_focus ) { |
840 | QWidget * active = activeWindow(); | 840 | QWidget * active = activeWindow(); |
841 | while ( active && active->isPopup() ) { | 841 | while ( active && active->isPopup() ) { |
842 | active->close(); | 842 | active->close(); |
843 | active = activeWindow(); | 843 | active = activeWindow(); |
844 | } | 844 | } |
845 | } | 845 | } |
846 | else { | 846 | else { |
847 | // make sure our modal widget is ALWAYS on top | 847 | // make sure our modal widget is ALWAYS on top |
848 | QWidget *topm = activeModalWidget(); | 848 | QWidget *topm = activeModalWidget(); |
849 | if ( topm ) { | 849 | if ( topm ) { |
850 | topm->raise(); | 850 | topm->raise(); |
851 | } | 851 | } |
852 | } | 852 | } |
853 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 853 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
854 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 854 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
855 | if ( m == AlwaysOff ) | 855 | if ( m == AlwaysOff ) |
856 | Global::hideInputMethod(); | 856 | Global::hideInputMethod(); |
857 | if ( m == AlwaysOn ) | 857 | if ( m == AlwaysOn ) |
858 | Global::showInputMethod(); | 858 | Global::showInputMethod(); |
859 | } | 859 | } |
860 | } | 860 | } |
861 | 861 | ||
862 | 862 | ||
863 | return QApplication::qwsEventFilter( e ); | 863 | return QApplication::qwsEventFilter( e ); |
864 | } | 864 | } |
865 | #endif | 865 | #endif |
866 | 866 | ||
867 | /*! | 867 | /*! |
868 | Destroys the QPEApplication. | 868 | Destroys the QPEApplication. |
869 | */ | 869 | */ |
870 | QPEApplication::~QPEApplication() | 870 | QPEApplication::~QPEApplication() |
871 | { | 871 | { |
872 | ungrabKeyboard(); | 872 | ungrabKeyboard(); |
873 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 873 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
874 | // Need to delete QCopChannels early, since the display will | 874 | // Need to delete QCopChannels early, since the display will |
875 | // be gone by the time we get to ~QObject(). | 875 | // be gone by the time we get to ~QObject(). |
876 | delete sysChannel; | 876 | delete sysChannel; |
877 | delete pidChannel; | 877 | delete pidChannel; |
878 | #endif | 878 | #endif |
879 | 879 | ||
880 | delete d; | 880 | delete d; |
881 | } | 881 | } |
882 | 882 | ||
883 | /*! | 883 | /*! |
884 | Returns <tt>$OPIEDIR/</tt>. | 884 | Returns <tt>$OPIEDIR/</tt>. |
885 | */ | 885 | */ |
886 | QString QPEApplication::qpeDir() | 886 | QString QPEApplication::qpeDir() |
887 | { | 887 | { |
888 | const char * base = getenv( "OPIEDIR" ); | 888 | const char * base = getenv( "OPIEDIR" ); |
889 | if ( base ) | 889 | if ( base ) |
890 | return QString( base ) + "/"; | 890 | return QString( base ) + "/"; |
891 | 891 | ||
892 | return QString( "../" ); | 892 | return QString( "../" ); |
893 | } | 893 | } |
894 | 894 | ||
895 | /*! | 895 | /*! |
896 | Returns the user's current Document directory. There is a trailing "/". | 896 | Returns the user's current Document directory. There is a trailing "/". |
897 | .. well, it does now,, and there's no trailing '/' | 897 | .. well, it does now,, and there's no trailing '/' |
898 | */ | 898 | */ |
899 | QString QPEApplication::documentDir() | 899 | QString QPEApplication::documentDir() |
900 | { | 900 | { |
901 | const char* base = getenv( "HOME"); | 901 | const char* base = getenv( "HOME"); |
902 | if ( base ) | 902 | if ( base ) |
903 | return QString( base ) + "/Documents"; | 903 | return QString( base ) + "/Documents"; |
904 | 904 | ||
905 | return QString( "../Documents" ); | 905 | return QString( "../Documents" ); |
906 | } | 906 | } |
907 | 907 | ||
908 | static int deforient = -1; | 908 | static int deforient = -1; |
909 | 909 | ||
910 | /*! | 910 | /*! |
911 | \internal | 911 | \internal |
912 | */ | 912 | */ |
913 | int QPEApplication::defaultRotation() | 913 | int QPEApplication::defaultRotation() |
914 | { | 914 | { |
915 | if ( deforient < 0 ) { | 915 | if ( deforient < 0 ) { |
916 | QString d = getenv( "QWS_DISPLAY" ); | 916 | QString d = getenv( "QWS_DISPLAY" ); |
917 | if ( d.contains( "Rot90" ) ) { | 917 | if ( d.contains( "Rot90" ) ) { |
918 | deforient = 90; | 918 | deforient = 90; |
919 | } | 919 | } |
920 | else if ( d.contains( "Rot180" ) ) { | 920 | else if ( d.contains( "Rot180" ) ) { |
921 | deforient = 180; | 921 | deforient = 180; |
922 | } | 922 | } |
923 | else if ( d.contains( "Rot270" ) ) { | 923 | else if ( d.contains( "Rot270" ) ) { |
924 | deforient = 270; | 924 | deforient = 270; |
925 | } | 925 | } |
926 | else { | 926 | else { |
927 | deforient = 0; | 927 | deforient = 0; |
928 | } | 928 | } |
929 | } | 929 | } |
930 | return deforient; | 930 | return deforient; |
931 | } | 931 | } |
932 | 932 | ||
933 | /*! | 933 | /*! |
934 | \internal | 934 | \internal |
935 | */ | 935 | */ |
936 | void QPEApplication::setDefaultRotation( int r ) | 936 | void QPEApplication::setDefaultRotation( int r ) |
937 | { | 937 | { |
938 | if ( qApp->type() == GuiServer ) { | 938 | if ( qApp->type() == GuiServer ) { |
939 | deforient = r; | 939 | deforient = r; |
940 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 940 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
941 | Config config("qpe"); | 941 | Config config("qpe"); |
942 | config.setGroup( "Rotation" ); | 942 | config.setGroup( "Rotation" ); |
943 | config.writeEntry( "Rot", r ); | 943 | config.writeEntry( "Rot", r ); |
944 | } | 944 | } |
945 | else { | 945 | else { |
946 | #ifndef QT_NO_COP | 946 | #ifndef QT_NO_COP |
947 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 947 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
948 | e << r; | 948 | e << r; |
949 | } | 949 | } |
950 | #endif | 950 | #endif |
951 | 951 | ||
952 | } | 952 | } |
953 | } | 953 | } |
954 | 954 | ||
955 | 955 | ||
956 | /*! | 956 | /*! |
957 | \internal | 957 | \internal |
958 | */ | 958 | */ |
959 | void QPEApplication::applyStyle() | 959 | void QPEApplication::applyStyle() |
960 | { | 960 | { |
961 | Config config( "qpe" ); | 961 | Config config( "qpe" ); |
962 | config.setGroup( "Appearance" ); | 962 | config.setGroup( "Appearance" ); |
963 | 963 | ||
964 | #if QT_VERSION > 233 | ||
964 | // don't block ourselves ... | 965 | // don't block ourselves ... |
965 | Opie::force_appearance = 0; | 966 | Opie::force_appearance = 0; |
966 | 967 | ||
967 | static QString appname = Opie::binaryName ( ); | 968 | static QString appname = Opie::binaryName ( ); |
968 | 969 | ||
969 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 970 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
970 | int nostyle = 0; | 971 | int nostyle = 0; |
971 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 972 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
972 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 973 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
973 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 974 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
974 | break; | 975 | break; |
975 | } | 976 | } |
976 | } | 977 | } |
977 | 978 | ||
978 | // Widget style | 979 | // Widget style |
979 | QString style = config.readEntry( "Style", "Light" ); | 980 | QString style = config.readEntry( "Style", "Light" ); |
980 | 981 | ||
981 | // don't set a custom style | 982 | // don't set a custom style |
982 | if ( nostyle & Opie::Force_Style ) | 983 | if ( nostyle & Opie::Force_Style ) |
983 | style = "Light"; | 984 | style = "Light"; |
984 | 985 | ||
985 | internalSetStyle ( style ); | 986 | internalSetStyle ( style ); |
986 | 987 | ||
987 | // Colors | 988 | // Colors |
988 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); | 989 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); |
989 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); | 990 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); |
990 | QPalette pal( btncolor, bgcolor ); | 991 | QPalette pal( btncolor, bgcolor ); |
991 | QString color = config.readEntry( "Highlight", "#800000" ); | 992 | QString color = config.readEntry( "Highlight", "#800000" ); |
992 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 993 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
993 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 994 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
994 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 995 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
995 | color = config.readEntry( "Text", "#000000" ); | 996 | color = config.readEntry( "Text", "#000000" ); |
996 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 997 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
997 | color = config.readEntry( "ButtonText", "#000000" ); | 998 | color = config.readEntry( "ButtonText", "#000000" ); |
998 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 999 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
999 | color = config.readEntry( "Base", "#FFFFFF" ); | 1000 | color = config.readEntry( "Base", "#FFFFFF" ); |
1000 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1001 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1001 | 1002 | ||
1002 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1003 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1003 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1004 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1004 | 1005 | ||
1005 | setPalette( pal, TRUE ); | 1006 | setPalette( pal, TRUE ); |
1006 | 1007 | ||
1007 | // Window Decoration | 1008 | // Window Decoration |
1008 | QString dec = config.readEntry( "Decoration", "Qtopia" ); | 1009 | QString dec = config.readEntry( "Decoration", "Qtopia" ); |
1009 | 1010 | ||
1010 | // don't set a custom deco | 1011 | // don't set a custom deco |
1011 | if ( nostyle & Opie::Force_Decoration ) | 1012 | if ( nostyle & Opie::Force_Decoration ) |
1012 | dec = ""; | 1013 | dec = ""; |
1013 | 1014 | ||
1014 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1015 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1015 | 1016 | ||
1016 | if ( dec != d->decorationName ) { | 1017 | if ( dec != d->decorationName ) { |
1017 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1018 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1018 | d->decorationName = dec; | 1019 | d->decorationName = dec; |
1019 | } | 1020 | } |
1020 | 1021 | ||
1021 | // Font | 1022 | // Font |
1022 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1023 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1023 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1024 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1024 | 1025 | ||
1025 | // don't set a custom font | 1026 | // don't set a custom font |
1026 | if ( nostyle & Opie::Force_Font ) { | 1027 | if ( nostyle & Opie::Force_Font ) { |
1027 | ff = "Vera"; | 1028 | ff = "Vera"; |
1028 | fs = 10; | 1029 | fs = 10; |
1029 | } | 1030 | } |
1030 | 1031 | ||
1031 | setFont ( QFont ( ff, fs ), true ); | 1032 | setFont ( QFont ( ff, fs ), true ); |
1032 | 1033 | ||
1033 | // revert to global blocking policy ... | 1034 | // revert to global blocking policy ... |
1034 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1035 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1035 | Opie::force_appearance &= ~nostyle; | 1036 | Opie::force_appearance &= ~nostyle; |
1037 | #endif | ||
1036 | } | 1038 | } |
1037 | 1039 | ||
1038 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1040 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1039 | { | 1041 | { |
1040 | #ifdef Q_WS_QWS | 1042 | #ifdef Q_WS_QWS |
1041 | QDataStream stream( data, IO_ReadOnly ); | 1043 | QDataStream stream( data, IO_ReadOnly ); |
1042 | if ( msg == "applyStyle()" ) { | 1044 | if ( msg == "applyStyle()" ) { |
1043 | applyStyle(); | 1045 | applyStyle(); |
1044 | } | 1046 | } |
1045 | else if ( msg == "toggleApplicationMenu()" ) { | 1047 | else if ( msg == "toggleApplicationMenu()" ) { |
1046 | QWidget *active = activeWindow ( ); | 1048 | QWidget *active = activeWindow ( ); |
1047 | 1049 | ||
1048 | if ( active ) { | 1050 | if ( active ) { |
1049 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1051 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1050 | bool oldactive = man-> isActive ( ); | 1052 | bool oldactive = man-> isActive ( ); |
1051 | 1053 | ||
1052 | man-> setActive( !man-> isActive() ); | 1054 | man-> setActive( !man-> isActive() ); |
1053 | 1055 | ||
1054 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1056 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1055 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1057 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1056 | } | 1058 | } |
1057 | } | 1059 | } |
1058 | } | 1060 | } |
1059 | else if ( msg == "setDefaultRotation(int)" ) { | 1061 | else if ( msg == "setDefaultRotation(int)" ) { |
1060 | if ( type() == GuiServer ) { | 1062 | if ( type() == GuiServer ) { |
1061 | int r; | 1063 | int r; |
1062 | stream >> r; | 1064 | stream >> r; |
1063 | setDefaultRotation( r ); | 1065 | setDefaultRotation( r ); |
1064 | } | 1066 | } |
1065 | } | 1067 | } |
1066 | else if ( msg == "setCurrentRotation(int)" ) { | 1068 | else if ( msg == "setCurrentRotation(int)" ) { |
1067 | int r; | 1069 | int r; |
1068 | stream >> r; | 1070 | stream >> r; |
1069 | setCurrentRotation( r ); | 1071 | setCurrentRotation( r ); |
1070 | } | 1072 | } |
1071 | else if ( msg == "shutdown()" ) { | 1073 | else if ( msg == "shutdown()" ) { |
1072 | if ( type() == GuiServer ) | 1074 | if ( type() == GuiServer ) |
1073 | shutdown(); | 1075 | shutdown(); |
1074 | } | 1076 | } |
1075 | else if ( msg == "quit()" ) { | 1077 | else if ( msg == "quit()" ) { |
1076 | if ( type() != GuiServer ) | 1078 | if ( type() != GuiServer ) |
1077 | tryQuit(); | 1079 | tryQuit(); |
1078 | } | 1080 | } |
1079 | else if ( msg == "forceQuit()" ) { | 1081 | else if ( msg == "forceQuit()" ) { |
1080 | if ( type() != GuiServer ) | 1082 | if ( type() != GuiServer ) |
1081 | quit(); | 1083 | quit(); |
1082 | } | 1084 | } |
1083 | else if ( msg == "restart()" ) { | 1085 | else if ( msg == "restart()" ) { |
1084 | if ( type() == GuiServer ) | 1086 | if ( type() == GuiServer ) |
1085 | restart(); | 1087 | restart(); |
1086 | } | 1088 | } |
1087 | else if ( msg == "language(QString)" ) { | 1089 | else if ( msg == "language(QString)" ) { |
1088 | if ( type() == GuiServer ) { | 1090 | if ( type() == GuiServer ) { |
1089 | QString l; | 1091 | QString l; |
1090 | stream >> l; | 1092 | stream >> l; |
1091 | QString cl = getenv( "LANG" ); | 1093 | QString cl = getenv( "LANG" ); |
1092 | if ( cl != l ) { | 1094 | if ( cl != l ) { |
1093 | if ( l.isNull() ) | 1095 | if ( l.isNull() ) |
1094 | unsetenv( "LANG" ); | 1096 | unsetenv( "LANG" ); |
1095 | else | 1097 | else |
1096 | setenv( "LANG", l.latin1(), 1 ); | 1098 | setenv( "LANG", l.latin1(), 1 ); |
1097 | restart(); | 1099 | restart(); |
1098 | } | 1100 | } |
1099 | } | 1101 | } |
1100 | } | 1102 | } |
1101 | else if ( msg == "timeChange(QString)" ) { | 1103 | else if ( msg == "timeChange(QString)" ) { |
1102 | QString t; | 1104 | QString t; |
1103 | stream >> t; | 1105 | stream >> t; |
1104 | if ( t.isNull() ) | 1106 | if ( t.isNull() ) |
1105 | unsetenv( "TZ" ); | 1107 | unsetenv( "TZ" ); |
1106 | else | 1108 | else |
1107 | setenv( "TZ", t.latin1(), 1 ); | 1109 | setenv( "TZ", t.latin1(), 1 ); |
1108 | // emit the signal so everyone else knows... | 1110 | // emit the signal so everyone else knows... |
1109 | emit timeChanged(); | 1111 | emit timeChanged(); |
1110 | } | 1112 | } |
1111 | else if ( msg == "execute(QString)" ) { | 1113 | else if ( msg == "execute(QString)" ) { |
1112 | if ( type() == GuiServer ) { | 1114 | if ( type() == GuiServer ) { |
1113 | QString t; | 1115 | QString t; |
1114 | stream >> t; | 1116 | stream >> t; |
1115 | Global::execute( t ); | 1117 | Global::execute( t ); |
1116 | } | 1118 | } |
1117 | } | 1119 | } |
1118 | else if ( msg == "execute(QString,QString)" ) { | 1120 | else if ( msg == "execute(QString,QString)" ) { |
1119 | if ( type() == GuiServer ) { | 1121 | if ( type() == GuiServer ) { |
1120 | QString t, d; | 1122 | QString t, d; |
1121 | stream >> t >> d; | 1123 | stream >> t >> d; |
1122 | Global::execute( t, d ); | 1124 | Global::execute( t, d ); |
1123 | } | 1125 | } |
1124 | } | 1126 | } |
1125 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { | 1127 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { |
1126 | if ( type() == GuiServer ) { | 1128 | if ( type() == GuiServer ) { |
1127 | QDateTime when; | 1129 | QDateTime when; |
1128 | QCString channel, message; | 1130 | QCString channel, message; |
1129 | int data; | 1131 | int data; |
1130 | stream >> when >> channel >> message >> data; | 1132 | stream >> when >> channel >> message >> data; |
1131 | AlarmServer::addAlarm( when, channel, message, data ); | 1133 | AlarmServer::addAlarm( when, channel, message, data ); |
1132 | } | 1134 | } |
1133 | } | 1135 | } |
1134 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { | 1136 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { |
1135 | if ( type() == GuiServer ) { | 1137 | if ( type() == GuiServer ) { |
1136 | QDateTime when; | 1138 | QDateTime when; |
1137 | QCString channel, message; | 1139 | QCString channel, message; |
1138 | int data; | 1140 | int data; |
1139 | stream >> when >> channel >> message >> data; | 1141 | stream >> when >> channel >> message >> data; |
1140 | AlarmServer::deleteAlarm( when, channel, message, data ); | 1142 | AlarmServer::deleteAlarm( when, channel, message, data ); |
1141 | } | 1143 | } |
1142 | } | 1144 | } |
1143 | else if ( msg == "clockChange(bool)" ) { | 1145 | else if ( msg == "clockChange(bool)" ) { |
1144 | int tmp; | 1146 | int tmp; |
1145 | stream >> tmp; | 1147 | stream >> tmp; |
1146 | emit clockChanged( tmp ); | 1148 | emit clockChanged( tmp ); |
1147 | } | 1149 | } |
1148 | else if ( msg == "weekChange(bool)" ) { | 1150 | else if ( msg == "weekChange(bool)" ) { |
1149 | int tmp; | 1151 | int tmp; |
1150 | stream >> tmp; | 1152 | stream >> tmp; |
1151 | emit weekChanged( tmp ); | 1153 | emit weekChanged( tmp ); |
1152 | } | 1154 | } |
1153 | else if ( msg == "setDateFormat(DateFormat)" ) { | 1155 | else if ( msg == "setDateFormat(DateFormat)" ) { |
1154 | DateFormat tmp; | 1156 | DateFormat tmp; |
1155 | stream >> tmp; | 1157 | stream >> tmp; |
1156 | emit dateFormatChanged( tmp ); | 1158 | emit dateFormatChanged( tmp ); |
1157 | } | 1159 | } |
1158 | else if ( msg == "setVolume(int,int)" ) { | 1160 | else if ( msg == "setVolume(int,int)" ) { |
1159 | int t, v; | 1161 | int t, v; |
1160 | stream >> t >> v; | 1162 | stream >> t >> v; |
1161 | setVolume( t, v ); | 1163 | setVolume( t, v ); |
1162 | emit volumeChanged( muted ); | 1164 | emit volumeChanged( muted ); |
1163 | } | 1165 | } |
1164 | else if ( msg == "volumeChange(bool)" ) { | 1166 | else if ( msg == "volumeChange(bool)" ) { |
1165 | stream >> muted; | 1167 | stream >> muted; |
1166 | setVolume(); | 1168 | setVolume(); |
1167 | emit volumeChanged( muted ); | 1169 | emit volumeChanged( muted ); |
1168 | } | 1170 | } |
1169 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1171 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1170 | int t, v; | 1172 | int t, v; |
1171 | stream >> t >> v; | 1173 | stream >> t >> v; |
1172 | setMic( t, v ); | 1174 | setMic( t, v ); |
1173 | emit micChanged( micMuted ); | 1175 | emit micChanged( micMuted ); |
1174 | } | 1176 | } |
1175 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1177 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1176 | stream >> micMuted; | 1178 | stream >> micMuted; |
1177 | setMic(); | 1179 | setMic(); |
1178 | emit micChanged( micMuted ); | 1180 | emit micChanged( micMuted ); |
1179 | } | 1181 | } |
1180 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1182 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1181 | int t, v; | 1183 | int t, v; |
1182 | stream >> t >> v; | 1184 | stream >> t >> v; |
1183 | setBass( t, v ); | 1185 | setBass( t, v ); |
1184 | } | 1186 | } |
1185 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1187 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1186 | setBass(); | 1188 | setBass(); |
1187 | } | 1189 | } |
1188 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1190 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1189 | int t, v; | 1191 | int t, v; |
1190 | stream >> t >> v; | 1192 | stream >> t >> v; |
1191 | setTreble( t, v ); | 1193 | setTreble( t, v ); |
1192 | } | 1194 | } |
1193 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1195 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1194 | setTreble(); | 1196 | setTreble(); |
1195 | } | 1197 | } |
1196 | 1198 | ||
1197 | 1199 | ||
1198 | 1200 | ||
1199 | #endif | 1201 | #endif |
1200 | } | 1202 | } |
1201 | 1203 | ||
1202 | /*! | 1204 | /*! |
1203 | \internal | 1205 | \internal |
1204 | */ | 1206 | */ |
1205 | bool QPEApplication::raiseAppropriateWindow() | 1207 | bool QPEApplication::raiseAppropriateWindow() |
1206 | { | 1208 | { |
1207 | bool r = FALSE; | 1209 | bool r = FALSE; |
1208 | // ########## raise()ing main window should raise and set active | 1210 | // ########## raise()ing main window should raise and set active |
1209 | // ########## it and then all childen. This belongs in Qt/Embedded | 1211 | // ########## it and then all childen. This belongs in Qt/Embedded |
1210 | QWidget *top = d->qpe_main_widget; | 1212 | QWidget *top = d->qpe_main_widget; |
1211 | if ( !top ) | 1213 | if ( !top ) |
1212 | top = mainWidget(); | 1214 | top = mainWidget(); |
1213 | if ( top && d->keep_running ) { | 1215 | if ( top && d->keep_running ) { |
1214 | if ( top->isVisible() ) | 1216 | if ( top->isVisible() ) |
1215 | r = TRUE; | 1217 | r = TRUE; |
1216 | else if (d->preloaded) { | 1218 | else if (d->preloaded) { |
1217 | // We are preloaded and not visible.. pretend we just started.. | 1219 | // We are preloaded and not visible.. pretend we just started.. |
1218 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1220 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1219 | e << d->appName; | 1221 | e << d->appName; |
1220 | } | 1222 | } |
1221 | 1223 | ||
1222 | d->show_mx(top, d->nomaximize); | 1224 | d->show_mx(top, d->nomaximize); |
1223 | top->raise(); | 1225 | top->raise(); |
1224 | top->setActiveWindow(); | 1226 | top->setActiveWindow(); |
1225 | } | 1227 | } |
1226 | QWidget *topm = activeModalWidget(); | 1228 | QWidget *topm = activeModalWidget(); |
1227 | if ( topm && topm != top ) { | 1229 | if ( topm && topm != top ) { |
1228 | topm->show(); | 1230 | topm->show(); |
1229 | topm->raise(); | 1231 | topm->raise(); |
1230 | topm->setActiveWindow(); | 1232 | topm->setActiveWindow(); |
1231 | // If we haven't already handled the fastAppShowing message | 1233 | // If we haven't already handled the fastAppShowing message |
1232 | if (!top && d->preloaded) { | 1234 | if (!top && d->preloaded) { |
1233 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1235 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1234 | e << d->appName; | 1236 | e << d->appName; |
1235 | } | 1237 | } |
1236 | r = FALSE; | 1238 | r = FALSE; |
1237 | } | 1239 | } |
1238 | return r; | 1240 | return r; |
1239 | } | 1241 | } |
1240 | 1242 | ||
1241 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | 1243 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) |
1242 | { | 1244 | { |
1243 | #ifdef Q_WS_QWS | 1245 | #ifdef Q_WS_QWS |
1244 | 1246 | ||
1245 | if ( msg == "quit()" ) { | 1247 | if ( msg == "quit()" ) { |
1246 | tryQuit(); | 1248 | tryQuit(); |
1247 | } | 1249 | } |
1248 | else if ( msg == "quitIfInvisible()" ) { | 1250 | else if ( msg == "quitIfInvisible()" ) { |
1249 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) | 1251 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) |
1250 | quit(); | 1252 | quit(); |
1251 | } | 1253 | } |
1252 | else if ( msg == "close()" ) { | 1254 | else if ( msg == "close()" ) { |
1253 | hideOrQuit(); | 1255 | hideOrQuit(); |
1254 | } | 1256 | } |
1255 | else if ( msg == "disablePreload()" ) { | 1257 | else if ( msg == "disablePreload()" ) { |
1256 | d->preloaded = FALSE; | 1258 | d->preloaded = FALSE; |
1257 | d->keep_running = TRUE; | 1259 | d->keep_running = TRUE; |
1258 | /* so that quit will quit */ | 1260 | /* so that quit will quit */ |
1259 | } | 1261 | } |
1260 | else if ( msg == "enablePreload()" ) { | 1262 | else if ( msg == "enablePreload()" ) { |
1261 | if (d->qpe_main_widget) | 1263 | if (d->qpe_main_widget) |
1262 | d->preloaded = TRUE; | 1264 | d->preloaded = TRUE; |
1263 | d->keep_running = TRUE; | 1265 | d->keep_running = TRUE; |
1264 | /* so next quit won't quit */ | 1266 | /* so next quit won't quit */ |
1265 | } | 1267 | } |
1266 | else if ( msg == "raise()" ) { | 1268 | else if ( msg == "raise()" ) { |
1267 | d->keep_running = TRUE; | 1269 | d->keep_running = TRUE; |
1268 | d->notbusysent = FALSE; | 1270 | d->notbusysent = FALSE; |
1269 | raiseAppropriateWindow(); | 1271 | raiseAppropriateWindow(); |
1270 | // Tell the system we're still chugging along... | 1272 | // Tell the system we're still chugging along... |
1271 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1273 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1272 | e << d->appName; | 1274 | e << d->appName; |
1273 | } | 1275 | } |
1274 | else if ( msg == "flush()" ) { | 1276 | else if ( msg == "flush()" ) { |
1275 | emit flush(); | 1277 | emit flush(); |
1276 | // we need to tell the desktop | 1278 | // we need to tell the desktop |
1277 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); | 1279 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); |
1278 | e << d->appName; | 1280 | e << d->appName; |
1279 | } | 1281 | } |
1280 | else if ( msg == "reload()" ) { | 1282 | else if ( msg == "reload()" ) { |
1281 | emit reload(); | 1283 | emit reload(); |
1282 | } | 1284 | } |
1283 | else if ( msg == "setDocument(QString)" ) { | 1285 | else if ( msg == "setDocument(QString)" ) { |
1284 | d->keep_running = TRUE; | 1286 | d->keep_running = TRUE; |
1285 | QDataStream stream( data, IO_ReadOnly ); | 1287 | QDataStream stream( data, IO_ReadOnly ); |
1286 | QString doc; | 1288 | QString doc; |
1287 | stream >> doc; | 1289 | stream >> doc; |
1288 | QWidget *mw = mainWidget(); | 1290 | QWidget *mw = mainWidget(); |
1289 | if ( !mw ) | 1291 | if ( !mw ) |
1290 | mw = d->qpe_main_widget; | 1292 | mw = d->qpe_main_widget; |
1291 | if ( mw ) | 1293 | if ( mw ) |
1292 | Global::setDocument( mw, doc ); | 1294 | Global::setDocument( mw, doc ); |
1293 | } | 1295 | } |
1294 | else if ( msg == "nextView()" ) { | 1296 | else if ( msg == "nextView()" ) { |
1295 | qDebug("got nextView()"); | 1297 | qDebug("got nextView()"); |
1296 | /* | 1298 | /* |
1297 | if ( raiseAppropriateWindow() ) | 1299 | if ( raiseAppropriateWindow() ) |
1298 | */ | 1300 | */ |
1299 | emit appMessage( msg, data); | 1301 | emit appMessage( msg, data); |
1300 | } | 1302 | } |
1301 | else { | 1303 | else { |
1302 | emit appMessage( msg, data); | 1304 | emit appMessage( msg, data); |
1303 | } | 1305 | } |
1304 | 1306 | ||
1305 | #endif | 1307 | #endif |
1306 | } | 1308 | } |
1307 | 1309 | ||
1308 | 1310 | ||
1309 | /*! | 1311 | /*! |
1310 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1312 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1311 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1313 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1312 | 1314 | ||
1313 | \sa showMainDocumentWidget() | 1315 | \sa showMainDocumentWidget() |
1314 | */ | 1316 | */ |
1315 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | 1317 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) |
1316 | { | 1318 | { |
1317 | d->show(mw, nomaximize ); | 1319 | d->show(mw, nomaximize ); |
1318 | } | 1320 | } |
1319 | 1321 | ||
1320 | /*! | 1322 | /*! |
1321 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1323 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1322 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1324 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1323 | 1325 | ||
1324 | This calls designates the application as | 1326 | This calls designates the application as |
1325 | a \link docwidget.html document-oriented\endlink application. | 1327 | a \link docwidget.html document-oriented\endlink application. |
1326 | 1328 | ||
1327 | The \a mw widget \e must have this slot: setDocument(const QString&). | 1329 | The \a mw widget \e must have this slot: setDocument(const QString&). |
1328 | 1330 | ||
1329 | \sa showMainWidget() | 1331 | \sa showMainWidget() |
1330 | */ | 1332 | */ |
1331 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | 1333 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) |
1332 | { | 1334 | { |
1333 | if ( mw && argc() == 2 ) | 1335 | if ( mw && argc() == 2 ) |
1334 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); | 1336 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); |
1335 | 1337 | ||
1336 | 1338 | ||
1337 | d->show(mw, nomaximize ); | 1339 | d->show(mw, nomaximize ); |
1338 | } | 1340 | } |
1339 | 1341 | ||
1340 | 1342 | ||
1341 | /*! | 1343 | /*! |
1342 | If an application is started via a \link qcop.html QCop\endlink | 1344 | If an application is started via a \link qcop.html QCop\endlink |
1343 | message, the application will process the \link qcop.html | 1345 | message, the application will process the \link qcop.html |
1344 | QCop\endlink message and then quit. If the application calls this | 1346 | QCop\endlink message and then quit. If the application calls this |
1345 | function while processing a \link qcop.html QCop\endlink message, | 1347 | function while processing a \link qcop.html QCop\endlink message, |
1346 | after processing its outstanding \link qcop.html QCop\endlink | 1348 | after processing its outstanding \link qcop.html QCop\endlink |
1347 | messages the application will start 'properly' and show itself. | 1349 | messages the application will start 'properly' and show itself. |
1348 | 1350 | ||
1349 | \sa keepRunning() | 1351 | \sa keepRunning() |
1350 | */ | 1352 | */ |
1351 | void QPEApplication::setKeepRunning() | 1353 | void QPEApplication::setKeepRunning() |
1352 | { | 1354 | { |
1353 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 1355 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
1354 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 1356 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
1355 | qpeApp->d->keep_running = TRUE; | 1357 | qpeApp->d->keep_running = TRUE; |
1356 | } | 1358 | } |
1357 | } | 1359 | } |
1358 | 1360 | ||
1359 | /*! | 1361 | /*! |
1360 | Returns TRUE if the application will quit after processing the | 1362 | Returns TRUE if the application will quit after processing the |
1361 | current list of qcop messages; otherwise returns FALSE. | 1363 | current list of qcop messages; otherwise returns FALSE. |
1362 | 1364 | ||
1363 | \sa setKeepRunning() | 1365 | \sa setKeepRunning() |
1364 | */ | 1366 | */ |
1365 | bool QPEApplication::keepRunning() const | 1367 | bool QPEApplication::keepRunning() const |
1366 | { | 1368 | { |
1367 | return d->keep_running; | 1369 | return d->keep_running; |
1368 | } | 1370 | } |
1369 | 1371 | ||
1370 | /*! | 1372 | /*! |
1371 | \internal | 1373 | \internal |
1372 | */ | 1374 | */ |
1373 | void QPEApplication::internalSetStyle( const QString &style ) | 1375 | void QPEApplication::internalSetStyle( const QString &style ) |
1374 | { | 1376 | { |
1375 | #if QT_VERSION >= 300 | 1377 | #if QT_VERSION >= 300 |
1376 | if ( style == "QPE" ) { | 1378 | if ( style == "QPE" ) { |
1377 | setStyle( new QPEStyle ); | 1379 | setStyle( new QPEStyle ); |
1378 | } | 1380 | } |
1379 | else { | 1381 | else { |
1380 | QStyle *s = QStyleFactory::create( style ); | 1382 | QStyle *s = QStyleFactory::create( style ); |
1381 | if ( s ) | 1383 | if ( s ) |
1382 | setStyle( s ); | 1384 | setStyle( s ); |
1383 | } | 1385 | } |
1384 | #else | 1386 | #else |
1385 | if ( style == "Windows" ) { | 1387 | if ( style == "Windows" ) { |
1386 | setStyle( new QWindowsStyle ); | 1388 | setStyle( new QWindowsStyle ); |
1387 | } | 1389 | } |
1388 | else if ( style == "QPE" ) { | 1390 | else if ( style == "QPE" ) { |
1389 | setStyle( new QPEStyle ); | 1391 | setStyle( new QPEStyle ); |
1390 | } | 1392 | } |
1391 | else if ( style == "Light" ) { | 1393 | else if ( style == "Light" ) { |
1392 | setStyle( new LightStyle ); | 1394 | setStyle( new LightStyle ); |
1393 | } | 1395 | } |
1394 | #ifndef QT_NO_STYLE_PLATINUM | 1396 | #ifndef QT_NO_STYLE_PLATINUM |
1395 | else if ( style == "Platinum" ) { | 1397 | else if ( style == "Platinum" ) { |
1396 | setStyle( new QPlatinumStyle ); | 1398 | setStyle( new QPlatinumStyle ); |
1397 | } | 1399 | } |
1398 | #endif | 1400 | #endif |
1399 | #ifndef QT_NO_STYLE_MOTIF | 1401 | #ifndef QT_NO_STYLE_MOTIF |
1400 | else if ( style == "Motif" ) { | 1402 | else if ( style == "Motif" ) { |
1401 | setStyle( new QMotifStyle ); | 1403 | setStyle( new QMotifStyle ); |
1402 | } | 1404 | } |
1403 | #endif | 1405 | #endif |
1404 | #ifndef QT_NO_STYLE_MOTIFPLUS | 1406 | #ifndef QT_NO_STYLE_MOTIFPLUS |
1405 | else if ( style == "MotifPlus" ) { | 1407 | else if ( style == "MotifPlus" ) { |
1406 | setStyle( new QMotifPlusStyle ); | 1408 | setStyle( new QMotifPlusStyle ); |
1407 | } | 1409 | } |
1408 | #endif | 1410 | #endif |
1409 | 1411 | ||
1410 | else { | 1412 | else { |
1411 | QStyle *sty = 0; | 1413 | QStyle *sty = 0; |
1412 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 1414 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; |
1413 | 1415 | ||
1414 | if ( style. find ( ".so" ) > 0 ) | 1416 | if ( style. find ( ".so" ) > 0 ) |
1415 | path += style; | 1417 | path += style; |
1416 | else | 1418 | else |
1417 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility | 1419 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility |
1418 | 1420 | ||
1419 | static QLibrary *lastlib = 0; | 1421 | static QLibrary *lastlib = 0; |
1420 | static StyleInterface *lastiface = 0; | 1422 | static StyleInterface *lastiface = 0; |
1421 | 1423 | ||
1422 | QLibrary *lib = new QLibrary ( path ); | 1424 | QLibrary *lib = new QLibrary ( path ); |
1423 | StyleInterface *iface = 0; | 1425 | StyleInterface *iface = 0; |
1424 | 1426 | ||
1425 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) | 1427 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) |
1426 | sty = iface-> style ( ); | 1428 | sty = iface-> style ( ); |
1427 | 1429 | ||
1428 | if ( sty ) { | 1430 | if ( sty ) { |
1429 | setStyle ( sty ); | 1431 | setStyle ( sty ); |
1430 | 1432 | ||
1431 | if ( lastiface ) | 1433 | if ( lastiface ) |
1432 | lastiface-> release ( ); | 1434 | lastiface-> release ( ); |
1433 | lastiface = iface; | 1435 | lastiface = iface; |
1434 | 1436 | ||
1435 | if ( lastlib ) { | 1437 | if ( lastlib ) { |
1436 | lastlib-> unload ( ); | 1438 | lastlib-> unload ( ); |
1437 | delete lastlib; | 1439 | delete lastlib; |
1438 | } | 1440 | } |
1439 | lastlib = lib; | 1441 | lastlib = lib; |
1440 | } | 1442 | } |
1441 | else { | 1443 | else { |
1442 | if ( iface ) | 1444 | if ( iface ) |
1443 | iface-> release ( ); | 1445 | iface-> release ( ); |
1444 | delete lib; | 1446 | delete lib; |
1445 | 1447 | ||
1446 | setStyle ( new LightStyle ( )); | 1448 | setStyle ( new LightStyle ( )); |
1447 | } | 1449 | } |
1448 | } | 1450 | } |
1449 | #endif | 1451 | #endif |
1450 | } | 1452 | } |
1451 | 1453 | ||
1452 | /*! | 1454 | /*! |
1453 | \internal | 1455 | \internal |
1454 | */ | 1456 | */ |
1455 | void QPEApplication::prepareForTermination( bool willrestart ) | 1457 | void QPEApplication::prepareForTermination( bool willrestart ) |
1456 | { | 1458 | { |
1457 | if ( willrestart ) { | 1459 | if ( willrestart ) { |
1458 | // Draw a big wait icon, the image can be altered in later revisions | 1460 | // Draw a big wait icon, the image can be altered in later revisions |
1459 | // QWidget *d = QApplication::desktop(); | 1461 | // QWidget *d = QApplication::desktop(); |
1460 | QImage img = Resource::loadImage( "launcher/new_wait" ); | 1462 | QImage img = Resource::loadImage( "launcher/new_wait" ); |
1461 | QPixmap pix; | 1463 | QPixmap pix; |
1462 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); | 1464 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); |
1463 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | | 1465 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | |
1464 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 1466 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
1465 | lblWait->setPixmap( pix ); | 1467 | lblWait->setPixmap( pix ); |
1466 | lblWait->setAlignment( QWidget::AlignCenter ); | 1468 | lblWait->setAlignment( QWidget::AlignCenter ); |
1467 | lblWait->show(); | 1469 | lblWait->show(); |
1468 | lblWait->showMaximized(); | 1470 | lblWait->showMaximized(); |
1469 | } | 1471 | } |
1470 | #ifndef SINGLE_APP | 1472 | #ifndef SINGLE_APP |
1471 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 1473 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
1472 | } | 1474 | } |
1473 | processEvents(); // ensure the message goes out. | 1475 | processEvents(); // ensure the message goes out. |
1474 | sleep( 1 ); // You have 1 second to comply. | 1476 | sleep( 1 ); // You have 1 second to comply. |
1475 | #endif | 1477 | #endif |
1476 | } | 1478 | } |
1477 | 1479 | ||
1478 | /*! | 1480 | /*! |
1479 | \internal | 1481 | \internal |
1480 | */ | 1482 | */ |
1481 | void QPEApplication::shutdown() | 1483 | void QPEApplication::shutdown() |
1482 | { | 1484 | { |
1483 | // Implement in server's QPEApplication subclass | 1485 | // Implement in server's QPEApplication subclass |
1484 | } | 1486 | } |
1485 | 1487 | ||
1486 | /*! | 1488 | /*! |
1487 | \internal | 1489 | \internal |
1488 | */ | 1490 | */ |
1489 | void QPEApplication::restart() | 1491 | void QPEApplication::restart() |
1490 | { | 1492 | { |
1491 | // Implement in server's QPEApplication subclass | 1493 | // Implement in server's QPEApplication subclass |
1492 | } | 1494 | } |
1493 | 1495 | ||
1494 | static QPtrDict<void>* stylusDict = 0; | 1496 | static QPtrDict<void>* stylusDict = 0; |
1495 | static void createDict() | 1497 | static void createDict() |
1496 | { | 1498 | { |
1497 | if ( !stylusDict ) | 1499 | if ( !stylusDict ) |
1498 | stylusDict = new QPtrDict<void>; | 1500 | stylusDict = new QPtrDict<void>; |
1499 | } | 1501 | } |
1500 | 1502 | ||
1501 | /*! | 1503 | /*! |
1502 | Returns the current StylusMode for widget \a w. | 1504 | Returns the current StylusMode for widget \a w. |
1503 | 1505 | ||
1504 | \sa setStylusOperation() StylusMode | 1506 | \sa setStylusOperation() StylusMode |
1505 | */ | 1507 | */ |
1506 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | 1508 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) |
1507 | { | 1509 | { |
1508 | if ( stylusDict ) | 1510 | if ( stylusDict ) |
1509 | return ( StylusMode ) ( int ) stylusDict->find( w ); | 1511 | return ( StylusMode ) ( int ) stylusDict->find( w ); |
1510 | return LeftOnly; | 1512 | return LeftOnly; |
1511 | } | 1513 | } |
1512 | 1514 | ||
1513 | /*! | 1515 | /*! |
1514 | \enum QPEApplication::StylusMode | 1516 | \enum QPEApplication::StylusMode |
1515 | 1517 | ||
1516 | \value LeftOnly the stylus only generates LeftButton | 1518 | \value LeftOnly the stylus only generates LeftButton |
1517 | events (the default). | 1519 | events (the default). |
1518 | \value RightOnHold the stylus generates RightButton events | 1520 | \value RightOnHold the stylus generates RightButton events |
1519 | if the user uses the press-and-hold gesture. | 1521 | if the user uses the press-and-hold gesture. |
1520 | 1522 | ||
1521 | \sa setStylusOperation() stylusOperation() | 1523 | \sa setStylusOperation() stylusOperation() |
1522 | */ | 1524 | */ |
1523 | 1525 | ||
1524 | /*! | 1526 | /*! |
1525 | Causes widget \a w to receive mouse events according to the stylus | 1527 | Causes widget \a w to receive mouse events according to the stylus |
1526 | \a mode. | 1528 | \a mode. |
1527 | 1529 | ||
1528 | \sa stylusOperation() StylusMode | 1530 | \sa stylusOperation() StylusMode |
1529 | */ | 1531 | */ |
1530 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) | 1532 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) |
1531 | { | 1533 | { |
1532 | createDict(); | 1534 | createDict(); |
1533 | if ( mode == LeftOnly ) { | 1535 | if ( mode == LeftOnly ) { |
1534 | stylusDict->remove | 1536 | stylusDict->remove |
1535 | ( w ); | 1537 | ( w ); |
1536 | w->removeEventFilter( qApp ); | 1538 | w->removeEventFilter( qApp ); |
1537 | } | 1539 | } |
1538 | else { | 1540 | else { |
1539 | stylusDict->insert( w, ( void* ) mode ); | 1541 | stylusDict->insert( w, ( void* ) mode ); |
1540 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); | 1542 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); |
1541 | w->installEventFilter( qApp ); | 1543 | w->installEventFilter( qApp ); |
1542 | } | 1544 | } |
1543 | } | 1545 | } |
1544 | 1546 | ||
1545 | 1547 | ||
1546 | /*! | 1548 | /*! |
1547 | \reimp | 1549 | \reimp |
1548 | */ | 1550 | */ |
1549 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | 1551 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) |
1550 | { | 1552 | { |
1551 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { | 1553 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { |
1552 | QMouseEvent * me = ( QMouseEvent* ) e; | 1554 | QMouseEvent * me = ( QMouseEvent* ) e; |
1553 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); | 1555 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); |
1554 | switch (mode) { | 1556 | switch (mode) { |
1555 | case RightOnHold: | 1557 | case RightOnHold: |
1556 | switch ( me->type() ) { | 1558 | switch ( me->type() ) { |
1557 | case QEvent::MouseButtonPress: | 1559 | case QEvent::MouseButtonPress: |
1558 | if ( me->button() == LeftButton ) { | 1560 | if ( me->button() == LeftButton ) { |
1559 | d->presstimer = startTimer(500); // #### pref. | 1561 | d->presstimer = startTimer(500); // #### pref. |
1560 | d->presswidget = (QWidget*)o; | 1562 | d->presswidget = (QWidget*)o; |
1561 | d->presspos = me->pos(); | 1563 | d->presspos = me->pos(); |
1562 | d->rightpressed = FALSE; | 1564 | d->rightpressed = FALSE; |
1563 | } | 1565 | } |
1564 | break; | 1566 | break; |
1565 | case QEvent::MouseMove: | 1567 | case QEvent::MouseMove: |
1566 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { | 1568 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { |
1567 | killTimer(d->presstimer); | 1569 | killTimer(d->presstimer); |
1568 | d->presstimer = 0; | 1570 | d->presstimer = 0; |
1569 | } | 1571 | } |
1570 | break; | 1572 | break; |
1571 | case QEvent::MouseButtonRelease: | 1573 | case QEvent::MouseButtonRelease: |
1572 | if ( me->button() == LeftButton ) { | 1574 | if ( me->button() == LeftButton ) { |
1573 | if ( d->presstimer ) { | 1575 | if ( d->presstimer ) { |
1574 | killTimer(d->presstimer); | 1576 | killTimer(d->presstimer); |
1575 | d->presstimer = 0; | 1577 | d->presstimer = 0; |
1576 | } | 1578 | } |
1577 | if ( d->rightpressed && d->presswidget ) { | 1579 | if ( d->rightpressed && d->presswidget ) { |
1578 | // Right released | 1580 | // Right released |
1579 | postEvent( d->presswidget, | 1581 | postEvent( d->presswidget, |
1580 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), | 1582 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), |
1581 | RightButton, LeftButton + RightButton ) ); | 1583 | RightButton, LeftButton + RightButton ) ); |
1582 | // Left released, off-widget | 1584 | // Left released, off-widget |
1583 | postEvent( d->presswidget, | 1585 | postEvent( d->presswidget, |
1584 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), | 1586 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), |
1585 | LeftButton, LeftButton ) ); | 1587 | LeftButton, LeftButton ) ); |
1586 | postEvent( d->presswidget, | 1588 | postEvent( d->presswidget, |
1587 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), | 1589 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), |
1588 | LeftButton, LeftButton ) ); | 1590 | LeftButton, LeftButton ) ); |
1589 | d->rightpressed = FALSE; | 1591 | d->rightpressed = FALSE; |
1590 | return TRUE; // don't send the real Left release | 1592 | return TRUE; // don't send the real Left release |
1591 | } | 1593 | } |
1592 | } | 1594 | } |
1593 | break; | 1595 | break; |
1594 | default: | 1596 | default: |
1595 | break; | 1597 | break; |
1596 | } | 1598 | } |
1597 | break; | 1599 | break; |
1598 | default: | 1600 | default: |
1599 | ; | 1601 | ; |
1600 | } | 1602 | } |
1601 | } | 1603 | } |
1602 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1604 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
1603 | QKeyEvent *ke = (QKeyEvent *)e; | 1605 | QKeyEvent *ke = (QKeyEvent *)e; |
1604 | if ( ke->key() == Key_Enter ) { | 1606 | if ( ke->key() == Key_Enter ) { |
1605 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { | 1607 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { |
1606 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', | 1608 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', |
1607 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); | 1609 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); |
1608 | return TRUE; | 1610 | return TRUE; |
1609 | } | 1611 | } |
1610 | } | 1612 | } |
1611 | } | 1613 | } |
1612 | return FALSE; | 1614 | return FALSE; |
1613 | } | 1615 | } |
1614 | 1616 | ||
1615 | /*! | 1617 | /*! |
1616 | \reimp | 1618 | \reimp |
1617 | */ | 1619 | */ |
1618 | void QPEApplication::timerEvent( QTimerEvent *e ) | 1620 | void QPEApplication::timerEvent( QTimerEvent *e ) |
1619 | { | 1621 | { |
1620 | if ( e->timerId() == d->presstimer && d->presswidget ) { | 1622 | if ( e->timerId() == d->presstimer && d->presswidget ) { |
1621 | // Right pressed | 1623 | // Right pressed |
1622 | postEvent( d->presswidget, | 1624 | postEvent( d->presswidget, |
1623 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, | 1625 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, |
1624 | RightButton, LeftButton ) ); | 1626 | RightButton, LeftButton ) ); |
1625 | killTimer( d->presstimer ); | 1627 | killTimer( d->presstimer ); |
1626 | d->presstimer = 0; | 1628 | d->presstimer = 0; |
1627 | d->rightpressed = TRUE; | 1629 | d->rightpressed = TRUE; |
1628 | } | 1630 | } |
1629 | } | 1631 | } |
1630 | 1632 | ||
1631 | void QPEApplication::removeSenderFromStylusDict() | 1633 | void QPEApplication::removeSenderFromStylusDict() |
1632 | { | 1634 | { |
1633 | stylusDict->remove | 1635 | stylusDict->remove |
1634 | ( ( void* ) sender() ); | 1636 | ( ( void* ) sender() ); |
1635 | if ( d->presswidget == sender() ) | 1637 | if ( d->presswidget == sender() ) |
1636 | d->presswidget = 0; | 1638 | d->presswidget = 0; |
1637 | } | 1639 | } |
1638 | 1640 | ||
1639 | /*! | 1641 | /*! |
1640 | \internal | 1642 | \internal |
1641 | */ | 1643 | */ |
1642 | bool QPEApplication::keyboardGrabbed() const | 1644 | bool QPEApplication::keyboardGrabbed() const |
1643 | { | 1645 | { |
1644 | return d->kbgrabbed; | 1646 | return d->kbgrabbed; |
1645 | } | 1647 | } |
1646 | 1648 | ||
1647 | 1649 | ||
1648 | /*! | 1650 | /*! |
1649 | Reverses the effect of grabKeyboard(). This is called automatically | 1651 | Reverses the effect of grabKeyboard(). This is called automatically |
1650 | on program exit. | 1652 | on program exit. |
1651 | */ | 1653 | */ |
1652 | void QPEApplication::ungrabKeyboard() | 1654 | void QPEApplication::ungrabKeyboard() |
1653 | { | 1655 | { |
1654 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; | 1656 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; |
1655 | } | 1657 | } |
1656 | 1658 | ||
1657 | /*! | 1659 | /*! |
1658 | Grabs the physical keyboard keys, e.g. the application's launching | 1660 | Grabs the physical keyboard keys, e.g. the application's launching |
1659 | keys. Instead of launching applications when these keys are pressed | 1661 | keys. Instead of launching applications when these keys are pressed |
1660 | the signals emitted are sent to this application instead. Some games | 1662 | the signals emitted are sent to this application instead. Some games |
1661 | programs take over the launch keys in this way to make interaction | 1663 | programs take over the launch keys in this way to make interaction |
1662 | easier. | 1664 | easier. |
1663 | 1665 | ||
1664 | \sa ungrabKeyboard() | 1666 | \sa ungrabKeyboard() |
1665 | */ | 1667 | */ |
1666 | void QPEApplication::grabKeyboard() | 1668 | void QPEApplication::grabKeyboard() |
1667 | { | 1669 | { |
1668 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; | 1670 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; |
1669 | } | 1671 | } |
1670 | 1672 | ||
1671 | /*! | 1673 | /*! |
1672 | \reimp | 1674 | \reimp |
1673 | */ | 1675 | */ |
1674 | int QPEApplication::exec() | 1676 | int QPEApplication::exec() |
1675 | { | 1677 | { |
1676 | #ifndef QT_NO_COP | 1678 | #ifndef QT_NO_COP |
1677 | d->sendQCopQ(); | 1679 | d->sendQCopQ(); |
1678 | #endif | 1680 | #endif |
1679 | 1681 | ||
1680 | if ( d->keep_running ) | 1682 | if ( d->keep_running ) |
1681 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) | 1683 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) |
1682 | return QApplication::exec(); | 1684 | return QApplication::exec(); |
1683 | 1685 | ||
1684 | #ifndef QT_NO_COP | 1686 | #ifndef QT_NO_COP |
1685 | 1687 | ||
1686 | { | 1688 | { |
1687 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 1689 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
1688 | e << d->appName; | 1690 | e << d->appName; |
1689 | } | 1691 | } |
1690 | #endif | 1692 | #endif |
1691 | processEvents(); | 1693 | processEvents(); |
1692 | return 0; | 1694 | return 0; |
1693 | } | 1695 | } |
1694 | 1696 | ||
1695 | /*! | 1697 | /*! |
1696 | \internal | 1698 | \internal |
1697 | External request for application to quit. Quits if possible without | 1699 | External request for application to quit. Quits if possible without |
1698 | loosing state. | 1700 | loosing state. |
1699 | */ | 1701 | */ |
1700 | void QPEApplication::tryQuit() | 1702 | void QPEApplication::tryQuit() |
1701 | { | 1703 | { |
1702 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) | 1704 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) |
1703 | return ; // Inside modal loop or konsole. Too hard to save state. | 1705 | return ; // Inside modal loop or konsole. Too hard to save state. |
1704 | #ifndef QT_NO_COP | 1706 | #ifndef QT_NO_COP |
1705 | 1707 | ||
1706 | { | 1708 | { |
1707 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 1709 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
1708 | e << d->appName; | 1710 | e << d->appName; |
1709 | } | 1711 | } |
1710 | #endif | 1712 | #endif |
1711 | processEvents(); | 1713 | processEvents(); |
1712 | 1714 | ||
1713 | quit(); | 1715 | quit(); |
1714 | } | 1716 | } |
1715 | 1717 | ||
1716 | /*! | 1718 | /*! |
1717 | \internal | 1719 | \internal |
1718 | */ | 1720 | */ |
1719 | void QPEApplication::installTranslation( const QString& baseName ) { | 1721 | void QPEApplication::installTranslation( const QString& baseName ) { |
1720 | QTranslator* trans = new QTranslator(this); | 1722 | QTranslator* trans = new QTranslator(this); |
1721 | QString tfn = qpeDir() + "/i18n/"+baseName; | 1723 | QString tfn = qpeDir() + "/i18n/"+baseName; |
1722 | if ( trans->load( tfn ) ) | 1724 | if ( trans->load( tfn ) ) |
1723 | installTranslator( trans ); | 1725 | installTranslator( trans ); |
1724 | else | 1726 | else |
1725 | delete trans; | 1727 | delete trans; |
1726 | } | 1728 | } |
1727 | 1729 | ||
1728 | /*! | 1730 | /*! |
1729 | \internal | 1731 | \internal |
1730 | User initiated quit. Makes the window 'Go Away'. If preloaded this means | 1732 | User initiated quit. Makes the window 'Go Away'. If preloaded this means |
1731 | hiding the window. If not it means quitting the application. | 1733 | hiding the window. If not it means quitting the application. |
1732 | As this is user initiated we don't need to check state. | 1734 | As this is user initiated we don't need to check state. |
1733 | */ | 1735 | */ |
1734 | void QPEApplication::hideOrQuit() | 1736 | void QPEApplication::hideOrQuit() |
1735 | { | 1737 | { |
1736 | processEvents(); | 1738 | processEvents(); |
1737 | 1739 | ||
1738 | // If we are a preloaded application we don't actually quit, so emit | 1740 | // If we are a preloaded application we don't actually quit, so emit |
1739 | // a System message indicating we're quasi-closing. | 1741 | // a System message indicating we're quasi-closing. |
1740 | if ( d->preloaded && d->qpe_main_widget ) | 1742 | if ( d->preloaded && d->qpe_main_widget ) |
1741 | #ifndef QT_NO_COP | 1743 | #ifndef QT_NO_COP |
1742 | 1744 | ||
1743 | { | 1745 | { |
1744 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); | 1746 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); |
1745 | e << d->appName; | 1747 | e << d->appName; |
1746 | d->qpe_main_widget->hide(); | 1748 | d->qpe_main_widget->hide(); |
1747 | } | 1749 | } |
1748 | #endif | 1750 | #endif |
1749 | else | 1751 | else |
1750 | quit(); | 1752 | quit(); |
1751 | } | 1753 | } |
1752 | 1754 | ||
1753 | 1755 | ||
1754 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | 1756 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
1755 | 1757 | ||
1756 | // The libraries with the skiff package (and possibly others) have | 1758 | // The libraries with the skiff package (and possibly others) have |
1757 | // completely useless implementations of builtin new and delete that | 1759 | // completely useless implementations of builtin new and delete that |
1758 | // use about 50% of your CPU. Here we revert to the simple libc | 1760 | // use about 50% of your CPU. Here we revert to the simple libc |
1759 | // functions. | 1761 | // functions. |
1760 | 1762 | ||
1761 | void* operator new[]( size_t size ) | 1763 | void* operator new[]( size_t size ) |
1762 | { | 1764 | { |
1763 | return malloc( size ); | 1765 | return malloc( size ); |
1764 | } | 1766 | } |
1765 | 1767 | ||
1766 | void* operator new( size_t size ) | 1768 | void* operator new( size_t size ) |
1767 | { | 1769 | { |
1768 | return malloc( size ); | 1770 | return malloc( size ); |
1769 | } | 1771 | } |
1770 | 1772 | ||
1771 | void operator delete[]( void* p ) | 1773 | void operator delete[]( void* p ) |
1772 | { | 1774 | { |
1773 | free( p ); | 1775 | free( p ); |
1774 | } | 1776 | } |
1775 | 1777 | ||
1776 | void operator delete[]( void* p, size_t /*size*/ ) | 1778 | void operator delete[]( void* p, size_t /*size*/ ) |
1777 | { | 1779 | { |
1778 | free( p ); | 1780 | free( p ); |
1779 | } | 1781 | } |
1780 | 1782 | ||
1781 | 1783 | ||
1782 | void operator delete( void* p ) | 1784 | void operator delete( void* p ) |
1783 | { | 1785 | { |
1784 | free( p ); | 1786 | free( p ); |
1785 | } | 1787 | } |
1786 | 1788 | ||
1787 | void operator delete( void* p, size_t /*size*/ ) | 1789 | void operator delete( void* p, size_t /*size*/ ) |
1788 | { | 1790 | { |
1789 | free( p ); | 1791 | free( p ); |
1790 | } | 1792 | } |
1791 | 1793 | ||
1792 | #endif | 1794 | #endif |
1793 | 1795 | ||
1794 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) | 1796 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) |
1795 | #include <qwidgetlist.h> | 1797 | #include <qwidgetlist.h> |
1796 | #ifdef QWS | 1798 | #ifdef QWS |
1797 | #include <qgfx_qws.h> | 1799 | #include <qgfx_qws.h> |
1798 | extern QRect qt_maxWindowRect; | 1800 | extern QRect qt_maxWindowRect; |
1799 | void qt_setMaxWindowRect(const QRect& r ) | 1801 | void qt_setMaxWindowRect(const QRect& r ) |
1800 | { | 1802 | { |
1801 | qt_maxWindowRect = qt_screen->mapFromDevice( r, | 1803 | qt_maxWindowRect = qt_screen->mapFromDevice( r, |
1802 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); | 1804 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); |
1803 | // Re-resize any maximized windows | 1805 | // Re-resize any maximized windows |