OSDN Git Service

Don't open files and help if someone chooses to cancel loading an example.
authorDaniel Molkentin <daniel.molkentin@nokia.com>
Wed, 18 May 2011 09:38:35 +0000 (11:38 +0200)
committerDaniel Molkentin <daniel.molkentin@nokia.com>
Thu, 19 May 2011 14:13:24 +0000 (16:13 +0200)
Task-Number: QTCREATORBUG-4414
Change-Id: I0272091d185fe6a9ac23022eb4efb723eb541494
Reviewed-on: http://codereview.qt.nokia.com/21
Reviewed-by: Daniel Molkentin <daniel.molkentin@nokia.com>
src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp

index 3cafbdd..f20b724 100644 (file)
@@ -422,7 +422,6 @@ void GettingStartedWelcomePageWidget::slotOpenExample()
     }
 
     QString tryFile;
-    files << proFile;
     if (isQmlProject) {
         tryFile = proFileInfo.path() + '/' + "/main.qml";
         if(!QFile::exists(tryFile))
@@ -436,10 +435,13 @@ void GettingStartedWelcomePageWidget::slotOpenExample()
         tryFile = proFileInfo.path() + "/main.cpp";
         if(!QFile::exists(tryFile))
             tryFile = proFileInfo.path() + '/' + proFileInfo.baseName() + ".cpp";
+        files << tryFile;
+    }
+    if (ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFile)) {
+        Core::ICore::instance()->openFiles(files);
+        if (!helpFile.isEmpty())
+            slotOpenContextHelpPage(helpFile);
     }
-    Core::ICore::instance()->openFiles(files, static_cast<Core::ICore::OpenFilesFlags>(Core::ICore::SwitchMode | Core::ICore::StopOnLoadFail));
-    if (!tryFile.isEmpty() && Core::EditorManager::instance()->hasEditor(tryFile) && !helpFile.isEmpty())
-        slotOpenContextHelpPage(helpFile);
 }
 
 void GettingStartedWelcomePageWidget::slotOpenHelpPage(const QString& url)