summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
Unidiff
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 262221e..c339a78 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -583,120 +583,120 @@ void QPEApplication::processQCopFile()
583\endcode 583\endcode
584 584
585 \sa qcop.html 585 \sa qcop.html
586 Note that messages received here may be processed by qpe application 586 Note that messages received here may be processed by qpe application
587 and emitted as signals, such as flush() and reload(). 587 and emitted as signals, such as flush() and reload().
588*/ 588*/
589 589
590/*! 590/*!
591 Constructs a QPEApplication just as you would construct 591 Constructs a QPEApplication just as you would construct
592 a QApplication, passing \a argc, \a argv, and \a t. 592 a QApplication, passing \a argc, \a argv, and \a t.
593 593
594 For applications, \a t should be the default, GuiClient. Only 594 For applications, \a t should be the default, GuiClient. Only
595 the Qtopia server passes GuiServer. 595 the Qtopia server passes GuiServer.
596*/ 596*/
597QPEApplication::QPEApplication( int & argc, char **argv, Type t ) 597QPEApplication::QPEApplication( int & argc, char **argv, Type t )
598 : QApplication( hack(argc), argv, t ), pidChannel( 0 ) 598 : QApplication( hack(argc), argv, t ), pidChannel( 0 )
599{ 599{
600 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. 600 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices.
601 601
602 d = new QPEApplicationData; 602 d = new QPEApplicationData;
603 d->loadTextCodecs(); 603 d->loadTextCodecs();
604 d->loadImageCodecs(); 604 d->loadImageCodecs();
605 int dw = desktop() ->width(); 605 int dw = desktop() ->width();
606 606
607 if ( dw < 200 ) { 607 if ( dw < 200 ) {
608 setFont( QFont( "vera", 8 ) ); 608 setFont( QFont( "vera", 8 ) );
609 AppLnk::setSmallIconSize( 10 ); 609 AppLnk::setSmallIconSize( 10 );
610 AppLnk::setBigIconSize( 28 ); 610 AppLnk::setBigIconSize( 28 );
611 } 611 }
612#if defined(OPIE_HIGH_RES_SMALL_PHY) 612#if defined(OPIE_HIGH_RES_SMALL_PHY)
613 else if ( dw > 600 ) { 613 else if ( dw > 600 ) {
614 setFont( QFont( "vera", 16 ) ); 614 setFont( QFont( "vera", 16 ) );
615 AppLnk::setSmallIconSize( 24 ); 615 AppLnk::setSmallIconSize( 24 );
616 AppLnk::setBigIconSize( 48 ); 616 AppLnk::setBigIconSize( 48 );
617 } 617 }
618#endif 618#endif
619 else if ( dw > 200 ) { 619 else if ( dw > 200 ) {
620 setFont( QFont( "vera", 10 ) ); 620 setFont( QFont( "vera", 10 ) );
621 AppLnk::setSmallIconSize( 14 ); 621 AppLnk::setSmallIconSize( 14 );
622 AppLnk::setBigIconSize( 32 ); 622 AppLnk::setBigIconSize( 32 );
623 } 623 }
624 624
625 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); 625 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory );
626 626
627 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); 627 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) );
628 628
629 629
630 sysChannel = new QCopChannel( "QPE/System", this ); 630 sysChannel = new QCopChannel( "QPE/System", this );
631 connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 631 connect( sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
632 this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); 632 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
633 633
634/* COde now in initapp */ 634/* COde now in initapp */
635#if 0 635#if 0
636#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 636#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
637 637
638 QString qcopfn( "/tmp/qcop-msg-" ); 638 QString qcopfn( "/tmp/qcop-msg-" );
639 qcopfn += QString( argv[ 0 ] ); // append command name 639 qcopfn += QString( argv[ 0 ] ); // append command name
640 640
641 QFile f( qcopfn ); 641 QFile f( qcopfn );
642 if ( f.open( IO_ReadOnly ) ) { 642 if ( f.open( IO_ReadOnly ) ) {
643 flock( f.handle(), LOCK_EX ); 643 flock( f.handle(), LOCK_EX );
644 } 644 }
645 645
646 646
647 647
648 QCString channel = QCString( argv[ 0 ] ); 648 QCString channel = QCString( argv[ 0 ] );
649 channel.replace( QRegExp( ".*/" ), "" ); 649 channel.replace( QRegExp( ".*/" ), "" );
650 d->appName = channel; 650 d->appName = channel;
651 channel = "QPE/Application/" + channel; 651 channel = "QPE/Application/" + channel;
652 pidChannel = new QCopChannel( channel, this ); 652 pidChannel = new QCopChannel( channel, this );
653 connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 653 connect( pidChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
654 this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); 654 this, SLOT( pidMessage(const QCString&,const QByteArray&) ) );
655 655
656 if ( f.isOpen() ) { 656 if ( f.isOpen() ) {
657 d->keep_running = FALSE; 657 d->keep_running = FALSE;
658 QDataStream ds( &f ); 658 QDataStream ds( &f );
659 QCString channel, message; 659 QCString channel, message;
660 QByteArray data; 660 QByteArray data;
661 while ( !ds.atEnd() ) { 661 while ( !ds.atEnd() ) {
662 ds >> channel >> message >> data; 662 ds >> channel >> message >> data;
663 d->enqueueQCop( channel, message, data ); 663 d->enqueueQCop( channel, message, data );
664 } 664 }
665 665
666 flock( f.handle(), LOCK_UN ); 666 flock( f.handle(), LOCK_UN );
667 f.close(); 667 f.close();
668 f.remove(); 668 f.remove();
669 } 669 }
670 670
671 for ( int a = 0; a < argc; a++ ) { 671 for ( int a = 0; a < argc; a++ ) {
672 if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { 672 if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) {
673 argv[ a ] = argv[ a + 1 ]; 673 argv[ a ] = argv[ a + 1 ];
674 a++; 674 a++;
675 d->preloaded = TRUE; 675 d->preloaded = TRUE;
676 argc -= 1; 676 argc -= 1;
677 } 677 }
678 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { 678 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) {
679 argv[ a ] = argv[ a + 1 ]; 679 argv[ a ] = argv[ a + 1 ];
680 a++; 680 a++;
681 d->preloaded = TRUE; 681 d->preloaded = TRUE;
682 d->forceshow = TRUE; 682 d->forceshow = TRUE;
683 argc -= 1; 683 argc -= 1;
684 } 684 }
685 } 685 }
686 686
687 /* overide stored arguments */ 687 /* overide stored arguments */
688 setArgs( argc, argv ); 688 setArgs( argc, argv );
689 689
690#endif 690#endif
691#else 691#else
692 initApp( argc, argv ); 692 initApp( argc, argv );
693#endif 693#endif
694 // qwsSetDecoration( new QPEDecoration() ); 694 // qwsSetDecoration( new QPEDecoration() );
695 695
696#ifndef QT_NO_TRANSLATION 696#ifndef QT_NO_TRANSLATION
697 697
698 d->langs = Global::languageList(); 698 d->langs = Global::languageList();
699 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { 699 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) {
700 QString lang = *it; 700 QString lang = *it;
701 701
702 installTranslation( lang + "/libopie.qm"); 702 installTranslation( lang + "/libopie.qm");
@@ -706,98 +706,98 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
706 706
707 //###language/font hack; should look it up somewhere 707 //###language/font hack; should look it up somewhere
708#ifdef QWS 708#ifdef QWS
709 709
710 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 710 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
711 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 711 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
712 setFont( fn ); 712 setFont( fn );
713 } 713 }
714#endif 714#endif
715 } 715 }
716#endif 716#endif
717 717
718 applyStyle(); 718 applyStyle();
719 719
720 if ( type() == GuiServer ) { 720 if ( type() == GuiServer ) {
721 setVolume(); 721 setVolume();
722 } 722 }
723 723
724 installEventFilter( this ); 724 installEventFilter( this );
725 725
726 QPEMenuToolFocusManager::initialize(); 726 QPEMenuToolFocusManager::initialize();
727 727
728#ifdef QT_NO_QWS_CURSOR 728#ifdef QT_NO_QWS_CURSOR
729 // if we have no cursor, probably don't want tooltips 729 // if we have no cursor, probably don't want tooltips
730 QToolTip::setEnabled( FALSE ); 730 QToolTip::setEnabled( FALSE );
731#endif 731#endif
732} 732}
733 733
734 734
735#ifdef QTOPIA_INTERNAL_INITAPP 735#ifdef QTOPIA_INTERNAL_INITAPP
736void QPEApplication::initApp( int argc, char **argv ) 736void QPEApplication::initApp( int argc, char **argv )
737{ 737{
738 delete pidChannel; 738 delete pidChannel;
739 d->keep_running = TRUE; 739 d->keep_running = TRUE;
740 d->preloaded = FALSE; 740 d->preloaded = FALSE;
741 d->forceshow = FALSE; 741 d->forceshow = FALSE;
742 742
743 QCString channel = QCString(argv[0]); 743 QCString channel = QCString(argv[0]);
744 744
745 channel.replace(QRegExp(".*/"),""); 745 channel.replace(QRegExp(".*/"),"");
746 d->appName = channel; 746 d->appName = channel;
747 747
748 #if QT_VERSION > 235 748 #if QT_VERSION > 235
749 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 749 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6
750 #endif 750 #endif
751 751
752 channel = "QPE/Application/" + channel; 752 channel = "QPE/Application/" + channel;
753 pidChannel = new QCopChannel( channel, this); 753 pidChannel = new QCopChannel( channel, this);
754 connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), 754 connect( pidChannel, SIGNAL(received(const QCString&,const QByteArray&)),
755 this, SLOT(pidMessage(const QCString &, const QByteArray &))); 755 this, SLOT(pidMessage(const QCString&,const QByteArray&)));
756 756
757 757
758 758
759 processQCopFile(); 759 processQCopFile();
760 d->keep_running = d->qcopq.isEmpty(); 760 d->keep_running = d->qcopq.isEmpty();
761 761
762 for (int a=0; a<argc; a++) { 762 for (int a=0; a<argc; a++) {
763 if ( qstrcmp(argv[a],"-preload")==0 ) { 763 if ( qstrcmp(argv[a],"-preload")==0 ) {
764 argv[a] = argv[a+1]; 764 argv[a] = argv[a+1];
765 a++; 765 a++;
766 d->preloaded = TRUE; 766 d->preloaded = TRUE;
767 argc-=1; 767 argc-=1;
768 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { 768 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) {
769 argv[a] = argv[a+1]; 769 argv[a] = argv[a+1];
770 a++; 770 a++;
771 d->preloaded = TRUE; 771 d->preloaded = TRUE;
772 d->forceshow = TRUE; 772 d->forceshow = TRUE;
773 argc-=1; 773 argc-=1;
774 } 774 }
775 } 775 }
776 776
777 /* overide stored arguments */ 777 /* overide stored arguments */
778 setArgs(argc, argv); 778 setArgs(argc, argv);
779 779
780 /* install translation here */ 780 /* install translation here */
781 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) 781 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it )
782 installTranslation( (*it) + "/" + d->appName + ".qm" ); 782 installTranslation( (*it) + "/" + d->appName + ".qm" );
783} 783}
784#endif 784#endif
785 785
786 786
787static QPtrDict<void>* inputMethodDict = 0; 787static QPtrDict<void>* inputMethodDict = 0;
788static void createInputMethodDict() 788static void createInputMethodDict()
789{ 789{
790 if ( !inputMethodDict ) 790 if ( !inputMethodDict )
791 inputMethodDict = new QPtrDict<void>; 791 inputMethodDict = new QPtrDict<void>;
792} 792}
793 793
794/*! 794/*!
795 Returns the currently set hint to the system as to whether 795 Returns the currently set hint to the system as to whether
796 widget \a w has any use for text input methods. 796 widget \a w has any use for text input methods.
797 797
798 798
799 \sa setInputMethodHint() InputMethodHint 799 \sa setInputMethodHint() InputMethodHint
800*/ 800*/
801QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) 801QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w )
802{ 802{
803 if ( inputMethodDict && w ) 803 if ( inputMethodDict && w )