1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

WebView: Shift modifier for inverting preferred new tab position.

- Shift + MiddleMouseClick and Ctrl + Shift + LeftMouseClick
This commit is contained in:
nowrep 2012-07-03 11:28:14 +02:00
parent dda70eef32
commit 193a9371f0
3 changed files with 13 additions and 8 deletions

View File

@ -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<QAction*>(sender())) { if (QAction* action = qobject_cast<QAction*>(sender())) {
openUrlInNewTab(action->data().toUrl(), WebSettings::newTabPosition); openUrlInNewTab(action->data().toUrl(), position);
} }
else { else {
openUrlInNewTab(url, WebSettings::newTabPosition); openUrlInNewTab(url, position);
} }
} }
@ -991,8 +996,8 @@ void WebView::mousePressEvent(QMouseEvent* event)
QWebFrame* frame = page()->frameAt(event->pos()); QWebFrame* frame = page()->frameAt(event->pos());
if (frame) { if (frame) {
const QUrl &link = frame->hitTestContent(event->pos()).linkUrl(); const QUrl &link = frame->hitTestContent(event->pos()).linkUrl();
if (event->modifiers() == Qt::ControlModifier && isUrlValid(link)) { if (event->modifiers() & Qt::ControlModifier && isUrlValid(link)) {
userDefinedOpenUrlInNewTab(link); userDefinedOpenUrlInNewTab(link, event->modifiers() & Qt::ShiftModifier);
event->accept(); event->accept();
return; return;
} }
@ -1018,7 +1023,7 @@ void WebView::mouseReleaseEvent(QMouseEvent* event)
if (frame) { if (frame) {
const QUrl &link = frame->hitTestContent(event->pos()).linkUrl(); const QUrl &link = frame->hitTestContent(event->pos()).linkUrl();
if (m_clickedUrl == link && isUrlValid(link)) { if (m_clickedUrl == link && isUrlValid(link)) {
userDefinedOpenUrlInNewTab(link); userDefinedOpenUrlInNewTab(link, event->modifiers() & Qt::ShiftModifier);
event->accept(); event->accept();
return; return;
} }

View File

@ -104,7 +104,7 @@ protected slots:
void openUrlInBackgroundTab(); void openUrlInBackgroundTab();
// To support user's option whether to open in selected or background tab // 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(); void createSearchEngine();

View File

@ -10,7 +10,7 @@ $menu_download = "Pobierz";
$menu_faq = "FAQ"; $menu_faq = "FAQ";
$menu_about = "Przyczyń się"; $menu_about = "Przyczyń się";
$footer_site = "www.qupzilla.com"; $footer_site = "www.qupzilla.com";
$translated_by = "Mariusz Fik <fisiu(at)opensuse.org"; // "Page translated by <translator's name>" $translated_by = "Page translated by Mariusz Fik"; // "Page translated by <translator's name>"
//Home Page //Home Page
$actual_version = "Aktualna Wersja"; $actual_version = "Aktualna Wersja";