diff options
Diffstat (limited to 'src/webwindow')
-rw-r--r-- | src/webwindow/webwindow.cpp | 61 | ||||
-rw-r--r-- | src/webwindow/webwindow.h | 12 |
2 files changed, 34 insertions, 39 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(); } diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h index bc445afe..64af055b 100644 --- a/src/webwindow/webwindow.h +++ b/src/webwindow/webwindow.h @@ -40,9 +40,11 @@ // Forward Declarations class WebPage; +class WebTab; +class WebView; + +class KLineEdit; -class QWebView; -class QLineEdit; class QPixmap; class QUrl; @@ -59,7 +61,7 @@ public: WebPage *page(); - QUrl url() const; + KUrl url() const; QString title() const; QIcon icon() const; @@ -94,8 +96,8 @@ Q_SIGNALS: private: int _progress; - QWebView *_view; - QLineEdit *_edit; + WebTab *_tab; + KLineEdit *_edit; }; #endif // WEB_WINDOW |