-rw-r--r-- | library/qpeapplication.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index c875ff2..86dbe85 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1024,56 +1024,48 @@ public: | |||
1024 | { | 1024 | { |
1025 | reject(); | 1025 | reject(); |
1026 | } | 1026 | } |
1027 | }; | 1027 | }; |
1028 | 1028 | ||
1029 | 1029 | ||
1030 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) | 1030 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) |
1031 | { | 1031 | { |
1032 | // specialised actions for certain widgets. May want to | 1032 | // specialised actions for certain widgets. May want to |
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 | ||
1049 | // { | ||
1050 | // public: | ||
1051 | // bool needsOk() | ||
1052 | // { | ||
1053 | // return ( getWState() & WState_Reserved1 ); | ||
1054 | // } | ||
1055 | // }; | ||
1056 | 1048 | ||
1057 | /*! | 1049 | /*! |
1058 | \internal | 1050 | \internal |
1059 | */ | 1051 | */ |
1060 | 1052 | ||
1061 | #ifdef QWS | 1053 | #ifdef QWS |
1062 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) | 1054 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) |
1063 | { | 1055 | { |
1064 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { | 1056 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { |
1065 | if ( qApp->type() != QApplication::GuiServer ) { | 1057 | if ( qApp->type() != QApplication::GuiServer ) { |
1066 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); | 1058 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); |
1067 | e << d->appName; | 1059 | e << d->appName; |
1068 | } | 1060 | } |
1069 | d->notbusysent = TRUE; | 1061 | d->notbusysent = TRUE; |
1070 | } | 1062 | } |
1071 | if ( type() == GuiServer ) { | 1063 | if ( type() == GuiServer ) { |
1072 | switch ( e->type ) { | 1064 | switch ( e->type ) { |
1073 | case QWSEvent::Mouse: | 1065 | case QWSEvent::Mouse: |
1074 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) | 1066 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) |
1075 | emit clientMoused(); | 1067 | emit clientMoused(); |
1076 | break; | 1068 | break; |
1077 | default: | 1069 | default: |
1078 | break; | 1070 | break; |
1079 | } | 1071 | } |
@@ -1101,48 +1093,49 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e ) | |||
1101 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { | 1093 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { |
1102 | QSignal s; | 1094 | QSignal s; |
1103 | s.connect( active, SLOT( accept() ) ); | 1095 | s.connect( active, SLOT( accept() ) ); |
1104 | s.activate(); | 1096 | s.activate(); |
1105 | } | 1097 | } |
1106 | else { | 1098 | else { |
1107 | // do the same as with the select key: Map to the default action of the widget: | 1099 | // do the same as with the select key: Map to the default action of the widget: |
1108 | mapToDefaultAction( ke, Qt::Key_Return ); | 1100 | mapToDefaultAction( ke, Qt::Key_Return ); |
1109 | } | 1101 | } |
1110 | } | 1102 | } |
1111 | } | 1103 | } |
1112 | } | 1104 | } |
1113 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 1105 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
1114 | // Use special "select" key to do whatever default action a widget has | 1106 | // Use special "select" key to do whatever default action a widget has |
1115 | mapToDefaultAction( ke, Qt::Key_Space ); | 1107 | mapToDefaultAction( ke, Qt::Key_Space ); |
1116 | } | 1108 | } |
1117 | else if ( ke->simpleData.keycode == Qt::Key_Escape && | 1109 | else if ( ke->simpleData.keycode == Qt::Key_Escape && |
1118 | ke->simpleData.is_press ) { | 1110 | ke->simpleData.is_press ) { |
1119 | // Escape key closes app if focus on toplevel | 1111 | // Escape key closes app if focus on toplevel |
1120 | QWidget * active = activeWindow(); | 1112 | QWidget * active = activeWindow(); |
1121 | if ( active && active->testWFlags( WType_TopLevel ) && | 1113 | if ( active && active->testWFlags( WType_TopLevel ) && |
1122 | ( int ) active->winId() == ke->simpleData.window && | 1114 | ( int ) active->winId() == ke->simpleData.window && |
1123 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 1115 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
1124 | if ( active->inherits( "QDialog" ) ) { | 1116 | if ( active->inherits( "QDialog" ) ) { |
1117 | qDebug("dialog hack"); | ||
1125 | HackDialog * d = ( HackDialog * ) active; | 1118 | HackDialog * d = ( HackDialog * ) active; |
1126 | d->rejectIt(); | 1119 | d->rejectIt(); |
1127 | return TRUE; | 1120 | return TRUE; |
1128 | } | 1121 | } |
1129 | } | 1122 | } |
1130 | } | 1123 | } |
1131 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { | 1124 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { |
1132 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) | 1125 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) |
1133 | // but we cannot access libopie function within libqpe :( | 1126 | // but we cannot access libopie function within libqpe :( |
1134 | 1127 | ||
1135 | QWidget * active = activeWindow ( ); | 1128 | QWidget * active = activeWindow ( ); |
1136 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 1129 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
1137 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 1130 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
1138 | QChar ch ( ke-> simpleData.unicode ); | 1131 | QChar ch ( ke-> simpleData.unicode ); |
1139 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 1132 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
1140 | ke-> simpleData.keycode, | 1133 | ke-> simpleData.keycode, |
1141 | ch. latin1 ( ), | 1134 | ch. latin1 ( ), |
1142 | ke-> simpleData.modifiers, | 1135 | ke-> simpleData.modifiers, |
1143 | QString ( ch ), | 1136 | QString ( ch ), |
1144 | ke-> simpleData.is_auto_repeat, 1 ); | 1137 | ke-> simpleData.is_auto_repeat, 1 ); |
1145 | 1138 | ||
1146 | QObject *which = QWidget::keyboardGrabber ( ); | 1139 | QObject *which = QWidget::keyboardGrabber ( ); |
1147 | if ( !which ) | 1140 | if ( !which ) |
1148 | which = QApplication::focusWidget ( ); | 1141 | which = QApplication::focusWidget ( ); |