summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/widget.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/widget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/widget.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/widget.cpp b/noncore/apps/opie-console/widget.cpp
index e17dfd4..c51983f 100644
--- a/noncore/apps/opie-console/widget.cpp
+++ b/noncore/apps/opie-console/widget.cpp
@@ -974,92 +974,92 @@ void Widget::onClearSelection()
974// For auto-hide, we need to get keypress-events, but we only get them when 974// For auto-hide, we need to get keypress-events, but we only get them when
975// we have focus. 975// we have focus.
976 976
977void Widget::doScroll(int lines) 977void Widget::doScroll(int lines)
978{ 978{
979 scrollbar->setValue(scrollbar->value()+lines); 979 scrollbar->setValue(scrollbar->value()+lines);
980} 980}
981 981
982bool Widget::eventFilter( QObject *obj, QEvent *e ) 982bool Widget::eventFilter( QObject *obj, QEvent *e )
983{ 983{
984 if ( (e->type() == QEvent::Accel || 984 if ( (e->type() == QEvent::Accel ||
985 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { 985 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
986 static_cast<QKeyEvent *>( e )->ignore(); 986 static_cast<QKeyEvent *>( e )->ignore();
987 return true; 987 return true;
988 } 988 }
989 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 989 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
990 return FALSE; // not us 990 return FALSE; // not us
991 if ( e->type() == QEvent::Wheel) { 991 if ( e->type() == QEvent::Wheel) {
992 QApplication::sendEvent(scrollbar, e); 992 QApplication::sendEvent(scrollbar, e);
993 } 993 }
994 994
995#ifdef FAKE_CTRL_AND_ALT 995#ifdef FAKE_CTRL_AND_ALT
996 static bool control = FALSE; 996 static bool control = FALSE;
997 static bool alt = FALSE; 997 static bool alt = FALSE;
998// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); 998// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
999 bool dele=FALSE; 999 bool dele=FALSE;
1000 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 1000 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1001 QKeyEvent* ke = (QKeyEvent*)e; 1001 QKeyEvent* ke = (QKeyEvent*)e;
1002 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 1002 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
1003 switch (ke->key()) { 1003 switch (ke->key()) {
1004 case Key_F9: // let this be "Control" 1004 case Key_F9: // let this be "Control"
1005 control = keydown; 1005 control = keydown;
1006 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 1006 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
1007 dele=TRUE; 1007 dele=TRUE;
1008 break; 1008 break;
1009 case Key_F13: // let this be "Alt" 1009 case Key_F13: // let this be "Alt"
1010 alt = keydown; 1010 alt = keydown;
1011 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); 1011 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
1012 dele=TRUE; 1012 dele=TRUE;
1013 break; 1013 break;
1014 default: 1014 default:
1015 if ( control ) { 1015 if ( control ) {
1016 int a = toupper(ke->ascii())-64; 1016 int a = toupper(ke->ascii())-64;
1017 if ( a >= 0 && a < ' ' ) { 1017 if ( a >= 0 && a < ' ' ) {
1018 e = new QKeyEvent(e->type(), ke->key(), 1018 e = new QKeyEvent(e->type(), ke->key(),
1019 a, ke->state()|ControlButton, QChar(a,0)); 1019 a, ke->state()|ControlButton, QChar(a,0));
1020 dele=TRUE; 1020 dele=TRUE;
1021 } 1021 }
1022 } 1022 }
1023 if ( alt ) { 1023 if ( alt ) {
1024 e = new QKeyEvent(e->type(), ke->key(), 1024 e = new QKeyEvent(e->type(), ke->key(),
1025 ke->ascii(), ke->state()|AltButton, ke->text()); 1025 ke->ascii(), ke->state()|AltButton, ke->text());
1026 dele=TRUE; 1026 dele=TRUE;
1027 } 1027 }
1028 } 1028 }
1029 } 1029 }
1030#endif 1030#endif
1031 1031
1032 if ( e->type() == QEvent::KeyPress ) { 1032 if ( e->type() == QEvent::KeyPress ) {
1033 QKeyEvent* ke = (QKeyEvent*)e; 1033 QKeyEvent* ke = (QKeyEvent*)e;
1034 actSel=0; // Key stroke implies a screen update, so Widget won't 1034 actSel=0; // Key stroke implies a screen update, so Widget won't
1035 // know where the current selection is. 1035 // know where the current selection is.
1036 1036
1037// qDebug("key pressed is 0x%x",ke->key()); 1037// odebug << "key pressed is 0x" << ke->key() << "" << oendl;
1038 1038
1039 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker 1039 if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker
1040 1040
1041// qDebug("key pressed 2 is 0x%x",ke->key()); 1041// odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl;
1042 emitText("\\"); // expose 1042 emitText("\\"); // expose
1043 } else 1043 } else
1044 emit keyPressedSignal(ke); // expose 1044 emit keyPressedSignal(ke); // expose
1045 ke->accept(); 1045 ke->accept();
1046#ifdef FAKE_CTRL_AND_ALT 1046#ifdef FAKE_CTRL_AND_ALT
1047 if ( dele ) delete e; 1047 if ( dele ) delete e;
1048#endif 1048#endif
1049 return true; // stop the event 1049 return true; // stop the event
1050 } 1050 }
1051 if ( e->type() == QEvent::Enter ) { 1051 if ( e->type() == QEvent::Enter ) {
1052 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), 1052 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
1053 this, SLOT(onClearSelection()) ); 1053 this, SLOT(onClearSelection()) );
1054 } 1054 }
1055 if ( e->type() == QEvent::Leave ) { 1055 if ( e->type() == QEvent::Leave ) {
1056 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 1056 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
1057 this, SLOT(onClearSelection()) ); 1057 this, SLOT(onClearSelection()) );
1058 } 1058 }
1059 return QFrame::eventFilter( obj, e ); 1059 return QFrame::eventFilter( obj, e );
1060} 1060}
1061 1061
1062/* ------------------------------------------------------------------------- */ 1062/* ------------------------------------------------------------------------- */
1063/* */ 1063/* */
1064/* Frame */ 1064/* Frame */
1065/* */ 1065/* */