summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-05-25 10:51:21 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-05-25 10:51:21 +0200
commit2ad17fa1cb5309172899cd8159d247071d6cd3e4 (patch)
tree14c51b676af835b32bc06acdede77c6991865450 /src
parentno inline functions, as suggested (diff)
downloadrekonq-2ad17fa1cb5309172899cd8159d247071d6cd3e4.tar.xz
Refactored page/setNewPage KWebPage methods
Diffstat (limited to 'src')
-rw-r--r--src/mainview.cpp32
-rw-r--r--src/webview.cpp4
-rw-r--r--src/webview.h4
3 files changed, 15 insertions, 25 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 9ba711ed..1b2d4769 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -58,9 +58,6 @@
#include <QtGui/QWidget>
#include <QtGui/QMouseEvent>
-#include <QtWebKit/QWebPage>
-
-
MainView::MainView(QWidget *parent)
: KTabWidget(parent)
@@ -179,8 +176,7 @@ void MainView::showTabBar()
void MainView::slotWebReload()
{
WebView *webView = currentWebView();
- QWebPage *currentParent = webView->webPage();
- QAction *action = currentParent->action(QWebPage::Reload);
+ QAction *action = webView->page()->action(QWebPage::Reload);
action->trigger();
}
@@ -188,8 +184,7 @@ void MainView::slotWebReload()
void MainView::slotWebStop()
{
WebView *webView = currentWebView();
- QWebPage *currentParent = webView->webPage();
- QAction *action = currentParent->action(QWebPage::Stop);
+ QAction *action = webView->page()->action(QWebPage::Stop);
action->trigger();
}
@@ -197,8 +192,7 @@ void MainView::slotWebStop()
void MainView::slotWebBack()
{
WebView *webView = currentWebView();
- QWebPage *currentParent = webView->webPage();
- QAction *action = currentParent->action(QWebPage::Back);
+ QAction *action = webView->page()->action(QWebPage::Back);
action->trigger();
}
@@ -206,8 +200,7 @@ void MainView::slotWebBack()
void MainView::slotWebForward()
{
WebView *webView = currentWebView();
- QWebPage *currentParent = webView->webPage();
- QAction *action = currentParent->action(QWebPage::Forward);
+ QAction *action = webView->page()->action(QWebPage::Forward);
action->trigger();
}
@@ -215,8 +208,7 @@ void MainView::slotWebForward()
void MainView::slotWebUndo()
{
WebView *webView = currentWebView();
- QWebPage *currentParent = webView->webPage();
- QAction *action = currentParent->action(QWebPage::Undo);
+ QAction *action = webView->page()->action(QWebPage::Undo);
action->trigger();
}
@@ -224,8 +216,7 @@ void MainView::slotWebUndo()
void MainView::slotWebRedo()
{
WebView *webView = currentWebView();
- QWebPage *currentParent = webView->webPage();
- QAction *action = currentParent->action(QWebPage::Redo);
+ QAction *action = webView->page()->action(QWebPage::Redo);
action->trigger();
}
@@ -233,8 +224,7 @@ void MainView::slotWebRedo()
void MainView::slotWebCut()
{
WebView *webView = currentWebView();
- QWebPage *currentParent = webView->webPage();
- QAction *action = currentParent->action(QWebPage::Cut);
+ QAction *action = webView->page()->action(QWebPage::Cut);
action->trigger();
}
@@ -242,8 +232,7 @@ void MainView::slotWebCut()
void MainView::slotWebCopy()
{
WebView *webView = currentWebView();
- QWebPage *currentParent = webView->webPage();
- QAction *action = currentParent->action(QWebPage::Copy);
+ QAction *action = webView->page()->action(QWebPage::Copy);
action->trigger();
}
@@ -251,8 +240,7 @@ void MainView::slotWebCopy()
void MainView::slotWebPaste()
{
WebView *webView = currentWebView();
- QWebPage *currentParent = webView->webPage();
- QAction *action = currentParent->action(QWebPage::Paste);
+ QAction *action = webView->page()->action(QWebPage::Paste);
action->trigger();
}
@@ -575,7 +563,7 @@ void MainView::webViewLoadProgress(int progress)
return;
}
- double totalBytes = static_cast<double>(webView->webPage()->totalBytes() / 1024);
+ double totalBytes = static_cast<double>(webView->page()->totalBytes() / 1024);
QString message = i18n("Loading %1% (%2 %3)...", progress, totalBytes, QLatin1String("kB"));
emit showStatusBarMessage(message);
diff --git a/src/webview.cpp b/src/webview.cpp
index 374a06a8..92995a93 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -80,9 +80,9 @@ WebView::WebView(QWidget* parent)
}
-WebPage *WebView::webPage() const
+void WebView::setNewPage()
{
- return m_page;
+ setPage(new WebPage(this));
}
diff --git a/src/webview.h b/src/webview.h
index 56693597..19fd9517 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -58,7 +58,6 @@ class WebView : public KWebView
public:
WebView(QWidget *parent = 0);
- WebPage *webPage() const;
KUrl url() const;
QString lastStatusBarText() const;
int progress() const;
@@ -83,6 +82,9 @@ protected:
*/
void keyPressEvent(QKeyEvent *event);
+ // to reimplement from KWebView
+ virtual void setNewPage();
+
private slots:
void setProgress(int progress);
void loadFinished();