diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-08-01 11:35:06 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-12-10 02:48:04 +0100 |
commit | 4b24758d7230504daedc3d537f233f02244641bb (patch) | |
tree | 27206d0a12e5052d7b4bffe76b48e1e1cca31985 /src | |
parent | Let WebTab compile (and everything NOT commented out...) (diff) | |
download | rekonq-4b24758d7230504daedc3d537f233f02244641bb.tar.xz |
Clean up WebWindow inserting the WebTab there.
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/bookmarkowner.cpp | 4 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstoolbar.cpp | 4 | ||||
-rw-r--r-- | src/settings/generalwidget.cpp | 2 | ||||
-rw-r--r-- | src/tabwindow/tabbar.cpp | 4 | ||||
-rw-r--r-- | src/tabwindow/tabwindow.cpp | 4 | ||||
-rw-r--r-- | src/webwindow/webwindow.cpp | 61 | ||||
-rw-r--r-- | src/webwindow/webwindow.h | 12 |
7 files changed, 43 insertions, 48 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 1c117824..aba4ec69 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -127,7 +127,7 @@ QString BookmarkOwner::currentTitle() const QString BookmarkOwner::currentUrl() const { - return rApp->tabWindow()->currentWebWindow()->url().toString(); + return rApp->tabWindow()->currentWebWindow()->url().url(); } @@ -141,7 +141,7 @@ QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const { QPair<QString, QString> item; item.first = view->webWindow(i)->title(); - item.second = view->webWindow(i)->url().toString(); + item.second = view->webWindow(i)->url().url(); bkList << item; } diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 27ccaec4..019c260e 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -404,7 +404,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) // DROP is URL QString url = dropEvent->mimeData()->urls().at(0).toString(); WebWindow *w = qobject_cast<WebWindow *>(parent()); - QString title = url.contains(w->url().toString()) + QString title = url.contains(w->url().url()) ? w->title() : url; bookmark = root.addBookmark(title, url); @@ -417,7 +417,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) if (u.isValid()) { WebWindow *w = qobject_cast<WebWindow *>(parent()); - QString title = url.contains(w->url().toString()) + QString title = url.contains(w->url().url()) ? w->title() : url; bookmark = root.addBookmark(title, url); diff --git a/src/settings/generalwidget.cpp b/src/settings/generalwidget.cpp index 34bea602..ae08a01f 100644 --- a/src/settings/generalwidget.cpp +++ b/src/settings/generalwidget.cpp @@ -95,7 +95,7 @@ void GeneralWidget::setHomeToCurrentPage() WebWindow *tab = tw->currentWebWindow(); if (tab) { - kcfg_homePage->setText(tab->url().toString()); + kcfg_homePage->setText(tab->url().url()); } } diff --git a/src/tabwindow/tabbar.cpp b/src/tabwindow/tabbar.cpp index 2d53c963..6f7586d0 100644 --- a/src/tabwindow/tabbar.cpp +++ b/src/tabwindow/tabbar.cpp @@ -38,13 +38,13 @@ #include <KColorScheme> #include <KLocalizedString> #include <KMenu> +#include <KUrl> #include <QPropertyAnimation> #include <QSignalMapper> #include <QStyleOptionFrameV3> #include <QMouseEvent> #include <QTimer> -#include <QUrl> static inline QByteArray highlightPropertyName(int index) @@ -419,7 +419,7 @@ void TabBar::showTabPreview() int w = tabSizeHint(0).width(); int h = w * tabW->size().height() / tabW->size().width(); - m_previewPopup = new TabPreviewPopup(indexedTab->tabPreview(w,h), indexedTab->url().toString() , this); + m_previewPopup = new TabPreviewPopup(indexedTab->tabPreview(w,h), indexedTab->url().url() , this); int tabBarWidth = tabW->size().width(); int leftIndex = tabRect(m_currentTabPreviewIndex).x() + (tabRect(m_currentTabPreviewIndex).width() - w) / 2; diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp index cce684cf..3e479bdf 100644 --- a/src/tabwindow/tabwindow.cpp +++ b/src/tabwindow/tabwindow.cpp @@ -285,7 +285,7 @@ void TabWindow::tabTitleChanged(const QString &title) bool emptyTitle = title.isEmpty(); - QString tabTitle = emptyTitle ? tab->url().toString() : title; + QString tabTitle = emptyTitle ? tab->url().url() : title; tabTitle.replace('&', "&&"); int index = indexOf(tab); @@ -405,7 +405,7 @@ void TabWindow::closeTab(int index, bool del) const int recentlyClosedTabsLimit = 8; TabHistory history(tabToClose->page()->history()); history.title = tabToClose->title(); - history.url = tabToClose->url().toString(); + history.url = tabToClose->url().url(); m_recentlyClosedTabs.removeAll(history); if (m_recentlyClosedTabs.count() == recentlyClosedTabsLimit) 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 |