diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2013-01-02 11:32:23 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2013-01-02 11:32:23 +0100 |
commit | b96d7a83dc5f25429b378fb4a4c3cf9399830491 (patch) | |
tree | 2f6f63bc305a15978994219076c5a9ec3aa5789b /src | |
parent | Krazy fixes, third shot (diff) | |
download | rekonq-b96d7a83dc5f25429b378fb4a4c3cf9399830491.tar.xz |
Restore rekonq 1.x shortcuts
ALT + #number to change tabs
CTRL + #number to load favorites
BUG: 312341
Diffstat (limited to 'src')
-rw-r--r-- | src/kspellplugin.cpp | 1 | ||||
-rw-r--r-- | src/tabwindow/tabwindow.cpp | 37 | ||||
-rw-r--r-- | src/tabwindow/tabwindow.h | 2 |
3 files changed, 40 insertions, 0 deletions
diff --git a/src/kspellplugin.cpp b/src/kspellplugin.cpp index 7b20b4a4..244c2a1d 100644 --- a/src/kspellplugin.cpp +++ b/src/kspellplugin.cpp @@ -27,6 +27,7 @@ // Self Includes #include "kspellplugin.h" +#include "kspellplugin.moc" // KDE Includes #include <KDebug> diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp index f05d8142..04a47b5e 100644 --- a/src/tabwindow/tabwindow.cpp +++ b/src/tabwindow/tabwindow.cpp @@ -171,6 +171,31 @@ void TabWindow::init() _addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); + + // ---------------------------------------------------------------------------------------------- + // shortcuts for quickly switching to a tab + QSignalMapper *tabSignalMapper = new QSignalMapper(this); + for (int i = 0; i < 9; i++) + { + a = new KAction(i18n("Switch to Tab %1", i+1), this); + a->setShortcut(KShortcut(QString("Alt+%1").arg(i+1))); + actionCollection()->addAction(QL1S(QString("switch_tab_" + QString::number(i+1)).toAscii()), a); + connect(a, SIGNAL(triggered(bool)), tabSignalMapper, SLOT(map())); + tabSignalMapper->setMapping(a, i); + } + connect(tabSignalMapper, SIGNAL(mapped(int)), this, SLOT(setCurrentIndex(int))); + + // shortcuts for loading favorite pages + QSignalMapper *favoritesSignalMapper = new QSignalMapper(this); + for (int i = 1; i <= 9; ++i) + { + a = new KAction(i18n("Switch to Favorite Page %1", i), this); + a->setShortcut(KShortcut(QString("Ctrl+%1").arg(i))); + actionCollection()->addAction(QL1S(QString("switch_favorite_" + QString::number(i)).toAscii()), a); + connect(a, SIGNAL(triggered(bool)), favoritesSignalMapper, SLOT(map())); + favoritesSignalMapper->setMapping(a, i); + } + connect(favoritesSignalMapper, SIGNAL(mapped(int)), this, SLOT(loadFavorite(int))); } @@ -672,3 +697,15 @@ bool TabWindow::isPrivateBrowsingWindowMode() { return _isPrivateBrowsing; } + + +void TabWindow::loadFavorite(const int index) +{ + QStringList urls = ReKonfig::previewUrls(); + if (index < 0 || index > urls.length()) + return; + + KUrl url = KUrl(urls.at(index - 1)); + loadUrl(url); + currentWebWindow()->setFocus(); +} diff --git a/src/tabwindow/tabwindow.h b/src/tabwindow/tabwindow.h index 018ad0e7..c3df016c 100644 --- a/src/tabwindow/tabwindow.h +++ b/src/tabwindow/tabwindow.h @@ -114,6 +114,8 @@ private Q_SLOTS: void setFullScreen(bool); + void loadFavorite(const int); + private: // the new tab button QToolButton *_addTabButton; |