Qnx: Removing BlackBerry Environment Setup wizard

It is replaced by BlackBerry Setup options page.

Change-Id: If0f0b5c10f019fb587f98699e5b4ed4a14984b4f
Reviewed-by: David Kaspar <dkaspar@blackberry.com>
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
David Kaspar
2014-02-12 17:59:28 +01:00
parent 8d5d0b0c9c
commit c149fa63c1
13 changed files with 0 additions and 2078 deletions

View File

@@ -33,7 +33,6 @@
#include "ui_blackberryndksettingswidget.h"
#include "qnxutils.h"
#include "blackberrysigningutils.h"
#include "blackberrysetupwizard.h"
#include "blackberryconfigurationmanager.h"
#include "blackberryconfiguration.h"
@@ -82,7 +81,6 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
m_ui->ndksTreeWidget->expandAll();
connect(m_ui->wizardButton, SIGNAL(clicked()), this, SLOT(launchBlackBerrySetupWizard()));
connect(m_ui->addNdkButton, SIGNAL(clicked()), this, SLOT(addNdkTarget()));
connect(m_ui->removeNdkButton, SIGNAL(clicked()), this, SLOT(removeNdkTarget()));
connect(m_ui->activateNdkTargetButton, SIGNAL(clicked()), this, SLOT(activateNdkTarget()));
@@ -102,12 +100,6 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
connect(&m_bbConfigManager, SIGNAL(settingsChanged()), &m_timer, SLOT(start()));
}
void BlackBerryNDKSettingsWidget::setWizardMessageVisible(bool visible)
{
m_ui->wizardLabel->setVisible(visible);
m_ui->wizardButton->setVisible(visible);
}
bool BlackBerryNDKSettingsWidget::hasActiveNdk() const
{
return !m_bbConfigManager.configurations().isEmpty();
@@ -131,22 +123,6 @@ BlackBerryConfiguration *BlackBerryNDKSettingsWidget::defaultConfiguration() con
m_ui->apiLevelCombo->itemData(currentIndex).value<void*>());
}
void BlackBerryNDKSettingsWidget::launchBlackBerrySetupWizard() const
{
BlackBerrySigningUtils &blackBerryUtils = BlackBerrySigningUtils::instance();
const bool alreadyConfigured = blackBerryUtils.hasRegisteredKeys() && blackBerryUtils.hasDefaultCertificate();
if (alreadyConfigured) {
QMessageBox::information(Core::ICore::mainWindow(), tr("Qt Creator"),
tr("It appears that your BlackBerry environment has already been configured."));
return;
}
BlackBerrySetupWizard wizard(Core::ICore::mainWindow());
connect(&wizard, SIGNAL(ndkTargetsUpdated()), this, SLOT(updateNdkList()));
wizard.exec();
}
void BlackBerryNDKSettingsWidget::updateInfoTable(QTreeWidgetItem* currentItem)
{
BlackBerryConfiguration *config = m_bbConfigManager.configurationFromEnvFile(

View File

@@ -55,8 +55,6 @@ class BlackBerryNDKSettingsWidget : public QWidget
public:
explicit BlackBerryNDKSettingsWidget(QWidget *parent = 0);
void setWizardMessageVisible(bool visible);
bool hasActiveNdk() const;
QList<BlackBerryConfiguration *> activatedTargets();
@@ -68,7 +66,6 @@ signals:
void targetsUpdated();
public slots:
void launchBlackBerrySetupWizard() const;
void updateInfoTable(QTreeWidgetItem* currentItem);
void updateNdkList();
void addNdkTarget();

View File

@@ -14,137 +14,6 @@
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="wizardLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>Get started and configure your environment:</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="wizardButton">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>13</red>
<green>131</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>13</red>
<green>131</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>13</red>
<green>131</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>13</red>
<green>131</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>144</red>
<green>141</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>150</red>
<green>147</green>
<blue>145</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<italic>false</italic>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>environment setup wizard</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>276</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">

View File

@@ -1,515 +0,0 @@
/**************************************************************************
**
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, 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, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "blackberrysetupwizard.h"
#include "blackberrysetupwizardpages.h"
#include "blackberrydeviceconfiguration.h"
#include "blackberrycertificate.h"
#include "blackberryconfigurationmanager.h"
#include "blackberrydebugtokenrequester.h"
#include "blackberrydebugtokenuploader.h"
#include "blackberrydeviceinformation.h"
#include "blackberrysigningutils.h"
#include "qnxconstants.h"
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <ssh/sshconnection.h>
#include <ssh/sshkeygenerator.h>
#include <utils/fileutils.h>
#include <coreplugin/icore.h>
#include <QDir>
#include <QMessageBox>
#include <QHostInfo>
#include <QAbstractButton>
using namespace ProjectExplorer;
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerrySetupWizard::BlackBerrySetupWizard(QWidget *parent) :
Utils::Wizard(parent),
m_ndkPage(0),
m_keysPage(0),
m_certificatePage(0),
m_devicePage(0),
m_certificate(0),
m_deviceInfo(0),
m_requester(0),
m_uploader(0),
m_utils(BlackBerrySigningUtils::instance()),
m_keyGenerator(0),
m_currentStep(-1),
m_stepOffset(0)
{
setWindowTitle(tr("BlackBerry Development Environment Setup Wizard"));
setOption(QWizard::IndependentPages, true);
m_welcomePage = new BlackBerrySetupWizardWelcomePage(this);
m_ndkPage = new BlackBerrySetupWizardNdkPage(this);
m_keysPage = new BlackBerrySetupWizardKeysPage(this);
m_certificatePage = new BlackBerrySetupWizardCertificatePage(this);
m_devicePage = new BlackBerrySetupWizardDevicePage(this);
m_finishPage = new BlackBerrySetupWizardFinishPage(this);
setPage(WelcomePageId, m_welcomePage);
setPage(NdkPageId, m_ndkPage);
setPage(KeysPageId, m_keysPage);
setPage(CertificatePageId, m_certificatePage);
setPage(DevicePageId, m_devicePage);
setPage(FinishPageId, m_finishPage);
m_deviceInfo = new BlackBerryDeviceInformation(this);
m_requester = new BlackBerryDebugTokenRequester(this);
m_uploader = new BlackBerryDebugTokenUploader(this);
m_keyGenerator = new QSsh::SshKeyGenerator;
connect(m_ndkPage, SIGNAL(targetsUpdated()),
this, SIGNAL(ndkTargetsUpdated()));
connect(m_deviceInfo, SIGNAL(finished(int)),
this, SLOT(deviceInfoFinished(int)));
connect(m_requester, SIGNAL(finished(int)),
this, SLOT(debugTokenArrived(int)));
connect(m_uploader, SIGNAL(finished(int)),
this, SLOT(uploaderFinished(int)));
connect(this, SIGNAL(stepFinished()),
this, SLOT(processNextStep()));
registerStep("requestDevicePin", tr("Reading device PIN..."));
registerStep("generateDeveloperCertificate", tr("Generating developer certificate..."));
registerStep("generateSshKeys", tr("Generating SSH keys..."));
registerStep("requestDebugToken", tr("Requesting a debug token for the device..."));
registerStep("uploadDebugToken", tr("Now uploading the debug token..."));
registerStep("writeDeviceInformation", tr("Writing device information..."));
}
BlackBerrySetupWizard::~BlackBerrySetupWizard()
{
delete m_keyGenerator;
foreach (Step *s, m_stepList)
delete s;
m_stepList.clear();
}
void BlackBerrySetupWizard::accept()
{
setBusy(true);
processNextStep();
}
void BlackBerrySetupWizard::processNextStep()
{
m_currentStep++;
if (m_currentStep >= m_stepList.size())
return;
const Step *step = m_stepList.at(m_currentStep);
m_finishPage->setProgress(step->message, m_currentStep * m_stepOffset);
QMetaObject::invokeMethod(this, step->slot);
}
void BlackBerrySetupWizard::deviceInfoFinished(int status)
{
const QString errorString = tr("Error reading device PIN. "
"Please make sure that the specified device IP address is correct.");
if (status != BlackBerryDeviceInformation::Success) {
QMessageBox::critical(this, tr("Error"), errorString);
reset();
return;
}
m_devicePin = m_deviceInfo->devicePin();
if (m_devicePin.isEmpty()) {
QMessageBox::critical(this, tr("Error"), errorString);
reset();
return;
}
emit stepFinished();
}
void BlackBerrySetupWizard::certificateCreated(int status)
{
if (status == BlackBerryCertificate::Error) {
QMessageBox::critical(this, tr("Error"), tr("Error creating developer certificate."));
m_certificate->deleteLater();
m_certificate = 0;
reset();
return;
}
emit stepFinished();
}
void BlackBerrySetupWizard::debugTokenArrived(int status)
{
QString errorString = tr("Failed to request debug token:") + QLatin1Char(' ');
switch (status) {
case BlackBerryDebugTokenRequester::Success:
emit stepFinished();
return;
case BlackBerryDebugTokenRequester::WrongCskPassword:
m_utils.clearCskPassword();
errorString += tr("Wrong CSK password.");
break;
case BlackBerryDebugTokenRequester::WrongKeystorePassword:
errorString += tr("Wrong keystore password.");
break;
case BlackBerryDebugTokenRequester::NetworkUnreachable:
errorString += tr("Network unreachable.");
break;
case BlackBerryDebugTokenRequester::IllegalPin:
errorString += tr("Illegal device PIN.");
break;
case BlackBerryDebugTokenRequester::FailedToStartInferiorProcess:
errorString += tr("Failed to start inferior process.");
break;
case BlackBerryDebugTokenRequester::InferiorProcessTimedOut:
errorString += tr("Inferior processes timed out.");
break;
case BlackBerryDebugTokenRequester::InferiorProcessCrashed:
errorString += tr("Inferior process has crashed.");
break;
case BlackBerryDebugTokenRequester::InferiorProcessReadError:
case BlackBerryDebugTokenRequester::InferiorProcessWriteError:
errorString += tr("Failed to communicate with the inferior process.");
break;
case BlackBerryDebugTokenRequester::UnknownError:
default:
m_utils.clearCskPassword();
errorString += tr("An unknwon error has occurred.");
break;
}
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
QFile dt(configuration.defaultKeystorePath());
if (dt.exists())
dt.remove();
QMessageBox::critical(this, tr("Error"), errorString);
reset();
}
void BlackBerrySetupWizard::uploaderFinished(int status)
{
QString errorString = tr("Failed to upload debug token:") + QLatin1Char(' ');
switch (status) {
case BlackBerryDebugTokenUploader::Success:
emit stepFinished();
return;
case BlackBerryDebugTokenUploader::NoRouteToHost:
errorString += tr("No route to host.");
break;
case BlackBerryDebugTokenUploader::AuthenticationFailed:
errorString += tr("Authentication failed.");
break;
case BlackBerryDebugTokenUploader::DevelopmentModeDisabled:
errorString += tr("Development mode is disabled on the device.");
break;
case BlackBerryDebugTokenUploader::FailedToStartInferiorProcess:
errorString += tr("Failed to start inferior process.");
break;
case BlackBerryDebugTokenUploader::InferiorProcessTimedOut:
errorString += tr("Inferior processes timed out.");
break;
case BlackBerryDebugTokenUploader::InferiorProcessCrashed:
errorString += tr("Inferior process has crashed.");
break;
case BlackBerryDebugTokenUploader::InferiorProcessReadError:
case BlackBerryDebugTokenUploader::InferiorProcessWriteError:
errorString += tr("Failed to communicate with the inferior process.");
break;
case BlackBerryDebugTokenUploader::UnknownError:
errorString += tr("An unknwon error has happened.");
break;
}
QMessageBox::critical(this, tr("Error"), errorString);
reset();
}
void BlackBerrySetupWizard::registerStep(const QByteArray &slot, const QString &message)
{
Step *s = new Step;
s->slot = slot;
s->message = message;
m_stepList << s;
m_stepOffset = 100/m_stepList.size();
}
void BlackBerrySetupWizard::setBusy(bool busy)
{
button(QWizard::BackButton)->setEnabled(!busy);
button(QWizard::NextButton)->setEnabled(!busy);
button(QWizard::FinishButton)->setEnabled(!busy);
button(QWizard::CancelButton)->setEnabled(!busy);
if (!busy)
m_finishPage->setProgress(QString(), -1);
}
void BlackBerrySetupWizard::cleanupFiles() const
{
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
QFile f;
f.setFileName(configuration.defaultKeystorePath());
f.remove();
f.setFileName(configuration.defaultDebugTokenPath());
f.remove();
f.setFileName(privateKeyPath());
f.remove();
f.setFileName(publicKeyPath());
f.remove();
QDir::root().rmpath(storeLocation());
}
void BlackBerrySetupWizard::reset()
{
cleanupFiles();
setBusy(false);
m_currentStep = -1;
if (m_certificate) {
m_certificate->deleteLater();
m_certificate = 0;
}
}
void BlackBerrySetupWizard::requestDevicePin()
{
if (!isPhysicalDevice()) {
emit stepFinished();
return;
}
m_deviceInfo->setDeviceTarget(hostName(), devicePassword());
}
void BlackBerrySetupWizard::generateDeveloperCertificate()
{
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
m_certificate = new BlackBerryCertificate(configuration.defaultKeystorePath(),
certificateAuthor(), certificatePassword());
connect(m_certificate, SIGNAL(finished(int)), this, SLOT(certificateCreated(int)));
m_certificate->store();
}
void BlackBerrySetupWizard::generateSshKeys()
{
const bool success = m_keyGenerator->generateKeys(QSsh::SshKeyGenerator::Rsa,
QSsh::SshKeyGenerator::Mixed, 4096,
QSsh::SshKeyGenerator::DoNotOfferEncryption);
if (!success) {
QMessageBox::critical(this, tr("Key Generation Failed"), m_keyGenerator->error());
reset();
return;
}
if (!QDir::root().mkpath(storeLocation())) {
QMessageBox::critical(this, tr("Failure to Save Key File"),
tr("Failed to create directory: '%1'.").arg(storeLocation()));
reset();
return;
}
if (QFileInfo(privateKeyPath()).exists()) {
QMessageBox::critical(this, tr("Failure to Save Key File"),
tr("Private key file already exists: '%1'").arg(privateKeyPath()));
reset();
return;
}
if (QFileInfo(publicKeyPath()).exists()) {
QMessageBox::critical(this, tr("Failure to Save Key File"),
tr("Public key file already exists: '%1'").arg(publicKeyPath()));
reset();
return;
}
Utils::FileSaver privateKeySaver(privateKeyPath());
privateKeySaver.write(m_keyGenerator->privateKey());
if (!privateKeySaver.finalize(this)) {
reset();
return; // finalize shows an error message if necessary
}
QFile::setPermissions(privateKeyPath(), QFile::ReadOwner | QFile::WriteOwner);
Utils::FileSaver publicKeySaver(publicKeyPath());
// blackberry-connect requires an @ character to be included in the RSA comment
const QString atHost = QLatin1Char('@') + QHostInfo::localHostName();
QByteArray publicKeyContent = m_keyGenerator->publicKey();
publicKeyContent.append(atHost.toLocal8Bit());
publicKeySaver.write(publicKeyContent);
if (!publicKeySaver.finalize(this)) {
reset();
return;
}
emit stepFinished();
}
void BlackBerrySetupWizard::requestDebugToken()
{
if (!isPhysicalDevice()) {
emit stepFinished();
return;
}
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
bool ok;
const QString cskPassword = m_utils.cskPassword(this, &ok);
if (!ok)
return;
m_requester->requestDebugToken(configuration.defaultDebugTokenPath(),
cskPassword, configuration.defaultKeystorePath(), certificatePassword(), m_devicePin);
}
void BlackBerrySetupWizard::uploadDebugToken()
{
if (!isPhysicalDevice()) {
emit stepFinished();
return;
}
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
m_uploader->uploadDebugToken(configuration.defaultDebugTokenPath(),
hostName(), devicePassword());
}
void BlackBerrySetupWizard::writeDeviceInformation()
{
DeviceManager * const deviceManager = DeviceManager::instance();
deviceManager->addDevice(device());
m_utils.setDefaultCertificate(m_certificate);
QWizard::accept();
}
QString BlackBerrySetupWizard::privateKeyPath() const
{
return storeLocation() + QLatin1String("/id_rsa");
}
QString BlackBerrySetupWizard::publicKeyPath() const
{
return storeLocation() + QLatin1String("/id_rsa.pub");
}
QString BlackBerrySetupWizard::deviceName() const
{
return field(QLatin1String(BlackBerrySetupWizardDevicePage::NameField)).toString();
}
QString BlackBerrySetupWizard::storeLocation() const
{
return Core::ICore::userResourcePath() + QLatin1String("/qnx/") + deviceName();
}
QString BlackBerrySetupWizard::certificatePassword() const
{
return field(QLatin1String(BlackBerrySetupWizardCertificatePage::PasswordField)).toString();
}
QString BlackBerrySetupWizard::certificateAuthor() const
{
return field(QLatin1String(BlackBerrySetupWizardCertificatePage::AuthorField)).toString();
}
QString BlackBerrySetupWizard::hostName() const
{
return field(QLatin1String(BlackBerrySetupWizardDevicePage::IpAddressField)).toString();
}
QString BlackBerrySetupWizard::devicePassword() const
{
return field(QLatin1String(BlackBerrySetupWizardDevicePage::PasswordField)).toString();
}
bool BlackBerrySetupWizard::isPhysicalDevice() const
{
return field(QLatin1String(BlackBerrySetupWizardDevicePage::PhysicalDeviceField)).toBool();
}
IDevice::Ptr BlackBerrySetupWizard::device()
{
QSsh::SshConnectionParameters sshParams;
sshParams.options = QSsh::SshIgnoreDefaultProxy;
sshParams.host = hostName();
sshParams.password = devicePassword();
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey;
sshParams.privateKeyFile = privateKeyPath();
sshParams.userName = QLatin1String("devuser");
sshParams.timeout = 10;
sshParams.port = 22;
IDevice::MachineType machineType = (isPhysicalDevice()) ? IDevice::Hardware : IDevice::Emulator;
BlackBerryDeviceConfiguration::Ptr configuration = BlackBerryDeviceConfiguration::create(
deviceName(), Core::Id(Constants::QNX_BB_OS_TYPE), machineType);
configuration->setSshParameters(sshParams);
configuration->setDebugToken(BlackBerryConfigurationManager::instance().defaultDebugTokenPath());
return configuration;
}

View File

@@ -1,144 +0,0 @@
/**************************************************************************
**
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, 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, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef BLACKBERRYSETUPWIZARD_H
#define BLACKBERRYSETUPWIZARD_H
#include <projectexplorer/devicesupport/idevice.h>
#include <utils/wizard.h>
#include <QList>
#include <QByteArray>
namespace QSsh { class SshKeyGenerator; }
namespace Qnx {
namespace Internal {
class BlackBerrySetupWizardWelcomePage;
class BlackBerrySetupWizardNdkPage;
class BlackBerrySetupWizardKeysPage;
class BlackBerrySetupWizardCertificatePage;
class BlackBerrySetupWizardDevicePage;
class BlackBerrySetupWizardFinishPage;
class BlackBerryCertificate;
class BlackBerryDeviceInformation;
class BlackBerryDebugTokenRequester;
class BlackBerryDebugTokenUploader;
class BlackBerrySigningUtils;
class BlackBerrySetupWizard : public Utils::Wizard
{
Q_OBJECT
public:
explicit BlackBerrySetupWizard(QWidget *parent = 0);
virtual ~BlackBerrySetupWizard();
public slots:
void accept();
signals:
void stepFinished();
void ndkTargetsUpdated();
private slots:
void processNextStep();
void deviceInfoFinished(int status);
void certificateCreated(int status);
void debugTokenArrived(int status);
void uploaderFinished(int status);
void requestDevicePin();
void generateDeveloperCertificate();
void generateSshKeys();
void requestDebugToken();
void uploadDebugToken();
void writeDeviceInformation();
private:
enum PageId {
WelcomePageId,
NdkPageId,
KeysPageId,
CertificatePageId,
DevicePageId,
FinishPageId
};
struct Step {
QByteArray slot;
QString message;
};
void registerStep(const QByteArray &slot, const QString &message);
void setBusy(bool busy);
void cleanupFiles() const;
void reset();
QString privateKeyPath() const;
QString publicKeyPath() const;
QString deviceName() const;
QString storeLocation() const;
QString certificatePassword() const;
QString certificateAuthor() const;
QString devicePassword() const;
QString hostName() const;
bool isPhysicalDevice() const;
ProjectExplorer::IDevice::Ptr device();
BlackBerrySetupWizardWelcomePage *m_welcomePage;
BlackBerrySetupWizardNdkPage *m_ndkPage;
BlackBerrySetupWizardKeysPage *m_keysPage;
BlackBerrySetupWizardCertificatePage *m_certificatePage;
BlackBerrySetupWizardDevicePage *m_devicePage;
BlackBerrySetupWizardFinishPage *m_finishPage;
BlackBerryCertificate *m_certificate;
BlackBerryDeviceInformation *m_deviceInfo;
BlackBerryDebugTokenRequester *m_requester;
BlackBerryDebugTokenUploader *m_uploader;
BlackBerrySigningUtils &m_utils;
QSsh::SshKeyGenerator *m_keyGenerator;
QString m_devicePin;
QList<Step*> m_stepList;
int m_currentStep;
int m_stepOffset;
};
} // namespace Qnx
} // namespace Internal
#endif // BLACKBERRYSETUPWIZARD_H

View File

@@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerrySetupWizardCertificatePage</class>
<widget class="QWidget" name="Qnx::Internal::BlackBerrySetupWizardCertificatePage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>223</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Author:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="author"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Password:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="password">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Confirm password:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="password2">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="showPassword">
<property name="text">
<string>Show password</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="status">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Status</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>93</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,134 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerrySetupWizardDevicePage</class>
<widget class="QWizardPage" name="Qnx::Internal::BlackBerrySetupWizardDevicePage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>508</width>
<height>159</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Device name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="deviceName">
<property name="placeholderText">
<string>IP or host name of the device</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Device IP address:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="ipAddress"/>
</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>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Device password:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="password">
<property name="toolTip">
<string>The password you use to unlock your device</string>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<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>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="physicalDevice">
<property name="text">
<string>Physical device</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="simulator">
<property name="text">
<string>Simulator</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerrySetupWizardFinishPage</class>
<widget class="QWizardPage" name="Qnx::Internal::BlackBerrySetupWizardFinishPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>134</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>36</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="statusLabel">
<property name="text">
<string>Status</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>36</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,429 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerrySetupWizardKeysPage</class>
<widget class="QWizardPage" name="Qnx::Internal::BlackBerrySetupWizardKeysPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>581</width>
<height>222</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<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>
<item>
<widget class="QLabel" name="legacyLabel">
<property name="palette">
<palette>
<active>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Legacy keys detected&lt;/span&gt;&lt;/p&gt;&lt;p&gt;It appears you are using legacy key files. Please visit &lt;a href=&quot;https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/bbid_to_sa.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#004f69;&quot;&gt;this page&lt;/span&gt;&lt;/a&gt; to upgrade your keys.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="openExternalLinks">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="linkLabel">
<property name="palette">
<palette>
<active>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Obtaining keys&lt;/span&gt;&lt;/p&gt;&lt;p&gt;You will need to order your signing keys from BlackBerry, by &lt;a href=&quot;https://www.blackberry.com/SignedKeys/codesigning.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#004f69;&quot;&gt;visiting this page.&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="openExternalLinks">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="helpLabel">
<property name="palette">
<palette>
<active>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Help&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Check &lt;a href=&quot;https://developer.blackberry.com/CodeSigningHelp/codesignhelp.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#004f69;&quot;&gt;this link&lt;/span&gt;&lt;/a&gt; if you need help with code signing.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="openExternalLinks">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="statusLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Your BlackBerry signing keys have already been installed.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<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>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,345 +0,0 @@
/**************************************************************************
**
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, 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, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "blackberrysetupwizardpages.h"
#include "blackberryndksettingswidget.h"
#include "blackberryconfiguration.h"
#include "blackberrysigningutils.h"
#include "ui_blackberrysetupwizardkeyspage.h"
#include "ui_blackberrysetupwizardcertificatepage.h"
#include "ui_blackberrysetupwizarddevicepage.h"
#include "ui_blackberrysetupwizardfinishpage.h"
#include <QVBoxLayout>
#include <QFileInfo>
#include <QLabel>
#include <QVBoxLayout>
#include <QMessageBox>
#include <QAbstractButton>
#include <QDesktopServices>
#include <QUrl>
#include <QDebug>
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerrySetupWizardWelcomePage::BlackBerrySetupWizardWelcomePage(QWidget *parent) :
QWizardPage(parent)
{
const QString welcomeMessage =
tr("Welcome to the BlackBerry Development "
"Environment Setup Wizard.\nThis wizard will guide you through "
"the essential steps to deploy a ready-to-go development environment "
"for BlackBerry 10 devices.");
setTitle(tr("BlackBerry Development Environment Setup"));
QLabel *label = new QLabel(this);
label->setWordWrap(true);
label->setText(welcomeMessage);
QVBoxLayout *layout = new QVBoxLayout;
layout->addStretch();
layout->addWidget(label);
layout->addStretch();
setLayout(layout);
}
//-----------------------------------------------------------------------------
BlackBerrySetupWizardNdkPage::BlackBerrySetupWizardNdkPage(QWidget *parent) :
QWizardPage(parent),
m_widget(0)
{
setTitle(tr("Configure the NDK Path"));
m_widget = new BlackBerryNDKSettingsWidget(this);
m_widget->setWizardMessageVisible(false);
connect(m_widget, SIGNAL(targetsUpdated()), this, SIGNAL(completeChanged()));
connect(m_widget, SIGNAL(targetsUpdated()), this, SIGNAL(targetsUpdated()));
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(m_widget);
setLayout(layout);
}
BlackBerrySetupWizardNdkPage::~BlackBerrySetupWizardNdkPage()
{
}
bool BlackBerrySetupWizardNdkPage::isComplete() const
{
return m_widget->hasActiveNdk();
}
//-----------------------------------------------------------------------------
BlackBerrySetupWizardKeysPage::BlackBerrySetupWizardKeysPage(QWidget *parent) :
QWizardPage(parent),
m_ui(0),
m_complete(false)
{
setTitle(tr("Setup Signing Keys"));
initUi();
}
BlackBerrySetupWizardKeysPage::~BlackBerrySetupWizardKeysPage()
{
delete m_ui;
m_ui = 0;
}
void BlackBerrySetupWizardKeysPage::showKeysMessage(const QString &url)
{
const QMessageBox::StandardButton button = QMessageBox::question(this,
tr("Qt Creator"),
tr("This wizard will be closed and you will be taken to the BlackBerry "
"key request web page. Do you want to continue?"),
QMessageBox::Yes | QMessageBox::No);
if (button == QMessageBox::Yes) {
QDesktopServices::openUrl(QUrl(url));
wizard()->reject();
}
}
bool BlackBerrySetupWizardKeysPage::isComplete() const
{
return m_complete;
}
void BlackBerrySetupWizardKeysPage::initUi()
{
BlackBerrySigningUtils &utils = BlackBerrySigningUtils::instance();
m_ui = new Ui::BlackBerrySetupWizardKeysPage;
m_ui->setupUi(this);
if (utils.hasLegacyKeys()) {
m_ui->linkLabel->setVisible(false);
m_ui->legacyLabel->setVisible(true);
m_ui->statusLabel->setVisible(false);
setComplete(false);
} else if (utils.hasRegisteredKeys()) {
m_ui->linkLabel->setVisible(false);
m_ui->legacyLabel->setVisible(false);
m_ui->statusLabel->setVisible(true);
setComplete(true);
} else {
m_ui->linkLabel->setVisible(true);
m_ui->legacyLabel->setVisible(false);
m_ui->statusLabel->setVisible(false);
setComplete(false);
}
connect(m_ui->linkLabel, SIGNAL(linkActivated(QString)),
this, SLOT(showKeysMessage(QString)));
connect(m_ui->legacyLabel, SIGNAL(linkActivated(QString)),
this, SLOT(showKeysMessage(QString)));
connect(m_ui->helpLabel, SIGNAL(linkActivated(QString)),
this, SLOT(showKeysMessage(QString)));
}
void BlackBerrySetupWizardKeysPage::setComplete(bool complete)
{
if (m_complete != complete) {
m_complete = complete;
m_ui->linkLabel->setVisible(!complete);
m_ui->statusLabel->setVisible(complete);
emit completeChanged();
}
}
//-----------------------------------------------------------------------------
const char BlackBerrySetupWizardCertificatePage::AuthorField[] = "CertificatePage::Author";
const char BlackBerrySetupWizardCertificatePage::PasswordField[] = "CertificatePage::Password";
const char BlackBerrySetupWizardCertificatePage::PasswordField2[] = "CertificatePage::Password2";
BlackBerrySetupWizardCertificatePage::BlackBerrySetupWizardCertificatePage(QWidget *parent)
: QWizardPage(parent),
m_ui(0),
m_complete(false)
{
setTitle(tr("Create Developer Certificate"));
initUi();
}
bool BlackBerrySetupWizardCertificatePage::isComplete() const
{
return m_complete;
}
void BlackBerrySetupWizardCertificatePage::validate()
{
if (m_ui->author->text().isEmpty()
|| m_ui->password->text().isEmpty()
|| m_ui->password2->text().isEmpty()) {
m_ui->status->clear();
setComplete(false);
return;
}
if (m_ui->password->text() != m_ui->password2->text()) {
m_ui->status->setText(tr("The entered passwords do not match."));
setComplete(false);
return;
}
if (m_ui->password->text().size() < 6) {
// TODO: Use tr() once string freeze is over
m_ui->status->setText(QCoreApplication::translate("Qnx::Internal::BlackBerryCreateCertificateDialog", "Password must be at least 6 characters long."));
setComplete(false);
return;
}
m_ui->status->clear();
setComplete(true);
}
void BlackBerrySetupWizardCertificatePage::checkBoxChanged(int state)
{
if (state == Qt::Checked) {
m_ui->password->setEchoMode(QLineEdit::Normal);
m_ui->password2->setEchoMode(QLineEdit::Normal);
} else {
m_ui->password->setEchoMode(QLineEdit::Password);
m_ui->password2->setEchoMode(QLineEdit::Password);
}
}
void BlackBerrySetupWizardCertificatePage::setComplete(bool complete)
{
if (m_complete != complete) {
m_complete = complete;
emit completeChanged();
}
}
void BlackBerrySetupWizardCertificatePage::initUi()
{
m_ui = new Ui::BlackBerrySetupWizardCertificatePage;
m_ui->setupUi(this);
m_ui->status->clear();
connect(m_ui->author, SIGNAL(textChanged(QString)),
this, SLOT(validate()));
connect(m_ui->password, SIGNAL(textChanged(QString)),
this, SLOT(validate()));
connect(m_ui->password2, SIGNAL(textChanged(QString)),
this, SLOT(validate()));
connect(m_ui->showPassword, SIGNAL(stateChanged(int)),
this, SLOT(checkBoxChanged(int)));
registerField(QLatin1String(AuthorField) + QLatin1Char('*'), m_ui->author);
registerField(QLatin1String(PasswordField) + QLatin1Char('*'), m_ui->password);
registerField(QLatin1String(PasswordField2) + QLatin1Char('*'), m_ui->password2);
}
//-----------------------------------------------------------------------------
const char BlackBerrySetupWizardDevicePage::NameField[] = "DevicePage::Name";
const char BlackBerrySetupWizardDevicePage::IpAddressField[] = "DevicePage::IpAddress";
const char BlackBerrySetupWizardDevicePage::PasswordField[] = "DevicePage::PasswordField";
const char BlackBerrySetupWizardDevicePage::PhysicalDeviceField[] = "DevicePage::PhysicalDeviceField";
BlackBerrySetupWizardDevicePage::BlackBerrySetupWizardDevicePage(QWidget *parent)
: QWizardPage(parent),
m_ui(0)
{
setTitle(tr("Configure BlackBerry Device Connection"));
m_ui = new Ui::BlackBerrySetupWizardDevicePage;
m_ui->setupUi(this);
m_ui->deviceName->setText(tr("BlackBerry Device"));
m_ui->ipAddress->setText(QLatin1String("169.254.0.1"));
connect(m_ui->deviceName, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
connect(m_ui->ipAddress, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
connect(m_ui->password, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
connect(m_ui->physicalDevice, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
registerField(QLatin1String(NameField) + QLatin1Char('*'), m_ui->deviceName);
registerField(QLatin1String(IpAddressField) + QLatin1Char('*'), m_ui->ipAddress);
registerField(QLatin1String(PasswordField), m_ui->password);
registerField(QLatin1String(PhysicalDeviceField), m_ui->physicalDevice);
}
bool BlackBerrySetupWizardDevicePage::isComplete() const
{
if (m_ui->deviceName->text().isEmpty() || m_ui->ipAddress->text().isEmpty())
return false;
const bool passwordMandatory = m_ui->physicalDevice->isChecked();
if (passwordMandatory && m_ui->password->text().isEmpty())
return false;
return true;
}
//-----------------------------------------------------------------------------
BlackBerrySetupWizardFinishPage::BlackBerrySetupWizardFinishPage(QWidget *parent)
: QWizardPage(parent),
m_ui(0)
{
setTitle(tr("Your environment is ready to be configured."));
m_ui = new Ui::BlackBerrySetupWizardFinishPage;
m_ui->setupUi(this);
setProgress(QString(), -1);
}
void BlackBerrySetupWizardFinishPage::setProgress(const QString &status, int progress)
{
if (progress < 0) {
m_ui->progressBar->hide();
m_ui->statusLabel->clear();
return;
} else if (!m_ui->progressBar->isVisible()) {
m_ui->progressBar->show();
}
m_ui->statusLabel->setText(status);
m_ui->progressBar->setValue(progress);
}

View File

@@ -1,165 +0,0 @@
/**************************************************************************
**
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
**
** Contact: BlackBerry (qt@blackberry.com)
** Contact: KDAB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, 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, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYSETUPWIZARDPAGES_H
#define QNX_INTERNAL_BLACKBERRYSETUPWIZARDPAGES_H
#include <QWizardPage>
namespace Utils { class PathChooser; }
namespace Qnx {
namespace Internal {
namespace Ui {
class BlackBerrySetupWizardKeysPage;
class BlackBerrySetupWizardDevicePage;
class BlackBerrySetupWizardCertificatePage;
class BlackBerrySetupWizardFinishPage;
} // namespace Ui
class BlackBerryCertificate;
class BlackBerryNDKSettingsWidget;
class BlackBerrySetupWizardWelcomePage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerrySetupWizardWelcomePage(QWidget *parent = 0);
};
//-----------------------------------------------------------------------------
class BlackBerrySetupWizardNdkPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerrySetupWizardNdkPage(QWidget *parent = 0);
virtual ~BlackBerrySetupWizardNdkPage();
bool isComplete() const;
signals:
void targetsUpdated();
private:
BlackBerryNDKSettingsWidget *m_widget;
};
//-----------------------------------------------------------------------------
class BlackBerrySetupWizardKeysPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerrySetupWizardKeysPage(QWidget *parent = 0);
virtual ~BlackBerrySetupWizardKeysPage();
bool isComplete() const;
private slots:
void showKeysMessage(const QString &url);
private:
void initUi();
void setComplete(bool complete);
Ui::BlackBerrySetupWizardKeysPage *m_ui;
bool m_complete;
};
//-----------------------------------------------------------------------------
class BlackBerrySetupWizardCertificatePage : public QWizardPage
{
Q_OBJECT
public:
static const char AuthorField[];
static const char PasswordField[];
static const char PasswordField2[];
explicit BlackBerrySetupWizardCertificatePage(QWidget *parent = 0);
bool isComplete() const;
private slots:
void validate();
void checkBoxChanged(int state);
private:
void setComplete(bool complete);
void initUi();
Ui::BlackBerrySetupWizardCertificatePage *m_ui;
bool m_complete;
};
//-----------------------------------------------------------------------------
class BlackBerrySetupWizardDevicePage : public QWizardPage
{
Q_OBJECT
public:
static const char NameField[];
static const char IpAddressField[];
static const char PasswordField[];
static const char PhysicalDeviceField[];
explicit BlackBerrySetupWizardDevicePage(QWidget *parent = 0);
bool isComplete() const;
private:
Ui::BlackBerrySetupWizardDevicePage *m_ui;
};
//-----------------------------------------------------------------------------
class BlackBerrySetupWizardFinishPage : public QWizardPage
{
Q_OBJECT
public:
explicit BlackBerrySetupWizardFinishPage(QWidget *parent = 0);
void setProgress(const QString &status, int progress);
private:
Ui::BlackBerrySetupWizardFinishPage *m_ui;
};
//-----------------------------------------------------------------------------
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYSETUPWIZARDPAGES_H

View File

@@ -82,8 +82,6 @@ SOURCES += qnxplugin.cpp \
bardescriptoreditorenvironmentwidget.cpp \
bardescriptoreditorassetswidget.cpp \
bardescriptoreditorabstractpanelwidget.cpp \
blackberrysetupwizard.cpp \
blackberrysetupwizardpages.cpp \
blackberrysigningutils.cpp \
qnxdevicetester.cpp \
blackberryconfigurationmanager.cpp \
@@ -186,8 +184,6 @@ HEADERS += qnxplugin.h\
bardescriptoreditorenvironmentwidget.h \
bardescriptoreditorassetswidget.h \
bardescriptoreditorabstractpanelwidget.h \
blackberrysetupwizard.h \
blackberrysetupwizardpages.h \
blackberrysigningutils.h \
qnxdevicetester.h \
blackberryconfigurationmanager.h \
@@ -230,10 +226,6 @@ FORMS += \
bardescriptoreditorpermissionswidget.ui \
bardescriptoreditorenvironmentwidget.ui \
bardescriptoreditorassetswidget.ui \
blackberrysetupwizardkeyspage.ui \
blackberrysetupwizardcertificatepage.ui \
blackberrysetupwizarddevicepage.ui \
blackberrysetupwizardfinishpage.ui \
blackberrydeviceconfigurationwizardconfigpage.ui \
blackberrydeviceconfigurationwizardquerypage.ui \
blackberryinstallwizardtargetpage.ui \

View File

@@ -188,14 +188,6 @@ QtcPlugin {
"blackberryndkprocess.h",
"blackberrysshkeysgenerator.cpp",
"blackberrysshkeysgenerator.h",
"blackberrysetupwizard.cpp",
"blackberrysetupwizard.h",
"blackberrysetupwizardpages.cpp",
"blackberrysetupwizardpages.h",
"blackberrysetupwizardkeyspage.ui",
"blackberrysetupwizardcertificatepage.ui",
"blackberrysetupwizarddevicepage.ui",
"blackberrysetupwizardfinishpage.ui",
"blackberrysigningutils.cpp",
"blackberrysigningutils.h",
"blackberryversionnumber.cpp",