-rw-r--r-- | library/qpeapplication.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 2432b65..65fac84 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -352,257 +352,257 @@ static void setMic( int t = 0, int percent = -1 ) | |||
352 | a \link qcop.html QCop\endlink message on the application's | 352 | a \link qcop.html QCop\endlink message on the application's |
353 | QPE/Application/\e{appname} channel, the appMessage() signal is | 353 | QPE/Application/\e{appname} channel, the appMessage() signal is |
354 | emitted. There are also flush() and reload() signals, which | 354 | emitted. There are also flush() and reload() signals, which |
355 | are emitted when synching begins and ends respectively - upon these | 355 | are emitted when synching begins and ends respectively - upon these |
356 | signals, the application should save and reload any data | 356 | signals, the application should save and reload any data |
357 | files that are involved in synching. Most of these signals will initially | 357 | files that are involved in synching. Most of these signals will initially |
358 | be received and unfiltered through the appMessage() signal. | 358 | be received and unfiltered through the appMessage() signal. |
359 | 359 | ||
360 | This class also provides a set of useful static functions. The | 360 | This class also provides a set of useful static functions. The |
361 | qpeDir() and documentDir() functions return the respective paths. | 361 | qpeDir() and documentDir() functions return the respective paths. |
362 | The grabKeyboard() and ungrabKeyboard() functions are used to | 362 | The grabKeyboard() and ungrabKeyboard() functions are used to |
363 | control whether the application takes control of the device's | 363 | control whether the application takes control of the device's |
364 | physical buttons (e.g. application launch keys). The stylus' mode of | 364 | physical buttons (e.g. application launch keys). The stylus' mode of |
365 | operation is set with setStylusOperation() and retrieved with | 365 | operation is set with setStylusOperation() and retrieved with |
366 | stylusOperation(). There are also setInputMethodHint() and | 366 | stylusOperation(). There are also setInputMethodHint() and |
367 | inputMethodHint() functions. | 367 | inputMethodHint() functions. |
368 | 368 | ||
369 | \ingroup qtopiaemb | 369 | \ingroup qtopiaemb |
370 | */ | 370 | */ |
371 | 371 | ||
372 | /*! | 372 | /*! |
373 | \fn void QPEApplication::clientMoused() | 373 | \fn void QPEApplication::clientMoused() |
374 | 374 | ||
375 | \internal | 375 | \internal |
376 | */ | 376 | */ |
377 | 377 | ||
378 | /*! | 378 | /*! |
379 | \fn void QPEApplication::timeChanged(); | 379 | \fn void QPEApplication::timeChanged(); |
380 | This signal is emitted when the time changes outside the normal | 380 | This signal is emitted when the time changes outside the normal |
381 | passage of time, i.e. if the time is set backwards or forwards. | 381 | passage of time, i.e. if the time is set backwards or forwards. |
382 | */ | 382 | */ |
383 | 383 | ||
384 | /*! | 384 | /*! |
385 | \fn void QPEApplication::clockChanged( bool ampm ); | 385 | \fn void QPEApplication::clockChanged( bool ampm ); |
386 | 386 | ||
387 | This signal is emitted when the user changes the clock's style. If | 387 | This signal is emitted when the user changes the clock's style. If |
388 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 388 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
389 | they want a 24-hour clock. | 389 | they want a 24-hour clock. |
390 | */ | 390 | */ |
391 | 391 | ||
392 | /*! | 392 | /*! |
393 | \fn void QPEApplication::volumeChanged( bool muted ) | 393 | \fn void QPEApplication::volumeChanged( bool muted ) |
394 | 394 | ||
395 | This signal is emitted whenever the mute state is changed. If \a | 395 | This signal is emitted whenever the mute state is changed. If \a |
396 | muted is TRUE, then sound output has been muted. | 396 | muted is TRUE, then sound output has been muted. |
397 | */ | 397 | */ |
398 | 398 | ||
399 | /*! | 399 | /*! |
400 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 400 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
401 | 401 | ||
402 | This signal is emitted if the week start day is changed. If \a | 402 | This signal is emitted if the week start day is changed. If \a |
403 | startOnMonday is TRUE then the first day of the week is Monday; if | 403 | startOnMonday is TRUE then the first day of the week is Monday; if |
404 | \a startOnMonday is FALSE then the first day of the week is | 404 | \a startOnMonday is FALSE then the first day of the week is |
405 | Sunday. | 405 | Sunday. |
406 | */ | 406 | */ |
407 | 407 | ||
408 | /*! | 408 | /*! |
409 | \fn void QPEApplication::dateFormatChanged() | 409 | \fn void QPEApplication::dateFormatChanged() |
410 | 410 | ||
411 | This signal is emitted whenever the date format is changed. | 411 | This signal is emitted whenever the date format is changed. |
412 | */ | 412 | */ |
413 | 413 | ||
414 | /*! | 414 | /*! |
415 | \fn void QPEApplication::flush() | 415 | \fn void QPEApplication::flush() |
416 | 416 | ||
417 | ### | 417 | ### |
418 | */ | 418 | */ |
419 | 419 | ||
420 | /*! | 420 | /*! |
421 | \fn void QPEApplication::reload() | 421 | \fn void QPEApplication::reload() |
422 | 422 | ||
423 | */ | 423 | */ |
424 | 424 | ||
425 | /*! | 425 | /*! |
426 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 426 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
427 | 427 | ||
428 | This signal is emitted when a message is received on this | 428 | This signal is emitted when a message is received on this |
429 | application's QPE/Application/<i>appname</i> \link qcop.html | 429 | application's QPE/Application/<i>appname</i> \link qcop.html |
430 | QCop\endlink channel. | 430 | QCop\endlink channel. |
431 | 431 | ||
432 | The slot to which you connect this signal uses \a msg and \a data | 432 | The slot to which you connect this signal uses \a msg and \a data |
433 | in the following way: | 433 | in the following way: |
434 | 434 | ||
435 | \code | 435 | \code |
436 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 436 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
437 | { | 437 | { |
438 | QDataStream stream( data, IO_ReadOnly ); | 438 | QDataStream stream( data, IO_ReadOnly ); |
439 | if ( msg == "someMessage(int,int,int)" ) { | 439 | if ( msg == "someMessage(int,int,int)" ) { |
440 | int a,b,c; | 440 | int a,b,c; |
441 | stream >> a >> b >> c; | 441 | stream >> a >> b >> c; |
442 | ... | 442 | ... |
443 | } else if ( msg == "otherMessage(QString)" ) { | 443 | } else if ( msg == "otherMessage(QString)" ) { |
444 | ... | 444 | ... |
445 | } | 445 | } |
446 | } | 446 | } |
447 | \endcode | 447 | \endcode |
448 | 448 | ||
449 | \sa qcop.html | 449 | \sa qcop.html |
450 | Note that messages received here may be processed by qpe application | 450 | Note that messages received here may be processed by qpe application |
451 | and emitted as signals, such as flush() and reload(). | 451 | and emitted as signals, such as flush() and reload(). |
452 | */ | 452 | */ |
453 | 453 | ||
454 | /*! | 454 | /*! |
455 | Constructs a QPEApplication just as you would construct | 455 | Constructs a QPEApplication just as you would construct |
456 | a QApplication, passing \a argc, \a argv, and \a t. | 456 | a QApplication, passing \a argc, \a argv, and \a t. |
457 | 457 | ||
458 | For applications, \a t should be the default, GuiClient. Only | 458 | For applications, \a t should be the default, GuiClient. Only |
459 | the Qtopia server passes GuiServer. | 459 | the Qtopia server passes GuiServer. |
460 | */ | 460 | */ |
461 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 461 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
462 | : QApplication( argc, argv, t ) | 462 | : QApplication( argc, argv, t ) |
463 | { | 463 | { |
464 | d = new QPEApplicationData; | 464 | d = new QPEApplicationData; |
465 | d->loadTextCodecs(); | 465 | d->loadTextCodecs(); |
466 | d->loadImageCodecs(); | 466 | d->loadImageCodecs(); |
467 | int dw = desktop() ->width(); | 467 | int dw = desktop() ->width(); |
468 | qWarning( "Width %d", dw ); | 468 | qWarning( "Width %d", dw ); |
469 | if ( dw < 200 ) { | 469 | if ( dw < 200 ) { |
470 | setFont( QFont( "helvetica", 8 ) ); | 470 | setFont( QFont( "helvetica", 8 ) ); |
471 | AppLnk::setSmallIconSize( 10 ); | 471 | AppLnk::setSmallIconSize( 10 ); |
472 | AppLnk::setBigIconSize( 28 ); | 472 | AppLnk::setBigIconSize( 28 ); |
473 | } | 473 | } |
474 | else if ( dw > 600 ) { | 474 | else if ( dw > 600 ) { |
475 | setFont( QFont( "helvetica", 12 ) ); | 475 | setFont( QFont( "helvetica", 12 ) ); |
476 | AppLnk::setSmallIconSize( 24 ); | 476 | AppLnk::setSmallIconSize( 24 ); |
477 | AppLnk::setBigIconSize( 48 ); | 477 | AppLnk::setBigIconSize( 48 ); |
478 | } | 478 | } |
479 | else if ( dw > 200 ) { | 479 | else if ( dw > 200 ) { |
480 | setFont( QFont( "helvetica", 12 ) ); | 480 | setFont( QFont( "helvetica", 10 ) ); |
481 | AppLnk::setSmallIconSize( 16 ); | 481 | AppLnk::setSmallIconSize( 16 ); |
482 | AppLnk::setBigIconSize( 32 ); | 482 | AppLnk::setBigIconSize( 32 ); |
483 | } | 483 | } |
484 | 484 | ||
485 | 485 | ||
486 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 486 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
487 | 487 | ||
488 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 488 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
489 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 489 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
490 | 490 | ||
491 | QString qcopfn( "/tmp/qcop-msg-" ); | 491 | QString qcopfn( "/tmp/qcop-msg-" ); |
492 | qcopfn += QString( argv[ 0 ] ); // append command name | 492 | qcopfn += QString( argv[ 0 ] ); // append command name |
493 | 493 | ||
494 | QFile f( qcopfn ); | 494 | QFile f( qcopfn ); |
495 | if ( f.open( IO_ReadOnly ) ) { | 495 | if ( f.open( IO_ReadOnly ) ) { |
496 | flock( f.handle(), LOCK_EX ); | 496 | flock( f.handle(), LOCK_EX ); |
497 | } | 497 | } |
498 | 498 | ||
499 | sysChannel = new QCopChannel( "QPE/System", this ); | 499 | sysChannel = new QCopChannel( "QPE/System", this ); |
500 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 500 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
501 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 501 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); |
502 | 502 | ||
503 | QCString channel = QCString( argv[ 0 ] ); | 503 | QCString channel = QCString( argv[ 0 ] ); |
504 | channel.replace( QRegExp( ".*/" ), "" ); | 504 | channel.replace( QRegExp( ".*/" ), "" ); |
505 | d->appName = channel; | 505 | d->appName = channel; |
506 | channel = "QPE/Application/" + channel; | 506 | channel = "QPE/Application/" + channel; |
507 | pidChannel = new QCopChannel( channel, this ); | 507 | pidChannel = new QCopChannel( channel, this ); |
508 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 508 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
509 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 509 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); |
510 | 510 | ||
511 | if ( f.isOpen() ) { | 511 | if ( f.isOpen() ) { |
512 | d->keep_running = FALSE; | 512 | d->keep_running = FALSE; |
513 | QDataStream ds( &f ); | 513 | QDataStream ds( &f ); |
514 | QCString channel, message; | 514 | QCString channel, message; |
515 | QByteArray data; | 515 | QByteArray data; |
516 | while ( !ds.atEnd() ) { | 516 | while ( !ds.atEnd() ) { |
517 | ds >> channel >> message >> data; | 517 | ds >> channel >> message >> data; |
518 | d->enqueueQCop( channel, message, data ); | 518 | d->enqueueQCop( channel, message, data ); |
519 | } | 519 | } |
520 | 520 | ||
521 | flock( f.handle(), LOCK_UN ); | 521 | flock( f.handle(), LOCK_UN ); |
522 | f.close(); | 522 | f.close(); |
523 | f.remove(); | 523 | f.remove(); |
524 | } | 524 | } |
525 | 525 | ||
526 | for ( int a = 0; a < argc; a++ ) { | 526 | for ( int a = 0; a < argc; a++ ) { |
527 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 527 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
528 | argv[ a ] = argv[ a + 1 ]; | 528 | argv[ a ] = argv[ a + 1 ]; |
529 | a++; | 529 | a++; |
530 | d->preloaded = TRUE; | 530 | d->preloaded = TRUE; |
531 | argc -= 1; | 531 | argc -= 1; |
532 | } | 532 | } |
533 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { | 533 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { |
534 | argv[ a ] = argv[ a + 1 ]; | 534 | argv[ a ] = argv[ a + 1 ]; |
535 | a++; | 535 | a++; |
536 | d->preloaded = TRUE; | 536 | d->preloaded = TRUE; |
537 | d->forceshow = TRUE; | 537 | d->forceshow = TRUE; |
538 | argc -= 1; | 538 | argc -= 1; |
539 | } | 539 | } |
540 | } | 540 | } |
541 | 541 | ||
542 | /* overide stored arguments */ | 542 | /* overide stored arguments */ |
543 | setArgs( argc, argv ); | 543 | setArgs( argc, argv ); |
544 | 544 | ||
545 | #endif | 545 | #endif |
546 | 546 | ||
547 | // qwsSetDecoration( new QPEDecoration() ); | 547 | // qwsSetDecoration( new QPEDecoration() ); |
548 | 548 | ||
549 | #ifndef QT_NO_TRANSLATION | 549 | #ifndef QT_NO_TRANSLATION |
550 | 550 | ||
551 | QStringList langs = Global::languageList(); | 551 | QStringList langs = Global::languageList(); |
552 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { | 552 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { |
553 | QString lang = *it; | 553 | QString lang = *it; |
554 | 554 | ||
555 | QTranslator * trans; | 555 | QTranslator * trans; |
556 | QString tfn; | 556 | QString tfn; |
557 | 557 | ||
558 | trans = new QTranslator( this ); | 558 | trans = new QTranslator( this ); |
559 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; | 559 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; |
560 | if ( trans->load( tfn ) ) | 560 | if ( trans->load( tfn ) ) |
561 | installTranslator( trans ); | 561 | installTranslator( trans ); |
562 | else | 562 | else |
563 | delete trans; | 563 | delete trans; |
564 | 564 | ||
565 | trans = new QTranslator( this ); | 565 | trans = new QTranslator( this ); |
566 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; | 566 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; |
567 | if ( trans->load( tfn ) ) | 567 | if ( trans->load( tfn ) ) |
568 | installTranslator( trans ); | 568 | installTranslator( trans ); |
569 | else | 569 | else |
570 | delete trans; | 570 | delete trans; |
571 | 571 | ||
572 | //###language/font hack; should look it up somewhere | 572 | //###language/font hack; should look it up somewhere |
573 | #ifdef QWS | 573 | #ifdef QWS |
574 | 574 | ||
575 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 575 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
576 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 576 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
577 | setFont( fn ); | 577 | setFont( fn ); |
578 | } | 578 | } |
579 | #endif | 579 | #endif |
580 | 580 | ||
581 | } | 581 | } |
582 | #endif | 582 | #endif |
583 | 583 | ||
584 | applyStyle(); | 584 | applyStyle(); |
585 | 585 | ||
586 | if ( type() == GuiServer ) { | 586 | if ( type() == GuiServer ) { |
587 | setVolume(); | 587 | setVolume(); |
588 | } | 588 | } |
589 | 589 | ||
590 | installEventFilter( this ); | 590 | installEventFilter( this ); |
591 | 591 | ||
592 | QPEMenuToolFocusManager::initialize(); | 592 | QPEMenuToolFocusManager::initialize(); |
593 | 593 | ||
594 | #ifdef QT_NO_QWS_CURSOR | 594 | #ifdef QT_NO_QWS_CURSOR |
595 | // if we have no cursor, probably don't want tooltips | 595 | // if we have no cursor, probably don't want tooltips |
596 | QToolTip::setEnabled( FALSE ); | 596 | QToolTip::setEnabled( FALSE ); |
597 | #endif | 597 | #endif |
598 | } | 598 | } |
599 | 599 | ||
600 | static QPtrDict<void>* inputMethodDict = 0; | 600 | static QPtrDict<void>* inputMethodDict = 0; |
601 | static void createInputMethodDict() | 601 | static void createInputMethodDict() |
602 | { | 602 | { |
603 | if ( !inputMethodDict ) | 603 | if ( !inputMethodDict ) |
604 | inputMethodDict = new QPtrDict<void>; | 604 | inputMethodDict = new QPtrDict<void>; |
605 | } | 605 | } |
606 | 606 | ||
607 | /*! | 607 | /*! |
608 | Returns the currently set hint to the system as to whether | 608 | Returns the currently set hint to the system as to whether |