Commit 0e669ace authored by El Mehdi Fekari's avatar El Mehdi Fekari Committed by Mehdi Fekari

Qnx: Fix device connection issue

BlackBerry device connections need the Qnx environments
to be set first to find the path to the conenct.jar package.
The device connection at startup needs to wait
for the Qnx setting to be loaded.

Change-Id: I89ad41a65da951f9f9c7a702346f8d4bb428d1cd
Reviewed-by: default avatarTobias Nätterlund <tobias.naetterlund@kdab.com>
Reviewed-by: Nicolas Arnaud-Cormos's avatarNicolas Arnaud-Cormos <nicolas@kdab.com>
parent 7f6265f6
......@@ -328,6 +328,8 @@ void BlackBerryConfigurationManager::loadSettings()
loadAutoDetectedConfigurations();
loadManualConfigurations();
loadCertificates();
emit settingsLoaded();
}
void BlackBerryConfigurationManager::clearConfigurationSettings(BlackBerryConfiguration *config)
......
......@@ -75,6 +75,9 @@ public slots:
void loadSettings();
void saveSettings();
signals:
void settingsLoaded();
private:
BlackBerryConfigurationManager(QObject *parent = 0);
static BlackBerryConfigurationManager *m_instance;
......
......@@ -33,6 +33,7 @@
#include "blackberrydeviceconfiguration.h"
#include "blackberrydeviceconnection.h"
#include "blackberryconfigurationmanager.h"
#include "qnxconstants.h"
#include <coreplugin/icore.h>
......@@ -110,6 +111,16 @@ void BlackBerryDeviceConnectionManager::connectDevice(Core::Id deviceId)
if (device.isNull())
return;
// BlackBerry Device connection needs the Qnx environments to be set
// in order to find the Connect.jar package.
// Let's delay the device connections at startup till the Qnx settings are loaded.
if (BlackBerryConfigurationManager::instance().configurations().isEmpty()) {
m_pendingDeviceConnections << device;
connect(&BlackBerryConfigurationManager::instance(), SIGNAL(settingsLoaded()),
this, SLOT(processPendingDeviceConnections()), Qt::UniqueConnection);
return;
}
connectDevice(device);
}
......@@ -292,6 +303,20 @@ void BlackBerryDeviceConnectionManager::handleProcessOutput(const QString &outpu
emit connectionOutput(deviceId, output);
}
void BlackBerryDeviceConnectionManager::processPendingDeviceConnections()
{
if (m_pendingDeviceConnections.isEmpty()
|| BlackBerryConfigurationManager::instance().configurations().isEmpty())
return;
foreach (ProjectExplorer::IDevice::ConstPtr device, m_pendingDeviceConnections)
connectDevice(device);
m_pendingDeviceConnections.clear();
disconnect(&BlackBerryConfigurationManager::instance(), SIGNAL(settingsLoaded()),
this, SLOT(processPendingDeviceConnections()));
}
BlackBerryDeviceConnection *BlackBerryDeviceConnectionManager::connectionForHost(const QString &host) const
{
QList<BlackBerryDeviceConnection*> connections = m_connections.uniqueKeys();
......
......@@ -83,6 +83,8 @@ private slots:
void handleProcessOutput(const QString &output);
void processPendingDeviceConnections();
private:
explicit BlackBerryDeviceConnectionManager();
......@@ -97,6 +99,8 @@ private:
static BlackBerryDeviceConnectionManager *m_instance;
QMultiMap<BlackBerryDeviceConnection*, Core::Id> m_connections;
QList<ProjectExplorer::IDevice::ConstPtr> m_pendingDeviceConnections;
};
} // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment