Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 2ea08a3ba14832632c6e43be68e1e38c > files > 5

kdebase4-4.6.5-1.0.mga1.src.rpm

commit 5ba077d55478a5acc837febdb064682407650e78
Author: Kurt Hindenburg <kurt.hindenburg@gmail.com>
Date:   Sun Apr 3 21:13:13 2011 -0400

    Set the window icon to the active session icon.
    
    The konsole window icon will now be the same as the currect session's
    icon.
    FEATURE: 256840

diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index df0b040..832d6f0 100644
--- konsole/src/MainWindow.cpp
+++ konsole/src/MainWindow.cpp
@@ -94,6 +94,8 @@ MainWindow::MainWindow()
             SLOT(setMenuBarVisibleOnce(bool)) );
     connect( _viewManager , SIGNAL(setSaveGeometryOnExitRequest(bool)) , this ,
 	    SLOT(setSaveGeometryOnExit(bool)) );
+    connect( _viewManager , SIGNAL(updateWindowIcon()) , this ,
+	    SLOT(updateWindowIcon()) );
     connect( _viewManager , SIGNAL(newViewRequest(Profile::Ptr)) , 
         this , SLOT(newFromProfile(Profile::Ptr)) );
     connect( _viewManager , SIGNAL(newViewRequest()) , 
@@ -221,6 +223,9 @@ void MainWindow::activeViewChanged(SessionController* controller)
     activeViewTitleChanged(controller);
 
     _pluggedController = controller;
+
+    // Update window icon to newly activated session's icon
+    updateWindowIcon();
 }
 
 void MainWindow::activeViewTitleChanged(ViewProperties* properties)
@@ -228,6 +233,12 @@ void MainWindow::activeViewTitleChanged(ViewProperties* properties)
     setPlainCaption(properties->title());
 }
 
+void MainWindow::updateWindowIcon()
+{
+    if (_pluggedController)
+        setWindowIcon(_pluggedController->icon());
+}
+
 IncrementalSearchBar* MainWindow::searchBar() const
 {
     return _viewManager->searchBar();
diff --git a/src/MainWindow.h b/src/MainWindow.h
index 33c2e53..1664350 100644
--- konsole/src/MainWindow.h
+++ konsole/src/MainWindow.h
@@ -174,6 +174,8 @@ class MainWindow : public KXmlGuiWindow
 
         void setSaveGeometryOnExit(bool visible);
 
+        void updateWindowIcon();
+
         void openUrls(const QList<KUrl>& urls);
 
     private:
diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
index 56fbec6..54d11c4 100644
--- konsole/src/ViewManager.cpp
+++ konsole/src/ViewManager.cpp
@@ -793,6 +793,8 @@ void ViewManager::applyProfile(TerminalDisplay* view , const Profile::Ptr info,
 
     emit setSaveGeometryOnExitRequest( info->property<bool>(Profile::SaveGeometryOnExit) );
 
+    emit updateWindowIcon();
+
     // tab bar visibility
     if (applyContainerSettings)
     {
diff --git a/src/ViewManager.h b/src/ViewManager.h
index bf17b4d..05f5370 100644
--- konsole/src/ViewManager.h
+++ konsole/src/ViewManager.h
@@ -204,6 +204,7 @@ signals:
      */
     void setMenuBarVisibleRequest(bool);
     void setSaveGeometryOnExitRequest(bool);
+    void updateWindowIcon();
 
     /** Requests creation of a new view with the default profile. */
     void newViewRequest();