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/qpeapplication.cpp | |
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 | |||
@@ -1097,67 +1097,64 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) | |||
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 | } |
@@ -2122,65 +2119,65 @@ void QPEApplication::grabKeyboard() | |||
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. |