[inspector] Emit signals from attachWindow and detachWindow in the Qt platform
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Aug 2008 10:06:39 +0000 (10:06 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Aug 2008 10:06:39 +0000 (10:06 +0000)
    Allow the user of the API to honor the attachWindow and detachWindow
    requests and attach the QWebPage/QWebView wherever it is wanted. This needs
    some more API in QWebPage to be properly exposed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35914 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
WebKit/qt/WebCoreSupport/InspectorClientQt.h

index 67b07d2ae92a6c5d0554be0be054e581b5ee1da7..8e87ec484c43d02c6a0b710867bfceac1d213137 100644 (file)
@@ -1,3 +1,18 @@
+2008-08-25  Holger Hans Peter Freyther  <zecke@selfish.org>
+
+        Reviewed by Simon.
+
+        [inspector] Emit signals from attachWindow and detachWindow in the Qt platform
+        Allow the user of the API to honor the attachWindow and detachWindow
+        requests and attach the QWebPage/QWebView wherever it is wanted. This needs
+        some more API in QWebPage to be properly exposed.
+
+        * WebCoreSupport/InspectorClientQt.cpp:
+        (WebCore::InspectorClientQt::createPage):
+        (WebCore::InspectorClientQt::attachWindow):
+        (WebCore::InspectorClientQt::detachWindow):
+        * WebCoreSupport/InspectorClientQt.h:
+
 2008-08-19  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Geoff Garen.
index 6854de47659bb5723a325120ac45c7f116d8e61d..3a5df33747c94cec6d4af6beb19200978cac3928 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2007 Apple Inc.  All rights reserved.
  * Copyright (C) 2007 Trolltech ASA
+ * Copyright (C) 2008 Holger Hans Peter Freyther
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -45,6 +46,8 @@ namespace WebCore {
 
 class InspectorClientWebPage : public QWebPage
 {
+    Q_OBJECT
+    friend class InspectorClientQt;
 public:
     QWebPage* createWindow(QWebPage::WebWindowType)
     {
@@ -54,6 +57,10 @@ public:
         connect(page, SIGNAL(destroyed()), w, SLOT(deleteLater()));
         return page;
     }
+
+Q_SIGNALS:
+    void attachRequested();
+    void detachRequested();
 };
 
 
@@ -82,7 +89,6 @@ private:
 
 InspectorClientQt::InspectorClientQt(QWebPage* page)
     : m_inspectedWebPage(page)
-    , m_attached(false)
 {}
 
 void InspectorClientQt::inspectorDestroyed()
@@ -96,7 +102,7 @@ Page* InspectorClientQt::createPage()
         return m_webPage->d->page;
 
     InspectorClientView* view = new InspectorClientView(m_inspectedWebPage->d->page->inspectorController());
-    m_webPage.set(view->page());
+    m_webPage.set(qobject_cast<InspectorClientWebPage*>(view->page()));
     m_webPage->mainFrame()->load(QString::fromLatin1("qrc:/webkit/inspector/inspector.html"));
     m_webPage->view()->setMinimumSize(400,300);
     return m_webPage->d->page;
@@ -136,22 +142,18 @@ bool InspectorClientQt::windowVisible()
 
 void InspectorClientQt::attachWindow()
 {
-    ASSERT(m_inspectedWebPage);
-    ASSERT(m_webPage);
-    ASSERT(!m_attached);
+    if (!m_webPage)
+        return;
 
-    m_attached = true;
-    notImplemented();
+    emit m_webPage->attachRequested();
 }
 
 void InspectorClientQt::detachWindow()
 {
-    ASSERT(m_inspectedWebPage);
-    ASSERT(m_webPage);
-    ASSERT(m_attached);
+    if (!m_webPage)
+        return;
 
-    m_attached = false;
-    notImplemented();
+    emit m_webPage->detachRequested();
 }
 
 void InspectorClientQt::setAttachedWindowHeight(unsigned height)
@@ -185,3 +187,5 @@ void InspectorClientQt::updateWindowTitle()
 }
 
 }
+
+#include "InspectorClientQt.moc"
index 0f30b91dc42084fcd57e25090a7f81ab55ee7a39..654095c773bd985941112ef48b297eaeeccbe035 100644 (file)
@@ -40,6 +40,7 @@ namespace WebCore {
     class Node;
     class Page;
     class String;
+    class InspectorClientWebPage;
 
     class InspectorClientQt : public InspectorClient {
     public:
@@ -67,8 +68,7 @@ namespace WebCore {
     private:
         void updateWindowTitle();
         QWebPage* m_inspectedWebPage;
-        OwnPtr<QWebPage> m_webPage;
-        bool m_attached;
+        OwnPtr<InspectorClientWebPage> m_webPage;
         QString m_inspectedURL;
     };
 }