OSDN Git Service

Trk: Checking result of TrkInstallFile.
authorRobert Loehning <robert.loehning@nokia.com>
Mon, 5 Oct 2009 17:32:59 +0000 (19:32 +0200)
committerRobert Loehning <robert.loehning@nokia.com>
Mon, 5 Oct 2009 17:33:33 +0000 (19:33 +0200)
src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
src/shared/trk/launcher.cpp
src/shared/trk/launcher.h

index 5b1a314..260e25c 100644 (file)
@@ -630,6 +630,7 @@ void S60DeviceRunControlBase::signsisProcessFinished()
     connect(m_launcher, SIGNAL(canNotCreateFile(QString,QString)), this, SLOT(printCreateFileFailed(QString,QString)));
     connect(m_launcher, SIGNAL(canNotWriteFile(QString,QString)), this, SLOT(printWriteFileFailed(QString,QString)));
     connect(m_launcher, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice()));
+    connect(m_launcher, SIGNAL(canNotInstall(QString,QString)), this, SLOT(printInstallFailed(QString,QString)));
     connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int)));
 
     //TODO sisx destination and file path user definable
@@ -676,6 +677,11 @@ void S60DeviceRunControlBase::printInstallingNotice()
     emit addToOutputWindow(this, tr("Installing application..."));
 }
 
+void S60DeviceRunControlBase::printInstallFailed(const QString &filename, const QString &errorMessage)
+{
+    emit addToOutputWindow(this, tr("Could not install from package %1 on device: %2").arg(filename, errorMessage));
+}
+
 void S60DeviceRunControlBase::launcherFinished()
 {
     m_launcher->deleteLater();
index fd67e54..65f9d7f 100644 (file)
@@ -175,6 +175,7 @@ private slots:
     void printWriteFileFailed(const QString &filename, const QString &errorMessage);
     void printCopyProgress(int progress);
     void printInstallingNotice();
+    void printInstallFailed(const QString &filename, const QString &errorMessage);
     void launcherFinished();
 
 private:
index e6cf4d9..936d740 100644 (file)
@@ -155,7 +155,7 @@ bool Launcher::startServer(QString *errorMessage)
     if (d->m_startupActions & ActionCopy)
         copyFileToRemote();
     else if (d->m_startupActions & ActionInstall)
-        installRemotePackageSilently(d->m_installFileName);
+        installRemotePackageSilently();
     else if (d->m_startupActions & ActionRun)
         startInferiorIfNeeded();
     return true;
@@ -379,7 +379,7 @@ void Launcher::handleFileCopied(const TrkResult &result)
 {
     Q_UNUSED(result)
     if (d->m_startupActions & ActionInstall)
-        installRemotePackageSilently(d->m_installFileName);
+        installRemotePackageSilently();
     else if (d->m_startupActions & ActionRun)
         startInferiorIfNeeded();
     else
@@ -518,21 +518,25 @@ void Launcher::copyFileToRemote()
     d->m_device.sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileCreation), ba);
 }
 
-void Launcher::installRemotePackageSilently(const QString &fileName)
+void Launcher::installRemotePackageSilently()
 {
     emit installingStarted();
     QByteArray ba;
     appendByte(&ba, 'C');
-    appendString(&ba, fileName.toLocal8Bit(), TargetByteOrder, false);
+    appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false);
     d->m_device.sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba);
 }
 
-void Launcher::handleInstallPackageFinished(const TrkResult &)
+void Launcher::handleInstallPackageFinished(const TrkResult &result)
 {
-    if (d->m_startupActions & ActionRun)
+    if (result.errorCode()) {
+        emit canNotInstall(d->m_installFileName, result.errorString());
+        emit finished();
+    } else if (d->m_startupActions & ActionRun) {
         startInferiorIfNeeded();
-    else
+    } else {
         emit finished();
+    }
 }
 
 void Launcher::startInferiorIfNeeded()
index 0af92a8..3c84e6f 100644 (file)
@@ -72,6 +72,7 @@ signals:
     void canNotCreateFile(const QString &filename, const QString &errorMessage);
     void canNotWriteFile(const QString &filename, const QString &errorMessage);
     void installingStarted();
+    void canNotInstall(const QString &packageFilename, const QString &errorMessage);
     void startingApplication();
     void applicationRunning(uint pid);
     void canNotRun(const QString &errorMessage);
@@ -104,7 +105,7 @@ private:
     void waitForTrkFinished(const TrkResult &data);
 
     void copyFileToRemote();
-    void installRemotePackageSilently(const QString &filename);
+    void installRemotePackageSilently();
     void startInferiorIfNeeded();
 
     void logMessage(const QString &msg);