author | llornkcor <llornkcor> | 2004-04-25 13:05:00 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-25 13:05:00 (UTC) |
commit | 4e4586dc20a0a8befe808d7c89ee2fb3222c63b6 (patch) (side-by-side diff) | |
tree | 3d67622f58160d0df8e69f75129be1ef6cdb9d03 | |
parent | 6182b509bdb16dd4d1e95b9a570219ef6c15ed21 (diff) | |
download | opie-4e4586dc20a0a8befe808d7c89ee2fb3222c63b6.zip opie-4e4586dc20a0a8befe808d7c89ee2fb3222c63b6.tar.gz opie-4e4586dc20a0a8befe808d7c89ee2fb3222c63b6.tar.bz2 |
escape close
-rw-r--r-- | library/qpeapplication.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index d0e9613..040b2fe 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -1095,70 +1095,72 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) if ( ke->simpleData.is_press ) { if ( popup ) popup->close(); if ( active->inherits( "QDialog" ) ) { HackDialog * d = ( HackDialog * ) active; d->acceptIt(); return TRUE; } else if ( ( ( HackWidget * ) active ) ->needsOk() ) { QSignal s; s.connect( active, SLOT( accept() ) ); s.activate(); } else { // do the same as with the select key: Map to the default action of the widget: mapToDefaultAction( ke, Qt::Key_Return ); } } } } else if ( ke->simpleData.keycode == Qt::Key_F30 ) { // Use special "select" key to do whatever default action a widget has mapToDefaultAction( ke, Qt::Key_Space ); } else if ( ke->simpleData.keycode == Qt::Key_Escape && ke->simpleData.is_press ) { // Escape key closes app if focus on toplevel QWidget * active = activeWindow(); if ( active && active->testWFlags( WType_TopLevel ) && ( int ) active->winId() == ke->simpleData.window && !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { if ( active->inherits( "QDialog" ) ) { - qDebug("dialog hack"); HackDialog * d = ( HackDialog * ) active; d->rejectIt(); return TRUE; + } else /*if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 )*/ { + active->close(); } } + } else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) // but we cannot access libopie function within libqpe :( QWidget * active = activeWindow ( ); if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { if ( d-> kbgrabbed ) { // we grabbed the keyboard QChar ch ( ke-> simpleData.unicode ); QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, ke-> simpleData.keycode, ch. latin1 ( ), ke-> simpleData.modifiers, QString ( ch ), ke-> simpleData.is_auto_repeat, 1 ); QObject *which = QWidget::keyboardGrabber ( ); if ( !which ) which = QApplication::focusWidget ( ); if ( !which ) which = QApplication::activeWindow ( ); if ( !which ) which = qApp; QApplication::sendEvent ( which, &qke ); } else { // we didn't grab the keyboard, so send the event to the launcher QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); } } return true; |