1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Merge pull request #1282 from kdave/single-key-shortcut-v2

[BrowserWindow] Enable single key shortcuts
This commit is contained in:
David Rosca 2014-04-07 15:42:52 +02:00
commit 4c812557f6
4 changed files with 18 additions and 1 deletions

View File

@ -407,6 +407,7 @@ void BrowserWindow::loadSettings()
settings.beginGroup("Shortcuts");
m_useTabNumberShortcuts = settings.value("useTabNumberShortcuts", true).toBool();
m_useSpeedDialNumberShortcuts = settings.value("useSpeedDialNumberShortcuts", true).toBool();
m_useSingleKeyShortcuts = settings.value("useSingleKeyShortcuts", false).toBool();
settings.endGroup();
m_adblockIcon->setEnabled(settings.value("AdBlock/enabled", true).toBool());
@ -1331,6 +1332,12 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event)
return;
}
}
if (event->modifiers() == Qt::NoModifier && m_useSingleKeyShortcuts) {
if (number == 1)
m_tabWidget->previousTab();
if (number == 2)
m_tabWidget->nextTab();
}
}
QMainWindow::keyPressEvent(event);

View File

@ -207,6 +207,7 @@ private:
// Shortcuts
bool m_useTabNumberShortcuts;
bool m_useSpeedDialNumberShortcuts;
bool m_useSingleKeyShortcuts;
// Remember visibility of menubar and statusbar after entering Fullscreen
bool m_menuBarVisible;

View File

@ -380,6 +380,7 @@ Preferences::Preferences(BrowserWindow* window, QWidget* parent)
settings.beginGroup("Shortcuts");
ui->switchTabsAlt->setChecked(settings.value("useTabNumberShortcuts", true).toBool());
ui->loadSpeedDialsCtrl->setChecked(settings.value("useSpeedDialNumberShortcuts", true).toBool());
ui->singleKeyShortcuts->setChecked(settings.value("useSingleKeyShortcuts", false).toBool());
settings.endGroup();
//NOTIFICATIONS
@ -964,6 +965,7 @@ void Preferences::saveSettings()
settings.beginGroup("Shortcuts");
settings.setValue("useTabNumberShortcuts", ui->switchTabsAlt->isChecked());
settings.setValue("useSpeedDialNumberShortcuts", ui->loadSpeedDialsCtrl->isChecked());
settings.setValue("useSingleKeyShortcuts", ui->singleKeyShortcuts->isChecked());
settings.endGroup();
//BROWSING

View File

@ -1987,7 +1987,14 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="singleKeyShortcuts">
<property name="text">
<string>Use single key shortcuts (1 - prev tab, 2 - next tab)</string>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_13">
<property name="orientation">
<enum>Qt::Vertical</enum>