-rw-r--r-- | library/qpeapplication.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 3ca6d73..c107a08 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -350,201 +350,202 @@ static void setMic( int t = 0, int percent = -1 ) | |||
350 | /*! | 350 | /*! |
351 | \fn void QPEApplication::clientMoused() | 351 | \fn void QPEApplication::clientMoused() |
352 | 352 | ||
353 | \internal | 353 | \internal |
354 | */ | 354 | */ |
355 | 355 | ||
356 | /*! | 356 | /*! |
357 | \fn void QPEApplication::timeChanged(); | 357 | \fn void QPEApplication::timeChanged(); |
358 | This signal is emitted when the time changes outside the normal | 358 | This signal is emitted when the time changes outside the normal |
359 | passage of time, i.e. if the time is set backwards or forwards. | 359 | passage of time, i.e. if the time is set backwards or forwards. |
360 | */ | 360 | */ |
361 | 361 | ||
362 | /*! | 362 | /*! |
363 | \fn void QPEApplication::clockChanged( bool ampm ); | 363 | \fn void QPEApplication::clockChanged( bool ampm ); |
364 | 364 | ||
365 | This signal is emitted when the user changes the clock's style. If | 365 | This signal is emitted when the user changes the clock's style. If |
366 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 366 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
367 | they want a 24-hour clock. | 367 | they want a 24-hour clock. |
368 | */ | 368 | */ |
369 | 369 | ||
370 | /*! | 370 | /*! |
371 | \fn void QPEApplication::volumeChanged( bool muted ) | 371 | \fn void QPEApplication::volumeChanged( bool muted ) |
372 | 372 | ||
373 | This signal is emitted whenever the mute state is changed. If \a | 373 | This signal is emitted whenever the mute state is changed. If \a |
374 | muted is TRUE, then sound output has been muted. | 374 | muted is TRUE, then sound output has been muted. |
375 | */ | 375 | */ |
376 | 376 | ||
377 | /*! | 377 | /*! |
378 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 378 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
379 | 379 | ||
380 | This signal is emitted if the week start day is changed. If \a | 380 | This signal is emitted if the week start day is changed. If \a |
381 | startOnMonday is TRUE then the first day of the week is Monday; if | 381 | startOnMonday is TRUE then the first day of the week is Monday; if |
382 | \a startOnMonday is FALSE then the first day of the week is | 382 | \a startOnMonday is FALSE then the first day of the week is |
383 | Sunday. | 383 | Sunday. |
384 | */ | 384 | */ |
385 | 385 | ||
386 | /*! | 386 | /*! |
387 | \fn void QPEApplication::dateFormatChanged() | 387 | \fn void QPEApplication::dateFormatChanged() |
388 | 388 | ||
389 | This signal is emitted whenever the date format is changed. | 389 | This signal is emitted whenever the date format is changed. |
390 | */ | 390 | */ |
391 | 391 | ||
392 | /*! | 392 | /*! |
393 | \fn void QPEApplication::flush() | 393 | \fn void QPEApplication::flush() |
394 | 394 | ||
395 | ### | 395 | ### |
396 | */ | 396 | */ |
397 | 397 | ||
398 | /*! | 398 | /*! |
399 | \fn void QPEApplication::reload() | 399 | \fn void QPEApplication::reload() |
400 | 400 | ||
401 | */ | 401 | */ |
402 | 402 | ||
403 | /*! | 403 | /*! |
404 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 404 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
405 | 405 | ||
406 | This signal is emitted when a message is received on this | 406 | This signal is emitted when a message is received on this |
407 | application's QPE/Application/<i>appname</i> \link qcop.html | 407 | application's QPE/Application/<i>appname</i> \link qcop.html |
408 | QCop\endlink channel. | 408 | QCop\endlink channel. |
409 | 409 | ||
410 | The slot to which you connect this signal uses \a msg and \a data | 410 | The slot to which you connect this signal uses \a msg and \a data |
411 | in the following way: | 411 | in the following way: |
412 | 412 | ||
413 | \code | 413 | \code |
414 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 414 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
415 | { | 415 | { |
416 | QDataStream stream( data, IO_ReadOnly ); | 416 | QDataStream stream( data, IO_ReadOnly ); |
417 | if ( msg == "someMessage(int,int,int)" ) { | 417 | if ( msg == "someMessage(int,int,int)" ) { |
418 | int a,b,c; | 418 | int a,b,c; |
419 | stream >> a >> b >> c; | 419 | stream >> a >> b >> c; |
420 | ... | 420 | ... |
421 | } else if ( msg == "otherMessage(QString)" ) { | 421 | } else if ( msg == "otherMessage(QString)" ) { |
422 | ... | 422 | ... |
423 | } | 423 | } |
424 | } | 424 | } |
425 | \endcode | 425 | \endcode |
426 | 426 | ||
427 | \sa qcop.html | 427 | \sa qcop.html |
428 | Note that messages received here may be processed by qpe application | 428 | Note that messages received here may be processed by qpe application |
429 | and emitted as signals, such as flush() and reload(). | 429 | and emitted as signals, such as flush() and reload(). |
430 | */ | 430 | */ |
431 | 431 | ||
432 | /*! | 432 | /*! |
433 | Constructs a QPEApplication just as you would construct | 433 | Constructs a QPEApplication just as you would construct |
434 | a QApplication, passing \a argc, \a argv, and \a t. | 434 | a QApplication, passing \a argc, \a argv, and \a t. |
435 | 435 | ||
436 | For applications, \a t should be the default, GuiClient. Only | 436 | For applications, \a t should be the default, GuiClient. Only |
437 | the Qtopia server passes GuiServer. | 437 | the Qtopia server passes GuiServer. |
438 | */ | 438 | */ |
439 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 439 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
440 | : QApplication( argc, argv, t ) | 440 | : QApplication( argc, argv, t ) |
441 | { | 441 | { |
442 | d = new QPEApplicationData; | 442 | d = new QPEApplicationData; |
443 | d->loadTextCodecs(); | 443 | d->loadTextCodecs(); |
444 | d->loadImageCodecs(); | 444 | d->loadImageCodecs(); |
445 | int dw = desktop() ->width(); | 445 | int dw = desktop() ->width(); |
446 | qWarning( "Width %d", dw ); | ||
446 | if ( dw < 200 ) { | 447 | if ( dw < 200 ) { |
447 | setFont( QFont( "helvetica", 8 ) ); | 448 | setFont( QFont( "helvetica", 8 ) ); |
448 | AppLnk::setSmallIconSize( 10 ); | 449 | AppLnk::setSmallIconSize( 10 ); |
449 | AppLnk::setBigIconSize( 28 ); | 450 | AppLnk::setBigIconSize( 28 ); |
450 | }else if ( dw > 600 ) { | 451 | }else if ( dw > 600 ) { |
451 | setFont( QFont( "helvetica", 12 ) ); | 452 | setFont( QFont( "helvetica", 12 ) ); |
452 | AppLnk::setSmallIconSize( 24 ); | 453 | AppLnk::setSmallIconSize( 24 ); |
453 | AppLnk::setBigIconSize( 48 ); | 454 | AppLnk::setBigIconSize( 48 ); |
454 | }else if ( dw > 400 ) { | 455 | }else if ( dw > 200 ) { |
455 | setFont( QFont( "helvetica", 12 ) ); | 456 | setFont( QFont( "helvetica", 12 ) ); |
456 | AppLnk::setSmallIconSize( 16 ); | 457 | AppLnk::setSmallIconSize( 16 ); |
457 | AppLnk::setBigIconSize( 32 ); | 458 | AppLnk::setBigIconSize( 32 ); |
458 | } | 459 | } |
459 | 460 | ||
460 | 461 | ||
461 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 462 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
462 | 463 | ||
463 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 464 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
464 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 465 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
465 | 466 | ||
466 | QString qcopfn( "/tmp/qcop-msg-" ); | 467 | QString qcopfn( "/tmp/qcop-msg-" ); |
467 | qcopfn += QString( argv[ 0 ] ); // append command name | 468 | qcopfn += QString( argv[ 0 ] ); // append command name |
468 | 469 | ||
469 | QFile f( qcopfn ); | 470 | QFile f( qcopfn ); |
470 | if ( f.open( IO_ReadOnly ) ) { | 471 | if ( f.open( IO_ReadOnly ) ) { |
471 | flock( f.handle(), LOCK_EX ); | 472 | flock( f.handle(), LOCK_EX ); |
472 | } | 473 | } |
473 | 474 | ||
474 | sysChannel = new QCopChannel( "QPE/System", this ); | 475 | sysChannel = new QCopChannel( "QPE/System", this ); |
475 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 476 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
476 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 477 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); |
477 | 478 | ||
478 | QCString channel = QCString( argv[ 0 ] ); | 479 | QCString channel = QCString( argv[ 0 ] ); |
479 | channel.replace( QRegExp( ".*/" ), "" ); | 480 | channel.replace( QRegExp( ".*/" ), "" ); |
480 | d->appName = channel; | 481 | d->appName = channel; |
481 | channel = "QPE/Application/" + channel; | 482 | channel = "QPE/Application/" + channel; |
482 | pidChannel = new QCopChannel( channel, this ); | 483 | pidChannel = new QCopChannel( channel, this ); |
483 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 484 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
484 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 485 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); |
485 | 486 | ||
486 | if ( f.isOpen() ) { | 487 | if ( f.isOpen() ) { |
487 | d->keep_running = FALSE; | 488 | d->keep_running = FALSE; |
488 | QDataStream ds( &f ); | 489 | QDataStream ds( &f ); |
489 | QCString channel, message; | 490 | QCString channel, message; |
490 | QByteArray data; | 491 | QByteArray data; |
491 | while ( !ds.atEnd() ) { | 492 | while ( !ds.atEnd() ) { |
492 | ds >> channel >> message >> data; | 493 | ds >> channel >> message >> data; |
493 | d->enqueueQCop( channel, message, data ); | 494 | d->enqueueQCop( channel, message, data ); |
494 | } | 495 | } |
495 | 496 | ||
496 | flock( f.handle(), LOCK_UN ); | 497 | flock( f.handle(), LOCK_UN ); |
497 | f.close(); | 498 | f.close(); |
498 | f.remove(); | 499 | f.remove(); |
499 | } | 500 | } |
500 | 501 | ||
501 | for ( int a = 0; a < argc; a++ ) { | 502 | for ( int a = 0; a < argc; a++ ) { |
502 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 503 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
503 | argv[ a ] = argv[ a + 1 ]; | 504 | argv[ a ] = argv[ a + 1 ]; |
504 | a++; | 505 | a++; |
505 | d->preloaded = TRUE; | 506 | d->preloaded = TRUE; |
506 | argc -= 1; | 507 | argc -= 1; |
507 | } | 508 | } |
508 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { | 509 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { |
509 | argv[ a ] = argv[ a + 1 ]; | 510 | argv[ a ] = argv[ a + 1 ]; |
510 | a++; | 511 | a++; |
511 | d->preloaded = TRUE; | 512 | d->preloaded = TRUE; |
512 | d->forceshow = TRUE; | 513 | d->forceshow = TRUE; |
513 | argc -= 1; | 514 | argc -= 1; |
514 | } | 515 | } |
515 | } | 516 | } |
516 | 517 | ||
517 | /* overide stored arguments */ | 518 | /* overide stored arguments */ |
518 | setArgs( argc, argv ); | 519 | setArgs( argc, argv ); |
519 | 520 | ||
520 | #endif | 521 | #endif |
521 | 522 | ||
522 | //qwsSetDecoration( new QPEDecoration() ); | 523 | //qwsSetDecoration( new QPEDecoration() ); |
523 | 524 | ||
524 | #ifndef QT_NO_TRANSLATION | 525 | #ifndef QT_NO_TRANSLATION |
525 | 526 | ||
526 | QStringList langs = Global::languageList(); | 527 | QStringList langs = Global::languageList(); |
527 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { | 528 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { |
528 | QString lang = *it; | 529 | QString lang = *it; |
529 | 530 | ||
530 | QTranslator * trans; | 531 | QTranslator * trans; |
531 | QString tfn; | 532 | QString tfn; |
532 | 533 | ||
533 | trans = new QTranslator( this ); | 534 | trans = new QTranslator( this ); |
534 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; | 535 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; |
535 | if ( trans->load( tfn ) ) | 536 | if ( trans->load( tfn ) ) |
536 | installTranslator( trans ); | 537 | installTranslator( trans ); |
537 | else | 538 | else |
538 | delete trans; | 539 | delete trans; |
539 | 540 | ||
540 | trans = new QTranslator( this ); | 541 | trans = new QTranslator( this ); |
541 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; | 542 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; |
542 | if ( trans->load( tfn ) ) | 543 | if ( trans->load( tfn ) ) |
543 | installTranslator( trans ); | 544 | installTranslator( trans ); |
544 | else | 545 | else |
545 | delete trans; | 546 | delete trans; |
546 | 547 | ||
547 | //###language/font hack; should look it up somewhere | 548 | //###language/font hack; should look it up somewhere |
548 | #ifdef QWS | 549 | #ifdef QWS |
549 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 550 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
550 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 551 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |