1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Merge branch 'Falkon/3.1'

This commit is contained in:
David Rosca 2019-04-22 09:50:50 +02:00
commit ee4dbad676
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 41 additions and 2 deletions

View File

@ -166,6 +166,10 @@ void SideBarManager::showSideBar(const QString &id, bool toggle)
if (!m_sideBar) { if (!m_sideBar) {
m_sideBar = m_window->addSideBar(); m_sideBar = m_window->addSideBar();
connect(m_sideBar, &QObject::destroyed, this, [this]() {
m_activeBar.clear();
m_window->saveSideBarSettings();
});
} }
if (id == m_activeBar) { if (id == m_activeBar) {

View File

@ -56,18 +56,53 @@ QWidget *VerticalTabsController::createSideBarWidget(BrowserWindow *window)
bool VerticalTabsController::handleKeyPress(QKeyEvent *event, TabWidget *tabWidget) 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()); VerticalTabsWidget *widget = m_widgets.value(tabWidget->browserWindow());
if (widget) { if (widget) {
widget->switchToNextTab(); widget->switchToNextTab();
return true; 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()); VerticalTabsWidget *widget = m_widgets.value(tabWidget->browserWindow());
if (widget) { if (widget) {
widget->switchToPreviousTab(); widget->switchToPreviousTab();
return true; 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; return false;
} }