Commit dfd4c14c authored by Kurt Hindenburg's avatar Kurt Hindenburg

Add action to jump to last tab.

Allows user to select a shortcut to jump to the far right tab.  There
is no default shortcut.

Patch by Francesco Cecconi <francesco.cecconi@gmail.com>
REVIEW: 102687
BUG: 279166
FIXED-IN: 4.8
parent 0c0874f9
......@@ -228,6 +228,11 @@ void ViewContainer::activateNextView()
setActiveView( _views.at(index) );
}
void ViewContainer::activateLastView()
{
setActiveView(_views.at(_views.count()-1));
}
void ViewContainer::activatePreviousView()
{
QWidget* active = activeView();
......
......@@ -203,6 +203,9 @@ public:
/** Changes the active view to the previous view */
void activatePreviousView();
/** Changes the active view to the last view */
void activateLastView();
/**
* This enum describes the directions
* in which views can be re-arranged within the container
......
......@@ -137,6 +137,7 @@ void ViewManager::setupActions()
KAction* nextViewAction = new KAction( i18n("Next Tab") , this );
KAction* previousViewAction = new KAction( i18n("Previous Tab") , this );
KAction* lastViewAction = new KAction( i18n("Switch to Last Tab") , this);
KAction* nextContainerAction = new KAction( i18n("Next View Container") , this);
KAction* moveViewLeftAction = new KAction( i18n("Move Tab Left") , this );
......@@ -207,6 +208,7 @@ void ViewManager::setupActions()
// Next / Previous View , Next Container
collection->addAction("next-view",nextViewAction);
collection->addAction("previous-view",previousViewAction);
collection->addAction("last-tab",lastViewAction);
collection->addAction("next-container",nextContainerAction);
collection->addAction("move-view-left",moveViewLeftAction);
collection->addAction("move-view-right",moveViewRightAction);
......@@ -254,6 +256,9 @@ void ViewManager::setupActions()
moveViewRightAction->setShortcut( QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_Right) );
connect( moveViewRightAction , SIGNAL(triggered()) , this , SLOT(moveActiveViewRight()) );
_viewSplitter->addAction(moveViewRightAction);
connect( lastViewAction, SIGNAL(triggered()) , this , SLOT(lastView()));
_viewSplitter->addAction(lastViewAction);
}
void ViewManager::switchToView(int index)
{
......@@ -314,6 +319,15 @@ void ViewManager::previousView()
container->activatePreviousView();
}
void ViewManager::lastView()
{
ViewContainer* container = _viewSplitter->activeContainer();
Q_ASSERT( container );
container->activateLastView();
}
void ViewManager::detachActiveView()
{
// find the currently active view and remove it from its container
......@@ -715,6 +729,9 @@ void ViewManager::setNavigationMethod(NavigationMethod method)
action = collection->action( "previous-view" );
if ( action ) action->setEnabled( _navigationMethod != NoNavigation );
action = collection->action( "last-tab" );
if ( action ) action->setEnabled( _navigationMethod != NoNavigation );
action = collection->action( "split-view-left-right" );
if ( action ) action->setEnabled( _navigationMethod != NoNavigation );
......
......@@ -292,6 +292,9 @@ private slots:
// called when "Previous View" shortcut is activated
void previousView();
// called when "Switch to last tab" shortcut is activated
void lastView();
// called when "Next View Container" shortcut is activated
void nextContainer();
......
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