diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-03-31 02:02:15 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-03-31 02:02:15 +0200 |
commit | 6d7c51718b098d81d19719376d91c9a97285a48f (patch) | |
tree | a37573c842e00ecefa385abc1e8ea172451ef0d6 /src/webview.cpp | |
parent | Properly opening mailto links (diff) | |
download | rekonq-6d7c51718b098d81d19719376d91c9a97285a48f.tar.xz |
Rewritten acceptNavigationRequest code
Diffstat (limited to 'src/webview.cpp')
-rw-r--r-- | src/webview.cpp | 67 |
1 files 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); |