-rw-r--r-- | library/qpeapplication.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 43a9be5..af00f49 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -2178,141 +2178,145 @@ int QPEApplication::exec() | |||
2178 | return QApplication::exec(); | 2178 | return QApplication::exec(); |
2179 | 2179 | ||
2180 | #ifndef QT_NO_COP | 2180 | #ifndef QT_NO_COP |
2181 | 2181 | ||
2182 | { | 2182 | { |
2183 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 2183 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
2184 | e << d->appName; | 2184 | e << d->appName; |
2185 | } | 2185 | } |
2186 | #endif | 2186 | #endif |
2187 | processEvents(); | 2187 | processEvents(); |
2188 | return 0; | 2188 | return 0; |
2189 | } | 2189 | } |
2190 | 2190 | ||
2191 | /*! | 2191 | /*! |
2192 | \internal | 2192 | \internal |
2193 | External request for application to quit. Quits if possible without | 2193 | External request for application to quit. Quits if possible without |
2194 | loosing state. | 2194 | loosing state. |
2195 | */ | 2195 | */ |
2196 | void QPEApplication::tryQuit() | 2196 | void QPEApplication::tryQuit() |
2197 | { | 2197 | { |
2198 | if ( activeModalWidget() ) | 2198 | if ( activeModalWidget() ) |
2199 | return ; // Inside modal loop or konsole. Too hard to save state. | 2199 | return ; // Inside modal loop or konsole. Too hard to save state. |
2200 | #ifndef QT_NO_COP | 2200 | #ifndef QT_NO_COP |
2201 | 2201 | ||
2202 | { | 2202 | { |
2203 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 2203 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
2204 | e << d->appName; | 2204 | e << d->appName; |
2205 | } | 2205 | } |
2206 | #endif | 2206 | #endif |
2207 | if ( d->keep_running ) | 2207 | if ( d->keep_running ) |
2208 | d->store_widget_rect(d->qpe_main_widget, d->appName); | 2208 | d->store_widget_rect(d->qpe_main_widget, d->appName); |
2209 | processEvents(); | 2209 | processEvents(); |
2210 | 2210 | ||
2211 | quit(); | 2211 | quit(); |
2212 | } | 2212 | } |
2213 | 2213 | ||
2214 | 2214 | ||
2215 | /*! | 2215 | /*! |
2216 | \internal | 2216 | \internal |
2217 | User initiated quit. Makes the window 'Go Away'. If preloaded this means | 2217 | User initiated quit. Makes the window 'Go Away'. If preloaded this means |
2218 | hiding the window. If not it means quitting the application. | 2218 | hiding the window. If not it means quitting the application. |
2219 | As this is user initiated we don't need to check state. | 2219 | As this is user initiated we don't need to check state. |
2220 | */ | 2220 | */ |
2221 | void QPEApplication::hideOrQuit() | 2221 | void QPEApplication::hideOrQuit() |
2222 | { | 2222 | { |
2223 | if ( d->keep_running ) | 2223 | if ( d->keep_running ) |
2224 | d->store_widget_rect(d->qpe_main_widget, d->appName); | 2224 | d->store_widget_rect(d->qpe_main_widget, d->appName); |
2225 | processEvents(); | 2225 | processEvents(); |
2226 | 2226 | ||
2227 | // If we are a preloaded application we don't actually quit, so emit | 2227 | // If we are a preloaded application we don't actually quit, so emit |
2228 | // a System message indicating we're quasi-closing. | 2228 | // a System message indicating we're quasi-closing. |
2229 | if ( d->preloaded && d->qpe_main_widget ) | 2229 | if ( d->preloaded && d->qpe_main_widget ) |
2230 | #ifndef QT_NO_COP | 2230 | #ifndef QT_NO_COP |
2231 | 2231 | ||
2232 | { | 2232 | { |
2233 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); | 2233 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); |
2234 | e << d->appName; | 2234 | e << d->appName; |
2235 | d->qpe_main_widget->hide(); | 2235 | d->qpe_main_widget->hide(); |
2236 | } | 2236 | } |
2237 | #endif | 2237 | #endif |
2238 | else | 2238 | else |
2239 | quit(); | 2239 | quit(); |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | #if (__GNUC__ > 2 ) | 2242 | #if (__GNUC__ > 2 ) |
2243 | extern "C" void __cxa_pure_virtual(); | 2243 | extern "C" void __cxa_pure_virtual(); |
2244 | 2244 | ||
2245 | void __cxa_pure_virtual() | 2245 | void __cxa_pure_virtual() |
2246 | { | 2246 | { |
2247 | fprintf( stderr, "Pure virtual called\n"); | 2247 | fprintf( stderr, "Pure virtual called\n"); |
2248 | abort(); | 2248 | abort(); |
2249 | 2249 | ||
2250 | } | 2250 | } |
2251 | 2251 | ||
2252 | #endif | 2252 | #endif |
2253 | 2253 | ||
2254 | 2254 | ||
2255 | #if defined(OPIE_NEW_MALLOC) | 2255 | #if defined(OPIE_NEW_MALLOC) |
2256 | 2256 | ||
2257 | // The libraries with the skiff package (and possibly others) have | 2257 | // The libraries with the skiff package (and possibly others) have |
2258 | // completely useless implementations of builtin new and delete that | 2258 | // completely useless implementations of builtin new and delete that |
2259 | // use about 50% of your CPU. Here we revert to the simple libc | 2259 | // use about 50% of your CPU. Here we revert to the simple libc |
2260 | // functions. | 2260 | // functions. |
2261 | 2261 | ||
2262 | void* operator new[]( size_t size ) | 2262 | void* operator new[]( size_t size ) |
2263 | { | 2263 | { |
2264 | return malloc( size ); | 2264 | return malloc( size ); |
2265 | } | 2265 | } |
2266 | 2266 | ||
2267 | void* operator new( size_t size ) | 2267 | void* operator new( size_t size ) |
2268 | { | 2268 | { |
2269 | return malloc( size ); | 2269 | return malloc( size ); |
2270 | } | 2270 | } |
2271 | 2271 | ||
2272 | void operator delete[]( void* p ) | 2272 | void operator delete[]( void* p ) |
2273 | { | 2273 | { |
2274 | free( p ); | 2274 | if ( p ) |
2275 | free( p ); | ||
2275 | } | 2276 | } |
2276 | 2277 | ||
2277 | void operator delete[]( void* p, size_t /*size*/ ) | 2278 | void operator delete[]( void* p, size_t /*size*/ ) |
2278 | { | 2279 | { |
2279 | free( p ); | 2280 | if ( p ) |
2281 | free( p ); | ||
2280 | } | 2282 | } |
2281 | 2283 | ||
2282 | 2284 | ||
2283 | void operator delete( void* p ) | 2285 | void operator delete( void* p ) |
2284 | { | 2286 | { |
2285 | free( p ); | 2287 | if ( p ) |
2288 | free( p ); | ||
2286 | } | 2289 | } |
2287 | 2290 | ||
2288 | void operator delete( void* p, size_t /*size*/ ) | 2291 | void operator delete( void* p, size_t /*size*/ ) |
2289 | { | 2292 | { |
2290 | free( p ); | 2293 | if ( p ) |
2294 | free( p ); | ||
2291 | } | 2295 | } |
2292 | 2296 | ||
2293 | #endif | 2297 | #endif |
2294 | 2298 | ||
2295 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) | 2299 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) |
2296 | #include <qwidgetlist.h> | 2300 | #include <qwidgetlist.h> |
2297 | #ifdef QWS | 2301 | #ifdef QWS |
2298 | #include <qgfx_qws.h> | 2302 | #include <qgfx_qws.h> |
2299 | extern QRect qt_maxWindowRect; | 2303 | extern QRect qt_maxWindowRect; |
2300 | void qt_setMaxWindowRect(const QRect& r ) | 2304 | void qt_setMaxWindowRect(const QRect& r ) |
2301 | { | 2305 | { |
2302 | qt_maxWindowRect = qt_screen->mapFromDevice( r, | 2306 | qt_maxWindowRect = qt_screen->mapFromDevice( r, |
2303 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); | 2307 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); |
2304 | // Re-resize any maximized windows | 2308 | // Re-resize any maximized windows |
2305 | QWidgetList* l = QApplication::topLevelWidgets(); | 2309 | QWidgetList* l = QApplication::topLevelWidgets(); |
2306 | if ( l ) { | 2310 | if ( l ) { |
2307 | QWidget * w = l->first(); | 2311 | QWidget * w = l->first(); |
2308 | while ( w ) { | 2312 | while ( w ) { |
2309 | if ( w->isVisible() && w->isMaximized() ) { | 2313 | if ( w->isVisible() && w->isMaximized() ) { |
2310 | w->showMaximized(); | 2314 | w->showMaximized(); |
2311 | } | 2315 | } |
2312 | w = l->next(); | 2316 | w = l->next(); |
2313 | } | 2317 | } |
2314 | delete l; | 2318 | delete l; |
2315 | } | 2319 | } |
2316 | } | 2320 | } |
2317 | #endif | 2321 | #endif |
2318 | #endif | 2322 | #endif |