summaryrefslogtreecommitdiff
authorzecke <zecke>2004-06-27 19:36:48 (UTC)
committer zecke <zecke>2004-06-27 19:36:48 (UTC)
commit78cd13f15c6057e18b6f095841a90bb438dd6fd2 (patch) (unidiff)
tree08376c584867032bc4fa5725467d46615b02e700
parent0ef75ca5409d290df36d1c0bbf0413e37bfd4124 (diff)
downloadopie-78cd13f15c6057e18b6f095841a90bb438dd6fd2.zip
opie-78cd13f15c6057e18b6f095841a90bb438dd6fd2.tar.gz
opie-78cd13f15c6057e18b6f095841a90bb438dd6fd2.tar.bz2
Safe eilers some time for weak symbols on MacOS X
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 4bc0c5f..b686e2e 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -932,769 +932,775 @@ void QPEApplication::initApp( int argc, char **argv )
932 channel.replace(QRegExp(".*/"),""); 932 channel.replace(QRegExp(".*/"),"");
933 d->appName = channel; 933 d->appName = channel;
934 934
935 #if QT_VERSION > 235 935 #if QT_VERSION > 235
936 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 936 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6
937 #endif 937 #endif
938 938
939 channel = "QPE/Application/" + channel; 939 channel = "QPE/Application/" + channel;
940 pidChannel = new QCopChannel( channel, this); 940 pidChannel = new QCopChannel( channel, this);
941 connect( pidChannel, SIGNAL(received(const QCString&,const QByteArray&)), 941 connect( pidChannel, SIGNAL(received(const QCString&,const QByteArray&)),
942 this, SLOT(pidMessage(const QCString&,const QByteArray&))); 942 this, SLOT(pidMessage(const QCString&,const QByteArray&)));
943 943
944 944
945 945
946 processQCopFile(); 946 processQCopFile();
947 d->keep_running = d->qcopq.isEmpty(); 947 d->keep_running = d->qcopq.isEmpty();
948 948
949 for (int a=0; a<argc; a++) { 949 for (int a=0; a<argc; a++) {
950 if ( qstrcmp(argv[a],"-preload")==0 ) { 950 if ( qstrcmp(argv[a],"-preload")==0 ) {
951 argv[a] = argv[a+1]; 951 argv[a] = argv[a+1];
952 a++; 952 a++;
953 d->preloaded = TRUE; 953 d->preloaded = TRUE;
954 argc-=1; 954 argc-=1;
955 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { 955 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) {
956 argv[a] = argv[a+1]; 956 argv[a] = argv[a+1];
957 a++; 957 a++;
958 d->preloaded = TRUE; 958 d->preloaded = TRUE;
959 d->forceshow = TRUE; 959 d->forceshow = TRUE;
960 argc-=1; 960 argc-=1;
961 } 961 }
962 } 962 }
963 963
964 /* overide stored arguments */ 964 /* overide stored arguments */
965 setArgs(argc, argv); 965 setArgs(argc, argv);
966 966
967 /* install translation here */ 967 /* install translation here */
968 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) 968 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it )
969 installTranslation( (*it) + "/" + d->appName + ".qm" ); 969 installTranslation( (*it) + "/" + d->appName + ".qm" );
970} 970}
971#endif 971#endif
972 972
973 973
974static QPtrDict<void>* inputMethodDict = 0; 974static QPtrDict<void>* inputMethodDict = 0;
975static void createInputMethodDict() 975static void createInputMethodDict()
976{ 976{
977 if ( !inputMethodDict ) 977 if ( !inputMethodDict )
978 inputMethodDict = new QPtrDict<void>; 978 inputMethodDict = new QPtrDict<void>;
979} 979}
980 980
981/*! 981/*!
982 Returns the currently set hint to the system as to whether 982 Returns the currently set hint to the system as to whether
983 widget \a w has any use for text input methods. 983 widget \a w has any use for text input methods.
984 984
985 985
986 \sa setInputMethodHint() InputMethodHint 986 \sa setInputMethodHint() InputMethodHint
987*/ 987*/
988QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) 988QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w )
989{ 989{
990 if ( inputMethodDict && w ) 990 if ( inputMethodDict && w )
991 return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); 991 return ( InputMethodHint ) ( int ) inputMethodDict->find( w );
992 return Normal; 992 return Normal;
993} 993}
994 994
995/*! 995/*!
996 \enum QPEApplication::InputMethodHint 996 \enum QPEApplication::InputMethodHint
997 997
998 \value Normal the application sometimes needs text input (the default). 998 \value Normal the application sometimes needs text input (the default).
999 \value AlwaysOff the application never needs text input. 999 \value AlwaysOff the application never needs text input.
1000 \value AlwaysOn the application always needs text input. 1000 \value AlwaysOn the application always needs text input.
1001*/ 1001*/
1002 1002
1003/*! 1003/*!
1004 Hints to the system that widget \a w has use for text input methods 1004 Hints to the system that widget \a w has use for text input methods
1005 as specified by \a mode. 1005 as specified by \a mode.
1006 1006
1007 \sa inputMethodHint() InputMethodHint 1007 \sa inputMethodHint() InputMethodHint
1008*/ 1008*/
1009void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) 1009void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode )
1010{ 1010{
1011 createInputMethodDict(); 1011 createInputMethodDict();
1012 if ( mode == Normal ) { 1012 if ( mode == Normal ) {
1013 inputMethodDict->remove 1013 inputMethodDict->remove
1014 ( w ); 1014 ( w );
1015 } 1015 }
1016 else { 1016 else {
1017 inputMethodDict->insert( w, ( void* ) mode ); 1017 inputMethodDict->insert( w, ( void* ) mode );
1018 } 1018 }
1019} 1019}
1020 1020
1021class HackDialog : public QDialog 1021class HackDialog : public QDialog
1022{ 1022{
1023public: 1023public:
1024 void acceptIt() 1024 void acceptIt()
1025 { 1025 {
1026 accept(); 1026 accept();
1027 } 1027 }
1028 void rejectIt() 1028 void rejectIt()
1029 { 1029 {
1030 reject(); 1030 reject();
1031 } 1031 }
1032}; 1032};
1033 1033
1034 1034
1035void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) 1035void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key )
1036{ 1036{
1037 // specialised actions for certain widgets. May want to 1037 // specialised actions for certain widgets. May want to
1038 // add more stuff here. 1038 // add more stuff here.
1039 if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) 1039 if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" )
1040 && activePopupWidget() ->parentWidget() 1040 && activePopupWidget() ->parentWidget()
1041 && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) 1041 && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) )
1042 key = Qt::Key_Return; 1042 key = Qt::Key_Return;
1043 1043
1044 if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) 1044 if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) )
1045 key = Qt::Key_Return; 1045 key = Qt::Key_Return;
1046 1046
1047#ifdef QWS 1047#ifdef QWS
1048 1048
1049 ke->simpleData.keycode = key; 1049 ke->simpleData.keycode = key;
1050#endif 1050#endif
1051} 1051}
1052 1052
1053 1053
1054/*! 1054/*!
1055 \internal 1055 \internal
1056*/ 1056*/
1057 1057
1058#ifdef QWS 1058#ifdef QWS
1059bool QPEApplication::qwsEventFilter( QWSEvent * e ) 1059bool QPEApplication::qwsEventFilter( QWSEvent * e )
1060{ 1060{
1061 if ( !d->notbusysent && e->type == QWSEvent::Focus ) { 1061 if ( !d->notbusysent && e->type == QWSEvent::Focus ) {
1062 if ( qApp->type() != QApplication::GuiServer ) { 1062 if ( qApp->type() != QApplication::GuiServer ) {
1063 QCopEnvelope e( "QPE/System", "notBusy(QString)" ); 1063 QCopEnvelope e( "QPE/System", "notBusy(QString)" );
1064 e << d->appName; 1064 e << d->appName;
1065 } 1065 }
1066 d->notbusysent = TRUE; 1066 d->notbusysent = TRUE;
1067 } 1067 }
1068 if ( type() == GuiServer ) { 1068 if ( type() == GuiServer ) {
1069 switch ( e->type ) { 1069 switch ( e->type ) {
1070 case QWSEvent::Mouse: 1070 case QWSEvent::Mouse:
1071 if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) 1071 if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) )
1072 emit clientMoused(); 1072 emit clientMoused();
1073 break; 1073 break;
1074 default: 1074 default:
1075 break; 1075 break;
1076 } 1076 }
1077 } 1077 }
1078 if ( e->type == QWSEvent::Key ) { 1078 if ( e->type == QWSEvent::Key ) {
1079 QWSKeyEvent *ke = ( QWSKeyEvent * ) e; 1079 QWSKeyEvent *ke = ( QWSKeyEvent * ) e;
1080 if ( ke->simpleData.keycode == Qt::Key_F33 ) { 1080 if ( ke->simpleData.keycode == Qt::Key_F33 ) {
1081 // Use special "OK" key to press "OK" on top level widgets 1081 // Use special "OK" key to press "OK" on top level widgets
1082 QWidget * active = activeWindow(); 1082 QWidget * active = activeWindow();
1083 QWidget *popup = 0; 1083 QWidget *popup = 0;
1084 if ( active && active->isPopup() ) { 1084 if ( active && active->isPopup() ) {
1085 popup = active; 1085 popup = active;
1086 active = active->parentWidget(); 1086 active = active->parentWidget();
1087 } 1087 }
1088 if ( active && ( int ) active->winId() == ke->simpleData.window && 1088 if ( active && ( int ) active->winId() == ke->simpleData.window &&
1089 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { 1089 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) {
1090 if ( ke->simpleData.is_press ) { 1090 if ( ke->simpleData.is_press ) {
1091 if ( popup ) 1091 if ( popup )
1092 popup->close(); 1092 popup->close();
1093 if ( active->inherits( "QDialog" ) ) { 1093 if ( active->inherits( "QDialog" ) ) {
1094 HackDialog * d = ( HackDialog * ) active; 1094 HackDialog * d = ( HackDialog * ) active;
1095 d->acceptIt(); 1095 d->acceptIt();
1096 return TRUE; 1096 return TRUE;
1097 } 1097 }
1098 else if ( ( ( HackWidget * ) active ) ->needsOk() ) { 1098 else if ( ( ( HackWidget * ) active ) ->needsOk() ) {
1099 QSignal s; 1099 QSignal s;
1100 s.connect( active, SLOT( accept() ) ); 1100 s.connect( active, SLOT( accept() ) );
1101 s.activate(); 1101 s.activate();
1102 } 1102 }
1103 else { 1103 else {
1104 // do the same as with the select key: Map to the default action of the widget: 1104 // do the same as with the select key: Map to the default action of the widget:
1105 mapToDefaultAction( ke, Qt::Key_Return ); 1105 mapToDefaultAction( ke, Qt::Key_Return );
1106 } 1106 }
1107 } 1107 }
1108 } 1108 }
1109 } 1109 }
1110 else if ( ke->simpleData.keycode == Qt::Key_F30 ) { 1110 else if ( ke->simpleData.keycode == Qt::Key_F30 ) {
1111 // Use special "select" key to do whatever default action a widget has 1111 // Use special "select" key to do whatever default action a widget has
1112 mapToDefaultAction( ke, Qt::Key_Space ); 1112 mapToDefaultAction( ke, Qt::Key_Space );
1113 } 1113 }
1114 else if ( ke->simpleData.keycode == Qt::Key_Escape && 1114 else if ( ke->simpleData.keycode == Qt::Key_Escape &&
1115 ke->simpleData.is_press ) { 1115 ke->simpleData.is_press ) {
1116 // Escape key closes app if focus on toplevel 1116 // Escape key closes app if focus on toplevel
1117 QWidget * active = activeWindow(); 1117 QWidget * active = activeWindow();
1118 if ( active && active->testWFlags( WType_TopLevel ) && 1118 if ( active && active->testWFlags( WType_TopLevel ) &&
1119 ( int ) active->winId() == ke->simpleData.window && 1119 ( int ) active->winId() == ke->simpleData.window &&
1120 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { 1120 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) {
1121 if ( active->inherits( "QDialog" ) ) { 1121 if ( active->inherits( "QDialog" ) ) {
1122 HackDialog * d = ( HackDialog * ) active; 1122 HackDialog * d = ( HackDialog * ) active;
1123 d->rejectIt(); 1123 d->rejectIt();
1124 return TRUE; 1124 return TRUE;
1125 } else /*if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 )*/ { 1125 } else /*if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 )*/ {
1126 active->close(); 1126 active->close();
1127 } 1127 }
1128 } 1128 }
1129 1129
1130 } 1130 }
1131 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { 1131 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) {
1132 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) 1132 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... ))
1133 // but we cannot access libopie function within libqpe :( 1133 // but we cannot access libopie function within libqpe :(
1134 1134
1135 QWidget * active = activeWindow ( ); 1135 QWidget * active = activeWindow ( );
1136 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { 1136 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) {
1137 if ( d-> kbgrabbed ) { // we grabbed the keyboard 1137 if ( d-> kbgrabbed ) { // we grabbed the keyboard
1138 QChar ch ( ke-> simpleData.unicode ); 1138 QChar ch ( ke-> simpleData.unicode );
1139 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, 1139 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease,
1140 ke-> simpleData.keycode, 1140 ke-> simpleData.keycode,
1141 ch. latin1 ( ), 1141 ch. latin1 ( ),
1142 ke-> simpleData.modifiers, 1142 ke-> simpleData.modifiers,
1143 QString ( ch ), 1143 QString ( ch ),
1144 ke-> simpleData.is_auto_repeat, 1 ); 1144 ke-> simpleData.is_auto_repeat, 1 );
1145 1145
1146 QObject *which = QWidget::keyboardGrabber ( ); 1146 QObject *which = QWidget::keyboardGrabber ( );
1147 if ( !which ) 1147 if ( !which )
1148 which = QApplication::focusWidget ( ); 1148 which = QApplication::focusWidget ( );
1149 if ( !which ) 1149 if ( !which )
1150 which = QApplication::activeWindow ( ); 1150 which = QApplication::activeWindow ( );
1151 if ( !which ) 1151 if ( !which )
1152 which = qApp; 1152 which = qApp;
1153 1153
1154 QApplication::sendEvent ( which, &qke ); 1154 QApplication::sendEvent ( which, &qke );
1155 } 1155 }
1156 else { // we didn't grab the keyboard, so send the event to the launcher 1156 else { // we didn't grab the keyboard, so send the event to the launcher
1157 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); 1157 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" );
1158 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); 1158 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat );
1159 } 1159 }
1160 } 1160 }
1161 return true; 1161 return true;
1162 } 1162 }
1163 } 1163 }
1164 if ( e->type == QWSEvent::Focus ) { 1164 if ( e->type == QWSEvent::Focus ) {
1165 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 1165 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
1166 if ( !fe->simpleData.get_focus ) { 1166 if ( !fe->simpleData.get_focus ) {
1167 QWidget * active = activeWindow(); 1167 QWidget * active = activeWindow();
1168 while ( active && active->isPopup() ) { 1168 while ( active && active->isPopup() ) {
1169 active->close(); 1169 active->close();
1170 active = activeWindow(); 1170 active = activeWindow();
1171 } 1171 }
1172 } 1172 }
1173 else { 1173 else {
1174 // make sure our modal widget is ALWAYS on top 1174 // make sure our modal widget is ALWAYS on top
1175 QWidget *topm = activeModalWidget(); 1175 QWidget *topm = activeModalWidget();
1176 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { 1176 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) {
1177 topm->raise(); 1177 topm->raise();
1178 } 1178 }
1179 } 1179 }
1180 if ( fe->simpleData.get_focus && inputMethodDict ) { 1180 if ( fe->simpleData.get_focus && inputMethodDict ) {
1181 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 1181 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
1182 if ( m == AlwaysOff ) 1182 if ( m == AlwaysOff )
1183 Global::hideInputMethod(); 1183 Global::hideInputMethod();
1184 if ( m == AlwaysOn ) 1184 if ( m == AlwaysOn )
1185 Global::showInputMethod(); 1185 Global::showInputMethod();
1186 } 1186 }
1187 } 1187 }
1188 1188
1189 1189
1190 return QApplication::qwsEventFilter( e ); 1190 return QApplication::qwsEventFilter( e );
1191} 1191}
1192#endif 1192#endif
1193 1193
1194/*! 1194/*!
1195 Destroys the QPEApplication. 1195 Destroys the QPEApplication.
1196*/ 1196*/
1197QPEApplication::~QPEApplication() 1197QPEApplication::~QPEApplication()
1198{ 1198{
1199 ungrabKeyboard(); 1199 ungrabKeyboard();
1200#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 1200#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
1201 // Need to delete QCopChannels early, since the display will 1201 // Need to delete QCopChannels early, since the display will
1202 // be gone by the time we get to ~QObject(). 1202 // be gone by the time we get to ~QObject().
1203 delete sysChannel; 1203 delete sysChannel;
1204 delete pidChannel; 1204 delete pidChannel;
1205#endif 1205#endif
1206 1206
1207 delete d; 1207 delete d;
1208} 1208}
1209 1209
1210/*! 1210/*!
1211 Returns <tt>$OPIEDIR/</tt>. 1211 Returns <tt>$OPIEDIR/</tt>.
1212*/ 1212*/
1213QString QPEApplication::qpeDir() 1213QString QPEApplication::qpeDir()
1214{ 1214{
1215 const char * base = getenv( "OPIEDIR" ); 1215 const char * base = getenv( "OPIEDIR" );
1216 if ( base ) 1216 if ( base )
1217 return QString( base ) + "/"; 1217 return QString( base ) + "/";
1218 1218
1219 return QString( "../" ); 1219 return QString( "../" );
1220} 1220}
1221 1221
1222/*! 1222/*!
1223 Returns the user's current Document directory. There is a trailing "/". 1223 Returns the user's current Document directory. There is a trailing "/".
1224 .. well, it does now,, and there's no trailing '/' 1224 .. well, it does now,, and there's no trailing '/'
1225*/ 1225*/
1226QString QPEApplication::documentDir() 1226QString QPEApplication::documentDir()
1227{ 1227{
1228 const char* base = getenv( "HOME"); 1228 const char* base = getenv( "HOME");
1229 if ( base ) 1229 if ( base )
1230 return QString( base ) + "/Documents"; 1230 return QString( base ) + "/Documents";
1231 1231
1232 return QString( "../Documents" ); 1232 return QString( "../Documents" );
1233} 1233}
1234 1234
1235static int deforient = -1; 1235static int deforient = -1;
1236 1236
1237/*! 1237/*!
1238 \internal 1238 \internal
1239*/ 1239*/
1240int QPEApplication::defaultRotation() 1240int QPEApplication::defaultRotation()
1241{ 1241{
1242 if ( deforient < 0 ) { 1242 if ( deforient < 0 ) {
1243 QString d = getenv( "QWS_DISPLAY" ); 1243 QString d = getenv( "QWS_DISPLAY" );
1244 if ( d.contains( "Rot90" ) ) { 1244 if ( d.contains( "Rot90" ) ) {
1245 deforient = 90; 1245 deforient = 90;
1246 } 1246 }
1247 else if ( d.contains( "Rot180" ) ) { 1247 else if ( d.contains( "Rot180" ) ) {
1248 deforient = 180; 1248 deforient = 180;
1249 } 1249 }
1250 else if ( d.contains( "Rot270" ) ) { 1250 else if ( d.contains( "Rot270" ) ) {
1251 deforient = 270; 1251 deforient = 270;
1252 } 1252 }
1253 else { 1253 else {
1254 deforient = 0; 1254 deforient = 0;
1255 } 1255 }
1256 } 1256 }
1257 return deforient; 1257 return deforient;
1258} 1258}
1259 1259
1260/*! 1260/*!
1261 \internal 1261 \internal
1262*/ 1262*/
1263void QPEApplication::setDefaultRotation( int r ) 1263void QPEApplication::setDefaultRotation( int r )
1264{ 1264{
1265 if ( qApp->type() == GuiServer ) { 1265 if ( qApp->type() == GuiServer ) {
1266 deforient = r; 1266 deforient = r;
1267 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 1267 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
1268 Config config("qpe"); 1268 Config config("qpe");
1269 config.setGroup( "Rotation" ); 1269 config.setGroup( "Rotation" );
1270 config.writeEntry( "Rot", r ); 1270 config.writeEntry( "Rot", r );
1271 } 1271 }
1272 else { 1272 else {
1273#ifndef QT_NO_COP 1273#ifndef QT_NO_COP
1274 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); 1274 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
1275 e << r; 1275 e << r;
1276 } 1276 }
1277#endif 1277#endif
1278 1278
1279 } 1279 }
1280} 1280}
1281 1281
1282#include <qgfx_qws.h> 1282#include <qgfx_qws.h>
1283#include <qwindowsystem_qws.h> 1283#include <qwindowsystem_qws.h>
1284 1284
1285extern void qws_clearLoadedFonts(); 1285extern void qws_clearLoadedFonts();
1286 1286
1287void QPEApplication::setCurrentMode( int x, int y, int depth ) 1287void QPEApplication::setCurrentMode( int x, int y, int depth )
1288{ 1288{
1289 // Reset the caches 1289 // Reset the caches
1290 qws_clearLoadedFonts(); 1290 qws_clearLoadedFonts();
1291 QPixmapCache::clear(); 1291 QPixmapCache::clear();
1292 1292
1293 // Change the screen mode 1293 // Change the screen mode
1294 qt_screen->setMode(x, y, depth); 1294 qt_screen->setMode(x, y, depth);
1295 1295
1296 if ( qApp->type() == GuiServer ) { 1296 if ( qApp->type() == GuiServer ) {
1297 // Reconfigure the GuiServer 1297 // Reconfigure the GuiServer
1298 qwsServer->beginDisplayReconfigure(); 1298 qwsServer->beginDisplayReconfigure();
1299 qwsServer->endDisplayReconfigure(); 1299 qwsServer->endDisplayReconfigure();
1300 1300
1301 // Get all the running apps to reset 1301 // Get all the running apps to reset
1302 QCopEnvelope env( "QPE/System", "reset()" ); 1302 QCopEnvelope env( "QPE/System", "reset()" );
1303 } 1303 }
1304} 1304}
1305 1305
1306void QPEApplication::reset() { 1306void QPEApplication::reset() {
1307 // Reconnect to the screen 1307 // Reconnect to the screen
1308 qt_screen->disconnect(); 1308 qt_screen->disconnect();
1309 qt_screen->connect( QString::null ); 1309 qt_screen->connect( QString::null );
1310 1310
1311 // Redraw everything 1311 // Redraw everything
1312 applyStyle(); 1312 applyStyle();
1313} 1313}
1314 1314
1315 1315
1316extern bool qt_left_hand_scrollbars __attribute__(( weak )); 1316#ifdef Q_OS_MACX
1317#define WEAK_SYMBOL __attribute__((weak_import))
1318#else
1319#define WEAK_SYMBOL __attribute__((weak))
1320#endif
1321
1322extern bool qt_left_hand_scrollbars WEAK_SYMBOL;
1317/*! 1323/*!
1318 \internal 1324 \internal
1319*/ 1325*/
1320void QPEApplication::applyStyle() 1326void QPEApplication::applyStyle()
1321{ 1327{
1322 Config config( "qpe" ); 1328 Config config( "qpe" );
1323 config.setGroup( "Appearance" ); 1329 config.setGroup( "Appearance" );
1324 1330
1325#if QT_VERSION > 233 1331#if QT_VERSION > 233
1326#if !defined(OPIE_NO_OVERRIDE_QT) 1332#if !defined(OPIE_NO_OVERRIDE_QT)
1327 // don't block ourselves ... 1333 // don't block ourselves ...
1328 Opie::force_appearance = 0; 1334 Opie::force_appearance = 0;
1329 1335
1330 static QString appname = Opie::binaryName ( ); 1336 static QString appname = Opie::binaryName ( );
1331 1337
1332 QStringList ex = config. readListEntry ( "NoStyle", ';' ); 1338 QStringList ex = config. readListEntry ( "NoStyle", ';' );
1333 int nostyle = 0; 1339 int nostyle = 0;
1334 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { 1340 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) {
1335 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { 1341 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) {
1336 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); 1342 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 );
1337 break; 1343 break;
1338 } 1344 }
1339 } 1345 }
1340#else 1346#else
1341 int nostyle = 0; 1347 int nostyle = 0;
1342#endif 1348#endif
1343 1349
1344 // Widget style 1350 // Widget style
1345 QString style = config.readEntry( "Style", "FlatStyle" ); 1351 QString style = config.readEntry( "Style", "FlatStyle" );
1346 1352
1347 // don't set a custom style 1353 // don't set a custom style
1348 if ( nostyle & Opie::Force_Style ) 1354 if ( nostyle & Opie::Force_Style )
1349 style = "FlatStyle"; 1355 style = "FlatStyle";
1350 1356
1351 internalSetStyle ( style ); 1357 internalSetStyle ( style );
1352 1358
1353 // Colors - from /etc/colors/Liquid.scheme 1359 // Colors - from /etc/colors/Liquid.scheme
1354 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); 1360 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) );
1355 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); 1361 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) );
1356 QPalette pal( btncolor, bgcolor ); 1362 QPalette pal( btncolor, bgcolor );
1357 QString color = config.readEntry( "Highlight", "#73adef" ); 1363 QString color = config.readEntry( "Highlight", "#73adef" );
1358 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 1364 pal.setColor( QColorGroup::Highlight, QColor( color ) );
1359 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 1365 color = config.readEntry( "HighlightedText", "#FFFFFF" );
1360 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 1366 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
1361 color = config.readEntry( "Text", "#000000" ); 1367 color = config.readEntry( "Text", "#000000" );
1362 pal.setColor( QColorGroup::Text, QColor( color ) ); 1368 pal.setColor( QColorGroup::Text, QColor( color ) );
1363 color = config.readEntry( "ButtonText", "#000000" ); 1369 color = config.readEntry( "ButtonText", "#000000" );
1364 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 1370 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
1365 color = config.readEntry( "Base", "#FFFFFF" ); 1371 color = config.readEntry( "Base", "#FFFFFF" );
1366 pal.setColor( QColorGroup::Base, QColor( color ) ); 1372 pal.setColor( QColorGroup::Base, QColor( color ) );
1367 1373
1368 pal.setColor( QPalette::Disabled, QColorGroup::Text, 1374 pal.setColor( QPalette::Disabled, QColorGroup::Text,
1369 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 1375 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
1370 1376
1371 setPalette( pal, TRUE ); 1377 setPalette( pal, TRUE );
1372 1378
1373 1379
1374 // Set the ScrollBar on the 'right' side but only if the weak symbol is present 1380 // Set the ScrollBar on the 'right' side but only if the weak symbol is present
1375 if (&qt_left_hand_scrollbars ) 1381 if (&qt_left_hand_scrollbars )
1376 qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false ); 1382 qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false );
1377 1383
1378 // Window Decoration 1384 // Window Decoration
1379 QString dec = config.readEntry( "Decoration", "Flat" ); 1385 QString dec = config.readEntry( "Decoration", "Flat" );
1380 1386
1381 // don't set a custom deco 1387 // don't set a custom deco
1382 if ( nostyle & Opie::Force_Decoration ) 1388 if ( nostyle & Opie::Force_Decoration )
1383 dec = ""; 1389 dec = "";
1384 1390
1385 1391
1386 if ( dec != d->decorationName ) { 1392 if ( dec != d->decorationName ) {
1387 qwsSetDecoration( new QPEDecoration( dec ) ); 1393 qwsSetDecoration( new QPEDecoration( dec ) );
1388 d->decorationName = dec; 1394 d->decorationName = dec;
1389 } 1395 }
1390 1396
1391 // Font 1397 // Font
1392 QString ff = config.readEntry( "FontFamily", font().family() ); 1398 QString ff = config.readEntry( "FontFamily", font().family() );
1393 int fs = config.readNumEntry( "FontSize", font().pointSize() ); 1399 int fs = config.readNumEntry( "FontSize", font().pointSize() );
1394 1400
1395 // don't set a custom font 1401 // don't set a custom font
1396 if ( nostyle & Opie::Force_Font ) { 1402 if ( nostyle & Opie::Force_Font ) {
1397 ff = "Vera"; 1403 ff = "Vera";
1398 fs = 10; 1404 fs = 10;
1399 } 1405 }
1400 1406
1401 setFont ( QFont ( ff, fs ), true ); 1407 setFont ( QFont ( ff, fs ), true );
1402 1408
1403#if !defined(OPIE_NO_OVERRIDE_QT) 1409#if !defined(OPIE_NO_OVERRIDE_QT)
1404 // revert to global blocking policy ... 1410 // revert to global blocking policy ...
1405 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; 1411 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None;
1406 Opie::force_appearance &= ~nostyle; 1412 Opie::force_appearance &= ~nostyle;
1407#endif 1413#endif
1408#endif 1414#endif
1409} 1415}
1410 1416
1411void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) 1417void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data )
1412{ 1418{
1413#ifdef Q_WS_QWS 1419#ifdef Q_WS_QWS
1414 QDataStream stream( data, IO_ReadOnly ); 1420 QDataStream stream( data, IO_ReadOnly );
1415 if ( msg == "applyStyle()" ) { 1421 if ( msg == "applyStyle()" ) {
1416 applyStyle(); 1422 applyStyle();
1417 } 1423 }
1418 else if ( msg == "toggleApplicationMenu()" ) { 1424 else if ( msg == "toggleApplicationMenu()" ) {
1419 QWidget *active = activeWindow ( ); 1425 QWidget *active = activeWindow ( );
1420 1426
1421 if ( active ) { 1427 if ( active ) {
1422 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); 1428 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( );
1423 bool oldactive = man-> isActive ( ); 1429 bool oldactive = man-> isActive ( );
1424 1430
1425 man-> setActive( !man-> isActive() ); 1431 man-> setActive( !man-> isActive() );
1426 1432
1427 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu 1433 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu
1428 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); 1434 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" );
1429 } 1435 }
1430 } 1436 }
1431 } 1437 }
1432 else if ( msg == "setDefaultRotation(int)" ) { 1438 else if ( msg == "setDefaultRotation(int)" ) {
1433 if ( type() == GuiServer ) { 1439 if ( type() == GuiServer ) {
1434 int r; 1440 int r;
1435 stream >> r; 1441 stream >> r;
1436 setDefaultRotation( r ); 1442 setDefaultRotation( r );
1437 } 1443 }
1438 } 1444 }
1439 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> 1445 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net>
1440 if ( type() == GuiServer ) { 1446 if ( type() == GuiServer ) {
1441 int x, y, depth; 1447 int x, y, depth;
1442 stream >> x; 1448 stream >> x;
1443 stream >> y; 1449 stream >> y;
1444 stream >> depth; 1450 stream >> depth;
1445 setCurrentMode( x, y, depth ); 1451 setCurrentMode( x, y, depth );
1446 } 1452 }
1447 } 1453 }
1448 else if ( msg == "reset()" ) { 1454 else if ( msg == "reset()" ) {
1449 if ( type() != GuiServer ) 1455 if ( type() != GuiServer )
1450 reset(); 1456 reset();
1451 } 1457 }
1452 else if ( msg == "setCurrentRotation(int)" ) { 1458 else if ( msg == "setCurrentRotation(int)" ) {
1453 int r; 1459 int r;
1454 stream >> r; 1460 stream >> r;
1455 setCurrentRotation( r ); 1461 setCurrentRotation( r );
1456 } 1462 }
1457 else if ( msg == "shutdown()" ) { 1463 else if ( msg == "shutdown()" ) {
1458 if ( type() == GuiServer ) 1464 if ( type() == GuiServer )
1459 shutdown(); 1465 shutdown();
1460 } 1466 }
1461 else if ( msg == "quit()" ) { 1467 else if ( msg == "quit()" ) {
1462 if ( type() != GuiServer ) 1468 if ( type() != GuiServer )
1463 tryQuit(); 1469 tryQuit();
1464 } 1470 }
1465 else if ( msg == "forceQuit()" ) { 1471 else if ( msg == "forceQuit()" ) {
1466 if ( type() != GuiServer ) 1472 if ( type() != GuiServer )
1467 quit(); 1473 quit();
1468 } 1474 }
1469 else if ( msg == "restart()" ) { 1475 else if ( msg == "restart()" ) {
1470 if ( type() == GuiServer ) 1476 if ( type() == GuiServer )
1471 restart(); 1477 restart();
1472 } 1478 }
1473 else if ( msg == "language(QString)" ) { 1479 else if ( msg == "language(QString)" ) {
1474 if ( type() == GuiServer ) { 1480 if ( type() == GuiServer ) {
1475 QString l; 1481 QString l;
1476 stream >> l; 1482 stream >> l;
1477 QString cl = getenv( "LANG" ); 1483 QString cl = getenv( "LANG" );
1478 if ( cl != l ) { 1484 if ( cl != l ) {
1479 if ( l.isNull() ) 1485 if ( l.isNull() )
1480 unsetenv( "LANG" ); 1486 unsetenv( "LANG" );
1481 else 1487 else
1482 setenv( "LANG", l.latin1(), 1 ); 1488 setenv( "LANG", l.latin1(), 1 );
1483 restart(); 1489 restart();
1484 } 1490 }
1485 } 1491 }
1486 } 1492 }
1487 else if ( msg == "timeChange(QString)" ) { 1493 else if ( msg == "timeChange(QString)" ) {
1488 QString t; 1494 QString t;
1489 stream >> t; 1495 stream >> t;
1490 if ( t.isNull() ) 1496 if ( t.isNull() )
1491 unsetenv( "TZ" ); 1497 unsetenv( "TZ" );
1492 else 1498 else
1493 setenv( "TZ", t.latin1(), 1 ); 1499 setenv( "TZ", t.latin1(), 1 );
1494 // emit the signal so everyone else knows... 1500 // emit the signal so everyone else knows...
1495 emit timeChanged(); 1501 emit timeChanged();
1496 } 1502 }
1497 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { 1503 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) {
1498 if ( type() == GuiServer ) { 1504 if ( type() == GuiServer ) {
1499 QDateTime when; 1505 QDateTime when;
1500 QCString channel, message; 1506 QCString channel, message;
1501 int data; 1507 int data;
1502 stream >> when >> channel >> message >> data; 1508 stream >> when >> channel >> message >> data;
1503 AlarmServer::addAlarm( when, channel, message, data ); 1509 AlarmServer::addAlarm( when, channel, message, data );
1504 } 1510 }
1505 } 1511 }
1506 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { 1512 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) {
1507 if ( type() == GuiServer ) { 1513 if ( type() == GuiServer ) {
1508 QDateTime when; 1514 QDateTime when;
1509 QCString channel, message; 1515 QCString channel, message;
1510 int data; 1516 int data;
1511 stream >> when >> channel >> message >> data; 1517 stream >> when >> channel >> message >> data;
1512 AlarmServer::deleteAlarm( when, channel, message, data ); 1518 AlarmServer::deleteAlarm( when, channel, message, data );
1513 } 1519 }
1514 } 1520 }
1515 else if ( msg == "clockChange(bool)" ) { 1521 else if ( msg == "clockChange(bool)" ) {
1516 int tmp; 1522 int tmp;
1517 stream >> tmp; 1523 stream >> tmp;
1518 emit clockChanged( tmp ); 1524 emit clockChanged( tmp );
1519 } 1525 }
1520 else if ( msg == "weekChange(bool)" ) { 1526 else if ( msg == "weekChange(bool)" ) {
1521 int tmp; 1527 int tmp;
1522 stream >> tmp; 1528 stream >> tmp;
1523 emit weekChanged( tmp ); 1529 emit weekChanged( tmp );
1524 } 1530 }
1525 else if ( msg == "setDateFormat(DateFormat)" ) { 1531 else if ( msg == "setDateFormat(DateFormat)" ) {
1526 DateFormat tmp; 1532 DateFormat tmp;
1527 stream >> tmp; 1533 stream >> tmp;
1528 emit dateFormatChanged( tmp ); 1534 emit dateFormatChanged( tmp );
1529 } 1535 }
1530 else if ( msg == "setVolume(int,int)" ) { 1536 else if ( msg == "setVolume(int,int)" ) {
1531 int t, v; 1537 int t, v;
1532 stream >> t >> v; 1538 stream >> t >> v;
1533 setVolume( t, v ); 1539 setVolume( t, v );
1534 emit volumeChanged( muted ); 1540 emit volumeChanged( muted );
1535 } 1541 }
1536 else if ( msg == "volumeChange(bool)" ) { 1542 else if ( msg == "volumeChange(bool)" ) {
1537 stream >> muted; 1543 stream >> muted;
1538 setVolume(); 1544 setVolume();
1539 emit volumeChanged( muted ); 1545 emit volumeChanged( muted );
1540 } 1546 }
1541 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1547 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1542 int t, v; 1548 int t, v;
1543 stream >> t >> v; 1549 stream >> t >> v;
1544 setMic( t, v ); 1550 setMic( t, v );
1545 emit micChanged( micMuted ); 1551 emit micChanged( micMuted );
1546 } 1552 }
1547 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1553 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1548 stream >> micMuted; 1554 stream >> micMuted;
1549 setMic(); 1555 setMic();
1550 emit micChanged( micMuted ); 1556 emit micChanged( micMuted );
1551 } 1557 }
1552 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1558 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1553 int t, v; 1559 int t, v;
1554 stream >> t >> v; 1560 stream >> t >> v;
1555 setBass( t, v ); 1561 setBass( t, v );
1556 } 1562 }
1557 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1563 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1558 setBass(); 1564 setBass();
1559 } 1565 }
1560 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1566 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1561 int t, v; 1567 int t, v;
1562 stream >> t >> v; 1568 stream >> t >> v;
1563 setTreble( t, v ); 1569 setTreble( t, v );
1564 } 1570 }
1565 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1571 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1566 setTreble(); 1572 setTreble();
1567 } else if ( msg == "getMarkedText()" ) { 1573 } else if ( msg == "getMarkedText()" ) {
1568 if ( type() == GuiServer ) { 1574 if ( type() == GuiServer ) {
1569 const ushort unicode = 'C'-'@'; 1575 const ushort unicode = 'C'-'@';
1570 const int scan = Key_C; 1576 const int scan = Key_C;
1571 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); 1577 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
1572 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); 1578 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
1573 } 1579 }
1574 } else if ( msg == "newChannel(QString)") { 1580 } else if ( msg == "newChannel(QString)") {
1575 QString myChannel = "QPE/Application/" + d->appName; 1581 QString myChannel = "QPE/Application/" + d->appName;
1576 QString channel; 1582 QString channel;
1577 stream >> channel; 1583 stream >> channel;
1578 if (channel == myChannel) { 1584 if (channel == myChannel) {
1579 processQCopFile(); 1585 processQCopFile();
1580 d->sendQCopQ(); 1586 d->sendQCopQ();
1581 } 1587 }
1582 } 1588 }
1583 1589
1584 1590
1585#endif 1591#endif
1586} 1592}
1587 1593
1588 1594
1589 1595
1590 1596
1591 1597
1592/*! 1598/*!
1593 \internal 1599 \internal
1594*/ 1600*/
1595bool QPEApplication::raiseAppropriateWindow() 1601bool QPEApplication::raiseAppropriateWindow()
1596{ 1602{
1597 bool r=FALSE; 1603 bool r=FALSE;
1598 1604
1599 // 1. Raise the main widget 1605 // 1. Raise the main widget
1600 QWidget *top = d->qpe_main_widget; 1606 QWidget *top = d->qpe_main_widget;
1601 if ( !top ) top = mainWidget(); 1607 if ( !top ) top = mainWidget();
1602 1608
1603 if ( top && d->keep_running ) { 1609 if ( top && d->keep_running ) {
1604 if ( top->isVisible() ) 1610 if ( top->isVisible() )
1605 r = TRUE; 1611 r = TRUE;
1606 else if (d->preloaded) { 1612 else if (d->preloaded) {
1607 // We are preloaded and not visible.. pretend we just started.. 1613 // We are preloaded and not visible.. pretend we just started..
1608#ifndef QT_NO_COP 1614#ifndef QT_NO_COP
1609 QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); 1615 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1610 e << d->appName; 1616 e << d->appName;
1611#endif 1617#endif
1612 } 1618 }
1613 1619
1614 d->show_mx(top,d->nomaximize, d->appName); 1620 d->show_mx(top,d->nomaximize, d->appName);
1615 top->raise(); 1621 top->raise();
1616 } 1622 }
1617 1623
1618 QWidget *topm = activeModalWidget(); 1624 QWidget *topm = activeModalWidget();
1619 1625
1620 // 2. Raise any parentless widgets (except top and topm, as they 1626 // 2. Raise any parentless widgets (except top and topm, as they
1621 // are raised before and after this loop). Order from most 1627 // are raised before and after this loop). Order from most
1622 // recently raised as deepest to least recently as top, so 1628 // recently raised as deepest to least recently as top, so
1623 // that repeated calls cycle through widgets. 1629 // that repeated calls cycle through widgets.
1624 QWidgetList *list = topLevelWidgets(); 1630 QWidgetList *list = topLevelWidgets();
1625 if ( list ) { 1631 if ( list ) {
1626 bool foundlast = FALSE; 1632 bool foundlast = FALSE;
1627 QWidget* topsub = 0; 1633 QWidget* topsub = 0;
1628 if ( d->lastraised ) { 1634 if ( d->lastraised ) {
1629 for (QWidget* w = list->first(); w; w = list->next()) { 1635 for (QWidget* w = list->first(); w; w = list->next()) {
1630 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { 1636 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
1631 if ( w == d->lastraised ) 1637 if ( w == d->lastraised )
1632 foundlast = TRUE; 1638 foundlast = TRUE;
1633 if ( foundlast ) { 1639 if ( foundlast ) {
1634 w->raise(); 1640 w->raise();
1635 topsub = w; 1641 topsub = w;
1636 } 1642 }
1637 } 1643 }
1638 } 1644 }
1639 } 1645 }
1640 for (QWidget* w = list->first(); w; w = list->next()) { 1646 for (QWidget* w = list->first(); w; w = list->next()) {
1641 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { 1647 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
1642 if ( w == d->lastraised ) 1648 if ( w == d->lastraised )
1643 break; 1649 break;
1644 w->raise(); 1650 w->raise();
1645 topsub = w; 1651 topsub = w;
1646 } 1652 }
1647 } 1653 }
1648 d->lastraised = topsub; 1654 d->lastraised = topsub;
1649 delete list; 1655 delete list;
1650 } 1656 }
1651 1657
1652 // 3. Raise the active modal widget. 1658 // 3. Raise the active modal widget.
1653 if ( topm ) { 1659 if ( topm ) {
1654 topm->show(); 1660 topm->show();
1655 topm->raise(); 1661 topm->raise();
1656 // If we haven't already handled the fastAppShowing message 1662 // If we haven't already handled the fastAppShowing message
1657 if (!top && d->preloaded) { 1663 if (!top && d->preloaded) {
1658#ifndef QT_NO_COP 1664#ifndef QT_NO_COP
1659 QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); 1665 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1660 e << d->appName; 1666 e << d->appName;
1661#endif 1667#endif
1662 } 1668 }
1663 r = FALSE; 1669 r = FALSE;
1664 } 1670 }
1665 1671
1666 return r; 1672 return r;
1667} 1673}
1668 1674
1669 1675
1670void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) 1676void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
1671{ 1677{
1672#ifdef Q_WS_QWS 1678#ifdef Q_WS_QWS
1673 1679
1674 if ( msg == "quit()" ) { 1680 if ( msg == "quit()" ) {
1675 tryQuit(); 1681 tryQuit();
1676 } 1682 }
1677 else if ( msg == "quitIfInvisible()" ) { 1683 else if ( msg == "quitIfInvisible()" ) {
1678 if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) 1684 if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() )
1679 quit(); 1685 quit();
1680 } 1686 }
1681 else if ( msg == "close()" ) { 1687 else if ( msg == "close()" ) {
1682 hideOrQuit(); 1688 hideOrQuit();
1683 } 1689 }
1684 else if ( msg == "disablePreload()" ) { 1690 else if ( msg == "disablePreload()" ) {
1685 d->preloaded = FALSE; 1691 d->preloaded = FALSE;
1686 d->keep_running = TRUE; 1692 d->keep_running = TRUE;
1687 /* so that quit will quit */ 1693 /* so that quit will quit */
1688 } 1694 }
1689 else if ( msg == "enablePreload()" ) { 1695 else if ( msg == "enablePreload()" ) {
1690 if (d->qpe_main_widget) 1696 if (d->qpe_main_widget)
1691 d->preloaded = TRUE; 1697 d->preloaded = TRUE;
1692 d->keep_running = TRUE; 1698 d->keep_running = TRUE;
1693 /* so next quit won't quit */ 1699 /* so next quit won't quit */
1694 } 1700 }
1695 else if ( msg == "raise()" ) { 1701 else if ( msg == "raise()" ) {
1696 d->keep_running = TRUE; 1702 d->keep_running = TRUE;
1697 d->notbusysent = FALSE; 1703 d->notbusysent = FALSE;
1698 raiseAppropriateWindow(); 1704 raiseAppropriateWindow();
1699 // Tell the system we're still chugging along... 1705 // Tell the system we're still chugging along...
1700 QCopEnvelope e("QPE/System", "appRaised(QString)"); 1706 QCopEnvelope e("QPE/System", "appRaised(QString)");