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

Added option to disable Alt/Ctrl + numbers shortcuts

Closes #647
This commit is contained in:
nowrep 2012-11-28 11:27:30 +01:00
parent 0a2dbc83a0
commit 85d09c8a64
8 changed files with 91 additions and 21 deletions

View File

@ -998,16 +998,18 @@ void MainApplication::clearTempPath()
QString path = PROFILEDIR + "tmp/"; QString path = PROFILEDIR + "tmp/";
QDir dir(path); QDir dir(path);
if (dir.exists()) if (dir.exists()) {
qz_removeDir(path); qz_removeDir(path);
}
} }
QString MainApplication::tempPath() const QString MainApplication::tempPath() const
{ {
QString path = PROFILEDIR + "tmp/"; QString path = PROFILEDIR + "tmp/";
QDir dir(path); QDir dir(path);
if (!dir.exists()) if (!dir.exists()) {
dir.mkdir(path); dir.mkdir(path);
}
return path; return path;
} }

View File

@ -582,7 +582,12 @@ void QupZilla::loadSettings()
m_webViewWidth = settings.value("WebViewWidth", 2000).toInt(); m_webViewWidth = settings.value("WebViewWidth", 2000).toInt();
const QString &activeSideBar = settings.value("SideBar", "None").toString(); const QString &activeSideBar = settings.value("SideBar", "None").toString();
settings.endGroup(); settings.endGroup();
settings.beginGroup("Shortcuts");
m_useTabNumberShortcuts = settings.value("useTabNumberShortcuts", true).toBool();
m_useSpeedDialNumberShortcuts = settings.value("useSpeedDialNumberShortcuts", true).toBool();
bool adBlockEnabled = settings.value("AdBlock/enabled", true).toBool(); bool adBlockEnabled = settings.value("AdBlock/enabled", true).toBool();
settings.endGroup();
m_adblockIcon->setEnabled(adBlockEnabled); m_adblockIcon->setEnabled(adBlockEnabled);
@ -1727,14 +1732,14 @@ void QupZilla::keyPressEvent(QKeyEvent* event)
} }
if (number != -1) { if (number != -1) {
if (event->modifiers() & Qt::AltModifier) { if (event->modifiers() & Qt::AltModifier && m_useTabNumberShortcuts) {
if (number == 9) { if (number == 9) {
number = m_tabWidget->count(); number = m_tabWidget->count();
} }
m_tabWidget->setCurrentIndex(number - 1); m_tabWidget->setCurrentIndex(number - 1);
return; return;
} }
if (event->modifiers() & Qt::ControlModifier) { if (event->modifiers() & Qt::ControlModifier && m_useSpeedDialNumberShortcuts) {
const QUrl &url = mApp->plugins()->speedDial()->urlForShortcut(number - 1); const QUrl &url = mApp->plugins()->speedDial()->urlForShortcut(number - 1);
if (url.isValid()) { if (url.isValid()) {
loadAddress(url); loadAddress(url);

View File

@ -283,8 +283,12 @@ private:
int m_webViewWidth; int m_webViewWidth;
bool m_usingTransparentBackground; bool m_usingTransparentBackground;
//Used for F11 FullScreen remember visibility // Shortcuts
//of menubar and statusbar bool m_useTabNumberShortcuts;
bool m_useSpeedDialNumberShortcuts;
// Used for F11 FullScreen remember visibility
// of menubar and statusbar
bool m_menuBarVisible; bool m_menuBarVisible;
bool m_statusBarVisible; bool m_statusBarVisible;
bool m_navigationVisible; bool m_navigationVisible;

View File

@ -68,5 +68,6 @@
<file>icons/sites/wikipedia.png</file> <file>icons/sites/wikipedia.png</file>
<file>icons/sites/yahoo.png</file> <file>icons/sites/yahoo.png</file>
<file>icons/sites/youtube.png</file> <file>icons/sites/youtube.png</file>
<file>icons/preferences/preferences-desktop-keyboard-shortcuts.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -66,12 +66,13 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png"))); ui->listWidget->item(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png")));
ui->listWidget->item(3)->setIcon(QIcon::fromTheme("preferences-system-network", QIcon(":/icons/preferences/applications-webbrowsers.png"))); ui->listWidget->item(3)->setIcon(QIcon::fromTheme("preferences-system-network", QIcon(":/icons/preferences/applications-webbrowsers.png")));
ui->listWidget->item(4)->setIcon(QIcon::fromTheme("preferences-desktop-font", QIcon(":/icons/preferences/applications-fonts.png"))); ui->listWidget->item(4)->setIcon(QIcon::fromTheme("preferences-desktop-font", QIcon(":/icons/preferences/applications-fonts.png")));
ui->listWidget->item(5)->setIcon(QIcon::fromTheme("download", QIcon(":/icons/preferences/mail-inbox.png"))); ui->listWidget->item(5)->setIcon(QIcon::fromTheme("preferences-desktop-keyboard-shortcuts", QIcon(":/icons/preferences/preferences-desktop-keyboard-shortcuts.png")));
ui->listWidget->item(6)->setIcon(QIcon::fromTheme("user-identity", QIcon(":/icons/preferences/dialog-password.png"))); ui->listWidget->item(6)->setIcon(QIcon::fromTheme("download", QIcon(":/icons/preferences/mail-inbox.png")));
ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png"))); ui->listWidget->item(7)->setIcon(QIcon::fromTheme("user-identity", QIcon(":/icons/preferences/dialog-password.png")));
ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-desktop-notification", QIcon(":/icons/preferences/dialog-question.png"))); ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
ui->listWidget->item(9)->setIcon(QIcon::fromTheme("preferences-plugin", QIcon(":/icons/preferences/extension.png"))); ui->listWidget->item(9)->setIcon(QIcon::fromTheme("preferences-desktop-notification", QIcon(":/icons/preferences/dialog-question.png")));
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png"))); ui->listWidget->item(10)->setIcon(QIcon::fromTheme("preferences-plugin", QIcon(":/icons/preferences/extension.png")));
ui->listWidget->item(11)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
} }
else { else {
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png"))); ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
@ -79,12 +80,13 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("applications-internet", QIcon(":/icons/preferences/applications-internet.png"))); ui->listWidget->item(2)->setIcon(QIcon::fromTheme("applications-internet", QIcon(":/icons/preferences/applications-internet.png")));
ui->listWidget->item(3)->setIcon(QIcon::fromTheme("applications-webbrowsers", QIcon(":/icons/preferences/applications-webbrowsers.png"))); ui->listWidget->item(3)->setIcon(QIcon::fromTheme("applications-webbrowsers", QIcon(":/icons/preferences/applications-webbrowsers.png")));
ui->listWidget->item(4)->setIcon(QIcon::fromTheme("applications-fonts", QIcon(":/icons/preferences/applications-fonts.png"))); ui->listWidget->item(4)->setIcon(QIcon::fromTheme("applications-fonts", QIcon(":/icons/preferences/applications-fonts.png")));
ui->listWidget->item(5)->setIcon(QIcon::fromTheme("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png"))); ui->listWidget->item(5)->setIcon(QIcon::fromTheme("preferences-desktop-keyboard-shortcuts", QIcon(":/icons/preferences/preferences-desktop-keyboard-shortcuts.png")));
ui->listWidget->item(6)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png"))); ui->listWidget->item(6)->setIcon(QIcon::fromTheme("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png")));
ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png"))); ui->listWidget->item(7)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
ui->listWidget->item(8)->setIcon(QIcon::fromTheme("dialog-question", QIcon(":/icons/preferences/dialog-question.png"))); ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
ui->listWidget->item(9)->setIcon(QIcon::fromTheme("extension", QIcon(":/icons/preferences/extension.png"))); ui->listWidget->item(9)->setIcon(QIcon::fromTheme("dialog-question", QIcon(":/icons/preferences/dialog-question.png")));
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png"))); ui->listWidget->item(10)->setIcon(QIcon::fromTheme("extension", QIcon(":/icons/preferences/extension.png")));
ui->listWidget->item(11)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
} }
Settings settings; Settings settings;
@ -326,6 +328,12 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", mApp->webSettings()->fontSize(QWebSettings::MinimumLogicalFontSize)).toInt()); ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", mApp->webSettings()->fontSize(QWebSettings::MinimumLogicalFontSize)).toInt());
settings.endGroup(); settings.endGroup();
//KEYBOARD SHORTCUTS
settings.beginGroup("Shortcuts");
ui->switchTabsAlt->setChecked(settings.value("useTabNumberShortcuts", true).toBool());
ui->loadSpeedDialsCtrl->setChecked(settings.value("useSpeedDialNumberShortcuts", true).toBool());
settings.endGroup();
//PLUGINS //PLUGINS
m_pluginsList = new PluginsManager(this); m_pluginsList = new PluginsManager(this);
ui->pluginsFrame->addWidget(m_pluginsList); ui->pluginsFrame->addWidget(m_pluginsList);
@ -837,6 +845,12 @@ void Preferences::saveSettings()
settings.setValue("MinimumLogicalFontSize", ui->sizeMinimumLogical->value()); settings.setValue("MinimumLogicalFontSize", ui->sizeMinimumLogical->value());
settings.endGroup(); settings.endGroup();
//KEYBOARD SHORTCUTS
settings.beginGroup("Shortcuts");
settings.setValue("useTabNumberShortcuts", ui->switchTabsAlt->isChecked());
settings.setValue("useSpeedDialNumberShortcuts", ui->loadSpeedDialsCtrl->isChecked());
settings.endGroup();
//BROWSING //BROWSING
settings.beginGroup("Web-Browser-Settings"); settings.beginGroup("Web-Browser-Settings");
settings.setValue("allowFlash", ui->allowPlugins->isChecked()); settings.setValue("allowFlash", ui->allowPlugins->isChecked());

