diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp
index 2ff9e9174..098a579f3 100644
--- a/src/lib/app/mainapplication.cpp
+++ b/src/lib/app/mainapplication.cpp
@@ -998,16 +998,18 @@ void MainApplication::clearTempPath()
QString path = PROFILEDIR + "tmp/";
QDir dir(path);
- if (dir.exists())
+ if (dir.exists()) {
qz_removeDir(path);
+ }
}
QString MainApplication::tempPath() const
{
QString path = PROFILEDIR + "tmp/";
QDir dir(path);
- if (!dir.exists())
+ if (!dir.exists()) {
dir.mkdir(path);
+ }
return path;
}
diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp
index 38c1e8fa5..693265e86 100644
--- a/src/lib/app/qupzilla.cpp
+++ b/src/lib/app/qupzilla.cpp
@@ -582,7 +582,12 @@ void QupZilla::loadSettings()
m_webViewWidth = settings.value("WebViewWidth", 2000).toInt();
const QString &activeSideBar = settings.value("SideBar", "None").toString();
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();
+ settings.endGroup();
m_adblockIcon->setEnabled(adBlockEnabled);
@@ -1727,14 +1732,14 @@ void QupZilla::keyPressEvent(QKeyEvent* event)
}
if (number != -1) {
- if (event->modifiers() & Qt::AltModifier) {
+ if (event->modifiers() & Qt::AltModifier && m_useTabNumberShortcuts) {
if (number == 9) {
number = m_tabWidget->count();
}
m_tabWidget->setCurrentIndex(number - 1);
return;
}
- if (event->modifiers() & Qt::ControlModifier) {
+ if (event->modifiers() & Qt::ControlModifier && m_useSpeedDialNumberShortcuts) {
const QUrl &url = mApp->plugins()->speedDial()->urlForShortcut(number - 1);
if (url.isValid()) {
loadAddress(url);
diff --git a/src/lib/app/qupzilla.h b/src/lib/app/qupzilla.h
index 9d27d73cb..908a3a585 100644
--- a/src/lib/app/qupzilla.h
+++ b/src/lib/app/qupzilla.h
@@ -283,8 +283,12 @@ private:
int m_webViewWidth;
bool m_usingTransparentBackground;
- //Used for F11 FullScreen remember visibility
- //of menubar and statusbar
+ // Shortcuts
+ bool m_useTabNumberShortcuts;
+ bool m_useSpeedDialNumberShortcuts;
+
+ // Used for F11 FullScreen remember visibility
+ // of menubar and statusbar
bool m_menuBarVisible;
bool m_statusBarVisible;
bool m_navigationVisible;
diff --git a/src/lib/data/icons.qrc b/src/lib/data/icons.qrc
index bf432a452..e27dec369 100644
--- a/src/lib/data/icons.qrc
+++ b/src/lib/data/icons.qrc
@@ -68,5 +68,6 @@
icons/sites/wikipedia.png
icons/sites/yahoo.png
icons/sites/youtube.png
+ icons/preferences/preferences-desktop-keyboard-shortcuts.png
diff --git a/src/lib/data/icons/preferences/preferences-desktop-keyboard-shortcuts.png b/src/lib/data/icons/preferences/preferences-desktop-keyboard-shortcuts.png
new file mode 100644
index 000000000..5b51639a3
Binary files /dev/null and b/src/lib/data/icons/preferences/preferences-desktop-keyboard-shortcuts.png differ
diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp
index 70fd400d0..e8e930288 100644
--- a/src/lib/preferences/preferences.cpp
+++ b/src/lib/preferences/preferences.cpp
@@ -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(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(5)->setIcon(QIcon::fromTheme("download", QIcon(":/icons/preferences/mail-inbox.png")));
- ui->listWidget->item(6)->setIcon(QIcon::fromTheme("user-identity", QIcon(":/icons/preferences/dialog-password.png")));
- ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
- ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-desktop-notification", QIcon(":/icons/preferences/dialog-question.png")));
- ui->listWidget->item(9)->setIcon(QIcon::fromTheme("preferences-plugin", QIcon(":/icons/preferences/extension.png")));
- ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.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("download", QIcon(":/icons/preferences/mail-inbox.png")));
+ ui->listWidget->item(7)->setIcon(QIcon::fromTheme("user-identity", QIcon(":/icons/preferences/dialog-password.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-desktop-notification", QIcon(":/icons/preferences/dialog-question.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 {
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(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(5)->setIcon(QIcon::fromTheme("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png")));
- ui->listWidget->item(6)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
- ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
- ui->listWidget->item(8)->setIcon(QIcon::fromTheme("dialog-question", QIcon(":/icons/preferences/dialog-question.png")));
- ui->listWidget->item(9)->setIcon(QIcon::fromTheme("extension", QIcon(":/icons/preferences/extension.png")));
- ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.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("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png")));
+ ui->listWidget->item(7)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.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("dialog-question", QIcon(":/icons/preferences/dialog-question.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;
@@ -326,6 +328,12 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->sizeMinimumLogical->setValue(settings.value("MinimumLogicalFontSize", mApp->webSettings()->fontSize(QWebSettings::MinimumLogicalFontSize)).toInt());
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
m_pluginsList = new PluginsManager(this);
ui->pluginsFrame->addWidget(m_pluginsList);
@@ -837,6 +845,12 @@ void Preferences::saveSettings()
settings.setValue("MinimumLogicalFontSize", ui->sizeMinimumLogical->value());
settings.endGroup();
+ //KEYBOARD SHORTCUTS
+ settings.beginGroup("Shortcuts");
+ settings.setValue("useTabNumberShortcuts", ui->switchTabsAlt->isChecked());
+ settings.setValue("useSpeedDialNumberShortcuts", ui->loadSpeedDialsCtrl->isChecked());
+ settings.endGroup();
+
//BROWSING
settings.beginGroup("Web-Browser-Settings");
settings.setValue("allowFlash", ui->allowPlugins->isChecked());
diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui
index aef718ec0..4bfdff32b 100644
--- a/src/lib/preferences/preferences.ui
+++ b/src/lib/preferences/preferences.ui
@@ -117,6 +117,11 @@
Fonts
+ -
+
+ Keyboard Shortcuts
+
+
-
Downloads
@@ -155,7 +160,7 @@
Qt::NoFocus
- 0
+ 5
@@ -1705,6 +1710,44 @@
+
+
+ -
+
+
+ <b>Shortcuts</b>
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Switch to tabs with Alt + number of tab
+
+
+
+ -
+
+
+ Load speed dials with Ctrl + number of speed dial
+
+
+
+
+
-
diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp
index 93914aa65..dfa34be93 100644
--- a/src/lib/webview/webview.cpp
+++ b/src/lib/webview/webview.cpp
@@ -380,14 +380,15 @@ void WebView::slotIconChanged()
void WebView::slotUrlChanged(const QUrl &url)
{
static QStringList exceptions;
- if (exceptions.isEmpty())
+ if (exceptions.isEmpty()) {
exceptions << "google." << "twitter.";
+ }
// Disable touch mocking on pages known not to work properly
const QString &host = url.host();
m_disableTouchMocking = false;
- foreach (const QString &site, exceptions) {
+ foreach(const QString & site, exceptions) {
if (host.contains(site)) {
m_disableTouchMocking = true;
}