* Add option to show new tab button with delayed popup menu on tab bar.

Go to Settings -> Edit Current Profile -> Tabs page and tick "Show 'New tab' button in tab bar"

  This was added for the benefit of users with existing habits from KDE 3 and is not
  shown by default.

* Add close buttons on tabs using the new style ppenz added to KTabBar
* Add confirmation when closing via middle-click/close button if a program other than a shell or
  nested shell is running in the foreground of that session.

BUG: 157015

Squashed commit of the following:

commit 54a5db9c31a5527e44d7358b30587c28bab965bc
Author: Robert Knight <robertknight@gmail.com>
Date:   Fri May 2 01:48:05 2008 +0100

    UI text correction: 'on tab bar' -> 'in tab bar'

commit ed8e70238e2cc4240f8334cd091fa2707785a908
Author: Robert Knight <robertknight@gmail.com>
Date:   Fri May 2 01:46:42 2008 +0100

    Do not show the confirm-on-close prompt if the foreground program is another shell.

commit 010370c12950a532d93c99d0983c74c47e26ad07
Author: Robert Knight <robertknight@gmail.com>
Date:   Fri May 2 01:40:05 2008 +0100

    Add a confirmation which is displayed when closing a tab via middle-click / close button if the program has an active program running in the session (other than the shell itself).

commit 49812e26e5fd8c44dd01f1a6a4c0e7271c6366fd
Author: Robert Knight <robertknight@gmail.com>
Date:   Fri May 2 01:25:29 2008 +0100

    Add confirmClose() method to ViewProperties which is can be re-implemented to prompt whether to close the session.  Make the presence of the close button in the ViewContainer dependent on a QuickCloseView feature being enabled.

commit ece191ad5ad550af47cd2ca0bc75a517119e7189
Author: Robert Knight <robertknight@gmail.com>
Date:   Fri May 2 01:09:17 2008 +0100

    Show 'close' button on tabs using the new close button style added to KTabBar by ppenz.

commit f975f04c993effdd2afef588c5f765192b6fab5a
Author: Robert Knight <robertknight@gmail.com>
Date:   Fri May 2 01:03:54 2008 +0100

    Better UI text for 'Show New Tab' option.

commit 642c5b1d07cd2288c78446efe395da050730decb
Author: Robert Knight <robertknight@gmail.com>
Date:   Thu May 1 21:04:47 2008 +0100

    Sync 'new tab' tab bar menu actions with profile list.

commit c6c556980e43afcb1bb5fdfaaa9dd7e12e524688
Author: Robert Knight <robertknight@gmail.com>
Date:   Wed Apr 30 23:01:34 2008 +0100

    Hook up actions in new tab popup menu so a new tab is created with the right profile when an action is chosen.

commit dece8a23ff101dda47d495ba38e57e55059c4e63
Author: Robert Knight <robertknight@gmail.com>
Date:   Wed Apr 30 22:51:28 2008 +0100

    Apply ShowNewTabButton profile property to current view container.

commit e244a95512dc535198fa69c3afe34b597402de15
Author: Robert Knight <robertknight@gmail.com>
Date:   Wed Apr 30 22:50:57 2008 +0100

    Add support for enabling/disabling a 'quick new view' widget in view containers.  Add an implementation of it (quick new tab button) in TabbedViewContainerV2

commit 9fdc2e450aefb9b602f8fb6b66d3508e6750531b
Author: Robert Knight <robertknight@gmail.com>
Date:   Wed Apr 30 22:50:22 2008 +0100

    Hook up 'Show new tab button' UI option.

commit 7326e6dccbc095f0f784fd6f4da532f250ca5437
Author: Robert Knight <robertknight@gmail.com>
Date:   Wed Apr 30 22:50:04 2008 +0100

    Add ShowNewTabButton profile property and set a default for it (false)

commit 273f85f0d21d8b755712c67c50a939400f15a169
Author: Robert Knight <robertknight@gmail.com>
Date:   Wed Apr 30 21:22:09 2008 +0100

    Add checkbox for toggling new tab menu button.

commit 200744ce620cd6bd9a9d1791e62863c618921788
Author: Robert Knight <robertknight@gmail.com>
Date:   Wed Apr 30 21:21:33 2008 +0100

    Formatting. Remove extra lines.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=803112
This commit is contained in:
Robert Knight
2008-05-02 00:59:47 +00:00
parent c5bfff3db3
commit 34a9e7ec42
15 changed files with 238 additions and 55 deletions

View File

@@ -26,6 +26,7 @@
// Qt
#include <QtCore/QDateTime>
#include <QtCore/QSignalMapper>
#include <QtGui/QMenu>
// KDE
#include <kdebug.h>
@@ -37,6 +38,7 @@
// Konsole
#include "ColorScheme.h"
#include "ProfileList.h"
#include "Session.h"
#include "TerminalDisplay.h"
#include "SessionController.h"
@@ -52,6 +54,7 @@ ViewManager::ViewManager(QObject* parent , KActionCollection* collection)
, _actionCollection(collection)
, _containerSignalMapper(new QSignalMapper(this))
, _navigationMethod(TabbedNavigation)
, _newViewMenu(0)
{
// create main view area
_viewSplitter = new ViewSplitter(0);
@@ -86,6 +89,20 @@ ViewManager::ViewManager(QObject* parent , KActionCollection* collection)
ViewManager::~ViewManager()
{
delete _newViewMenu;
}
QMenu* ViewManager::createNewViewMenu()
{
if (_newViewMenu)
return _newViewMenu;
_newViewMenu = new QMenu(0);
ProfileList* newViewProfiles = new ProfileList(false,_newViewMenu);
newViewProfiles->syncWidgetActions(_newViewMenu,true);
connect(newViewProfiles,SIGNAL(profileSelected(Profile::Ptr)),this,
SIGNAL(newViewRequest(Profile::Ptr)));
return _newViewMenu;
}
QWidget* ViewManager::activeView() const
{
@@ -567,6 +584,7 @@ ViewContainer* ViewManager::createContainer(const Profile::Ptr info)
default:
container = new StackedViewContainer(_viewSplitter);
}
container->setFeatures(ViewContainer::QuickCloseView);
// connect signals and slots
connect( container , SIGNAL(viewAdded(QWidget*,ViewProperties*)) , _containerSignalMapper ,
@@ -697,6 +715,7 @@ void ViewManager::applyProfile(TerminalDisplay* view , const Profile::Ptr info,
ViewContainer* container = _viewSplitter->activeContainer();
int tabBarMode = info->property<int>(Profile::TabBarMode);
int tabBarPosition = info->property<int>(Profile::TabBarPosition);
bool showNewTabButton = info->property<int>(Profile::ShowNewTabButton);
if ( tabBarMode == Profile::AlwaysHideTabBar )
container->setNavigationDisplayMode(ViewContainer::AlwaysHideNavigation);
@@ -714,6 +733,15 @@ void ViewManager::applyProfile(TerminalDisplay* view , const Profile::Ptr info,
if ( container->supportedNavigationPositions().contains(position) )
container->setNavigationPosition(position);
if (showNewTabButton &&
(container->supportedFeatures() & ViewContainer::QuickNewView))
{
container->setFeatures(container->features() | ViewContainer::QuickNewView);
container->setNewViewMenu(createNewViewMenu());
}
else
container->setFeatures(container->features() & ~ViewContainer::QuickNewView);
}
// load colour scheme