Commit be9ec6d6 authored by Stephan Binner's avatar Stephan Binner
Browse files

Added keyboard shorcuts to switch between tabs.

Patch provided by Randy Pearson <blueboy@bamafolks.com>.

svn path=/trunk/kdebase/konqueror/; revision=172373
parent e3e9ce98
......@@ -2071,6 +2071,16 @@ void KonqMainWindow::slotRemoveOtherTabsPopup()
}
void KonqMainWindow::slotActivateNextTab()
{
m_pViewManager->activateNextTab();
}
void KonqMainWindow::slotActivatePrevTab()
{
m_pViewManager->activatePrevTab();
}
void KonqMainWindow::slotDumpDebugInfo()
{
#ifndef NDEBUG
......@@ -2886,6 +2896,9 @@ void KonqMainWindow::initActions()
m_paBreakOffTab = new KAction( i18n( "Detach Current Tab" ), "tab_breakoff", CTRL+SHIFT+Key_B, this, SLOT( slotBreakOffTab() ), actionCollection(), "breakoffcurrenttab" );
m_paRemoveView = new KAction( i18n( "&Remove Active View" ),"view_remove", CTRL+SHIFT+Key_R, this, SLOT( slotRemoveView() ), actionCollection(), "removeview" );
m_paRemoveTab = new KAction( i18n( "Close Current Tab" ), "tab_remove", CTRL+SHIFT+Key_W, this, SLOT( slotRemoveTab() ), actionCollection(), "removecurrenttab" );
m_paActivateNextTab = new KAction( i18n( "Activate Next Tab" ), "tab_next", CTRL+Key_BracketRight, this, SLOT( slotActivateNextTab() ), actionCollection(), "activatenexttab" );
m_paActivatePrevTab = new KAction( i18n( "Activate Previous Tab" ), "tab_previous", CTRL+Key_BracketLeft, this, SLOT( slotActivatePrevTab() ), actionCollection(), "activateprevtab" );
#ifndef NDEBUG
m_paDumpDebugInfo = new KAction( i18n( "Dump Debug Info" ), "view_dump_debug_info", 0, this, SLOT( slotDumpDebugInfo() ), actionCollection(), "dumpdebuginfo" );
#endif
......@@ -3053,6 +3066,8 @@ void KonqMainWindow::updateViewActions()
m_paDuplicateTab->setEnabled( false );
m_paRemoveTab->setEnabled( false );
m_paBreakOffTab->setEnabled( false );
m_paActivateNextTab->setEnabled( false );
m_paActivatePrevTab->setEnabled( false );
}
else
{
......@@ -3062,11 +3077,15 @@ void KonqMainWindow::updateViewActions()
{
m_paRemoveTab->setEnabled( true );
m_paBreakOffTab->setEnabled( true );
m_paActivateNextTab->setEnabled( true );
m_paActivatePrevTab->setEnabled( true );
}
else
{
m_paRemoveTab->setEnabled( false );
m_paBreakOffTab->setEnabled( false );
m_paActivateNextTab->setEnabled( false );
m_paActivatePrevTab->setEnabled( false );
}
}
......
......@@ -380,6 +380,8 @@ protected slots:
void slotRemoveOtherTabsPopup();
void slotRemoveTab();
void slotRemoveTabPopup();
void slotActivateNextTab();
void slotActivatePrevTab();
void slotDumpDebugInfo();
void slotSaveViewProfile();
......@@ -536,6 +538,8 @@ private:
KAction *m_paBreakOffTab;
KAction *m_paRemoveView;
KAction *m_paRemoveTab;
KAction *m_paActivateNextTab;
KAction *m_paActivatePrevTab;
KAction *m_paDumpDebugInfo;
KAction *m_paSaveRemoveViewProfile;
......
......@@ -577,6 +577,42 @@ void KonqViewManager::removeOtherTabs( KonqFrameBase* tab )
}
void KonqViewManager::activateNextTab()
{
if (m_pDocContainer == 0L) return;
if (m_pDocContainer->frameType() != "Tabs") return;
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
if( tabContainer->count() == 1 ) return;
int iTab = tabContainer->currentPageIndex();
iTab++;
if( iTab == tabContainer->count() )
iTab = 0;
tabContainer->setCurrentPage( iTab );
}
void KonqViewManager::activatePrevTab()
{
if (m_pDocContainer == 0L) return;
if (m_pDocContainer->frameType() != "Tabs") return;
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
if( tabContainer->count() == 1 ) return;
int iTab = tabContainer->currentPageIndex();
iTab--;
if( iTab == -1 )
iTab = tabContainer->count() - 1;
tabContainer->setCurrentPage( iTab );
}
void KonqViewManager::showTab( KonqView *view )
{
static_cast<KonqFrameTabs*>( docContainer() )->showPage( view->frame() );
......
......@@ -131,6 +131,18 @@ public:
*/
void removeOtherTabs( KonqFrameBase* tab = 0L );
/**
* Locates and activates the next tab
*
*/
void activateNextTab();
/**
* Locates and activates the previous tab
*
*/
void activatePrevTab();
/**
* Brings the tab specified by @p view to the front of the stack
*
......
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