File konsole-tab-switch.diff of Package kdebase4

Index: apps/konsole/src/ViewManager.h
===================================================================
--- apps/konsole/src/ViewManager.h	(revision 837724)
+++ apps/konsole/src/ViewManager.h	(revision 837725)
@@ -239,6 +239,9 @@
     void moveActiveViewLeft();
     // moves active view to the right
     void moveActiveViewRight();
+    // switches to the view at visual position 'index' 
+    // in the current container
+    void switchToView(int index);
 
 	// called when a SessionController gains focus
 	void controllerChanged(SessionController* controller);
Index: apps/konsole/src/ViewManager.cpp
===================================================================
--- apps/konsole/src/ViewManager.cpp	(revision 837724)
+++ apps/konsole/src/ViewManager.cpp	(revision 837725)
@@ -201,6 +201,19 @@
         collection->addAction("next-container",nextContainerAction);
         collection->addAction("move-view-left",moveViewLeftAction);
         collection->addAction("move-view-right",moveViewRightAction);
+
+        // Switch to tab N shortcuts
+        const int SWITCH_TO_TAB_COUNT = 10;
+        QSignalMapper* switchToTabMapper = new QSignalMapper(this);
+        connect(switchToTabMapper,SIGNAL(mapped(int)),this,SLOT(switchToView(int)));
+        for (int i=0;i < SWITCH_TO_TAB_COUNT;i++)
+        {
+            KAction* switchToTabAction = new KAction(i18n("Switch to Tab %1",i+1),this);
+            switchToTabMapper->setMapping(switchToTabAction,i);
+            connect(switchToTabAction,SIGNAL(triggered()),switchToTabMapper,
+                    SLOT(map()));
+            collection->addAction(QString("switch-to-tab-%1").arg(i),switchToTabAction);
+        }
     }
 
     QListIterator<QAction*> iter(multiViewOnlyActions);
@@ -235,7 +248,16 @@
     connect( moveViewRightAction , SIGNAL(triggered()) , this , SLOT(moveActiveViewRight()) );
     _viewSplitter->addAction(moveViewRightAction);
 }
-
+void ViewManager::switchToView(int index)
+{
+    Q_ASSERT(index >= 0);
+    ViewContainer* container = _viewSplitter->activeContainer();
+    Q_ASSERT( container );
+    QList<QWidget*> containerViews = container->views();
+    if (index >= containerViews.count())
+        return;
+    container->setActiveView(containerViews.at(index));
+}
 void ViewManager::updateDetachViewState()
 {
 	if (!_actionCollection)