* 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
This commit is contained in:
Aaron J. Seigo 2009-04-07 08:33:51 +00:00
parent 18211150b2
commit 0b5bceb2e9
2 changed files with 24 additions and 2 deletions

View File

@ -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);
}

View File

@ -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.