diff --git a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp index 7b0dbd871a9..82ab15fd371 100644 --- a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp @@ -48,6 +48,8 @@ #include #include +#include + #include #include #include @@ -134,6 +136,8 @@ bool CodaRunControl::setupLauncher() appendMessage(tr("Couldn't open serial device: %1").arg(serialDevice->errorString()), ErrorMessageFormat); return false; } + connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)), + this, SLOT(deviceRemoved(SymbianUtils::SymbianDevice))); m_state = StateConnecting; m_tcfTrkDevice->sendSerialPing(false); QTimer::singleShot(4000, this, SLOT(checkForTimeout())); @@ -356,3 +360,12 @@ void CodaRunControl::cancelConnection() appendMessage(tr("Canceled."), ErrorMessageFormat); 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(); + } +} diff --git a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.h b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.h index 087fcb0e034..3065aeaec87 100644 --- a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.h +++ b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.h @@ -47,6 +47,10 @@ class TcfTrkDevice; class TcfTrkEvent; } +namespace SymbianUtils { +class SymbianDevice; +} + namespace Qt4ProjectManager { namespace Internal { @@ -70,6 +74,7 @@ protected slots: void finishRunControl(); void checkForTimeout(); void cancelConnection(); + void deviceRemoved(const SymbianUtils::SymbianDevice &device); private slots: void slotError(const QString &error);