From 218978a74a5487d3567d870e6c67bfd8607013af Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 26 Nov 2010 09:56:05 +0100 Subject: [PATCH] Maemo: Small deployment refactoring. --- .../qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp | 6 +++--- .../qt4projectmanager/qt-maemo/maemodeployablelistmodel.h | 3 ++- .../qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp index a4a14b966c7..e768758d162 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp @@ -225,15 +225,15 @@ bool MaemoDeployableListModel::isEditable(const QModelIndex &index) const && m_deployables.first().remoteDir.isEmpty(); } -bool MaemoDeployableListModel::canAddDesktopFile() const +bool MaemoDeployableListModel::hasDesktopFile() const { if (m_projectType == LibraryTemplate) return false; foreach (const MaemoDeployable &d, m_deployables) { if (QFileInfo(d.localFilePath).fileName() == m_projectName + QLatin1String(".desktop")) - return false; + return true; } - return true; + return false; } bool MaemoDeployableListModel::canAddIcon() const diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h index a297433ab5c..36b7280c792 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h @@ -69,7 +69,8 @@ public: bool isApplicationProject() const { return m_projectType == ApplicationTemplate; } QString applicationName() const { return m_targetInfo.target; } bool hasTargetPath() const { return m_hasTargetPath; } - bool canAddDesktopFile() const; + bool canAddDesktopFile() const { return isApplicationProject() && !hasDesktopFile(); } + bool hasDesktopFile() const; bool canAddIcon() const; bool addDesktopFile(QString &error); bool addIcon(const QString &fileName, QString &error); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp index 4d3a32c96da..0f71e133094 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp @@ -602,7 +602,7 @@ void MaemoPackageCreationStep::updateDesktopFiles(const QString &rulesFilePath) for (int i = 0; i < deployStep()->deployables()->modelCount(); ++i) { const MaemoDeployableListModel * const model = deployStep()->deployables()->modelAt(i); - if (!model->isApplicationProject()) + if (!model->hasDesktopFile()) continue; const QString appName = model->applicationName(); if (maemoToolChain()->version() == MaemoToolChain::Maemo6) {