From c78af170f439d981f85f46f60290161903159b10 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 24 Mar 2010 14:12:43 +1000 Subject: Remove support for QML-in-HTML-in-WebView Currently, this feature too prone to accidental misuse and abuse. --- examples/declarative/webview/evalandattach.html | 31 -------- examples/declarative/webview/evalandattach.qml | 55 -------------- .../declarative/webview/qdeclarative-in-html.qml | 33 -------- src/imports/webkit/qdeclarativewebview.cpp | 87 ---------------------- src/imports/webkit/qdeclarativewebview_p.h | 1 - 5 files changed, 207 deletions(-) delete mode 100644 examples/declarative/webview/evalandattach.html delete mode 100644 examples/declarative/webview/evalandattach.qml delete mode 100644 examples/declarative/webview/qdeclarative-in-html.qml diff --git a/examples/declarative/webview/evalandattach.html b/examples/declarative/webview/evalandattach.html deleted file mode 100644 index 48a1c33..0000000 --- a/examples/declarative/webview/evalandattach.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - -
 
- -
-

- Below a qml(QFxItem) object inside webkit: -

- - - - diff --git a/examples/declarative/webview/evalandattach.qml b/examples/declarative/webview/evalandattach.qml deleted file mode 100644 index d219d84..0000000 --- a/examples/declarative/webview/evalandattach.qml +++ /dev/null @@ -1,55 +0,0 @@ -import Qt 4.6 -import org.webkit 1.0 - -Item { - height: 640 - width: 360 - Text { - id: teksti - text: webView.statusText1 - anchors.top: parent.top - height: 30 - anchors.left: parent.left - width: parent.width/2 - } - - Text { - id: teksti2 - text: webView.statusText2 - anchors.top: parent.top - height: 30 - anchors.left: teksti.right - anchors.right: parent.right - } - - MouseArea { - anchors.fill: teksti - onClicked: { webView.evaluateJavaScript ("do_it()") } - } - - WebView { - id: webView - property alias statusText1: txt.text - property alias statusText2: txt2.text - anchors.top: teksti.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - focus: true - settings.pluginsEnabled: true - javaScriptWindowObjects: [ - QtObject { - id: txt - WebView.windowObjectName: "statusText1" - property string text: "Click me!" - }, - QtObject { - id: txt2 - WebView.windowObjectName: "statusText2" - property string text: "" - } - ] - url: "evalandattach.html" - } - -} diff --git a/examples/declarative/webview/qdeclarative-in-html.qml b/examples/declarative/webview/qdeclarative-in-html.qml deleted file mode 100644 index 172ea4b..0000000 --- a/examples/declarative/webview/qdeclarative-in-html.qml +++ /dev/null @@ -1,33 +0,0 @@ -import Qt 4.6 -import org.webkit 1.0 - -// The WebView supports QML data through the HTML OBJECT tag -Rectangle { - color:"blue" - Flickable { - width: parent.width - height: parent.height/2 - contentWidth: web.width*web.scale - contentHeight: web.height*web.scale - WebView { - id: web - width: 250 - height: 420 - zoomFactor: 0.75 - smoothCache: true - settings.pluginsEnabled: true - html: "\ - \ - These are QML plugins, shown in a QML WebView via HTML OBJECT tags, all scaled to 75%\ - and placed in a Flickable area...\ - \ -
Duration Color Plugin\ -
500 red \ -
2000 blue \ -
1000 green \ -
\ - \ - " - } - } -} diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp index f8b2b88..0b85ae4 100644 --- a/src/imports/webkit/qdeclarativewebview.cpp +++ b/src/imports/webkit/qdeclarativewebview.cpp @@ -1239,96 +1239,11 @@ bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QS } -/* - Qt WebKit does not understand non-QWidget plugins, so dummy widgets - are created, parented to a single dummy tool window. - - The requirements for QML object plugins are input to the Qt WebKit - non-QWidget plugin support, which will obsolete this kludge. -*/ -class QWidget_Dummy_Plugin : public QWidget -{ - Q_OBJECT -public: - static QWidget *dummy_shared_parent() - { - static QWidget *dsp = 0; - if (!dsp) { - dsp = new QWidget(0,Qt::Tool); - dsp->setGeometry(-10000,-10000,0,0); - dsp->show(); - } - return dsp; - } - QWidget_Dummy_Plugin(const QUrl& url, QDeclarativeWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : - QWidget(dummy_shared_parent()), - propertyNames(paramNames), - propertyValues(paramValues), - webview(view) - { - QDeclarativeEngine *engine = qmlEngine(webview); - component = new QDeclarativeComponent(engine, url, this); - item = 0; - if (component->isLoading()) - connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(qmlLoaded())); - else - qmlLoaded(); - } - -public Q_SLOTS: - void qmlLoaded() - { - if (component->isError()) { - // ### Could instead give these errors to the WebView to handle. - qWarning() << component->errors(); - return; - } - item = qobject_cast(component->create(qmlContext(webview))); - item->setParent(webview); - QString jsObjName; - for (int i=0; isetProperty(propertyNames[i].toUtf8(),propertyValues[i]); - if (propertyNames[i] == QLatin1String("objectname")) - jsObjName = propertyValues[i]; - } - } - if (!jsObjName.isNull()) { - QWebFrame *f = webview->page()->mainFrame(); - f->addToJavaScriptWindowObject(jsObjName, item); - } - resizeEvent(0); - delete component; - component = 0; - } - void resizeEvent(QResizeEvent*) - { - if (item) { - item->setX(x()); - item->setY(y()); - item->setWidth(width()); - item->setHeight(height()); - } - } - -private: - QDeclarativeComponent *component; - QDeclarativeItem *item; - QStringList propertyNames, propertyValues; - QDeclarativeWebView *webview; -}; - QDeclarativeWebView *QDeclarativeWebPage::viewItem() { return static_cast(parent()); } -QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) -{ - QUrl comp = qmlContext(viewItem())->resolvedUrl(url); - return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues); -} - QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type) { QDeclarativeWebView *newView = viewItem()->createWindow(type); @@ -1338,5 +1253,3 @@ QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type) } QT_END_NAMESPACE - -#include diff --git a/src/imports/webkit/qdeclarativewebview_p.h b/src/imports/webkit/qdeclarativewebview_p.h index 36b18a6..81581d8 100644 --- a/src/imports/webkit/qdeclarativewebview_p.h +++ b/src/imports/webkit/qdeclarativewebview_p.h @@ -69,7 +69,6 @@ public: explicit QDeclarativeWebPage(QDeclarativeWebView *parent); ~QDeclarativeWebPage(); protected: - QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); QWebPage *createWindow(WebWindowType type); void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); -- cgit v0.12