From 92721449c05d3496fe105317c9472f80c8b4c372 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 20 Apr 2019 19:26:00 +0200 Subject: [PATCH 1/2] VerticalTabs: Also override Ctrl+PgUp/PgDown shortcuts --- .../VerticalTabs/verticaltabscontroller.cpp | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/plugins/VerticalTabs/verticaltabscontroller.cpp b/src/plugins/VerticalTabs/verticaltabscontroller.cpp index b782c6db0..7135175e5 100644 --- a/src/plugins/VerticalTabs/verticaltabscontroller.cpp +++ b/src/plugins/VerticalTabs/verticaltabscontroller.cpp @@ -56,18 +56,53 @@ QWidget *VerticalTabsController::createSideBarWidget(BrowserWindow *window) bool VerticalTabsController::handleKeyPress(QKeyEvent *event, TabWidget *tabWidget) { - if (event->key() == Qt::Key_Tab && event->modifiers() == Qt::ControlModifier) { + auto switchToNextTab = [=]() { VerticalTabsWidget *widget = m_widgets.value(tabWidget->browserWindow()); if (widget) { widget->switchToNextTab(); return true; } - } else if (event->key() == Qt::Key_Backtab && event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { + return false; + }; + + auto switchToPreviousTab = [=]() { VerticalTabsWidget *widget = m_widgets.value(tabWidget->browserWindow()); if (widget) { widget->switchToPreviousTab(); return true; } + return false; + }; + + switch (event->key()) { + case Qt::Key_Tab: + case Qt::Key_PageDown: + if (event->modifiers() == Qt::ControlModifier) { + if (switchToNextTab()) { + return true; + } + } + break; + + case Qt::Key_Backtab: + if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { + if (switchToPreviousTab()) { + return true; + } + } + break; + + case Qt::Key_PageUp: + if (event->modifiers() == Qt::ControlModifier) { + if (switchToPreviousTab()) { + return true; + } + } + break; + + default: + break; } + return false; } From f38265230de9a3355e9a16f9081b6692e02c7886 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 21 Apr 2019 11:21:29 +0200 Subject: [PATCH 2/2] SideBarManager: Clear active sidebar upon close BUG: 406724 FIXED-IN: 3.1.1 --- src/lib/sidebar/sidebar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/sidebar/sidebar.cpp b/src/lib/sidebar/sidebar.cpp index 4e1a991ef..5b2fa1850 100644 --- a/src/lib/sidebar/sidebar.cpp +++ b/src/lib/sidebar/sidebar.cpp @@ -166,6 +166,10 @@ void SideBarManager::showSideBar(const QString &id, bool toggle) if (!m_sideBar) { m_sideBar = m_window->addSideBar(); + connect(m_sideBar, &QObject::destroyed, this, [this]() { + m_activeBar.clear(); + m_window->saveSideBarSettings(); + }); } if (id == m_activeBar) {