From ff7ef5eddaeb600c4169711a3aa4614e0ab8b44c Mon Sep 17 00:00:00 2001
From: Christian Kandeler <christian.kandeler@nokia.com>
Date: Thu, 9 Sep 2010 10:36:59 +0200
Subject: [PATCH] Maemo: Get rid of maemo6 reference, fix deploy paths.

---
 .../qt-maemo/maemodeployablelistmodel.cpp     | 23 ++++++++++++-------
 .../qt-maemo/maemotemplatesmanager.cpp        |  7 ++++--
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp
index bca0375c776..272e1c2211d 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp
@@ -59,20 +59,27 @@ bool MaemoDeployableListModel::buildModel()
 
     const MaemoProFileWrapper::InstallsList &installs = m_proFileWrapper->installs();
     if (installs.targetPath.isEmpty()) {
-        const QString remoteDir = m_proFileNode->projectType() == LibraryTemplate
-            ? QLatin1String("/opt/lib")
-            : QLatin1String("/opt/bin");
+        const QString remoteDirSuffix
+            = QLatin1String(m_proFileNode->projectType() == LibraryTemplate
+                ? "/lib" : "/bin");
+        const QString remoteDirMaemo5
+            = QLatin1String("/opt/usr") + remoteDirSuffix;
+        const QString remoteDirMaemo6
+            = QLatin1String("/usr/local") + remoteDirSuffix;
         m_deployables.prepend(MaemoDeployable(localExecutableFilePath(),
-            remoteDir));
+            remoteDirMaemo5));
         QFile projectFile(m_proFileNode->path());
         if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
             qWarning("Error updating .pro file.");
             return false;
         }
-        QString installsString
-            = QLatin1String("\nmaemo5|maemo6 {\n    target.path = ")
-                + remoteDir + QLatin1String("\n    INSTALLS += target\n}\n");
-        if (!projectFile.write(installsString.toLocal8Bit())) {
+        QString proFileTemplate = QLatin1String("\nunix:!symbian {\n"
+            "    maemo5 {\n        target.path = maemo5path\n    } else {\n"
+            "        target.path = maemo6path\n    }\n"
+            "    INSTALLS += target\n}");
+        proFileTemplate.replace(QLatin1String("maemo5path"), remoteDirMaemo5);
+        proFileTemplate.replace(QLatin1String("maemo6path"), remoteDirMaemo6);
+        if (!projectFile.write(proFileTemplate.toLocal8Bit())) {
             qWarning("Error updating .pro file.");
             return false;
         }
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp
index f079ab42b45..8e878b568d8 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp
@@ -363,9 +363,12 @@ bool MaemoTemplatesManager::updateDesktopFile(const Qt4Target *target,
             return false;
         }
         QByteArray proFileContents = proFile.readAll();
-        proFileContents += "\nmaemo5|maemp6{\n"
+        proFileContents += "\nunix:!symbian {\n"
             "    desktopfile.files = $${TARGET}.desktop\n"
-            "    desktopfile.path = /usr/share/applications/hildon\n"
+            "    maemo5 {\n"
+            "        desktopfile.path = /usr/share/applications/hildon\n"
+            "    } else {\n"
+            "        desktopfile.path = /usr/share/applications\n    }\n"
             "    INSTALLS += desktopfile\n}\n";
         proFile.resize(0);
         proFile.write(proFileContents);
-- 
GitLab