[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdereview/kdewebkit
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2009-11-03 0:49:06
Message-ID: 1257209346.885523.24734.nullmailer () svn ! kde ! org
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic