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/webtab/protocolhandler.cpp | 4 ++-- src/webwindow/webwindow.cpp | 31 +++++++------------------------ src/webwindow/webwindow.h | 9 +++------ 3 files changed, 12 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/webtab/protocolhandler.cpp b/src/webtab/protocolhandler.cpp index 0a21fc4c..bca5a007 100644 --- a/src/webtab/protocolhandler.cpp +++ b/src/webtab/protocolhandler.cpp @@ -35,7 +35,7 @@ #include "webwindow.h" #include "webpage.h" #include "webtab.h" -#include // this has to be substituted with #include "urlbar.h" +#include "urlbar.h" // #include "newtabpage.h" // KDE Includes @@ -274,7 +274,7 @@ void ProtocolHandler::showResults(const KFileItemList &list) _frame->setHtml(html); qobject_cast(_frame->page())->setIsOnRekonqPage(true); - _webwin->urlBar()->setUrl(_url); + _webwin->urlBar()->setQUrl(_url); _webwin->view()->setFocus(); HistoryManager::self()->addHistoryEntry(_url, _url.prettyUrl()); 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; } 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 -- cgit v1.2.1