From 40548df8f8b12ec7b4145a268872cf1ceb41e698 Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@nokia.com>
Date: Tue, 23 Nov 2010 13:06:55 +0100
Subject: [PATCH] Symbian: Improve warnings on project setup

 * Warn on spaces in the project path
 * Warn on special characters in the project name only

This should stop warnings from appearing when trying to run the Qt demos
on symbian.
---
 .../qt-s60/s60projectchecker.cpp              | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/plugins/qt4projectmanager/qt-s60/s60projectchecker.cpp b/src/plugins/qt4projectmanager/qt-s60/s60projectchecker.cpp
index 4716a981f62..a16b4458dbb 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60projectchecker.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60projectchecker.cpp
@@ -67,16 +67,27 @@ S60ProjectChecker::reportIssues(const QString &proFile, const QtVersion *version
                                                         "The \"Open C/C++ plugin\" is not installed in the Symbian SDK or the Symbian SDK path is misconfigured for Qt version %1.").arg(version->displayName()),
                             QString(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
     }
-    // Warn of strange characters in project name:
-    QString projectPath = proFile;
+
+    // Warn of strange characters in project name and path:
+    const QString projectName = proFile.mid(proFile.lastIndexOf(QLatin1Char('/')) + 1);
+    QString projectPath = proFile.left(proFile.lastIndexOf(QLatin1Char('/')));
 #if defined (Q_OS_WIN)
     if (projectPath.at(1) == QChar(':') && projectPath.at(0).toUpper() >= QChar('A') && projectPath.at(0).toUpper() <= QChar('Z'))
         projectPath = projectPath.mid(2);
 #endif
-    if (projectPath.contains(QRegExp("[^a-zA-Z0-9./]"))) {
+    if (projectPath.contains(QLatin1Char(' '))) {
+        results.append(Task(Task::Warning,
+                            QCoreApplication::translate("ProjectExplorer::Internal::S60ProjectChecker",
+                                                        "The Symbian toolchain does not handle spaces "
+                                                        "in the project path '%1'.").arg(projectPath),
+                            QString(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
+    }
+    if (projectName.contains(QRegExp("[^a-zA-Z0-9.]"))) {
         results.append(Task(Task::Warning,
                             QCoreApplication::translate("ProjectExplorer::Internal::S60ProjectChecker",
-                                                        "The Symbian toolchain does not handle special characters in a project path well."),
+                                                        "The Symbian toolchain does not handle special "
+                                                        "characters in the project name '%1' well.")
+                            .arg(projectName),
                             QString(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
     }
     return results;
-- 
GitLab