author | llornkcor <llornkcor> | 2004-04-25 09:23:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-25 09:23:09 (UTC) |
commit | a4b1facac26431ddfcb4d31b2e6489a8a9e047b9 (patch) (unidiff) | |
tree | 0742ebba7371963c369cbfc03f17eefc605f52d5 /library | |
parent | 5d3c80f70109bee75d55db2a11d7112eb7ebaa99 (diff) | |
download | opie-a4b1facac26431ddfcb4d31b2e6489a8a9e047b9.zip opie-a4b1facac26431ddfcb4d31b2e6489a8a9e047b9.tar.gz opie-a4b1facac26431ddfcb4d31b2e6489a8a9e047b9.tar.bz2 |
remove embeddedkonsole hack
-rw-r--r-- | library/qpeapplication.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 10c6c40..c875ff2 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1033,195 +1033,192 @@ void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) | |||
1033 | // add more stuff here. | 1033 | // add more stuff here. |
1034 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) | 1034 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) |
1035 | && activePopupWidget() ->parentWidget() | 1035 | && activePopupWidget() ->parentWidget() |
1036 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) | 1036 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) |
1037 | key = Qt::Key_Return; | 1037 | key = Qt::Key_Return; |
1038 | 1038 | ||
1039 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) | 1039 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) |
1040 | key = Qt::Key_Return; | 1040 | key = Qt::Key_Return; |
1041 | 1041 | ||
1042 | #ifdef QWS | 1042 | #ifdef QWS |
1043 | 1043 | ||
1044 | ke->simpleData.keycode = key; | 1044 | ke->simpleData.keycode = key; |
1045 | #endif | 1045 | #endif |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | // class HackWidget : public QWidget | 1048 | // class HackWidget : public QWidget |
1049 | // { | 1049 | // { |
1050 | // public: | 1050 | // public: |
1051 | // bool needsOk() | 1051 | // bool needsOk() |
1052 | // { | 1052 | // { |
1053 | // return ( getWState() & WState_Reserved1 ); | 1053 | // return ( getWState() & WState_Reserved1 ); |
1054 | // } | 1054 | // } |
1055 | // }; | 1055 | // }; |
1056 | 1056 | ||
1057 | /*! | 1057 | /*! |
1058 | \internal | 1058 | \internal |
1059 | */ | 1059 | */ |
1060 | 1060 | ||
1061 | #ifdef QWS | 1061 | #ifdef QWS |
1062 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) | 1062 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) |
1063 | { | 1063 | { |
1064 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { | 1064 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { |
1065 | if ( qApp->type() != QApplication::GuiServer ) { | 1065 | if ( qApp->type() != QApplication::GuiServer ) { |
1066 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); | 1066 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); |
1067 | e << d->appName; | 1067 | e << d->appName; |
1068 | } | 1068 | } |
1069 | d->notbusysent = TRUE; | 1069 | d->notbusysent = TRUE; |
1070 | } | 1070 | } |
1071 | if ( type() == GuiServer ) { | 1071 | if ( type() == GuiServer ) { |
1072 | switch ( e->type ) { | 1072 | switch ( e->type ) { |
1073 | case QWSEvent::Mouse: | 1073 | case QWSEvent::Mouse: |
1074 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) | 1074 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) |
1075 | emit clientMoused(); | 1075 | emit clientMoused(); |
1076 | break; | 1076 | break; |
1077 | default: | 1077 | default: |
1078 | break; | 1078 | break; |
1079 | } | 1079 | } |
1080 | } | 1080 | } |
1081 | if ( e->type == QWSEvent::Key ) { | 1081 | if ( e->type == QWSEvent::Key ) { |
1082 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; | 1082 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; |
1083 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { | 1083 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { |
1084 | // Use special "OK" key to press "OK" on top level widgets | 1084 | // Use special "OK" key to press "OK" on top level widgets |
1085 | QWidget * active = activeWindow(); | 1085 | QWidget * active = activeWindow(); |
1086 | QWidget *popup = 0; | 1086 | QWidget *popup = 0; |
1087 | if ( active && active->isPopup() ) { | 1087 | if ( active && active->isPopup() ) { |
1088 | popup = active; | 1088 | popup = active; |
1089 | active = active->parentWidget(); | 1089 | active = active->parentWidget(); |
1090 | } | 1090 | } |
1091 | if ( active && ( int ) active->winId() == ke->simpleData.window && | 1091 | if ( active && ( int ) active->winId() == ke->simpleData.window && |
1092 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 1092 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
1093 | if ( ke->simpleData.is_press ) { | 1093 | if ( ke->simpleData.is_press ) { |
1094 | if ( popup ) | 1094 | if ( popup ) |
1095 | popup->close(); | 1095 | popup->close(); |
1096 | if ( active->inherits( "QDialog" ) ) { | 1096 | if ( active->inherits( "QDialog" ) ) { |
1097 | HackDialog * d = ( HackDialog * ) active; | 1097 | HackDialog * d = ( HackDialog * ) active; |
1098 | d->acceptIt(); | 1098 | d->acceptIt(); |
1099 | return TRUE; | 1099 | return TRUE; |
1100 | } | 1100 | } |
1101 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { | 1101 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { |
1102 | QSignal s; | 1102 | QSignal s; |
1103 | s.connect( active, SLOT( accept() ) ); | 1103 | s.connect( active, SLOT( accept() ) ); |
1104 | s.activate(); | 1104 | s.activate(); |
1105 | } | 1105 | } |
1106 | else { | 1106 | else { |
1107 | // do the same as with the select key: Map to the default action of the widget: | 1107 | // do the same as with the select key: Map to the default action of the widget: |
1108 | mapToDefaultAction( ke, Qt::Key_Return ); | 1108 | mapToDefaultAction( ke, Qt::Key_Return ); |
1109 | } | 1109 | } |
1110 | } | 1110 | } |
1111 | } | 1111 | } |
1112 | } | 1112 | } |
1113 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 1113 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
1114 | // Use special "select" key to do whatever default action a widget has | 1114 | // Use special "select" key to do whatever default action a widget has |
1115 | mapToDefaultAction( ke, Qt::Key_Space ); | 1115 | mapToDefaultAction( ke, Qt::Key_Space ); |
1116 | } | 1116 | } |
1117 | else if ( ke->simpleData.keycode == Qt::Key_Escape && | 1117 | else if ( ke->simpleData.keycode == Qt::Key_Escape && |
1118 | ke->simpleData.is_press ) { | 1118 | ke->simpleData.is_press ) { |
1119 | // Escape key closes app if focus on toplevel | 1119 | // Escape key closes app if focus on toplevel |
1120 | QWidget * active = activeWindow(); | 1120 | QWidget * active = activeWindow(); |
1121 | if ( active && active->testWFlags( WType_TopLevel ) && | 1121 | if ( active && active->testWFlags( WType_TopLevel ) && |
1122 | ( int ) active->winId() == ke->simpleData.window && | 1122 | ( int ) active->winId() == ke->simpleData.window && |
1123 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 1123 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
1124 | if ( active->inherits( "QDialog" ) ) { | 1124 | if ( active->inherits( "QDialog" ) ) { |
1125 | HackDialog * d = ( HackDialog * ) active; | 1125 | HackDialog * d = ( HackDialog * ) active; |
1126 | d->rejectIt(); | 1126 | d->rejectIt(); |
1127 | return TRUE; | 1127 | return TRUE; |
1128 | } | 1128 | } |
1129 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { | ||
1130 | active->close(); | ||
1131 | } | ||
1132 | } | 1129 | } |
1133 | } | 1130 | } |
1134 | 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 ) { |
1135 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) | 1132 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) |
1136 | // but we cannot access libopie function within libqpe :( | 1133 | // but we cannot access libopie function within libqpe :( |
1137 | 1134 | ||
1138 | QWidget * active = activeWindow ( ); | 1135 | QWidget * active = activeWindow ( ); |
1139 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 1136 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
1140 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 1137 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
1141 | QChar ch ( ke-> simpleData.unicode ); | 1138 | QChar ch ( ke-> simpleData.unicode ); |
1142 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 1139 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
1143 | ke-> simpleData.keycode, | 1140 | ke-> simpleData.keycode, |
1144 | ch. latin1 ( ), | 1141 | ch. latin1 ( ), |
1145 | ke-> simpleData.modifiers, | 1142 | ke-> simpleData.modifiers, |
1146 | QString ( ch ), | 1143 | QString ( ch ), |
1147 | ke-> simpleData.is_auto_repeat, 1 ); | 1144 | ke-> simpleData.is_auto_repeat, 1 ); |
1148 | 1145 | ||
1149 | QObject *which = QWidget::keyboardGrabber ( ); | 1146 | QObject *which = QWidget::keyboardGrabber ( ); |
1150 | if ( !which ) | 1147 | if ( !which ) |
1151 | which = QApplication::focusWidget ( ); | 1148 | which = QApplication::focusWidget ( ); |
1152 | if ( !which ) | 1149 | if ( !which ) |
1153 | which = QApplication::activeWindow ( ); | 1150 | which = QApplication::activeWindow ( ); |
1154 | if ( !which ) | 1151 | if ( !which ) |
1155 | which = qApp; | 1152 | which = qApp; |
1156 | 1153 | ||
1157 | QApplication::sendEvent ( which, &qke ); | 1154 | QApplication::sendEvent ( which, &qke ); |
1158 | } | 1155 | } |
1159 | 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 |
1160 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 1157 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); |
1161 | 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 ); |
1162 | } | 1159 | } |
1163 | } | 1160 | } |
1164 | return true; | 1161 | return true; |
1165 | } | 1162 | } |
1166 | } | 1163 | } |
1167 | if ( e->type == QWSEvent::Focus ) { | 1164 | if ( e->type == QWSEvent::Focus ) { |
1168 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 1165 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
1169 | if ( !fe->simpleData.get_focus ) { | 1166 | if ( !fe->simpleData.get_focus ) { |
1170 | QWidget * active = activeWindow(); | 1167 | QWidget * active = activeWindow(); |
1171 | while ( active && active->isPopup() ) { | 1168 | while ( active && active->isPopup() ) { |
1172 | active->close(); | 1169 | active->close(); |
1173 | active = activeWindow(); | 1170 | active = activeWindow(); |
1174 | } | 1171 | } |
1175 | } | 1172 | } |
1176 | else { | 1173 | else { |
1177 | // make sure our modal widget is ALWAYS on top | 1174 | // make sure our modal widget is ALWAYS on top |
1178 | QWidget *topm = activeModalWidget(); | 1175 | QWidget *topm = activeModalWidget(); |
1179 | if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { | 1176 | if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { |
1180 | topm->raise(); | 1177 | topm->raise(); |
1181 | } | 1178 | } |
1182 | } | 1179 | } |
1183 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 1180 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
1184 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 1181 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
1185 | if ( m == AlwaysOff ) | 1182 | if ( m == AlwaysOff ) |
1186 | Global::hideInputMethod(); | 1183 | Global::hideInputMethod(); |
1187 | if ( m == AlwaysOn ) | 1184 | if ( m == AlwaysOn ) |
1188 | Global::showInputMethod(); | 1185 | Global::showInputMethod(); |
1189 | } | 1186 | } |
1190 | } | 1187 | } |
1191 | 1188 | ||
1192 | 1189 | ||
1193 | return QApplication::qwsEventFilter( e ); | 1190 | return QApplication::qwsEventFilter( e ); |
1194 | } | 1191 | } |
1195 | #endif | 1192 | #endif |
1196 | 1193 | ||
1197 | /*! | 1194 | /*! |
1198 | Destroys the QPEApplication. | 1195 | Destroys the QPEApplication. |
1199 | */ | 1196 | */ |
1200 | QPEApplication::~QPEApplication() | 1197 | QPEApplication::~QPEApplication() |
1201 | { | 1198 | { |
1202 | ungrabKeyboard(); | 1199 | ungrabKeyboard(); |
1203 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 1200 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
1204 | // Need to delete QCopChannels early, since the display will | 1201 | // Need to delete QCopChannels early, since the display will |
1205 | // be gone by the time we get to ~QObject(). | 1202 | // be gone by the time we get to ~QObject(). |
1206 | delete sysChannel; | 1203 | delete sysChannel; |
1207 | delete pidChannel; | 1204 | delete pidChannel; |
1208 | #endif | 1205 | #endif |
1209 | 1206 | ||
1210 | delete d; | 1207 | delete d; |
1211 | } | 1208 | } |
1212 | 1209 | ||
1213 | /*! | 1210 | /*! |
1214 | Returns <tt>$OPIEDIR/</tt>. | 1211 | Returns <tt>$OPIEDIR/</tt>. |
1215 | */ | 1212 | */ |
1216 | QString QPEApplication::qpeDir() | 1213 | QString QPEApplication::qpeDir() |
1217 | { | 1214 | { |
1218 | const char * base = getenv( "OPIEDIR" ); | 1215 | const char * base = getenv( "OPIEDIR" ); |
1219 | if ( base ) | 1216 | if ( base ) |
1220 | return QString( base ) + "/"; | 1217 | return QString( base ) + "/"; |
1221 | 1218 | ||
1222 | return QString( "../" ); | 1219 | return QString( "../" ); |
1223 | } | 1220 | } |
1224 | 1221 | ||
1225 | /*! | 1222 | /*! |
1226 | Returns the user's current Document directory. There is a trailing "/". | 1223 | Returns the user's current Document directory. There is a trailing "/". |
1227 | .. well, it does now,, and there's no trailing '/' | 1224 | .. well, it does now,, and there's no trailing '/' |
@@ -2058,193 +2055,193 @@ bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | |||
2058 | } | 2055 | } |
2059 | } | 2056 | } |
2060 | } | 2057 | } |
2061 | return FALSE; | 2058 | return FALSE; |
2062 | } | 2059 | } |
2063 | 2060 | ||
2064 | /*! | 2061 | /*! |
2065 | \reimp | 2062 | \reimp |
2066 | */ | 2063 | */ |
2067 | void QPEApplication::timerEvent( QTimerEvent *e ) | 2064 | void QPEApplication::timerEvent( QTimerEvent *e ) |
2068 | { | 2065 | { |
2069 | if ( e->timerId() == d->presstimer && d->presswidget ) { | 2066 | if ( e->timerId() == d->presstimer && d->presswidget ) { |
2070 | // Right pressed | 2067 | // Right pressed |
2071 | postEvent( d->presswidget, | 2068 | postEvent( d->presswidget, |
2072 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, | 2069 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, |
2073 | RightButton, LeftButton ) ); | 2070 | RightButton, LeftButton ) ); |
2074 | killTimer( d->presstimer ); | 2071 | killTimer( d->presstimer ); |
2075 | d->presstimer = 0; | 2072 | d->presstimer = 0; |
2076 | d->rightpressed = TRUE; | 2073 | d->rightpressed = TRUE; |
2077 | } | 2074 | } |
2078 | } | 2075 | } |
2079 | 2076 | ||
2080 | void QPEApplication::removeSenderFromStylusDict() | 2077 | void QPEApplication::removeSenderFromStylusDict() |
2081 | { | 2078 | { |
2082 | stylusDict->remove | 2079 | stylusDict->remove |
2083 | ( ( void* ) sender() ); | 2080 | ( ( void* ) sender() ); |
2084 | if ( d->presswidget == sender() ) | 2081 | if ( d->presswidget == sender() ) |
2085 | d->presswidget = 0; | 2082 | d->presswidget = 0; |
2086 | } | 2083 | } |
2087 | 2084 | ||
2088 | /*! | 2085 | /*! |
2089 | \internal | 2086 | \internal |
2090 | */ | 2087 | */ |
2091 | bool QPEApplication::keyboardGrabbed() const | 2088 | bool QPEApplication::keyboardGrabbed() const |
2092 | { | 2089 | { |
2093 | return d->kbgrabbed; | 2090 | return d->kbgrabbed; |
2094 | } | 2091 | } |
2095 | 2092 | ||
2096 | 2093 | ||
2097 | /*! | 2094 | /*! |
2098 | Reverses the effect of grabKeyboard(). This is called automatically | 2095 | Reverses the effect of grabKeyboard(). This is called automatically |
2099 | on program exit. | 2096 | on program exit. |
2100 | */ | 2097 | */ |
2101 | void QPEApplication::ungrabKeyboard() | 2098 | void QPEApplication::ungrabKeyboard() |
2102 | { | 2099 | { |
2103 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; | 2100 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; |
2104 | } | 2101 | } |
2105 | 2102 | ||
2106 | /*! | 2103 | /*! |
2107 | Grabs the physical keyboard keys, e.g. the application's launching | 2104 | Grabs the physical keyboard keys, e.g. the application's launching |
2108 | keys. Instead of launching applications when these keys are pressed | 2105 | keys. Instead of launching applications when these keys are pressed |
2109 | the signals emitted are sent to this application instead. Some games | 2106 | the signals emitted are sent to this application instead. Some games |
2110 | programs take over the launch keys in this way to make interaction | 2107 | programs take over the launch keys in this way to make interaction |
2111 | easier. | 2108 | easier. |
2112 | 2109 | ||
2113 | \sa ungrabKeyboard() | 2110 | \sa ungrabKeyboard() |
2114 | */ | 2111 | */ |
2115 | void QPEApplication::grabKeyboard() | 2112 | void QPEApplication::grabKeyboard() |
2116 | { | 2113 | { |
2117 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; | 2114 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; |
2118 | } | 2115 | } |
2119 | 2116 | ||
2120 | /*! | 2117 | /*! |
2121 | \reimp | 2118 | \reimp |
2122 | */ | 2119 | */ |
2123 | int QPEApplication::exec() | 2120 | int QPEApplication::exec() |
2124 | { | 2121 | { |
2125 | d->qcopQok = true; | 2122 | d->qcopQok = true; |
2126 | #ifndef QT_NO_COP | 2123 | #ifndef QT_NO_COP |
2127 | d->sendQCopQ(); | 2124 | d->sendQCopQ(); |
2128 | if ( !d->keep_running ) | 2125 | if ( !d->keep_running ) |
2129 | processEvents(); // we may have received QCop messages in the meantime. | 2126 | processEvents(); // we may have received QCop messages in the meantime. |
2130 | #endif | 2127 | #endif |
2131 | 2128 | ||
2132 | if ( d->keep_running ) | 2129 | if ( d->keep_running ) |
2133 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) | 2130 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) |
2134 | return QApplication::exec(); | 2131 | return QApplication::exec(); |
2135 | 2132 | ||
2136 | #ifndef QT_NO_COP | 2133 | #ifndef QT_NO_COP |
2137 | 2134 | ||
2138 | { | 2135 | { |
2139 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 2136 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
2140 | e << d->appName; | 2137 | e << d->appName; |
2141 | } | 2138 | } |
2142 | #endif | 2139 | #endif |
2143 | processEvents(); | 2140 | processEvents(); |
2144 | return 0; | 2141 | return 0; |
2145 | } | 2142 | } |
2146 | 2143 | ||
2147 | /*! | 2144 | /*! |
2148 | \internal | 2145 | \internal |
2149 | External request for application to quit. Quits if possible without | 2146 | External request for application to quit. Quits if possible without |
2150 | loosing state. | 2147 | loosing state. |
2151 | */ | 2148 | */ |
2152 | void QPEApplication::tryQuit() | 2149 | void QPEApplication::tryQuit() |
2153 | { | 2150 | { |
2154 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) | 2151 | if ( activeModalWidget() ) |
2155 | return ; // Inside modal loop or konsole. Too hard to save state. | 2152 | return ; // Inside modal loop or konsole. Too hard to save state. |
2156 | #ifndef QT_NO_COP | 2153 | #ifndef QT_NO_COP |
2157 | 2154 | ||
2158 | { | 2155 | { |
2159 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 2156 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
2160 | e << d->appName; | 2157 | e << d->appName; |
2161 | } | 2158 | } |
2162 | #endif | 2159 | #endif |
2163 | if ( d->keep_running ) | 2160 | if ( d->keep_running ) |
2164 | d->store_widget_rect(d->qpe_main_widget, d->appName); | 2161 | d->store_widget_rect(d->qpe_main_widget, d->appName); |
2165 | processEvents(); | 2162 | processEvents(); |
2166 | 2163 | ||
2167 | quit(); | 2164 | quit(); |
2168 | } | 2165 | } |
2169 | 2166 | ||
2170 | /*! | 2167 | /*! |
2171 | \internal | 2168 | \internal |
2172 | */ | 2169 | */ |
2173 | void QPEApplication::installTranslation( const QString& baseName ) { | 2170 | void QPEApplication::installTranslation( const QString& baseName ) { |
2174 | QTranslator* trans = new QTranslator(this); | 2171 | QTranslator* trans = new QTranslator(this); |
2175 | QString tfn = qpeDir() + "/i18n/"+baseName; | 2172 | QString tfn = qpeDir() + "/i18n/"+baseName; |
2176 | if ( trans->load( tfn ) ) | 2173 | if ( trans->load( tfn ) ) |
2177 | installTranslator( trans ); | 2174 | installTranslator( trans ); |
2178 | else | 2175 | else |
2179 | delete trans; | 2176 | delete trans; |
2180 | } | 2177 | } |
2181 | 2178 | ||
2182 | /*! | 2179 | /*! |
2183 | \internal | 2180 | \internal |
2184 | User initiated quit. Makes the window 'Go Away'. If preloaded this means | 2181 | User initiated quit. Makes the window 'Go Away'. If preloaded this means |
2185 | hiding the window. If not it means quitting the application. | 2182 | hiding the window. If not it means quitting the application. |
2186 | As this is user initiated we don't need to check state. | 2183 | As this is user initiated we don't need to check state. |
2187 | */ | 2184 | */ |
2188 | void QPEApplication::hideOrQuit() | 2185 | void QPEApplication::hideOrQuit() |
2189 | { | 2186 | { |
2190 | if ( d->keep_running ) | 2187 | if ( d->keep_running ) |
2191 | d->store_widget_rect(d->qpe_main_widget, d->appName); | 2188 | d->store_widget_rect(d->qpe_main_widget, d->appName); |
2192 | processEvents(); | 2189 | processEvents(); |
2193 | 2190 | ||
2194 | // If we are a preloaded application we don't actually quit, so emit | 2191 | // If we are a preloaded application we don't actually quit, so emit |
2195 | // a System message indicating we're quasi-closing. | 2192 | // a System message indicating we're quasi-closing. |
2196 | if ( d->preloaded && d->qpe_main_widget ) | 2193 | if ( d->preloaded && d->qpe_main_widget ) |
2197 | #ifndef QT_NO_COP | 2194 | #ifndef QT_NO_COP |
2198 | 2195 | ||
2199 | { | 2196 | { |
2200 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); | 2197 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); |
2201 | e << d->appName; | 2198 | e << d->appName; |
2202 | d->qpe_main_widget->hide(); | 2199 | d->qpe_main_widget->hide(); |
2203 | } | 2200 | } |
2204 | #endif | 2201 | #endif |
2205 | else | 2202 | else |
2206 | quit(); | 2203 | quit(); |
2207 | } | 2204 | } |
2208 | 2205 | ||
2209 | #if (__GNUC__ > 2 ) | 2206 | #if (__GNUC__ > 2 ) |
2210 | extern "C" void __cxa_pure_virtual(); | 2207 | extern "C" void __cxa_pure_virtual(); |
2211 | 2208 | ||
2212 | void __cxa_pure_virtual() | 2209 | void __cxa_pure_virtual() |
2213 | { | 2210 | { |
2214 | fprintf( stderr, "Pure virtual called\n"); | 2211 | fprintf( stderr, "Pure virtual called\n"); |
2215 | abort(); | 2212 | abort(); |
2216 | 2213 | ||
2217 | } | 2214 | } |
2218 | 2215 | ||
2219 | #endif | 2216 | #endif |
2220 | 2217 | ||
2221 | 2218 | ||
2222 | #if defined(OPIE_NEW_MALLOC) | 2219 | #if defined(OPIE_NEW_MALLOC) |
2223 | 2220 | ||
2224 | // The libraries with the skiff package (and possibly others) have | 2221 | // The libraries with the skiff package (and possibly others) have |
2225 | // completely useless implementations of builtin new and delete that | 2222 | // completely useless implementations of builtin new and delete that |
2226 | // use about 50% of your CPU. Here we revert to the simple libc | 2223 | // use about 50% of your CPU. Here we revert to the simple libc |
2227 | // functions. | 2224 | // functions. |
2228 | 2225 | ||
2229 | void* operator new[]( size_t size ) | 2226 | void* operator new[]( size_t size ) |
2230 | { | 2227 | { |
2231 | return malloc( size ); | 2228 | return malloc( size ); |
2232 | } | 2229 | } |
2233 | 2230 | ||
2234 | void* operator new( size_t size ) | 2231 | void* operator new( size_t size ) |
2235 | { | 2232 | { |
2236 | return malloc( size ); | 2233 | return malloc( size ); |
2237 | } | 2234 | } |
2238 | 2235 | ||
2239 | void operator delete[]( void* p ) | 2236 | void operator delete[]( void* p ) |
2240 | { | 2237 | { |
2241 | free( p ); | 2238 | free( p ); |
2242 | } | 2239 | } |
2243 | 2240 | ||
2244 | void operator delete[]( void* p, size_t /*size*/ ) | 2241 | void operator delete[]( void* p, size_t /*size*/ ) |
2245 | { | 2242 | { |
2246 | free( p ); | 2243 | free( p ); |
2247 | } | 2244 | } |
2248 | 2245 | ||
2249 | 2246 | ||
2250 | void operator delete( void* p ) | 2247 | void operator delete( void* p ) |