CODA: Some extra cleanup is done when a Cancel gets pressed

This commit is contained in:
Pawel Polanski
2011-04-06 13:06:55 +02:00
parent 0cc474230c
commit ff104a1b2a
2 changed files with 17 additions and 5 deletions

View File

@@ -313,10 +313,18 @@ void S60DeployStep::stop()
m_launcher->terminate(); m_launcher->terminate();
} else { } else {
if (m_codaDevice) { if (m_codaDevice) {
switch (m_state) {
case StateSendingData:
closeRemoteFile();
break;
default:
break; //should also stop the package installatrion, but CODA does not support it yet
}
disconnect(m_codaDevice.data(), 0, this, 0); disconnect(m_codaDevice.data(), 0, this, 0);
SymbianUtils::SymbianDeviceManager::instance()->releaseCodaDevice(m_codaDevice); SymbianUtils::SymbianDeviceManager::instance()->releaseCodaDevice(m_codaDevice);
} }
} }
m_state = StateUninit;
emit finished(false); emit finished(false);
} }
@@ -350,9 +358,8 @@ void S60DeployStep::setupConnections()
void S60DeployStep::startDeployment() void S60DeployStep::startDeployment()
{ {
if (m_channel == S60DeployConfiguration::CommunicationTrkSerialConnection) { if (m_channel == S60DeployConfiguration::CommunicationTrkSerialConnection)
QTC_ASSERT(m_launcher, return); QTC_ASSERT(m_launcher, return);
}
QTC_ASSERT(!m_codaDevice.data(), return); QTC_ASSERT(!m_codaDevice.data(), return);
// We need to defer setupConnections() in the case of CommunicationCodaSerialConnection // We need to defer setupConnections() in the case of CommunicationCodaSerialConnection
@@ -573,9 +580,10 @@ void S60DeployStep::handleSymbianInstall(const Coda::CodaCommandResult &result)
{ {
if (result.type == Coda::CodaCommandResult::SuccessReply) { if (result.type == Coda::CodaCommandResult::SuccessReply) {
appendMessage(tr("Installation has finished"), false); appendMessage(tr("Installation has finished"), false);
if (++m_currentFileIndex >= m_signedPackages.count()) if (++m_currentFileIndex >= m_signedPackages.count()) {
m_state = StateFinished;
emit allFilesInstalled(); emit allFilesInstalled();
else } else
initFileInstallation(); initFileInstallation();
} else { } else {
reportError(tr("Installation failed: %1; " reportError(tr("Installation failed: %1; "
@@ -613,8 +621,10 @@ void S60DeployStep::closeRemoteFile()
{ {
QTC_ASSERT(m_codaDevice, return); QTC_ASSERT(m_codaDevice, return);
emit addOutput(QLatin1String("\n"), ProjectExplorer::BuildStep::MessageOutput);
m_codaDevice->sendFileSystemCloseCommand(Coda::CodaCallback(this, &S60DeployStep::handleFileSystemClose), m_codaDevice->sendFileSystemCloseCommand(Coda::CodaCallback(this, &S60DeployStep::handleFileSystemClose),
m_remoteFileHandle); m_remoteFileHandle);
} }
void S60DeployStep::handleFileSystemWrite(const Coda::CodaCommandResult &result) void S60DeployStep::handleFileSystemWrite(const Coda::CodaCommandResult &result)
@@ -743,6 +753,7 @@ void S60DeployStep::installFailed(const QString &filename, const QString &errorM
void S60DeployStep::checkForCancel() void S60DeployStep::checkForCancel()
{ {
if ((m_futureInterface->isCanceled() || m_deployCanceled) && m_timer->isActive()) { if ((m_futureInterface->isCanceled() || m_deployCanceled) && m_timer->isActive()) {
closeRemoteFile();
m_timer->stop(); m_timer->stop();
stop(); stop();
QString canceledText(tr("Deployment has been cancelled.")); QString canceledText(tr("Deployment has been cancelled."));

View File

@@ -184,7 +184,8 @@ private:
StateConnecting, StateConnecting,
StateConnected, StateConnected,
StateSendingData, StateSendingData,
StateInstalling StateInstalling,
StateFinished
}; };
QString m_serialPortName; QString m_serialPortName;