-rw-r--r-- | library/qpeapplication.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index c7ef2b7..262221e 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -977,257 +977,256 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) | |||
977 | else { // we didn't grab the keyboard, so send the event to the launcher | 977 | else { // we didn't grab the keyboard, so send the event to the launcher |
978 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 978 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); |
979 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); | 979 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); |
980 | } | 980 | } |
981 | } | 981 | } |
982 | return true; | 982 | return true; |
983 | } | 983 | } |
984 | } | 984 | } |
985 | if ( e->type == QWSEvent::Focus ) { | 985 | if ( e->type == QWSEvent::Focus ) { |
986 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 986 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
987 | if ( !fe->simpleData.get_focus ) { | 987 | if ( !fe->simpleData.get_focus ) { |
988 | QWidget * active = activeWindow(); | 988 | QWidget * active = activeWindow(); |
989 | while ( active && active->isPopup() ) { | 989 | while ( active && active->isPopup() ) { |
990 | active->close(); | 990 | active->close(); |
991 | active = activeWindow(); | 991 | active = activeWindow(); |
992 | } | 992 | } |
993 | } | 993 | } |
994 | else { | 994 | else { |
995 | // make sure our modal widget is ALWAYS on top | 995 | // make sure our modal widget is ALWAYS on top |
996 | QWidget *topm = activeModalWidget(); | 996 | QWidget *topm = activeModalWidget(); |
997 | if ( topm ) { | 997 | if ( topm ) { |
998 | topm->raise(); | 998 | topm->raise(); |
999 | } | 999 | } |
1000 | } | 1000 | } |
1001 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 1001 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
1002 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 1002 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
1003 | if ( m == AlwaysOff ) | 1003 | if ( m == AlwaysOff ) |
1004 | Global::hideInputMethod(); | 1004 | Global::hideInputMethod(); |
1005 | if ( m == AlwaysOn ) | 1005 | if ( m == AlwaysOn ) |
1006 | Global::showInputMethod(); | 1006 | Global::showInputMethod(); |
1007 | } | 1007 | } |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | 1010 | ||
1011 | return QApplication::qwsEventFilter( e ); | 1011 | return QApplication::qwsEventFilter( e ); |
1012 | } | 1012 | } |
1013 | #endif | 1013 | #endif |
1014 | 1014 | ||
1015 | /*! | 1015 | /*! |
1016 | Destroys the QPEApplication. | 1016 | Destroys the QPEApplication. |
1017 | */ | 1017 | */ |
1018 | QPEApplication::~QPEApplication() | 1018 | QPEApplication::~QPEApplication() |
1019 | { | 1019 | { |
1020 | ungrabKeyboard(); | 1020 | ungrabKeyboard(); |
1021 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 1021 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
1022 | // Need to delete QCopChannels early, since the display will | 1022 | // Need to delete QCopChannels early, since the display will |
1023 | // be gone by the time we get to ~QObject(). | 1023 | // be gone by the time we get to ~QObject(). |
1024 | delete sysChannel; | 1024 | delete sysChannel; |
1025 | delete pidChannel; | 1025 | delete pidChannel; |
1026 | #endif | 1026 | #endif |
1027 | 1027 | ||
1028 | delete d; | 1028 | delete d; |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | /*! | 1031 | /*! |
1032 | Returns <tt>$OPIEDIR/</tt>. | 1032 | Returns <tt>$OPIEDIR/</tt>. |
1033 | */ | 1033 | */ |
1034 | QString QPEApplication::qpeDir() | 1034 | QString QPEApplication::qpeDir() |
1035 | { | 1035 | { |
1036 | const char * base = getenv( "OPIEDIR" ); | 1036 | const char * base = getenv( "OPIEDIR" ); |
1037 | if ( base ) | 1037 | if ( base ) |
1038 | return QString( base ) + "/"; | 1038 | return QString( base ) + "/"; |
1039 | 1039 | ||
1040 | return QString( "../" ); | 1040 | return QString( "../" ); |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | /*! | 1043 | /*! |
1044 | Returns the user's current Document directory. There is a trailing "/". | 1044 | Returns the user's current Document directory. There is a trailing "/". |
1045 | .. well, it does now,, and there's no trailing '/' | 1045 | .. well, it does now,, and there's no trailing '/' |
1046 | */ | 1046 | */ |
1047 | QString QPEApplication::documentDir() | 1047 | QString QPEApplication::documentDir() |
1048 | { | 1048 | { |
1049 | const char* base = getenv( "HOME"); | 1049 | const char* base = getenv( "HOME"); |
1050 | if ( base ) | 1050 | if ( base ) |
1051 | return QString( base ) + "/Documents"; | 1051 | return QString( base ) + "/Documents"; |
1052 | 1052 | ||
1053 | return QString( "../Documents" ); | 1053 | return QString( "../Documents" ); |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | static int deforient = -1; | 1056 | static int deforient = -1; |
1057 | 1057 | ||
1058 | /*! | 1058 | /*! |
1059 | \internal | 1059 | \internal |
1060 | */ | 1060 | */ |
1061 | int QPEApplication::defaultRotation() | 1061 | int QPEApplication::defaultRotation() |
1062 | { | 1062 | { |
1063 | if ( deforient < 0 ) { | 1063 | if ( deforient < 0 ) { |
1064 | QString d = getenv( "QWS_DISPLAY" ); | 1064 | QString d = getenv( "QWS_DISPLAY" ); |
1065 | if ( d.contains( "Rot90" ) ) { | 1065 | if ( d.contains( "Rot90" ) ) { |
1066 | deforient = 90; | 1066 | deforient = 90; |
1067 | } | 1067 | } |
1068 | else if ( d.contains( "Rot180" ) ) { | 1068 | else if ( d.contains( "Rot180" ) ) { |
1069 | deforient = 180; | 1069 | deforient = 180; |
1070 | } | 1070 | } |
1071 | else if ( d.contains( "Rot270" ) ) { | 1071 | else if ( d.contains( "Rot270" ) ) { |
1072 | deforient = 270; | 1072 | deforient = 270; |
1073 | } | 1073 | } |
1074 | else { | 1074 | else { |
1075 | deforient = 0; | 1075 | deforient = 0; |
1076 | } | 1076 | } |
1077 | } | 1077 | } |
1078 | return deforient; | 1078 | return deforient; |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | /*! | 1081 | /*! |
1082 | \internal | 1082 | \internal |
1083 | */ | 1083 | */ |
1084 | void QPEApplication::setDefaultRotation( int r ) | 1084 | void QPEApplication::setDefaultRotation( int r ) |
1085 | { | 1085 | { |
1086 | if ( qApp->type() == GuiServer ) { | 1086 | if ( qApp->type() == GuiServer ) { |
1087 | deforient = r; | 1087 | deforient = r; |
1088 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1088 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
1089 | Config config("qpe"); | 1089 | Config config("qpe"); |
1090 | config.setGroup( "Rotation" ); | 1090 | config.setGroup( "Rotation" ); |
1091 | config.writeEntry( "Rot", r ); | 1091 | config.writeEntry( "Rot", r ); |
1092 | } | 1092 | } |
1093 | else { | 1093 | else { |
1094 | #ifndef QT_NO_COP | 1094 | #ifndef QT_NO_COP |
1095 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1095 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1096 | e << r; | 1096 | e << r; |
1097 | } | 1097 | } |
1098 | #endif | 1098 | #endif |
1099 | 1099 | ||
1100 | } | 1100 | } |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | #include <qgfx_qws.h> | 1103 | #include <qgfx_qws.h> |
1104 | #include <qwindowsystem_qws.h> | 1104 | #include <qwindowsystem_qws.h> |
1105 | #include <qpixmapcache.h> | ||
1106 | 1105 | ||
1107 | extern void qws_clearLoadedFonts(); | 1106 | extern void qws_clearLoadedFonts(); |
1108 | 1107 | ||
1109 | void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1108 | void QPEApplication::setCurrentMode( int x, int y, int depth ) |
1110 | { | 1109 | { |
1111 | // Reset the caches | 1110 | // Reset the caches |
1112 | qws_clearLoadedFonts(); | 1111 | qws_clearLoadedFonts(); |
1113 | QPixmapCache::clear(); | 1112 | QPixmapCache::clear(); |
1114 | 1113 | ||
1115 | // Change the screen mode | 1114 | // Change the screen mode |
1116 | qt_screen->setMode(x, y, depth); | 1115 | qt_screen->setMode(x, y, depth); |
1117 | 1116 | ||
1118 | if ( qApp->type() == GuiServer ) { | 1117 | if ( qApp->type() == GuiServer ) { |
1119 | // Reconfigure the GuiServer | 1118 | // Reconfigure the GuiServer |
1120 | qwsServer->beginDisplayReconfigure(); | 1119 | qwsServer->beginDisplayReconfigure(); |
1121 | qwsServer->endDisplayReconfigure(); | 1120 | qwsServer->endDisplayReconfigure(); |
1122 | 1121 | ||
1123 | // Get all the running apps to reset | 1122 | // Get all the running apps to reset |
1124 | QCopEnvelope env( "QPE/System", "reset()" ); | 1123 | QCopEnvelope env( "QPE/System", "reset()" ); |
1125 | } | 1124 | } |
1126 | } | 1125 | } |
1127 | 1126 | ||
1128 | void QPEApplication::reset() { | 1127 | void QPEApplication::reset() { |
1129 | // Reconnect to the screen | 1128 | // Reconnect to the screen |
1130 | qt_screen->disconnect(); | 1129 | qt_screen->disconnect(); |
1131 | qt_screen->connect( QString::null ); | 1130 | qt_screen->connect( QString::null ); |
1132 | 1131 | ||
1133 | // Redraw everything | 1132 | // Redraw everything |
1134 | applyStyle(); | 1133 | applyStyle(); |
1135 | } | 1134 | } |
1136 | 1135 | ||
1137 | /*! | 1136 | /*! |
1138 | \internal | 1137 | \internal |
1139 | */ | 1138 | */ |
1140 | void QPEApplication::applyStyle() | 1139 | void QPEApplication::applyStyle() |
1141 | { | 1140 | { |
1142 | Config config( "qpe" ); | 1141 | Config config( "qpe" ); |
1143 | config.setGroup( "Appearance" ); | 1142 | config.setGroup( "Appearance" ); |
1144 | 1143 | ||
1145 | #if QT_VERSION > 233 | 1144 | #if QT_VERSION > 233 |
1146 | #if !defined(OPIE_NO_OVERRIDE_QT) | 1145 | #if !defined(OPIE_NO_OVERRIDE_QT) |
1147 | // don't block ourselves ... | 1146 | // don't block ourselves ... |
1148 | Opie::force_appearance = 0; | 1147 | Opie::force_appearance = 0; |
1149 | 1148 | ||
1150 | static QString appname = Opie::binaryName ( ); | 1149 | static QString appname = Opie::binaryName ( ); |
1151 | 1150 | ||
1152 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 1151 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
1153 | int nostyle = 0; | 1152 | int nostyle = 0; |
1154 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 1153 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
1155 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 1154 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
1156 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 1155 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
1157 | break; | 1156 | break; |
1158 | } | 1157 | } |
1159 | } | 1158 | } |
1160 | #else | 1159 | #else |
1161 | int nostyle = 0; | 1160 | int nostyle = 0; |
1162 | #endif | 1161 | #endif |
1163 | 1162 | ||
1164 | // Widget style | 1163 | // Widget style |
1165 | QString style = config.readEntry( "Style", "FlatStyle" ); | 1164 | QString style = config.readEntry( "Style", "FlatStyle" ); |
1166 | 1165 | ||
1167 | // don't set a custom style | 1166 | // don't set a custom style |
1168 | if ( nostyle & Opie::Force_Style ) | 1167 | if ( nostyle & Opie::Force_Style ) |
1169 | style = "FlatStyle"; | 1168 | style = "FlatStyle"; |
1170 | 1169 | ||
1171 | internalSetStyle ( style ); | 1170 | internalSetStyle ( style ); |
1172 | 1171 | ||
1173 | // Colors - from /etc/colors/Liquid.scheme | 1172 | // Colors - from /etc/colors/Liquid.scheme |
1174 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); | 1173 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); |
1175 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); | 1174 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); |
1176 | QPalette pal( btncolor, bgcolor ); | 1175 | QPalette pal( btncolor, bgcolor ); |
1177 | QString color = config.readEntry( "Highlight", "#73adef" ); | 1176 | QString color = config.readEntry( "Highlight", "#73adef" ); |
1178 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1177 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1179 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1178 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1180 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1179 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1181 | color = config.readEntry( "Text", "#000000" ); | 1180 | color = config.readEntry( "Text", "#000000" ); |
1182 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1181 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1183 | color = config.readEntry( "ButtonText", "#000000" ); | 1182 | color = config.readEntry( "ButtonText", "#000000" ); |
1184 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1183 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1185 | color = config.readEntry( "Base", "#FFFFFF" ); | 1184 | color = config.readEntry( "Base", "#FFFFFF" ); |
1186 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1185 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1187 | 1186 | ||
1188 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1187 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1189 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1188 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1190 | 1189 | ||
1191 | setPalette( pal, TRUE ); | 1190 | setPalette( pal, TRUE ); |
1192 | 1191 | ||
1193 | // Window Decoration | 1192 | // Window Decoration |
1194 | QString dec = config.readEntry( "Decoration", "Flat" ); | 1193 | QString dec = config.readEntry( "Decoration", "Flat" ); |
1195 | 1194 | ||
1196 | // don't set a custom deco | 1195 | // don't set a custom deco |
1197 | if ( nostyle & Opie::Force_Decoration ) | 1196 | if ( nostyle & Opie::Force_Decoration ) |
1198 | dec = ""; | 1197 | dec = ""; |
1199 | 1198 | ||
1200 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1199 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1201 | 1200 | ||
1202 | if ( dec != d->decorationName ) { | 1201 | if ( dec != d->decorationName ) { |
1203 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1202 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1204 | d->decorationName = dec; | 1203 | d->decorationName = dec; |
1205 | } | 1204 | } |
1206 | 1205 | ||
1207 | // Font | 1206 | // Font |
1208 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1207 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1209 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1208 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1210 | 1209 | ||
1211 | // don't set a custom font | 1210 | // don't set a custom font |
1212 | if ( nostyle & Opie::Force_Font ) { | 1211 | if ( nostyle & Opie::Force_Font ) { |
1213 | ff = "Vera"; | 1212 | ff = "Vera"; |
1214 | fs = 10; | 1213 | fs = 10; |
1215 | } | 1214 | } |
1216 | 1215 | ||
1217 | setFont ( QFont ( ff, fs ), true ); | 1216 | setFont ( QFont ( ff, fs ), true ); |
1218 | 1217 | ||
1219 | #if !defined(OPIE_NO_OVERRIDE_QT) | 1218 | #if !defined(OPIE_NO_OVERRIDE_QT) |
1220 | // revert to global blocking policy ... | 1219 | // revert to global blocking policy ... |
1221 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1220 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1222 | Opie::force_appearance &= ~nostyle; | 1221 | Opie::force_appearance &= ~nostyle; |
1223 | #endif | 1222 | #endif |
1224 | #endif | 1223 | #endif |
1225 | } | 1224 | } |
1226 | 1225 | ||
1227 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1226 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1228 | { | 1227 | { |
1229 | #ifdef Q_WS_QWS | 1228 | #ifdef Q_WS_QWS |
1230 | QDataStream stream( data, IO_ReadOnly ); | 1229 | QDataStream stream( data, IO_ReadOnly ); |
1231 | if ( msg == "applyStyle()" ) { | 1230 | if ( msg == "applyStyle()" ) { |
1232 | applyStyle(); | 1231 | applyStyle(); |
1233 | } | 1232 | } |