-rw-r--r-- | library/qpeapplication.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 71ec5b3..bf353d4 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -884,404 +884,404 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) | |||
884 | return TRUE; | 884 | return TRUE; |
885 | } | 885 | } |
886 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { | 886 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { |
887 | QSignal s; | 887 | QSignal s; |
888 | s.connect( active, SLOT( accept() ) ); | 888 | s.connect( active, SLOT( accept() ) ); |
889 | s.activate(); | 889 | s.activate(); |
890 | } | 890 | } |
891 | else { | 891 | else { |
892 | // do the same as with the select key: Map to the default action of the widget: | 892 | // do the same as with the select key: Map to the default action of the widget: |
893 | mapToDefaultAction( ke, Qt::Key_Return ); | 893 | mapToDefaultAction( ke, Qt::Key_Return ); |
894 | } | 894 | } |
895 | } | 895 | } |
896 | } | 896 | } |
897 | } | 897 | } |
898 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 898 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
899 | // Use special "select" key to do whatever default action a widget has | 899 | // Use special "select" key to do whatever default action a widget has |
900 | mapToDefaultAction( ke, Qt::Key_Space ); | 900 | mapToDefaultAction( ke, Qt::Key_Space ); |
901 | } | 901 | } |
902 | else if ( ke->simpleData.keycode == Qt::Key_Escape && | 902 | else if ( ke->simpleData.keycode == Qt::Key_Escape && |
903 | ke->simpleData.is_press ) { | 903 | ke->simpleData.is_press ) { |
904 | // Escape key closes app if focus on toplevel | 904 | // Escape key closes app if focus on toplevel |
905 | QWidget * active = activeWindow(); | 905 | QWidget * active = activeWindow(); |
906 | if ( active && active->testWFlags( WType_TopLevel ) && | 906 | if ( active && active->testWFlags( WType_TopLevel ) && |
907 | ( int ) active->winId() == ke->simpleData.window && | 907 | ( int ) active->winId() == ke->simpleData.window && |
908 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 908 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
909 | if ( active->inherits( "QDialog" ) ) { | 909 | if ( active->inherits( "QDialog" ) ) { |
910 | HackDialog * d = ( HackDialog * ) active; | 910 | HackDialog * d = ( HackDialog * ) active; |
911 | d->rejectIt(); | 911 | d->rejectIt(); |
912 | return TRUE; | 912 | return TRUE; |
913 | } | 913 | } |
914 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { | 914 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { |
915 | active->close(); | 915 | active->close(); |
916 | } | 916 | } |
917 | } | 917 | } |
918 | } | 918 | } |
919 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { | 919 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { |
920 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) | 920 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) |
921 | // but we cannot access libopie function within libqpe :( | 921 | // but we cannot access libopie function within libqpe :( |
922 | 922 | ||
923 | QWidget * active = activeWindow ( ); | 923 | QWidget * active = activeWindow ( ); |
924 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 924 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
925 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 925 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
926 | QChar ch ( ke-> simpleData.unicode ); | 926 | QChar ch ( ke-> simpleData.unicode ); |
927 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 927 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
928 | ke-> simpleData.keycode, | 928 | ke-> simpleData.keycode, |
929 | ch. latin1 ( ), | 929 | ch. latin1 ( ), |
930 | ke-> simpleData.modifiers, | 930 | ke-> simpleData.modifiers, |
931 | QString ( ch ), | 931 | QString ( ch ), |
932 | ke-> simpleData.is_auto_repeat, 1 ); | 932 | ke-> simpleData.is_auto_repeat, 1 ); |
933 | 933 | ||
934 | QObject *which = QWidget::keyboardGrabber ( ); | 934 | QObject *which = QWidget::keyboardGrabber ( ); |
935 | if ( !which ) | 935 | if ( !which ) |
936 | which = QApplication::focusWidget ( ); | 936 | which = QApplication::focusWidget ( ); |
937 | if ( !which ) | 937 | if ( !which ) |
938 | which = QApplication::activeWindow ( ); | 938 | which = QApplication::activeWindow ( ); |
939 | if ( !which ) | 939 | if ( !which ) |
940 | which = qApp; | 940 | which = qApp; |
941 | 941 | ||
942 | QApplication::sendEvent ( which, &qke ); | 942 | QApplication::sendEvent ( which, &qke ); |
943 | } | 943 | } |
944 | else { // we didn't grab the keyboard, so send the event to the launcher | 944 | else { // we didn't grab the keyboard, so send the event to the launcher |
945 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 945 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); |
946 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); | 946 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); |
947 | } | 947 | } |
948 | } | 948 | } |
949 | return true; | 949 | return true; |
950 | } | 950 | } |
951 | } | 951 | } |
952 | if ( e->type == QWSEvent::Focus ) { | 952 | if ( e->type == QWSEvent::Focus ) { |
953 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 953 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
954 | if ( !fe->simpleData.get_focus ) { | 954 | if ( !fe->simpleData.get_focus ) { |
955 | QWidget * active = activeWindow(); | 955 | QWidget * active = activeWindow(); |
956 | while ( active && active->isPopup() ) { | 956 | while ( active && active->isPopup() ) { |
957 | active->close(); | 957 | active->close(); |
958 | active = activeWindow(); | 958 | active = activeWindow(); |
959 | } | 959 | } |
960 | } | 960 | } |
961 | else { | 961 | else { |
962 | // make sure our modal widget is ALWAYS on top | 962 | // make sure our modal widget is ALWAYS on top |
963 | QWidget *topm = activeModalWidget(); | 963 | QWidget *topm = activeModalWidget(); |
964 | if ( topm ) { | 964 | if ( topm ) { |
965 | topm->raise(); | 965 | topm->raise(); |
966 | } | 966 | } |
967 | } | 967 | } |
968 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 968 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
969 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 969 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
970 | if ( m == AlwaysOff ) | 970 | if ( m == AlwaysOff ) |
971 | Global::hideInputMethod(); | 971 | Global::hideInputMethod(); |
972 | if ( m == AlwaysOn ) | 972 | if ( m == AlwaysOn ) |
973 | Global::showInputMethod(); | 973 | Global::showInputMethod(); |
974 | } | 974 | } |
975 | } | 975 | } |
976 | 976 | ||
977 | 977 | ||
978 | return QApplication::qwsEventFilter( e ); | 978 | return QApplication::qwsEventFilter( e ); |
979 | } | 979 | } |
980 | #endif | 980 | #endif |
981 | 981 | ||
982 | /*! | 982 | /*! |
983 | Destroys the QPEApplication. | 983 | Destroys the QPEApplication. |
984 | */ | 984 | */ |
985 | QPEApplication::~QPEApplication() | 985 | QPEApplication::~QPEApplication() |
986 | { | 986 | { |
987 | ungrabKeyboard(); | 987 | ungrabKeyboard(); |
988 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 988 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
989 | // Need to delete QCopChannels early, since the display will | 989 | // Need to delete QCopChannels early, since the display will |
990 | // be gone by the time we get to ~QObject(). | 990 | // be gone by the time we get to ~QObject(). |
991 | delete sysChannel; | 991 | delete sysChannel; |
992 | delete pidChannel; | 992 | delete pidChannel; |
993 | #endif | 993 | #endif |
994 | 994 | ||
995 | delete d; | 995 | delete d; |
996 | } | 996 | } |
997 | 997 | ||
998 | /*! | 998 | /*! |
999 | Returns <tt>$OPIEDIR/</tt>. | 999 | Returns <tt>$OPIEDIR/</tt>. |
1000 | */ | 1000 | */ |
1001 | QString QPEApplication::qpeDir() | 1001 | QString QPEApplication::qpeDir() |
1002 | { | 1002 | { |
1003 | const char * base = getenv( "OPIEDIR" ); | 1003 | const char * base = getenv( "OPIEDIR" ); |
1004 | if ( base ) | 1004 | if ( base ) |
1005 | return QString( base ) + "/"; | 1005 | return QString( base ) + "/"; |
1006 | 1006 | ||
1007 | return QString( "../" ); | 1007 | return QString( "../" ); |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | /*! | 1010 | /*! |
1011 | Returns the user's current Document directory. There is a trailing "/". | 1011 | Returns the user's current Document directory. There is a trailing "/". |
1012 | .. well, it does now,, and there's no trailing '/' | 1012 | .. well, it does now,, and there's no trailing '/' |
1013 | */ | 1013 | */ |
1014 | QString QPEApplication::documentDir() | 1014 | QString QPEApplication::documentDir() |
1015 | { | 1015 | { |
1016 | const char* base = getenv( "HOME"); | 1016 | const char* base = getenv( "HOME"); |
1017 | if ( base ) | 1017 | if ( base ) |
1018 | return QString( base ) + "/Documents"; | 1018 | return QString( base ) + "/Documents"; |
1019 | 1019 | ||
1020 | return QString( "../Documents" ); | 1020 | return QString( "../Documents" ); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | static int deforient = -1; | 1023 | static int deforient = -1; |
1024 | 1024 | ||
1025 | /*! | 1025 | /*! |
1026 | \internal | 1026 | \internal |
1027 | */ | 1027 | */ |
1028 | int QPEApplication::defaultRotation() | 1028 | int QPEApplication::defaultRotation() |
1029 | { | 1029 | { |
1030 | if ( deforient < 0 ) { | 1030 | if ( deforient < 0 ) { |
1031 | QString d = getenv( "QWS_DISPLAY" ); | 1031 | QString d = getenv( "QWS_DISPLAY" ); |
1032 | if ( d.contains( "Rot90" ) ) { | 1032 | if ( d.contains( "Rot90" ) ) { |
1033 | deforient = 90; | 1033 | deforient = 90; |
1034 | } | 1034 | } |
1035 | else if ( d.contains( "Rot180" ) ) { | 1035 | else if ( d.contains( "Rot180" ) ) { |
1036 | deforient = 180; | 1036 | deforient = 180; |
1037 | } | 1037 | } |
1038 | else if ( d.contains( "Rot270" ) ) { | 1038 | else if ( d.contains( "Rot270" ) ) { |
1039 | deforient = 270; | 1039 | deforient = 270; |
1040 | } | 1040 | } |
1041 | else { | 1041 | else { |
1042 | deforient = 0; | 1042 | deforient = 0; |
1043 | } | 1043 | } |
1044 | } | 1044 | } |
1045 | return deforient; | 1045 | return deforient; |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | /*! | 1048 | /*! |
1049 | \internal | 1049 | \internal |
1050 | */ | 1050 | */ |
1051 | void QPEApplication::setDefaultRotation( int r ) | 1051 | void QPEApplication::setDefaultRotation( int r ) |
1052 | { | 1052 | { |
1053 | if ( qApp->type() == GuiServer ) { | 1053 | if ( qApp->type() == GuiServer ) { |
1054 | deforient = r; | 1054 | deforient = r; |
1055 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1055 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
1056 | Config config("qpe"); | 1056 | Config config("qpe"); |
1057 | config.setGroup( "Rotation" ); | 1057 | config.setGroup( "Rotation" ); |
1058 | config.writeEntry( "Rot", r ); | 1058 | config.writeEntry( "Rot", r ); |
1059 | } | 1059 | } |
1060 | else { | 1060 | else { |
1061 | #ifndef QT_NO_COP | 1061 | #ifndef QT_NO_COP |
1062 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1062 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1063 | e << r; | 1063 | e << r; |
1064 | } | 1064 | } |
1065 | #endif | 1065 | #endif |
1066 | 1066 | ||
1067 | } | 1067 | } |
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | #include <qgfx_qws.h> | 1070 | #include <qgfx_qws.h> |
1071 | #include <qwindowsystem_qws.h> | 1071 | #include <qwindowsystem_qws.h> |
1072 | #include <qpixmapcache.h> | 1072 | #include <qpixmapcache.h> |
1073 | 1073 | ||
1074 | extern void qws_clearLoadedFonts(); | 1074 | extern void qws_clearLoadedFonts(); |
1075 | 1075 | ||
1076 | inline void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1076 | void QPEApplication::setCurrentMode( int x, int y, int depth ) |
1077 | { | 1077 | { |
1078 | // Reset the caches | 1078 | // Reset the caches |
1079 | qws_clearLoadedFonts(); | 1079 | qws_clearLoadedFonts(); |
1080 | QPixmapCache::clear(); | 1080 | QPixmapCache::clear(); |
1081 | 1081 | ||
1082 | // Change the screen mode | 1082 | // Change the screen mode |
1083 | qt_screen->setMode(x, y, depth); | 1083 | qt_screen->setMode(x, y, depth); |
1084 | 1084 | ||
1085 | if ( qApp->type() == GuiServer ) { | 1085 | if ( qApp->type() == GuiServer ) { |
1086 | // Reconfigure the GuiServer | 1086 | // Reconfigure the GuiServer |
1087 | qwsServer->beginDisplayReconfigure(); | 1087 | qwsServer->beginDisplayReconfigure(); |
1088 | qwsServer->endDisplayReconfigure(); | 1088 | qwsServer->endDisplayReconfigure(); |
1089 | 1089 | ||
1090 | // Get all the running apps to reset | 1090 | // Get all the running apps to reset |
1091 | QCopEnvelope env( "QPE/System", "reset()" ); | 1091 | QCopEnvelope env( "QPE/System", "reset()" ); |
1092 | } | 1092 | } |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | inline void QPEApplication::reset() { | 1095 | void QPEApplication::reset() { |
1096 | // Reconnect to the screen | 1096 | // Reconnect to the screen |
1097 | qt_screen->disconnect(); | 1097 | qt_screen->disconnect(); |
1098 | qt_screen->connect( QString::null ); | 1098 | qt_screen->connect( QString::null ); |
1099 | 1099 | ||
1100 | // Redraw everything | 1100 | // Redraw everything |
1101 | applyStyle(); | 1101 | applyStyle(); |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | /*! | 1104 | /*! |
1105 | \internal | 1105 | \internal |
1106 | */ | 1106 | */ |
1107 | void QPEApplication::applyStyle() | 1107 | void QPEApplication::applyStyle() |
1108 | { | 1108 | { |
1109 | Config config( "qpe" ); | 1109 | Config config( "qpe" ); |
1110 | config.setGroup( "Appearance" ); | 1110 | config.setGroup( "Appearance" ); |
1111 | 1111 | ||
1112 | #if QT_VERSION > 233 | 1112 | #if QT_VERSION > 233 |
1113 | // don't block ourselves ... | 1113 | // don't block ourselves ... |
1114 | Opie::force_appearance = 0; | 1114 | Opie::force_appearance = 0; |
1115 | 1115 | ||
1116 | static QString appname = Opie::binaryName ( ); | 1116 | static QString appname = Opie::binaryName ( ); |
1117 | 1117 | ||
1118 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 1118 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
1119 | int nostyle = 0; | 1119 | int nostyle = 0; |
1120 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 1120 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
1121 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 1121 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
1122 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 1122 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
1123 | break; | 1123 | break; |
1124 | } | 1124 | } |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | // Widget style | 1127 | // Widget style |
1128 | QString style = config.readEntry( "Style", "FlatStyle" ); | 1128 | QString style = config.readEntry( "Style", "FlatStyle" ); |
1129 | 1129 | ||
1130 | // don't set a custom style | 1130 | // don't set a custom style |
1131 | if ( nostyle & Opie::Force_Style ) | 1131 | if ( nostyle & Opie::Force_Style ) |
1132 | style = "FlatStyle"; | 1132 | style = "FlatStyle"; |
1133 | 1133 | ||
1134 | internalSetStyle ( style ); | 1134 | internalSetStyle ( style ); |
1135 | 1135 | ||
1136 | // Colors - from /etc/colors/Liquid.scheme | 1136 | // Colors - from /etc/colors/Liquid.scheme |
1137 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); | 1137 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); |
1138 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); | 1138 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); |
1139 | QPalette pal( btncolor, bgcolor ); | 1139 | QPalette pal( btncolor, bgcolor ); |
1140 | QString color = config.readEntry( "Highlight", "#73adef" ); | 1140 | QString color = config.readEntry( "Highlight", "#73adef" ); |
1141 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1141 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1142 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1142 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1143 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1143 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1144 | color = config.readEntry( "Text", "#000000" ); | 1144 | color = config.readEntry( "Text", "#000000" ); |
1145 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1145 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1146 | color = config.readEntry( "ButtonText", "#000000" ); | 1146 | color = config.readEntry( "ButtonText", "#000000" ); |
1147 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1147 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1148 | color = config.readEntry( "Base", "#FFFFFF" ); | 1148 | color = config.readEntry( "Base", "#FFFFFF" ); |
1149 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1149 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1150 | 1150 | ||
1151 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1151 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1152 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1152 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1153 | 1153 | ||
1154 | setPalette( pal, TRUE ); | 1154 | setPalette( pal, TRUE ); |
1155 | 1155 | ||
1156 | // Window Decoration | 1156 | // Window Decoration |
1157 | QString dec = config.readEntry( "Decoration", "Flat" ); | 1157 | QString dec = config.readEntry( "Decoration", "Flat" ); |
1158 | 1158 | ||
1159 | // don't set a custom deco | 1159 | // don't set a custom deco |
1160 | if ( nostyle & Opie::Force_Decoration ) | 1160 | if ( nostyle & Opie::Force_Decoration ) |
1161 | dec = ""; | 1161 | dec = ""; |
1162 | 1162 | ||
1163 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1163 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1164 | 1164 | ||
1165 | if ( dec != d->decorationName ) { | 1165 | if ( dec != d->decorationName ) { |
1166 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1166 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1167 | d->decorationName = dec; | 1167 | d->decorationName = dec; |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | // Font | 1170 | // Font |
1171 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1171 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1172 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1172 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1173 | 1173 | ||
1174 | // don't set a custom font | 1174 | // don't set a custom font |
1175 | if ( nostyle & Opie::Force_Font ) { | 1175 | if ( nostyle & Opie::Force_Font ) { |
1176 | ff = "Vera"; | 1176 | ff = "Vera"; |
1177 | fs = 10; | 1177 | fs = 10; |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | setFont ( QFont ( ff, fs ), true ); | 1180 | setFont ( QFont ( ff, fs ), true ); |
1181 | 1181 | ||
1182 | // revert to global blocking policy ... | 1182 | // revert to global blocking policy ... |
1183 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1183 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1184 | Opie::force_appearance &= ~nostyle; | 1184 | Opie::force_appearance &= ~nostyle; |
1185 | #endif | 1185 | #endif |
1186 | } | 1186 | } |
1187 | 1187 | ||
1188 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1188 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1189 | { | 1189 | { |
1190 | #ifdef Q_WS_QWS | 1190 | #ifdef Q_WS_QWS |
1191 | QDataStream stream( data, IO_ReadOnly ); | 1191 | QDataStream stream( data, IO_ReadOnly ); |
1192 | if ( msg == "applyStyle()" ) { | 1192 | if ( msg == "applyStyle()" ) { |
1193 | applyStyle(); | 1193 | applyStyle(); |
1194 | } | 1194 | } |
1195 | else if ( msg == "toggleApplicationMenu()" ) { | 1195 | else if ( msg == "toggleApplicationMenu()" ) { |
1196 | QWidget *active = activeWindow ( ); | 1196 | QWidget *active = activeWindow ( ); |
1197 | 1197 | ||
1198 | if ( active ) { | 1198 | if ( active ) { |
1199 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1199 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1200 | bool oldactive = man-> isActive ( ); | 1200 | bool oldactive = man-> isActive ( ); |
1201 | 1201 | ||
1202 | man-> setActive( !man-> isActive() ); | 1202 | man-> setActive( !man-> isActive() ); |
1203 | 1203 | ||
1204 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1204 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1205 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1205 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1206 | } | 1206 | } |
1207 | } | 1207 | } |
1208 | } | 1208 | } |
1209 | else if ( msg == "setDefaultRotation(int)" ) { | 1209 | else if ( msg == "setDefaultRotation(int)" ) { |
1210 | if ( type() == GuiServer ) { | 1210 | if ( type() == GuiServer ) { |
1211 | int r; | 1211 | int r; |
1212 | stream >> r; | 1212 | stream >> r; |
1213 | setDefaultRotation( r ); | 1213 | setDefaultRotation( r ); |
1214 | } | 1214 | } |
1215 | } | 1215 | } |
1216 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> | 1216 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> |
1217 | if ( type() == GuiServer ) { | 1217 | if ( type() == GuiServer ) { |
1218 | int x, y, depth; | 1218 | int x, y, depth; |
1219 | stream >> x; | 1219 | stream >> x; |
1220 | stream >> y; | 1220 | stream >> y; |
1221 | stream >> depth; | 1221 | stream >> depth; |
1222 | setCurrentMode( x, y, depth ); | 1222 | setCurrentMode( x, y, depth ); |
1223 | } | 1223 | } |
1224 | } | 1224 | } |
1225 | else if ( msg == "reset()" ) { | 1225 | else if ( msg == "reset()" ) { |
1226 | if ( type() != GuiServer ) | 1226 | if ( type() != GuiServer ) |
1227 | reset(); | 1227 | reset(); |
1228 | } | 1228 | } |
1229 | else if ( msg == "setCurrentRotation(int)" ) { | 1229 | else if ( msg == "setCurrentRotation(int)" ) { |
1230 | int r; | 1230 | int r; |
1231 | stream >> r; | 1231 | stream >> r; |
1232 | setCurrentRotation( r ); | 1232 | setCurrentRotation( r ); |
1233 | } | 1233 | } |
1234 | else if ( msg == "shutdown()" ) { | 1234 | else if ( msg == "shutdown()" ) { |
1235 | if ( type() == GuiServer ) | 1235 | if ( type() == GuiServer ) |
1236 | shutdown(); | 1236 | shutdown(); |
1237 | } | 1237 | } |
1238 | else if ( msg == "quit()" ) { | 1238 | else if ( msg == "quit()" ) { |
1239 | if ( type() != GuiServer ) | 1239 | if ( type() != GuiServer ) |
1240 | tryQuit(); | 1240 | tryQuit(); |
1241 | } | 1241 | } |
1242 | else if ( msg == "forceQuit()" ) { | 1242 | else if ( msg == "forceQuit()" ) { |
1243 | if ( type() != GuiServer ) | 1243 | if ( type() != GuiServer ) |
1244 | quit(); | 1244 | quit(); |
1245 | } | 1245 | } |
1246 | else if ( msg == "restart()" ) { | 1246 | else if ( msg == "restart()" ) { |
1247 | if ( type() == GuiServer ) | 1247 | if ( type() == GuiServer ) |
1248 | restart(); | 1248 | restart(); |
1249 | } | 1249 | } |
1250 | else if ( msg == "language(QString)" ) { | 1250 | else if ( msg == "language(QString)" ) { |
1251 | if ( type() == GuiServer ) { | 1251 | if ( type() == GuiServer ) { |
1252 | QString l; | 1252 | QString l; |
1253 | stream >> l; | 1253 | stream >> l; |
1254 | QString cl = getenv( "LANG" ); | 1254 | QString cl = getenv( "LANG" ); |
1255 | if ( cl != l ) { | 1255 | if ( cl != l ) { |
1256 | if ( l.isNull() ) | 1256 | if ( l.isNull() ) |
1257 | unsetenv( "LANG" ); | 1257 | unsetenv( "LANG" ); |
1258 | else | 1258 | else |
1259 | setenv( "LANG", l.latin1(), 1 ); | 1259 | setenv( "LANG", l.latin1(), 1 ); |
1260 | restart(); | 1260 | restart(); |
1261 | } | 1261 | } |
1262 | } | 1262 | } |
1263 | } | 1263 | } |
1264 | else if ( msg == "timeChange(QString)" ) { | 1264 | else if ( msg == "timeChange(QString)" ) { |
1265 | QString t; | 1265 | QString t; |
1266 | stream >> t; | 1266 | stream >> t; |
1267 | if ( t.isNull() ) | 1267 | if ( t.isNull() ) |
1268 | unsetenv( "TZ" ); | 1268 | unsetenv( "TZ" ); |
1269 | else | 1269 | else |
1270 | setenv( "TZ", t.latin1(), 1 ); | 1270 | setenv( "TZ", t.latin1(), 1 ); |
1271 | // emit the signal so everyone else knows... | 1271 | // emit the signal so everyone else knows... |
1272 | emit timeChanged(); | 1272 | emit timeChanged(); |
1273 | } | 1273 | } |
1274 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { | 1274 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { |
1275 | if ( type() == GuiServer ) { | 1275 | if ( type() == GuiServer ) { |
1276 | QDateTime when; | 1276 | QDateTime when; |
1277 | QCString channel, message; | 1277 | QCString channel, message; |
1278 | int data; | 1278 | int data; |
1279 | stream >> when >> channel >> message >> data; | 1279 | stream >> when >> channel >> message >> data; |
1280 | AlarmServer::addAlarm( when, channel, message, data ); | 1280 | AlarmServer::addAlarm( when, channel, message, data ); |
1281 | } | 1281 | } |
1282 | } | 1282 | } |
1283 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { | 1283 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { |
1284 | if ( type() == GuiServer ) { | 1284 | if ( type() == GuiServer ) { |
1285 | QDateTime when; | 1285 | QDateTime when; |
1286 | QCString channel, message; | 1286 | QCString channel, message; |
1287 | int data; | 1287 | int data; |