forked from qt-creator/qt-creator
Qnx: BlackBerry Setup options page
Setup options page checks for general setup of API Levels, Signing Keys and Devices. It is meant to become a central point for BlackBerry settings. Adding BlackBerryConfigurationManager::settingsChanged signal to notify about any change to BBConfig settings. Fixing BlackBerrySigningUtils to correctly ask for password and reopen the certificate in case an invalid password is entered and a generic ResultCode::Error happens. Fixing header define for blackberryinstallwizard.h Fixing URL for BlackBerry Legacy Keys. Change-Id: I1c4592c03ab07678ef829b85ce7b13457b9304a9 Reviewed-by: David Kaspar <dkaspar@blackberry.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "blackberryconfiguration.h"
|
#include "blackberryconfiguration.h"
|
||||||
|
#include "blackberryconfigurationmanager.h"
|
||||||
#include "blackberryqtversion.h"
|
#include "blackberryqtversion.h"
|
||||||
|
|
||||||
#include "qnxtoolchain.h"
|
#include "qnxtoolchain.h"
|
||||||
@@ -435,6 +436,8 @@ bool BlackBerryConfiguration::activate()
|
|||||||
if (qt5X86Version)
|
if (qt5X86Version)
|
||||||
createKit(qt5X86Version, x86ToolChain, x86DebuggerItemId);
|
createKit(qt5X86Version, x86ToolChain, x86DebuggerItemId);
|
||||||
|
|
||||||
|
BlackBerryConfigurationManager::instance().emitSettingsChanged();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,6 +459,8 @@ void BlackBerryConfiguration::deactivate()
|
|||||||
KitManager::deregisterKit(kit);
|
KitManager::deregisterKit(kit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlackBerryConfigurationManager::instance().emitSettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
@@ -150,6 +150,8 @@ void BlackBerryConfigurationManager::restoreConfigurations()
|
|||||||
if (!useNewestConfiguration && (config->ndkEnvFile().toString() == ndkEnvFile))
|
if (!useNewestConfiguration && (config->ndkEnvFile().toString() == ndkEnvFile))
|
||||||
setDefaultConfiguration(config);
|
setDefaultConfiguration(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backward compatibility: Read existing entries in the ManualNDKsGroup
|
// Backward compatibility: Read existing entries in the ManualNDKsGroup
|
||||||
@@ -205,6 +207,7 @@ void BlackBerryConfigurationManager::setDefaultConfiguration(BlackBerryConfigura
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_defaultConfiguration = config;
|
m_defaultConfiguration = config;
|
||||||
|
emit settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlackBerryConfigurationManager::newestConfigurationEnabled() const
|
bool BlackBerryConfigurationManager::newestConfigurationEnabled() const
|
||||||
@@ -212,6 +215,11 @@ bool BlackBerryConfigurationManager::newestConfigurationEnabled() const
|
|||||||
return !m_defaultConfiguration;
|
return !m_defaultConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlackBerryConfigurationManager::emitSettingsChanged()
|
||||||
|
{
|
||||||
|
emit settingsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void BlackBerryConfigurationManager::setKitsAutoDetectionSource()
|
void BlackBerryConfigurationManager::setKitsAutoDetectionSource()
|
||||||
{
|
{
|
||||||
foreach (Kit *kit, KitManager::kits()) {
|
foreach (Kit *kit, KitManager::kits()) {
|
||||||
@@ -267,6 +275,7 @@ bool BlackBerryConfigurationManager::addConfiguration(BlackBerryConfiguration *c
|
|||||||
|
|
||||||
if (config->isValid()) {
|
if (config->isValid()) {
|
||||||
insertByVersion(config);
|
insertByVersion(config);
|
||||||
|
emit settingsChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,6 +296,8 @@ void BlackBerryConfigurationManager::removeConfiguration(BlackBerryConfiguration
|
|||||||
setDefaultConfiguration(0);
|
setDefaultConfiguration(0);
|
||||||
|
|
||||||
delete config;
|
delete config;
|
||||||
|
|
||||||
|
emit settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BlackBerryConfiguration *> BlackBerryConfigurationManager::configurations() const
|
QList<BlackBerryConfiguration *> BlackBerryConfigurationManager::configurations() const
|
||||||
@@ -369,6 +380,7 @@ void BlackBerryConfigurationManager::loadSettings()
|
|||||||
m_configs.first()->activate();
|
m_configs.first()->activate();
|
||||||
|
|
||||||
emit settingsLoaded();
|
emit settingsLoaded();
|
||||||
|
emit settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlackBerryConfigurationManager::saveSettings()
|
void BlackBerryConfigurationManager::saveSettings()
|
||||||
|
@@ -64,7 +64,6 @@ public:
|
|||||||
QString barsignerDbPath() const;
|
QString barsignerDbPath() const;
|
||||||
QString defaultKeystorePath() const;
|
QString defaultKeystorePath() const;
|
||||||
QString defaultDebugTokenPath() const;
|
QString defaultDebugTokenPath() const;
|
||||||
void clearConfigurationSettings(BlackBerryConfiguration *config);
|
|
||||||
|
|
||||||
// returns the environment for the default API level
|
// returns the environment for the default API level
|
||||||
QList<Utils::EnvironmentItem> defaultConfigurationEnv() const;
|
QList<Utils::EnvironmentItem> defaultConfigurationEnv() const;
|
||||||
@@ -74,6 +73,8 @@ public:
|
|||||||
|
|
||||||
bool newestConfigurationEnabled() const;
|
bool newestConfigurationEnabled() const;
|
||||||
|
|
||||||
|
void emitSettingsChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
@@ -81,6 +82,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void settingsLoaded();
|
void settingsLoaded();
|
||||||
|
void settingsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BlackBerryConfigurationManager(QObject *parent = 0);
|
BlackBerryConfigurationManager(QObject *parent = 0);
|
||||||
|
@@ -29,8 +29,8 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H
|
#ifndef QNX_INTERNAL_BLACKBERRYINSTALLWIZARD_H
|
||||||
#define QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H
|
#define QNX_INTERNAL_BLACKBERRYINSTALLWIZARD_H
|
||||||
|
|
||||||
#include <utils/wizard.h>
|
#include <utils/wizard.h>
|
||||||
|
|
||||||
@@ -105,4 +105,4 @@ private:
|
|||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qnx
|
} // namespace Qnx
|
||||||
|
|
||||||
#endif // QNX_INTERNAL_BLACKBERRYDEVICECONFIGURATIONWIZARD_H
|
#endif // QNX_INTERNAL_BLACKBERRYINSTALLWIZARD_H
|
||||||
|
@@ -135,19 +135,8 @@ void BlackBerryKeysWidget::certificateLoaded(int status)
|
|||||||
|
|
||||||
void BlackBerryKeysWidget::createCertificate()
|
void BlackBerryKeysWidget::createCertificate()
|
||||||
{
|
{
|
||||||
BlackBerryCreateCertificateDialog dialog(this);
|
if (m_utils.createCertificate())
|
||||||
|
|
||||||
const int result = dialog.exec();
|
|
||||||
|
|
||||||
if (result == QDialog::Rejected)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BlackBerryCertificate *certificate = dialog.certificate();
|
|
||||||
|
|
||||||
if (certificate) {
|
|
||||||
m_utils.setDefaultCertificate(certificate);
|
|
||||||
updateCertificateSection();
|
updateCertificateSection();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlackBerryKeysWidget::clearCertificate()
|
void BlackBerryKeysWidget::clearCertificate()
|
||||||
@@ -194,17 +183,16 @@ void BlackBerryKeysWidget::updateCertificateSection()
|
|||||||
void BlackBerryKeysWidget::updateKeysSection()
|
void BlackBerryKeysWidget::updateKeysSection()
|
||||||
{
|
{
|
||||||
if (m_utils.hasLegacyKeys()) {
|
if (m_utils.hasLegacyKeys()) {
|
||||||
m_ui->keyStatus->setText(tr("It appears you are using legacy key files. "
|
m_ui->keyStatus->setText(tr("It appears you are using legacy key files. Please refer to the "
|
||||||
"Please refer to the "
|
"<a href=\"%1\">BlackBerry website</a> to find out how to update your keys.")
|
||||||
"<a href=\"https://developer.blackberry.com/native/documentation"
|
.arg(QLatin1String(Qnx::Constants::QNX_LEGACY_KEYS_URL)));
|
||||||
"/core/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/bbid_to_sa.html\">"
|
|
||||||
"BlackBerry website</a> to find out how to update your keys."));
|
|
||||||
} else if (m_utils.hasRegisteredKeys()) {
|
} else if (m_utils.hasRegisteredKeys()) {
|
||||||
m_ui->keyStatus->setText(tr("Your keys are ready to be used"));
|
m_ui->keyStatus->setText(tr("Your keys are ready to be used"));
|
||||||
} else {
|
} else {
|
||||||
m_ui->keyStatus->setText(tr("No keys found. Please refer to the "
|
m_ui->keyStatus->setText(tr("No keys found. Please refer to the "
|
||||||
"<a href=\"https://www.blackberry.com/SignedKeys/codesigning.html\">BlackBerry website</a> "
|
"<a href=\"%1\">BlackBerry website</a> "
|
||||||
"to find out how to request your keys."));
|
"to find out how to request your keys.")
|
||||||
|
.arg(QLatin1String(Qnx::Constants::QNX_REGISTER_KEYS_URL)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,8 +91,15 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
|
|||||||
connect(m_ui->ndksTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateInfoTable(QTreeWidgetItem*)));
|
connect(m_ui->ndksTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateInfoTable(QTreeWidgetItem*)));
|
||||||
connect(this, SIGNAL(targetsUpdated()), this, SLOT(populateDefaultConfigurationCombo()));
|
connect(this, SIGNAL(targetsUpdated()), this, SLOT(populateDefaultConfigurationCombo()));
|
||||||
|
|
||||||
updateNdkList();
|
// BlackBerryConfigurationManager.settingsChanged signal may be emitted multiple times
|
||||||
populateDefaultConfigurationCombo();
|
// during the same event handling. This would result in multiple updatePage() calls even through
|
||||||
|
// just one is needed.
|
||||||
|
// QTimer allows to merge those multiple signal emits into a single updatePage() call.
|
||||||
|
m_timer.setSingleShot(true);
|
||||||
|
connect(&m_timer, SIGNAL(timeout()), this, SLOT(updatePage()));
|
||||||
|
|
||||||
|
updatePage();
|
||||||
|
connect(&m_bbConfigManager, SIGNAL(settingsChanged()), &m_timer, SLOT(start()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlackBerryNDKSettingsWidget::setWizardMessageVisible(bool visible)
|
void BlackBerryNDKSettingsWidget::setWizardMessageVisible(bool visible)
|
||||||
@@ -393,6 +400,12 @@ void BlackBerryNDKSettingsWidget::launchBlackBerryInstallerWizard(BlackBerryInst
|
|||||||
wizard.exec();
|
wizard.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlackBerryNDKSettingsWidget::updatePage()
|
||||||
|
{
|
||||||
|
updateNdkList();
|
||||||
|
populateDefaultConfigurationCombo();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qnx
|
} // namespace Qnx
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include "blackberryinstallwizard.h"
|
#include "blackberryinstallwizard.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
@@ -80,6 +81,7 @@ public slots:
|
|||||||
void handleUninstallationFinished();
|
void handleUninstallationFinished();
|
||||||
void updateUi(QTreeWidgetItem* item, BlackBerryConfiguration* config);
|
void updateUi(QTreeWidgetItem* item, BlackBerryConfiguration* config);
|
||||||
void populateDefaultConfigurationCombo();
|
void populateDefaultConfigurationCombo();
|
||||||
|
void updatePage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void launchBlackBerryInstallerWizard(BlackBerryInstallerDataHandler::Mode mode,
|
void launchBlackBerryInstallerWizard(BlackBerryInstallerDataHandler::Mode mode,
|
||||||
@@ -93,6 +95,8 @@ private:
|
|||||||
|
|
||||||
QList<BlackBerryConfiguration *> m_activatedTargets;
|
QList<BlackBerryConfiguration *> m_activatedTargets;
|
||||||
QList<BlackBerryConfiguration *> m_deactivatedTargets;
|
QList<BlackBerryConfiguration *> m_deactivatedTargets;
|
||||||
|
|
||||||
|
QTimer m_timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
67
src/plugins/qnx/blackberrysetuppage.cpp
Normal file
67
src/plugins/qnx/blackberrysetuppage.cpp
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
|
||||||
|
**
|
||||||
|
** Contact: BlackBerry (qt@blackberry.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 "blackberrysetuppage.h"
|
||||||
|
#include "blackberrysetupwidget.h"
|
||||||
|
#include "qnxconstants.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
namespace Qnx {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
BlackBerrySetupPage::BlackBerrySetupPage(QObject *parent)
|
||||||
|
: Core::IOptionsPage(parent)
|
||||||
|
{
|
||||||
|
setId(Core::Id(Constants::QNX_BB_SETUP_ID));
|
||||||
|
setDisplayName(tr("Setup"));
|
||||||
|
setCategory(Constants::QNX_BB_CATEGORY);
|
||||||
|
setDisplayCategory(QCoreApplication::translate("BlackBerry", Constants::QNX_BB_CATEGORY_TR));
|
||||||
|
setCategoryIcon(QLatin1String(Constants::QNX_BB_CATEGORY_ICON));
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *BlackBerrySetupPage::widget()
|
||||||
|
{
|
||||||
|
if (!m_widget)
|
||||||
|
m_widget = new BlackBerrySetupWidget;
|
||||||
|
return m_widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlackBerrySetupPage::apply()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlackBerrySetupPage::finish()
|
||||||
|
{
|
||||||
|
delete m_widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qnx
|
59
src/plugins/qnx/blackberrysetuppage.h
Normal file
59
src/plugins/qnx/blackberrysetuppage.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
|
||||||
|
**
|
||||||
|
** Contact: BlackBerry (qt@blackberry.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 BLACKBERRYSETUPPAGE_H
|
||||||
|
#define BLACKBERRYSETUPPAGE_H
|
||||||
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
|
namespace Qnx {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class BlackBerrySetupWidget;
|
||||||
|
|
||||||
|
class BlackBerrySetupPage : public Core::IOptionsPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit BlackBerrySetupPage(QObject *parent = 0);
|
||||||
|
QWidget *widget();
|
||||||
|
void apply();
|
||||||
|
void finish();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPointer<BlackBerrySetupWidget> m_widget;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qnx
|
||||||
|
|
||||||
|
#endif // BLACKBERRYSETUPPAGE_H
|
332
src/plugins/qnx/blackberrysetupwidget.cpp
Normal file
332
src/plugins/qnx/blackberrysetupwidget.cpp
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
|
||||||
|
**
|
||||||
|
** Contact: BlackBerry (qt@blackberry.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 "blackberrysetupwidget.h"
|
||||||
|
|
||||||
|
#include "blackberryconfigurationmanager.h"
|
||||||
|
#include "blackberryconfiguration.h"
|
||||||
|
#include "blackberrysigningutils.h"
|
||||||
|
#include "blackberrydeviceconfigurationwizard.h"
|
||||||
|
#include "blackberryinstallwizard.h"
|
||||||
|
#include "blackberrycertificate.h"
|
||||||
|
#include "qnxconstants.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QWizard>
|
||||||
|
#include <QUrl>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
namespace Qnx {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
SetupItem::SetupItem(const QString &desc, QWidget *parent)
|
||||||
|
: QFrame(parent)
|
||||||
|
{
|
||||||
|
m_timer.setSingleShot(true);
|
||||||
|
connect(&m_timer, SIGNAL(timeout()), this, SLOT(validate()));
|
||||||
|
|
||||||
|
setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
|
||||||
|
QVBoxLayout *frameLayout = new QVBoxLayout(this);
|
||||||
|
|
||||||
|
QHBoxLayout *childLayout = new QHBoxLayout;
|
||||||
|
frameLayout->addLayout(childLayout);
|
||||||
|
|
||||||
|
m_icon = new QLabel;
|
||||||
|
childLayout->addWidget(m_icon);
|
||||||
|
|
||||||
|
m_label = new QLabel;
|
||||||
|
m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
childLayout->addWidget(m_label);
|
||||||
|
|
||||||
|
m_button = new QPushButton;
|
||||||
|
childLayout->addWidget(m_button);
|
||||||
|
QObject::connect(m_button, SIGNAL(clicked()), this, SLOT(onFixPressed()));
|
||||||
|
|
||||||
|
if (!desc.isEmpty()) {
|
||||||
|
m_desc = new QLabel(desc);
|
||||||
|
m_desc->setWordWrap(true);
|
||||||
|
QFont font = m_desc->font();
|
||||||
|
font.setItalic(true);
|
||||||
|
m_desc->setFont(font);
|
||||||
|
frameLayout->addWidget(m_desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupItem::set(Status status, const QString &message, const QString &fixText)
|
||||||
|
{
|
||||||
|
const char *icon;
|
||||||
|
switch (status) {
|
||||||
|
case Ok:
|
||||||
|
icon = Qnx::Constants::QNX_OK_ICON;
|
||||||
|
break;
|
||||||
|
case Info:
|
||||||
|
icon = Qnx::Constants::QNX_INFO_ICON;
|
||||||
|
break;
|
||||||
|
case Warning:
|
||||||
|
icon = Qnx::Constants::QNX_WARNING_ICON;
|
||||||
|
break;
|
||||||
|
case Error:
|
||||||
|
icon = Qnx::Constants::QNX_ERROR_ICON;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_icon->setPixmap(QPixmap(QLatin1String(icon)));
|
||||||
|
m_label->setText(message);
|
||||||
|
m_button->setVisible(!fixText.isEmpty());
|
||||||
|
m_button->setText(fixText);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupItem::onFixPressed()
|
||||||
|
{
|
||||||
|
fix();
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupItem::validateLater()
|
||||||
|
{
|
||||||
|
// BlackBerryConfigurationManager.settingsChanged and DeviceManager.updated signals
|
||||||
|
// may be emitted multiple times during the same event handling. This would result in multiple
|
||||||
|
// validation() calls even through just one is needed.
|
||||||
|
// QTimer allows to merge those multiple signal emits into a single validate() call.
|
||||||
|
m_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
APILevelSetupItem::APILevelSetupItem(QWidget *parent)
|
||||||
|
: SetupItem(tr("API Level defines kits, Qt versions, compilers, debuggers needed"
|
||||||
|
" for building BlackBerry applications."), parent)
|
||||||
|
{
|
||||||
|
validate();
|
||||||
|
connect(&BlackBerryConfigurationManager::instance(), SIGNAL(settingsChanged()),
|
||||||
|
this, SLOT(validateLater()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void APILevelSetupItem::validate()
|
||||||
|
{
|
||||||
|
FoundTypes found = resolvedFoundType();
|
||||||
|
if (!found.testFlag(Any))
|
||||||
|
set(Error, tr("No API Level is installed."), tr("Install"));
|
||||||
|
else if (!found.testFlag(Valid))
|
||||||
|
set(Error, tr("No valid API Level is installed."), tr("Install"));
|
||||||
|
else if (!found.testFlag(Active))
|
||||||
|
set(Error, tr("Valid API Level is not activated."), tr("Activate"));
|
||||||
|
else if (!found.testFlag(V_10_2))
|
||||||
|
set(Warning, tr("Valid API Level 10.2 or newer is not installed."), tr("Install"));
|
||||||
|
else if (!found.testFlag(V_10_2_AS_DEFAULT))
|
||||||
|
set(Warning, tr("Valid API Level 10.2 or newer is not set as default."), tr("Set"));
|
||||||
|
else
|
||||||
|
set(Ok, tr("API Level is configured."));
|
||||||
|
// TODO: should we check something more e.g. BB10 kits are valid?
|
||||||
|
}
|
||||||
|
|
||||||
|
void APILevelSetupItem::fix()
|
||||||
|
{
|
||||||
|
FoundTypes found = resolvedFoundType();
|
||||||
|
if (!found.testFlag(Any) || !found.testFlag(Valid)) {
|
||||||
|
installAPILevel();
|
||||||
|
} else if (!found.testFlag(Active)) {
|
||||||
|
foreach (BlackBerryConfiguration *config,
|
||||||
|
BlackBerryConfigurationManager::instance().configurations()) {
|
||||||
|
if (config->isValid() && !config->isActive()) {
|
||||||
|
config->activate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!found.testFlag(V_10_2)) {
|
||||||
|
// TODO: install filter for 10.2 only
|
||||||
|
installAPILevel();
|
||||||
|
} else if (!found.testFlag(V_10_2_AS_DEFAULT)) {
|
||||||
|
BlackBerryConfigurationManager::instance().setDefaultConfiguration(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
APILevelSetupItem::FoundTypes APILevelSetupItem::resolvedFoundType()
|
||||||
|
{
|
||||||
|
FoundTypes found;
|
||||||
|
|
||||||
|
// TODO: for now, all Trunk versions are understood as 10.2 compliant
|
||||||
|
BlackBerryVersionNumber version_10_2(QLatin1String("10.2.0.0"));
|
||||||
|
foreach (BlackBerryConfiguration *config,
|
||||||
|
BlackBerryConfigurationManager::instance().configurations()) {
|
||||||
|
found |= Any;
|
||||||
|
if (config->isValid()) {
|
||||||
|
found |= Valid;
|
||||||
|
if (config->isActive())
|
||||||
|
found |= Active;
|
||||||
|
if (config->version() > version_10_2)
|
||||||
|
found |= V_10_2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BlackBerryConfiguration *config = BlackBerryConfigurationManager::instance().defaultConfiguration();
|
||||||
|
if (config && config->version() > version_10_2)
|
||||||
|
found |= V_10_2_AS_DEFAULT;
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
void APILevelSetupItem::installAPILevel()
|
||||||
|
{
|
||||||
|
BlackBerryInstallWizard wizard(
|
||||||
|
BlackBerryInstallerDataHandler::InstallMode,
|
||||||
|
BlackBerryInstallerDataHandler::ApiLevel, QString(), this);
|
||||||
|
connect(&wizard, SIGNAL(processFinished()), this, SLOT(handleInstallationFinished()));
|
||||||
|
wizard.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void APILevelSetupItem::handleInstallationFinished()
|
||||||
|
{
|
||||||
|
// manually-added API Levels are automatically registered by BlackBerryInstallWizard
|
||||||
|
// auto-detected API Levels needs to reloaded explicitly
|
||||||
|
BlackBerryConfigurationManager::instance().loadAutoDetectedConfigurations();
|
||||||
|
validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
SigningKeysSetupItem::SigningKeysSetupItem(QWidget *parent)
|
||||||
|
: SetupItem(tr("Signing keys are needed for signing BlackBerry applications"
|
||||||
|
" and managing debug tokens."), parent)
|
||||||
|
{
|
||||||
|
validate();
|
||||||
|
connect(&BlackBerrySigningUtils::instance(), SIGNAL(defaultCertificateLoaded(int)),
|
||||||
|
this, SLOT(validate()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SigningKeysSetupItem::validate()
|
||||||
|
{
|
||||||
|
BlackBerrySigningUtils &utils = BlackBerrySigningUtils::instance();
|
||||||
|
if (utils.hasLegacyKeys())
|
||||||
|
set(Error, tr("Found legacy BlackBerry signing keys."), tr("Update"));
|
||||||
|
else if (!utils.hasRegisteredKeys())
|
||||||
|
set(Error, tr("Cannot find BlackBerry signing keys."), tr("Request"));
|
||||||
|
else if (!QFileInfo(BlackBerryConfigurationManager::instance().defaultKeystorePath()).exists())
|
||||||
|
set(Error, tr("Cannot find developer certificate."), tr("Create"));
|
||||||
|
else if (utils.defaultCertificateOpeningStatus() != BlackBerrySigningUtils::Opened)
|
||||||
|
set(Info, tr("Developer certificate is not opened."), tr("Open"));
|
||||||
|
else
|
||||||
|
set(Ok, tr("Signing keys are ready to use."));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SigningKeysSetupItem::fix()
|
||||||
|
{
|
||||||
|
BlackBerrySigningUtils &utils = BlackBerrySigningUtils::instance();
|
||||||
|
if (utils.hasLegacyKeys()) {
|
||||||
|
QDesktopServices::openUrl(QUrl(QLatin1String(Qnx::Constants::QNX_LEGACY_KEYS_URL)));
|
||||||
|
} else if (!utils.hasRegisteredKeys()) {
|
||||||
|
QDesktopServices::openUrl(QUrl(QLatin1String(Qnx::Constants::QNX_REGISTER_KEYS_URL)));
|
||||||
|
} else if (!QFileInfo(BlackBerryConfigurationManager::instance().defaultKeystorePath()).exists()) {
|
||||||
|
set(Info, tr("Opening certificate..."));
|
||||||
|
utils.createCertificate();
|
||||||
|
} else if (utils.defaultCertificateOpeningStatus() != BlackBerrySigningUtils::Opened) {
|
||||||
|
connect(&utils, SIGNAL(defaultCertificateLoaded(int)), this, SLOT(defaultCertificateLoaded(int)));
|
||||||
|
utils.openDefaultCertificate(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SigningKeysSetupItem::defaultCertificateLoaded(int status)
|
||||||
|
{
|
||||||
|
BlackBerrySigningUtils &utils = BlackBerrySigningUtils::instance();
|
||||||
|
disconnect(&utils, SIGNAL(defaultCertificateLoaded(int)), this, SLOT(defaultCertificateLoaded(int)));
|
||||||
|
switch (status) {
|
||||||
|
case BlackBerryCertificate::Success:
|
||||||
|
// handled by the connect in ctor already
|
||||||
|
break;
|
||||||
|
case BlackBerryCertificate::WrongPassword:
|
||||||
|
QMessageBox::critical(this, tr("Qt Creator"), tr("Invalid certificate password."));
|
||||||
|
break;
|
||||||
|
case BlackBerryCertificate::Busy:
|
||||||
|
case BlackBerryCertificate::InvalidOutputFormat:
|
||||||
|
case BlackBerryCertificate::Error:
|
||||||
|
QMessageBox::critical(this, tr("Qt Creator"), tr("Error loading certificate."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceSetupItem::DeviceSetupItem(QWidget *parent)
|
||||||
|
: SetupItem(tr("BlackBerry 10 device or simulator is needed for running BlackBerry applications."),
|
||||||
|
parent)
|
||||||
|
{
|
||||||
|
validate();
|
||||||
|
connect(ProjectExplorer::DeviceManager::instance(), SIGNAL(updated()),
|
||||||
|
this, SLOT(validateLater()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceSetupItem::validate()
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
ProjectExplorer::DeviceManager *manager = ProjectExplorer::DeviceManager::instance();
|
||||||
|
for (int i = 0; i < manager->deviceCount(); i ++) {
|
||||||
|
ProjectExplorer::IDevice::ConstPtr device = manager->deviceAt(i);
|
||||||
|
if (device->type() == Constants::QNX_BB_OS_TYPE) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
set(Error, tr("No BlackBerry 10 device or simulator is registered."), tr("Add"));
|
||||||
|
else
|
||||||
|
set(Ok, tr("BlackBerry 10 device or simulator is registered."));
|
||||||
|
// TODO: check for existence of an API Level matching a device?
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceSetupItem::fix()
|
||||||
|
{
|
||||||
|
BlackBerryDeviceConfigurationWizard wizard(this);
|
||||||
|
if (wizard.exec() == QDialog::Accepted)
|
||||||
|
ProjectExplorer::DeviceManager::instance()->addDevice(wizard.device());
|
||||||
|
}
|
||||||
|
|
||||||
|
BlackBerrySetupWidget::BlackBerrySetupWidget(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
layout->addWidget(new APILevelSetupItem);
|
||||||
|
layout->addWidget(new SigningKeysSetupItem);
|
||||||
|
layout->addWidget(new DeviceSetupItem);
|
||||||
|
|
||||||
|
layout->addStretch();
|
||||||
|
|
||||||
|
QLabel *howTo = new QLabel;
|
||||||
|
howTo->setTextFormat(Qt::RichText);
|
||||||
|
howTo->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
|
howTo->setOpenExternalLinks(true);
|
||||||
|
howTo->setText(tr("<a href=\"%1\">How to Setup Qt Creator for BlackBerry 10 development</a>")
|
||||||
|
.arg(QLatin1String(Qnx::Constants::QNX_BLACKBERRY_SETUP_URL)));
|
||||||
|
layout->addWidget(howTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qnx
|
143
src/plugins/qnx/blackberrysetupwidget.h
Normal file
143
src/plugins/qnx/blackberrysetupwidget.h
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
|
||||||
|
**
|
||||||
|
** Contact: BlackBerry (qt@blackberry.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 BLACKBERRYSETUPWIDGET_H
|
||||||
|
#define BLACKBERRYSETUPWIDGET_H
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QLabel;
|
||||||
|
class QPushButton;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Qnx {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
|
||||||
|
class SetupItem : public QFrame {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum Status {
|
||||||
|
Ok, Info, Warning, Error
|
||||||
|
};
|
||||||
|
|
||||||
|
SetupItem(const QString &desc = QString(), QWidget *parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void set(Status status, const QString &message, const QString &fixText = QString());
|
||||||
|
Q_SLOT virtual void validate() = 0;
|
||||||
|
virtual void fix() = 0;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onFixPressed();
|
||||||
|
void validateLater();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QLabel *m_icon;
|
||||||
|
QLabel *m_label;
|
||||||
|
QPushButton *m_button;
|
||||||
|
QLabel *m_desc;
|
||||||
|
QTimer m_timer;
|
||||||
|
};
|
||||||
|
|
||||||
|
class APILevelSetupItem : public SetupItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
APILevelSetupItem(QWidget *parent = 0);
|
||||||
|
|
||||||
|
enum FoundType {
|
||||||
|
Any = (1 << 0),
|
||||||
|
Valid = (1 << 1),
|
||||||
|
Active = (1 << 2),
|
||||||
|
V_10_2 = (1 << 3),
|
||||||
|
V_10_2_AS_DEFAULT = (1 << 4)
|
||||||
|
};
|
||||||
|
Q_DECLARE_FLAGS(FoundTypes, FoundType)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void validate();
|
||||||
|
virtual void fix();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleInstallationFinished();
|
||||||
|
|
||||||
|
private:
|
||||||
|
FoundTypes resolvedFoundType();
|
||||||
|
void installAPILevel();
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(APILevelSetupItem::FoundTypes)
|
||||||
|
|
||||||
|
class SigningKeysSetupItem : public SetupItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
SigningKeysSetupItem(QWidget *parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void validate();
|
||||||
|
virtual void fix();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void defaultCertificateLoaded(int status);
|
||||||
|
};
|
||||||
|
|
||||||
|
class DeviceSetupItem : public SetupItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
DeviceSetupItem(QWidget *parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void validate();
|
||||||
|
virtual void fix();
|
||||||
|
};
|
||||||
|
|
||||||
|
class BlackBerrySetupWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit BlackBerrySetupWidget(QWidget *parent = 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespeace Qnx
|
||||||
|
|
||||||
|
#endif // BLACKBERRYSETUPWIDGET_H
|
@@ -33,10 +33,12 @@
|
|||||||
#include "blackberrycertificate.h"
|
#include "blackberrycertificate.h"
|
||||||
#include "blackberryconfiguration.h"
|
#include "blackberryconfiguration.h"
|
||||||
#include "blackberryconfigurationmanager.h"
|
#include "blackberryconfigurationmanager.h"
|
||||||
|
#include "blackberrycreatecertificatedialog.h"
|
||||||
#include "blackberrydebugtokenreader.h"
|
#include "blackberrydebugtokenreader.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@@ -59,7 +61,8 @@ BlackBerrySigningUtils & BlackBerrySigningUtils::instance()
|
|||||||
|
|
||||||
BlackBerrySigningUtils::BlackBerrySigningUtils(QObject *parent) :
|
BlackBerrySigningUtils::BlackBerrySigningUtils(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_defaultCertificate(0)
|
m_defaultCertificate(0),
|
||||||
|
m_defaultCertificateStatus(NotOpened)
|
||||||
{
|
{
|
||||||
loadDebugTokens();
|
loadDebugTokens();
|
||||||
}
|
}
|
||||||
@@ -118,22 +121,37 @@ const BlackBerryCertificate * BlackBerrySigningUtils::defaultCertificate() const
|
|||||||
return m_defaultCertificate;
|
return m_defaultCertificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlackBerrySigningUtils::Status BlackBerrySigningUtils::defaultCertificateOpeningStatus() const
|
||||||
|
{
|
||||||
|
return m_defaultCertificateStatus;
|
||||||
|
}
|
||||||
|
|
||||||
void BlackBerrySigningUtils::openDefaultCertificate(QWidget *passwordPromptParent)
|
void BlackBerrySigningUtils::openDefaultCertificate(QWidget *passwordPromptParent)
|
||||||
{
|
{
|
||||||
if (m_defaultCertificate) {
|
switch (m_defaultCertificateStatus) {
|
||||||
|
case Opening:
|
||||||
|
return;
|
||||||
|
case Opened:
|
||||||
emit defaultCertificateLoaded(BlackBerryCertificate::Success);
|
emit defaultCertificateLoaded(BlackBerryCertificate::Success);
|
||||||
return;
|
return;
|
||||||
|
default:
|
||||||
|
m_defaultCertificateStatus = Opening;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
const QString password = certificatePassword(passwordPromptParent, &ok);
|
const QString password = certificatePassword(passwordPromptParent, &ok);
|
||||||
|
|
||||||
// action has been canceled
|
// action has been canceled
|
||||||
if (!ok)
|
if (!ok) {
|
||||||
|
m_defaultCertificateStatus = NotOpened;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BlackBerryConfigurationManager &configManager = BlackBerryConfigurationManager::instance();
|
BlackBerryConfigurationManager &configManager = BlackBerryConfigurationManager::instance();
|
||||||
|
|
||||||
|
if (m_defaultCertificate)
|
||||||
|
m_defaultCertificate->deleteLater();
|
||||||
|
|
||||||
m_defaultCertificate = new BlackBerryCertificate(configManager.defaultKeystorePath(),
|
m_defaultCertificate = new BlackBerryCertificate(configManager.defaultKeystorePath(),
|
||||||
QString(), password, this);
|
QString(), password, this);
|
||||||
|
|
||||||
@@ -149,6 +167,7 @@ void BlackBerrySigningUtils::setDefaultCertificate(BlackBerryCertificate *certif
|
|||||||
|
|
||||||
certificate->setParent(this);
|
certificate->setParent(this);
|
||||||
m_defaultCertificate = certificate;
|
m_defaultCertificate = certificate;
|
||||||
|
m_defaultCertificateStatus = Opened;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlackBerrySigningUtils::clearCskPassword()
|
void BlackBerrySigningUtils::clearCskPassword()
|
||||||
@@ -166,6 +185,7 @@ void BlackBerrySigningUtils::deleteDefaultCertificate()
|
|||||||
clearCertificatePassword();
|
clearCertificatePassword();
|
||||||
m_defaultCertificate->deleteLater();
|
m_defaultCertificate->deleteLater();
|
||||||
m_defaultCertificate = 0;
|
m_defaultCertificate = 0;
|
||||||
|
m_defaultCertificateStatus = NotOpened;
|
||||||
|
|
||||||
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
|
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
|
||||||
|
|
||||||
@@ -192,15 +212,36 @@ void BlackBerrySigningUtils::removeDebugToken(const QString &dt)
|
|||||||
emit debugTokenListChanged();
|
emit debugTokenListChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BlackBerrySigningUtils::createCertificate()
|
||||||
|
{
|
||||||
|
BlackBerryCreateCertificateDialog dialog;
|
||||||
|
|
||||||
|
const int result = dialog.exec();
|
||||||
|
|
||||||
|
if (result == QDialog::Rejected)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
BlackBerryCertificate *certificate = dialog.certificate();
|
||||||
|
|
||||||
|
if (certificate)
|
||||||
|
setDefaultCertificate(certificate);
|
||||||
|
|
||||||
|
return certificate;
|
||||||
|
}
|
||||||
|
|
||||||
void BlackBerrySigningUtils::certificateLoaded(int status)
|
void BlackBerrySigningUtils::certificateLoaded(int status)
|
||||||
{
|
{
|
||||||
if (status != BlackBerryCertificate::Success) {
|
if (status != BlackBerryCertificate::Success) {
|
||||||
|
m_defaultCertificateStatus = NotOpened;
|
||||||
m_defaultCertificate->deleteLater();
|
m_defaultCertificate->deleteLater();
|
||||||
m_defaultCertificate = 0;
|
m_defaultCertificate = 0;
|
||||||
|
|
||||||
if (status == BlackBerryCertificate::WrongPassword)
|
// we have clear the password under any error since we are not able to distinquish
|
||||||
clearCertificatePassword();
|
// if password is correct or not in case BlackBerryCertificate::Error status happens
|
||||||
}
|
clearCertificatePassword();
|
||||||
|
} else
|
||||||
|
m_defaultCertificateStatus = Opened;
|
||||||
|
|
||||||
|
|
||||||
emit defaultCertificateLoaded(status);
|
emit defaultCertificateLoaded(status);
|
||||||
}
|
}
|
||||||
|
@@ -50,6 +50,12 @@ class BlackBerrySigningUtils : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum Status {
|
||||||
|
NotOpened,
|
||||||
|
Opening,
|
||||||
|
Opened
|
||||||
|
};
|
||||||
|
|
||||||
static BlackBerrySigningUtils &instance();
|
static BlackBerrySigningUtils &instance();
|
||||||
|
|
||||||
bool hasRegisteredKeys();
|
bool hasRegisteredKeys();
|
||||||
@@ -60,12 +66,14 @@ public:
|
|||||||
QString certificatePassword(QWidget *passwordPromptParent = 0, bool *ok = 0);
|
QString certificatePassword(QWidget *passwordPromptParent = 0, bool *ok = 0);
|
||||||
|
|
||||||
const BlackBerryCertificate *defaultCertificate() const;
|
const BlackBerryCertificate *defaultCertificate() const;
|
||||||
|
Status defaultCertificateOpeningStatus() const;
|
||||||
|
|
||||||
void openDefaultCertificate(QWidget *passwordPromptParent = 0);
|
void openDefaultCertificate(QWidget *passwordPromptParent = 0);
|
||||||
void setDefaultCertificate(BlackBerryCertificate *certificate);
|
void setDefaultCertificate(BlackBerryCertificate *certificate);
|
||||||
void clearCskPassword();
|
void clearCskPassword();
|
||||||
void clearCertificatePassword();
|
void clearCertificatePassword();
|
||||||
void deleteDefaultCertificate();
|
void deleteDefaultCertificate();
|
||||||
|
bool createCertificate();
|
||||||
void addDebugToken(const QString &dt);
|
void addDebugToken(const QString &dt);
|
||||||
void removeDebugToken(const QString &dt);
|
void removeDebugToken(const QString &dt);
|
||||||
|
|
||||||
@@ -90,6 +98,7 @@ private:
|
|||||||
QString promptPassword(const QString &message, QWidget *dialogParent = 0, bool *ok = 0) const;
|
QString promptPassword(const QString &message, QWidget *dialogParent = 0, bool *ok = 0) const;
|
||||||
|
|
||||||
BlackBerryCertificate *m_defaultCertificate;
|
BlackBerryCertificate *m_defaultCertificate;
|
||||||
|
Status m_defaultCertificateStatus;
|
||||||
|
|
||||||
QString m_cskPassword;
|
QString m_cskPassword;
|
||||||
QString m_certificatePassword;
|
QString m_certificatePassword;
|
||||||
|
BIN
src/plugins/qnx/images/error.png
Normal file
BIN
src/plugins/qnx/images/error.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 627 B |
BIN
src/plugins/qnx/images/info.png
Normal file
BIN
src/plugins/qnx/images/info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 630 B |
BIN
src/plugins/qnx/images/ok.png
Normal file
BIN
src/plugins/qnx/images/ok.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 220 B |
BIN
src/plugins/qnx/images/warning.png
Normal file
BIN
src/plugins/qnx/images/warning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 743 B |
@@ -102,7 +102,9 @@ SOURCES += qnxplugin.cpp \
|
|||||||
blackberrycheckdevicestatusstep.cpp \
|
blackberrycheckdevicestatusstep.cpp \
|
||||||
qnxattachdebugsupport.cpp \
|
qnxattachdebugsupport.cpp \
|
||||||
qnxattachdebugdialog.cpp \
|
qnxattachdebugdialog.cpp \
|
||||||
blackberrydeployqtlibrariesdialog.cpp
|
blackberrydeployqtlibrariesdialog.cpp \
|
||||||
|
blackberrysetuppage.cpp \
|
||||||
|
blackberrysetupwidget.cpp
|
||||||
|
|
||||||
HEADERS += qnxplugin.h\
|
HEADERS += qnxplugin.h\
|
||||||
qnxconstants.h \
|
qnxconstants.h \
|
||||||
@@ -204,7 +206,9 @@ HEADERS += qnxplugin.h\
|
|||||||
blackberrycheckdevicestatusstepconfigwidget.h \
|
blackberrycheckdevicestatusstepconfigwidget.h \
|
||||||
qnxattachdebugsupport.h \
|
qnxattachdebugsupport.h \
|
||||||
qnxattachdebugdialog.h \
|
qnxattachdebugdialog.h \
|
||||||
blackberrydeployqtlibrariesdialog.h
|
blackberrydeployqtlibrariesdialog.h \
|
||||||
|
blackberrysetuppage.h \
|
||||||
|
blackberrysetupwidget.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
blackberrydeviceconfigurationwizardsetuppage.ui \
|
blackberrydeviceconfigurationwizardsetuppage.ui \
|
||||||
|
@@ -147,6 +147,10 @@ QtcPlugin {
|
|||||||
"blackberryruncontrol.h",
|
"blackberryruncontrol.h",
|
||||||
"blackberryruncontrolfactory.cpp",
|
"blackberryruncontrolfactory.cpp",
|
||||||
"blackberryruncontrolfactory.h",
|
"blackberryruncontrolfactory.h",
|
||||||
|
"blackberrysetuppage.cpp",
|
||||||
|
"blackberrysetuppage.h",
|
||||||
|
"blackberrysetupwidget.cpp",
|
||||||
|
"blackberrysetupwidget.h",
|
||||||
"blackberrysigningpasswordsdialog.h",
|
"blackberrysigningpasswordsdialog.h",
|
||||||
"blackberrysigningpasswordsdialog.cpp",
|
"blackberrysigningpasswordsdialog.cpp",
|
||||||
"blackberrysigningpasswordsdialog.ui",
|
"blackberrysigningpasswordsdialog.ui",
|
||||||
|
@@ -2,5 +2,9 @@
|
|||||||
<qresource prefix="/qnx">
|
<qresource prefix="/qnx">
|
||||||
<file>images/target-small.png</file>
|
<file>images/target-small.png</file>
|
||||||
<file>images/target.png</file>
|
<file>images/target.png</file>
|
||||||
|
<file>images/ok.png</file>
|
||||||
|
<file>images/info.png</file>
|
||||||
|
<file>images/warning.png</file>
|
||||||
|
<file>images/error.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -96,6 +96,7 @@ const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain";
|
|||||||
const char QNX_BB_CATEGORY[] = "XF.BlackBerry";
|
const char QNX_BB_CATEGORY[] = "XF.BlackBerry";
|
||||||
const char QNX_BB_CATEGORY_TR[] = QT_TRANSLATE_NOOP("BlackBerry", "BlackBerry");
|
const char QNX_BB_CATEGORY_TR[] = QT_TRANSLATE_NOOP("BlackBerry", "BlackBerry");
|
||||||
const char QNX_BB_CATEGORY_ICON[] = ":/qnx/images/target.png";
|
const char QNX_BB_CATEGORY_ICON[] = ":/qnx/images/target.png";
|
||||||
|
const char QNX_BB_SETUP_ID[] = "ZA.BlackBerry Setup";
|
||||||
const char QNX_BB_NDK_SETTINGS_ID[] = "ZZ.BlackBerry NDK Configuration";
|
const char QNX_BB_NDK_SETTINGS_ID[] = "ZZ.BlackBerry NDK Configuration";
|
||||||
const char QNX_BB_SIGNING_ID[] = "ZZ.BlackBerry Signing Infrastructure Configuration";
|
const char QNX_BB_SIGNING_ID[] = "ZZ.BlackBerry Signing Infrastructure Configuration";
|
||||||
|
|
||||||
@@ -119,6 +120,16 @@ const char QNX_DEBUGGING_GROUP[] = "Debugger.Group.Qnx";
|
|||||||
|
|
||||||
const char QNX_BLACKBERRY_DEFAULT_DEPLOY_QT_BASEPATH[] = "/accounts/devuser/";
|
const char QNX_BLACKBERRY_DEFAULT_DEPLOY_QT_BASEPATH[] = "/accounts/devuser/";
|
||||||
|
|
||||||
|
const char QNX_OK_ICON[] = ":/qnx/images/ok.png";
|
||||||
|
const char QNX_INFO_ICON[] = ":/qnx/images/info.png";
|
||||||
|
const char QNX_WARNING_ICON[] = ":/qnx/images/warning.png";
|
||||||
|
const char QNX_ERROR_ICON[] = ":/qnx/images/error.png";
|
||||||
|
|
||||||
|
const char QNX_BLACKBERRY_SETUP_URL[] = "http://qt-project.org/wiki/Qt-Creator-with-BlackBerry-10";
|
||||||
|
const char QNX_LEGACY_KEYS_URL[] = "https://developer.blackberry.com/native/documentation/core"
|
||||||
|
"/com.qnx.doc.native_sdk.devguide/topic/bbid_to_sa.html";
|
||||||
|
const char QNX_REGISTER_KEYS_URL[] = "https://www.blackberry.com/SignedKeys/codesigning.html";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace Qnx
|
} // namespace Qnx
|
||||||
|
|
||||||
|
@@ -46,6 +46,7 @@
|
|||||||
#include "qnxdeployconfigurationfactory.h"
|
#include "qnxdeployconfigurationfactory.h"
|
||||||
#include "qnxrunconfigurationfactory.h"
|
#include "qnxrunconfigurationfactory.h"
|
||||||
#include "qnxqtversionfactory.h"
|
#include "qnxqtversionfactory.h"
|
||||||
|
#include "blackberrysetuppage.h"
|
||||||
#include "blackberryndksettingspage.h"
|
#include "blackberryndksettingspage.h"
|
||||||
#include "bardescriptoreditorfactory.h"
|
#include "bardescriptoreditorfactory.h"
|
||||||
#include "bardescriptormagicmatcher.h"
|
#include "bardescriptormagicmatcher.h"
|
||||||
@@ -98,6 +99,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
|
|||||||
addAutoReleasedObject(new BlackBerryDeployStepFactory);
|
addAutoReleasedObject(new BlackBerryDeployStepFactory);
|
||||||
addAutoReleasedObject(new BlackBerryRunConfigurationFactory);
|
addAutoReleasedObject(new BlackBerryRunConfigurationFactory);
|
||||||
addAutoReleasedObject(new BlackBerryRunControlFactory);
|
addAutoReleasedObject(new BlackBerryRunControlFactory);
|
||||||
|
addAutoReleasedObject(new BlackBerrySetupPage);
|
||||||
addAutoReleasedObject(new BlackBerryNDKSettingsPage);
|
addAutoReleasedObject(new BlackBerryNDKSettingsPage);
|
||||||
addAutoReleasedObject(new BlackBerryKeysPage);
|
addAutoReleasedObject(new BlackBerryKeysPage);
|
||||||
addAutoReleasedObject(new BlackBerryCheckDeviceStatusStepFactory);
|
addAutoReleasedObject(new BlackBerryCheckDeviceStatusStepFactory);
|
||||||
|
Reference in New Issue
Block a user