From 8fe5ac405ea254cb8510e62a9890f42209530e3f Mon Sep 17 00:00:00 2001
From: Aurindam Jana <aurindam.jana@digia.com>
Date: Fri, 26 Apr 2013 10:28:26 +0200
Subject: [PATCH] QmlDebugging: Set correct host when attaching to an
 application

Change-Id: I32030b5320f6de129af77fbde28cf7a4a048d9dc
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
---
 src/plugins/debugger/debuggerplugin.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index eb0a1712e92..b2e0768a652 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -92,6 +92,8 @@
 #include <projectexplorer/session.h>
 #include <projectexplorer/target.h>
 
+#include <android/androidconstants.h>
+
 #include <texteditor/basetexteditor.h>
 #include <texteditor/fontsettings.h>
 #include <texteditor/texteditorsettings.h>
@@ -1754,7 +1756,16 @@ void DebuggerPluginPrivate::attachToQmlPort()
     setConfigValue(_("LastQmlServerPort"), dlg.port());
     setConfigValue(_("LastProfile"), kit->id().toSetting());
 
-    sp.qmlServerAddress = sp.connParams.host;
+    IDevice::ConstPtr device = DeviceKitInformation::device(kit);
+    if (device) {
+        sp.connParams = device->sshParameters();
+        if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
+                || device->type() == Android::Constants::ANDROID_DEVICE_TYPE) {
+            sp.qmlServerAddress = QLatin1String("localhost");
+        } else {
+            sp.qmlServerAddress = sp.connParams.host;
+        }
+    }
     sp.qmlServerPort = dlg.port();
     sp.startMode = AttachToRemoteProcess;
     sp.closeMode = KillAtClose;
-- 
GitLab