Commit b96d7a83 authored by Andrea Diamantini's avatar Andrea Diamantini
Browse files

Restore rekonq 1.x shortcuts

ALT + #number to change tabs
CTRL + #number to load favorites

BUG: 312341
parent 2d812b51
......@@ -27,6 +27,7 @@
// Self Includes
#include "kspellplugin.h"
#include "kspellplugin.moc"
// KDE Includes
#include <KDebug>
......
......@@ -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();
}
......@@ -114,6 +114,8 @@ private Q_SLOTS:
void setFullScreen(bool);
void loadFavorite(const int);
private:
// the new tab button
QToolButton *_addTabButton;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment