summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp4
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
@@ -1079,102 +1079,104 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
1079 default: 1079 default:
1080 break; 1080 break;
1081 } 1081 }
1082 } 1082 }
1083 if ( e->type == QWSEvent::Key ) { 1083 if ( e->type == QWSEvent::Key ) {
1084 QWSKeyEvent *ke = ( QWSKeyEvent * ) e; 1084 QWSKeyEvent *ke = ( QWSKeyEvent * ) e;
1085 if ( ke->simpleData.keycode == Qt::Key_F33 ) { 1085 if ( ke->simpleData.keycode == Qt::Key_F33 ) {
1086 // Use special "OK" key to press "OK" on top level widgets 1086 // Use special "OK" key to press "OK" on top level widgets
1087 QWidget * active = activeWindow(); 1087 QWidget * active = activeWindow();
1088 QWidget *popup = 0; 1088 QWidget *popup = 0;
1089 if ( active && active->isPopup() ) { 1089 if ( active && active->isPopup() ) {
1090 popup = active; 1090 popup = active;
1091 active = active->parentWidget(); 1091 active = active->parentWidget();
1092 } 1092 }
1093 if ( active && ( int ) active->winId() == ke->simpleData.window && 1093 if ( active && ( int ) active->winId() == ke->simpleData.window &&
1094 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { 1094 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) {
1095 if ( ke->simpleData.is_press ) { 1095 if ( ke->simpleData.is_press ) {
1096 if ( popup ) 1096 if ( popup )
1097 popup->close(); 1097 popup->close();
1098 if ( active->inherits( "QDialog" ) ) { 1098 if ( active->inherits( "QDialog" ) ) {
1099 HackDialog * d = ( HackDialog * ) active; 1099 HackDialog * d = ( HackDialog * ) active;
1100 d->acceptIt(); 1100 d->acceptIt();
1101 return TRUE; 1101 return TRUE;
1102 } 1102 }
1103 else if ( ( ( HackWidget * ) active ) ->needsOk() ) { 1103 else if ( ( ( HackWidget * ) active ) ->needsOk() ) {
1104 QSignal s; 1104 QSignal s;
1105 s.connect( active, SLOT( accept() ) ); 1105 s.connect( active, SLOT( accept() ) );
1106 s.activate(); 1106 s.activate();
1107 } 1107 }
1108 else { 1108 else {
1109 // do the same as with the select key: Map to the default action of the widget: 1109 // do the same as with the select key: Map to the default action of the widget:
1110 mapToDefaultAction( ke, Qt::Key_Return ); 1110 mapToDefaultAction( ke, Qt::Key_Return );
1111 } 1111 }
1112 } 1112 }
1113 } 1113 }
1114 } 1114 }
1115 else if ( ke->simpleData.keycode == Qt::Key_F30 ) { 1115 else if ( ke->simpleData.keycode == Qt::Key_F30 ) {
1116 // Use special "select" key to do whatever default action a widget has 1116 // Use special "select" key to do whatever default action a widget has
1117 mapToDefaultAction( ke, Qt::Key_Space ); 1117 mapToDefaultAction( ke, Qt::Key_Space );
1118 } 1118 }
1119 else if ( ke->simpleData.keycode == Qt::Key_Escape && 1119 else if ( ke->simpleData.keycode == Qt::Key_Escape &&
1120 ke->simpleData.is_press ) { 1120 ke->simpleData.is_press ) {
1121 // Escape key closes app if focus on toplevel 1121 // Escape key closes app if focus on toplevel
1122 QWidget * active = activeWindow(); 1122 QWidget * active = activeWindow();
1123 if ( active && active->testWFlags( WType_TopLevel ) && 1123 if ( active && active->testWFlags( WType_TopLevel ) &&
1124 ( int ) active->winId() == ke->simpleData.window && 1124 ( int ) active->winId() == ke->simpleData.window &&
1125 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { 1125 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) {
1126 if ( active->inherits( "QDialog" ) ) { 1126 if ( active->inherits( "QDialog" ) ) {
1127 qDebug("dialog hack");
1128 HackDialog * d = ( HackDialog * ) active; 1127 HackDialog * d = ( HackDialog * ) active;
1129 d->rejectIt(); 1128 d->rejectIt();
1130 return TRUE; 1129 return TRUE;
1130 } else /*if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 )*/ {
1131 active->close();
1131 } 1132 }
1132 } 1133 }
1134
1133 } 1135 }
1134 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { 1136 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) {
1135 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) 1137 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... ))
1136 // but we cannot access libopie function within libqpe :( 1138 // but we cannot access libopie function within libqpe :(
1137 1139
1138 QWidget * active = activeWindow ( ); 1140 QWidget * active = activeWindow ( );
1139 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { 1141 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) {
1140 if ( d-> kbgrabbed ) { // we grabbed the keyboard 1142 if ( d-> kbgrabbed ) { // we grabbed the keyboard
1141 QChar ch ( ke-> simpleData.unicode ); 1143 QChar ch ( ke-> simpleData.unicode );
1142 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, 1144 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease,
1143 ke-> simpleData.keycode, 1145 ke-> simpleData.keycode,
1144 ch. latin1 ( ), 1146 ch. latin1 ( ),
1145 ke-> simpleData.modifiers, 1147 ke-> simpleData.modifiers,
1146 QString ( ch ), 1148 QString ( ch ),
1147 ke-> simpleData.is_auto_repeat, 1 ); 1149 ke-> simpleData.is_auto_repeat, 1 );
1148 1150
1149 QObject *which = QWidget::keyboardGrabber ( ); 1151 QObject *which = QWidget::keyboardGrabber ( );
1150 if ( !which ) 1152 if ( !which )
1151 which = QApplication::focusWidget ( ); 1153 which = QApplication::focusWidget ( );
1152 if ( !which ) 1154 if ( !which )
1153 which = QApplication::activeWindow ( ); 1155 which = QApplication::activeWindow ( );
1154 if ( !which ) 1156 if ( !which )
1155 which = qApp; 1157 which = qApp;
1156 1158
1157 QApplication::sendEvent ( which, &qke ); 1159 QApplication::sendEvent ( which, &qke );
1158 } 1160 }
1159 else { // we didn't grab the keyboard, so send the event to the launcher 1161 else { // we didn't grab the keyboard, so send the event to the launcher
1160 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); 1162 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 ); 1163 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat );
1162 } 1164 }
1163 } 1165 }
1164 return true; 1166 return true;
1165 } 1167 }
1166 } 1168 }
1167 if ( e->type == QWSEvent::Focus ) { 1169 if ( e->type == QWSEvent::Focus ) {
1168 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 1170 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
1169 if ( !fe->simpleData.get_focus ) { 1171 if ( !fe->simpleData.get_focus ) {
1170 QWidget * active = activeWindow(); 1172 QWidget * active = activeWindow();
1171 while ( active && active->isPopup() ) { 1173 while ( active && active->isPopup() ) {
1172 active->close(); 1174 active->close();
1173 active = activeWindow(); 1175 active = activeWindow();
1174 } 1176 }
1175 } 1177 }
1176 else { 1178 else {
1177 // make sure our modal widget is ALWAYS on top 1179 // make sure our modal widget is ALWAYS on top
1178 QWidget *topm = activeModalWidget(); 1180 QWidget *topm = activeModalWidget();
1179 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) { 1181 if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) {
1180 topm->raise(); 1182 topm->raise();