1 /****************************************************************************
3 ** Copyright (C) 2007-2008 Urs Wolfer <uwolfer @ kde.org>
5 ** This file is part of KDE.
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; see the file COPYING. If not, write to
19 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ** Boston, MA 02110-1301, USA.
22 ****************************************************************************/
26 #include <QMessageBox>
27 #include <QInputDialog>
28 #define KMessageBox QMessageBox
29 #define error(parent, message, caption) \
30 critical(parent, caption, message)
32 #include <QApplication>
37 #include <QHBoxLayout>
38 #include <QVBoxLayout>
40 #include <QMouseEvent>
41 #include <QPushButton>
48 // Definition of key modifier mask constants
49 #define KMOD_Alt_R 0x01
50 #define KMOD_Alt_L 0x02
51 #define KMOD_Meta_L 0x04
52 #define KMOD_Control_L 0x08
53 #define KMOD_Shift_L 0x10
55 //local cursor width/height in px, should be an odd number
56 const int CURSOR_SIZE = 7;
58 const int TAP_PRESS_TIME = 180;
59 const int DOUBLE_TAP_UP_TIME = 500;
62 VncView::VncView(QWidget *parent, const KUrl &url, RemoteView::Quality quality, int listen_port)
70 m_firstPasswordTry(true),
71 m_dontSendClipboard(false),
72 m_horizontalFactor(1.0),
73 m_verticalFactor(1.0),
74 m_forceLocalCursor(false),
75 force_full_repaint(false),
77 listen_port(listen_port)
83 //BlockingQueuedConnection can cause deadlocks when exiting, handled in startQuitting()
84 connect(&vncThread, SIGNAL(imageUpdated(int, int, int, int)), this, SLOT(updateImage(int, int, int, int)), Qt::BlockingQueuedConnection);
85 connect(&vncThread, SIGNAL(gotCut(const QString&)), this, SLOT(setCut(const QString&)), Qt::BlockingQueuedConnection);
86 connect(&vncThread, SIGNAL(passwordRequest()), this, SLOT(requestPassword()), Qt::BlockingQueuedConnection);
87 connect(&vncThread, SIGNAL(outputErrorMessage(QString)), this, SLOT(outputErrorMessage(QString)));
89 //don't miss early connection failures
90 connect(&vncThread, SIGNAL(finished()), this, SLOT(startQuitting()));
92 m_clipboard = QApplication::clipboard();
93 connect(m_clipboard, SIGNAL(selectionChanged()), this, SLOT(clipboardSelectionChanged()));
94 connect(m_clipboard, SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
103 // Disconnect all signals so that we don't get any more callbacks from the client thread
104 vncThread.disconnect();
109 void VncView::forceFullRepaint()
111 force_full_repaint = true;
115 bool VncView::eventFilter(QObject *obj, QEvent *event)
118 if (event->type() == QEvent::KeyPress ||
119 event->type() == QEvent::KeyRelease ||
120 event->type() == QEvent::MouseButtonDblClick ||
121 event->type() == QEvent::MouseButtonPress ||
122 event->type() == QEvent::MouseButtonRelease ||
123 event->type() == QEvent::Wheel ||
124 event->type() == QEvent::MouseMove)
127 return RemoteView::eventFilter(obj, event);
130 QSize VncView::framebufferSize()
132 return m_frame.size();
135 QSize VncView::sizeHint() const
140 QSize VncView::minimumSizeHint() const
145 void VncView::startQuitting()
150 kDebug(5011) << "about to quit";
152 //const bool connected = status() == RemoteView::Connected;
154 setStatus(Disconnecting);
158 //if(connected) //remove if things work without it
161 const bool quitSuccess = vncThread.wait(700);
163 //happens when vncThread wants to call a slot via BlockingQueuedConnection,
164 //needs an event loop in this thread so execution continues after 'emit'
166 if(!loop.processEvents())
167 kDebug(5011) << "BUG: deadlocked, but no events to deliver?";
170 setStatus(Disconnected);
173 bool VncView::isQuitting()
178 bool VncView::start()
180 vncThread.setHost(m_host);
181 vncThread.setPort(m_port);
182 vncThread.setListenPort(listen_port); //if port is != 0, thread will listen for connections
183 vncThread.setQuality(quality);
185 // set local cursor on by default because low quality mostly means slow internet connection
186 if (quality == RemoteView::Low) {
187 showDotCursor(RemoteView::CursorOn);
190 setStatus(Connecting);
196 bool VncView::supportsScaling() const
201 bool VncView::supportsLocalCursor() const
206 void VncView::requestPassword()
208 kDebug(5011) << "request password";
210 setStatus(Authenticating);
212 if (!m_url.password().isNull()) {
213 vncThread.setPassword(m_url.password());
218 settings.beginGroup("hosts");
219 QString password = settings.value(QString("%1/password").arg(m_host), "").toString();
220 //check for saved password
221 if(m_firstPasswordTry and !password.isEmpty()) {
222 kDebug(5011) << "Trying saved password";
223 m_firstPasswordTry = false;
224 vncThread.setPassword(password);
227 m_firstPasswordTry = false;
230 QDialog dialog(this);
231 dialog.setWindowTitle(tr("Password required"));
233 QLineEdit passwordbox;
234 passwordbox.setEchoMode(QLineEdit::Password);
235 passwordbox.setText(password);
236 QCheckBox save_password(tr("Save Password"));
237 save_password.setChecked(!password.isEmpty()); //offer to overwrite saved password
238 QPushButton ok_button(tr("Done"));
239 ok_button.setMaximumWidth(100);
240 connect(&ok_button, SIGNAL(clicked()),
241 &dialog, SLOT(accept()));
245 layout2.addWidget(&passwordbox);
246 if(!m_host.isEmpty()) //don't save incomming connections
247 layout2.addWidget(&save_password);
248 layout1.addLayout(&layout2);
249 layout1.addWidget(&ok_button);
250 dialog.setLayout(&layout1);
252 if(dialog.exec()) { //dialog accepted
253 password = passwordbox.text();
255 if(!m_host.isEmpty() and save_password.isChecked()) {
256 kDebug(5011) << "Saving password for host '" << m_host << "'";
258 settings.setValue(QString("%1/password").arg(m_host), password);
262 vncThread.setPassword(password);
264 vncThread.setPassword(QString()); //null string to exit
268 void VncView::outputErrorMessage(const QString &message)
270 if (message == "INTERNAL:APPLE_VNC_COMPATIBILTY") {
271 setCursor(localDotCursor());
272 m_forceLocalCursor = true;
278 emit errorMessage(i18n("VNC failure"), message);
281 void VncView::updateImage(int x, int y, int w, int h)
283 if(!QApplication::focusWidget()) { //no focus, we're probably minimized
287 //kDebug(5011) << "got update" << width() << height();
294 if (m_horizontalFactor != 1.0 || m_verticalFactor != 1.0) {
295 // If the view is scaled, grow the update rectangle to avoid artifacts
296 int x_extrapixels = 1.0/m_horizontalFactor + 1;
297 int y_extrapixels = 1.0/m_verticalFactor + 1;
301 m_w+=2*x_extrapixels;
302 m_h+=2*y_extrapixels;
305 m_frame = vncThread.image();
307 if (!m_initDone) { //TODO this seems an odd place for initialization
308 setAttribute(Qt::WA_StaticContents);
309 setAttribute(Qt::WA_OpaquePaintEvent);
310 installEventFilter(this);
312 setCursor(((m_dotCursorState == CursorOn) || m_forceLocalCursor) ? localDotCursor() : Qt::BlankCursor);
314 setMouseTracking(true); // get mouse events even when there is no mousebutton pressed
315 setFocusPolicy(Qt::WheelFocus);
316 setStatus(Connected);
317 // emit framebufferSizeChanged(m_frame.width(), m_frame.height());
320 resize(width(), height());
326 static QSize old_frame_size = QSize();
327 if ((y == 0 && x == 0) && (m_frame.size() != old_frame_size)) {
328 old_frame_size = m_frame.size();
329 kDebug(5011) << "Updating framebuffer size";
331 emit framebufferSizeChanged(m_frame.width(), m_frame.height());
335 repaint(qRound(m_x * m_horizontalFactor), qRound(m_y * m_verticalFactor), qRound(m_w * m_horizontalFactor), qRound(m_h * m_verticalFactor));
339 void VncView::setViewOnly(bool viewOnly)
341 RemoteView::setViewOnly(viewOnly);
343 m_dontSendClipboard = viewOnly;
346 setCursor(Qt::ArrowCursor);
348 setCursor(m_dotCursorState == CursorOn ? localDotCursor() : Qt::BlankCursor);
351 void VncView::showDotCursor(DotCursorState state)
353 RemoteView::showDotCursor(state);
355 setCursor(state == CursorOn ? localDotCursor() : Qt::BlankCursor);
358 //level should be in [0, 100]
359 void VncView::setZoomLevel(int level)
361 Q_ASSERT(parentWidget() != 0);
363 if(level == -1) { //handle resize
364 resize(m_frame.width()*m_horizontalFactor, m_frame.height()*m_verticalFactor);
368 double magnification;
371 } else if(level >= 90) {
374 const double min_horiz_magnification = double(parentWidget()->width())/m_frame.width();
375 const double min_vert_magnification = double(parentWidget()->height())/m_frame.height();
376 const double fit_screen_magnification = qMin(min_horiz_magnification, min_vert_magnification);
378 //level=90 => magnification=1.0, level=0 => magnification=fit_screen_magnification
379 magnification = (level)/90.0*(1.0 - fit_screen_magnification) + fit_screen_magnification;
382 if(magnification < 0 //remote display smaller than local?
383 or magnification != magnification) //nan
386 m_verticalFactor = m_horizontalFactor = magnification;
387 resize(m_frame.width()*magnification, m_frame.height()*magnification);
390 void VncView::setCut(const QString &text)
392 m_dontSendClipboard = true;
393 m_clipboard->setText(text, QClipboard::Clipboard);
394 m_clipboard->setText(text, QClipboard::Selection);
395 m_dontSendClipboard = false;
398 void VncView::paintEvent(QPaintEvent *event)
400 //kDebug(5011) << "paint event: x: " << m_x << ", y: " << m_y << ", w: " << m_w << ", h: " << m_h;
401 if (m_frame.isNull() || m_frame.format() == QImage::Format_Invalid) {
402 kDebug(5011) << "no valid image to paint";
403 RemoteView::paintEvent(event);
409 QPainter painter(this);
411 Qt::TransformationMode transformation_mode = Qt::SmoothTransformation;
412 if( m_horizontalFactor >= 1.0 )
413 transformation_mode = Qt::FastTransformation;
415 //TODO: seems to have no purpose, remove
416 if (false and m_repaint and !force_full_repaint) {
417 // kDebug(5011) << "normal repaint";
418 painter.drawImage(QRect(qRound(m_x*m_horizontalFactor), qRound(m_y*m_verticalFactor),
419 qRound(m_w*m_horizontalFactor), qRound(m_h*m_verticalFactor)),
420 m_frame.copy(m_x, m_y, m_w, m_h).scaled(qRound(m_w*m_horizontalFactor),
421 qRound(m_h*m_verticalFactor),
422 Qt::IgnoreAspectRatio, transformation_mode));
424 //kDebug(5011) << "resize repaint";
425 const QRect rect = event->rect();
426 if (!force_full_repaint and (rect.width() != width() || rect.height() != height())) {
427 // kDebug(5011) << "Partial repaint";
428 const int sx = rect.x()/m_horizontalFactor;
429 const int sy = rect.y()/m_verticalFactor;
430 const int sw = rect.width()/m_horizontalFactor;
431 const int sh = rect.height()/m_verticalFactor;
432 painter.drawImage(rect,
433 m_frame.copy(sx, sy, sw, sh).scaled(rect.width(), rect.height(),
434 Qt::IgnoreAspectRatio, transformation_mode));
436 kDebug(5011) << "Full repaint" << width() << height() << m_frame.width() << m_frame.height();
437 painter.drawImage(QRect(0, 0, width(), height()),
438 m_frame.scaled(m_frame.width() * m_horizontalFactor, m_frame.height() * m_verticalFactor,
439 Qt::IgnoreAspectRatio, transformation_mode));
440 force_full_repaint = false;
444 //draw local cursor ourselves, normal mouse pointer doesn't deal with scrolling
445 if((m_dotCursorState == CursorOn) || m_forceLocalCursor) {
446 #if QT_VERSION >= 0x040500
447 painter.setCompositionMode(QPainter::RasterOp_SourceXorDestination);
449 //rectangle size includes 1px pen width
450 painter.drawRect(cursor_x*m_horizontalFactor - CURSOR_SIZE/2, cursor_y*m_verticalFactor - CURSOR_SIZE/2, CURSOR_SIZE-1, CURSOR_SIZE-1);
453 RemoteView::paintEvent(event);
456 void VncView::resizeEvent(QResizeEvent *event)
458 RemoteView::resizeEvent(event);
462 bool VncView::event(QEvent *event)
464 switch (event->type()) {
465 case QEvent::KeyPress:
466 case QEvent::KeyRelease:
467 // kDebug(5011) << "keyEvent";
468 keyEventHandler(static_cast<QKeyEvent*>(event));
471 case QEvent::MouseButtonDblClick:
472 case QEvent::MouseButtonPress:
473 case QEvent::MouseButtonRelease:
474 case QEvent::MouseMove:
475 // kDebug(5011) << "mouseEvent";
476 mouseEventHandler(static_cast<QMouseEvent*>(event));
480 // kDebug(5011) << "wheelEvent";
481 wheelEventHandler(static_cast<QWheelEvent*>(event));
484 case QEvent::WindowActivate: //input panel may have been closed, prevent IM from interfering with hardware keyboard
485 setAttribute(Qt::WA_InputMethodEnabled, false);
488 return RemoteView::event(event);
492 //call with e == 0 to flush held events
493 void VncView::mouseEventHandler(QMouseEvent *e)
495 static bool tap_detected = false;
496 static bool double_tap_detected = false;
497 static bool tap_drag_detected = false;
498 static QTime press_time;
499 static QTime up_time; //used for double clicks/tap&drag, for time after first tap
501 if(!e) { //flush held taps
503 m_buttonMask |= 0x01;
504 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
505 m_buttonMask &= 0xfe;
506 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
507 tap_detected = false;
508 } else if(double_tap_detected and press_time.elapsed() > TAP_PRESS_TIME) { //got tap + another press -> tap & drag
509 m_buttonMask |= 0x01;
510 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
511 double_tap_detected = false;
512 tap_drag_detected = true;
518 if(e->x() < 0 or e->y() < 0) { //QScrollArea tends to send invalid events sometimes...
523 cursor_x = qRound(e->x()/m_horizontalFactor);
524 cursor_y = qRound(e->y()/m_verticalFactor);
525 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask); // plain move event
527 if(!disable_tapping and e->button() == Qt::LeftButton) { //implement touchpad-like input for left button
528 if(e->type() == QEvent::MouseButtonPress or e->type() == QEvent::MouseButtonDblClick) {
530 if(tap_detected and up_time.elapsed() < DOUBLE_TAP_UP_TIME) {
531 tap_detected = false;
532 double_tap_detected = true;
534 QTimer::singleShot(TAP_PRESS_TIME, this, SLOT(mouseEventHandler()));
536 } else if(e->type() == QEvent::MouseButtonRelease) {
537 if(tap_drag_detected) {
538 m_buttonMask &= 0xfe;
539 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
540 tap_drag_detected = false;
541 } else if(double_tap_detected) { //double click
542 double_tap_detected = false;
544 m_buttonMask |= 0x01;
545 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
546 m_buttonMask &= 0xfe;
547 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
548 m_buttonMask |= 0x01;
549 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
550 m_buttonMask &= 0xfe;
551 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
552 } else if(press_time.elapsed() < TAP_PRESS_TIME) { //tap
555 QTimer::singleShot(DOUBLE_TAP_UP_TIME, this, SLOT(mouseEventHandler()));
559 } else { //middle or right button, send directly
560 if ((e->type() == QEvent::MouseButtonPress)) {
561 if (e->button() & Qt::MidButton)
562 m_buttonMask |= 0x02;
563 if (e->button() & Qt::RightButton)
564 m_buttonMask |= 0x04;
565 } else if (e->type() == QEvent::MouseButtonRelease) {
566 if (e->button() & Qt::MidButton)
567 m_buttonMask &= 0xfd;
568 if (e->button() & Qt::RightButton)
569 m_buttonMask &= 0xfb;
571 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
574 //prevent local cursor artifacts
575 static int old_cursor_x = cursor_x;
576 static int old_cursor_y = cursor_y;
577 if(((m_dotCursorState == CursorOn) || m_forceLocalCursor)
578 and (cursor_x != old_cursor_x or cursor_y != old_cursor_y)) {
579 //clear last position
580 repaint(old_cursor_x*m_horizontalFactor - CURSOR_SIZE/2, old_cursor_y*m_verticalFactor - CURSOR_SIZE/2, CURSOR_SIZE, CURSOR_SIZE);
581 //and refresh new one
582 repaint(cursor_x*m_horizontalFactor - CURSOR_SIZE/2, cursor_y*m_verticalFactor - CURSOR_SIZE/2, CURSOR_SIZE, CURSOR_SIZE);
584 old_cursor_x = cursor_x; old_cursor_y = cursor_y;
588 void VncView::wheelEventHandler(QWheelEvent *event)
591 if (event->delta() < 0)
596 const int x = qRound(event->x() / m_horizontalFactor);
597 const int y = qRound(event->y() / m_verticalFactor);
599 vncThread.mouseEvent(x, y, eb | m_buttonMask);
600 vncThread.mouseEvent(x, y, m_buttonMask);
603 void VncView::keyEventHandler(QKeyEvent *e)
605 // strip away autorepeating KeyRelease; see bug #206598
606 if (e->isAutoRepeat() && (e->type() == QEvent::KeyRelease)) {
610 // parts of this code are based on http://italc.sourcearchive.com/documentation/1.0.9.1/vncview_8cpp-source.html
611 rfbKeySym k = e->nativeVirtualKey();
613 // we do not handle Key_Backtab separately as the Shift-modifier
614 // is already enabled
615 if (e->key() == Qt::Key_Backtab) {
619 const bool pressed = (e->type() == QEvent::KeyPress);
622 //don't send ISO_Level3_Shift (would break things like Win+0-9)
623 //also enable IM so symbol key works
625 setAttribute(Qt::WA_InputMethodEnabled, pressed);
632 if (k == XK_Shift_L || k == XK_Control_L || k == XK_Meta_L || k == XK_Alt_L) {
635 } else if (m_mods.contains(k)) {
643 int current_zoom = -1;
644 if(e->key() == Qt::Key_F8)
645 current_zoom = left_zoom;
646 else if(e->key() == Qt::Key_F7)
647 current_zoom = right_zoom;
649 // kDebug(5011) << "got '" << e->text() << "'.";
650 vncThread.keyEvent(k, pressed);
652 kDebug(5011) << "nativeVirtualKey() for '" << e->text() << "' failed.";
656 if(current_zoom == -1)
659 //handle zoom buttons
660 if(current_zoom == 0) { //left click
662 m_buttonMask |= 0x01;
664 m_buttonMask &= 0xfe;
665 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
666 } else if(current_zoom == 1) { //right click
668 m_buttonMask |= 0x04;
670 m_buttonMask &= 0xfb;
671 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
672 } else if(current_zoom == 2) { //middle click
674 m_buttonMask |= 0x02;
676 m_buttonMask &= 0xfd;
677 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
678 } else if(current_zoom == 3 and pressed) { //wheel up
680 vncThread.mouseEvent(cursor_x, cursor_y, eb | m_buttonMask);
681 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
682 } else if(current_zoom == 4 and pressed) { //wheel down
684 vncThread.mouseEvent(cursor_x, cursor_y, eb | m_buttonMask);
685 vncThread.mouseEvent(cursor_x, cursor_y, m_buttonMask);
686 } else if(current_zoom == 5) { //page up
687 vncThread.keyEvent(0xff55, pressed);
688 } else if(current_zoom == 6) { //page down
689 vncThread.keyEvent(0xff56, pressed);
693 void VncView::unpressModifiers()
695 const QList<unsigned int> keys = m_mods.keys();
696 QList<unsigned int>::const_iterator it = keys.constBegin();
697 while (it != keys.end()) {
698 vncThread.keyEvent(*it, false);
704 void VncView::clipboardSelectionChanged()
706 if (m_status != Connected)
709 if (m_clipboard->ownsSelection() || m_dontSendClipboard)
712 const QString text = m_clipboard->text(QClipboard::Selection);
714 vncThread.clientCut(text);
717 void VncView::clipboardDataChanged()
719 if (m_status != Connected)
722 if (m_clipboard->ownsClipboard() || m_dontSendClipboard)
725 const QString text = m_clipboard->text(QClipboard::Clipboard);
727 vncThread.clientCut(text);
731 void VncView::sendKey(Qt::Key key)
733 //convert Qt::Key into x11 keysym
745 case Qt::Key_PageDown:
763 case Qt::Key_Backspace:
778 k = 0xffbe + int(key - Qt::Key_F1);
790 case Qt::MetaModifier:
794 case Qt::AltModifier:
797 case Qt::Key_Control:
798 case Qt::ControlModifier:
802 kDebug(5011) << "sendKey(): Unhandled Qt::Key value " << key;
806 if (k == XK_Shift_L || k == XK_Control_L || k == XK_Meta_L || k == XK_Alt_L || k == XK_Super_L) {
807 if (m_mods.contains(k)) { //release
809 vncThread.keyEvent(k, false);
812 vncThread.keyEvent(k, true);
814 } else { //normal key
815 vncThread.keyEvent(k, true);
816 vncThread.keyEvent(k, false);
820 void VncView::sendKeySequence(QKeySequence keys)
822 Q_ASSERT(keys.count() <= 1); //we can only handle a single combination
824 //to get at individual key presses, we split 'keys' into its components
828 QString k = keys.toString().section('+', pos, pos);
832 //kDebug(5011) << "found key: " << k;
834 key_list.append(Qt::Key_Alt);
835 } else if(k == "Ctrl") {
836 key_list.append(Qt::Key_Control);
837 } else if(k == "Meta") {
838 key_list.append(Qt::Key_Meta);
840 key_list.append(QKeySequence(k)[0]);
846 for(int i = 0; i < key_list.count(); i++)
847 sendKey(Qt::Key(key_list.at(i)));
849 //release modifiers (everything before final key)
850 for(int i = key_list.count()-2; i >= 0; i--)
851 sendKey(Qt::Key(key_list.at(i)));
854 void VncView::reloadSettings()
857 left_zoom = settings.value("left_zoom", 0).toInt();
858 right_zoom = settings.value("right_zoom", 1).toInt();
859 disable_tapping = settings.value("disable_tapping", false).toBool();
861 bool always_show_local_cursor = settings.value("always_show_local_cursor", false).toBool();
862 if(always_show_local_cursor)
863 showDotCursor(CursorOn);
868 //convert commitString into keyevents
869 void VncView::inputMethodEvent(QInputMethodEvent *event)
871 //TODO handle replacements
872 //NOTE for the return key to work Qt needs to enable multiline input, which only works for Q(Plain)TextEdit
874 //kDebug(5011) << event->commitString() << "|" << event->preeditString() << "|" << event->replacementLength() << "|" << event->replacementStart();
875 QString letters = event->commitString();
876 for(int i = 0; i < letters.length(); i++) {
877 char k = letters.at(i).toLatin1(); //works with all 'normal' keys, not umlauts.
879 kDebug(5011) << "unhandled key";
882 vncThread.keyEvent(k, true);
883 vncThread.keyEvent(k, false);
888 #include "moc_vncview.cpp"