summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-03-24 04:12:43 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-03-24 04:12:43 (GMT)
commitc78af170f439d981f85f46f60290161903159b10 (patch)
tree9befc8d0dbf4f7f3e4b7e648d388e0557a15b84b
parent562ff1d1fcb726932aa4483655aa0d4c6a9746f2 (diff)
downloadQt-c78af170f439d981f85f46f60290161903159b10.zip
Qt-c78af170f439d981f85f46f60290161903159b10.tar.gz
Qt-c78af170f439d981f85f46f60290161903159b10.tar.bz2
Remove support for QML-in-HTML-in-WebView
Currently, this feature too prone to accidental misuse and abuse.
-rw-r--r--examples/declarative/webview/evalandattach.html31
-rw-r--r--examples/declarative/webview/evalandattach.qml55
-rw-r--r--examples/declarative/webview/qdeclarative-in-html.qml33
-rw-r--r--src/imports/webkit/qdeclarativewebview.cpp87
-rw-r--r--src/imports/webkit/qdeclarativewebview_p.h1
5 files changed, 0 insertions, 207 deletions
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 @@
-<body bgcolor=gray onload="ftext.confirmed.connect (ftext_confirmed); ">
- <script>
- do_it = function () {var oPressed = document.getElementById('pressed');
- oPressed.innerHTML = 'MouseArea in QML clicked!';};
- ftext_confirmed = function () { statusText1.text = ftext.text; var oT = document.getElementById('htmlTextInput'); oT.value = ftext.text }
- </script>
- <table border=1>
- <tr>
- <td>&nbsp</td>
- <td id='pressed'></td>
- </tr>
- <tr>
- <td><label for='htmlTextInput'>Type something:</label></td>
- <td><input type='text' name='htmlTextInput' size='25' id='htmlTextInput'
- onfocus="statusText2.text = 'Focus in html text input.'"></td>
- </tr>
- <tr>
- <td><label for='htmlButton'>&nbsp;</label></td>
- <td>
- <input type='button' id='htmlButton' value='Push'
- onclick="var oText = document.getElementById('htmlTextInput'); statusText1.text = oText.value; ftext.text = oText.value" />
- </tr>
- </table>
- <p>
- Below a qml(QFxItem) object inside webkit:
- </p>
- <object data=content/FieldText.qml TYPE=application/x-qt-plugin id="ftext_id" text="" label="Cool:" width="200"
- objectname="ftext">
- </object>
-</body>
-
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: "<html>\
- <body bgcolor=white>\
- These are QML plugins, shown in a QML WebView via HTML OBJECT tags, all scaled to 75%\
- and placed in a Flickable area...\
- <table border=1>\
- <tr><th>Duration <th>Color <th>Plugin\
- <tr><td>500 <td>red <td><OBJECT data=content/SpinSquare.qml TYPE=application/x-qt-plugin width=100 height=100 period=500 color=red />\
- <tr><td>2000 <td>blue <td><OBJECT data=content/SpinSquare.qml TYPE=application/x-qt-plugin width=100 height=100 period=2000 color=blue />\
- <tr><td>1000 <td>green <td><OBJECT data=content/SpinSquare.qml TYPE=application/x-qt-plugin width=100 height=100 period=1000 color=green />\
- </table>\
- </body>\
- </html>"
- }
- }
-}
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 &paramNames, const QStringList &paramValues) :
- 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<QDeclarativeItem*>(component->create(qmlContext(webview)));
- item->setParent(webview);
- QString jsObjName;
- for (int i=0; i<propertyNames.count(); ++i) {
- if (propertyNames[i] != QLatin1String("type") && propertyNames[i] != QLatin1String("data")) {
- item->setProperty(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<QDeclarativeWebView*>(parent());
}
-QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
-{
- 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 <qdeclarativewebview.moc>
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 &paramNames, const QStringList &paramValues);
QWebPage *createWindow(WebWindowType type);
void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID);
QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile);