author | llornkcor <llornkcor> | 2002-10-18 15:31:23 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-18 15:31:23 (UTC) |
commit | 0910b94b5b6618c84b3eb6c457c9137d63a7277f (patch) (unidiff) | |
tree | 44df052721286af898978416a1efcce3c472baaa | |
parent | 88b3a159060ed7057bfee4cc1ccfcf81a63a4780 (diff) | |
download | opie-0910b94b5b6618c84b3eb6c457c9137d63a7277f.zip opie-0910b94b5b6618c84b3eb6c457c9137d63a7277f.tar.gz opie-0910b94b5b6618c84b3eb6c457c9137d63a7277f.tar.bz2 |
handle Ctrl-V event
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index 6d5c6e9..b1ad008 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -983,103 +983,108 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
983 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) | 983 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) |
984 | return FALSE; // not us | 984 | return FALSE; // not us |
985 | if ( e->type() == QEvent::Wheel) { | 985 | if ( e->type() == QEvent::Wheel) { |
986 | QApplication::sendEvent(scrollbar, e); | 986 | QApplication::sendEvent(scrollbar, e); |
987 | } | 987 | } |
988 | 988 | ||
989 | #ifdef FAKE_CTRL_AND_ALT | 989 | #ifdef FAKE_CTRL_AND_ALT |
990 | static bool control = FALSE; | 990 | static bool control = FALSE; |
991 | static bool alt = FALSE; | 991 | static bool alt = FALSE; |
992 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); | 992 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); |
993 | bool dele=FALSE; | 993 | bool dele=FALSE; |
994 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 994 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
995 | QKeyEvent* ke = (QKeyEvent*)e; | 995 | QKeyEvent* ke = (QKeyEvent*)e; |
996 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 996 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
997 | switch (ke->key()) { | 997 | switch (ke->key()) { |
998 | case Key_F9: // let this be "Control" | 998 | case Key_F9: // let this be "Control" |
999 | control = keydown; | 999 | control = keydown; |
1000 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); | 1000 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); |
1001 | dele=TRUE; | 1001 | dele=TRUE; |
1002 | break; | 1002 | break; |
1003 | case Key_F13: // let this be "Alt" | 1003 | case Key_F13: // let this be "Alt" |
1004 | alt = keydown; | 1004 | alt = keydown; |
1005 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); | 1005 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); |
1006 | dele=TRUE; | 1006 | dele=TRUE; |
1007 | break; | 1007 | break; |
1008 | default: | 1008 | default: |
1009 | if ( control ) { | 1009 | if ( control ) { |
1010 | int a = toupper(ke->ascii())-64; | 1010 | int a = toupper(ke->ascii())-64; |
1011 | if ( a >= 0 && a < ' ' ) { | 1011 | if ( a >= 0 && a < ' ' ) { |
1012 | e = new QKeyEvent(e->type(), ke->key(), | 1012 | e = new QKeyEvent(e->type(), ke->key(), |
1013 | a, ke->state()|ControlButton, QChar(a,0)); | 1013 | a, ke->state()|ControlButton, QChar(a,0)); |
1014 | dele=TRUE; | 1014 | dele=TRUE; |
1015 | } | 1015 | } |
1016 | } | 1016 | } |
1017 | if ( alt ) { | 1017 | if ( alt ) { |
1018 | e = new QKeyEvent(e->type(), ke->key(), | 1018 | e = new QKeyEvent(e->type(), ke->key(), |
1019 | ke->ascii(), ke->state()|AltButton, ke->text()); | 1019 | ke->ascii(), ke->state()|AltButton, ke->text()); |
1020 | dele=TRUE; | 1020 | dele=TRUE; |
1021 | } | 1021 | } |
1022 | } | 1022 | } |
1023 | } | 1023 | } |
1024 | #endif | 1024 | #endif |
1025 | 1025 | ||
1026 | if ( e->type() == QEvent::KeyPress ) { | 1026 | if ( e->type() == QEvent::KeyPress ) { |
1027 | QKeyEvent* ke = (QKeyEvent*)e; | 1027 | QKeyEvent* ke = (QKeyEvent*)e; |
1028 | actSel=0; // Key stroke implies a screen update, so TEWidget won't | 1028 | actSel=0; // Key stroke implies a screen update, so TEWidget won't |
1029 | // know where the current selection is. | 1029 | // know where the current selection is. |
1030 | 1030 | ||
1031 | // qDebug("key pressed is 0x%x",ke->key()); | 1031 | // qDebug("key pressed is 0x%x, state %d",ke->key(), ke->state()); |
1032 | 1032 | ||
1033 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker | 1033 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { |
1034 | //lets hardcode this sucker | ||
1034 | 1035 | ||
1035 | // qDebug("key pressed 2 is 0x%x",ke->key()); | 1036 | // qDebug("key pressed 2 is 0x%x",ke->key()); |
1036 | emitText("\\"); // expose | 1037 | emitText("\\"); // expose |
1037 | } else | 1038 | } |
1039 | else if( ke->state() == ControlButton && ke->key() == Key_V) { | ||
1040 | pasteClipboard(); | ||
1041 | } | ||
1042 | else | ||
1038 | emit keyPressedSignal(ke); // expose | 1043 | emit keyPressedSignal(ke); // expose |
1039 | ke->accept(); | 1044 | ke->accept(); |
1040 | #ifdef FAKE_CTRL_AND_ALT | 1045 | #ifdef FAKE_CTRL_AND_ALT |
1041 | if ( dele ) delete e; | 1046 | if ( dele ) delete e; |
1042 | #endif | 1047 | #endif |
1043 | return true; // stop the event | 1048 | return true; // stop the event |
1044 | } | 1049 | } |
1045 | if ( e->type() == QEvent::Enter ) { | 1050 | if ( e->type() == QEvent::Enter ) { |
1046 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), | 1051 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), |
1047 | this, SLOT(onClearSelection()) ); | 1052 | this, SLOT(onClearSelection()) ); |
1048 | } | 1053 | } |
1049 | if ( e->type() == QEvent::Leave ) { | 1054 | if ( e->type() == QEvent::Leave ) { |
1050 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), | 1055 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), |
1051 | this, SLOT(onClearSelection()) ); | 1056 | this, SLOT(onClearSelection()) ); |
1052 | } | 1057 | } |
1053 | return QFrame::eventFilter( obj, e ); | 1058 | return QFrame::eventFilter( obj, e ); |
1054 | } | 1059 | } |
1055 | 1060 | ||
1056 | /* ------------------------------------------------------------------------- */ | 1061 | /* ------------------------------------------------------------------------- */ |
1057 | /* */ | 1062 | /* */ |
1058 | /* Frame */ | 1063 | /* Frame */ |
1059 | /* */ | 1064 | /* */ |
1060 | /* ------------------------------------------------------------------------- */ | 1065 | /* ------------------------------------------------------------------------- */ |
1061 | 1066 | ||
1062 | void TEWidget::frameChanged() | 1067 | void TEWidget::frameChanged() |
1063 | { | 1068 | { |
1064 | propagateSize(); | 1069 | propagateSize(); |
1065 | update(); | 1070 | update(); |
1066 | } | 1071 | } |
1067 | 1072 | ||
1068 | /* ------------------------------------------------------------------------- */ | 1073 | /* ------------------------------------------------------------------------- */ |
1069 | /* */ | 1074 | /* */ |
1070 | /* Sound */ | 1075 | /* Sound */ |
1071 | /* */ | 1076 | /* */ |
1072 | /* ------------------------------------------------------------------------- */ | 1077 | /* ------------------------------------------------------------------------- */ |
1073 | 1078 | ||
1074 | void TEWidget::Bell() | 1079 | void TEWidget::Bell() |
1075 | { | 1080 | { |
1076 | QApplication::beep(); | 1081 | QApplication::beep(); |
1077 | } | 1082 | } |
1078 | 1083 | ||
1079 | /* ------------------------------------------------------------------------- */ | 1084 | /* ------------------------------------------------------------------------- */ |
1080 | /* */ | 1085 | /* */ |
1081 | /* Auxiluary */ | 1086 | /* Auxiluary */ |
1082 | /* */ | 1087 | /* */ |
1083 | /* ------------------------------------------------------------------------- */ | 1088 | /* ------------------------------------------------------------------------- */ |
1084 | 1089 | ||
1085 | void TEWidget::clearImage() | 1090 | void TEWidget::clearImage() |