From kde-commits Tue Nov 03 00:49:06 2009 From: Dawit Alemayehu Date: Tue, 03 Nov 2009 00:49:06 +0000 To: kde-commits Subject: kdereview/kdewebkit Message-Id: <1257209346.885523.24734.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=125720935605173 SVN commit 1044092 by adawit: Paste the selection in the clipboard when the middle click occurs on editable element such as a text area even it does not currently have the focus. [Untested] Fixes bug #212821. M +12 -2 kwebviewprivate_p.h --- trunk/kdereview/kdewebkit/kwebviewprivate_p.h #1044091:1044092 @@ -77,8 +77,8 @@ bool mouseReleased(const QPoint &pos) { - const QWebHitTestResult result = q->page()->mainFrame()->hitTestContent(pos); - const QUrl url = result.linkUrl(); + hitTest = q->page()->mainFrame()->hitTestContent(pos); + const QUrl url = hitTest.linkUrl(); if (url.isEmpty()) { return false; @@ -100,6 +100,15 @@ void handleUrlPasteFromClipboard() { + if (hitTest.isContentEditable()) { +#if QT_VERSION >= 0x040600 + QString text (hitTest.element().toPlainText()); + text += QApplication::clipboard()->text(QClipboard::Selection).trimmed(); + hitTest.element().setPlainText(text); +#endif + return; + } + if (q->page() && !q->page()->isModified() && (pressedButtons & Qt::MidButton)) { QString clipboardText(QApplication::clipboard()->text(QClipboard::Selection).trimmed()); if (KUriFilter::self()->filterUri(clipboardText, QStringList() << "kshorturifilter")) { @@ -111,6 +120,7 @@ T *q; Qt::KeyboardModifiers keyboardModifiers; Qt::MouseButtons pressedButtons; + QWebHitTestResult hitTest; }; #endif