View File

@ -117,6 +117,11 @@
<string>Fonts</string> <string>Fonts</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Keyboard Shortcuts</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>Downloads</string> <string>Downloads</string>
@ -155,7 +160,7 @@
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>5</number>
</property> </property>
<widget class="QWidget" name="stackedWidgetPage1"> <widget class="QWidget" name="stackedWidgetPage1">
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
@ -1705,6 +1710,44 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="page_4">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>&lt;b&gt;Shortcuts&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_13">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="switchTabsAlt">
<property name="text">
<string>Switch to tabs with Alt + number of tab</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="loadSpeedDialsCtrl">
<property name="text">
<string>Load speed dials with Ctrl + number of speed dial</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="downloadPage"> <widget class="QWidget" name="downloadPage">
<layout class="QGridLayout" name="gridLayout_10"> <layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0" colspan="4"> <item row="0" column="0" colspan="4">

View File

@ -380,14 +380,15 @@ void WebView::slotIconChanged()
void WebView::slotUrlChanged(const QUrl &url) void WebView::slotUrlChanged(const QUrl &url)
{ {
static QStringList exceptions; static QStringList exceptions;
if (exceptions.isEmpty()) if (exceptions.isEmpty()) {
exceptions << "google." << "twitter."; exceptions << "google." << "twitter.";
}
// Disable touch mocking on pages known not to work properly // Disable touch mocking on pages known not to work properly
const QString &host = url.host(); const QString &host = url.host();
m_disableTouchMocking = false; m_disableTouchMocking = false;
foreach (const QString &site, exceptions) { foreach(const QString & site, exceptions) {
if (host.contains(site)) { if (host.contains(site)) {
m_disableTouchMocking = true; m_disableTouchMocking = true;
} }