summaryrefslogtreecommitdiff
path: root/src/webwindow
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-08-01 17:53:32 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:04 +0100
commit906112a363e16f774b407e8277468a74a144ccef (patch)
treefeffd06df8be1edac6a17d4143daaaf1b28c8c4a /src/webwindow
parentUrlbar, first code ported to the new API (diff)
downloadrekonq-906112a363e16f774b407e8277468a74a144ccef.tar.xz
Port WebWindow to use Urlbar class. Easier testing changes...
Diffstat (limited to 'src/webwindow')
-rw-r--r--src/webwindow/webwindow.cpp31
-rw-r--r--src/webwindow/webwindow.h9
2 files changed, 10 insertions, 30 deletions
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index c0cd9c41..758807b7 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -30,10 +30,11 @@
#include "webpage.h"
#include "webtab.h"
+#include "urlbar.h"
+
#include "websnap.h"
#include <KUrl>
-#include <KLineEdit>
#include <QWebView>
#include <QVBoxLayout>
@@ -43,7 +44,7 @@ WebWindow::WebWindow(QWidget *parent)
: QWidget(parent)
, _progress(0)
, _tab(new WebTab(this))
- , _edit(new KLineEdit(this))
+ , _bar(new UrlBar(_tab))
{
init();
}
@@ -52,7 +53,7 @@ WebWindow::WebWindow(QWidget *parent)
WebWindow::WebWindow(WebPage *page, QWidget *parent)
: QWidget(parent)
, _tab(new WebTab(this))
- , _edit(new KLineEdit(this))
+ , _bar(new UrlBar(_tab))
{
_tab->view()->setPage(page);
page->setParent(_tab->view());
@@ -65,19 +66,13 @@ void WebWindow::init()
{
// layout
QVBoxLayout *l = new QVBoxLayout;
- l->addWidget(_edit);
+ l->addWidget(_bar);
l->addWidget(_tab);
l->setContentsMargins(0, 0, 0, 0);
setLayout(l);
setContentsMargins(0, 0, 0, 0);
- // line edit signals
- connect(_edit, SIGNAL(returnPressed()), this, SLOT(checkLoadUrl()));
-
- // url signal
- connect(_tab->view(), SIGNAL(urlChanged(QUrl)), this, SLOT(setUrlText(QUrl)));
-
// things changed signals
connect(_tab->view(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
@@ -104,24 +99,12 @@ WebPage *WebWindow::page()
}
-void WebWindow::checkLoadUrl()
-{
- QString urlString = _edit->text();
- QUrl u = QUrl::fromUserInput(urlString);
- load(u);
-}
-
-
void WebWindow::checkLoadProgress(int p)
{
_progress = p;
emit loadProgress(p);
}
-void WebWindow::setUrlText(const QUrl &u)
-{
- _edit->setText(u.toString());
-}
KUrl WebWindow::url() const
{
@@ -141,9 +124,9 @@ QIcon WebWindow::icon() const
}
-KLineEdit *WebWindow::urlBar()
+UrlBar *WebWindow::urlBar()
{
- return _edit;
+ return _bar;
}
diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h
index 9551000b..a8bebbf4 100644
--- a/src/webwindow/webwindow.h
+++ b/src/webwindow/webwindow.h
@@ -43,7 +43,7 @@ class WebPage;
class WebTab;
class WebView;
-class KLineEdit;
+class UrlBar;
class QPixmap;
class QUrl;
@@ -65,7 +65,7 @@ public:
QString title() const;
QIcon icon() const;
- KLineEdit *urlBar();
+ UrlBar *urlBar();
WebTab *view();
QPixmap tabPreview(int width, int height);
@@ -82,9 +82,6 @@ private:
void init();
private Q_SLOTS:
- void checkLoadUrl();
- void setUrlText(const QUrl &);
-
void checkLoadProgress(int);
Q_SIGNALS:
@@ -100,7 +97,7 @@ private:
int _progress;
WebTab *_tab;
- KLineEdit *_edit;
+ UrlBar *_bar;
};
#endif // WEB_WINDOW