Symbian: Finish CODA's RunControl when usb cable is unplugged

This commit is contained in:
Pawel Polanski
2011-02-07 09:45:54 +01:00
parent 64dd45f7b9
commit d15d07b7cf
2 changed files with 18 additions and 0 deletions

View File

@@ -48,6 +48,8 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <symbianutils/symbiandevicemanager.h>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QScopedPointer> #include <QtCore/QScopedPointer>
@@ -134,6 +136,8 @@ bool CodaRunControl::setupLauncher()
appendMessage(tr("Couldn't open serial device: %1").arg(serialDevice->errorString()), ErrorMessageFormat); appendMessage(tr("Couldn't open serial device: %1").arg(serialDevice->errorString()), ErrorMessageFormat);
return false; return false;
} }
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
this, SLOT(deviceRemoved(SymbianUtils::SymbianDevice)));
m_state = StateConnecting; m_state = StateConnecting;
m_tcfTrkDevice->sendSerialPing(false); m_tcfTrkDevice->sendSerialPing(false);
QTimer::singleShot(4000, this, SLOT(checkForTimeout())); QTimer::singleShot(4000, this, SLOT(checkForTimeout()));
@@ -356,3 +360,12 @@ void CodaRunControl::cancelConnection()
appendMessage(tr("Canceled."), ErrorMessageFormat); appendMessage(tr("Canceled."), ErrorMessageFormat);
emit finished(); emit finished();
} }
void CodaRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &device)
{
if (m_tcfTrkDevice && device.portName() == m_serialPort) {
QString msg = tr("The device '%1' has been disconnected").arg(device.friendlyName());
appendMessage(msg, ErrorMessageFormat);
finishRunControl();
}
}

View File

@@ -47,6 +47,10 @@ class TcfTrkDevice;
class TcfTrkEvent; class TcfTrkEvent;
} }
namespace SymbianUtils {
class SymbianDevice;
}
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
@@ -70,6 +74,7 @@ protected slots:
void finishRunControl(); void finishRunControl();
void checkForTimeout(); void checkForTimeout();
void cancelConnection(); void cancelConnection();
void deviceRemoved(const SymbianUtils::SymbianDevice &device);
private slots: private slots:
void slotError(const QString &error); void slotError(const QString &error);