From 6d7c51718b098d81d19719376d91c9a97285a48f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 31 Mar 2009 02:02:15 +0200 Subject: Rewritten acceptNavigationRequest code --- src/webview.cpp | 67 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/src/webview.cpp b/src/webview.cpp index c3ad49b3..0e9a3c9d 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -86,9 +86,12 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r return false; } - // ctrl open in new tab and select - if (type == QWebPage::NavigationTypeLinkClicked) + switch(type) { + + // user clicked on a link or pressed return on a focused link. + case QWebPage::NavigationTypeLinkClicked: + kWarning() << "Navigation Type LINKCLICKED.."; if(m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) @@ -101,25 +104,51 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r m_pressedButtons = Qt::NoButton; return false; } - } - - if (frame == mainFrame()) - { - m_loadingUrl = request.url(); - emit loadingUrl(m_loadingUrl); - } - else - { - kWarning() << "NO Main Frame, creating a new WebView.."; - WebView *webView = Application::instance()->newWebView(); - webView->setFocus(); - webView->load(request); - return false; - } - if(type == QWebPage::NavigationTypeOther) - { + if (frame == mainFrame()) + { + m_loadingUrl = request.url(); + emit loadingUrl(m_loadingUrl); + } + else + { + kWarning() << "NO Main Frame, creating a new WebView.."; + WebView *webView = Application::instance()->newWebView(); + webView->setFocus(); + webView->load(request); + return false; + } + break; + + // user activated a submit button for an HTML form. + case QWebPage::NavigationTypeFormSubmitted: + kWarning() << "Navigation Type Form Submitted.."; + break; + + // Navigation to a previously shown document in the back or forward history is requested. + case QWebPage::NavigationTypeBackOrForward: + kWarning() << "Navigation Type BackOrForward.."; + break; + + // user activated the reload action. + case QWebPage::NavigationTypeReload: + kWarning() << "Navigation Type Reload.."; + break; + + // An HTML form was submitted a second time. + case QWebPage::NavigationTypeFormResubmitted: + kWarning() << "Navigation Type Form Resubmitted.."; + break; + + // A navigation to another document using a method not listed above. + case QWebPage::NavigationTypeOther: kWarning() << "Navigation Type OTHER.."; + break; + + // should be nothing.. + default: + kWarning() << "Default NON existant case.."; + break; } return QWebPage::acceptNavigationRequest(frame, request, type); -- cgit v1.2.1