summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-02-19 12:10:25 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-02-19 12:10:25 +0100
commita013b8f0a260ebedbd74f76bd43b0384ca5e2bc4 (patch)
treeb12e2c230b64a601ffa3a9afd7b10bf5c1fffca4 /src
parent.. and check that the changes you do are right. (diff)
downloadrekonq-a013b8f0a260ebedbd74f76bd43b0384ca5e2bc4.tar.xz
Save memory. One WebPage pointer less for each WebView :)
Diffstat (limited to 'src')
-rw-r--r--src/webview.cpp19
-rw-r--r--src/webview.h3
2 files changed, 14 insertions, 8 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index 36f62bfa..e39ff32e 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -62,16 +62,16 @@
WebView::WebView(QWidget* parent)
: KWebView(parent, false)
- , m_page( new WebPage(this) )
- , m_mousePos(QPoint(0,0))
+ , m_mousePos( QPoint(0,0) )
{
- setPage(m_page);
+ WebPage *page = new WebPage(this);
+ setPage(page);
// download system
connect(this, SIGNAL(linkShiftClicked(const KUrl &)),
- m_page, SLOT(downloadUrl(const KUrl &)));
- connect(m_page, SIGNAL(downloadRequested(const QNetworkRequest &)),
- m_page, SLOT(downloadRequest(const QNetworkRequest &)));
+ page, SLOT(downloadUrl(const KUrl &)));
+ connect(page, SIGNAL(downloadRequested(const QNetworkRequest &)),
+ page, SLOT(downloadRequest(const QNetworkRequest &)));
// middle click || ctrl + click signal
connect(this, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)),
@@ -89,6 +89,13 @@ WebView::~WebView()
}
+WebPage *WebView::page()
+{
+ WebPage *page = qobject_cast<WebPage *>( KWebView::page() );
+ return page;
+}
+
+
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
diff --git a/src/webview.h b/src/webview.h
index 1598b19c..6d75c549 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -46,7 +46,7 @@ public:
explicit WebView(QWidget *parent);
~WebView();
- WebPage *page() { return m_page; }
+ WebPage *page();
QPoint mousePos();
protected:
@@ -71,7 +71,6 @@ signals:
void loadUrl(const KUrl &, const Rekonq::OpenType &);
private:
- WebPage *const m_page;
QPoint m_mousePos;
};