forked from qt-creator/qt-creator
Implement ssh key generation dialog.
Reviewed-by: ck
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include "maemoconfigtestdialog.h"
|
#include "maemoconfigtestdialog.h"
|
||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfigurations.h"
|
||||||
|
#include "maemosshconfigdialog.h"
|
||||||
#include "maemosshthread.h"
|
#include "maemosshthread.h"
|
||||||
|
|
||||||
#include <QtCore/QRegExp>
|
#include <QtCore/QRegExp>
|
||||||
@@ -118,7 +119,6 @@ MaemoSettingsWidget::MaemoSettingsWidget(QWidget *parent)
|
|||||||
m_nameValidator(new NameValidator(m_devConfs)),
|
m_nameValidator(new NameValidator(m_devConfs)),
|
||||||
m_timeoutValidator(new TimeoutValidator),
|
m_timeoutValidator(new TimeoutValidator),
|
||||||
m_keyDeployer(0)
|
m_keyDeployer(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
initGui();
|
initGui();
|
||||||
}
|
}
|
||||||
@@ -160,6 +160,7 @@ void MaemoSettingsWidget::initGui()
|
|||||||
m_ui->nameLineEdit->setValidator(m_nameValidator);
|
m_ui->nameLineEdit->setValidator(m_nameValidator);
|
||||||
m_ui->timeoutLineEdit->setValidator(m_timeoutValidator);
|
m_ui->timeoutLineEdit->setValidator(m_timeoutValidator);
|
||||||
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
||||||
|
|
||||||
foreach (const MaemoDeviceConfig &devConf, m_devConfs)
|
foreach (const MaemoDeviceConfig &devConf, m_devConfs)
|
||||||
m_ui->configurationComboBox->addItem(devConf.name);
|
m_ui->configurationComboBox->addItem(devConf.name);
|
||||||
connect(m_ui->configurationComboBox, SIGNAL(currentIndexChanged(int)),
|
connect(m_ui->configurationComboBox, SIGNAL(currentIndexChanged(int)),
|
||||||
@@ -350,27 +351,49 @@ void MaemoSettingsWidget::testConfig()
|
|||||||
dialog->open();
|
dialog->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoSettingsWidget::showGenerateSshKeyDialog()
|
||||||
|
{
|
||||||
|
MaemoSshConfigDialog dialog(this);
|
||||||
|
connect(&dialog, SIGNAL(publicKeyGenerated(QString)), this,
|
||||||
|
SLOT(setPublicKey(QString)));
|
||||||
|
connect(&dialog, SIGNAL(privateKeyGenerated(QString)), this,
|
||||||
|
SLOT(setPrivateKey(QString)));
|
||||||
|
dialog.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoSettingsWidget::setPublicKey(const QString &path)
|
||||||
|
{
|
||||||
|
m_publicKey = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoSettingsWidget::setPrivateKey(const QString &path)
|
||||||
|
{
|
||||||
|
m_ui->keyFileLineEdit->setPath(path);
|
||||||
|
keyFileEditingFinished();
|
||||||
|
}
|
||||||
|
|
||||||
void MaemoSettingsWidget::deployKey()
|
void MaemoSettingsWidget::deployKey()
|
||||||
{
|
{
|
||||||
if (m_keyDeployer)
|
if (m_keyDeployer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QString &dir = QFileInfo(currentConfig().keyFile).path();
|
if (!QFileInfo(m_publicKey).exists()) {
|
||||||
const QString &keyFile = QFileDialog::getOpenFileName(this,
|
const QString &dir = QFileInfo(currentConfig().keyFile).path();
|
||||||
tr("Choose public key file"), dir,
|
m_publicKey = QFileDialog::getOpenFileName(this,
|
||||||
tr("Public Key Files(*.pub);;All Files (*)"));
|
tr("Choose public key file"), dir,
|
||||||
if (keyFile.isEmpty())
|
tr("Public Key Files(*.pub);;All Files (*)"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_publicKey.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_ui->deployKeyButton->disconnect();
|
m_ui->deployKeyButton->disconnect();
|
||||||
SshDeploySpec deploySpec(keyFile, homeDirOnDevice(currentConfig().uname)
|
SshDeploySpec deploySpec(m_publicKey, homeDirOnDevice(currentConfig().uname)
|
||||||
+ QLatin1String("/.ssh/authorized_keys"), true);
|
+ QLatin1String("/.ssh/authorized_keys"), true);
|
||||||
m_keyDeployer = new MaemoSshDeployer(currentConfig(), QList<SshDeploySpec>() << deploySpec);
|
m_keyDeployer = new MaemoSshDeployer(currentConfig(), QList<SshDeploySpec>() << deploySpec);
|
||||||
connect(m_keyDeployer, SIGNAL(finished()),
|
connect(m_keyDeployer, SIGNAL(finished()), this, SLOT(handleDeployThreadFinished()));
|
||||||
this, SLOT(handleDeployThreadFinished()));
|
|
||||||
m_ui->deployKeyButton->setText(tr("Stop deploying"));
|
m_ui->deployKeyButton->setText(tr("Stop deploying"));
|
||||||
connect(m_ui->deployKeyButton, SIGNAL(clicked()),
|
connect(m_ui->deployKeyButton, SIGNAL(clicked()), this, SLOT(stopDeploying()));
|
||||||
this, SLOT(stopDeploying()));
|
|
||||||
m_keyDeployer->start();
|
m_keyDeployer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,11 +433,13 @@ void MaemoSettingsWidget::currentConfigChanged(int index)
|
|||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
m_ui->removeConfigButton->setEnabled(false);
|
m_ui->removeConfigButton->setEnabled(false);
|
||||||
m_ui->testConfigButton->setEnabled(false);
|
m_ui->testConfigButton->setEnabled(false);
|
||||||
|
m_ui->generateKeyButton->setEnabled(false);
|
||||||
clearDetails();
|
clearDetails();
|
||||||
m_ui->detailsWidget->setEnabled(false);
|
m_ui->detailsWidget->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
m_ui->removeConfigButton->setEnabled(true);
|
m_ui->removeConfigButton->setEnabled(true);
|
||||||
m_ui->testConfigButton->setEnabled(true);
|
m_ui->testConfigButton->setEnabled(true);
|
||||||
|
m_ui->generateKeyButton->setEnabled(true);
|
||||||
m_ui->configurationComboBox->setCurrentIndex(index);
|
m_ui->configurationComboBox->setCurrentIndex(index);
|
||||||
display(currentConfig());
|
display(currentConfig());
|
||||||
}
|
}
|
||||||
|
@@ -82,6 +82,10 @@ private slots:
|
|||||||
// For configuration testing.
|
// For configuration testing.
|
||||||
void testConfig();
|
void testConfig();
|
||||||
|
|
||||||
|
void showGenerateSshKeyDialog();
|
||||||
|
void setPublicKey(const QString &path);
|
||||||
|
void setPrivateKey(const QString &path);
|
||||||
|
|
||||||
// For key deploying.
|
// For key deploying.
|
||||||
void deployKey();
|
void deployKey();
|
||||||
void handleDeployThreadFinished();
|
void handleDeployThreadFinished();
|
||||||
@@ -104,6 +108,7 @@ private:
|
|||||||
NameValidator * const m_nameValidator;
|
NameValidator * const m_nameValidator;
|
||||||
TimeoutValidator * const m_timeoutValidator;
|
TimeoutValidator * const m_timeoutValidator;
|
||||||
MaemoSshDeployer *m_keyDeployer;
|
MaemoSshDeployer *m_keyDeployer;
|
||||||
|
QString m_publicKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -6,39 +6,262 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>550</width>
|
<width>484</width>
|
||||||
<height>350</height>
|
<height>307</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Maemo Device Configurations</string>
|
<string>Maemo Device Configurations</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item row="0" column="0" colspan="2">
|
<item>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="configurationLabel">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<property name="text">
|
<item row="0" column="0">
|
||||||
<string>Configuration:</string>
|
<widget class="QLabel" name="configurationLabel">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>Configuration:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="configurationComboBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
<widget class="QComboBox" name="configurationComboBox">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="sizePolicy">
|
<property name="frameShape">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
<enum>QFrame::StyledPanel</enum>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="editable">
|
<property name="frameShadow">
|
||||||
<bool>false</bool>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="detailsWidget" native="true">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="deviceNameLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="nameLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="deviceTypeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Device type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QWidget" name="deviceTypeButtonsWidget" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="deviceButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remote Device</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="simulatorButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Local Simulator</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="authTypeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Authentication type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QWidget" name="authTypeButtonsWidget" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="passwordButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Password</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="keyButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Key</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="hostNameLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Host Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="hostLineEdit">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>IP or host name of the device</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="portsLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Ports:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="sshPortLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>SSH:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="sshPortSpinBox">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>22</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="gdbServerLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Gdb server:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="gdbServerPortSpinBox">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="connectionTimeoutLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Connection Timeout:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLineEdit" name="timeoutLineEdit">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Timeout value in milliseconds</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="userNameLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>User Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QLineEdit" name="userLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="passwordLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Password:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="QLineEdit" name="pwdLineEdit">
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="keyLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Private key file:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
|
<widget class="Utils::PathChooser" name="keyFileLineEdit" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2" rowspan="2">
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="addConfigButton">
|
<widget class="QPushButton" name="addConfigButton">
|
||||||
@@ -67,13 +290,23 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="generateKeyButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Generate SSH Key ...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="deployKeyButton">
|
<widget class="QPushButton" name="deployKeyButton">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Deploy Key ...</string>
|
<string>Deploy public Key ...</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -92,226 +325,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QFrame" name="frame">
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="detailsWidget" native="true">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="deviceNameLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Name</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="nameLineEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="deviceTypeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Device type:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QWidget" name="deviceTypeButtonsWidget" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="deviceButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Remote device</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="simulatorButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Local simulator</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="authTypeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Authentication type:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QWidget" name="authTypeButtonsWidget" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="passwordButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Password</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="keyButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Key</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="hostNameLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Host name:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLineEdit" name="hostLineEdit">
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>IP or host name of the device</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="portsLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Ports:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="sshPortLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>SSH:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="sshPortSpinBox">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>65535</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>22</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="gdbServerLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Gdb server:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="gdbServerPortSpinBox">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>65535</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>10000</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="connectionTimeoutLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Connection timeout:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QLineEdit" name="timeoutLineEdit">
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>Timeout value in milliseconds</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLabel" name="userNameLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>User name:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLineEdit" name="userLineEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="passwordLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Password:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="QLineEdit" name="pwdLineEdit">
|
|
||||||
<property name="echoMode">
|
|
||||||
<enum>QLineEdit::Password</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="keyLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Private key file:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1">
|
|
||||||
<widget class="Utils::PathChooser" name="keyFileLineEdit" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
@@ -335,8 +348,8 @@
|
|||||||
<slot>deviceTypeChanged()</slot>
|
<slot>deviceTypeChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>273</x>
|
<x>231</x>
|
||||||
<y>108</y>
|
<y>99</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>511</x>
|
<x>511</x>
|
||||||
@@ -351,8 +364,8 @@
|
|||||||
<slot>hostNameEditingFinished()</slot>
|
<slot>hostNameEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>402</x>
|
<x>335</x>
|
||||||
<y>163</y>
|
<y>148</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>424</x>
|
<x>424</x>
|
||||||
@@ -367,8 +380,8 @@
|
|||||||
<slot>timeoutEditingFinished()</slot>
|
<slot>timeoutEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>402</x>
|
<x>335</x>
|
||||||
<y>225</y>
|
<y>202</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>425</x>
|
<x>425</x>
|
||||||
@@ -383,8 +396,8 @@
|
|||||||
<slot>userNameEditingFinished()</slot>
|
<slot>userNameEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>402</x>
|
<x>335</x>
|
||||||
<y>255</y>
|
<y>228</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>422</x>
|
<x>422</x>
|
||||||
@@ -399,8 +412,8 @@
|
|||||||
<slot>passwordEditingFinished()</slot>
|
<slot>passwordEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>402</x>
|
<x>335</x>
|
||||||
<y>285</y>
|
<y>254</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>423</x>
|
<x>423</x>
|
||||||
@@ -415,8 +428,8 @@
|
|||||||
<slot>deviceTypeChanged()</slot>
|
<slot>deviceTypeChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>402</x>
|
<x>335</x>
|
||||||
<y>108</y>
|
<y>99</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>426</x>
|
<x>426</x>
|
||||||
@@ -447,8 +460,8 @@
|
|||||||
<slot>deleteConfig()</slot>
|
<slot>deleteConfig()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>523</x>
|
<x>473</x>
|
||||||
<y>69</y>
|
<y>61</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>513</x>
|
<x>513</x>
|
||||||
@@ -463,8 +476,8 @@
|
|||||||
<slot>authenticationTypeChanged()</slot>
|
<slot>authenticationTypeChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>273</x>
|
<x>231</x>
|
||||||
<y>133</y>
|
<y>122</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>513</x>
|
<x>513</x>
|
||||||
@@ -479,8 +492,8 @@
|
|||||||
<slot>keyFileEditingFinished()</slot>
|
<slot>keyFileEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>402</x>
|
<x>335</x>
|
||||||
<y>305</y>
|
<y>273</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>257</x>
|
<x>257</x>
|
||||||
@@ -495,8 +508,8 @@
|
|||||||
<slot>keyFileEditingFinished()</slot>
|
<slot>keyFileEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>402</x>
|
<x>335</x>
|
||||||
<y>305</y>
|
<y>273</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>257</x>
|
<x>257</x>
|
||||||
@@ -511,8 +524,8 @@
|
|||||||
<slot>testConfig()</slot>
|
<slot>testConfig()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>523</x>
|
<x>473</x>
|
||||||
<y>102</y>
|
<y>90</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>428</x>
|
<x>428</x>
|
||||||
@@ -527,8 +540,8 @@
|
|||||||
<slot>deployKey()</slot>
|
<slot>deployKey()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>523</x>
|
<x>473</x>
|
||||||
<y>135</y>
|
<y>148</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>510</x>
|
<x>510</x>
|
||||||
@@ -543,8 +556,8 @@
|
|||||||
<slot>authenticationTypeChanged()</slot>
|
<slot>authenticationTypeChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>402</x>
|
<x>335</x>
|
||||||
<y>133</y>
|
<y>122</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>525</x>
|
<x>525</x>
|
||||||
@@ -568,6 +581,22 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>generateKeyButton</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
|
<slot>showGenerateSshKeyDialog()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>403</x>
|
||||||
|
<y>107</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>358</x>
|
||||||
|
<y>-11</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>configNameEditingFinished()</slot>
|
<slot>configNameEditingFinished()</slot>
|
||||||
@@ -586,5 +615,6 @@
|
|||||||
<slot>deployKey()</slot>
|
<slot>deployKey()</slot>
|
||||||
<slot>gdbServerPortEditingFinished()</slot>
|
<slot>gdbServerPortEditingFinished()</slot>
|
||||||
<slot>currentConfigChanged(int)</slot>
|
<slot>currentConfigChanged(int)</slot>
|
||||||
|
<slot>showGenerateSshKeyDialog()</slot>
|
||||||
</slots>
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
@@ -33,96 +33,105 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "maemosshconfigdialog.h"
|
#include "maemosshconfigdialog.h"
|
||||||
#include "maemosshthread.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include "maemodeviceconfigurations.h"
|
||||||
|
#include "ne7sshobject.h"
|
||||||
|
|
||||||
#include <ne7ssh.h>
|
#include <ne7ssh.h>
|
||||||
|
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
|
||||||
|
#include <QtNetwork/QHostInfo>
|
||||||
|
|
||||||
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QDesktopServices>
|
||||||
|
#include <QtGui/QFileDialog>
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
MaemoSshConfigDialog::MaemoSshConfigDialog(QWidget *parent)
|
MaemoSshConfigDialog::MaemoSshConfigDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_keyDeployer(0)
|
, home(QDesktopServices::storageLocation(QDesktopServices::HomeLocation))
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
|
|
||||||
const QLatin1String root("MaemoSsh/");
|
connect(m_ui.rsa, SIGNAL(toggled(bool)), this, SLOT(slotToggled()));
|
||||||
QSettings *settings = Core::ICore::instance()->settings();
|
connect(m_ui.dsa, SIGNAL(toggled(bool)), this, SLOT(slotToggled()));
|
||||||
m_ui.useKeyFromPath->setChecked(settings->value(root + QLatin1String("userKey"),
|
|
||||||
false).toBool());
|
|
||||||
m_ui.keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
|
||||||
m_ui.keyFileLineEdit->setPath(settings->value(root + QLatin1String("keyPath"),
|
|
||||||
QDir::toNativeSeparators(QDir::homePath() + QLatin1String("/.ssh/id_rsa.pub")))
|
|
||||||
.toString());
|
|
||||||
|
|
||||||
connect(m_ui.deployButton, SIGNAL(clicked()), this, SLOT(deployKey()));
|
|
||||||
connect(m_ui.generateButton, SIGNAL(clicked()), this, SLOT(generateSshKey()));
|
connect(m_ui.generateButton, SIGNAL(clicked()), this, SLOT(generateSshKey()));
|
||||||
|
connect(m_ui.savePublicKey, SIGNAL(clicked()), this, SLOT(savePublicKey()));
|
||||||
|
connect(m_ui.savePrivateKey, SIGNAL(clicked()), this, SLOT(savePrivateKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MaemoSshConfigDialog::~MaemoSshConfigDialog()
|
MaemoSshConfigDialog::~MaemoSshConfigDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoSshConfigDialog::slotToggled()
|
||||||
|
{
|
||||||
|
m_ui.comboBox->setCurrentIndex(0);
|
||||||
|
m_ui.comboBox->setEnabled(m_ui.rsa->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
void MaemoSshConfigDialog::generateSshKey()
|
void MaemoSshConfigDialog::generateSshKey()
|
||||||
{
|
{
|
||||||
if (!m_ui.keyFileLineEdit->isValid()) {
|
algorithm = m_ui.rsa->isChecked() ? "rsa" : "dsa";
|
||||||
ne7ssh ssh;
|
tmpKey = QDir::tempPath().append(QLatin1Char('/') + algorithm).toUtf8();
|
||||||
ssh.generateKeyPair("rsa", "test", "id_rsa", "id_rsa.pub");
|
QByteArray userId = QString(home.mid(home.lastIndexOf(QLatin1Char('/')) + 1)
|
||||||
|
+ QLatin1Char('@') + QHostInfo::localHostName()).toUtf8();
|
||||||
|
|
||||||
|
QFile::remove(tmpKey);
|
||||||
|
QFile::remove(tmpKey + ".pub");
|
||||||
|
|
||||||
|
QApplication::setOverrideCursor(Qt::BusyCursor);
|
||||||
|
|
||||||
|
QSharedPointer<ne7ssh> ssh = Ne7SshObject::instance()->get();
|
||||||
|
if (ssh->generateKeyPair(algorithm, userId, tmpKey, tmpKey + ".pub",
|
||||||
|
m_ui.comboBox->currentText().toUShort())) {
|
||||||
|
QFile file(tmpKey + ".pub");
|
||||||
|
if (file.open(QIODevice::ReadOnly))
|
||||||
|
m_ui.plainTextEdit->setPlainText(file.readAll());
|
||||||
|
m_ui.savePublicKey->setEnabled(true);
|
||||||
|
m_ui.savePrivateKey->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
m_ui.infoLabel->setText("An public key has been created already.");
|
m_ui.plainTextEdit->setPlainText(tr("Could not create SSH key pair."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoSshConfigDialog::deployKey()
|
void MaemoSshConfigDialog::savePublicKey()
|
||||||
{
|
{
|
||||||
if (m_keyDeployer)
|
checkSshDir();
|
||||||
return;
|
copyFile(QFileDialog::getSaveFileName(this, tr("Choose folder to save "
|
||||||
|
"public key file"), home + QString::fromLatin1("/.ssh/id_%1.pub")
|
||||||
|
.arg(algorithm.constData())), true);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_ui.keyFileLineEdit->validatePath(m_ui.keyFileLineEdit->path())) {
|
void MaemoSshConfigDialog::savePrivateKey()
|
||||||
m_ui.deployButton->disconnect();
|
{
|
||||||
//SshDeploySpec deploySpec(keyFile, homeDirOnDevice(currentConfig().uname)
|
checkSshDir();
|
||||||
// + QLatin1String("/.ssh/authorized_keys"), true);
|
copyFile(QFileDialog::getSaveFileName(this, tr("Choose folder to save "
|
||||||
//m_keyDeployer = new MaemoSshDeployer(currentConfig(), QList<SshDeploySpec>()
|
"private key file"), home + QString::fromLatin1("/.ssh/id_%1")
|
||||||
// << deploySpec);
|
.arg(algorithm.constData())), false);
|
||||||
//connect(m_keyDeployer, SIGNAL(finished()), this,
|
}
|
||||||
// SLOT(handleDeployThreadFinished()));
|
|
||||||
if (m_keyDeployer) {
|
void MaemoSshConfigDialog::checkSshDir()
|
||||||
m_keyDeployer->start();
|
{
|
||||||
m_ui.deployButton->setText(tr("Stop deploying"));
|
QDir dir(home + QString::fromLatin1("/.ssh"));
|
||||||
connect(m_ui.deployButton, SIGNAL(clicked()), this, SLOT(stopDeploying()));
|
if (!dir.exists())
|
||||||
|
dir.mkpath(home + QString::fromLatin1("/.ssh"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoSshConfigDialog::copyFile(const QString &file, bool pubKey)
|
||||||
|
{
|
||||||
|
if (!file.isEmpty()) {
|
||||||
|
if (!QFile::exists(file) || QFile::remove(file)) {
|
||||||
|
QFile(tmpKey + (pubKey ? ".pub" : "")).copy(file);
|
||||||
|
if (pubKey)
|
||||||
|
emit publicKeyGenerated(file);
|
||||||
|
else
|
||||||
|
emit privateKeyGenerated(file);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
m_ui.infoLabel->setText("The public key path is invalid.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoSshConfigDialog::handleDeployThreadFinished()
|
|
||||||
{
|
|
||||||
if (!m_keyDeployer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_keyDeployer->hasError()) {
|
|
||||||
m_ui.infoLabel->setText(tr("Key deployment failed: %1")
|
|
||||||
.arg(m_keyDeployer->error()));
|
|
||||||
} else {
|
|
||||||
m_ui.infoLabel->setText(tr("Key was successfully deployed."));
|
|
||||||
}
|
|
||||||
stopDeploying();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoSshConfigDialog::stopDeploying()
|
|
||||||
{
|
|
||||||
if (m_keyDeployer) {
|
|
||||||
m_ui.deployButton->disconnect();
|
|
||||||
const bool buttonWasEnabled = m_ui.deployButton->isEnabled();
|
|
||||||
m_keyDeployer->disconnect();
|
|
||||||
m_keyDeployer->stop();
|
|
||||||
delete m_keyDeployer;
|
|
||||||
m_keyDeployer = 0;
|
|
||||||
m_ui.deployButton->setText(tr("Deploy Public Key"));
|
|
||||||
connect(m_ui.deployButton, SIGNAL(clicked()), this, SLOT(deployKey()));
|
|
||||||
m_ui.deployButton->setEnabled(buttonWasEnabled);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,8 +42,6 @@
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class MaemoSshDeployer;
|
|
||||||
|
|
||||||
class MaemoSshConfigDialog : public QDialog
|
class MaemoSshConfigDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -51,15 +49,25 @@ public:
|
|||||||
MaemoSshConfigDialog(QWidget *parent = 0);
|
MaemoSshConfigDialog(QWidget *parent = 0);
|
||||||
~MaemoSshConfigDialog();
|
~MaemoSshConfigDialog();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void publicKeyGenerated(const QString &path);
|
||||||
|
void privateKeyGenerated(const QString &path);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void slotToggled();
|
||||||
void generateSshKey();
|
void generateSshKey();
|
||||||
void deployKey();
|
void savePublicKey();
|
||||||
void handleDeployThreadFinished();
|
void savePrivateKey();
|
||||||
void stopDeploying();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void checkSshDir();
|
||||||
|
void copyFile(const QString &file, bool pubKey);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString home;
|
||||||
|
QByteArray tmpKey;
|
||||||
|
QByteArray algorithm;
|
||||||
Ui::MaemoSshConfigDialog m_ui;
|
Ui::MaemoSshConfigDialog m_ui;
|
||||||
MaemoSshDeployer *m_keyDeployer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Qt4ProjectManager
|
} // Qt4ProjectManager
|
||||||
|
@@ -9,117 +9,218 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>387</width>
|
<width>500</width>
|
||||||
<height>128</height>
|
<height>275</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>275</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>SSH Key Configuration</string>
|
<string>SSH Key Configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="useKeyFromPath">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="sizePolicy">
|
<property name="title">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
<string>Options</string>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Use key from location:</string>
|
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="keySize">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Key size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">1024</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">2048</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">4096</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>328</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="keyAlgo">
|
||||||
|
<property name="text">
|
||||||
|
<string>Key algorithm:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rsa">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>RSA</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="dsa">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>DSA</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Key</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="undoRedoEnabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="plainText">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="generateButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Generate SSH Key</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="savePublicKey">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save public Key...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="savePrivateKey">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save private Key...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="keyLabel">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Private key file:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Utils::PathChooser" name="keyFileLineEdit" native="true">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="infoLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="generateButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Generate SSH Key</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -131,13 +232,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="deployButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Deploy Public Key</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="closeButton">
|
<widget class="QPushButton" name="closeButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -149,23 +243,8 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>Utils::PathChooser</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header location="global">utils/pathchooser.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
<slots>
|
|
||||||
<signal>editingFinished()</signal>
|
|
||||||
<signal>browsingFinished()</signal>
|
|
||||||
</slots>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>closeButton</tabstop>
|
<tabstop>closeButton</tabstop>
|
||||||
<tabstop>deployButton</tabstop>
|
|
||||||
<tabstop>generateButton</tabstop>
|
|
||||||
<tabstop>useKeyFromPath</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
@@ -185,37 +264,5 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>useKeyFromPath</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>keyLabel</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>83</x>
|
|
||||||
<y>17</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>73</x>
|
|
||||||
<y>42</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>useKeyFromPath</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>keyFileLineEdit</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>193</x>
|
|
||||||
<y>17</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>246</x>
|
|
||||||
<y>42</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
@@ -13,6 +13,7 @@ HEADERS += \
|
|||||||
$$PWD/maemorunfactories.h \
|
$$PWD/maemorunfactories.h \
|
||||||
$$PWD/maemosettingspage.h \
|
$$PWD/maemosettingspage.h \
|
||||||
$$PWD/maemosettingswidget.h \
|
$$PWD/maemosettingswidget.h \
|
||||||
|
$$PWD/maemosshconfigdialog.h \
|
||||||
$$PWD/maemosshconnection.h \
|
$$PWD/maemosshconnection.h \
|
||||||
$$PWD/maemosshthread.h \
|
$$PWD/maemosshthread.h \
|
||||||
$$PWD/maemotoolchain.h \
|
$$PWD/maemotoolchain.h \
|
||||||
@@ -31,6 +32,7 @@ SOURCES += \
|
|||||||
$$PWD/maemorunfactories.cpp \
|
$$PWD/maemorunfactories.cpp \
|
||||||
$$PWD/maemosettingspage.cpp \
|
$$PWD/maemosettingspage.cpp \
|
||||||
$$PWD/maemosettingswidget.cpp \
|
$$PWD/maemosettingswidget.cpp \
|
||||||
|
$$PWD/maemosshconfigdialog.cpp \
|
||||||
$$PWD/maemosshconnection.cpp \
|
$$PWD/maemosshconnection.cpp \
|
||||||
$$PWD/maemosshthread.cpp \
|
$$PWD/maemosshthread.cpp \
|
||||||
$$PWD/maemotoolchain.cpp \
|
$$PWD/maemotoolchain.cpp \
|
||||||
@@ -41,6 +43,7 @@ SOURCES += \
|
|||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/maemoconfigtestdialog.ui \
|
$$PWD/maemoconfigtestdialog.ui \
|
||||||
$$PWD/maemosettingswidget.ui
|
$$PWD/maemosettingswidget.ui \
|
||||||
|
$$PWD/maemosshconfigdialog.ui
|
||||||
|
|
||||||
RESOURCES += $$PWD/qt-maemo.qrc
|
RESOURCES += $$PWD/qt-maemo.qrc
|
||||||
|
Reference in New Issue
Block a user