author | llornkcor <llornkcor> | 2003-02-17 00:56:19 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-17 00:56:19 (UTC) |
commit | 0c50793d0ef839e90b9b2dea5001c3170971fc06 (patch) (unidiff) | |
tree | 7cb670b64059524eab1130212ba1c43ebed66720 | |
parent | 4d0e8ffd8518fe24ed94cfcf92eeff666b014094 (diff) | |
download | opie-0c50793d0ef839e90b9b2dea5001c3170971fc06.zip opie-0c50793d0ef839e90b9b2dea5001c3170971fc06.tar.gz opie-0c50793d0ef839e90b9b2dea5001c3170971fc06.tar.bz2 |
fixes bug 671 - clipboard copy causes new line
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index 23720cd..a989e10 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -918,33 +918,34 @@ void TEWidget::setMouseMarks(bool on) | |||
918 | setCursor( mouse_marks ? ibeamCursor : arrowCursor ); | 918 | setCursor( mouse_marks ? ibeamCursor : arrowCursor ); |
919 | } | 919 | } |
920 | 920 | ||
921 | /* ------------------------------------------------------------------------- */ | 921 | /* ------------------------------------------------------------------------- */ |
922 | /* */ | 922 | /* */ |
923 | /* Clipboard */ | 923 | /* Clipboard */ |
924 | /* */ | 924 | /* */ |
925 | /* ------------------------------------------------------------------------- */ | 925 | /* ------------------------------------------------------------------------- */ |
926 | 926 | ||
927 | #undef KeyPress | 927 | #undef KeyPress |
928 | 928 | ||
929 | void TEWidget::emitSelection() | 929 | void TEWidget::emitSelection() |
930 | // Paste Clipboard by simulating keypress events | 930 | // Paste Clipboard by simulating keypress events |
931 | { | 931 | { |
932 | #ifndef QT_NO_CLIPBOARD | 932 | #ifndef QT_NO_CLIPBOARD |
933 | QString text = QApplication::clipboard()->text(); | 933 | QString text = QApplication::clipboard()->text(); |
934 | if ( ! text.isNull() ) | 934 | //qDebug(text); |
935 | if ( ! text.isNull()) | ||
935 | { | 936 | { |
936 | text.replace(QRegExp("\n"), "\r"); | 937 | text.replace(QRegExp("\n"), "\r"); |
937 | QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); | 938 | QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); |
938 | emit keyPressedSignal(&e); // expose as a big fat keypress event | 939 | emit keyPressedSignal(&e); // expose as a big fat keypress event |
939 | emit clearSelectionSignal(); | 940 | emit clearSelectionSignal(); |
940 | } | 941 | } |
941 | #endif | 942 | #endif |
942 | } | 943 | } |
943 | 944 | ||
944 | void TEWidget::emitText(QString text) | 945 | void TEWidget::emitText(QString text) |
945 | { | 946 | { |
946 | QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); | 947 | QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text); |
947 | emit keyPressedSignal(&e); // expose as a big fat keypress event | 948 | emit keyPressedSignal(&e); // expose as a big fat keypress event |
948 | } | 949 | } |
949 | 950 | ||
950 | void TEWidget::pasteClipboard( ) | 951 | void TEWidget::pasteClipboard( ) |
@@ -1054,32 +1055,35 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1054 | if ( e->type() == QEvent::KeyPress ) { | 1055 | if ( e->type() == QEvent::KeyPress ) { |
1055 | QKeyEvent* ke = (QKeyEvent*)e; | 1056 | QKeyEvent* ke = (QKeyEvent*)e; |
1056 | actSel=0; // Key stroke implies a screen update, so TEWidget won't | 1057 | actSel=0; // Key stroke implies a screen update, so TEWidget won't |
1057 | // know where the current selection is. | 1058 | // know where the current selection is. |
1058 | 1059 | ||
1059 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); | 1060 | // qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); |
1060 | 1061 | ||
1061 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { | 1062 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { |
1062 | //lets hardcode this sucker | 1063 | //lets hardcode this sucker |
1063 | 1064 | ||
1064 | // qDebug("key pressed 2 is 0x%x", ke->key()); | 1065 | // qDebug("key pressed 2 is 0x%x", ke->key()); |
1065 | emitText("\\"); // expose | 1066 | emitText("\\"); // expose |
1066 | } | 1067 | } |
1067 | else if( ke->state() == ControlButton && ke->key() == Key_V) { | 1068 | else if( ke->state() == ControlButton && ke->key() == Key_V) { |
1068 | pasteClipboard(); | 1069 | pasteClipboard(); |
1069 | } | 1070 | } |
1071 | else if( ke->state() == ControlButton && ke->key() == Key_C) { | ||
1072 | // pasteClipboard(); | ||
1073 | } | ||
1070 | else | 1074 | else |
1071 | emit keyPressedSignal(ke); // expose | 1075 | emit keyPressedSignal(ke); // expose |
1072 | ke->accept(); | 1076 | ke->accept(); |
1073 | #ifdef FAKE_CTRL_AND_ALT | 1077 | #ifdef FAKE_CTRL_AND_ALT |
1074 | if ( dele ) delete e; | 1078 | if ( dele ) delete e; |
1075 | #endif | 1079 | #endif |
1076 | return true; // stop the event | 1080 | return true; // stop the event |
1077 | } | 1081 | } |
1078 | if ( e->type() == QEvent::Enter ) { | 1082 | if ( e->type() == QEvent::Enter ) { |
1079 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), | 1083 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), |
1080 | this, SLOT(onClearSelection()) ); | 1084 | this, SLOT(onClearSelection()) ); |
1081 | } | 1085 | } |
1082 | if ( e->type() == QEvent::Leave ) { | 1086 | if ( e->type() == QEvent::Leave ) { |
1083 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), | 1087 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), |
1084 | this, SLOT(onClearSelection()) ); | 1088 | this, SLOT(onClearSelection()) ); |
1085 | } | 1089 | } |