Commit 8bddd27a authored by Christian Kandeler's avatar Christian Kandeler

Maemo: Add possibility to set the SSH port in the device config wizard.

This is for weird people who do port forwarding.

Task-number: QTCREATORBUG-5317
Change-Id: If15cab3cc3a12aa79aef0e1cfd1111db79e57b7c
Reviewed-on: http://codereview.qt.nokia.com/1235Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent b37fda1a
......@@ -82,6 +82,7 @@ struct WizardData
QString publicKeyFilePath;
QString userName;
QString password;
int sshPort;
};
enum PageId {
......@@ -119,6 +120,9 @@ public:
m_ui->hwButton->setChecked(true);
handleDeviceTypeChanged();
m_ui->hostNameLineEdit->setText(defaultHost(deviceType()));
m_ui->sshPortSpinBox->setMinimum(1);
m_ui->sshPortSpinBox->setMaximum(65535);
m_ui->sshPortSpinBox->setValue(22);
connect(m_ui->nameLineEdit, SIGNAL(textChanged(QString)), this,
SIGNAL(completeChanged()));
connect(m_ui->hostNameLineEdit, SIGNAL(textChanged(QString)), this,
......@@ -150,12 +154,20 @@ public:
? LinuxDeviceConfiguration::Physical : LinuxDeviceConfiguration::Emulator;
}
int sshPort() const
{
return deviceType() == LinuxDeviceConfiguration::Emulator
? 6666 : m_ui->sshPortSpinBox->value();
}
private slots:
void handleDeviceTypeChanged()
{
const bool enable = deviceType() == LinuxDeviceConfiguration::Physical;
m_ui->hostNameLabel->setEnabled(enable);
m_ui->hostNameLineEdit->setEnabled(enable);
m_ui->sshPortLabel->setEnabled(enable);
m_ui->sshPortSpinBox->setEnabled(enable);
}
private:
......@@ -495,9 +507,9 @@ private:
SshConnectionParameters sshParams(SshConnectionParameters::NoProxy);
sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword;
sshParams.host = hostAddress();
sshParams.port = 22;
sshParams.port = m_wizardData.sshPort;
sshParams.password = password();
sshParams.timeout = 30;
sshParams.timeout = 10;
sshParams.userName = defaultUser(m_wizardData.osType);
m_ui->statusLabel->setText(tr("Deploying... "));
m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath);
......@@ -609,18 +621,17 @@ LinuxDeviceConfiguration::Ptr MaemoDeviceConfigWizard::deviceConfiguration()
Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy);
sshParams.userName = defaultUser(d->wizardData.osType);
sshParams.host = d->wizardData.hostName;
sshParams.port = d->wizardData.sshPort;
if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator) {
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword;
sshParams.password = d->wizardData.osType == LinuxDeviceConfiguration::MeeGoOsType
? QLatin1String("meego") : QString();
sshParams.port = 6666;
sshParams.timeout = 30;
freePortsSpec = QLatin1String("13219,14168");
doTest = false;
} else {
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByKey;
sshParams.privateKeyFile = d->wizardData.privateKeyFilePath;
sshParams.port = 22;
sshParams.timeout = 10;
freePortsSpec = QLatin1String("10000-10100");
doTest = true;
......@@ -643,7 +654,7 @@ int MaemoDeviceConfigWizard::nextId() const
d->wizardData.osType = d->startPage.osType();
d->wizardData.deviceType = d->startPage.deviceType();
d->wizardData.hostName = d->startPage.hostName();
d->wizardData.sshPort = d->startPage.sshPort();
if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator)
return FinalPageId;
return PreviousKeySetupCheckPageId;
......
......@@ -6,17 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>727</width>
<height>136</height>
<width>721</width>
<height>176</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
......@@ -102,6 +99,33 @@
<item row="3" column="1">
<widget class="QLineEdit" name="hostNameLineEdit"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="sshPortLabel">
<property name="text">
<string>The SSH port:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSpinBox" name="sshPortSpinBox"/>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
......
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