summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/TEWidget.cpp
Unidiff
Diffstat (limited to 'core/apps/embeddedkonsole/TEWidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index 93348f4..3cb1c0a 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -920,49 +920,49 @@ int TEWidget::charClass(char ch) const
920 920
921 // Everything else is weird 921 // Everything else is weird
922 return 1; 922 return 1;
923} 923}
924 924
925void TEWidget::setMouseMarks(bool on) 925void TEWidget::setMouseMarks(bool on)
926{ 926{
927 mouse_marks = on; 927 mouse_marks = on;
928 setCursor( mouse_marks ? ibeamCursor : arrowCursor ); 928 setCursor( mouse_marks ? ibeamCursor : arrowCursor );
929} 929}
930 930
931/* ------------------------------------------------------------------------- */ 931/* ------------------------------------------------------------------------- */
932/* */ 932/* */
933/* Clipboard */ 933/* Clipboard */
934/* */ 934/* */
935/* ------------------------------------------------------------------------- */ 935/* ------------------------------------------------------------------------- */
936 936
937#undef KeyPress 937#undef KeyPress
938 938
939void TEWidget::emitSelection() 939void TEWidget::emitSelection()
940// Paste Clipboard by simulating keypress events 940// Paste Clipboard by simulating keypress events
941{ 941{
942#ifndef QT_NO_CLIPBOARD 942#ifndef QT_NO_CLIPBOARD
943 QString text = QApplication::clipboard()->text(); 943 QString text = QApplication::clipboard()->text();
944 //qDebug(text); 944 //odebug << text << oendl;
945 if ( ! text.isNull()) 945 if ( ! text.isNull())
946 { 946 {
947 text.replace(QRegExp("\n"), "\r"); 947 text.replace(QRegExp("\n"), "\r");
948 QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); 948 QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text);
949 emit keyPressedSignal(&e); // expose as a big fat keypress event 949 emit keyPressedSignal(&e); // expose as a big fat keypress event
950 emit clearSelectionSignal(); 950 emit clearSelectionSignal();
951 } 951 }
952#endif 952#endif
953} 953}
954 954
955void TEWidget::emitText(QString text) 955void TEWidget::emitText(QString text)
956{ 956{
957 QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); 957 QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text);
958 emit keyPressedSignal(&e); // expose as a big fat keypress event 958 emit keyPressedSignal(&e); // expose as a big fat keypress event
959} 959}
960 960
961void TEWidget::pasteClipboard( ) 961void TEWidget::pasteClipboard( )
962{ 962{
963 emitSelection(); 963 emitSelection();
964} 964}
965 965
966void TEWidget::setSelection(const QString& t) 966void TEWidget::setSelection(const QString& t)
967{ 967{
968#ifndef QT_NO_CLIPBOARD 968#ifndef QT_NO_CLIPBOARD
@@ -1007,88 +1007,88 @@ void TEWidget::doScroll(int lines)
1007{ 1007{
1008 scrollbar->setValue(scrollbar->value()+lines); 1008 scrollbar->setValue(scrollbar->value()+lines);
1009} 1009}
1010 1010
1011void TEWidget::doHScroll(int lines) { 1011void TEWidget::doHScroll(int lines) {
1012 hScrollbar->setValue( hScrollbar->value()+lines); 1012 hScrollbar->setValue( hScrollbar->value()+lines);
1013} 1013}
1014 1014
1015bool TEWidget::eventFilter( QObject *obj, QEvent *e ) 1015bool TEWidget::eventFilter( QObject *obj, QEvent *e )
1016{ 1016{
1017 if ( (e->type() == QEvent::Accel || 1017 if ( (e->type() == QEvent::Accel ||
1018 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { 1018 e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
1019 static_cast<QKeyEvent *>( e )->ignore(); 1019 static_cast<QKeyEvent *>( e )->ignore();
1020 return true; 1020 return true;
1021 } 1021 }
1022 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) 1022 if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
1023 return FALSE; // not us 1023 return FALSE; // not us
1024 if ( e->type() == QEvent::Wheel) { 1024 if ( e->type() == QEvent::Wheel) {
1025 QApplication::sendEvent(scrollbar, e); 1025 QApplication::sendEvent(scrollbar, e);
1026 } 1026 }
1027 1027
1028#ifdef FAKE_CTRL_AND_ALT 1028#ifdef FAKE_CTRL_AND_ALT
1029 static bool control = FALSE; 1029 static bool control = FALSE;
1030 static bool alt = FALSE; 1030 static bool alt = FALSE;
1031// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); 1031// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
1032 bool dele=FALSE; 1032 bool dele=FALSE;
1033 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 1033 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1034 QKeyEvent* ke = (QKeyEvent*)e; 1034 QKeyEvent* ke = (QKeyEvent*)e;
1035 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 1035 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
1036 switch (ke->key()) { 1036 switch (ke->key()) {
1037 case Key_F9: // let this be "Control" 1037 case Key_F9: // let this be "Control"
1038 control = keydown; 1038 control = keydown;
1039 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 1039 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
1040 dele=TRUE; 1040 dele=TRUE;
1041 break; 1041 break;
1042 case Key_F13: // let this be "Alt" 1042 case Key_F13: // let this be "Alt"
1043 alt = keydown; 1043 alt = keydown;
1044 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); 1044 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
1045 dele=TRUE; 1045 dele=TRUE;
1046 break; 1046 break;
1047 default: 1047 default:
1048 if ( control ) { 1048 if ( control ) {
1049 int a = toupper(ke->ascii())-64; 1049 int a = toupper(ke->ascii())-64;
1050 if ( a >= 0 && a < ' ' ) { 1050 if ( a >= 0 && a < ' ' ) {
1051 e = new QKeyEvent(e->type(), ke->key(), 1051 e = new QKeyEvent(e->type(), ke->key(),
1052 a, ke->state()|ControlButton, QChar(a,0)); 1052 a, ke->state()|ControlButton, QChar(a,0));
1053 dele=TRUE; 1053 dele=TRUE;
1054 } 1054 }
1055 } 1055 }
1056 if ( alt ) { 1056 if ( alt ) {
1057 e = new QKeyEvent(e->type(), ke->key(), 1057 e = new QKeyEvent(e->type(), ke->key(),
1058 ke->ascii(), ke->state()|AltButton, ke->text()); 1058 ke->ascii(), ke->state()|AltButton, ke->text());
1059 dele=TRUE; 1059 dele=TRUE;
1060 } 1060 }
1061 } 1061 }
1062 } 1062 }
1063#endif 1063#endif
1064 1064
1065 if ( e->type() == QEvent::KeyPress ) { 1065 if ( e->type() == QEvent::KeyPress ) {
1066 QKeyEvent* ke = (QKeyEvent*)e; 1066 QKeyEvent* ke = (QKeyEvent*)e;
1067 actSel=0; // Key stroke implies a screen update, so TEWidget won't 1067 actSel=0; // Key stroke implies a screen update, so TEWidget won't
1068 // know where the current selection is. 1068 // know where the current selection is.
1069 1069
1070// qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); 1070// odebug << "key pressed is 0x" << ke->key() << ", ascii is 0x" << ke->ascii() << ", state " << ke->state() << "" << oendl;
1071 1071
1072 bool special_function = true; 1072 bool special_function = true;
1073 switch(ke->key()) { 1073 switch(ke->key()) {
1074 //case 0x201b: // fn-5 1074 //case 0x201b: // fn-5
1075 //case Key_F1: 1075 //case Key_F1:
1076 // switch sessions (?) 1076 // switch sessions (?)
1077 // emitText("\\"); // expose (??) 1077 // emitText("\\"); // expose (??)
1078 // break; 1078 // break;
1079 1079
1080 case 0x2016: // fn-p 1080 case 0x2016: // fn-p
1081 case Key_F2: 1081 case Key_F2:
1082 pasteClipboard(); 1082 pasteClipboard();
1083 break; 1083 break;
1084 1084
1085 case 0x2018: // fn-S 1085 case 0x2018: // fn-S
1086 case Key_F3: 1086 case Key_F3:
1087 emit changeSession(1); 1087 emit changeSession(1);
1088 break; 1088 break;
1089 1089
1090 case 0x2019: // fn-n 1090 case 0x2019: // fn-n
1091 emit newSession(); 1091 emit newSession();
1092 break; 1092 break;
1093 1093
1094 case Qt::Key_Tab: 1094 case Qt::Key_Tab: