From 12536eeb9f587370346d1b466c9914c05a90d2cd Mon Sep 17 00:00:00 2001 From: Robert Loehning <robert.loehning@nokia.com> Date: Mon, 28 Sep 2009 16:56:31 +0200 Subject: [PATCH] Trk: Checking for result of file creation. Reviewed-by: con --- .../qt-s60/s60devicerunconfiguration.cpp | 6 ++++++ .../qt-s60/s60devicerunconfiguration.h | 1 + src/shared/trk/launcher.cpp | 12 ++++++++---- src/shared/trk/launcher.h | 1 + 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp index 88f2c344149..9b2846fffaa 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp @@ -641,6 +641,7 @@ void S60DeviceRunControl::signsisProcessFinished() m_launcher = new trk::Launcher; connect(m_launcher, SIGNAL(finished()), this, SLOT(runFinished())); connect(m_launcher, SIGNAL(copyingStarted()), this, SLOT(printCopyingNotice())); + connect(m_launcher, SIGNAL(canNotCreateFile(QString,QString)), this, SLOT(printCreateFileFailed(QString,QString))); connect(m_launcher, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice())); connect(m_launcher, SIGNAL(startingApplication()), this, SLOT(printStartingNotice())); connect(m_launcher, SIGNAL(applicationRunning(uint)), this, SLOT(printRunNotice(uint))); @@ -673,6 +674,11 @@ void S60DeviceRunControl::printCopyingNotice() emit addToOutputWindow(this, tr("0% copied.")); } +void S60DeviceRunControl::printCreateFileFailed(const QString &filename, const QString &errorMessage) +{ + emit addToOutputWindow(this, tr("Could not create file %1 on device: %2").arg(filename, errorMessage)); +} + void S60DeviceRunControl::printCopyProgress(int progress) { emit addToOutputWindow(this, tr("%1% copied.").arg(progress)); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h index 5ac7e7be091..48cafb8c7f1 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h @@ -160,6 +160,7 @@ private slots: void signsisProcessFailed(); void signsisProcessFinished(); void printCopyingNotice(); + void printCreateFileFailed(const QString &filename, const QString &errorMessage); void printCopyProgress(int progress); void printInstallingNotice(); void printStartingNotice(); diff --git a/src/shared/trk/launcher.cpp b/src/shared/trk/launcher.cpp index 697498ece3d..e74318ad935 100644 --- a/src/shared/trk/launcher.cpp +++ b/src/shared/trk/launcher.cpp @@ -129,10 +129,10 @@ bool Launcher::startServer(QString *errorMessage) d->m_device.sendTrkMessage(TrkVersions, TrkCallback(this, &Launcher::handleTrkVersion)); if (d->m_fileName.isEmpty()) return true; - if (!d->m_copyState.sourceFileName.isEmpty() && !d->m_copyState.destinationFileName.isEmpty()) - copyFileToRemote(); - else + if (d->m_copyState.sourceFileName.isEmpty() || d->m_copyState.destinationFileName.isEmpty()) installAndRun(); + else + copyFileToRemote(); return true; } @@ -301,7 +301,11 @@ void Launcher::handleTrkVersion(const TrkResult &result) void Launcher::handleFileCreation(const TrkResult &result) { - // we don't do any error handling yet, which is bad + if (result.errorCode() || result.data.size() < 6) { + emit canNotCreateFile(d->m_copyState.destinationFileName, errorMessage(result.errorCode())); + emit finished(); + return; + } const char *data = result.data.data(); d->m_copyState.copyFileHandle = extractInt(data + 2); QFile file(d->m_copyState.sourceFileName); diff --git a/src/shared/trk/launcher.h b/src/shared/trk/launcher.h index b24ed7d73d0..01c83ff7906 100644 --- a/src/shared/trk/launcher.h +++ b/src/shared/trk/launcher.h @@ -57,6 +57,7 @@ public: signals: void copyingStarted(); + void canNotCreateFile(const QString &filename, const QString &errorMessage); void installingStarted(); void startingApplication(); void applicationRunning(uint pid); -- GitLab