From 193a9371f0539bd844b0938f5d534f8ddadcc61a Mon Sep 17 00:00:00 2001 From: nowrep Date: Tue, 3 Jul 2012 11:28:14 +0200 Subject: [PATCH] WebView: Shift modifier for inverting preferred new tab position. - Shift + MiddleMouseClick and Ctrl + Shift + LeftMouseClick --- src/lib/webview/webview.cpp | 17 +++++++++++------ src/lib/webview/webview.h | 2 +- translations/homepage/pl_PL.php | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 2d428fc0e..88050a1d2 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -503,13 +503,18 @@ void WebView::openUrlInBackgroundTab() } } -void WebView::userDefinedOpenUrlInNewTab(const QUrl &url) +void WebView::userDefinedOpenUrlInNewTab(const QUrl &url, bool invert) { + Qz::NewTabPositionFlag position = WebSettings::newTabPosition; + if (invert) { + position = (position == Qz::NT_SelectedTab) ? Qz::NT_NotSelectedTab : Qz::NT_SelectedTab; + } + if (QAction* action = qobject_cast(sender())) { - openUrlInNewTab(action->data().toUrl(), WebSettings::newTabPosition); + openUrlInNewTab(action->data().toUrl(), position); } else { - openUrlInNewTab(url, WebSettings::newTabPosition); + openUrlInNewTab(url, position); } } @@ -991,8 +996,8 @@ void WebView::mousePressEvent(QMouseEvent* event) QWebFrame* frame = page()->frameAt(event->pos()); if (frame) { const QUrl &link = frame->hitTestContent(event->pos()).linkUrl(); - if (event->modifiers() == Qt::ControlModifier && isUrlValid(link)) { - userDefinedOpenUrlInNewTab(link); + if (event->modifiers() & Qt::ControlModifier && isUrlValid(link)) { + userDefinedOpenUrlInNewTab(link, event->modifiers() & Qt::ShiftModifier); event->accept(); return; } @@ -1018,7 +1023,7 @@ void WebView::mouseReleaseEvent(QMouseEvent* event) if (frame) { const QUrl &link = frame->hitTestContent(event->pos()).linkUrl(); if (m_clickedUrl == link && isUrlValid(link)) { - userDefinedOpenUrlInNewTab(link); + userDefinedOpenUrlInNewTab(link, event->modifiers() & Qt::ShiftModifier); event->accept(); return; } diff --git a/src/lib/webview/webview.h b/src/lib/webview/webview.h index 6f42595ff..cb2881966 100644 --- a/src/lib/webview/webview.h +++ b/src/lib/webview/webview.h @@ -104,7 +104,7 @@ protected slots: void openUrlInBackgroundTab(); // To support user's option whether to open in selected or background tab - void userDefinedOpenUrlInNewTab(const QUrl &url = QUrl()); + void userDefinedOpenUrlInNewTab(const QUrl &url = QUrl(), bool invert = false); void createSearchEngine(); diff --git a/translations/homepage/pl_PL.php b/translations/homepage/pl_PL.php index d73646ff6..2340ab7c7 100644 --- a/translations/homepage/pl_PL.php +++ b/translations/homepage/pl_PL.php @@ -10,7 +10,7 @@ $menu_download = "Pobierz"; $menu_faq = "FAQ"; $menu_about = "Przyczyń się"; $footer_site = "www.qupzilla.com"; -$translated_by = "Mariusz Fik " +$translated_by = "Page translated by Mariusz Fik"; // "Page translated by " //Home Page $actual_version = "Aktualna Wersja";