File changeset_r18dd5bd012dae86b118c7b7a132866c0c7781297.diff of Package kdebase4.import5217

commit 18dd5bd012dae86b118c7b7a132866c0c7781297
Author: Kurt Hindenburg <kurt.hindenburg@gmail.com>
Date:   Sat Feb 5 15:58:42 2011 -0500

    Fix issue where the context menu popup no longer appeared after closing
    a tab.
    
    Backport to 4.6 branch.
    CCBUG: 185466

diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 49f1bb4..39727fc 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -86,6 +86,8 @@ MainWindow::MainWindow()
     connect( _viewManager , SIGNAL(empty()) , this , SLOT(close()) );
     connect( _viewManager , SIGNAL(activeViewChanged(SessionController*)) , this ,
             SLOT(activeViewChanged(SessionController*)) );
+    connect( _viewManager , SIGNAL(unplugController(SessionController*)) , this ,
+            SLOT(disconnectController(SessionController*)) );
     connect( _viewManager , SIGNAL(viewPropertiesChanged(const QList<ViewProperties*>&)) ,
            bookmarkHandler() , SLOT(setViews(const QList<ViewProperties*>&)) );
 
diff --git a/src/MainWindow.h b/src/MainWindow.h
index 98ca2a0..2e4276d 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -161,6 +161,7 @@ class MainWindow : public KXmlGuiWindow
         void showShortcutsDialog();
         void newFromProfile(Profile::Ptr profile);
         void activeViewChanged(SessionController* controller);
+        void disconnectController(SessionController* controller);
         void activeViewTitleChanged(ViewProperties*);
 
         void sessionListChanged(const QList<QAction*>& actions);
@@ -181,7 +182,6 @@ class MainWindow : public KXmlGuiWindow
         void setupActions();
         void setupWidgets();
         QString activeSessionDir() const;
-        void disconnectController(SessionController* controller);
 
         // sets the active shortcuts of actions in 'dest' to the shortcuts of actions
         // with the same name in 'source' (see KAction::ActiveShortcut)
diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
index 3c5db04..a846a38 100644
--- a/src/ViewManager.cpp
+++ b/src/ViewManager.cpp
@@ -377,6 +377,10 @@ void ViewManager::sessionFinished()
         }
     }
 
+    // This is needed to remove this controller from factory() in 
+    // order to prevent BUG: 185466 - disappearing menu popup
+    if (_pluggedController)
+        emit unplugController(_pluggedController);
 }
 
 void ViewManager::focusActiveView()
diff --git a/src/ViewManager.h b/src/ViewManager.h
index 3a1a796..bf17b4d 100644
--- a/src/ViewManager.h
+++ b/src/ViewManager.h
@@ -175,6 +175,12 @@ signals:
      */
     void activeViewChanged(SessionController* controller);
 
+    /** 
+     * Emitted when the current session needs unplugged from factory().
+     * @param controller The controller associated with the active view 
+     */
+    void unplugController(SessionController* controller);
+
     /**
      * Emitted when the list of view properties ( as returned by viewProperties() ) changes.
      * This occurs when views are added to or removed from the active container, or