VcsBase: Make Vcs Action active again when opening a project

Make Vcs actions active again when a project is opened but no
document is open.

Task-number: QTCREATORBUG-13609
Change-Id: I3d5accc3dc65412b1af5fc8c6a2baa9ac97c6e25
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2015-01-12 14:07:09 +01:00
parent 87faa62fa0
commit 8b928191bc

View File

@@ -220,6 +220,9 @@ StateListener::StateListener(QObject *parent) : QObject(parent)
connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
this, &StateListener::slotStateChanged);
connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
this, &StateListener::slotStateChanged);
EditorManager::setWindowTitleVcsTopicHandler(&StateListener::windowTitleVcsTopic);
}
@@ -308,7 +311,10 @@ void StateListener::slotStateChanged()
}
// Check for project, find the control
IVersionControl *projectControl = 0;
if (const Project *currentProject = ProjectTree::currentProject()) {
Project *currentProject = ProjectTree::currentProject();
if (!currentProject)
currentProject = SessionManager::startupProject();
if (currentProject) {
state.currentProjectPath = currentProject->projectDirectory().toString();
state.currentProjectName = currentProject->displayName();
projectControl = VcsManager::findVersionControlForDirectory(state.currentProjectPath,