mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +01:00
VerticalTabs: Override Alt+9 keyboard shortcut
Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
949af4dc81
commit
ff31c58c05
@ -725,6 +725,11 @@ TabMruModel *BrowserWindow::tabMruModel() const
|
|||||||
return m_tabMruModel;
|
return m_tabMruModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BrowserWindow::useTabNumberShortcuts() const
|
||||||
|
{
|
||||||
|
return m_useTabNumberShortcuts;
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserWindow::setWindowTitle(const QString &t)
|
void BrowserWindow::setWindowTitle(const QString &t)
|
||||||
{
|
{
|
||||||
QString title = t;
|
QString title = t;
|
||||||
|
@ -125,6 +125,8 @@ public:
|
|||||||
TabModel *tabModel() const;
|
TabModel *tabModel() const;
|
||||||
TabMruModel *tabMruModel() const;
|
TabMruModel *tabMruModel() const;
|
||||||
|
|
||||||
|
bool useTabNumberShortcuts() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void startingCompleted();
|
void startingCompleted();
|
||||||
void aboutToClose();
|
void aboutToClose();
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "verticaltabsplugin.h"
|
#include "verticaltabsplugin.h"
|
||||||
#include "verticaltabswidget.h"
|
#include "verticaltabswidget.h"
|
||||||
|
|
||||||
|
#include "browserwindow.h"
|
||||||
#include "tabwidget.h"
|
#include "tabwidget.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
@ -100,6 +101,16 @@ bool VerticalTabsController::handleKeyPress(QKeyEvent *event, TabWidget *tabWidg
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Qt::Key_9:
|
||||||
|
if ((event->modifiers() & Qt::AltModifier) && tabWidget->browserWindow()->useTabNumberShortcuts()) {
|
||||||
|
VerticalTabsWidget *widget = m_widgets.value(tabWidget->browserWindow());
|
||||||
|
if (widget) {
|
||||||
|
widget->switchToLastTab();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,14 @@ void VerticalTabsWidget::switchToPreviousTab()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VerticalTabsWidget::switchToLastTab()
|
||||||
|
{
|
||||||
|
WebTab *tab = lastTab();
|
||||||
|
if (tab) {
|
||||||
|
tab->makeCurrentTab();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WebTab *VerticalTabsWidget::nextTab() const
|
WebTab *VerticalTabsWidget::nextTab() const
|
||||||
{
|
{
|
||||||
QModelIndex next;
|
QModelIndex next;
|
||||||
@ -158,6 +166,20 @@ WebTab *VerticalTabsWidget::previousTab() const
|
|||||||
return previous.data(TabModel::WebTabRole).value<WebTab*>();
|
return previous.data(TabModel::WebTabRole).value<WebTab*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebTab * VerticalTabsWidget::lastTab() const
|
||||||
|
{
|
||||||
|
QModelIndex last;
|
||||||
|
auto rows = m_normalView->model()->rowCount();
|
||||||
|
if (rows > 0) {
|
||||||
|
last = m_normalView->model()->index(rows - 1, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
last = m_pinnedView->model()->index(m_pinnedView->model()->rowCount(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return last.data(TabModel::WebTabRole).value<WebTab*>();
|
||||||
|
}
|
||||||
|
|
||||||
void VerticalTabsWidget::wheelEvent(QWheelEvent *event)
|
void VerticalTabsWidget::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (!qzSettings->alwaysSwitchTabsWithWheel && m_normalView->verticalScrollBar()->isVisible()) {
|
if (!qzSettings->alwaysSwitchTabsWithWheel && m_normalView->verticalScrollBar()->isVisible()) {
|
||||||
|
@ -42,12 +42,14 @@ public:
|
|||||||
|
|
||||||
void switchToNextTab();
|
void switchToNextTab();
|
||||||
void switchToPreviousTab();
|
void switchToPreviousTab();
|
||||||
|
void switchToLastTab();
|
||||||
|
|
||||||
void addChildTab();
|
void addChildTab();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WebTab *nextTab() const;
|
WebTab *nextTab() const;
|
||||||
WebTab *previousTab() const;
|
WebTab *previousTab() const;
|
||||||
|
WebTab *lastTab() const;
|
||||||
|
|
||||||
void wheelEvent(QWheelEvent *event) override;
|
void wheelEvent(QWheelEvent *event) override;
|
||||||
void updateGroupMenu();
|
void updateGroupMenu();
|
||||||
|
Loading…
Reference in New Issue
Block a user