From 44d2c0b531c3f2d6240531114cd6471011739b9b Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 20 Aug 2010 18:19:11 +0000 Subject: [PATCH] forward urlchaged signal back forward reload slots to make it more usable from javascript and to have the api simiar to qgraphicswebview svn path=/trunk/KDE/kdelibs/; revision=1166067 --- widgets/webview.cpp | 22 ++++++++++++++++++++++ widgets/webview.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/widgets/webview.cpp b/widgets/webview.cpp index 9da0fb665..67b35afee 100644 --- a/widgets/webview.cpp +++ b/widgets/webview.cpp @@ -79,6 +79,8 @@ WebView::WebView(QGraphicsItem *parent) this, SIGNAL(loadProgress(int))); connect(d->webView, SIGNAL(loadFinished(bool)), this, SLOT(loadingFinished(bool))); + connect(d->webView, SIGNAL(urlChanged(const QUrl &)), + this, SLOT(urlChanged(const QUrl &))); } WebView::~WebView() @@ -179,6 +181,26 @@ bool WebView::dragToScroll() return d->webView->dragToScroll(); } +void WebView::back() +{ + d->webView->back(); +} + +void WebView::forward() +{ + d->webView->forward(); +} + +void WebView::reload() +{ + d->webView->reload(); +} + +void WebView::stop() +{ + d->webView->stop(); +} + void WebView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { QGraphicsWidget::paint(painter, option, widget); diff --git a/widgets/webview.h b/widgets/webview.h index 293330390..51587c8c2 100644 --- a/widgets/webview.h +++ b/widgets/webview.h @@ -174,6 +174,31 @@ class PLASMA_EXPORT WebView : public QGraphicsWidget */ void setGeometry(const QRectF &geometry); + public Q_SLOTS: + /** + * Loads the previous document in the list of documents built by navigating links. + * @since 4.6 + */ + void back(); + + /** + * Loads the next document in the list of documents built by navigating links. + * @since 4.6 + */ + void forward(); + + /** + * Reloads the current document. + * @since 4.6 + */ + void reload(); + + /** + * Stops loading the document. + * @since 4.6 + */ + void stop(); + Q_SIGNALS: /** * During loading progress, this signal is emitted. The values @@ -191,6 +216,12 @@ class PLASMA_EXPORT WebView : public QGraphicsWidget */ void loadFinished(bool success); + /** + * url displayed by the web page changed + * @since 4.6 + */ + void urlChanged(const QUrl &url); + protected: /** * Reimplementation