Implemented clipboard functions in QWebPage, in particular can(Cut|Copy|Paste), cut...
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2007 14:16:42 +0000 (14:16 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jun 2007 14:16:42 +0000 (14:16 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23852 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitQt/Api/qwebpage.cpp
WebKitQt/Api/qwebpage.h
WebKitQt/ChangeLog
WebKitQt/WebCoreSupport/EditorClientQt.cpp

index 80635cd..52e4e78 100644 (file)
@@ -44,6 +44,8 @@
 #include "KURL.h"
 #include "Image.h"
 #include "IconDatabase.h"
+#include "FocusController.h"
+#include "Editor.h"
 
 #include <QDebug>
 #include <QDragEnterEvent>
@@ -261,6 +263,36 @@ void QWebPage::setWindowGeometry(const QRect& geom)
     Q_UNUSED(geom)
 }
 
+bool QWebPage::canCut() const
+{
+    return d->page->focusController()->focusedOrMainFrame()->editor()->canCut();
+}
+
+bool QWebPage::canCopy() const
+{
+    return d->page->focusController()->focusedOrMainFrame()->editor()->canCopy();
+}
+
+bool QWebPage::canPaste() const
+{
+    return d->page->focusController()->focusedOrMainFrame()->editor()->canPaste();
+}
+
+void QWebPage::cut()
+{
+    d->page->focusController()->focusedOrMainFrame()->editor()->cut();
+}
+
+void QWebPage::copy()
+{
+    d->page->focusController()->focusedOrMainFrame()->editor()->copy();
+}
+
+void QWebPage::paste()
+{
+    d->page->focusController()->focusedOrMainFrame()->editor()->paste();
+}
+
 /*!
   Returns true if the page contains unsubmitted form data.
 */
index ce70679..53e265d 100644 (file)
@@ -91,6 +91,10 @@ public:
     QNetworkProxy networkProxy() const;
 #endif
 
+    bool canCut() const;
+    bool canCopy() const;
+    bool canPaste() const;
+
 public slots:
     /**
      * Stops loading of the page, if loading.
@@ -103,6 +107,10 @@ public slots:
 
     virtual void setWindowGeometry(const QRect& geom);
 
+    void cut();
+    void copy();
+    void paste();
+
 signals:
     /**
      * Signal is emitted when load is started on one of the child
@@ -142,6 +150,8 @@ signals:
      */
     void iconLoaded();
 
+    void selectionChanged();
+
 protected:
     virtual QWebFrame *createFrame(QWebFrame *parentFrame, QWebFrameData *frameData);
     virtual QWebPage *createWindow();
index 0109be5..e8f8560 100644 (file)
@@ -1,3 +1,19 @@
+2007-06-28  Simon Hausmann  <hausmann@kde.org>
+
+        Reviewed by Zack.
+
+        Implemented clipboard functions in QWebPage, in particular can(Cut|Copy|Paste), cut/copy/paste as slot as well as a selectionChanged() signal.
+
+        * Api/qwebpage.cpp:
+        (QWebPage::canCut):
+        (QWebPage::canCopy):
+        (QWebPage::canPaste):
+        (QWebPage::cut):
+        (QWebPage::copy):
+        (QWebPage::paste):
+        * Api/qwebpage.h:
+        * WebCoreSupport/EditorClientQt.cpp:
+
 2007-06-27  George Staikos  <staikos@kde.org>
 
         Compile with various Qt configurations.
index d355787..d5a4685 100644 (file)
@@ -116,7 +116,7 @@ void EditorClientQt::respondToChangedContents()
 
 void EditorClientQt::respondToChangedSelection()
 {
-    notImplemented();
+    emit m_page->selectionChanged();
 }
 
 void EditorClientQt::didEndEditing()