From: Mathias Soeken Date: Sat, 25 Oct 2008 09:00:28 +0000 (+0000) Subject: You can now switch the tabs in dolphin via keyboard shortcuts like in konqueror X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/75bf8edaeb4a6a7b3bf03a3171661b577af79135 You can now switch the tabs in dolphin via keyboard shortcuts like in konqueror svn path=/trunk/KDE/kdebase/apps/; revision=875689 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index edff432a4..04ce2b741 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -318,6 +318,29 @@ void DolphinMainWindow::openNewTab(const KUrl& url) actionCollection()->action("close_tab")->setEnabled(true); } +void DolphinMainWindow::activateNextTab() +{ + if (m_viewTab.count() == 1 || m_tabBar->count() < 2) { + return; + } + + int tabIndex = (m_tabBar->currentIndex() + 1) % m_tabBar->count(); + m_tabBar->setCurrentIndex(tabIndex); +} + +void DolphinMainWindow::activatePrevTab() +{ + if (m_viewTab.count() == 1 || m_tabBar->count() < 2) { + return; + } + + int tabIndex = (m_tabBar->currentIndex() - 1); + if (tabIndex == -1) { + tabIndex = m_tabBar->count() - 1; + } + m_tabBar->setCurrentIndex(tabIndex); +} + void DolphinMainWindow::toggleActiveView() { if (m_viewTab[m_tabIndex].secondaryView == 0) { @@ -1015,6 +1038,17 @@ void DolphinMainWindow::setupActions() // setup 'Settings' menu m_showMenuBar = KStandardAction::showMenubar(this, SLOT(toggleShowMenuBar()), actionCollection()); KStandardAction::preferences(this, SLOT(editSettings()), actionCollection()); + + // not in menu actions + KAction* activateNextTab = actionCollection()->addAction("activatenexttab"); + activateNextTab->setText( i18n( "Activate Next Tab" ) ); + connect(activateNextTab, SIGNAL(triggered()), SLOT( activateNextTab() )); + activateNextTab->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext()); + + KAction* activatePrevTab = actionCollection()->addAction("activateprevtab"); + activatePrevTab->setText( i18n( "Activate Previous Tab" ) ); + connect(activatePrevTab, SIGNAL(triggered()), SLOT( activatePrevTab() )); + activatePrevTab->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); } void DolphinMainWindow::setupDockWidgets() diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index a9db9a3e2..eb609938f 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -305,6 +305,10 @@ private slots: */ void openNewTab(const KUrl& url); + void activateNextTab(); + + void activatePrevTab(); + /** Toggles the active view if two views are shown within the main window. */ void toggleActiveView();