2011-04-13 08:42:33 +02:00
|
|
|
/**************************************************************************
|
2011-02-03 09:59:50 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file is part of Qt Creator
|
2011-02-03 09:59:50 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2011-02-03 09:59:50 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2011-02-03 09:59:50 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2011-04-13 08:42:33 +02:00
|
|
|
**
|
|
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2011-02-03 09:59:50 +01:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2011-02-03 09:59:50 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2011-02-03 09:59:50 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
**************************************************************************/
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
#include "maemodeviceconfigwizard.h"
|
|
|
|
|
#include "ui_maemodeviceconfigwizardkeycreationpage.h"
|
2011-02-03 14:17:13 +01:00
|
|
|
#include "ui_maemodeviceconfigwizardkeydeploymentpage.h"
|
2011-03-09 12:07:35 +01:00
|
|
|
#include "ui_maemodeviceconfigwizardlogindatapage.h"
|
2011-02-02 17:53:36 +01:00
|
|
|
#include "ui_maemodeviceconfigwizardpreviouskeysetupcheckpage.h"
|
|
|
|
|
#include "ui_maemodeviceconfigwizardreusekeyscheckpage.h"
|
|
|
|
|
#include "ui_maemodeviceconfigwizardstartpage.h"
|
|
|
|
|
|
|
|
|
|
#include "maemodeviceconfigurations.h"
|
2011-04-21 14:39:57 +02:00
|
|
|
#include "maemoglobal.h"
|
2011-02-03 14:17:13 +01:00
|
|
|
#include "maemokeydeployer.h"
|
2011-02-02 17:53:36 +01:00
|
|
|
|
2011-03-30 15:15:15 +02:00
|
|
|
#include <utils/fileutils.h>
|
2011-02-14 16:34:17 +01:00
|
|
|
#include <utils/ssh/sshkeygenerator.h>
|
2011-02-02 17:53:36 +01:00
|
|
|
|
|
|
|
|
#include <QtCore/QDir>
|
|
|
|
|
#include <QtCore/QFile>
|
|
|
|
|
#include <QtGui/QButtonGroup>
|
|
|
|
|
#include <QtGui/QDesktopServices>
|
|
|
|
|
#include <QtGui/QMessageBox>
|
|
|
|
|
#include <QtGui/QWizardPage>
|
|
|
|
|
|
2011-03-09 12:07:35 +01:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
namespace Qt4ProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
struct WizardData
|
|
|
|
|
{
|
|
|
|
|
QString configName;
|
|
|
|
|
QString hostName;
|
2011-04-21 14:39:57 +02:00
|
|
|
MaemoDeviceConfig::OsVersion osVersion;
|
2011-03-09 12:07:35 +01:00
|
|
|
SshConnectionParameters::AuthenticationType authType;
|
2011-02-02 17:53:36 +01:00
|
|
|
MaemoDeviceConfig::DeviceType deviceType;
|
|
|
|
|
QString privateKeyFilePath;
|
|
|
|
|
QString publicKeyFilePath;
|
2011-03-09 12:07:35 +01:00
|
|
|
QString userName;
|
|
|
|
|
QString password;
|
2011-02-02 17:53:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum PageId {
|
2011-03-09 12:07:35 +01:00
|
|
|
StartPageId, LoginDataPageId, PreviousKeySetupCheckPageId,
|
|
|
|
|
ReuseKeysCheckPageId, KeyCreationPageId, KeyDeploymentPageId, FinalPageId
|
2011-02-02 17:53:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MaemoDeviceConfigWizardStartPage : public QWizardPage
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
MaemoDeviceConfigWizardStartPage(QWidget *parent = 0)
|
|
|
|
|
: QWizardPage(parent), m_ui(new Ui::MaemoDeviceConfigWizardStartPage)
|
|
|
|
|
{
|
|
|
|
|
m_ui->setupUi(this);
|
2011-02-03 14:17:13 +01:00
|
|
|
setTitle(tr("General Information"));
|
|
|
|
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
2011-04-21 14:39:57 +02:00
|
|
|
m_ui->fremantleButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo5));
|
|
|
|
|
m_ui->harmattanButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Maemo6));
|
|
|
|
|
m_ui->meegoButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::Meego));
|
|
|
|
|
m_ui->genericLinuxButton->setText(MaemoGlobal::osVersionToString(MaemoDeviceConfig::GenericLinux));
|
2011-03-09 12:07:35 +01:00
|
|
|
|
|
|
|
|
QButtonGroup *buttonGroup = new QButtonGroup(this);
|
2011-02-02 17:53:36 +01:00
|
|
|
buttonGroup->setExclusive(true);
|
|
|
|
|
buttonGroup->addButton(m_ui->hwButton);
|
|
|
|
|
buttonGroup->addButton(m_ui->qemuButton);
|
|
|
|
|
connect(buttonGroup, SIGNAL(buttonClicked(int)),
|
|
|
|
|
SLOT(handleDeviceTypeChanged()));
|
2011-03-09 12:07:35 +01:00
|
|
|
|
|
|
|
|
buttonGroup = new QButtonGroup(this);
|
|
|
|
|
buttonGroup->setExclusive(true);
|
|
|
|
|
buttonGroup->addButton(m_ui->fremantleButton);
|
|
|
|
|
buttonGroup->addButton(m_ui->harmattanButton);
|
|
|
|
|
buttonGroup->addButton(m_ui->meegoButton);
|
|
|
|
|
buttonGroup->addButton(m_ui->genericLinuxButton);
|
|
|
|
|
connect(buttonGroup, SIGNAL(buttonClicked(int)),
|
|
|
|
|
SLOT(handleOsTypeChanged()));
|
|
|
|
|
|
|
|
|
|
m_ui->nameLineEdit->setText(QLatin1String("(New Configuration)"));
|
2011-02-03 14:17:13 +01:00
|
|
|
m_ui->harmattanButton->setChecked(true);
|
|
|
|
|
m_ui->hwButton->setChecked(true);
|
2011-02-02 17:53:36 +01:00
|
|
|
handleDeviceTypeChanged();
|
2011-03-09 12:07:35 +01:00
|
|
|
m_ui->hostNameLineEdit->setText(MaemoDeviceConfig::defaultHost(deviceType(),
|
|
|
|
|
osVersion()));
|
2011-02-02 17:53:36 +01:00
|
|
|
connect(m_ui->nameLineEdit, SIGNAL(textChanged(QString)), this,
|
|
|
|
|
SIGNAL(completeChanged()));
|
|
|
|
|
connect(m_ui->hostNameLineEdit, SIGNAL(textChanged(QString)), this,
|
|
|
|
|
SIGNAL(completeChanged()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual bool isComplete() const
|
|
|
|
|
{
|
|
|
|
|
return !configName().isEmpty() && !hostName().isEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString configName() const { return m_ui->nameLineEdit->text().trimmed(); }
|
|
|
|
|
|
|
|
|
|
QString hostName() const
|
|
|
|
|
{
|
2011-02-14 13:56:39 +01:00
|
|
|
return deviceType() == MaemoDeviceConfig::Emulator
|
2011-03-09 12:07:35 +01:00
|
|
|
? MaemoDeviceConfig::defaultHost(MaemoDeviceConfig::Emulator, osVersion())
|
2011-02-02 17:53:36 +01:00
|
|
|
: m_ui->hostNameLineEdit->text().trimmed();
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-21 14:39:57 +02:00
|
|
|
MaemoDeviceConfig::OsVersion osVersion() const
|
2011-02-02 17:53:36 +01:00
|
|
|
{
|
2011-04-21 14:39:57 +02:00
|
|
|
return m_ui->fremantleButton->isChecked() ? MaemoDeviceConfig::Maemo5
|
|
|
|
|
: m_ui->harmattanButton->isChecked() ? MaemoDeviceConfig::Maemo6
|
|
|
|
|
: m_ui->meegoButton->isChecked() ? MaemoDeviceConfig::Meego
|
|
|
|
|
: MaemoDeviceConfig::GenericLinux;
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MaemoDeviceConfig::DeviceType deviceType() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->hwButton->isChecked()
|
2011-02-14 13:56:39 +01:00
|
|
|
? MaemoDeviceConfig::Physical : MaemoDeviceConfig::Emulator;
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void handleDeviceTypeChanged()
|
|
|
|
|
{
|
|
|
|
|
const bool enable = deviceType() == MaemoDeviceConfig::Physical;
|
|
|
|
|
m_ui->hostNameLabel->setEnabled(enable);
|
|
|
|
|
m_ui->hostNameLineEdit->setEnabled(enable);
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-09 12:07:35 +01:00
|
|
|
void handleOsTypeChanged()
|
|
|
|
|
{
|
2011-04-21 14:39:57 +02:00
|
|
|
if (osVersion() == MaemoDeviceConfig::GenericLinux) {
|
2011-03-09 12:07:35 +01:00
|
|
|
m_ui->hwButton->setChecked(true);
|
|
|
|
|
m_ui->hwButton->setEnabled(false);
|
|
|
|
|
m_ui->qemuButton->setEnabled(false);
|
|
|
|
|
} else {
|
|
|
|
|
m_ui->hwButton->setEnabled(true);
|
|
|
|
|
m_ui->qemuButton->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
handleDeviceTypeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
private:
|
|
|
|
|
const QScopedPointer<Ui::MaemoDeviceConfigWizardStartPage> m_ui;
|
|
|
|
|
};
|
|
|
|
|
|
2011-03-09 12:07:35 +01:00
|
|
|
class MaemoDeviceConfigWizardLoginDataPage : public QWizardPage
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2011-04-11 11:50:40 +02:00
|
|
|
MaemoDeviceConfigWizardLoginDataPage(WizardData &wizardData, QWidget *parent)
|
2011-03-09 12:07:35 +01:00
|
|
|
: QWizardPage(parent),
|
2011-04-11 11:50:40 +02:00
|
|
|
m_ui(new Ui::MaemoDeviceConfigWizardLoginDataPage),
|
|
|
|
|
m_wizardData(wizardData)
|
2011-03-09 12:07:35 +01:00
|
|
|
{
|
|
|
|
|
m_ui->setupUi(this);
|
|
|
|
|
setTitle(tr("Login Data"));
|
|
|
|
|
m_ui->privateKeyPathChooser->setExpectedKind(PathChooser::File);
|
|
|
|
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
|
|
|
|
connect(m_ui->userNameLineEdit, SIGNAL(textChanged(QString)),
|
|
|
|
|
SIGNAL(completeChanged()));
|
|
|
|
|
connect(m_ui->privateKeyPathChooser, SIGNAL(validChanged()),
|
|
|
|
|
SIGNAL(completeChanged()));
|
|
|
|
|
connect(m_ui->passwordButton, SIGNAL(toggled(bool)),
|
|
|
|
|
SLOT(handleAuthTypeChanged()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual bool isComplete() const
|
|
|
|
|
{
|
|
|
|
|
return !userName().isEmpty()
|
|
|
|
|
&& (authType() == SshConnectionParameters::AuthenticationByPassword
|
|
|
|
|
|| m_ui->privateKeyPathChooser->isValid());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void initializePage()
|
|
|
|
|
{
|
2011-04-11 11:50:40 +02:00
|
|
|
m_ui->userNameLineEdit->setText(MaemoDeviceConfig::defaultUser(m_wizardData.osVersion));
|
2011-03-09 12:07:35 +01:00
|
|
|
m_ui->passwordButton->setChecked(true);
|
|
|
|
|
m_ui->passwordLineEdit->clear();
|
|
|
|
|
m_ui->privateKeyPathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath());
|
|
|
|
|
handleAuthTypeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SshConnectionParameters::AuthenticationType authType() const
|
|
|
|
|
{
|
|
|
|
|
return m_ui->passwordButton->isChecked()
|
|
|
|
|
? SshConnectionParameters::AuthenticationByPassword
|
|
|
|
|
: SshConnectionParameters::AuthenticationByKey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString userName() const { return m_ui->userNameLineEdit->text().trimmed(); }
|
|
|
|
|
QString password() const { return m_ui->passwordLineEdit->text(); }
|
|
|
|
|
QString privateKeyFilePath() const { return m_ui->privateKeyPathChooser->path(); }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Q_SLOT void handleAuthTypeChanged()
|
|
|
|
|
{
|
|
|
|
|
m_ui->passwordLineEdit->setEnabled(authType() == SshConnectionParameters::AuthenticationByPassword);
|
|
|
|
|
m_ui->privateKeyPathChooser->setEnabled(authType() == SshConnectionParameters::AuthenticationByKey);
|
|
|
|
|
emit completeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QScopedPointer<Ui::MaemoDeviceConfigWizardLoginDataPage> m_ui;
|
2011-04-11 11:50:40 +02:00
|
|
|
const WizardData &m_wizardData;
|
2011-03-09 12:07:35 +01:00
|
|
|
};
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
class MaemoDeviceConfigWizardPreviousKeySetupCheckPage : public QWizardPage
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
MaemoDeviceConfigWizardPreviousKeySetupCheckPage(QWidget *parent)
|
|
|
|
|
: QWizardPage(parent),
|
|
|
|
|
m_ui(new Ui::MaemoDeviceConfigWizardCheckPreviousKeySetupPage)
|
|
|
|
|
{
|
|
|
|
|
m_ui->setupUi(this);
|
2011-03-09 12:07:35 +01:00
|
|
|
m_ui->privateKeyFilePathChooser->setExpectedKind(PathChooser::File);
|
2011-02-03 14:17:13 +01:00
|
|
|
setTitle(tr("Device Status Check"));
|
|
|
|
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
2011-02-02 17:53:36 +01:00
|
|
|
QButtonGroup * const buttonGroup = new QButtonGroup(this);
|
|
|
|
|
buttonGroup->setExclusive(true);
|
|
|
|
|
buttonGroup->addButton(m_ui->keyWasSetUpButton);
|
|
|
|
|
buttonGroup->addButton(m_ui->keyWasNotSetUpButton);
|
|
|
|
|
connect(buttonGroup, SIGNAL(buttonClicked(int)),
|
|
|
|
|
SLOT(handleSelectionChanged()));
|
2011-02-03 17:06:58 +01:00
|
|
|
connect(m_ui->privateKeyFilePathChooser, SIGNAL(changed(QString)),
|
2011-02-02 17:53:36 +01:00
|
|
|
this, SIGNAL(completeChanged()));
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-03 17:06:58 +01:00
|
|
|
virtual bool isComplete() const
|
|
|
|
|
{
|
|
|
|
|
return !keyBasedLoginWasSetup()
|
|
|
|
|
|| m_ui->privateKeyFilePathChooser->isValid();
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-03 14:17:13 +01:00
|
|
|
virtual void initializePage()
|
|
|
|
|
{
|
|
|
|
|
m_ui->keyWasNotSetUpButton->setChecked(true);
|
2011-02-03 17:06:58 +01:00
|
|
|
m_ui->privateKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath());
|
|
|
|
|
handleSelectionChanged();
|
2011-02-03 14:17:13 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
bool keyBasedLoginWasSetup() const {
|
|
|
|
|
return m_ui->keyWasSetUpButton->isChecked();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString privateKeyFilePath() const {
|
2011-02-03 17:06:58 +01:00
|
|
|
return m_ui->privateKeyFilePathChooser->path();
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Q_SLOT void handleSelectionChanged()
|
|
|
|
|
{
|
2011-02-03 17:06:58 +01:00
|
|
|
m_ui->privateKeyFilePathChooser->setEnabled(keyBasedLoginWasSetup());
|
2011-02-02 17:53:36 +01:00
|
|
|
emit completeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QScopedPointer<Ui::MaemoDeviceConfigWizardCheckPreviousKeySetupPage> m_ui;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MaemoDeviceConfigWizardReuseKeysCheckPage : public QWizardPage
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
MaemoDeviceConfigWizardReuseKeysCheckPage(QWidget *parent)
|
|
|
|
|
: QWizardPage(parent),
|
|
|
|
|
m_ui(new Ui::MaemoDeviceConfigWizardReuseKeysCheckPage)
|
|
|
|
|
{
|
|
|
|
|
m_ui->setupUi(this);
|
2011-02-03 14:17:13 +01:00
|
|
|
setTitle(tr("Existing Keys Check"));
|
|
|
|
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
2011-03-09 12:07:35 +01:00
|
|
|
m_ui->publicKeyFilePathChooser->setExpectedKind(PathChooser::File);
|
|
|
|
|
m_ui->privateKeyFilePathChooser->setExpectedKind(PathChooser::File);
|
2011-02-02 17:53:36 +01:00
|
|
|
QButtonGroup * const buttonGroup = new QButtonGroup(this);
|
|
|
|
|
buttonGroup->setExclusive(true);
|
|
|
|
|
buttonGroup->addButton(m_ui->reuseButton);
|
|
|
|
|
buttonGroup->addButton(m_ui->dontReuseButton);
|
|
|
|
|
connect(buttonGroup, SIGNAL(buttonClicked(int)),
|
|
|
|
|
SLOT(handleSelectionChanged()));
|
2011-02-03 17:06:58 +01:00
|
|
|
connect(m_ui->privateKeyFilePathChooser, SIGNAL(changed(QString)),
|
2011-02-02 17:53:36 +01:00
|
|
|
this, SIGNAL(completeChanged()));
|
2011-02-03 17:06:58 +01:00
|
|
|
connect(m_ui->publicKeyFilePathChooser, SIGNAL(changed(QString)),
|
2011-02-02 17:53:36 +01:00
|
|
|
this, SIGNAL(completeChanged()));
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-03 14:17:13 +01:00
|
|
|
virtual bool isComplete() const
|
2011-02-02 17:53:36 +01:00
|
|
|
{
|
2011-02-03 17:06:58 +01:00
|
|
|
return !reuseKeys() || (m_ui->publicKeyFilePathChooser->isValid()
|
|
|
|
|
&& m_ui->privateKeyFilePathChooser->isValid());
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-03 14:17:13 +01:00
|
|
|
virtual void initializePage()
|
|
|
|
|
{
|
|
|
|
|
m_ui->dontReuseButton->setChecked(true);
|
2011-02-10 15:37:12 +01:00
|
|
|
m_ui->privateKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPrivateKeyFilePath());
|
|
|
|
|
m_ui->publicKeyFilePathChooser->setPath(MaemoDeviceConfig::defaultPublicKeyFilePath());
|
2011-02-03 14:17:13 +01:00
|
|
|
handleSelectionChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
bool reuseKeys() const { return m_ui->reuseButton->isChecked(); }
|
2011-02-03 14:17:13 +01:00
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
QString privateKeyFilePath() const {
|
2011-02-03 17:06:58 +01:00
|
|
|
return m_ui->privateKeyFilePathChooser->path();
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
2011-02-03 14:17:13 +01:00
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
QString publicKeyFilePath() const {
|
2011-02-03 17:06:58 +01:00
|
|
|
return m_ui->publicKeyFilePathChooser->path();
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Q_SLOT void handleSelectionChanged()
|
|
|
|
|
{
|
|
|
|
|
m_ui->privateKeyFilePathLabel->setEnabled(reuseKeys());
|
2011-02-03 17:06:58 +01:00
|
|
|
m_ui->privateKeyFilePathChooser->setEnabled(reuseKeys());
|
2011-02-02 17:53:36 +01:00
|
|
|
m_ui->publicKeyFilePathLabel->setEnabled(reuseKeys());
|
2011-02-03 17:06:58 +01:00
|
|
|
m_ui->publicKeyFilePathChooser->setEnabled(reuseKeys());
|
2011-02-02 17:53:36 +01:00
|
|
|
emit completeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QScopedPointer<Ui::MaemoDeviceConfigWizardReuseKeysCheckPage> m_ui;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MaemoDeviceConfigWizardKeyCreationPage : public QWizardPage
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
MaemoDeviceConfigWizardKeyCreationPage(QWidget *parent)
|
|
|
|
|
: QWizardPage(parent),
|
2011-02-03 14:17:13 +01:00
|
|
|
m_ui(new Ui::MaemoDeviceConfigWizardKeyCreationPage)
|
2011-02-02 17:53:36 +01:00
|
|
|
{
|
|
|
|
|
m_ui->setupUi(this);
|
2011-02-03 14:17:13 +01:00
|
|
|
setTitle(tr("Key Creation"));
|
|
|
|
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
|
|
|
|
connect(m_ui->createKeysButton, SIGNAL(clicked()), SLOT(createKeys()));
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString privateKeyFilePath() const {
|
2011-02-03 17:06:58 +01:00
|
|
|
return m_ui->keyDirPathChooser->path() + QLatin1String("/qtc_id_rsa");
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString publicKeyFilePath() const {
|
|
|
|
|
return privateKeyFilePath() + QLatin1String(".pub");
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-03 14:17:13 +01:00
|
|
|
virtual void initializePage()
|
|
|
|
|
{
|
|
|
|
|
m_isComplete = false;
|
|
|
|
|
const QString &dir = QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
|
|
|
|
|
+ QLatin1String("/.ssh");
|
2011-02-03 17:06:58 +01:00
|
|
|
m_ui->keyDirPathChooser->setPath(dir);
|
2011-02-03 14:17:13 +01:00
|
|
|
enableInput();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
virtual bool isComplete() const { return m_isComplete; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
Q_SLOT void createKeys()
|
|
|
|
|
{
|
2011-02-03 17:06:58 +01:00
|
|
|
const QString &dirPath = m_ui->keyDirPathChooser->path();
|
2011-03-29 10:43:39 +02:00
|
|
|
QFileInfo fi(dirPath);
|
|
|
|
|
if (fi.exists() && !fi.isDir()) {
|
2011-02-15 16:05:52 +01:00
|
|
|
QMessageBox::critical(this, tr("Cannot Create Keys"),
|
2011-03-29 10:43:39 +02:00
|
|
|
tr("The path you have entered is not a directory."));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!fi.exists() && !QDir::root().mkpath(dirPath)) {
|
2011-02-15 16:05:52 +01:00
|
|
|
QMessageBox::critical(this, tr("Cannot Create Keys"),
|
2011-03-29 10:43:39 +02:00
|
|
|
tr("The directory you have entered does not exist and "
|
|
|
|
|
"cannot be created."));
|
2011-02-02 17:53:36 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-03 17:06:58 +01:00
|
|
|
m_ui->keyDirPathChooser->setEnabled(false);
|
2011-02-02 17:53:36 +01:00
|
|
|
m_ui->createKeysButton->setEnabled(false);
|
2011-02-03 14:17:13 +01:00
|
|
|
m_ui->statusLabel->setText(tr("Creating keys ... "));
|
2011-03-09 12:07:35 +01:00
|
|
|
SshKeyGenerator keyGenerator;
|
|
|
|
|
if (!keyGenerator.generateKeys(SshKeyGenerator::Rsa,
|
|
|
|
|
SshKeyGenerator::OpenSsl, 1024)) {
|
2011-02-15 16:05:52 +01:00
|
|
|
QMessageBox::critical(this, tr("Cannot Create Keys"),
|
2011-02-02 17:53:36 +01:00
|
|
|
tr("Key creation failed: %1").arg(keyGenerator.error()));
|
2011-02-03 14:17:13 +01:00
|
|
|
enableInput();
|
2011-02-02 17:53:36 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!saveFile(privateKeyFilePath(), keyGenerator.privateKey())
|
|
|
|
|
|| !saveFile(publicKeyFilePath(), keyGenerator.publicKey())) {
|
2011-02-03 14:17:13 +01:00
|
|
|
enableInput();
|
2011-02-02 17:53:36 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-15 16:05:52 +01:00
|
|
|
m_ui->statusLabel->setText(m_ui->statusLabel->text() + tr("Done."));
|
2011-02-02 17:53:36 +01:00
|
|
|
m_isComplete = true;
|
|
|
|
|
emit completeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool saveFile(const QString &filePath, const QByteArray &data)
|
|
|
|
|
{
|
2011-03-30 15:15:15 +02:00
|
|
|
Utils::FileSaver saver(filePath);
|
|
|
|
|
saver.write(data);
|
|
|
|
|
if (!saver.finalize()) {
|
|
|
|
|
QMessageBox::critical(this, tr("Could Not Save Key File"), saver.errorString());
|
2011-02-02 17:53:36 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-03 14:17:13 +01:00
|
|
|
void enableInput()
|
|
|
|
|
{
|
2011-02-03 17:06:58 +01:00
|
|
|
m_ui->keyDirPathChooser->setEnabled(true);
|
2011-03-29 10:43:39 +02:00
|
|
|
m_ui->createKeysButton->setEnabled(true);
|
2011-02-03 14:17:13 +01:00
|
|
|
m_ui->statusLabel->clear();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
const QScopedPointer<Ui::MaemoDeviceConfigWizardKeyCreationPage> m_ui;
|
|
|
|
|
bool m_isComplete;
|
|
|
|
|
};
|
|
|
|
|
|
2011-02-03 14:17:13 +01:00
|
|
|
class MaemoDeviceConfigWizardKeyDeploymentPage : public QWizardPage
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
MaemoDeviceConfigWizardKeyDeploymentPage(const WizardData &wizardData,
|
|
|
|
|
QWidget *parent = 0)
|
|
|
|
|
: QWizardPage(parent),
|
|
|
|
|
m_ui(new Ui::MaemoDeviceConfigWizardKeyDeploymentPage),
|
|
|
|
|
m_wizardData(wizardData),
|
|
|
|
|
m_keyDeployer(new MaemoKeyDeployer(this))
|
|
|
|
|
{
|
|
|
|
|
m_ui->setupUi(this);
|
2011-03-31 14:43:02 +02:00
|
|
|
m_instructionTextTemplate = m_ui->instructionLabel->text();
|
2011-02-03 14:17:13 +01:00
|
|
|
setTitle(tr("Key Deployment"));
|
|
|
|
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
|
|
|
|
connect(m_ui->deviceAddressLineEdit, SIGNAL(textChanged(QString)),
|
|
|
|
|
SLOT(enableOrDisableButton()));
|
|
|
|
|
connect(m_ui->passwordLineEdit, SIGNAL(textChanged(QString)),
|
|
|
|
|
SLOT(enableOrDisableButton()));
|
|
|
|
|
connect(m_ui->deployButton, SIGNAL(clicked()), SLOT(deployKey()));
|
|
|
|
|
connect(m_keyDeployer, SIGNAL(error(QString)),
|
|
|
|
|
SLOT(handleKeyDeploymentError(QString)));
|
|
|
|
|
connect(m_keyDeployer, SIGNAL(finishedSuccessfully()),
|
|
|
|
|
SLOT(handleKeyDeploymentSuccess()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void initializePage()
|
|
|
|
|
{
|
|
|
|
|
m_isComplete = false;
|
|
|
|
|
m_ui->deviceAddressLineEdit->setText(m_wizardData.hostName);
|
2011-03-31 14:43:02 +02:00
|
|
|
m_ui->instructionLabel->setText(QString(m_instructionTextTemplate)
|
|
|
|
|
.replace(QLatin1String("%%%maddev%%%"),
|
2011-04-01 09:53:09 +02:00
|
|
|
MaemoGlobal::madDeveloperUiName(m_wizardData.osVersion)));
|
2011-02-03 14:17:13 +01:00
|
|
|
m_ui->passwordLineEdit->clear();
|
|
|
|
|
enableInput();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual bool isComplete() const { return m_isComplete; }
|
|
|
|
|
|
|
|
|
|
QString hostAddress() const {
|
|
|
|
|
return m_ui->deviceAddressLineEdit->text().trimmed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Q_SLOT void enableOrDisableButton()
|
|
|
|
|
{
|
|
|
|
|
m_ui->deployButton->setEnabled(!hostAddress().isEmpty()
|
|
|
|
|
&& !password().isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_SLOT void deployKey()
|
|
|
|
|
{
|
2011-02-14 16:34:17 +01:00
|
|
|
using namespace Utils;
|
2011-02-03 14:17:13 +01:00
|
|
|
m_ui->deviceAddressLineEdit->setEnabled(false);
|
|
|
|
|
m_ui->passwordLineEdit->setEnabled(false);
|
|
|
|
|
m_ui->deployButton->setEnabled(false);
|
2011-03-09 12:07:35 +01:00
|
|
|
SshConnectionParameters sshParams(SshConnectionParameters::NoProxy);
|
2011-02-28 17:01:53 +01:00
|
|
|
sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword;
|
2011-02-03 14:17:13 +01:00
|
|
|
sshParams.host = hostAddress();
|
|
|
|
|
sshParams.port = MaemoDeviceConfig::defaultSshPort(MaemoDeviceConfig::Physical);
|
2011-02-15 13:33:52 +01:00
|
|
|
sshParams.password = password();
|
2011-02-03 14:17:13 +01:00
|
|
|
sshParams.timeout = 30;
|
2011-03-09 12:07:35 +01:00
|
|
|
sshParams.userName = MaemoDeviceConfig::defaultUser(m_wizardData.osVersion);
|
2011-02-03 14:17:13 +01:00
|
|
|
m_ui->statusLabel->setText(tr("Deploying... "));
|
|
|
|
|
m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_SLOT void handleKeyDeploymentError(const QString &errorMsg)
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::critical(this, tr("Key Deployment Failure"), errorMsg);
|
|
|
|
|
enableInput();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_SLOT void handleKeyDeploymentSuccess()
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::information(this, tr("Key Deployment Success"),
|
|
|
|
|
tr("The key was successfully deployed. You may now close "
|
2011-03-31 14:43:02 +02:00
|
|
|
"the \"%1\" application and continue.")
|
2011-04-01 09:53:09 +02:00
|
|
|
.arg(MaemoGlobal::madDeveloperUiName(m_wizardData.osVersion)));
|
2011-02-15 16:05:52 +01:00
|
|
|
m_ui->statusLabel->setText(m_ui->statusLabel->text() + tr("Done."));
|
2011-02-03 14:17:13 +01:00
|
|
|
m_isComplete = true;
|
|
|
|
|
emit completeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void enableInput()
|
|
|
|
|
{
|
|
|
|
|
m_ui->deviceAddressLineEdit->setEnabled(true);
|
|
|
|
|
m_ui->passwordLineEdit->setEnabled(true);
|
|
|
|
|
m_ui->statusLabel->clear();
|
|
|
|
|
enableOrDisableButton();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString password() const {
|
|
|
|
|
return m_ui->passwordLineEdit->text().trimmed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QScopedPointer<Ui::MaemoDeviceConfigWizardKeyDeploymentPage> m_ui;
|
|
|
|
|
bool m_isComplete;
|
|
|
|
|
const WizardData &m_wizardData;
|
|
|
|
|
MaemoKeyDeployer * const m_keyDeployer;
|
2011-03-31 14:43:02 +02:00
|
|
|
QString m_instructionTextTemplate;
|
2011-02-03 14:17:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MaemoDeviceConfigWizardFinalPage : public QWizardPage
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2011-02-04 10:34:29 +01:00
|
|
|
MaemoDeviceConfigWizardFinalPage(const WizardData &wizardData,
|
|
|
|
|
QWidget *parent)
|
|
|
|
|
: QWizardPage(parent),
|
|
|
|
|
m_infoLabel(new QLabel(this)),
|
|
|
|
|
m_wizardData(wizardData)
|
2011-02-03 14:17:13 +01:00
|
|
|
{
|
|
|
|
|
setTitle(tr("Setup Finished"));
|
|
|
|
|
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
|
2011-02-04 10:34:29 +01:00
|
|
|
m_infoLabel->setWordWrap(true);
|
2011-02-03 14:17:13 +01:00
|
|
|
QVBoxLayout * const layout = new QVBoxLayout(this);
|
2011-02-04 10:34:29 +01:00
|
|
|
layout->addWidget(m_infoLabel);
|
2011-02-03 14:17:13 +01:00
|
|
|
}
|
2011-02-04 10:34:29 +01:00
|
|
|
|
|
|
|
|
virtual void initializePage()
|
|
|
|
|
{
|
2011-03-29 08:40:21 +02:00
|
|
|
QString infoText;
|
|
|
|
|
if (m_wizardData.deviceType == MaemoDeviceConfig::Physical) {
|
|
|
|
|
infoText = tr("The new device configuration will now be "
|
|
|
|
|
"created and a test procedure will be run to check whether "
|
|
|
|
|
"Qt Creator can connect to the device and to provide some "
|
|
|
|
|
"information about its features.");
|
|
|
|
|
} else {
|
|
|
|
|
infoText = tr("The new device configuration will now be created.");
|
2011-02-04 10:34:29 +01:00
|
|
|
}
|
|
|
|
|
m_infoLabel->setText(infoText);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QLabel * const m_infoLabel;
|
|
|
|
|
const WizardData &m_wizardData;
|
2011-02-03 14:17:13 +01:00
|
|
|
};
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
|
|
struct MaemoDeviceConfigWizardPrivate
|
|
|
|
|
{
|
2011-02-03 16:09:35 +01:00
|
|
|
MaemoDeviceConfigWizardPrivate(MaemoDeviceConfigurations *devConfigs,
|
|
|
|
|
QWidget *parent)
|
|
|
|
|
: devConfigs(devConfigs),
|
|
|
|
|
startPage(parent),
|
2011-04-11 11:50:40 +02:00
|
|
|
loginDataPage(wizardData, parent),
|
2011-02-02 17:53:36 +01:00
|
|
|
previousKeySetupPage(parent),
|
|
|
|
|
reuseKeysCheckPage(parent),
|
2011-02-03 14:17:13 +01:00
|
|
|
keyCreationPage(parent),
|
|
|
|
|
keyDeploymentPage(wizardData, parent),
|
2011-02-04 10:34:29 +01:00
|
|
|
finalPage(wizardData, parent)
|
2011-02-02 17:53:36 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WizardData wizardData;
|
2011-02-03 16:09:35 +01:00
|
|
|
MaemoDeviceConfigurations * const devConfigs;
|
2011-02-02 17:53:36 +01:00
|
|
|
MaemoDeviceConfigWizardStartPage startPage;
|
2011-03-09 12:07:35 +01:00
|
|
|
MaemoDeviceConfigWizardLoginDataPage loginDataPage;
|
2011-02-02 17:53:36 +01:00
|
|
|
MaemoDeviceConfigWizardPreviousKeySetupCheckPage previousKeySetupPage;
|
|
|
|
|
MaemoDeviceConfigWizardReuseKeysCheckPage reuseKeysCheckPage;
|
|
|
|
|
MaemoDeviceConfigWizardKeyCreationPage keyCreationPage;
|
2011-02-03 14:17:13 +01:00
|
|
|
MaemoDeviceConfigWizardKeyDeploymentPage keyDeploymentPage;
|
|
|
|
|
MaemoDeviceConfigWizardFinalPage finalPage;
|
2011-02-02 17:53:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2011-02-03 16:09:35 +01:00
|
|
|
MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(MaemoDeviceConfigurations *devConfigs,
|
|
|
|
|
QWidget *parent)
|
|
|
|
|
: QWizard(parent),
|
|
|
|
|
d(new MaemoDeviceConfigWizardPrivate(devConfigs, this))
|
2011-02-02 17:53:36 +01:00
|
|
|
{
|
2011-02-03 14:17:13 +01:00
|
|
|
setWindowTitle(tr("New Device Configuration Setup"));
|
2011-02-02 17:53:36 +01:00
|
|
|
setPage(StartPageId, &d->startPage);
|
2011-03-09 12:07:35 +01:00
|
|
|
setPage(LoginDataPageId, &d->loginDataPage);
|
2011-02-02 17:53:36 +01:00
|
|
|
setPage(PreviousKeySetupCheckPageId, &d->previousKeySetupPage);
|
|
|
|
|
setPage(ReuseKeysCheckPageId, &d->reuseKeysCheckPage);
|
|
|
|
|
setPage(KeyCreationPageId, &d->keyCreationPage);
|
2011-02-03 14:17:13 +01:00
|
|
|
setPage(KeyDeploymentPageId, &d->keyDeploymentPage);
|
|
|
|
|
setPage(FinalPageId, &d->finalPage);
|
|
|
|
|
d->finalPage.setCommitPage(true);
|
2011-02-02 17:53:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MaemoDeviceConfigWizard::~MaemoDeviceConfigWizard() {}
|
|
|
|
|
|
2011-02-03 16:09:35 +01:00
|
|
|
void MaemoDeviceConfigWizard::createDeviceConfig()
|
|
|
|
|
{
|
|
|
|
|
QString name = d->wizardData.configName;
|
|
|
|
|
if (d->devConfigs->hasConfig(name)) {
|
|
|
|
|
const QString nameTemplate = name + QLatin1String(" (%1)");
|
|
|
|
|
int suffix = 2;
|
|
|
|
|
do
|
|
|
|
|
name = nameTemplate.arg(QString::number(suffix++));
|
|
|
|
|
while (d->devConfigs->hasConfig(name));
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-21 14:39:57 +02:00
|
|
|
if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) {
|
2011-03-09 12:07:35 +01:00
|
|
|
if (d->wizardData.authType == SshConnectionParameters::AuthenticationByPassword) {
|
|
|
|
|
d->devConfigs->addGenericLinuxConfigurationUsingPassword(name,
|
|
|
|
|
d->wizardData.hostName, d->wizardData.userName,
|
|
|
|
|
d->wizardData.password);
|
|
|
|
|
} else {
|
|
|
|
|
d->devConfigs->addGenericLinuxConfigurationUsingKey(name,
|
|
|
|
|
d->wizardData.hostName, d->wizardData.userName,
|
|
|
|
|
d->wizardData.privateKeyFilePath);
|
|
|
|
|
}
|
|
|
|
|
} else if (d->wizardData.deviceType == MaemoDeviceConfig::Physical) {
|
2011-02-03 16:09:35 +01:00
|
|
|
d->devConfigs->addHardwareDeviceConfiguration(name,
|
2011-03-09 12:07:35 +01:00
|
|
|
d->wizardData.osVersion, d->wizardData.hostName,
|
2011-02-03 16:09:35 +01:00
|
|
|
d->wizardData.privateKeyFilePath);
|
|
|
|
|
} else {
|
|
|
|
|
d->devConfigs->addEmulatorDeviceConfiguration(name,
|
2011-03-09 12:07:35 +01:00
|
|
|
d->wizardData.osVersion);
|
2011-02-03 16:09:35 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-02 17:53:36 +01:00
|
|
|
int MaemoDeviceConfigWizard::nextId() const
|
|
|
|
|
{
|
|
|
|
|
switch (currentId()) {
|
|
|
|
|
case StartPageId:
|
|
|
|
|
d->wizardData.configName = d->startPage.configName();
|
2011-03-09 12:07:35 +01:00
|
|
|
d->wizardData.osVersion = d->startPage.osVersion();
|
2011-02-02 17:53:36 +01:00
|
|
|
d->wizardData.deviceType = d->startPage.deviceType();
|
|
|
|
|
d->wizardData.hostName = d->startPage.hostName();
|
|
|
|
|
|
2011-02-14 13:56:39 +01:00
|
|
|
if (d->wizardData.deviceType == MaemoDeviceConfig::Emulator) {
|
2011-02-03 14:17:13 +01:00
|
|
|
return FinalPageId;
|
2011-04-21 14:39:57 +02:00
|
|
|
} else if (d->wizardData.osVersion == MaemoDeviceConfig::GenericLinux) {
|
2011-03-09 12:07:35 +01:00
|
|
|
return LoginDataPageId;
|
2011-02-03 14:17:13 +01:00
|
|
|
} else {
|
|
|
|
|
return PreviousKeySetupCheckPageId;
|
|
|
|
|
}
|
2011-03-09 12:07:35 +01:00
|
|
|
case LoginDataPageId:
|
|
|
|
|
d->wizardData.userName = d->loginDataPage.userName();
|
|
|
|
|
d->wizardData.authType = d->loginDataPage.authType();
|
|
|
|
|
if (d->wizardData.authType == SshConnectionParameters::AuthenticationByPassword)
|
|
|
|
|
d->wizardData.password = d->loginDataPage.password();
|
|
|
|
|
else
|
|
|
|
|
d->wizardData.privateKeyFilePath = d->loginDataPage.privateKeyFilePath();
|
|
|
|
|
return FinalPageId;
|
2011-02-02 17:53:36 +01:00
|
|
|
case PreviousKeySetupCheckPageId:
|
|
|
|
|
if (d->previousKeySetupPage.keyBasedLoginWasSetup()) {
|
|
|
|
|
d->wizardData.privateKeyFilePath
|
|
|
|
|
= d->previousKeySetupPage.privateKeyFilePath();
|
2011-02-03 14:17:13 +01:00
|
|
|
return FinalPageId;
|
2011-02-02 17:53:36 +01:00
|
|
|
} else {
|
|
|
|
|
return ReuseKeysCheckPageId;
|
|
|
|
|
}
|
|
|
|
|
case ReuseKeysCheckPageId:
|
|
|
|
|
if (d->reuseKeysCheckPage.reuseKeys()) {
|
|
|
|
|
d->wizardData.privateKeyFilePath
|
|
|
|
|
= d->reuseKeysCheckPage.privateKeyFilePath();
|
|
|
|
|
d->wizardData.publicKeyFilePath
|
|
|
|
|
= d->reuseKeysCheckPage.publicKeyFilePath();
|
|
|
|
|
return KeyDeploymentPageId;
|
|
|
|
|
} else {
|
|
|
|
|
return KeyCreationPageId;
|
|
|
|
|
}
|
|
|
|
|
case KeyCreationPageId:
|
|
|
|
|
d->wizardData.privateKeyFilePath
|
|
|
|
|
= d->keyCreationPage.privateKeyFilePath();
|
|
|
|
|
d->wizardData.publicKeyFilePath
|
|
|
|
|
= d->keyCreationPage.publicKeyFilePath();
|
|
|
|
|
return KeyDeploymentPageId;
|
2011-02-03 16:09:35 +01:00
|
|
|
case KeyDeploymentPageId:
|
|
|
|
|
d->wizardData.hostName = d->keyDeploymentPage.hostAddress();
|
|
|
|
|
return FinalPageId;
|
2011-02-03 14:17:13 +01:00
|
|
|
case FinalPageId: return -1;
|
2011-02-02 17:53:36 +01:00
|
|
|
default:
|
|
|
|
|
Q_ASSERT(false);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qt4ProjectManager
|
|
|
|
|
|
|
|
|
|
#include "maemodeviceconfigwizard.moc"
|