1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** GNU Lesser General Public License Usage
**
** 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.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#include "maemodeviceconfigwizard.h"
#include "ui_maemodeviceconfigwizardkeycreationpage.h"
#include "ui_maemodeviceconfigwizardkeydeploymentpage.h"
#include "ui_maemodeviceconfigwizardpreviouskeysetupcheckpage.h"
#include "ui_maemodeviceconfigwizardreusekeyscheckpage.h"
#include "ui_maemodeviceconfigwizardstartpage.h"
#include "maddedevicetester.h"
#include "maemoconstants.h"
#include "maemoglobal.h"
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
#include <remotelinux/linuxdevicetestdialog.h>
#include <remotelinux/remotelinuxutils.h>
#include <remotelinux/sshkeydeployer.h>
#include <utils/fileutils.h>
#include <utils/ssh/sshkeygenerator.h>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtGui/QButtonGroup>
#include <QtGui/QDesktopServices>
#include <QtGui/QMessageBox>
#include <QtGui/QWizardPage>
using namespace RemoteLinux;
using namespace Utils;
namespace Madde {
namespace Internal {
namespace {
QString defaultUser(const QString &osType)
{
if (osType == QLatin1String(MeeGoOsType))
return QLatin1String("meego");
return QLatin1String("developer");
}
QString defaultHost(LinuxDeviceConfiguration::DeviceType type)
{
return QLatin1String(type == LinuxDeviceConfiguration::Hardware ? "192.168.2.15" : "localhost");
}
struct WizardData
{
QString configName;
QString hostName;
QString osType;
SshConnectionParameters::AuthenticationType authType;
LinuxDeviceConfiguration::DeviceType deviceType;
QString privateKeyFilePath;
QString publicKeyFilePath;
QString userName;
QString password;
int sshPort;
};
enum PageId {
StartPageId, PreviousKeySetupCheckPageId, ReuseKeysCheckPageId, KeyCreationPageId,
KeyDeploymentPageId, FinalPageId
};
class MaemoDeviceConfigWizardStartPage : public QWizardPage
{
Q_OBJECT
public:
MaemoDeviceConfigWizardStartPage(QWidget *parent = 0)
: QWizardPage(parent), m_ui(new Ui::MaemoDeviceConfigWizardStartPage)
{
m_ui->setupUi(this);
setTitle(tr("General Information"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_ui->osTypeComboBox->addItem(RemoteLinuxUtils::osTypeToString(QLatin1String(Maemo5OsType)),
QLatin1String(Maemo5OsType));
m_ui->osTypeComboBox->addItem(RemoteLinuxUtils::osTypeToString(QLatin1String(HarmattanOsType)),
QLatin1String(HarmattanOsType));
m_ui->osTypeComboBox->addItem(RemoteLinuxUtils::osTypeToString(QLatin1String(MeeGoOsType)),
QLatin1String(MeeGoOsType));
QButtonGroup *buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(true);
buttonGroup->addButton(m_ui->hwButton);
buttonGroup->addButton(m_ui->emulatorButton);
connect(buttonGroup, SIGNAL(buttonClicked(int)),
SLOT(handleDeviceTypeChanged()));
m_ui->nameLineEdit->setText(tr("MeeGo Device"));
m_ui->osTypeComboBox->setCurrentIndex(m_ui->osTypeComboBox->findData(QLatin1String(HarmattanOsType)));
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,
SIGNAL(completeChanged()));
}
virtual bool isComplete() const
{
return !configName().isEmpty() && !hostName().isEmpty();
}
QString configName() const { return m_ui->nameLineEdit->text().trimmed(); }
QString hostName() const
{
return deviceType() == LinuxDeviceConfiguration::Emulator
? defaultHost(LinuxDeviceConfiguration::Emulator)
: m_ui->hostNameLineEdit->text().trimmed();
}
QString osType() const
{
return m_ui->osTypeComboBox->itemData(m_ui->osTypeComboBox->currentIndex()).toString();
}
LinuxDeviceConfiguration::DeviceType deviceType() const
{
return m_ui->hwButton->isChecked()
? LinuxDeviceConfiguration::Hardware : LinuxDeviceConfiguration::Emulator;
}
int sshPort() const
{
return deviceType() == LinuxDeviceConfiguration::Emulator
? 6666 : m_ui->sshPortSpinBox->value();
}
private slots:
void handleDeviceTypeChanged()
{
const bool enable = deviceType() == LinuxDeviceConfiguration::Hardware;
m_ui->hostNameLabel->setEnabled(enable);
m_ui->hostNameLineEdit->setEnabled(enable);
m_ui->sshPortLabel->setEnabled(enable);
m_ui->sshPortSpinBox->setEnabled(enable);
}
private:
const QScopedPointer<Ui::MaemoDeviceConfigWizardStartPage> m_ui;
};
class MaemoDeviceConfigWizardPreviousKeySetupCheckPage : public QWizardPage
{
Q_OBJECT
public:
MaemoDeviceConfigWizardPreviousKeySetupCheckPage(QWidget *parent)
: QWizardPage(parent),
m_ui(new Ui::MaemoDeviceConfigWizardCheckPreviousKeySetupPage)
{
m_ui->setupUi(this);
m_ui->privateKeyFilePathChooser->setExpectedKind(PathChooser::File);
setTitle(tr("Device Status Check"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
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()));
connect(m_ui->privateKeyFilePathChooser, SIGNAL(changed(QString)),
this, SIGNAL(completeChanged()));
}
virtual bool isComplete() const
{
return !keyBasedLoginWasSetup()
|| m_ui->privateKeyFilePathChooser->isValid();
}
virtual void initializePage()
{
m_ui->keyWasNotSetUpButton->setChecked(true);
m_ui->privateKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
handleSelectionChanged();
}
bool keyBasedLoginWasSetup() const {
return m_ui->keyWasSetUpButton->isChecked();
}
QString privateKeyFilePath() const {
return m_ui->privateKeyFilePathChooser->path();
}
private:
Q_SLOT void handleSelectionChanged()
{
m_ui->privateKeyFilePathChooser->setEnabled(keyBasedLoginWasSetup());
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);
setTitle(tr("Existing Keys Check"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_ui->publicKeyFilePathChooser->setExpectedKind(PathChooser::File);
m_ui->privateKeyFilePathChooser->setExpectedKind(PathChooser::File);
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()));
connect(m_ui->privateKeyFilePathChooser, SIGNAL(changed(QString)),
this, SIGNAL(completeChanged()));
connect(m_ui->publicKeyFilePathChooser, SIGNAL(changed(QString)),
this, SIGNAL(completeChanged()));
}
virtual bool isComplete() const
{
return !reuseKeys() || (m_ui->publicKeyFilePathChooser->isValid()
&& m_ui->privateKeyFilePathChooser->isValid());
}
virtual void initializePage()
{
m_ui->dontReuseButton->setChecked(true);
m_ui->privateKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
m_ui->publicKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPublicKeyFilePath());
handleSelectionChanged();
}
bool reuseKeys() const { return m_ui->reuseButton->isChecked(); }
QString privateKeyFilePath() const {
return m_ui->privateKeyFilePathChooser->path();
}
QString publicKeyFilePath() const {
return m_ui->publicKeyFilePathChooser->path();
}
private:
Q_SLOT void handleSelectionChanged()
{
m_ui->privateKeyFilePathLabel->setEnabled(reuseKeys());
m_ui->privateKeyFilePathChooser->setEnabled(reuseKeys());
m_ui->publicKeyFilePathLabel->setEnabled(reuseKeys());
m_ui->publicKeyFilePathChooser->setEnabled(reuseKeys());
emit completeChanged();
}
const QScopedPointer<Ui::MaemoDeviceConfigWizardReuseKeysCheckPage> m_ui;
};
class MaemoDeviceConfigWizardKeyCreationPage : public QWizardPage
{
Q_OBJECT
public:
MaemoDeviceConfigWizardKeyCreationPage(QWidget *parent)
: QWizardPage(parent),
m_ui(new Ui::MaemoDeviceConfigWizardKeyCreationPage)
{
m_ui->setupUi(this);
setTitle(tr("Key Creation"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
connect(m_ui->createKeysButton, SIGNAL(clicked()), SLOT(createKeys()));
}
QString privateKeyFilePath() const {
return m_ui->keyDirPathChooser->path() + QLatin1String("/qtc_id_rsa");
}
QString publicKeyFilePath() const {
return privateKeyFilePath() + QLatin1String(".pub");
}
virtual void initializePage()
{
m_isComplete = false;
const QString &dir = QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
+ QLatin1String("/.ssh");
m_ui->keyDirPathChooser->setPath(dir);
enableInput();
}
virtual bool isComplete() const { return m_isComplete; }
private:
Q_SLOT void createKeys()
{
const QString &dirPath = m_ui->keyDirPathChooser->path();
QFileInfo fi(dirPath);
if (fi.exists() && !fi.isDir()) {
QMessageBox::critical(this, tr("Cannot Create Keys"),
tr("The path you have entered is not a directory."));
return;
}
if (!fi.exists() && !QDir::root().mkpath(dirPath)) {
QMessageBox::critical(this, tr("Cannot Create Keys"),
tr("The directory you have entered does not exist and "
"cannot be created."));
return;
}
m_ui->keyDirPathChooser->setEnabled(false);
m_ui->createKeysButton->setEnabled(false);
m_ui->statusLabel->setText(tr("Creating keys ... "));
SshKeyGenerator keyGenerator;
if (!keyGenerator.generateKeys(SshKeyGenerator::Rsa,
SshKeyGenerator::Mixed, 1024)) {
QMessageBox::critical(this, tr("Cannot Create Keys"),
tr("Key creation failed: %1").arg(keyGenerator.error()));
enableInput();
return;
}
if (!saveFile(privateKeyFilePath(), keyGenerator.privateKey())
|| !saveFile(publicKeyFilePath(), keyGenerator.publicKey())) {
enableInput();
return;
}
QFile::setPermissions(privateKeyFilePath(),
QFile::ReadOwner | QFile::WriteOwner);
m_ui->statusLabel->setText(m_ui->statusLabel->text() + tr("Done."));
m_isComplete = true;
emit completeChanged();
}
bool saveFile(const QString &filePath, const QByteArray &data)
{
Utils::FileSaver saver(filePath);
saver.write(data);
if (!saver.finalize()) {
QMessageBox::critical(this, tr("Could Not Save Key File"), saver.errorString());
return false;
}
return true;
}
void enableInput()
{
m_ui->keyDirPathChooser->setEnabled(true);
m_ui->createKeysButton->setEnabled(true);
m_ui->statusLabel->clear();
}
const QScopedPointer<Ui::MaemoDeviceConfigWizardKeyCreationPage> m_ui;
bool m_isComplete;
};
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 SshKeyDeployer(this))
{
m_ui->setupUi(this);
m_instructionTextTemplate = m_ui->instructionLabel->text();
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);
m_ui->instructionLabel->setText(QString(m_instructionTextTemplate)
.replace(QLatin1String("%%%maddev%%%"),
MaemoGlobal::madDeveloperUiName(m_wizardData.osType)));
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()
{
using namespace Utils;
m_ui->deviceAddressLineEdit->setEnabled(false);
m_ui->passwordLineEdit->setEnabled(false);
m_ui->deployButton->setEnabled(false);
SshConnectionParameters sshParams(SshConnectionParameters::NoProxy);
sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword;
sshParams.host = hostAddress();
sshParams.port = m_wizardData.sshPort;
sshParams.password = password();
sshParams.timeout = 10;
sshParams.userName = defaultUser(m_wizardData.osType);
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 "
"the \"%1\" application and continue.")
.arg(MaemoGlobal::madDeveloperUiName(m_wizardData.osType)));
m_ui->statusLabel->setText(m_ui->statusLabel->text() + tr("Done."));
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;
SshKeyDeployer * const m_keyDeployer;
QString m_instructionTextTemplate;
};
class MaemoDeviceConfigWizardFinalPage : public GenericLinuxDeviceConfigurationWizardFinalPage
{
Q_OBJECT
public:
MaemoDeviceConfigWizardFinalPage(const WizardData &wizardData, QWidget *parent)
: GenericLinuxDeviceConfigurationWizardFinalPage(parent), m_wizardData(wizardData)
{
}
private:
QString infoText() const
{
if (m_wizardData.deviceType == LinuxDeviceConfiguration::Emulator)
return tr("The new device configuration will now be created.");
return GenericLinuxDeviceConfigurationWizardFinalPage::infoText();
}
const WizardData &m_wizardData;
};
} // anonymous namespace
struct MaemoDeviceConfigWizardPrivate
{
MaemoDeviceConfigWizardPrivate(QWidget *parent)
: startPage(parent),
previousKeySetupPage(parent),
reuseKeysCheckPage(parent),
keyCreationPage(parent),
keyDeploymentPage(wizardData, parent),
finalPage(wizardData, parent)
{
}
WizardData wizardData;
MaemoDeviceConfigWizardStartPage startPage;
MaemoDeviceConfigWizardPreviousKeySetupCheckPage previousKeySetupPage;
MaemoDeviceConfigWizardReuseKeysCheckPage reuseKeysCheckPage;
MaemoDeviceConfigWizardKeyCreationPage keyCreationPage;
MaemoDeviceConfigWizardKeyDeploymentPage keyDeploymentPage;
MaemoDeviceConfigWizardFinalPage finalPage;
};
MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(QWidget *parent)
: ILinuxDeviceConfigurationWizard(parent), d(new MaemoDeviceConfigWizardPrivate(this))
{
setWindowTitle(tr("New Device Configuration Setup"));
setPage(StartPageId, &d->startPage);
setPage(PreviousKeySetupCheckPageId, &d->previousKeySetupPage);
setPage(ReuseKeysCheckPageId, &d->reuseKeysCheckPage);
setPage(KeyCreationPageId, &d->keyCreationPage);
setPage(KeyDeploymentPageId, &d->keyDeploymentPage);
setPage(FinalPageId, &d->finalPage);
d->finalPage.setCommitPage(true);
}
MaemoDeviceConfigWizard::~MaemoDeviceConfigWizard()
{
delete d;
}
LinuxDeviceConfiguration::Ptr MaemoDeviceConfigWizard::deviceConfiguration()
{
bool doTest;
QString freePortsSpec;
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 == QLatin1String(MeeGoOsType)
? QLatin1String("meego") : QString();
sshParams.timeout = 30;
freePortsSpec = QLatin1String("13219,14168");
doTest = false;
} else {
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByKey;
sshParams.privateKeyFile = d->wizardData.privateKeyFilePath;
sshParams.timeout = 10;
freePortsSpec = QLatin1String("10000-10100");
doTest = true;
}
const LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(d->wizardData.configName,
d->wizardData.osType, d->wizardData.deviceType, PortList::fromString(freePortsSpec),
sshParams);
if (doTest) {
LinuxDeviceTestDialog dlg(devConf, new MaddeDeviceTester(this), this);
dlg.exec();
}
return devConf;
}
int MaemoDeviceConfigWizard::nextId() const
{
switch (currentId()) {
case StartPageId:
d->wizardData.configName = d->startPage.configName();
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;
case PreviousKeySetupCheckPageId:
if (d->previousKeySetupPage.keyBasedLoginWasSetup()) {
d->wizardData.privateKeyFilePath
= d->previousKeySetupPage.privateKeyFilePath();
return FinalPageId;
} 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;
case KeyDeploymentPageId:
d->wizardData.hostName = d->keyDeploymentPage.hostAddress();
return FinalPageId;
case FinalPageId: return -1;
default:
Q_ASSERT(false);
return -1;
}
}
} // namespace Internal
} // namespace Madde
#include "maemodeviceconfigwizard.moc"
|