From ed6f28522d77fb96e7c78e9f139412bc82d350f6 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Mon, 4 Oct 2010 13:18:40 +0200
Subject: [PATCH] QmlInspector: Fix regression in live preview

ClientProxy::isEnabled() now only returns true when the server plugins
are available too. Wait until then before using it to initialize
the livepreview objects.

Reviewed-by: Lasse Holmstedt
---
 src/plugins/qmljsinspector/qmljsinspectorplugin.cpp | 13 ++++++++++---
 src/plugins/qmljsinspector/qmljsinspectorplugin.h   |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/plugins/qmljsinspector/qmljsinspectorplugin.cpp b/src/plugins/qmljsinspector/qmljsinspectorplugin.cpp
index a972d1ba505..a89f00d0baa 100644
--- a/src/plugins/qmljsinspector/qmljsinspectorplugin.cpp
+++ b/src/plugins/qmljsinspector/qmljsinspectorplugin.cpp
@@ -118,14 +118,16 @@ void InspectorPlugin::extensionsInitialized()
     m_inspectorUi->setupUi();
 }
 
-// The adapter object is only added to the pool with a succesful connection,
-// so we can immediately init our stuff.
 void InspectorPlugin::objectAdded(QObject *object)
 {
     Debugger::QmlAdapter *adapter = qobject_cast<Debugger::QmlAdapter *>(object);
     if (adapter) {
         m_clientProxy = new ClientProxy(adapter);
-        m_inspectorUi->connected(m_clientProxy);
+        if (m_clientProxy->isConnected()) {
+            clientProxyConnected();
+        } else {
+            connect(m_clientProxy, SIGNAL(connected()), this, SLOT(clientProxyConnected()));
+        }
         return;
     }
 
@@ -148,4 +150,9 @@ void InspectorPlugin::aboutToRemoveObject(QObject *obj)
     }
 }
 
+void InspectorPlugin::clientProxyConnected()
+{
+    m_inspectorUi->connected(m_clientProxy);
+}
+
 Q_EXPORT_PLUGIN(InspectorPlugin)
diff --git a/src/plugins/qmljsinspector/qmljsinspectorplugin.h b/src/plugins/qmljsinspector/qmljsinspectorplugin.h
index ea4a378c74e..f0f9500fb74 100644
--- a/src/plugins/qmljsinspector/qmljsinspectorplugin.h
+++ b/src/plugins/qmljsinspector/qmljsinspectorplugin.h
@@ -74,6 +74,7 @@ public:
 private slots:
     void objectAdded(QObject *object);
     void aboutToRemoveObject(QObject *obj);
+    void clientProxyConnected();
 
 private:
     void createActions();
-- 
GitLab