From 4f4bbe98289f20b760bffb6f2d63f6ec9b93e093 Mon Sep 17 00:00:00 2001
From: con <qtc-committer@nokia.com>
Date: Fri, 26 Mar 2010 12:16:44 +0100
Subject: [PATCH] Change contextChanged signal to also notify about additional
 contexts.

---
 src/plugins/bookmarks/bookmarkmanager.cpp | 2 +-
 src/plugins/coreplugin/filemanager.cpp    | 2 +-
 src/plugins/coreplugin/icore.cpp          | 4 ++--
 src/plugins/coreplugin/icore.h            | 2 +-
 src/plugins/coreplugin/mainwindow.cpp     | 2 +-
 src/plugins/vcsbase/vcsbaseplugin.cpp     | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp
index e78bcc06522..62a23af0698 100644
--- a/src/plugins/bookmarks/bookmarkmanager.cpp
+++ b/src/plugins/bookmarks/bookmarkmanager.cpp
@@ -321,7 +321,7 @@ BookmarkManager::BookmarkManager() :
     m_bookmarkIcon(QLatin1String(":/bookmarks/images/bookmark.png")),
     m_selectionModel(new QItemSelectionModel(this, this))
 {
-    connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*)),
+    connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*,QList<int>)),
             this, SLOT(updateActionStatus()));
 
     connect(ProjectExplorerPlugin::instance()->session(), SIGNAL(sessionLoaded()),
diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp
index abf93ce8829..6d7b7ae6eed 100644
--- a/src/plugins/coreplugin/filemanager.cpp
+++ b/src/plugins/coreplugin/filemanager.cpp
@@ -149,7 +149,7 @@ FileManager::FileManager(QMainWindow *mw)
         this, SLOT(changedFile(QString)));
     connect(d->m_mainWindow, SIGNAL(windowActivated()),
         this, SLOT(mainWindowActivated()));
-    connect(core, SIGNAL(contextChanged(Core::IContext*)),
+    connect(core, SIGNAL(contextChanged(Core::IContext*,QList<int>)),
         this, SLOT(syncWithEditor(Core::IContext*)));
 
     const QSettings *s = core->settings();
diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp
index 7f305abe1f1..1c1a2bc81e6 100644
--- a/src/plugins/coreplugin/icore.cpp
+++ b/src/plugins/coreplugin/icore.cpp
@@ -374,7 +374,7 @@
 */
 
 /*!
-    \fn void ICore::contextChanged(Core::IContext *context)
+    \fn void ICore::contextChanged(Core::IContext *context, const QList<int> &additionalContexts)
     \brief Sent just after a new \a context became the current context
-    (meaning that its widget got focus).
+    (meaning that its widget got focus), or if the additional context ids changed.
 */
diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h
index c0ff26c7f4e..ccc3b3b707c 100644
--- a/src/plugins/coreplugin/icore.h
+++ b/src/plugins/coreplugin/icore.h
@@ -124,7 +124,7 @@ signals:
     void optionsDialogRequested();
     void coreAboutToClose();
     void contextAboutToChange(Core::IContext *context);
-    void contextChanged(Core::IContext *context);
+    void contextChanged(Core::IContext *context, const QList<int> &additionalContexts);
 };
 
 } // namespace Core
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index 433c20a2c7c..1cb7e2f25f3 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -1096,7 +1096,6 @@ void MainWindow::updateContextObject(IContext *context)
         if (debugMainWindow)
             qDebug() << "new context object =" << context << (context ? context->widget() : 0)
                      << (context ? context->widget()->metaObject()->className() : 0);
-        emit m_coreImpl->contextChanged(context);
     }
 }
 
@@ -1215,6 +1214,7 @@ void MainWindow::updateContext()
     }
 
     m_actionManager->setContext(uniquecontexts);
+    emit m_coreImpl->contextChanged(m_activeContext, m_additionalContexts);
 }
 
 void MainWindow::aboutToShowRecentFiles()
diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp
index 43321a66374..fa55662b28e 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.cpp
+++ b/src/plugins/vcsbase/vcsbaseplugin.cpp
@@ -173,7 +173,7 @@ StateListener::StateListener(QObject *parent) :
         QObject(parent)
 {
     Core::ICore *core = Core::ICore::instance();
-    connect(core, SIGNAL(contextChanged(Core::IContext *)),
+    connect(core, SIGNAL(contextChanged(Core::IContext*,QList<int>)),
             this, SLOT(slotStateChanged()));
     connect(core->fileManager(), SIGNAL(currentFileChanged(QString)),
             this, SLOT(slotStateChanged()));
-- 
GitLab