summaryrefslogtreecommitdiff
path: root/src/tabwindow
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2013-02-10 22:04:16 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-02-12 15:58:11 +0100
commitd70ae675ec02d347b49169ee7cf551f64263680e (patch)
tree70d2d9eea6c5175e4469b9d97ff6ca50b0022df8 /src/tabwindow
parentAdd support for numpad Enter in find. (diff)
downloadrekonq-d70ae675ec02d347b49169ee7cf551f64263680e.tar.xz
Add keyboard shortcut support for 'Show Next Tab' and 'Show Previous Tab'
Signed-off-by: Andrea Diamantini <adjam7@gmail.com>
Diffstat (limited to 'src/tabwindow')
-rw-r--r--src/tabwindow/tabwindow.cpp28
-rw-r--r--src/tabwindow/tabwindow.h3
2 files changed, 31 insertions, 0 deletions
diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp
index 3910467b..acf84948 100644
--- a/src/tabwindow/tabwindow.cpp
+++ b/src/tabwindow/tabwindow.cpp
@@ -154,6 +154,16 @@ void TabWindow::init()
actionCollection()->addAction(QL1S("close_tab"), a);
connect(a, SIGNAL(triggered(bool)), this, SLOT(closeTab()));
+ a = new KAction(i18n("Show Next Tab"), this);
+ a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext());
+ actionCollection()->addAction(QL1S("show_next_tab"), a);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(nextTab()));
+
+ a = new KAction(i18n("Show Previous Tab"), this);
+ a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev());
+ actionCollection()->addAction(QL1S("show_prev_tab"), a);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(previousTab()));
+
a = KStandardAction::fullScreen(this, SLOT(setFullScreen(bool)), this, actionCollection());
KShortcut fullScreenShortcut = KStandardShortcut::fullScreen();
fullScreenShortcut.setAlternate(Qt::Key_F11);
@@ -722,6 +732,24 @@ void TabWindow::restoreLastClosedTab()
}
+void TabWindow::nextTab()
+{
+ int next = currentIndex() + 1;
+ if (next == count())
+ next = 0;
+ setCurrentIndex(next);
+}
+
+
+void TabWindow::previousTab()
+{
+ int next = currentIndex() - 1;
+ if (next < 0)
+ next = count() - 1;
+ setCurrentIndex(next);
+}
+
+
void TabWindow::setFullScreen(bool makeFullScreen)
{
tabBar()->setVisible(!makeFullScreen);
diff --git a/src/tabwindow/tabwindow.h b/src/tabwindow/tabwindow.h
index 3a00ac4a..a273d3b1 100644
--- a/src/tabwindow/tabwindow.h
+++ b/src/tabwindow/tabwindow.h
@@ -111,6 +111,9 @@ private Q_SLOTS:
void reloadAllTabs();
void bookmarkAllTabs();
+ void nextTab();
+ void previousTab();
+
void restoreLastClosedTab();
void setFullScreen(bool);