diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-10-21 12:06:52 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-12-10 02:48:05 +0100 |
commit | 0f9594f7c43f0b86c634e6f4e92b14fc9783bfee (patch) | |
tree | 8caf0c827fc9933edb3be56e790b9355f3014f70 /src/webtab | |
parent | enable webapp mode by calling "rekonq --webapp URL" :D (diff) | |
download | rekonq-0f9594f7c43f0b86c634e6f4e92b14fc9783bfee.tar.xz |
Fix new page creation on blank target url click
Diffstat (limited to 'src/webtab')
-rw-r--r-- | src/webtab/protocolhandler.cpp | 8 | ||||
-rw-r--r-- | src/webtab/protocolhandler.h | 6 | ||||
-rw-r--r-- | src/webtab/webpage.cpp | 19 | ||||
-rw-r--r-- | src/webtab/webpage.h | 2 | ||||
-rw-r--r-- | src/webtab/webview.cpp | 13 | ||||
-rw-r--r-- | src/webtab/webview.h | 3 |
6 files changed, 33 insertions, 18 deletions
diff --git a/src/webtab/protocolhandler.cpp b/src/webtab/protocolhandler.cpp index 26fd481a..dcf9d1a4 100644 --- a/src/webtab/protocolhandler.cpp +++ b/src/webtab/protocolhandler.cpp @@ -32,7 +32,6 @@ // Local Includes #include "historymanager.h" -#include "webwindow.h" #include "webpage.h" #include "webtab.h" #include "urlbar.h" @@ -97,7 +96,7 @@ ProtocolHandler::ProtocolHandler(QObject *parent) } -void ProtocolHandler::setWindow(WebWindow *w) +void ProtocolHandler::setWindow(QWidget *w) { _webwin = w; _lister->setMainWindow(_webwin); @@ -275,8 +274,9 @@ void ProtocolHandler::showResults(const KFileItemList &list) _frame->setHtml(html); qobject_cast<WebPage *>(_frame->page())->setIsOnRekonqPage(true); - _webwin->urlBar()->setQUrl(_url); - _webwin->view()->setFocus(); + // FIXME: how can we handle this? +// _webwin->urlBar()->setQUrl(_url); +// _webwin->view()->setFocus(); if (_frame->page()->settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) return; diff --git a/src/webtab/protocolhandler.h b/src/webtab/protocolhandler.h index 7d685ea4..83d2e81c 100644 --- a/src/webtab/protocolhandler.h +++ b/src/webtab/protocolhandler.h @@ -38,8 +38,6 @@ #include <QObject> // Forward Declarations -class WebWindow; - class KDirLister; class KFileItemList; class KJob; @@ -67,7 +65,7 @@ public: */ bool postHandling(const QNetworkRequest &request, QWebFrame *frame); - void setWindow(WebWindow *); + void setWindow(QWidget *); Q_SIGNALS: void downloadUrl(const KUrl &); @@ -83,7 +81,7 @@ private: QWebFrame *_frame; KUrl _url; - WebWindow *_webwin; + QWidget *_webwin; }; #endif // PROTOCOL_HANDLER_H diff --git a/src/webtab/webpage.cpp b/src/webtab/webpage.cpp index 93d59d90..a30ca804 100644 --- a/src/webtab/webpage.cpp +++ b/src/webtab/webpage.cpp @@ -129,11 +129,6 @@ WebPage::WebPage(QWidget *parent) , _networkAnalyzer(false) , _isOnRekonqPage(false) { - WebView *view = qobject_cast<WebView *>(parent); - WebTab *tab = qobject_cast<WebTab *>(view->parent()); - WebWindow *w = tab->webWindow(); - _protHandler.setWindow(w); - // handling unsupported content... setForwardUnsupportedContent(true); connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(handleUnsupportedContent(QNetworkReply*))); @@ -147,10 +142,6 @@ WebPage::WebPage(QWidget *parent) // disable QtWebKit cache to just use KIO one.. manager->setCache(0); - // set cookieJar window.. - if (parent && parent->window()) - manager->setWindow(parent->window()); - setNetworkAccessManager(manager); // activate ssl warnings @@ -184,6 +175,16 @@ WebPage::~WebPage() } +void WebPage::setWindow(QWidget *w) +{ + // set cookieJar window.. + NetworkAccessManager *manager = qobject_cast<NetworkAccessManager *>(networkAccessManager()); + manager->setWindow(w); + + _protHandler.setWindow(w); +} + + bool WebPage::isOnRekonqPage() const { return _isOnRekonqPage; diff --git a/src/webtab/webpage.h b/src/webtab/webpage.h index 1985e047..96cc5634 100644 --- a/src/webtab/webpage.h +++ b/src/webtab/webpage.h @@ -52,6 +52,8 @@ public: explicit WebPage(QWidget *parent = 0); ~WebPage(); + void setWindow(QWidget *); + bool isOnRekonqPage() const; void setIsOnRekonqPage(bool b); diff --git a/src/webtab/webview.cpp b/src/webtab/webview.cpp index df4af0b3..bb90a58a 100644 --- a/src/webtab/webview.cpp +++ b/src/webtab/webview.cpp @@ -158,6 +158,19 @@ WebPage *WebView::page() } +void WebView::setPage(WebPage *pg) +{ + KWebView::setPage(pg); + + WebTab *tab = qobject_cast<WebTab *>(parent()); + if (!tab) + return; + WebWindow *w = tab->webWindow(); + if (w && w->window()) + pg->setWindow(w->window()); +} + + bool WebView::popupSpellMenu(QContextMenuEvent *event) { // return false if not handled diff --git a/src/webtab/webview.h b/src/webtab/webview.h index ba4c0df4..2ff877e1 100644 --- a/src/webtab/webview.h +++ b/src/webtab/webview.h @@ -66,7 +66,8 @@ public: ~WebView(); WebPage *page(); - + void setPage(WebPage *); + void load(const QUrl &url); void load(const QNetworkRequest &req, QNetworkAccessManager::Operation op = QNetworkAccessManager::GetOperation, |