author | mickeyl <mickeyl> | 2003-05-16 19:07:01 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-16 19:07:01 (UTC) |
commit | 1ac65aca5d1219e537238330501bc441dd2a3324 (patch) (unidiff) | |
tree | f60f613028dbef184e4b2fd31c5499d1e07c6e6b | |
parent | e7dc14955879dfabf5093b06784402c4525eed2a (diff) | |
download | opie-1ac65aca5d1219e537238330501bc441dd2a3324.zip opie-1ac65aca5d1219e537238330501bc441dd2a3324.tar.gz opie-1ac65aca5d1219e537238330501bc441dd2a3324.tar.bz2 |
enable opie to compile against a non-patched qt 2.3.2
to prepare the possibility of building an opie 1.0 feed for the sharp rom
-rw-r--r-- | library/qpeapplication.cpp | 2 | ||||
-rw-r--r-- | library/qpeapplication.h | 11 | ||||
-rw-r--r-- | library/qt_override.cpp | 3 | ||||
-rw-r--r-- | library/qt_override_p.h | 10 |
4 files changed, 19 insertions, 7 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index f4db1ab..19adb00 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -836,328 +836,330 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) | |||
836 | } | 836 | } |
837 | if ( e->type == QWSEvent::Focus ) { | 837 | if ( e->type == QWSEvent::Focus ) { |
838 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 838 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
839 | if ( !fe->simpleData.get_focus ) { | 839 | if ( !fe->simpleData.get_focus ) { |
840 | QWidget * active = activeWindow(); | 840 | QWidget * active = activeWindow(); |
841 | while ( active && active->isPopup() ) { | 841 | while ( active && active->isPopup() ) { |
842 | active->close(); | 842 | active->close(); |
843 | active = activeWindow(); | 843 | active = activeWindow(); |
844 | } | 844 | } |
845 | } | 845 | } |
846 | else { | 846 | else { |
847 | // make sure our modal widget is ALWAYS on top | 847 | // make sure our modal widget is ALWAYS on top |
848 | QWidget *topm = activeModalWidget(); | 848 | QWidget *topm = activeModalWidget(); |
849 | if ( topm ) { | 849 | if ( topm ) { |
850 | topm->raise(); | 850 | topm->raise(); |
851 | } | 851 | } |
852 | } | 852 | } |
853 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 853 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
854 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 854 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
855 | if ( m == AlwaysOff ) | 855 | if ( m == AlwaysOff ) |
856 | Global::hideInputMethod(); | 856 | Global::hideInputMethod(); |
857 | if ( m == AlwaysOn ) | 857 | if ( m == AlwaysOn ) |
858 | Global::showInputMethod(); | 858 | Global::showInputMethod(); |
859 | } | 859 | } |
860 | } | 860 | } |
861 | 861 | ||
862 | 862 | ||
863 | return QApplication::qwsEventFilter( e ); | 863 | return QApplication::qwsEventFilter( e ); |
864 | } | 864 | } |
865 | #endif | 865 | #endif |
866 | 866 | ||
867 | /*! | 867 | /*! |
868 | Destroys the QPEApplication. | 868 | Destroys the QPEApplication. |
869 | */ | 869 | */ |
870 | QPEApplication::~QPEApplication() | 870 | QPEApplication::~QPEApplication() |
871 | { | 871 | { |
872 | ungrabKeyboard(); | 872 | ungrabKeyboard(); |
873 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 873 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
874 | // Need to delete QCopChannels early, since the display will | 874 | // Need to delete QCopChannels early, since the display will |
875 | // be gone by the time we get to ~QObject(). | 875 | // be gone by the time we get to ~QObject(). |
876 | delete sysChannel; | 876 | delete sysChannel; |
877 | delete pidChannel; | 877 | delete pidChannel; |
878 | #endif | 878 | #endif |
879 | 879 | ||
880 | delete d; | 880 | delete d; |
881 | } | 881 | } |
882 | 882 | ||
883 | /*! | 883 | /*! |
884 | Returns <tt>$OPIEDIR/</tt>. | 884 | Returns <tt>$OPIEDIR/</tt>. |
885 | */ | 885 | */ |
886 | QString QPEApplication::qpeDir() | 886 | QString QPEApplication::qpeDir() |
887 | { | 887 | { |
888 | const char * base = getenv( "OPIEDIR" ); | 888 | const char * base = getenv( "OPIEDIR" ); |
889 | if ( base ) | 889 | if ( base ) |
890 | return QString( base ) + "/"; | 890 | return QString( base ) + "/"; |
891 | 891 | ||
892 | return QString( "../" ); | 892 | return QString( "../" ); |
893 | } | 893 | } |
894 | 894 | ||
895 | /*! | 895 | /*! |
896 | Returns the user's current Document directory. There is a trailing "/". | 896 | Returns the user's current Document directory. There is a trailing "/". |
897 | .. well, it does now,, and there's no trailing '/' | 897 | .. well, it does now,, and there's no trailing '/' |
898 | */ | 898 | */ |
899 | QString QPEApplication::documentDir() | 899 | QString QPEApplication::documentDir() |
900 | { | 900 | { |
901 | const char* base = getenv( "HOME"); | 901 | const char* base = getenv( "HOME"); |
902 | if ( base ) | 902 | if ( base ) |
903 | return QString( base ) + "/Documents"; | 903 | return QString( base ) + "/Documents"; |
904 | 904 | ||
905 | return QString( "../Documents" ); | 905 | return QString( "../Documents" ); |
906 | } | 906 | } |
907 | 907 | ||
908 | static int deforient = -1; | 908 | static int deforient = -1; |
909 | 909 | ||
910 | /*! | 910 | /*! |
911 | \internal | 911 | \internal |
912 | */ | 912 | */ |
913 | int QPEApplication::defaultRotation() | 913 | int QPEApplication::defaultRotation() |
914 | { | 914 | { |
915 | if ( deforient < 0 ) { | 915 | if ( deforient < 0 ) { |
916 | QString d = getenv( "QWS_DISPLAY" ); | 916 | QString d = getenv( "QWS_DISPLAY" ); |
917 | if ( d.contains( "Rot90" ) ) { | 917 | if ( d.contains( "Rot90" ) ) { |
918 | deforient = 90; | 918 | deforient = 90; |
919 | } | 919 | } |
920 | else if ( d.contains( "Rot180" ) ) { | 920 | else if ( d.contains( "Rot180" ) ) { |
921 | deforient = 180; | 921 | deforient = 180; |
922 | } | 922 | } |
923 | else if ( d.contains( "Rot270" ) ) { | 923 | else if ( d.contains( "Rot270" ) ) { |
924 | deforient = 270; | 924 | deforient = 270; |
925 | } | 925 | } |
926 | else { | 926 | else { |
927 | deforient = 0; | 927 | deforient = 0; |
928 | } | 928 | } |
929 | } | 929 | } |
930 | return deforient; | 930 | return deforient; |
931 | } | 931 | } |
932 | 932 | ||
933 | /*! | 933 | /*! |
934 | \internal | 934 | \internal |
935 | */ | 935 | */ |
936 | void QPEApplication::setDefaultRotation( int r ) | 936 | void QPEApplication::setDefaultRotation( int r ) |
937 | { | 937 | { |
938 | if ( qApp->type() == GuiServer ) { | 938 | if ( qApp->type() == GuiServer ) { |
939 | deforient = r; | 939 | deforient = r; |
940 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 940 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
941 | Config config("qpe"); | 941 | Config config("qpe"); |
942 | config.setGroup( "Rotation" ); | 942 | config.setGroup( "Rotation" ); |
943 | config.writeEntry( "Rot", r ); | 943 | config.writeEntry( "Rot", r ); |
944 | } | 944 | } |
945 | else { | 945 | else { |
946 | #ifndef QT_NO_COP | 946 | #ifndef QT_NO_COP |
947 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 947 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
948 | e << r; | 948 | e << r; |
949 | } | 949 | } |
950 | #endif | 950 | #endif |
951 | 951 | ||
952 | } | 952 | } |
953 | } | 953 | } |
954 | 954 | ||
955 | 955 | ||
956 | /*! | 956 | /*! |
957 | \internal | 957 | \internal |
958 | */ | 958 | */ |
959 | void QPEApplication::applyStyle() | 959 | void QPEApplication::applyStyle() |
960 | { | 960 | { |
961 | Config config( "qpe" ); | 961 | Config config( "qpe" ); |
962 | config.setGroup( "Appearance" ); | 962 | config.setGroup( "Appearance" ); |
963 | 963 | ||
964 | #if QT_VERSION > 233 | ||
964 | // don't block ourselves ... | 965 | // don't block ourselves ... |
965 | Opie::force_appearance = 0; | 966 | Opie::force_appearance = 0; |
966 | 967 | ||
967 | static QString appname = Opie::binaryName ( ); | 968 | static QString appname = Opie::binaryName ( ); |
968 | 969 | ||
969 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 970 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
970 | int nostyle = 0; | 971 | int nostyle = 0; |
971 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 972 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
972 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 973 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
973 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 974 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
974 | break; | 975 | break; |
975 | } | 976 | } |
976 | } | 977 | } |
977 | 978 | ||
978 | // Widget style | 979 | // Widget style |
979 | QString style = config.readEntry( "Style", "Light" ); | 980 | QString style = config.readEntry( "Style", "Light" ); |
980 | 981 | ||
981 | // don't set a custom style | 982 | // don't set a custom style |
982 | if ( nostyle & Opie::Force_Style ) | 983 | if ( nostyle & Opie::Force_Style ) |
983 | style = "Light"; | 984 | style = "Light"; |
984 | 985 | ||
985 | internalSetStyle ( style ); | 986 | internalSetStyle ( style ); |
986 | 987 | ||
987 | // Colors | 988 | // Colors |
988 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); | 989 | QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); |
989 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); | 990 | QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); |
990 | QPalette pal( btncolor, bgcolor ); | 991 | QPalette pal( btncolor, bgcolor ); |
991 | QString color = config.readEntry( "Highlight", "#800000" ); | 992 | QString color = config.readEntry( "Highlight", "#800000" ); |
992 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 993 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
993 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 994 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
994 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 995 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
995 | color = config.readEntry( "Text", "#000000" ); | 996 | color = config.readEntry( "Text", "#000000" ); |
996 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 997 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
997 | color = config.readEntry( "ButtonText", "#000000" ); | 998 | color = config.readEntry( "ButtonText", "#000000" ); |
998 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 999 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
999 | color = config.readEntry( "Base", "#FFFFFF" ); | 1000 | color = config.readEntry( "Base", "#FFFFFF" ); |
1000 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1001 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1001 | 1002 | ||
1002 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1003 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1003 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1004 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1004 | 1005 | ||
1005 | setPalette( pal, TRUE ); | 1006 | setPalette( pal, TRUE ); |
1006 | 1007 | ||
1007 | // Window Decoration | 1008 | // Window Decoration |
1008 | QString dec = config.readEntry( "Decoration", "Qtopia" ); | 1009 | QString dec = config.readEntry( "Decoration", "Qtopia" ); |
1009 | 1010 | ||
1010 | // don't set a custom deco | 1011 | // don't set a custom deco |
1011 | if ( nostyle & Opie::Force_Decoration ) | 1012 | if ( nostyle & Opie::Force_Decoration ) |
1012 | dec = ""; | 1013 | dec = ""; |
1013 | 1014 | ||
1014 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1015 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1015 | 1016 | ||
1016 | if ( dec != d->decorationName ) { | 1017 | if ( dec != d->decorationName ) { |
1017 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1018 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1018 | d->decorationName = dec; | 1019 | d->decorationName = dec; |
1019 | } | 1020 | } |
1020 | 1021 | ||
1021 | // Font | 1022 | // Font |
1022 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1023 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1023 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1024 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1024 | 1025 | ||
1025 | // don't set a custom font | 1026 | // don't set a custom font |
1026 | if ( nostyle & Opie::Force_Font ) { | 1027 | if ( nostyle & Opie::Force_Font ) { |
1027 | ff = "Vera"; | 1028 | ff = "Vera"; |
1028 | fs = 10; | 1029 | fs = 10; |
1029 | } | 1030 | } |
1030 | 1031 | ||
1031 | setFont ( QFont ( ff, fs ), true ); | 1032 | setFont ( QFont ( ff, fs ), true ); |
1032 | 1033 | ||
1033 | // revert to global blocking policy ... | 1034 | // revert to global blocking policy ... |
1034 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1035 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1035 | Opie::force_appearance &= ~nostyle; | 1036 | Opie::force_appearance &= ~nostyle; |
1037 | #endif | ||
1036 | } | 1038 | } |
1037 | 1039 | ||
1038 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1040 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1039 | { | 1041 | { |
1040 | #ifdef Q_WS_QWS | 1042 | #ifdef Q_WS_QWS |
1041 | QDataStream stream( data, IO_ReadOnly ); | 1043 | QDataStream stream( data, IO_ReadOnly ); |
1042 | if ( msg == "applyStyle()" ) { | 1044 | if ( msg == "applyStyle()" ) { |
1043 | applyStyle(); | 1045 | applyStyle(); |
1044 | } | 1046 | } |
1045 | else if ( msg == "toggleApplicationMenu()" ) { | 1047 | else if ( msg == "toggleApplicationMenu()" ) { |
1046 | QWidget *active = activeWindow ( ); | 1048 | QWidget *active = activeWindow ( ); |
1047 | 1049 | ||
1048 | if ( active ) { | 1050 | if ( active ) { |
1049 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1051 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1050 | bool oldactive = man-> isActive ( ); | 1052 | bool oldactive = man-> isActive ( ); |
1051 | 1053 | ||
1052 | man-> setActive( !man-> isActive() ); | 1054 | man-> setActive( !man-> isActive() ); |
1053 | 1055 | ||
1054 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1056 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1055 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1057 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1056 | } | 1058 | } |
1057 | } | 1059 | } |
1058 | } | 1060 | } |
1059 | else if ( msg == "setDefaultRotation(int)" ) { | 1061 | else if ( msg == "setDefaultRotation(int)" ) { |
1060 | if ( type() == GuiServer ) { | 1062 | if ( type() == GuiServer ) { |
1061 | int r; | 1063 | int r; |
1062 | stream >> r; | 1064 | stream >> r; |
1063 | setDefaultRotation( r ); | 1065 | setDefaultRotation( r ); |
1064 | } | 1066 | } |
1065 | } | 1067 | } |
1066 | else if ( msg == "setCurrentRotation(int)" ) { | 1068 | else if ( msg == "setCurrentRotation(int)" ) { |
1067 | int r; | 1069 | int r; |
1068 | stream >> r; | 1070 | stream >> r; |
1069 | setCurrentRotation( r ); | 1071 | setCurrentRotation( r ); |
1070 | } | 1072 | } |
1071 | else if ( msg == "shutdown()" ) { | 1073 | else if ( msg == "shutdown()" ) { |
1072 | if ( type() == GuiServer ) | 1074 | if ( type() == GuiServer ) |
1073 | shutdown(); | 1075 | shutdown(); |
1074 | } | 1076 | } |
1075 | else if ( msg == "quit()" ) { | 1077 | else if ( msg == "quit()" ) { |
1076 | if ( type() != GuiServer ) | 1078 | if ( type() != GuiServer ) |
1077 | tryQuit(); | 1079 | tryQuit(); |
1078 | } | 1080 | } |
1079 | else if ( msg == "forceQuit()" ) { | 1081 | else if ( msg == "forceQuit()" ) { |
1080 | if ( type() != GuiServer ) | 1082 | if ( type() != GuiServer ) |
1081 | quit(); | 1083 | quit(); |
1082 | } | 1084 | } |
1083 | else if ( msg == "restart()" ) { | 1085 | else if ( msg == "restart()" ) { |
1084 | if ( type() == GuiServer ) | 1086 | if ( type() == GuiServer ) |
1085 | restart(); | 1087 | restart(); |
1086 | } | 1088 | } |
1087 | else if ( msg == "language(QString)" ) { | 1089 | else if ( msg == "language(QString)" ) { |
1088 | if ( type() == GuiServer ) { | 1090 | if ( type() == GuiServer ) { |
1089 | QString l; | 1091 | QString l; |
1090 | stream >> l; | 1092 | stream >> l; |
1091 | QString cl = getenv( "LANG" ); | 1093 | QString cl = getenv( "LANG" ); |
1092 | if ( cl != l ) { | 1094 | if ( cl != l ) { |
1093 | if ( l.isNull() ) | 1095 | if ( l.isNull() ) |
1094 | unsetenv( "LANG" ); | 1096 | unsetenv( "LANG" ); |
1095 | else | 1097 | else |
1096 | setenv( "LANG", l.latin1(), 1 ); | 1098 | setenv( "LANG", l.latin1(), 1 ); |
1097 | restart(); | 1099 | restart(); |
1098 | } | 1100 | } |
1099 | } | 1101 | } |
1100 | } | 1102 | } |
1101 | else if ( msg == "timeChange(QString)" ) { | 1103 | else if ( msg == "timeChange(QString)" ) { |
1102 | QString t; | 1104 | QString t; |
1103 | stream >> t; | 1105 | stream >> t; |
1104 | if ( t.isNull() ) | 1106 | if ( t.isNull() ) |
1105 | unsetenv( "TZ" ); | 1107 | unsetenv( "TZ" ); |
1106 | else | 1108 | else |
1107 | setenv( "TZ", t.latin1(), 1 ); | 1109 | setenv( "TZ", t.latin1(), 1 ); |
1108 | // emit the signal so everyone else knows... | 1110 | // emit the signal so everyone else knows... |
1109 | emit timeChanged(); | 1111 | emit timeChanged(); |
1110 | } | 1112 | } |
1111 | else if ( msg == "execute(QString)" ) { | 1113 | else if ( msg == "execute(QString)" ) { |
1112 | if ( type() == GuiServer ) { | 1114 | if ( type() == GuiServer ) { |
1113 | QString t; | 1115 | QString t; |
1114 | stream >> t; | 1116 | stream >> t; |
1115 | Global::execute( t ); | 1117 | Global::execute( t ); |
1116 | } | 1118 | } |
1117 | } | 1119 | } |
1118 | else if ( msg == "execute(QString,QString)" ) { | 1120 | else if ( msg == "execute(QString,QString)" ) { |
1119 | if ( type() == GuiServer ) { | 1121 | if ( type() == GuiServer ) { |
1120 | QString t, d; | 1122 | QString t, d; |
1121 | stream >> t >> d; | 1123 | stream >> t >> d; |
1122 | Global::execute( t, d ); | 1124 | Global::execute( t, d ); |
1123 | } | 1125 | } |
1124 | } | 1126 | } |
1125 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { | 1127 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { |
1126 | if ( type() == GuiServer ) { | 1128 | if ( type() == GuiServer ) { |
1127 | QDateTime when; | 1129 | QDateTime when; |
1128 | QCString channel, message; | 1130 | QCString channel, message; |
1129 | int data; | 1131 | int data; |
1130 | stream >> when >> channel >> message >> data; | 1132 | stream >> when >> channel >> message >> data; |
1131 | AlarmServer::addAlarm( when, channel, message, data ); | 1133 | AlarmServer::addAlarm( when, channel, message, data ); |
1132 | } | 1134 | } |
1133 | } | 1135 | } |
1134 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { | 1136 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { |
1135 | if ( type() == GuiServer ) { | 1137 | if ( type() == GuiServer ) { |
1136 | QDateTime when; | 1138 | QDateTime when; |
1137 | QCString channel, message; | 1139 | QCString channel, message; |
1138 | int data; | 1140 | int data; |
1139 | stream >> when >> channel >> message >> data; | 1141 | stream >> when >> channel >> message >> data; |
1140 | AlarmServer::deleteAlarm( when, channel, message, data ); | 1142 | AlarmServer::deleteAlarm( when, channel, message, data ); |
1141 | } | 1143 | } |
1142 | } | 1144 | } |
1143 | else if ( msg == "clockChange(bool)" ) { | 1145 | else if ( msg == "clockChange(bool)" ) { |
1144 | int tmp; | 1146 | int tmp; |
1145 | stream >> tmp; | 1147 | stream >> tmp; |
1146 | emit clockChanged( tmp ); | 1148 | emit clockChanged( tmp ); |
1147 | } | 1149 | } |
1148 | else if ( msg == "weekChange(bool)" ) { | 1150 | else if ( msg == "weekChange(bool)" ) { |
1149 | int tmp; | 1151 | int tmp; |
1150 | stream >> tmp; | 1152 | stream >> tmp; |
1151 | emit weekChanged( tmp ); | 1153 | emit weekChanged( tmp ); |
1152 | } | 1154 | } |
1153 | else if ( msg == "setDateFormat(DateFormat)" ) { | 1155 | else if ( msg == "setDateFormat(DateFormat)" ) { |
1154 | DateFormat tmp; | 1156 | DateFormat tmp; |
1155 | stream >> tmp; | 1157 | stream >> tmp; |
1156 | emit dateFormatChanged( tmp ); | 1158 | emit dateFormatChanged( tmp ); |
1157 | } | 1159 | } |
1158 | else if ( msg == "setVolume(int,int)" ) { | 1160 | else if ( msg == "setVolume(int,int)" ) { |
1159 | int t, v; | 1161 | int t, v; |
1160 | stream >> t >> v; | 1162 | stream >> t >> v; |
1161 | setVolume( t, v ); | 1163 | setVolume( t, v ); |
1162 | emit volumeChanged( muted ); | 1164 | emit volumeChanged( muted ); |
1163 | } | 1165 | } |
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index e35c008..65a6d33 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -1,193 +1,198 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef __QPE_APPLICATION_H__ | 20 | #ifndef __QPE_APPLICATION_H__ |
21 | #define __QPE_APPLICATION_H__ | 21 | #define __QPE_APPLICATION_H__ |
22 | 22 | ||
23 | #include <stdlib.h> // for setenv() | 23 | #include <stdlib.h> // for setenv() |
24 | 24 | ||
25 | #include <qglobal.h> | 25 | #include <qglobal.h> |
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #include <qdialog.h> | 27 | #include <qdialog.h> |
28 | #include <qwsdisplay_qws.h> | 28 | #include <qwsdisplay_qws.h> |
29 | #if defined(_WS_QWS_) && !defined(Q_WS_QWS) | 29 | #if defined(_WS_QWS_) && !defined(Q_WS_QWS) |
30 | #define Q_WS_QWS | 30 | #define Q_WS_QWS |
31 | #endif | 31 | #endif |
32 | #include "qpedecoration_qws.h" | 32 | #include "qpedecoration_qws.h" |
33 | #include "timestring.h" | 33 | #include "timestring.h" |
34 | 34 | ||
35 | class QCopChannel; | 35 | class QCopChannel; |
36 | class QPEApplicationData; | 36 | class QPEApplicationData; |
37 | class QWSEvent; | 37 | class QWSEvent; |
38 | class QWSKeyEvent; | 38 | class QWSKeyEvent; |
39 | 39 | ||
40 | 40 | ||
41 | class QPEApplication : public QApplication | 41 | class QPEApplication : public QApplication |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | QPEApplication( int& argc, char **argv, Type=GuiClient ); | 45 | QPEApplication( int& argc, char **argv, Type=GuiClient ); |
46 | ~QPEApplication(); | 46 | ~QPEApplication(); |
47 | 47 | ||
48 | static QString qpeDir(); | 48 | static QString qpeDir(); |
49 | static QString documentDir(); | 49 | static QString documentDir(); |
50 | void applyStyle(); | 50 | void applyStyle(); |
51 | static int defaultRotation(); | 51 | static int defaultRotation(); |
52 | static void setDefaultRotation(int r); | 52 | static void setDefaultRotation(int r); |
53 | static void setCurrentRotation(int r); | 53 | static void setCurrentRotation(int r); |
54 | static void grabKeyboard(); | 54 | static void grabKeyboard(); |
55 | static void ungrabKeyboard(); | 55 | static void ungrabKeyboard(); |
56 | 56 | ||
57 | enum StylusMode { | 57 | enum StylusMode { |
58 | LeftOnly, | 58 | LeftOnly, |
59 | RightOnHold | 59 | RightOnHold |
60 | // RightOnHoldLeftDelayed, etc. | 60 | // RightOnHoldLeftDelayed, etc. |
61 | }; | 61 | }; |
62 | static void setStylusOperation( QWidget*, StylusMode ); | 62 | static void setStylusOperation( QWidget*, StylusMode ); |
63 | static StylusMode stylusOperation( QWidget* ); | 63 | static StylusMode stylusOperation( QWidget* ); |
64 | 64 | ||
65 | enum InputMethodHint { | 65 | enum InputMethodHint { |
66 | Normal, | 66 | Normal, |
67 | AlwaysOff, | 67 | AlwaysOff, |
68 | AlwaysOn | 68 | AlwaysOn |
69 | }; | 69 | }; |
70 | 70 | ||
71 | enum screenSaverHint { | 71 | enum screenSaverHint { |
72 | Disable = 0, | 72 | Disable = 0, |
73 | DisableLightOff = 1, | 73 | DisableLightOff = 1, |
74 | DisableSuspend = 2, | 74 | DisableSuspend = 2, |
75 | Enable = 100 | 75 | Enable = 100 |
76 | }; | 76 | }; |
77 | 77 | ||
78 | static void setInputMethodHint( QWidget *, InputMethodHint ); | 78 | static void setInputMethodHint( QWidget *, InputMethodHint ); |
79 | static InputMethodHint inputMethodHint( QWidget * ); | 79 | static InputMethodHint inputMethodHint( QWidget * ); |
80 | 80 | ||
81 | void showMainWidget( QWidget*, bool nomax=FALSE ); | 81 | void showMainWidget( QWidget*, bool nomax=FALSE ); |
82 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); | 82 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); |
83 | static void showDialog( QDialog*, bool nomax=FALSE ); | 83 | static void showDialog( QDialog*, bool nomax=FALSE ); |
84 | static int execDialog( QDialog*, bool nomax=FALSE ); | 84 | static int execDialog( QDialog*, bool nomax=FALSE ); |
85 | 85 | ||
86 | static void setKeepRunning(); | 86 | static void setKeepRunning(); |
87 | bool keepRunning() const; | 87 | bool keepRunning() const; |
88 | 88 | ||
89 | bool keyboardGrabbed() const; | 89 | bool keyboardGrabbed() const; |
90 | 90 | ||
91 | int exec(); | 91 | int exec(); |
92 | 92 | ||
93 | signals: | 93 | signals: |
94 | void clientMoused(); | 94 | void clientMoused(); |
95 | void timeChanged(); | 95 | void timeChanged(); |
96 | void clockChanged( bool pm ); | 96 | void clockChanged( bool pm ); |
97 | void micChanged( bool muted ); | 97 | void micChanged( bool muted ); |
98 | void volumeChanged( bool muted ); | 98 | void volumeChanged( bool muted ); |
99 | void appMessage( const QCString& msg, const QByteArray& data); | 99 | void appMessage( const QCString& msg, const QByteArray& data); |
100 | void weekChanged( bool startOnMonday ); | 100 | void weekChanged( bool startOnMonday ); |
101 | void dateFormatChanged( DateFormat ); | 101 | void dateFormatChanged( DateFormat ); |
102 | void flush(); | 102 | void flush(); |
103 | void reload(); | 103 | void reload(); |
104 | 104 | ||
105 | private slots: | 105 | private slots: |
106 | void systemMessage( const QCString &msg, const QByteArray &data ); | 106 | void systemMessage( const QCString &msg, const QByteArray &data ); |
107 | void pidMessage( const QCString &msg, const QByteArray &data ); | 107 | void pidMessage( const QCString &msg, const QByteArray &data ); |
108 | void removeSenderFromStylusDict(); | 108 | void removeSenderFromStylusDict(); |
109 | void hideOrQuit(); | 109 | void hideOrQuit(); |
110 | 110 | ||
111 | protected: | 111 | protected: |
112 | bool qwsEventFilter( QWSEvent * ); | 112 | bool qwsEventFilter( QWSEvent * ); |
113 | void internalSetStyle( const QString &style ); | 113 | void internalSetStyle( const QString &style ); |
114 | void prepareForTermination(bool willrestart); | 114 | void prepareForTermination(bool willrestart); |
115 | virtual void restart(); | 115 | virtual void restart(); |
116 | virtual void shutdown(); | 116 | virtual void shutdown(); |
117 | bool eventFilter( QObject *, QEvent * ); | 117 | bool eventFilter( QObject *, QEvent * ); |
118 | void timerEvent( QTimerEvent * ); | 118 | void timerEvent( QTimerEvent * ); |
119 | bool raiseAppropriateWindow(); | 119 | bool raiseAppropriateWindow(); |
120 | virtual void tryQuit(); | 120 | virtual void tryQuit(); |
121 | 121 | #if QT_VERSION > 233 | |
122 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) | 122 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) |
123 | 123 | #endif | |
124 | private: | 124 | private: |
125 | #ifndef QT_NO_TRANSLATION | 125 | #ifndef QT_NO_TRANSLATION |
126 | void installTranslation( const QString& baseName ); | 126 | void installTranslation( const QString& baseName ); |
127 | #endif | 127 | #endif |
128 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 128 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
129 | 129 | ||
130 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 130 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
131 | QCopChannel *sysChannel; | 131 | QCopChannel *sysChannel; |
132 | QCopChannel *pidChannel; | 132 | QCopChannel *pidChannel; |
133 | #endif | 133 | #endif |
134 | QPEApplicationData *d; | 134 | QPEApplicationData *d; |
135 | 135 | ||
136 | bool reserved_sh; | 136 | bool reserved_sh; |
137 | 137 | ||
138 | 138 | ||
139 | 139 | ||
140 | }; | 140 | }; |
141 | 141 | ||
142 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) | 142 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) |
143 | { | 143 | { |
144 | QSize sh = d->sizeHint(); | 144 | QSize sh = d->sizeHint(); |
145 | int w = QMAX(sh.width(),d->width()); | 145 | int w = QMAX(sh.width(),d->width()); |
146 | int h = QMAX(sh.height(),d->height()); | 146 | int h = QMAX(sh.height(),d->height()); |
147 | if ( !nomax | 147 | if ( !nomax |
148 | && ( w > qApp->desktop()->width()*3/4 | 148 | && ( w > qApp->desktop()->width()*3/4 |
149 | || h > qApp->desktop()->height()*3/4 ) ) | 149 | || h > qApp->desktop()->height()*3/4 ) ) |
150 | { | 150 | { |
151 | d->showMaximized(); | 151 | d->showMaximized(); |
152 | } else { | 152 | } else { |
153 | d->resize(w,h); | 153 | d->resize(w,h); |
154 | d->show(); | 154 | d->show(); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) | 158 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) |
159 | { | 159 | { |
160 | showDialog(d,nomax); | 160 | showDialog(d,nomax); |
161 | return d->exec(); | 161 | return d->exec(); |
162 | } | 162 | } |
163 | 163 | ||
164 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ | 164 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ |
165 | 165 | ||
166 | inline int TransToDeg ( Transformation t ) | 166 | inline int TransToDeg ( Transformation t ) |
167 | { | 167 | { |
168 | int d = static_cast<int>( t ); | 168 | int d = static_cast<int>( t ); |
169 | return d * 90; | 169 | return d * 90; |
170 | } | 170 | } |
171 | 171 | ||
172 | inline Transformation DegToTrans ( int d ) | 172 | inline Transformation DegToTrans ( int d ) |
173 | { | 173 | { |
174 | Transformation t = static_cast<Transformation>( d / 90 ); | 174 | Transformation t = static_cast<Transformation>( d / 90 ); |
175 | return t; | 175 | return t; |
176 | } | 176 | } |
177 | 177 | ||
178 | /* | 178 | /* |
179 | * Set current rotation of Opie, and rotation for newly started apps. | 179 | * Set current rotation of Opie, and rotation for newly started apps. |
180 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, | 180 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, |
181 | * and 2) does not set deforient or save orientation to qpe.conf. | 181 | * and 2) does not set deforient or save orientation to qpe.conf. |
182 | */ | 182 | */ |
183 | 183 | ||
184 | inline void QPEApplication::setCurrentRotation( int r ) | 184 | inline void QPEApplication::setCurrentRotation( int r ) |
185 | { | 185 | { |
186 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots | ||
187 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() | ||
188 | #if QT_VERSION > 233 | ||
186 | Transformation e = DegToTrans( r ); | 189 | Transformation e = DegToTrans( r ); |
187 | |||
188 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 190 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
189 | qApp->desktop()->qwsDisplay()->setTransformation( e ); | 191 | qApp->desktop()->qwsDisplay()->setTransformation( e ); |
192 | #else | ||
193 | setDefaultRotation( r ); | ||
194 | #endif | ||
190 | } | 195 | } |
191 | 196 | ||
192 | 197 | ||
193 | #endif | 198 | #endif |
diff --git a/library/qt_override.cpp b/library/qt_override.cpp index 02c48a0..edda874 100644 --- a/library/qt_override.cpp +++ b/library/qt_override.cpp | |||
@@ -1,170 +1,171 @@ | |||
1 | 1 | ||
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qwsdecoration_qws.h> | 3 | #include <qwsdecoration_qws.h> |
4 | #include <qcommonstyle.h> | 4 | #include <qcommonstyle.h> |
5 | #include <qfontdatabase.h> | 5 | #include <qfontdatabase.h> |
6 | 6 | ||
7 | #include <unistd.h> | 7 | #include <unistd.h> |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
10 | #include <limits.h> | 10 | #include <limits.h> |
11 | #include <sys/param.h> // for toolchains with old libc headers | 11 | #include <sys/param.h> // for toolchains with old libc headers |
12 | 12 | ||
13 | #include "qt_override_p.h" | 13 | #include "qt_override_p.h" |
14 | 14 | ||
15 | 15 | #if QT_VERSION > 233 | |
16 | 16 | ||
17 | struct color_fix_t { | 17 | struct color_fix_t { |
18 | char *m_app; | 18 | char *m_app; |
19 | char *m_class; | 19 | char *m_class; |
20 | char *m_name; | 20 | char *m_name; |
21 | QColorGroup::ColorRole m_set; | 21 | QColorGroup::ColorRole m_set; |
22 | QColorGroup::ColorRole m_get; | 22 | QColorGroup::ColorRole m_get; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | 25 | ||
26 | 26 | ||
27 | static const color_fix_t apps_that_need_special_colors [] = { | 27 | static const color_fix_t apps_that_need_special_colors [] = { |
28 | { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base }, | 28 | { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base }, |
29 | { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base }, | 29 | { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base }, |
30 | 30 | ||
31 | { 0, 0, 0, QColorGroup::Base, QColorGroup::Base } | 31 | { 0, 0, 0, QColorGroup::Base, QColorGroup::Base } |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static const char * const apps_that_need_pointsizes_times_10 [] = { | 34 | static const char * const apps_that_need_pointsizes_times_10 [] = { |
35 | "HancomMobileWord", | 35 | "HancomMobileWord", |
36 | "hancomsheet", | 36 | "hancomsheet", |
37 | "HancomPresenterViewer", | 37 | "HancomPresenterViewer", |
38 | 38 | ||
39 | 0 | 39 | 0 |
40 | }; | 40 | }; |
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | int Opie::force_appearance = 0; | 45 | int Opie::force_appearance = 0; |
46 | 46 | ||
47 | 47 | ||
48 | // Return the *real* name of the binary - not just a quick guess | 48 | // Return the *real* name of the binary - not just a quick guess |
49 | // by looking at argv [0] (which could be anything) | 49 | // by looking at argv [0] (which could be anything) |
50 | 50 | ||
51 | static void binaryNameFree ( ) | 51 | static void binaryNameFree ( ) |
52 | { | 52 | { |
53 | ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here | 53 | ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here |
54 | } | 54 | } |
55 | 55 | ||
56 | const char *Opie::binaryName ( ) | 56 | const char *Opie::binaryName ( ) |
57 | { | 57 | { |
58 | static const char *appname = 0; | 58 | static const char *appname = 0; |
59 | 59 | ||
60 | if ( !appname ) { | 60 | if ( !appname ) { |
61 | char dst [PATH_MAX + 1]; | 61 | char dst [PATH_MAX + 1]; |
62 | int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX ); | 62 | int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX ); |
63 | 63 | ||
64 | if ( l <= 0 ) | 64 | if ( l <= 0 ) |
65 | l = 0; | 65 | l = 0; |
66 | 66 | ||
67 | dst [l] = 0; | 67 | dst [l] = 0; |
68 | const char *b = ::strrchr ( dst, '/' ); | 68 | const char *b = ::strrchr ( dst, '/' ); |
69 | appname = ::strdup ( b ? b + 1 : dst ); | 69 | appname = ::strdup ( b ? b + 1 : dst ); |
70 | 70 | ||
71 | ::atexit ( binaryNameFree ); | 71 | ::atexit ( binaryNameFree ); |
72 | } | 72 | } |
73 | return appname; | 73 | return appname; |
74 | } | 74 | } |
75 | 75 | ||
76 | 76 | ||
77 | // Fix for a toolchain incompatibility (binaries compiled with | 77 | // Fix for a toolchain incompatibility (binaries compiled with |
78 | // old tcs using shared libs compiled with newer tcs) | 78 | // old tcs using shared libs compiled with newer tcs) |
79 | 79 | ||
80 | extern "C" { | 80 | extern "C" { |
81 | 81 | ||
82 | extern void __gmon_start__ ( ) __attribute__(( weak )); | 82 | extern void __gmon_start__ ( ) __attribute__(( weak )); |
83 | 83 | ||
84 | extern void __gmon_start__ ( ) | 84 | extern void __gmon_start__ ( ) |
85 | { | 85 | { |
86 | } | 86 | } |
87 | 87 | ||
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | // Fix for apps, that use QPainter::eraseRect() which doesn't work with styles | 91 | // Fix for apps, that use QPainter::eraseRect() which doesn't work with styles |
92 | // that set a background pixmap (it would be easier to fix eraseRect(), but | 92 | // that set a background pixmap (it would be easier to fix eraseRect(), but |
93 | // TT made it an inline ...) | 93 | // TT made it an inline ...) |
94 | 94 | ||
95 | void QPEApplication::polish ( QWidget *w ) | 95 | void QPEApplication::polish ( QWidget *w ) |
96 | { | 96 | { |
97 | //qDebug ( "QPEApplication::polish()" ); | 97 | //qDebug ( "QPEApplication::polish()" ); |
98 | 98 | ||
99 | for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { | 99 | for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { |
100 | if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && | 100 | if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && |
101 | ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && | 101 | ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && |
102 | ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) { | 102 | ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) { |
103 | QPalette pal = w-> palette ( ); | 103 | QPalette pal = w-> palette ( ); |
104 | pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get )); | 104 | pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get )); |
105 | w-> setPalette ( pal ); | 105 | w-> setPalette ( pal ); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | QApplication::polish ( w ); | 108 | QApplication::polish ( w ); |
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | // Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes | 112 | // Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes |
113 | // were multiplied by 10 (which was incorrect) | 113 | // were multiplied by 10 (which was incorrect) |
114 | 114 | ||
115 | QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) | 115 | QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) |
116 | { | 116 | { |
117 | //qDebug ( "QFontDatabase::pointSizes()" ); | 117 | //qDebug ( "QFontDatabase::pointSizes()" ); |
118 | 118 | ||
119 | QValueList <int> sl = pointSizes_NonWeak ( family, style, charset ); | 119 | QValueList <int> sl = pointSizes_NonWeak ( family, style, charset ); |
120 | 120 | ||
121 | for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { | 121 | for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { |
122 | if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) { | 122 | if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) { |
123 | for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 123 | for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
124 | *it *= 10; | 124 | *it *= 10; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | return sl; | 127 | return sl; |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | // Various style/font/color related overrides for weak symbols in Qt/E, | 131 | // Various style/font/color related overrides for weak symbols in Qt/E, |
132 | // which allows us to force the usage of the global Opie appearance. | 132 | // which allows us to force the usage of the global Opie appearance. |
133 | 133 | ||
134 | void QApplication::setStyle ( QStyle *style ) | 134 | void QApplication::setStyle ( QStyle *style ) |
135 | { | 135 | { |
136 | //qDebug ( "QApplication::setStyle()" ); | 136 | //qDebug ( "QApplication::setStyle()" ); |
137 | 137 | ||
138 | if ( Opie::force_appearance & Opie::Force_Style ) | 138 | if ( Opie::force_appearance & Opie::Force_Style ) |
139 | delete style; | 139 | delete style; |
140 | else | 140 | else |
141 | QApplication::setStyle_NonWeak ( style ); | 141 | QApplication::setStyle_NonWeak ( style ); |
142 | } | 142 | } |
143 | 143 | ||
144 | void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) | 144 | void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) |
145 | { | 145 | { |
146 | //qDebug ( "QApplication::setPalette()" ); | 146 | //qDebug ( "QApplication::setPalette()" ); |
147 | 147 | ||
148 | if (!( Opie::force_appearance & Opie::Force_Style )) | 148 | if (!( Opie::force_appearance & Opie::Force_Style )) |
149 | QApplication::setPalette_NonWeak ( pal, informWidgets, className ); | 149 | QApplication::setPalette_NonWeak ( pal, informWidgets, className ); |
150 | } | 150 | } |
151 | 151 | ||
152 | void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) | 152 | void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) |
153 | { | 153 | { |
154 | //qDebug ( "QApplication::setFont()" ); | 154 | //qDebug ( "QApplication::setFont()" ); |
155 | 155 | ||
156 | if (!( Opie::force_appearance & Opie::Force_Font )) | 156 | if (!( Opie::force_appearance & Opie::Force_Font )) |
157 | QApplication::setFont_NonWeak ( fnt, informWidgets, className ); | 157 | QApplication::setFont_NonWeak ( fnt, informWidgets, className ); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | void QApplication::qwsSetDecoration ( QWSDecoration *deco ) | 161 | void QApplication::qwsSetDecoration ( QWSDecoration *deco ) |
162 | { | 162 | { |
163 | //qDebug ( "QApplication::qwsSetDecoration()" ); | 163 | //qDebug ( "QApplication::qwsSetDecoration()" ); |
164 | 164 | ||
165 | if ( Opie::force_appearance & Opie::Force_Decoration ) | 165 | if ( Opie::force_appearance & Opie::Force_Decoration ) |
166 | delete deco; | 166 | delete deco; |
167 | else | 167 | else |
168 | QApplication::qwsSetDecoration_NonWeak ( deco ); | 168 | QApplication::qwsSetDecoration_NonWeak ( deco ); |
169 | } | 169 | } |
170 | 170 | ||
171 | #endif \ No newline at end of file | ||
diff --git a/library/qt_override_p.h b/library/qt_override_p.h index d11917c..cb05d15 100644 --- a/library/qt_override_p.h +++ b/library/qt_override_p.h | |||
@@ -1,21 +1,25 @@ | |||
1 | #ifndef __QT_OVERRIDE_H__ | 1 | #ifndef __QT_OVERRIDE_H__ |
2 | #define __QT_OVERRIDE_H__ | 2 | #define __QT_OVERRIDE_H__ |
3 | 3 | ||
4 | #if QT_VERSION > 233 | ||
5 | |||
4 | namespace Opie { | 6 | namespace Opie { |
5 | 7 | ||
6 | enum ForceAppearance { | 8 | enum ForceAppearance { |
7 | Force_Style = 0x01, | 9 | Force_Style = 0x01, |
8 | Force_Font = 0x02, | 10 | Force_Font = 0x02, |
9 | Force_Decoration = 0x04, | 11 | Force_Decoration = 0x04, |
10 | 12 | ||
11 | Force_All = 0xff, | 13 | Force_All = 0xff, |
12 | Force_None = 0x00, | 14 | Force_None = 0x00, |
13 | }; | 15 | }; |
14 | 16 | ||
15 | extern const char *binaryName ( ); | 17 | extern const char *binaryName ( ); |
16 | 18 | ||
17 | extern int force_appearance; | 19 | extern int force_appearance; |
18 | 20 | ||
19 | } | 21 | } |
20 | 22 | ||
23 | #endif // (QT_VERSION >233) | ||
24 | |||
21 | #endif | 25 | #endif |