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

List:       kde-commits
Subject:    playground/libs/webkitkde
From:       Simon Hausmann <hausmann () kde ! org>
Date:       2007-06-28 14:18:14
Message-ID: 1183040294.842089.8414.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 681306 by hausmann:

Added support for the cut/copy/paste actions through the browserextension.


 M  +14 -0     webkitpart.cpp  
 M  +4 -1      webkitpart.h  


--- trunk/playground/libs/webkitkde/webkitpart.cpp #681305:681306
@@ -139,6 +139,12 @@
 WebKitBrowserExtension::WebKitBrowserExtension(WebKitPart *parent)
     : KParts::BrowserExtension(parent), part(parent)
 {
+    connect(part->page(), SIGNAL(selectionChanged()),
+            this, SLOT(updateEditActions()));
+
+    enableAction("cut", false);
+    enableAction("copy", false);
+    enableAction("paste", false);
 }
 
 void WebKitBrowserExtension::cut()
@@ -156,6 +162,14 @@
     part->page()->paste();
 }
 
+void WebKitBrowserExtension::updateEditActions()
+{
+    QWebPage *page = part->page();
+    enableAction("cut", page->canCut());
+    enableAction("copy", page->canCopy());
+    enableAction("paste", page->canPaste());
+}
+
 typedef KParts::GenericFactory<WebKitPart> Factory;
 Q_EXPORT_PLUGIN(Factory);
 
--- trunk/playground/libs/webkitkde/webkitpart.h #681305:681306
@@ -45,7 +45,7 @@
 
     QWebPage::NavigationRequestResponse navigationRequested(const QWebNetworkRequest &request);
 
-    inline QWebPage *page() const { return webPage; }
+    inline WebPage *page() { return webPage; }
 
     static KAboutData *createAboutData();
 
@@ -84,6 +84,9 @@
     void copy();
     void paste();
 
+private slots:
+    void updateEditActions();
+
 private:
     WebKitPart *part;
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

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