From 0b5bceb2e932db0b5541e4ecb85d20787ebcdf59 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Tue, 7 Apr 2009 08:33:51 +0000 Subject: [PATCH] * implement the READ side of the properties * remove a compile warning thanks, Laurent, for noticing the properties missing READs CCMAIL:montel@kde.org svn path=/trunk/KDE/kdelibs/; revision=950458 --- widgets/webview.cpp | 12 ++++++++++++ widgets/webview.h | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/widgets/webview.cpp b/widgets/webview.cpp index bc407a8ab..7cc07e9f0 100644 --- a/widgets/webview.cpp +++ b/widgets/webview.cpp @@ -85,6 +85,11 @@ void WebView::setUrl(const KUrl &url) } } +KUrl WebView::url() const +{ + return d->page ? d->page->mainFrame()->url() : KUrl(); +} + void WebView::setHtml(const QByteArray &html, const KUrl &baseUrl) { d->loaded = false; @@ -101,6 +106,11 @@ void WebView::setHtml(const QString &html, const KUrl &baseUrl) } } +QString WebView::html() const +{ + return d->page ? d->page->mainFrame()->toHtml() : QByteArray(); +} + QRectF WebView::geometry() const { if (d->loaded && d->page) { @@ -438,6 +448,8 @@ void WebViewPrivate::updateRequested(const QRect &dirtyRect) void WebViewPrivate::scrollRequested(int dx, int dy, const QRect &scrollRect) { + Q_UNUSED(dx) + Q_UNUSED(dy) updateRequested(scrollRect); } diff --git a/widgets/webview.h b/widgets/webview.h index 2a79a11a4..85e20301e 100644 --- a/widgets/webview.h +++ b/widgets/webview.h @@ -47,8 +47,8 @@ class PLASMA_EXPORT WebView : public QGraphicsWidget { Q_OBJECT - Q_PROPERTY(QString url WRITE setUrl) - Q_PROPERTY(QString html WRITE setHtml) + Q_PROPERTY(KUrl url READ url WRITE setUrl) + Q_PROPERTY(QString html READ html WRITE setHtml) Q_PROPERTY(bool dragToScroll READ dragToScroll WRITE setDragToScroll) public: @@ -62,6 +62,11 @@ class PLASMA_EXPORT WebView : public QGraphicsWidget */ void setUrl(const KUrl &url); + /** + * @return the html content of the page + */ + KUrl url() const; + /** * Sets the html to be shown along with a base URL to be used * to resolve relative references. @@ -71,6 +76,11 @@ class PLASMA_EXPORT WebView : public QGraphicsWidget */ void setHtml(const QByteArray &html, const KUrl &baseUrl = KUrl()); + /** + * @return the html content of the page + */ + QString html() const; + /** * Sets the html to be shown along with a base URL to be used * to resolve relative references.