-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 cd1c62e..d4734ae 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -401,385 +401,385 @@ static void setTreble( int t = 0, int percent = -1 ) | |||
401 | case 0: { | 401 | case 0: { |
402 | Config cfg( "qpe" ); | 402 | Config cfg( "qpe" ); |
403 | cfg.setGroup( "Volume" ); | 403 | cfg.setGroup( "Volume" ); |
404 | if ( percent < 0 ) | 404 | if ( percent < 0 ) |
405 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | 405 | percent = cfg.readNumEntry( "TreblePercent", 50 ); |
406 | 406 | ||
407 | int fd = 0; | 407 | int fd = 0; |
408 | int treble = percent; | 408 | int treble = percent; |
409 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 409 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
410 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | 410 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); |
411 | ::close( fd ); | 411 | ::close( fd ); |
412 | } | 412 | } |
413 | } | 413 | } |
414 | break; | 414 | break; |
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | 418 | ||
419 | /*! | 419 | /*! |
420 | \class QPEApplication qpeapplication.h | 420 | \class QPEApplication qpeapplication.h |
421 | \brief The QPEApplication class implements various system services | 421 | \brief The QPEApplication class implements various system services |
422 | that are available to all Qtopia applications. | 422 | that are available to all Qtopia applications. |
423 | 423 | ||
424 | Simply by using QPEApplication instead of QApplication, a standard Qt | 424 | Simply by using QPEApplication instead of QApplication, a standard Qt |
425 | application becomes a Qtopia application. It automatically follows | 425 | application becomes a Qtopia application. It automatically follows |
426 | style changes, quits and raises, and in the | 426 | style changes, quits and raises, and in the |
427 | case of \link docwidget.html document-oriented\endlink applications, | 427 | case of \link docwidget.html document-oriented\endlink applications, |
428 | changes the currently displayed document in response to the environment. | 428 | changes the currently displayed document in response to the environment. |
429 | 429 | ||
430 | To create a \link docwidget.html document-oriented\endlink | 430 | To create a \link docwidget.html document-oriented\endlink |
431 | application use showMainDocumentWidget(); to create a | 431 | application use showMainDocumentWidget(); to create a |
432 | non-document-oriented application use showMainWidget(). The | 432 | non-document-oriented application use showMainWidget(). The |
433 | keepRunning() function indicates whether the application will | 433 | keepRunning() function indicates whether the application will |
434 | continue running after it's processed the last \link qcop.html | 434 | continue running after it's processed the last \link qcop.html |
435 | QCop\endlink message. This can be changed using setKeepRunning(). | 435 | QCop\endlink message. This can be changed using setKeepRunning(). |
436 | 436 | ||
437 | A variety of signals are emitted when certain events occur, for | 437 | A variety of signals are emitted when certain events occur, for |
438 | example, timeChanged(), clockChanged(), weekChanged(), | 438 | example, timeChanged(), clockChanged(), weekChanged(), |
439 | dateFormatChanged() and volumeChanged(). If the application receives | 439 | dateFormatChanged() and volumeChanged(). If the application receives |
440 | a \link qcop.html QCop\endlink message on the application's | 440 | a \link qcop.html QCop\endlink message on the application's |
441 | QPE/Application/\e{appname} channel, the appMessage() signal is | 441 | QPE/Application/\e{appname} channel, the appMessage() signal is |
442 | emitted. There are also flush() and reload() signals, which | 442 | emitted. There are also flush() and reload() signals, which |
443 | are emitted when synching begins and ends respectively - upon these | 443 | are emitted when synching begins and ends respectively - upon these |
444 | signals, the application should save and reload any data | 444 | signals, the application should save and reload any data |
445 | files that are involved in synching. Most of these signals will initially | 445 | files that are involved in synching. Most of these signals will initially |
446 | be received and unfiltered through the appMessage() signal. | 446 | be received and unfiltered through the appMessage() signal. |
447 | 447 | ||
448 | This class also provides a set of useful static functions. The | 448 | This class also provides a set of useful static functions. The |
449 | qpeDir() and documentDir() functions return the respective paths. | 449 | qpeDir() and documentDir() functions return the respective paths. |
450 | The grabKeyboard() and ungrabKeyboard() functions are used to | 450 | The grabKeyboard() and ungrabKeyboard() functions are used to |
451 | control whether the application takes control of the device's | 451 | control whether the application takes control of the device's |
452 | physical buttons (e.g. application launch keys). The stylus' mode of | 452 | physical buttons (e.g. application launch keys). The stylus' mode of |
453 | operation is set with setStylusOperation() and retrieved with | 453 | operation is set with setStylusOperation() and retrieved with |
454 | stylusOperation(). There are also setInputMethodHint() and | 454 | stylusOperation(). There are also setInputMethodHint() and |
455 | inputMethodHint() functions. | 455 | inputMethodHint() functions. |
456 | 456 | ||
457 | \ingroup qtopiaemb | 457 | \ingroup qtopiaemb |
458 | */ | 458 | */ |
459 | 459 | ||
460 | /*! | 460 | /*! |
461 | \fn void QPEApplication::clientMoused() | 461 | \fn void QPEApplication::clientMoused() |
462 | 462 | ||
463 | \internal | 463 | \internal |
464 | */ | 464 | */ |
465 | 465 | ||
466 | /*! | 466 | /*! |
467 | \fn void QPEApplication::timeChanged(); | 467 | \fn void QPEApplication::timeChanged(); |
468 | This signal is emitted when the time changes outside the normal | 468 | This signal is emitted when the time changes outside the normal |
469 | passage of time, i.e. if the time is set backwards or forwards. | 469 | passage of time, i.e. if the time is set backwards or forwards. |
470 | */ | 470 | */ |
471 | 471 | ||
472 | /*! | 472 | /*! |
473 | \fn void QPEApplication::clockChanged( bool ampm ); | 473 | \fn void QPEApplication::clockChanged( bool ampm ); |
474 | 474 | ||
475 | This signal is emitted when the user changes the clock's style. If | 475 | This signal is emitted when the user changes the clock's style. If |
476 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 476 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
477 | they want a 24-hour clock. | 477 | they want a 24-hour clock. |
478 | */ | 478 | */ |
479 | 479 | ||
480 | /*! | 480 | /*! |
481 | \fn void QPEApplication::volumeChanged( bool muted ) | 481 | \fn void QPEApplication::volumeChanged( bool muted ) |
482 | 482 | ||
483 | This signal is emitted whenever the mute state is changed. If \a | 483 | This signal is emitted whenever the mute state is changed. If \a |
484 | muted is TRUE, then sound output has been muted. | 484 | muted is TRUE, then sound output has been muted. |
485 | */ | 485 | */ |
486 | 486 | ||
487 | /*! | 487 | /*! |
488 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 488 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
489 | 489 | ||
490 | This signal is emitted if the week start day is changed. If \a | 490 | This signal is emitted if the week start day is changed. If \a |
491 | startOnMonday is TRUE then the first day of the week is Monday; if | 491 | startOnMonday is TRUE then the first day of the week is Monday; if |
492 | \a startOnMonday is FALSE then the first day of the week is | 492 | \a startOnMonday is FALSE then the first day of the week is |
493 | Sunday. | 493 | Sunday. |
494 | */ | 494 | */ |
495 | 495 | ||
496 | /*! | 496 | /*! |
497 | \fn void QPEApplication::dateFormatChanged(DateFormat) | 497 | \fn void QPEApplication::dateFormatChanged(DateFormat) |
498 | 498 | ||
499 | This signal is emitted whenever the date format is changed. | 499 | This signal is emitted whenever the date format is changed. |
500 | */ | 500 | */ |
501 | 501 | ||
502 | /*! | 502 | /*! |
503 | \fn void QPEApplication::flush() | 503 | \fn void QPEApplication::flush() |
504 | 504 | ||
505 | ### | 505 | ### |
506 | */ | 506 | */ |
507 | 507 | ||
508 | /*! | 508 | /*! |
509 | \fn void QPEApplication::reload() | 509 | \fn void QPEApplication::reload() |
510 | 510 | ||
511 | */ | 511 | */ |
512 | 512 | ||
513 | 513 | ||
514 | 514 | ||
515 | void QPEApplication::processQCopFile() | 515 | void QPEApplication::processQCopFile() |
516 | { | 516 | { |
517 | QString qcopfn("/tmp/qcop-msg-"); | 517 | QString qcopfn("/tmp/qcop-msg-"); |
518 | qcopfn += d->appName; // append command name | 518 | qcopfn += d->appName; // append command name |
519 | 519 | ||
520 | QFile f(qcopfn); | 520 | QFile f(qcopfn); |
521 | if ( f.open(IO_ReadWrite) ) { | 521 | if ( f.open(IO_ReadWrite) ) { |
522 | #ifndef Q_OS_WIN32 | 522 | #ifndef Q_OS_WIN32 |
523 | flock(f.handle(), LOCK_EX); | 523 | flock(f.handle(), LOCK_EX); |
524 | #endif | 524 | #endif |
525 | QDataStream ds(&f); | 525 | QDataStream ds(&f); |
526 | QCString channel, message; | 526 | QCString channel, message; |
527 | QByteArray data; | 527 | QByteArray data; |
528 | while(!ds.atEnd()) { | 528 | while(!ds.atEnd()) { |
529 | ds >> channel >> message >> data; | 529 | ds >> channel >> message >> data; |
530 | d->enqueueQCop(channel,message,data); | 530 | d->enqueueQCop(channel,message,data); |
531 | } | 531 | } |
532 | ::ftruncate(f.handle(), 0); | 532 | ::ftruncate(f.handle(), 0); |
533 | #ifndef Q_OS_WIN32 | 533 | #ifndef Q_OS_WIN32 |
534 | f.flush(); | 534 | f.flush(); |
535 | flock(f.handle(), LOCK_UN); | 535 | flock(f.handle(), LOCK_UN); |
536 | #endif | 536 | #endif |
537 | } | 537 | } |
538 | #endif | 538 | #endif |
539 | } | 539 | } |
540 | 540 | ||
541 | 541 | ||
542 | /*! | 542 | /*! |
543 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 543 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
544 | 544 | ||
545 | This signal is emitted when a message is received on this | 545 | This signal is emitted when a message is received on this |
546 | application's QPE/Application/<i>appname</i> \link qcop.html | 546 | application's QPE/Application/<i>appname</i> \link qcop.html |
547 | QCop\endlink channel. | 547 | QCop\endlink channel. |
548 | 548 | ||
549 | The slot to which you connect this signal uses \a msg and \a data | 549 | The slot to which you connect this signal uses \a msg and \a data |
550 | in the following way: | 550 | in the following way: |
551 | 551 | ||
552 | \code | 552 | \code |
553 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 553 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
554 | { | 554 | { |
555 | QDataStream stream( data, IO_ReadOnly ); | 555 | QDataStream stream( data, IO_ReadOnly ); |
556 | if ( msg == "someMessage(int,int,int)" ) { | 556 | if ( msg == "someMessage(int,int,int)" ) { |
557 | int a,b,c; | 557 | int a,b,c; |
558 | stream >> a >> b >> c; | 558 | stream >> a >> b >> c; |
559 | ... | 559 | ... |
560 | } else if ( msg == "otherMessage(QString)" ) { | 560 | } else if ( msg == "otherMessage(QString)" ) { |
561 | ... | 561 | ... |
562 | } | 562 | } |
563 | } | 563 | } |
564 | \endcode | 564 | \endcode |
565 | 565 | ||
566 | \sa qcop.html | 566 | \sa qcop.html |
567 | Note that messages received here may be processed by qpe application | 567 | Note that messages received here may be processed by qpe application |
568 | and emitted as signals, such as flush() and reload(). | 568 | and emitted as signals, such as flush() and reload(). |
569 | */ | 569 | */ |
570 | 570 | ||
571 | /*! | 571 | /*! |
572 | Constructs a QPEApplication just as you would construct | 572 | Constructs a QPEApplication just as you would construct |
573 | a QApplication, passing \a argc, \a argv, and \a t. | 573 | a QApplication, passing \a argc, \a argv, and \a t. |
574 | 574 | ||
575 | For applications, \a t should be the default, GuiClient. Only | 575 | For applications, \a t should be the default, GuiClient. Only |
576 | the Qtopia server passes GuiServer. | 576 | the Qtopia server passes GuiServer. |
577 | */ | 577 | */ |
578 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 578 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
579 | : QApplication( hack(argc), argv, t ), pidChannel( 0 ) | 579 | : QApplication( hack(argc), argv, t ), pidChannel( 0 ) |
580 | { | 580 | { |
581 | QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. | 581 | QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. |
582 | 582 | ||
583 | d = new QPEApplicationData; | 583 | d = new QPEApplicationData; |
584 | d->loadTextCodecs(); | 584 | d->loadTextCodecs(); |
585 | d->loadImageCodecs(); | 585 | d->loadImageCodecs(); |
586 | int dw = desktop() ->width(); | 586 | int dw = desktop() ->width(); |
587 | 587 | ||
588 | if ( dw < 200 ) { | 588 | if ( dw < 200 ) { |
589 | setFont( QFont( "vera", 8 ) ); | 589 | setFont( QFont( "vera", 8 ) ); |
590 | AppLnk::setSmallIconSize( 10 ); | 590 | AppLnk::setSmallIconSize( 10 ); |
591 | AppLnk::setBigIconSize( 28 ); | 591 | AppLnk::setBigIconSize( 28 ); |
592 | } | 592 | } |
593 | #ifndef OPIE_HIGH_RES_SMALL_PHY | 593 | #if defined(OPIE_HIGH_RES_SMALL_PHY) |
594 | else if ( dw > 600 ) { | 594 | else if ( dw > 600 ) { |
595 | setFont( QFont( "vera", 16 ) ); | 595 | setFont( QFont( "vera", 16 ) ); |
596 | AppLnk::setSmallIconSize( 24 ); | 596 | AppLnk::setSmallIconSize( 24 ); |
597 | AppLnk::setBigIconSize( 48 ); | 597 | AppLnk::setBigIconSize( 48 ); |
598 | } | 598 | } |
599 | #endif | 599 | #endif |
600 | else if ( dw > 200 ) { | 600 | else if ( dw > 200 ) { |
601 | setFont( QFont( "vera", 10 ) ); | 601 | setFont( QFont( "vera", 10 ) ); |
602 | AppLnk::setSmallIconSize( 14 ); | 602 | AppLnk::setSmallIconSize( 14 ); |
603 | AppLnk::setBigIconSize( 32 ); | 603 | AppLnk::setBigIconSize( 32 ); |
604 | } | 604 | } |
605 | 605 | ||
606 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 606 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
607 | 607 | ||
608 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 608 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
609 | 609 | ||
610 | 610 | ||
611 | sysChannel = new QCopChannel( "QPE/System", this ); | 611 | sysChannel = new QCopChannel( "QPE/System", this ); |
612 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 612 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
613 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 613 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); |
614 | 614 | ||
615 | /* COde now in initapp */ | 615 | /* COde now in initapp */ |
616 | #if 0 | 616 | #if 0 |
617 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 617 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
618 | 618 | ||
619 | QString qcopfn( "/tmp/qcop-msg-" ); | 619 | QString qcopfn( "/tmp/qcop-msg-" ); |
620 | qcopfn += QString( argv[ 0 ] ); // append command name | 620 | qcopfn += QString( argv[ 0 ] ); // append command name |
621 | 621 | ||
622 | QFile f( qcopfn ); | 622 | QFile f( qcopfn ); |
623 | if ( f.open( IO_ReadOnly ) ) { | 623 | if ( f.open( IO_ReadOnly ) ) { |
624 | flock( f.handle(), LOCK_EX ); | 624 | flock( f.handle(), LOCK_EX ); |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | 628 | ||
629 | QCString channel = QCString( argv[ 0 ] ); | 629 | QCString channel = QCString( argv[ 0 ] ); |
630 | channel.replace( QRegExp( ".*/" ), "" ); | 630 | channel.replace( QRegExp( ".*/" ), "" ); |
631 | d->appName = channel; | 631 | d->appName = channel; |
632 | channel = "QPE/Application/" + channel; | 632 | channel = "QPE/Application/" + channel; |
633 | pidChannel = new QCopChannel( channel, this ); | 633 | pidChannel = new QCopChannel( channel, this ); |
634 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 634 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
635 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 635 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); |
636 | 636 | ||
637 | if ( f.isOpen() ) { | 637 | if ( f.isOpen() ) { |
638 | d->keep_running = FALSE; | 638 | d->keep_running = FALSE; |
639 | QDataStream ds( &f ); | 639 | QDataStream ds( &f ); |
640 | QCString channel, message; | 640 | QCString channel, message; |
641 | QByteArray data; | 641 | QByteArray data; |
642 | while ( !ds.atEnd() ) { | 642 | while ( !ds.atEnd() ) { |
643 | ds >> channel >> message >> data; | 643 | ds >> channel >> message >> data; |
644 | d->enqueueQCop( channel, message, data ); | 644 | d->enqueueQCop( channel, message, data ); |
645 | } | 645 | } |
646 | 646 | ||
647 | flock( f.handle(), LOCK_UN ); | 647 | flock( f.handle(), LOCK_UN ); |
648 | f.close(); | 648 | f.close(); |
649 | f.remove(); | 649 | f.remove(); |
650 | } | 650 | } |
651 | 651 | ||
652 | for ( int a = 0; a < argc; a++ ) { | 652 | for ( int a = 0; a < argc; a++ ) { |
653 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 653 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
654 | argv[ a ] = argv[ a + 1 ]; | 654 | argv[ a ] = argv[ a + 1 ]; |
655 | a++; | 655 | a++; |
656 | d->preloaded = TRUE; | 656 | d->preloaded = TRUE; |
657 | argc -= 1; | 657 | argc -= 1; |
658 | } | 658 | } |
659 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { | 659 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { |
660 | argv[ a ] = argv[ a + 1 ]; | 660 | argv[ a ] = argv[ a + 1 ]; |
661 | a++; | 661 | a++; |
662 | d->preloaded = TRUE; | 662 | d->preloaded = TRUE; |
663 | d->forceshow = TRUE; | 663 | d->forceshow = TRUE; |
664 | argc -= 1; | 664 | argc -= 1; |
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
668 | /* overide stored arguments */ | 668 | /* overide stored arguments */ |
669 | setArgs( argc, argv ); | 669 | setArgs( argc, argv ); |
670 | 670 | ||
671 | #endif | 671 | #endif |
672 | #else | 672 | #else |
673 | initApp( argc, argv ); | 673 | initApp( argc, argv ); |
674 | #endif | 674 | #endif |
675 | // qwsSetDecoration( new QPEDecoration() ); | 675 | // qwsSetDecoration( new QPEDecoration() ); |
676 | 676 | ||
677 | #ifndef QT_NO_TRANSLATION | 677 | #ifndef QT_NO_TRANSLATION |
678 | 678 | ||
679 | d->langs = Global::languageList(); | 679 | d->langs = Global::languageList(); |
680 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { | 680 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { |
681 | QString lang = *it; | 681 | QString lang = *it; |
682 | 682 | ||
683 | installTranslation( lang + "/libopie.qm"); | 683 | installTranslation( lang + "/libopie.qm"); |
684 | installTranslation( lang + "/libqpe.qm" ); | 684 | installTranslation( lang + "/libqpe.qm" ); |
685 | installTranslation( lang + "/" + d->appName + ".qm" ); | 685 | installTranslation( lang + "/" + d->appName + ".qm" ); |
686 | 686 | ||
687 | 687 | ||
688 | //###language/font hack; should look it up somewhere | 688 | //###language/font hack; should look it up somewhere |
689 | #ifdef QWS | 689 | #ifdef QWS |
690 | 690 | ||
691 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 691 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
692 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 692 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
693 | setFont( fn ); | 693 | setFont( fn ); |
694 | } | 694 | } |
695 | #endif | 695 | #endif |
696 | } | 696 | } |
697 | #endif | 697 | #endif |
698 | 698 | ||
699 | applyStyle(); | 699 | applyStyle(); |
700 | 700 | ||
701 | if ( type() == GuiServer ) { | 701 | if ( type() == GuiServer ) { |
702 | setVolume(); | 702 | setVolume(); |
703 | } | 703 | } |
704 | 704 | ||
705 | installEventFilter( this ); | 705 | installEventFilter( this ); |
706 | 706 | ||
707 | QPEMenuToolFocusManager::initialize(); | 707 | QPEMenuToolFocusManager::initialize(); |
708 | 708 | ||
709 | #ifdef QT_NO_QWS_CURSOR | 709 | #ifdef QT_NO_QWS_CURSOR |
710 | // if we have no cursor, probably don't want tooltips | 710 | // if we have no cursor, probably don't want tooltips |
711 | QToolTip::setEnabled( FALSE ); | 711 | QToolTip::setEnabled( FALSE ); |
712 | #endif | 712 | #endif |
713 | } | 713 | } |
714 | 714 | ||
715 | 715 | ||
716 | #ifdef QTOPIA_INTERNAL_INITAPP | 716 | #ifdef QTOPIA_INTERNAL_INITAPP |
717 | void QPEApplication::initApp( int argc, char **argv ) | 717 | void QPEApplication::initApp( int argc, char **argv ) |
718 | { | 718 | { |
719 | bool initial = pidChannel; // was set to 0 in the initializer | 719 | bool initial = pidChannel; // was set to 0 in the initializer |
720 | delete pidChannel; | 720 | delete pidChannel; |
721 | d->keep_running = TRUE; | 721 | d->keep_running = TRUE; |
722 | d->preloaded = FALSE; | 722 | d->preloaded = FALSE; |
723 | d->forceshow = FALSE; | 723 | d->forceshow = FALSE; |
724 | 724 | ||
725 | QCString channel = QCString(argv[0]); | 725 | QCString channel = QCString(argv[0]); |
726 | 726 | ||
727 | channel.replace(QRegExp(".*/"),""); | 727 | channel.replace(QRegExp(".*/"),""); |
728 | d->appName = channel; | 728 | d->appName = channel; |
729 | 729 | ||
730 | #if QT_VERSION > 235 | 730 | #if QT_VERSION > 235 |
731 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 | 731 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 |
732 | #endif | 732 | #endif |
733 | 733 | ||
734 | channel = "QPE/Application/" + channel; | 734 | channel = "QPE/Application/" + channel; |
735 | pidChannel = new QCopChannel( channel, this); | 735 | pidChannel = new QCopChannel( channel, this); |
736 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 736 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
737 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); | 737 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); |
738 | 738 | ||
739 | if (!initial) { | 739 | if (!initial) { |
740 | processQCopFile(); | 740 | processQCopFile(); |
741 | d->keep_running = d->qcopq.isEmpty(); | 741 | d->keep_running = d->qcopq.isEmpty(); |
742 | } | 742 | } |
743 | 743 | ||
744 | for (int a=0; a<argc; a++) { | 744 | for (int a=0; a<argc; a++) { |
745 | if ( qstrcmp(argv[a],"-preload")==0 ) { | 745 | if ( qstrcmp(argv[a],"-preload")==0 ) { |
746 | argv[a] = argv[a+1]; | 746 | argv[a] = argv[a+1]; |
747 | a++; | 747 | a++; |
748 | d->preloaded = TRUE; | 748 | d->preloaded = TRUE; |
749 | argc-=1; | 749 | argc-=1; |
750 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { | 750 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { |
751 | argv[a] = argv[a+1]; | 751 | argv[a] = argv[a+1]; |
752 | a++; | 752 | a++; |
753 | d->preloaded = TRUE; | 753 | d->preloaded = TRUE; |
754 | d->forceshow = TRUE; | 754 | d->forceshow = TRUE; |
755 | argc-=1; | 755 | argc-=1; |
756 | } | 756 | } |
757 | } | 757 | } |
758 | 758 | ||
759 | /* overide stored arguments */ | 759 | /* overide stored arguments */ |
760 | setArgs(argc, argv); | 760 | setArgs(argc, argv); |
761 | 761 | ||
762 | /* install translation here */ | 762 | /* install translation here */ |
763 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) | 763 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) |
764 | installTranslation( (*it) + "/" + d->appName + ".qm" ); | 764 | installTranslation( (*it) + "/" + d->appName + ".qm" ); |
765 | } | 765 | } |
766 | #endif | 766 | #endif |
767 | 767 | ||
768 | 768 | ||
769 | static QPtrDict<void>* inputMethodDict = 0; | 769 | static QPtrDict<void>* inputMethodDict = 0; |
770 | static void createInputMethodDict() | 770 | static void createInputMethodDict() |
771 | { | 771 | { |
772 | if ( !inputMethodDict ) | 772 | if ( !inputMethodDict ) |
773 | inputMethodDict = new QPtrDict<void>; | 773 | inputMethodDict = new QPtrDict<void>; |
774 | } | 774 | } |
775 | 775 | ||
776 | /*! | 776 | /*! |
777 | Returns the currently set hint to the system as to whether | 777 | Returns the currently set hint to the system as to whether |
778 | widget \a w has any use for text input methods. | 778 | widget \a w has any use for text input methods. |
779 | 779 | ||
780 | 780 | ||
781 | \sa setInputMethodHint() InputMethodHint | 781 | \sa setInputMethodHint() InputMethodHint |
782 | */ | 782 | */ |
783 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | 783 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) |
784 | { | 784 | { |
785 | if ( inputMethodDict && w ) | 785 | if ( inputMethodDict && w ) |