Commit 2b1da5ec authored by Robert Knight's avatar Robert Knight
Browse files

Update window caption when session title changes.

svn path=/branches/work/konsole-split-view/; revision=628527
parent c383d7aa
...@@ -155,18 +155,31 @@ void ViewManager::viewActivated( QWidget* view ) ...@@ -155,18 +155,31 @@ void ViewManager::viewActivated( QWidget* view )
view->setFocus(Qt::OtherFocusReason); view->setFocus(Qt::OtherFocusReason);
} }
void ViewManager::activeViewTitleChanged(ViewProperties* properties)
{
// set a plain caption (ie. without the automatic addition of " - AppName" at the end)
// to make the taskbar entry cleaner and easier to read
_mainWindow->setPlainCaption( properties->title() );
}
void ViewManager::viewFocused( SessionController* controller ) void ViewManager::viewFocused( SessionController* controller )
{ {
if ( _pluggedController != controller ) if ( _pluggedController != controller )
{ {
if ( _pluggedController ) if ( _pluggedController )
{
_mainWindow->guiFactory()->removeClient(_pluggedController); _mainWindow->guiFactory()->removeClient(_pluggedController);
disconnect( controller , SIGNAL(titleChanged(ViewProperties*)),
this , SLOT(activeViewTitleChanged(ViewProperties*)) );
}
// update the menus in the main window to use the actions from the active // update the menus in the main window to use the actions from the active
// controller // controller
_mainWindow->guiFactory()->addClient(controller); _mainWindow->guiFactory()->addClient(controller);
// update the caption of the main window to match that of the focused session // update the caption of the main window to match that of the focused session
_mainWindow->setPlainCaption( controller->session()->displayTitle() ); connect( controller , SIGNAL(titleChanged(ViewProperties*)),
this , SLOT(activeViewTitleChanged(ViewProperties*)) );
_pluggedController = controller; _pluggedController = controller;
...@@ -274,7 +287,7 @@ ViewContainer* ViewManager::createContainer() ...@@ -274,7 +287,7 @@ ViewContainer* ViewManager::createContainer()
// connect signals and slots // connect signals and slots
connect( container , SIGNAL(closeRequest(QWidget*)) , this , SLOT(viewCloseRequest(QWidget*)) ); connect( container , SIGNAL(closeRequest(QWidget*)) , this , SLOT(viewCloseRequest(QWidget*)) );
*/ */
ViewContainer* container = new ListViewContainer(_viewSplitter); ViewContainer* container = new StackedViewContainer(_viewSplitter);
connect( container , SIGNAL(activeViewChanged(QWidget*)) , this , SLOT(viewActivated(QWidget*))); connect( container , SIGNAL(activeViewChanged(QWidget*)) , this , SLOT(viewActivated(QWidget*)));
return container; return container;
......
...@@ -32,6 +32,7 @@ class TESession; ...@@ -32,6 +32,7 @@ class TESession;
class TEWidget; class TEWidget;
class SessionController; class SessionController;
class ViewProperties;
class ViewContainer; class ViewContainer;
class ViewSplitter; class ViewSplitter;
...@@ -97,6 +98,8 @@ private slots: ...@@ -97,6 +98,8 @@ private slots:
// that we can plug the appropriate actions into the UI // that we can plug the appropriate actions into the UI
void viewActivated( QWidget* view ); void viewActivated( QWidget* view );
// called when the title of the active view changes
void activeViewTitleChanged( ViewProperties* );
private: private:
void setupActions(); void setupActions();
void focusActiveView(); void focusActiveView();
......
Supports Markdown
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