summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-05-04 11:17:12 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-05-04 11:17:12 +0200
commitfa45fb2d3811f52040a39281ed3ad864c05cc8b9 (patch)
treef258be0faafe613b6270623edcbaddf026df5185
parentFixing opening window resizing and removing menubar & toolbar. (diff)
downloadrekonq-fa45fb2d3811f52040a39281ed3ad864c05cc8b9.tar.xz
new (and simpler) createWindow implementation..
this solves (A-LA rekonq) also kde-apps preview screenshots
-rw-r--r--src/webview.cpp45
-rw-r--r--src/webview.h1
2 files changed, 21 insertions, 25 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index 5f42112b..8722dd58 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -56,7 +56,6 @@ WebPage::WebPage(QObject *parent)
: QWebPage(parent)
, m_keyboardModifiers(Qt::NoModifier)
, m_pressedButtons(Qt::NoButton)
- , m_openInNewTab(false)
{
setNetworkAccessManager(Application::networkAccessManager());
@@ -84,9 +83,15 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
switch (type)
{
- // user clicked on a link or pressed return on a focused link.
+ // A navigation to another document using a method not listed above.
+ case QWebPage::NavigationTypeOther:
+ kDebug() << "NavigationTypeOther";
+
+ // user clicked on a link or pressed return on a focused link.
case QWebPage::NavigationTypeLinkClicked:
+ kDebug() << "NavigationTypeLinkClicked";
+
if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
{
webView = Application::instance()->newWebView();
@@ -117,14 +122,17 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
// user activated a submit button for an HTML form.
case QWebPage::NavigationTypeFormSubmitted:
+ kDebug() << "NavigationTypeFormSubmitted";
break;
// Navigation to a previously shown document in the back or forward history is requested.
case QWebPage::NavigationTypeBackOrForward:
+ kDebug() << "NavigationTypeBackOrForward";
break;
// user activated the reload action.
case QWebPage::NavigationTypeReload:
+ kDebug() << "NavigationTypeReload";
#if QT_VERSION <= 040500
// HACK Ported from Arora
@@ -133,6 +141,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
// See: https://bugs.webkit.org/show_bug.cgi?id=24283
if (qApp->keyboardModifiers() & Qt::ShiftModifier)
{
+ kDebug() << "Arora hack";
QNetworkRequest newRequest(request);
newRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute,
QNetworkRequest::AlwaysNetwork);
@@ -145,10 +154,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
// An HTML form was submitted a second time.
case QWebPage::NavigationTypeFormResubmitted:
- break;
-
- // A navigation to another document using a method not listed above.
- case QWebPage::NavigationTypeOther:
+ kDebug() << "NavigationTypeFormResubmitted";
break;
// should be nothing..
@@ -162,29 +168,17 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
QWebPage *WebPage::createWindow(QWebPage::WebWindowType type)
{
+ kDebug() << "creating window as new tabs.. ";
+
// added to manage web modal dialogs
if (type == QWebPage::WebModalDialog)
{
// FIXME : need a "real" implementation..
- kWarning() << "Modal Dialog ---------------------------------------";
- QWebView *w = new QWebView();
- w->show();
- return w->page();
+ kDebug() << "Modal Dialog ---------------------------------------";
}
- if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
- {
- m_openInNewTab = true;
- }
-
- if (m_openInNewTab)
- {
- m_openInNewTab = false;
- return Application::instance()->newWebView()->page();
- }
-
- MainWindow *mainWindow = Application::instance()->mainWindow();
- return mainWindow->currentTab()->page();
+ WebView *w = Application::instance()->newWebView();
+ return w->page();
}
@@ -230,6 +224,10 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
KUrl srcUrl = reply->url();
Application::downloadManager()->newDownload(srcUrl);
}
+ else
+ {
+ kDebug() << "invalid content type header";
+ }
return;
}
@@ -439,7 +437,6 @@ void WebView::wheelEvent(QWheelEvent *event)
void WebView::openLinkInNewTab()
{
- m_page->m_openInNewTab = true;
pageAction(QWebPage::OpenLinkInNewWindow)->trigger();
}
diff --git a/src/webview.h b/src/webview.h
index 11f04571..1d07beac 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -75,7 +75,6 @@ private:
// set the webview mousepressedevent
Qt::KeyboardModifiers m_keyboardModifiers;
Qt::MouseButtons m_pressedButtons;
- bool m_openInNewTab;
KUrl m_loadingUrl;
};