void MaemoDeviceEnvReader::stop()
{
m_stop = true;
- disconnect(m_connection.data(), 0, this, 0);
+ if (m_connection)
+ disconnect(m_connection.data(), 0, this, 0);
if (m_remoteProcess) {
disconnect(m_remoteProcess.data());
m_remoteProcess->closeChannel();
SLOT(remoteErrorOutput(QByteArray)));
m_remoteOutput.clear();
+ m_remoteErrorOutput.clear();
m_remoteProcess->start();
}
{
emit error(tr("Could not connect to host: %1")
.arg(m_connection->errorString()));
- emit finished();
+ setFinished();
}
void MaemoDeviceEnvReader::handleCurrentDeviceConfigChanged()
m_devConfig = m_runConfig->deviceConfig();
m_env.clear();
- emit finished();
+ setFinished();
}
void MaemoDeviceEnvReader::remoteProcessFinished(int exitCode)
QString::SkipEmptyParts));
}
} else {
- emit error(tr("Error running remote process: %1")
- .arg(m_remoteProcess->errorString()));
+ QString errorMsg = tr("Error running remote process: %1")
+ .arg(m_remoteProcess->errorString());
+ if (!m_remoteErrorOutput.isEmpty()) {
+ errorMsg += tr("\nRemote stderr was: '%1'")
+ .arg(QString::fromUtf8(m_remoteErrorOutput));
+ }
+ emit error(errorMsg);
}
- emit finished();
+ setFinished();
}
void MaemoDeviceEnvReader::remoteOutput(const QByteArray &data)
void MaemoDeviceEnvReader::remoteErrorOutput(const QByteArray &data)
{
- emit error(data);
+ m_remoteErrorOutput += data;
+}
+
+void MaemoDeviceEnvReader::setFinished()
+{
+ stop();
+ emit finished();
}
- } // Internal
+} // Internal
} // Qt4ProjectManager
#include <qt4projectmanager/qt4target.h>
#include <utils/detailswidget.h>
+#include <QtCore/QCoreApplication>
#include <QtGui/QComboBox>
#include <QtGui/QFileDialog>
#include <QtGui/QFormLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
+#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
#include <QtGui/QRadioButton>
#include <QtGui/QTableView>
namespace Qt4ProjectManager {
namespace Internal {
+namespace {
+const QString FetchEnvButtonText
+ = QCoreApplication::translate("Qt4ProjectManager::Internal::MaemoRunConfigurationWidget",
+ "Fetch Device Environment");
+} // anonymous namespace
MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
MaemoRunConfiguration *runConfiguration, QWidget *parent)
m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentBase());
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
- m_fetchEnv = new QPushButton(tr("Fetch Device Environment"));
+ m_fetchEnv = new QPushButton(FetchEnvButtonText);
baseEnvironmentLayout->addWidget(m_fetchEnv);
baseEnvironmentLayout->addStretch(10);
connect(m_runConfiguration,
SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
this, SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)));
- connect(m_fetchEnv, SIGNAL(pressed()), this, SLOT(fetchEnvironment()));
+ connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
connect(m_deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished()));
+ connect(m_deviceEnvReader, SIGNAL(error(QString)), this,
+ SLOT(fetchEnvironmentError(QString)));
}
void MaemoRunConfigurationWidget::argumentsEdited(const QString &text)
void MaemoRunConfigurationWidget::fetchEnvironment()
{
+ disconnect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
+ connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment()));
+ m_fetchEnv->setText(tr("Cancel Fetch Operation"));
m_deviceEnvReader->start();
- m_fetchEnv->setEnabled(false);
+}
+
+void MaemoRunConfigurationWidget::stopFetchEnvironment()
+{
+ m_deviceEnvReader->stop();
+ fetchEnvironmentFinished();
}
void MaemoRunConfigurationWidget::fetchEnvironmentFinished()
{
- m_fetchEnv->setEnabled(true);
+ disconnect(m_fetchEnv, SIGNAL(clicked()), this,
+ SLOT(stopFetchEnvironment()));
+ connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment()));
+ m_fetchEnv->setText(FetchEnvButtonText);
m_runConfiguration->setSystemEnvironment(m_deviceEnvReader->deviceEnvironment());
}
+void MaemoRunConfigurationWidget::fetchEnvironmentError(const QString &error)
+{
+ QMessageBox::warning(this, tr("Device error"),
+ tr("Fetching environment failed: %1").arg(error));
+}
+
void MaemoRunConfigurationWidget::userChangesEdited()
{
m_ignoreChange = true;