[vlmc-devel] [PATCH] Ensure the WelcomePage to choose an existing project

Yikai Lu luyikei.qmltu at gmail.com
Sat Mar 5 15:14:28 CET 2016


Some platforms allow a QFileDialog to choose an project that doesn't exist, which causes various bugs.

I'm sorry for my previous two patches that has typo.
---
 src/Gui/wizard/WelcomePage.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/Gui/wizard/WelcomePage.cpp b/src/Gui/wizard/WelcomePage.cpp
index 096ec1d..fb0a232 100644
--- a/src/Gui/wizard/WelcomePage.cpp
+++ b/src/Gui/wizard/WelcomePage.cpp
@@ -139,6 +139,12 @@ WelcomePage::loadProject()
 
     if ( projectPath.isEmpty() ) return;
 
+    if ( !QFile(projectPath).exists() ) {
+        QMessageBox::warning(this, tr("Invalid project file path"),
+                             tr("Please use an existing project file."));
+        return;
+    }
+
     // Search if the item is already in the list
     QListWidgetItem* item = NULL;
     for ( int i = 0; i < m_ui.projectsListWidget->count(); ++i )
-- 
1.9.1



More information about the Vlmc-devel mailing list