From 157ff4889e8aa0b97d3d72679bca08e54288e386 Mon Sep 17 00:00:00 2001
From: ck <qt-info@nokia.com>
Date: Mon, 12 Apr 2010 10:55:17 +0200
Subject: [PATCH] Maemo: Make errors more obvious to users.

Reviewed-by: kh1
---
 .../qt-maemo/maemoruncontrol.cpp                 | 16 +++++++++++++---
 .../qt4projectmanager/qt-maemo/maemoruncontrol.h |  1 +
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
index 60906fb95c7..7f4e2127c4e 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
@@ -49,6 +49,8 @@
 #include <QtCore/QProcess>
 #include <QtCore/QStringBuilder>
 
+#include <QtGui/QMessageBox>
+
 namespace Qt4ProjectManager {
 namespace Internal {
 
@@ -86,6 +88,7 @@ void AbstractMaemoRunControl::startDeployment(bool forDebugging)
 
         deploy();
     } else {
+        handleError(tr("No device configuration set for run configuration."));
         handleDeploymentFinished(false);
     }
 }
@@ -146,7 +149,7 @@ void AbstractMaemoRunControl::deployProcessFinished()
     if (success) {
         emit addToOutputWindow(this, tr("Deployment finished."));
     } else {
-        emit error(this, tr("Deployment failed: %1").arg(sshDeployer->error()));
+        handleError(tr("Deployment failed: %1").arg(sshDeployer->error()));
         m_progress.reportCanceled();
     }
     m_progress.reportFinished();
@@ -206,6 +209,12 @@ const QString AbstractMaemoRunControl::targetCmdLinePrefix() const
         arg(executableOnTarget());
 }
 
+void AbstractMaemoRunControl::handleError(const QString &errString)
+{
+    QMessageBox::critical(0, tr("Remote Execution Failure"), errString);
+    emit error(this, errString);
+}
+
 
 MaemoRunControl::MaemoRunControl(RunConfiguration *runConfiguration)
     : AbstractMaemoRunControl(runConfiguration)
@@ -251,7 +260,8 @@ void MaemoRunControl::executionFinished()
     if (stoppedByUser) {
         emit addToOutputWindow(this, tr("Remote process stopped by user."));
     } else if (sshRunner->hasError()) {
-        emit addToOutputWindow(this, tr("Remote process exited with error: %1").arg(sshRunner->error()));
+        emit addToOutputWindow(this, tr("Remote process exited with error: %1")
+                                         .arg(sshRunner->error()));
     } else {
         emit addToOutputWindow(this, tr("Remote process finished successfully."));
     }
@@ -351,7 +361,7 @@ void MaemoDebugRunControl::startGdbServer()
 
 void MaemoDebugRunControl::gdbServerStartFailed(const QString &reason)
 {
-    emit addToOutputWindow(this, tr("Debugging failed: %1").arg(reason));
+    handleError(tr("Debugging failed: %1").arg(reason));
     emit stopRequested();
     emit finished();
 }
diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h
index bcc9de92abe..27862a7f1b6 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h
@@ -70,6 +70,7 @@ protected:
     void startDeployment(bool forDebugging);
     void deploy();
     void stopDeployment();
+    void handleError(const QString &errString);
     bool isDeploying() const;
     const QString executableOnHost() const;
     const QString executableOnTarget() const;
-- 
GitLab