forked from qt-creator/qt-creator
Maemo: Make SSH connection error messages a bit more helpful.
Task-number: QTCREATORBUG-3225
This commit is contained in:
@@ -335,11 +335,14 @@ void MaemoDeployStep::start()
|
||||
|
||||
void MaemoDeployStep::handleConnectionFailure()
|
||||
{
|
||||
if (m_state != Inactive) {
|
||||
raiseError(tr("Could not connect to host: %1")
|
||||
.arg(m_connection->errorString()));
|
||||
setState(Inactive);
|
||||
}
|
||||
if (m_state == Inactive)
|
||||
return;
|
||||
|
||||
const QString errorMsg = m_state == Connecting
|
||||
? MaemoGlobal::failedToConnectToServerMessage(m_connection, deviceConfig())
|
||||
: tr("Connection error: %1").arg(m_connection->errorString());
|
||||
raiseError(errorMsg);
|
||||
setState(Inactive);
|
||||
}
|
||||
|
||||
void MaemoDeployStep::handleSftpChannelInitialized()
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
|
||||
#include "maemoglobal.h"
|
||||
|
||||
#include "maemodeviceconfigurations.h"
|
||||
|
||||
#include <coreplugin/ssh/sshconnection.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
@@ -79,6 +82,23 @@ QString MaemoGlobal::remoteEnvironment(const QList<Utils::EnvironmentItem> &list
|
||||
return env.mid(0, env.size() - 1);
|
||||
}
|
||||
|
||||
QString MaemoGlobal::failedToConnectToServerMessage(const Core::SshConnection::Ptr &connection,
|
||||
const MaemoDeviceConfig &deviceConfig)
|
||||
{
|
||||
QString errorMsg = TR("Could not connect to host: %1")
|
||||
.arg(connection->errorString());
|
||||
|
||||
if (deviceConfig.type == MaemoDeviceConfig::Simulator) {
|
||||
if (connection->errorState() == Core::SshTimeoutError
|
||||
|| connection->errorState() == Core::SshSocketError) {
|
||||
errorMsg += TR("\nDid you start Qemu?");
|
||||
}
|
||||
} else if (connection->errorState() == Core::SshTimeoutError) {
|
||||
errorMsg += TR("\nIs the device connected and set up for network access?");
|
||||
}
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
bool MaemoGlobal::removeRecursively(const QString &filePath, QString &error)
|
||||
{
|
||||
QFileInfo fileInfo(filePath);
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QSharedPointer>
|
||||
|
||||
#define ASSERT_STATE_GENERIC(State, expected, actual) \
|
||||
MaemoGlobal::assertState<State>(expected, actual, Q_FUNC_INFO)
|
||||
@@ -46,8 +47,11 @@ class QProcess;
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core { class SshConnection; }
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
class MaemoDeviceConfig;
|
||||
|
||||
class MaemoGlobal
|
||||
{
|
||||
@@ -57,6 +61,8 @@ public:
|
||||
static QString remoteCommandPrefix(const QString &commandFilePath);
|
||||
static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list);
|
||||
static QString remoteSourceProfilesCommand();
|
||||
static QString failedToConnectToServerMessage(const QSharedPointer<Core::SshConnection> &connection,
|
||||
const MaemoDeviceConfig &deviceConfig);
|
||||
|
||||
static bool removeRecursively(const QString &filePath, QString &error);
|
||||
static void callMaddeShellScript(QProcess &proc, const QString &maddeRoot,
|
||||
|
||||
@@ -152,9 +152,10 @@ void MaemoSshRunner::handleConnectionFailure()
|
||||
if (m_state == Inactive)
|
||||
qWarning("Unexpected state %d in %s.", m_state, Q_FUNC_INFO);
|
||||
|
||||
const QString errorTemplate = m_state == Connecting
|
||||
? tr("Could not connect to host: %1") : tr("Connection failed: %1");
|
||||
emitError(errorTemplate.arg(m_connection->errorString()));
|
||||
const QString errorMsg = m_state == Connecting
|
||||
? MaemoGlobal::failedToConnectToServerMessage(m_connection, m_devConfig)
|
||||
: tr("Connection error: %1").arg(m_connection->errorString());
|
||||
emitError(errorMsg);
|
||||
}
|
||||
|
||||
void MaemoSshRunner::cleanup()
|
||||
|
||||
Reference in New Issue
Block a user