summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfxwebview.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-06-10 04:57:51 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-06-10 04:57:51 (GMT)
commit4dc4cfac667389efda4a43df5ff8cfa4ba305a2f (patch)
tree5c937ab2e510edb7a359b225132544d938a884a9 /src/declarative/fx/qfxwebview.cpp
parent29496148abe8506fbf50c99e9a210095c5115a14 (diff)
downloadQt-4dc4cfac667389efda4a43df5ff8cfa4ba305a2f.zip
Qt-4dc4cfac667389efda4a43df5ff8cfa4ba305a2f.tar.gz
Qt-4dc4cfac667389efda4a43df5ff8cfa4ba305a2f.tar.bz2
Support URLs directly (not just as strings), so they are correctly resolved.
URLs expressed as strings (possible relative) are resolved relative to the component in which the string expression is converted to a url value. All items are converted to use QUrl properties, except SqlConnection, where the databasename is only a special-case URL (this may need further consideration).
Diffstat (limited to 'src/declarative/fx/qfxwebview.cpp')
-rw-r--r--src/declarative/fx/qfxwebview.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index bfccd34..d15502b 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -287,7 +287,7 @@ void QFxWebView::componentComplete()
Q_D(QFxWebView);
switch (d->pending) {
case QFxWebViewPrivate::PendingUrl:
- setUrl(d->pending_url.toString());
+ setUrl(d->pending_url);
break;
case QFxWebViewPrivate::PendingHtml:
setHtml(d->pending_string, d->pending_url);
@@ -339,7 +339,7 @@ void QFxWebView::doLoadFinished(bool ok)
}
/*!
- \qmlproperty string WebView::url
+ \qmlproperty url WebView::url
This property holds the URL to the page displayed in this item.
Note that after this property is set, it may take some time
@@ -358,24 +358,22 @@ void QFxWebView::doLoadFinished(bool ok)
Emitted when loading of the URL successfully starts after
setUrl() is called.
*/
-QString QFxWebView::url() const
+QUrl QFxWebView::url() const
{
- return page()->mainFrame()->url().toString();
+ return page()->mainFrame()->url();
}
-void QFxWebView::setUrl(const QString &n)
+void QFxWebView::setUrl(const QUrl &url)
{
Q_D(QFxWebView);
- if (n == page()->mainFrame()->url().toString())
+ if (url == page()->mainFrame()->url())
return;
page()->setViewportSize(QSize(
d->idealwidth>0 ? d->idealwidth : width(),
d->idealheight>0 ? d->idealheight : height()));
- QUrl url(n);
- if (url.isRelative())
- url = qmlContext(this)->resolvedUrl(n);
+ Q_ASSERT(!url.isRelative());
if (isComponentComplete())
page()->mainFrame()->load(url);
@@ -942,7 +940,7 @@ void QFxWebView::setHtml(const QString &html, const QUrl &baseUrl)
d->idealwidth>0 ? d->idealwidth : width(),
d->idealheight>0 ? d->idealheight : height()));
if (isComponentComplete())
- page()->mainFrame()->setHtml(html, qmlContext(this)->resolvedUrl(baseUrl));
+ page()->mainFrame()->setHtml(html, baseUrl);
else {
d->pending = d->PendingHtml;
d->pending_url = baseUrl;