From 906112a363e16f774b407e8277468a74a144ccef Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 1 Aug 2012 17:53:32 +0200 Subject: Port WebWindow to use Urlbar class. Easier testing changes... --- src/webwindow/webwindow.cpp | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'src/webwindow/webwindow.cpp') 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 -#include #include #include @@ -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; } -- cgit v1.2.1