Commit 12536eeb authored by Robert Loehning's avatar Robert Loehning
Browse files

Trk: Checking for result of file creation.

Reviewed-by: con
parent 3ca067ad
......@@ -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));
......
......@@ -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();
......
......@@ -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);
......
......@@ -57,6 +57,7 @@ public:
signals:
void copyingStarted();
void canNotCreateFile(const QString &filename, const QString &errorMessage);
void installingStarted();
void startingApplication();
void applicationRunning(uint pid);
......
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