From 3cd64380ffe389a6081bea2261fb7ec2c22bf2ee Mon Sep 17 00:00:00 2001
From: Fawzi Mohamed <fawzi.mohamed@digia.com>
Date: Wed, 26 Mar 2014 16:50:12 +0100
Subject: [PATCH] ios: correctly update run configuration names

Change-Id: I46ea3e273f7e0e9a015c867a2bec261006bec117
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
---
 src/plugins/ios/iosrunconfiguration.cpp | 10 +++++++---
 src/plugins/ios/iosrunconfiguration.h   |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/plugins/ios/iosrunconfiguration.cpp b/src/plugins/ios/iosrunconfiguration.cpp
index 22406dbeef2..798e5591069 100644
--- a/src/plugins/ios/iosrunconfiguration.cpp
+++ b/src/plugins/ios/iosrunconfiguration.cpp
@@ -100,6 +100,7 @@ void IosRunConfiguration::init()
     m_parseInProgress = project->parseInProgress(m_profilePath);
     m_lastIsEnabled = isEnabled();
     m_lastDisabledReason = disabledReason();
+    updateDisplayNames();
     connect(DeviceManager::instance(), SIGNAL(updated()),
             SLOT(deviceChanges()));
     connect(KitManager::instance(), SIGNAL(kitsChanged()),
@@ -120,7 +121,7 @@ void IosRunConfiguration::enabledCheck()
 }
 
 void IosRunConfiguration::deviceChanges() {
-    setDefaultDisplayName(defaultDisplayName());
+    updateDisplayNames();
     enabledCheck();
 }
 
@@ -131,6 +132,8 @@ void IosRunConfiguration::proFileUpdated(QmakeProjectManager::QmakeProFileNode *
         return;
     m_parseSuccess = success;
     m_parseInProgress = parseInProgress;
+    if (success && !parseInProgress)
+        updateDisplayNames();
     enabledCheck();
 }
 
@@ -149,12 +152,13 @@ QStringList IosRunConfiguration::commandLineArguments()
     return m_arguments;
 }
 
-QString IosRunConfiguration::defaultDisplayName()
+void IosRunConfiguration::updateDisplayNames()
 {
     ProjectExplorer::IDevice::ConstPtr dev =
             ProjectExplorer::DeviceKitInformation::device(target()->kit());
     const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
-    return tr("Run on %1").arg(devName);
+    setDefaultDisplayName(tr("Run on %1").arg(devName));
+    setDisplayName(tr("Run %1 on %2").arg(appName()).arg(devName));
 }
 
 IosDeployStep *IosRunConfiguration::deployStep() const
diff --git a/src/plugins/ios/iosrunconfiguration.h b/src/plugins/ios/iosrunconfiguration.h
index 02789fe62b2..73fbe80a156 100644
--- a/src/plugins/ios/iosrunconfiguration.h
+++ b/src/plugins/ios/iosrunconfiguration.h
@@ -72,7 +72,6 @@ public:
 
 protected:
     IosRunConfiguration(ProjectExplorer::Target *parent, IosRunConfiguration *source);
-    QString defaultDisplayName();
 
 private slots:
     void proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress);
@@ -81,6 +80,7 @@ private:
     void init();
     void enabledCheck();
     friend class IosRunConfigurationWidget;
+    void updateDisplayNames();
 
     QString m_profilePath;
     QStringList m_arguments;
-- 
GitLab