summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/TEWidget.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/TEWidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index e535296..d168a5e 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -1008,92 +1008,92 @@ void TEWidget::onClearSelection()
1008// For auto-hide, we need to get keypress-events, but we only get them when 1008// For auto-hide, we need to get keypress-events, but we only get them when
1009// we have focus. 1009// we have focus.
1010 1010
1011void TEWidget::doScroll(int lines) 1011void TEWidget::doScroll(int lines)
1012{ 1012{
1013 scrollbar->setValue(scrollbar->value()+lines); 1013 scrollbar->setValue(scrollbar->value()+lines);
1014} 1014}
1015 1015
1016bool TEWidget::eventFilter( QObject *obj, QEvent *e ) 1016bool TEWidget::eventFilter( QObject *obj, QEvent *e )
1017{ 1017{
1018 if ( (e->type() == QEvent::Accel || 1018 if ( (e->type() == QEvent::Accel ||
1019 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { 1019 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
1020 static_cast<QKeyEvent *>( e )->ignore(); 1020 static_cast<QKeyEvent *>( e )->ignore();
1021 return true; 1021 return true;
1022 } 1022 }
1023 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 1023 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
1024 return FALSE; // not us 1024 return FALSE; // not us
1025 if ( e->type() == QEvent::Wheel) { 1025 if ( e->type() == QEvent::Wheel) {
1026 QApplication::sendEvent(scrollbar, e); 1026 QApplication::sendEvent(scrollbar, e);
1027 } 1027 }
1028 1028
1029#ifdef FAKE_CTRL_AND_ALT 1029#ifdef FAKE_CTRL_AND_ALT
1030 static bool control = FALSE; 1030 static bool control = FALSE;
1031 static bool alt = FALSE; 1031 static bool alt = FALSE;
1032// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); 1032// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
1033 bool dele=FALSE; 1033 bool dele=FALSE;
1034 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 1034 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1035 QKeyEvent* ke = (QKeyEvent*)e; 1035 QKeyEvent* ke = (QKeyEvent*)e;
1036 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 1036 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
1037 switch (ke->key()) { 1037 switch (ke->key()) {
1038 case Key_F9: // let this be "Control" 1038 case Key_F9: // let this be "Control"
1039 control = keydown; 1039 control = keydown;
1040 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 1040 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
1041 dele=TRUE; 1041 dele=TRUE;
1042 break; 1042 break;
1043 case Key_F13: // let this be "Alt" 1043 case Key_F13: // let this be "Alt"
1044 alt = keydown; 1044 alt = keydown;
1045 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); 1045 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
1046 dele=TRUE; 1046 dele=TRUE;
1047 break; 1047 break;
1048 default: 1048 default:
1049 if ( control ) { 1049 if ( control ) {
1050 int a = toupper(ke->ascii())-64; 1050 int a = toupper(ke->ascii())-64;
1051 if ( a >= 0 && a < ' ' ) { 1051 if ( a >= 0 && a < ' ' ) {
1052 e = new QKeyEvent(e->type(), ke->key(), 1052 e = new QKeyEvent(e->type(), ke->key(),
1053 a, ke->state()|ControlButton, QChar(a,0)); 1053 a, ke->state()|ControlButton, QChar(a,0));
1054 dele=TRUE; 1054 dele=TRUE;
1055 } 1055 }
1056 } 1056 }
1057 if ( alt ) { 1057 if ( alt ) {
1058 e = new QKeyEvent(e->type(), ke->key(), 1058 e = new QKeyEvent(e->type(), ke->key(),
1059 ke->ascii(), ke->state()|AltButton, ke->text()); 1059 ke->ascii(), ke->state()|AltButton, ke->text());
1060 dele=TRUE; 1060 dele=TRUE;
1061 } 1061 }
1062 } 1062 }
1063 } 1063 }
1064#endif 1064#endif
1065 1065
1066 if ( e->type() == QEvent::KeyPress ) { 1066 if ( e->type() == QEvent::KeyPress ) {
1067 QKeyEvent* ke = (QKeyEvent*)e; 1067 QKeyEvent* ke = (QKeyEvent*)e;
1068 actSel=0; // Key stroke implies a screen update, so TEWidget won't 1068 actSel=0; // Key stroke implies a screen update, so TEWidget won't
1069 // know where the current selection is. 1069 // know where the current selection is.
1070 1070
1071// qDebug("key pressed is 0x%x",ke->key()); 1071// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
1072 1072
1073 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker 1073 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
1074 1074
1075// qDebug("key pressed 2 is 0x%x",ke->key()); 1075// odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl;
1076 emitText("\\"); // expose 1076 emitText("\\"); // expose
1077 } else 1077 } else
1078 emit keyPressedSignal(ke); // expose 1078 emit keyPressedSignal(ke); // expose
1079 ke->accept(); 1079 ke->accept();
1080#ifdef FAKE_CTRL_AND_ALT 1080#ifdef FAKE_CTRL_AND_ALT
1081 if ( dele ) delete e; 1081 if ( dele ) delete e;
1082#endif 1082#endif
1083 return true; // stop the event 1083 return true; // stop the event
1084 } 1084 }
1085 if ( e->type() == QEvent::Enter ) { 1085 if ( e->type() == QEvent::Enter ) {
1086 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), 1086 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
1087 this, SLOT(onClearSelection()) ); 1087 this, SLOT(onClearSelection()) );
1088 } 1088 }
1089 if ( e->type() == QEvent::Leave ) { 1089 if ( e->type() == QEvent::Leave ) {
1090 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 1090 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
1091 this, SLOT(onClearSelection()) ); 1091 this, SLOT(onClearSelection()) );
1092 } 1092 }
1093 return QFrame::eventFilter( obj, e ); 1093 return QFrame::eventFilter( obj, e );
1094} 1094}
1095 1095
1096/* ------------------------------------------------------------------------- */ 1096/* ------------------------------------------------------------------------- */
1097/* */ 1097/* */
1098/* Frame */ 1098/* Frame */
1099/* */ 1099/* */