summaryrefslogtreecommitdiff
authorzecke <zecke>2002-09-25 18:15:58 (UTC)
committer zecke <zecke>2002-09-25 18:15:58 (UTC)
commitc96507591791d48a6d6dad3de6c15739c84e1c93 (patch) (unidiff)
treef5476860497023dd6d9e1c82c61cc6bb3f61a6da
parentd44c455b86d6cccbc497e3e8d8aa399096eff7db (diff)
downloadopie-c96507591791d48a6d6dad3de6c15739c84e1c93.zip
opie-c96507591791d48a6d6dad3de6c15739c84e1c93.tar.gz
opie-c96507591791d48a6d6dad3de6c15739c84e1c93.tar.bz2
ljps patch was/is correct
but for some reason TT is not using QFile so I made it use getenv(HOME) instead
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index bdf67b9..533d7bd 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -715,193 +715,197 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
715 ke->simpleData.is_press ) { 715 ke->simpleData.is_press ) {
716 // Escape key closes app if focus on toplevel 716 // Escape key closes app if focus on toplevel
717 QWidget * active = activeWindow(); 717 QWidget * active = activeWindow();
718 if ( active && active->testWFlags( WType_TopLevel ) && 718 if ( active && active->testWFlags( WType_TopLevel ) &&
719 ( int ) active->winId() == ke->simpleData.window && 719 ( int ) active->winId() == ke->simpleData.window &&
720 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { 720 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) {
721 if ( active->inherits( "QDialog" ) ) { 721 if ( active->inherits( "QDialog" ) ) {
722 HackDialog * d = ( HackDialog * ) active; 722 HackDialog * d = ( HackDialog * ) active;
723 d->rejectIt(); 723 d->rejectIt();
724 return TRUE; 724 return TRUE;
725 } 725 }
726 else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { 726 else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) {
727 active->close(); 727 active->close();
728 } 728 }
729 } 729 }
730 } 730 }
731 731
732#if QT_VERSION < 231 732#if QT_VERSION < 231
733 // Filter out the F4/Launcher key from apps 733 // Filter out the F4/Launcher key from apps
734 // ### The launcher key may not always be F4 on all devices 734 // ### The launcher key may not always be F4 on all devices
735 if ( ( ( QWSKeyEvent * ) e ) ->simpleData.keycode == Qt::Key_F4 ) 735 if ( ( ( QWSKeyEvent * ) e ) ->simpleData.keycode == Qt::Key_F4 )
736 return TRUE; 736 return TRUE;
737#endif 737#endif
738 738
739 } 739 }
740 if ( e->type == QWSEvent::Focus ) { 740 if ( e->type == QWSEvent::Focus ) {
741 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 741 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
742 QWidget* nfw = QWidget::find( e->window() ); 742 QWidget* nfw = QWidget::find( e->window() );
743 if ( !fe->simpleData.get_focus ) { 743 if ( !fe->simpleData.get_focus ) {
744 QWidget * active = activeWindow(); 744 QWidget * active = activeWindow();
745 while ( active && active->isPopup() ) { 745 while ( active && active->isPopup() ) {
746 active->close(); 746 active->close();
747 active = activeWindow(); 747 active = activeWindow();
748 } 748 }
749 if ( !nfw && d->kbgrabber == 2 ) { 749 if ( !nfw && d->kbgrabber == 2 ) {
750 ungrabKeyboard(); 750 ungrabKeyboard();
751 d->kbregrab = TRUE; // want kb back when we're active 751 d->kbregrab = TRUE; // want kb back when we're active
752 } 752 }
753 } 753 }
754 else { 754 else {
755 // make sure our modal widget is ALWAYS on top 755 // make sure our modal widget is ALWAYS on top
756 QWidget *topm = activeModalWidget(); 756 QWidget *topm = activeModalWidget();
757 if ( topm ) { 757 if ( topm ) {
758 topm->raise(); 758 topm->raise();
759 } 759 }
760 if ( d->kbregrab ) { 760 if ( d->kbregrab ) {
761 grabKeyboard(); 761 grabKeyboard();
762 d->kbregrab = FALSE; 762 d->kbregrab = FALSE;
763 } 763 }
764 } 764 }
765 if ( fe->simpleData.get_focus && inputMethodDict ) { 765 if ( fe->simpleData.get_focus && inputMethodDict ) {
766 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 766 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
767 if ( m == AlwaysOff ) 767 if ( m == AlwaysOff )
768 Global::hideInputMethod(); 768 Global::hideInputMethod();
769 if ( m == AlwaysOn ) 769 if ( m == AlwaysOn )
770 Global::showInputMethod(); 770 Global::showInputMethod();
771 } 771 }
772 } 772 }
773 return QApplication::qwsEventFilter( e ); 773 return QApplication::qwsEventFilter( e );
774} 774}
775#endif 775#endif
776 776
777/*! 777/*!
778 Destroys the QPEApplication. 778 Destroys the QPEApplication.
779*/ 779*/
780QPEApplication::~QPEApplication() 780QPEApplication::~QPEApplication()
781{ 781{
782 ungrabKeyboard(); 782 ungrabKeyboard();
783#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 783#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
784 // Need to delete QCopChannels early, since the display will 784 // Need to delete QCopChannels early, since the display will
785 // be gone by the time we get to ~QObject(). 785 // be gone by the time we get to ~QObject().
786 delete sysChannel; 786 delete sysChannel;
787 delete pidChannel; 787 delete pidChannel;
788#endif 788#endif
789 789
790 delete d; 790 delete d;
791} 791}
792 792
793/*! 793/*!
794 Returns <tt>$OPIEDIR/</tt>. 794 Returns <tt>$OPIEDIR/</tt>.
795*/ 795*/
796QString QPEApplication::qpeDir() 796QString QPEApplication::qpeDir()
797{ 797{
798 const char * base = getenv( "OPIEDIR" ); 798 const char * base = getenv( "OPIEDIR" );
799 if ( base ) 799 if ( base )
800 return QString( base ) + "/"; 800 return QString( base ) + "/";
801 801
802 return QString( "../" ); 802 return QString( "../" );
803} 803}
804 804
805/*! 805/*!
806 Returns the user's current Document directory. There is a trailing "/". 806 Returns the user's current Document directory. There is a trailing "/".
807 .. well, it does now,, and there's no trailing '/' 807 .. well, it does now,, and there's no trailing '/'
808*/ 808*/
809QString QPEApplication::documentDir() 809QString QPEApplication::documentDir()
810{ 810{
811 return QString( QDir::homeDirPath() + "/Documents"); 811 const char* base = getenv( "HOME");
812 if( base )
813 return QString( base ) + "/Documents";
814
815 return QString( "../Documents" );
812} 816}
813 817
814static int deforient = -1; 818static int deforient = -1;
815 819
816/*! 820/*!
817 \internal 821 \internal
818*/ 822*/
819int QPEApplication::defaultRotation() 823int QPEApplication::defaultRotation()
820{ 824{
821 if ( deforient < 0 ) { 825 if ( deforient < 0 ) {
822 QString d = getenv( "QWS_DISPLAY" ); 826 QString d = getenv( "QWS_DISPLAY" );
823 if ( d.contains( "Rot90" ) ) { 827 if ( d.contains( "Rot90" ) ) {
824 deforient = 90; 828 deforient = 90;
825 } 829 }
826 else if ( d.contains( "Rot180" ) ) { 830 else if ( d.contains( "Rot180" ) ) {
827 deforient = 180; 831 deforient = 180;
828 } 832 }
829 else if ( d.contains( "Rot270" ) ) { 833 else if ( d.contains( "Rot270" ) ) {
830 deforient = 270; 834 deforient = 270;
831 } 835 }
832 else { 836 else {
833 deforient = 0; 837 deforient = 0;
834 } 838 }
835 } 839 }
836 return deforient; 840 return deforient;
837} 841}
838 842
839/*! 843/*!
840 \internal 844 \internal
841*/ 845*/
842void QPEApplication::setDefaultRotation( int r ) 846void QPEApplication::setDefaultRotation( int r )
843{ 847{
844 if ( qApp->type() == GuiServer ) { 848 if ( qApp->type() == GuiServer ) {
845 deforient = r; 849 deforient = r;
846 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 850 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
847 Config config("qpe"); 851 Config config("qpe");
848 config.setGroup( "Rotation" ); 852 config.setGroup( "Rotation" );
849 config.writeEntry( "Screen", getenv("QWS_DISPLAY") ); 853 config.writeEntry( "Screen", getenv("QWS_DISPLAY") );
850 } else { 854 } else {
851#ifndef QT_NO_COP 855#ifndef QT_NO_COP
852 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); e << r; } 856 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); e << r; }
853#endif 857#endif
854 } 858 }
855} 859}
856 860
857/*! 861/*!
858 \internal 862 \internal
859*/ 863*/
860void QPEApplication::applyStyle() 864void QPEApplication::applyStyle()
861{ 865{
862 Config config( "qpe" ); 866 Config config( "qpe" );
863 867
864 config.setGroup( "Appearance" ); 868 config.setGroup( "Appearance" );
865 869
866 // Widget style 870 // Widget style
867 QString style = config.readEntry( "Style", "Light" ); 871 QString style = config.readEntry( "Style", "Light" );
868 internalSetStyle( style ); 872 internalSetStyle( style );
869 873
870 // Colors 874 // Colors
871 QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); 875 QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) );
872 QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); 876 QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) );
873 QPalette pal( btncolor, bgcolor ); 877 QPalette pal( btncolor, bgcolor );
874 QString color = config.readEntry( "Highlight", "#800000" ); 878 QString color = config.readEntry( "Highlight", "#800000" );
875 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 879 pal.setColor( QColorGroup::Highlight, QColor( color ) );
876 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 880 color = config.readEntry( "HighlightedText", "#FFFFFF" );
877 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 881 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
878 color = config.readEntry( "Text", "#000000" ); 882 color = config.readEntry( "Text", "#000000" );
879 pal.setColor( QColorGroup::Text, QColor( color ) ); 883 pal.setColor( QColorGroup::Text, QColor( color ) );
880 color = config.readEntry( "ButtonText", "#000000" ); 884 color = config.readEntry( "ButtonText", "#000000" );
881 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 885 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
882 color = config.readEntry( "Base", "#FFFFFF" ); 886 color = config.readEntry( "Base", "#FFFFFF" );
883 pal.setColor( QColorGroup::Base, QColor( color ) ); 887 pal.setColor( QColorGroup::Base, QColor( color ) );
884 888
885 pal.setColor( QPalette::Disabled, QColorGroup::Text, 889 pal.setColor( QPalette::Disabled, QColorGroup::Text,
886 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 890 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
887 891
888 setPalette( pal, TRUE ); 892 setPalette( pal, TRUE );
889 893
890 // Window Decoration 894 // Window Decoration
891 QString dec = config.readEntry( "Decoration", "Qtopia" ); 895 QString dec = config.readEntry( "Decoration", "Qtopia" );
892 if ( dec != d->decorationName ) { 896 if ( dec != d->decorationName ) {
893 qwsSetDecoration( new QPEDecoration( dec ) ); 897 qwsSetDecoration( new QPEDecoration( dec ) );
894 d->decorationName = dec; 898 d->decorationName = dec;
895 } 899 }
896 900
897 // Font 901 // Font
898 QString ff = config.readEntry( "FontFamily", font().family() ); 902 QString ff = config.readEntry( "FontFamily", font().family() );
899 int fs = config.readNumEntry( "FontSize", font().pointSize() ); 903 int fs = config.readNumEntry( "FontSize", font().pointSize() );
900 setFont( QFont(ff,fs) ); 904 setFont( QFont(ff,fs) );
901} 905}
902 906
903void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) 907void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data )
904{ 908{
905#ifdef Q_WS_QWS 909#ifdef Q_WS_QWS
906 QDataStream stream( data, IO_ReadOnly ); 910 QDataStream stream( data, IO_ReadOnly );
907 if ( msg == "applyStyle()" ) { 911 if ( msg == "applyStyle()" ) {