summaryrefslogtreecommitdiff
path: root/src/webwindow/webwindow.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-08-01 11:35:06 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:04 +0100
commit4b24758d7230504daedc3d537f233f02244641bb (patch)
tree27206d0a12e5052d7b4bffe76b48e1e1cca31985 /src/webwindow/webwindow.cpp
parentLet WebTab compile (and everything NOT commented out...) (diff)
downloadrekonq-4b24758d7230504daedc3d537f233f02244641bb.tar.xz
Clean up WebWindow inserting the WebTab there.
Diffstat (limited to 'src/webwindow/webwindow.cpp')
-rw-r--r--src/webwindow/webwindow.cpp61
1 files changed, 27 insertions, 34 deletions
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index 2955f399..48e24852 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -28,10 +28,13 @@
#include "webwindow.moc"
#include "webpage.h"
+#include "webtab.h"
+
#include "websnap.h"
-#include <QUrl>
-#include <QLineEdit>
+#include <KUrl>
+#include <KLineEdit>
+
#include <QWebView>
#include <QVBoxLayout>
@@ -39,24 +42,20 @@
WebWindow::WebWindow(QWidget *parent)
: QWidget(parent)
, _progress(0)
- , _view(new QWebView(this))
- , _edit(new QLineEdit(this))
+ , _tab(new WebTab(this))
+ , _edit(new KLineEdit(this))
{
- WebPage *p = new WebPage(_view);
- _view->setPage(p);
-
init();
}
WebWindow::WebWindow(WebPage *page, QWidget *parent)
: QWidget(parent)
- , _view(new QWebView(this))
- , _edit(new QLineEdit(this))
+ , _tab(new WebTab(this))
+ , _edit(new KLineEdit(this))
{
- _view->setPage(page);
- page->setParent(_view);
-
+ _tab->view()->setPage(page);
+
init();
}
@@ -66,7 +65,7 @@ void WebWindow::init()
// layout
QVBoxLayout *l = new QVBoxLayout;
l->addWidget(_edit);
- l->addWidget(_view);
+ l->addWidget(_tab);
l->setContentsMargins(0, 0, 0, 0);
setLayout(l);
@@ -76,16 +75,16 @@ void WebWindow::init()
connect(_edit, SIGNAL(returnPressed()), this, SLOT(checkLoadUrl()));
// url signal
- connect(_view, SIGNAL(urlChanged(QUrl)), this, SLOT(setUrlText(QUrl)));
+ connect(_tab->view(), SIGNAL(urlChanged(QUrl)), this, SLOT(setUrlText(QUrl)));
// things changed signals
- connect(_view, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
+ connect(_tab->view(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
// load signals
- connect(_view, SIGNAL(loadStarted()), this, SIGNAL(loadStarted()));
- connect(_view, SIGNAL(loadFinished(bool)), this, SIGNAL(loadFinished(bool)));
+ connect(_tab->view(), SIGNAL(loadStarted()), this, SIGNAL(loadStarted()));
+ connect(_tab->view(), SIGNAL(loadFinished(bool)), this, SIGNAL(loadFinished(bool)));
- connect(_view, SIGNAL(loadProgress(int)), this, SLOT(checkLoadProgress(int)));
+ connect(_tab->view(), SIGNAL(loadProgress(int)), this, SLOT(checkLoadProgress(int)));
// page signals
connect(page(), SIGNAL(pageCreated(WebPage *)), this, SIGNAL(pageCreated(WebPage *)));
@@ -94,17 +93,13 @@ void WebWindow::init()
void WebWindow::load(const QUrl &url)
{
- _view->load(url);
+ _tab->view()->load(url);
}
WebPage *WebWindow::page()
{
- if (!_view)
- return 0;
-
- WebPage *p = qobject_cast<WebPage *>(_view->page());
- return p;
+ return _tab->page();
}
@@ -116,34 +111,32 @@ void WebWindow::checkLoadUrl()
}
-void WebWindow::setUrlText(const QUrl &u)
-{
- _edit->setText(u.toString());
-}
-
-
void WebWindow::checkLoadProgress(int p)
{
_progress = p;
emit loadProgress(p);
}
+void WebWindow::setUrlText(const QUrl &u)
+{
+ _edit->setText(u.toString());
+}
-QUrl WebWindow::url() const
+KUrl WebWindow::url() const
{
- return _view->url();
+ return _tab->url();
}
QString WebWindow::title() const
{
- return _view->title();
+ return _tab->view()->title();
}
QIcon WebWindow::icon() const
{
- return _view->icon();
+ return _tab->view()->icon();
}