From b360e73f6add589b8ab9b07396a6c9ace687db7d Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@theqtcompany.com>
Date: Fri, 24 Oct 2014 18:29:33 +0200
Subject: [PATCH] JsonWizard: Use up-to-date file information

This avoids a new project being opened if you are trying to add a new
subproject to some existing project.

Change-Id: Ic5a2f4b0dedbfd6994c59e4944fc32b11d648871
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
---
 .../projectexplorer/jsonwizard/jsonwizard.cpp      | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp
index 1b4572df22b..d490d9907e1 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp
@@ -162,14 +162,12 @@ void JsonWizard::accept()
     Utils::Wizard::accept();
 
     QString errorMessage;
-    GeneratorFiles list = fileList();
-
-    if (list.isEmpty())
+    if (fileList().isEmpty())
         return;
 
     emit prePromptForOverwrite(m_files);
     JsonWizardGenerator::OverwriteResult overwrite =
-            JsonWizardGenerator::promptForOverwrite(&list, &errorMessage);
+            JsonWizardGenerator::promptForOverwrite(&m_files, &errorMessage);
     if (overwrite == JsonWizardGenerator::OverwriteError) {
         if (!errorMessage.isEmpty())
             QMessageBox::warning(this, tr("Failed to Overwrite Files"), errorMessage);
@@ -177,27 +175,27 @@ void JsonWizard::accept()
     }
 
     emit preFormatFiles(m_files);
-    if (!JsonWizardGenerator::formatFiles(this, &list, &errorMessage)) {
+    if (!JsonWizardGenerator::formatFiles(this, &m_files, &errorMessage)) {
         if (!errorMessage.isEmpty())
             QMessageBox::warning(this, tr("Failed to Format Files"), errorMessage);
         return;
     }
 
     emit preWriteFiles(m_files);
-    if (!JsonWizardGenerator::writeFiles(this, &list, &errorMessage)) {
+    if (!JsonWizardGenerator::writeFiles(this, &m_files, &errorMessage)) {
         if (!errorMessage.isEmpty())
             QMessageBox::warning(this, tr("Failed to Write Files"), errorMessage);
         return;
     }
 
     emit postProcessFiles(m_files);
-    if (!JsonWizardGenerator::postWrite(this, &list, &errorMessage)) {
+    if (!JsonWizardGenerator::postWrite(this, &m_files, &errorMessage)) {
         if (!errorMessage.isEmpty())
             QMessageBox::warning(this, tr("Failed to Post-Process Files"), errorMessage);
         return;
     }
     emit filesReady(m_files);
-    if (!JsonWizardGenerator::allDone(this, &list, &errorMessage)) {
+    if (!JsonWizardGenerator::allDone(this, &m_files, &errorMessage)) {
         if (!errorMessage.isEmpty())
             QMessageBox::warning(this, tr("Failed to Open Files"), errorMessage);
         return;
-- 
GitLab