forked from qt-creator/qt-creator
Initial implementation of BB key management
Change-Id: Iba9c264b6c5809a0714da69591248fc2962c6526 Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
5686983e95
commit
41bdf34275
179
src/plugins/qnx/blackberrycertificate.cpp
Normal file
179
src/plugins/qnx/blackberrycertificate.cpp
Normal file
@@ -0,0 +1,179 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberrycertificate.h"
|
||||
#include "blackberryconfiguration.h"
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QProcess>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BlackBerryCertificate::BlackBerryCertificate(const QString &fileName,
|
||||
const QString &author, const QString &storePass, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_fileName(fileName),
|
||||
m_author(author),
|
||||
m_storePass(storePass),
|
||||
m_process(new QProcess(this))
|
||||
{
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::load()
|
||||
{
|
||||
if (m_process->state() != QProcess::NotRunning) {
|
||||
emit finished(BlackBerryCertificate::Busy);
|
||||
return;
|
||||
}
|
||||
QStringList arguments;
|
||||
|
||||
arguments << QLatin1String("-keystore")
|
||||
<< m_fileName
|
||||
<< QLatin1String("-list")
|
||||
<< QLatin1String("-verbose")
|
||||
<< QLatin1String("-storepass")
|
||||
<< m_storePass;
|
||||
|
||||
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(loadFinished()));
|
||||
connect(m_process, SIGNAL(error(QProcess::ProcessError)),
|
||||
this, SLOT(processError()));
|
||||
|
||||
m_process->start(command(), arguments);
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::store()
|
||||
{
|
||||
if (m_process->state() != QProcess::NotRunning) {
|
||||
emit finished(BlackBerryCertificate::Busy);
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(m_fileName);
|
||||
|
||||
if (file.exists())
|
||||
file.remove();
|
||||
|
||||
QStringList arguments;
|
||||
|
||||
arguments << QLatin1String("-genkeypair")
|
||||
<< QLatin1String("-storepass")
|
||||
<< m_storePass
|
||||
<< QLatin1String("-author")
|
||||
<< m_author
|
||||
<< QLatin1String("-keystore")
|
||||
<< m_fileName;
|
||||
|
||||
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(storeFinished(int)));
|
||||
connect(m_process, SIGNAL(error(QProcess::ProcessError)),
|
||||
this, SLOT(processError()));
|
||||
|
||||
m_process->start(command(), arguments);
|
||||
}
|
||||
|
||||
QString BlackBerryCertificate::fileName() const
|
||||
{
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
QString BlackBerryCertificate::author() const
|
||||
{
|
||||
return m_author;
|
||||
}
|
||||
|
||||
QString BlackBerryCertificate::id() const
|
||||
{
|
||||
QString tmpId = fileName();
|
||||
return tmpId.replace(QLatin1String("/"), QLatin1String("-"));
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::storeFinished(int status)
|
||||
{
|
||||
m_process->disconnect();
|
||||
|
||||
if (status == 0)
|
||||
emit finished(BlackBerryCertificate::Success);
|
||||
else
|
||||
emit finished(BlackBerryCertificate::Error);
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::loadFinished()
|
||||
{
|
||||
m_process->disconnect();
|
||||
|
||||
ResultCode status = Error;
|
||||
|
||||
QTextStream processOutput(m_process);
|
||||
|
||||
while (!processOutput.atEnd()) {
|
||||
QString chunk = processOutput.readLine();
|
||||
|
||||
if (chunk.contains(
|
||||
QLatin1String("Error: Failed to decrypt keystore, invalid password"))) {
|
||||
status = WrongPassword;
|
||||
break;
|
||||
} else if (chunk.startsWith(QLatin1String("Owner:"))) {
|
||||
chunk.remove(QLatin1String("Owner:"));
|
||||
m_author = chunk.remove(QLatin1String("CN=")).trimmed();
|
||||
status = Success;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
emit finished(status);
|
||||
}
|
||||
|
||||
void BlackBerryCertificate::processError()
|
||||
{
|
||||
m_process->disconnect();
|
||||
|
||||
emit finished(Error);
|
||||
}
|
||||
|
||||
QString BlackBerryCertificate::command() const
|
||||
{
|
||||
QString command = BlackBerryConfiguration::instance()
|
||||
.qnxEnv().value(QLatin1String("QNX_HOST"))
|
||||
+ QLatin1String("/usr/bin/blackberry-keytool");
|
||||
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
command += QLatin1String(".bat");
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
92
src/plugins/qnx/blackberrycertificate.h
Normal file
92
src/plugins/qnx/blackberrycertificate.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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_BLACKBERRYCERTIFICATE_H
|
||||
#define QNX_INTERNAL_BLACKBERRYCERTIFICATE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QProcess;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryCertificate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ResultCode {
|
||||
Success,
|
||||
Busy,
|
||||
WrongPassword,
|
||||
Error
|
||||
};
|
||||
|
||||
BlackBerryCertificate(const QString &fileName,
|
||||
const QString &author = QString(),
|
||||
const QString &storePass = QString(),
|
||||
QObject *parent = 0);
|
||||
|
||||
void load();
|
||||
void store();
|
||||
|
||||
QString fileName() const;
|
||||
QString author() const;
|
||||
QString id() const;
|
||||
|
||||
signals:
|
||||
void loaded();
|
||||
void stored();
|
||||
void finished(int status);
|
||||
|
||||
private slots:
|
||||
void storeFinished(int status);
|
||||
void loadFinished();
|
||||
void processError();
|
||||
|
||||
private:
|
||||
QString command() const;
|
||||
|
||||
QString m_fileName;
|
||||
QString m_author;
|
||||
QString m_storePass;
|
||||
|
||||
QProcess *m_process;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYCERTIFICATE_H
|
||||
206
src/plugins/qnx/blackberrycertificatemodel.cpp
Normal file
206
src/plugins/qnx/blackberrycertificatemodel.cpp
Normal file
@@ -0,0 +1,206 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberrycertificatemodel.h"
|
||||
#include "blackberrycertificate.h"
|
||||
#include "blackberryconfiguration.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
const QLatin1String SettingsGroup("BlackBerryConfiguration");
|
||||
const QLatin1String CertificateGroup("Certificates");
|
||||
|
||||
BlackBerryCertificateModel::BlackBerryCertificateModel(QObject *parent) :
|
||||
QAbstractTableModel(parent),
|
||||
m_activeCertificate(0)
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
BlackBerryCertificateModel::~BlackBerryCertificateModel()
|
||||
{
|
||||
}
|
||||
|
||||
int BlackBerryCertificateModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_certificates.count();
|
||||
}
|
||||
|
||||
int BlackBerryCertificateModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return ColumnCount;
|
||||
}
|
||||
|
||||
QVariant BlackBerryCertificateModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (index.row() >= rowCount() || index.column() >= columnCount())
|
||||
return QVariant();
|
||||
|
||||
const BlackBerryCertificate *cert = m_certificates.at(index.row());
|
||||
|
||||
if (role == Qt::CheckStateRole) {
|
||||
if (index.column() == CertActive)
|
||||
return (m_activeCertificate == cert) ? Qt::Checked : Qt::Unchecked;
|
||||
} else if (role == Qt::DisplayRole) {
|
||||
if (index.column() == CertPath)
|
||||
return cert->fileName();
|
||||
else if (index.column() == CertAuthor)
|
||||
return cert->author();
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant BlackBerryCertificateModel::headerData(int section,
|
||||
Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
if (orientation == Qt::Vertical)
|
||||
return section;
|
||||
|
||||
switch (section) {
|
||||
case CertPath:
|
||||
return tr("Path");
|
||||
case CertAuthor:
|
||||
return tr("Author");
|
||||
case CertActive:
|
||||
return tr("Active");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
bool BlackBerryCertificateModel::setData(const QModelIndex &ind,
|
||||
const QVariant &value, int role)
|
||||
{
|
||||
Q_UNUSED(value);
|
||||
|
||||
if (role == Qt::CheckStateRole && ind.column() == CertActive) {
|
||||
const int oldIndex = m_certificates.indexOf(m_activeCertificate);
|
||||
|
||||
m_activeCertificate = m_certificates.at(ind.row());
|
||||
|
||||
if (oldIndex >= 0)
|
||||
emit dataChanged(index(oldIndex, CertActive), index(oldIndex, CertActive));
|
||||
|
||||
emit dataChanged(ind, ind);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BlackBerryCertificateModel::removeRows(int row, int count,
|
||||
const QModelIndex &parent)
|
||||
{
|
||||
|
||||
beginRemoveRows(parent, row, row + count - 1);
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
BlackBerryCertificate *cert = m_certificates.takeAt(row);
|
||||
//XXX shall we also delete from disk?
|
||||
delete cert;
|
||||
}
|
||||
|
||||
endRemoveRows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Qt::ItemFlags BlackBerryCertificateModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
|
||||
switch (index.column()) {
|
||||
case CertActive:
|
||||
flags |= Qt::ItemIsUserCheckable;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
BlackBerryCertificate * BlackBerryCertificateModel::activeCertificate() const
|
||||
{
|
||||
return m_activeCertificate;
|
||||
}
|
||||
|
||||
QList<BlackBerryCertificate*> BlackBerryCertificateModel::certificates() const
|
||||
{
|
||||
return m_certificates;
|
||||
}
|
||||
|
||||
bool BlackBerryCertificateModel::insertCertificate(BlackBerryCertificate *certificate)
|
||||
{
|
||||
if (m_certificates.contains(certificate))
|
||||
return false;
|
||||
|
||||
beginInsertRows(QModelIndex(), m_certificates.count(), m_certificates.count());
|
||||
|
||||
if (m_certificates.isEmpty())
|
||||
m_activeCertificate = certificate;
|
||||
|
||||
certificate->setParent(this);
|
||||
m_certificates << certificate;
|
||||
|
||||
endInsertRows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlackBerryCertificateModel::load()
|
||||
{
|
||||
BlackBerryConfiguration &configuration = BlackBerryConfiguration::instance();
|
||||
m_certificates = configuration.certificates();
|
||||
m_activeCertificate = configuration.activeCertificate();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
89
src/plugins/qnx/blackberrycertificatemodel.h
Normal file
89
src/plugins/qnx/blackberrycertificatemodel.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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_BLACKBERRYCERTIFICATESTOREMODEL_H
|
||||
#define QNX_INTERNAL_BLACKBERRYCERTIFICATESTOREMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QList>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryCertificate;
|
||||
|
||||
class BlackBerryCertificateModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BlackBerryCertificateModel(QObject *parent = 0);
|
||||
~BlackBerryCertificateModel();
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
|
||||
QVariant data(const QModelIndex &index,
|
||||
int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const;
|
||||
|
||||
bool setData(const QModelIndex &index, const QVariant &value,
|
||||
int role = Qt::EditRole);
|
||||
bool removeRows(int row, int count,
|
||||
const QModelIndex &parent = QModelIndex());
|
||||
|
||||
bool insertCertificate(BlackBerryCertificate *certificate);
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
||||
BlackBerryCertificate *activeCertificate() const;
|
||||
QList<BlackBerryCertificate*> certificates() const;
|
||||
|
||||
private slots:
|
||||
void load();
|
||||
|
||||
private:
|
||||
enum Columns {
|
||||
CertPath,
|
||||
CertAuthor,
|
||||
CertActive,
|
||||
ColumnCount
|
||||
};
|
||||
|
||||
QList<BlackBerryCertificate*> m_certificates;
|
||||
BlackBerryCertificate *m_activeCertificate;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYCERTIFICATESTOREMODEL_H
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "blackberryconfiguration.h"
|
||||
#include "blackberryqtversion.h"
|
||||
#include "blackberrycertificate.h"
|
||||
#include "qnxutils.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -62,22 +63,29 @@ namespace Internal {
|
||||
namespace {
|
||||
const QLatin1String SettingsGroup("BlackBerryConfiguration");
|
||||
const QLatin1String NDKLocationKey("NDKLocation");
|
||||
const QLatin1String CertificateGroup("Certificates");
|
||||
}
|
||||
|
||||
BlackBerryConfiguration::BlackBerryConfiguration(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
loadSetting();
|
||||
connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSetting()));
|
||||
loadSettings();
|
||||
connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings()));
|
||||
}
|
||||
|
||||
bool BlackBerryConfiguration::setConfig(const QString &ndkPath)
|
||||
bool BlackBerryConfiguration::setNdkPath(const QString &ndkPath)
|
||||
{
|
||||
if (ndkPath.isEmpty())
|
||||
return false;
|
||||
|
||||
m_config.ndkPath = ndkPath;
|
||||
m_config.qnxEnv = QnxUtils::parseEnvironmentFile(QnxUtils::envFilePath(ndkPath));
|
||||
|
||||
return refresh();
|
||||
}
|
||||
|
||||
bool BlackBerryConfiguration::refresh()
|
||||
{
|
||||
m_config.qnxEnv = QnxUtils::parseEnvironmentFile(QnxUtils::envFilePath(m_config.ndkPath));
|
||||
|
||||
QString ndkTarget = m_config.qnxEnv.value(QLatin1String("QNX_TARGET"));
|
||||
QString sep = QString::fromLatin1("%1qnx6").arg(QDir::separator());
|
||||
@@ -120,12 +128,83 @@ bool BlackBerryConfiguration::setConfig(const QString &ndkPath)
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::setupConfiguration(const QString &ndkPath)
|
||||
void BlackBerryConfiguration::loadCertificates()
|
||||
{
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
|
||||
settings->beginGroup(SettingsGroup);
|
||||
settings->beginGroup(CertificateGroup);
|
||||
|
||||
foreach (QString certificateId, settings->childGroups()) {
|
||||
settings->beginGroup(certificateId);
|
||||
|
||||
BlackBerryCertificate *cert =
|
||||
new BlackBerryCertificate(settings->value(QLatin1String(Qnx::Constants::QNX_KEY_PATH)).toString(),
|
||||
settings->value(QLatin1String(Qnx::Constants::QNX_KEY_AUTHOR)).toString());
|
||||
cert->setParent(this);
|
||||
|
||||
if (settings->value(QLatin1String(Qnx::Constants::QNX_KEY_ACTIVE)).toBool())
|
||||
m_config.activeCertificate = cert;
|
||||
|
||||
m_config.certificates << cert;
|
||||
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
settings->endGroup();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::loadNdkSettings()
|
||||
{
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
|
||||
settings->beginGroup(SettingsGroup);
|
||||
setNdkPath(settings->value(NDKLocationKey).toString());
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::saveCertificates()
|
||||
{
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
|
||||
settings->beginGroup(SettingsGroup);
|
||||
settings->beginGroup(CertificateGroup);
|
||||
|
||||
settings->remove(QString());
|
||||
|
||||
foreach (const BlackBerryCertificate *cert, m_config.certificates) {
|
||||
settings->beginGroup(cert->id());
|
||||
settings->setValue(QLatin1String(Qnx::Constants::QNX_KEY_PATH), cert->fileName());
|
||||
settings->setValue(QLatin1String(Qnx::Constants::QNX_KEY_AUTHOR), cert->author());
|
||||
|
||||
if (cert == m_config.activeCertificate)
|
||||
settings->setValue(QLatin1String(Qnx::Constants::QNX_KEY_ACTIVE), true);
|
||||
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
settings->endGroup();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::saveNdkSettings()
|
||||
{
|
||||
if (m_config.ndkPath.isEmpty())
|
||||
return;
|
||||
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup(SettingsGroup);
|
||||
settings->setValue(NDKLocationKey, m_config.ndkPath);
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::setupNdkConfiguration(const QString &ndkPath)
|
||||
{
|
||||
if (ndkPath.isEmpty())
|
||||
return;
|
||||
|
||||
if (setConfig(ndkPath)) {
|
||||
if (setNdkPath(ndkPath)) {
|
||||
QtSupport::BaseQtVersion *qtVersion = createQtVersion();
|
||||
ProjectExplorer::GccToolChain *tc = createGccToolChain();
|
||||
ProjectExplorer::Kit *deviceKit = createKit(ArmLeV7, qtVersion, tc);
|
||||
@@ -143,7 +222,7 @@ void BlackBerryConfiguration::setupConfiguration(const QString &ndkPath)
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::cleanConfiguration()
|
||||
void BlackBerryConfiguration::cleanNdkConfiguration()
|
||||
{
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(m_config.qmakeBinaryFile);
|
||||
if (version) {
|
||||
@@ -161,10 +240,42 @@ void BlackBerryConfiguration::cleanConfiguration()
|
||||
}
|
||||
|
||||
BlackBerryConfig conf;
|
||||
conf.activeCertificate = m_config.activeCertificate;
|
||||
conf.certificates = m_config.certificates;
|
||||
m_config = conf;
|
||||
emit updated();
|
||||
|
||||
clearSetting();
|
||||
clearNdkSettings();
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::syncCertificates(QList<BlackBerryCertificate*> certificates,
|
||||
BlackBerryCertificate *activeCertificate)
|
||||
{
|
||||
m_config.activeCertificate = activeCertificate;
|
||||
|
||||
foreach (BlackBerryCertificate *cert, m_config.certificates) {
|
||||
if (!certificates.contains(cert)) {
|
||||
m_config.certificates.removeAll(cert);
|
||||
delete cert;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (BlackBerryCertificate *cert, certificates) {
|
||||
if (!m_config.certificates.contains(cert)) {
|
||||
cert->setParent(this);
|
||||
m_config.certificates << cert;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<BlackBerryCertificate*> BlackBerryConfiguration::certificates() const
|
||||
{
|
||||
return m_config.certificates;
|
||||
}
|
||||
|
||||
BlackBerryCertificate * BlackBerryConfiguration::activeCertificate()
|
||||
{
|
||||
return m_config.activeCertificate;
|
||||
}
|
||||
|
||||
QtSupport::BaseQtVersion *BlackBerryConfiguration::createQtVersion()
|
||||
@@ -252,26 +363,19 @@ ProjectExplorer::Kit *BlackBerryConfiguration::createKit(QnxArchitecture arch, Q
|
||||
return kit;
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::loadSetting()
|
||||
void BlackBerryConfiguration::loadSettings()
|
||||
{
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup(SettingsGroup);
|
||||
setConfig(settings->value(NDKLocationKey).toString());
|
||||
settings->endGroup();
|
||||
loadNdkSettings();
|
||||
loadCertificates();
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::saveSetting()
|
||||
void BlackBerryConfiguration::saveSettings()
|
||||
{
|
||||
if (m_config.ndkPath.isEmpty())
|
||||
return;
|
||||
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup(SettingsGroup);
|
||||
settings->setValue(NDKLocationKey, m_config.ndkPath);
|
||||
settings->endGroup();
|
||||
saveNdkSettings();
|
||||
saveCertificates();
|
||||
}
|
||||
|
||||
void BlackBerryConfiguration::clearSetting()
|
||||
void BlackBerryConfiguration::clearNdkSettings()
|
||||
{
|
||||
QSettings *settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup(SettingsGroup);
|
||||
@@ -326,6 +430,45 @@ Utils::FileName BlackBerryConfiguration::sysRoot() const
|
||||
return m_config.sysRoot;
|
||||
}
|
||||
|
||||
QString BlackBerryConfiguration::dataDirPath() const
|
||||
{
|
||||
const QString homeDir = QDir::homePath();
|
||||
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
return homeDir + QLatin1String("/Library/Research in Motion");
|
||||
|
||||
if (Utils::HostOsInfo::isAnyUnixHost())
|
||||
return homeDir + QLatin1String("/.rim");
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
// needed because QSysInfo::windowsVersion() is not available on other
|
||||
// platforms.
|
||||
if (QSysInfo::windowsVersion() == QSysInfo::WV_XP)
|
||||
return homeDir
|
||||
+ QLatin1String("/Local Settings/Application Data/Research In Motion");
|
||||
return homeDir + QLatin1String("/AppData/Local/Research in Motion");
|
||||
}
|
||||
#endif
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString BlackBerryConfiguration::barsignerCskPath() const
|
||||
{
|
||||
return dataDirPath() + QLatin1String("/barsigner.csk");
|
||||
}
|
||||
|
||||
QString BlackBerryConfiguration::barsignerDbPath() const
|
||||
{
|
||||
return dataDirPath() + QLatin1String("/barsigner.db");
|
||||
}
|
||||
|
||||
QString BlackBerryConfiguration::defaultKeystorePath() const
|
||||
{
|
||||
return dataDirPath() + QLatin1String("/author.p12");
|
||||
}
|
||||
|
||||
// TODO: QnxUtils::parseEnvFile() and qnxEnv() to return Util::Enviroment instead(?)
|
||||
QMultiMap<QString, QString> BlackBerryConfiguration::qnxEnv() const
|
||||
{
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryCertificate;
|
||||
|
||||
class BlackBerryConfig
|
||||
{
|
||||
QString ndkPath;
|
||||
@@ -58,6 +60,8 @@ class BlackBerryConfig
|
||||
Utils::FileName simulatorDebuger;
|
||||
Utils::FileName sysRoot;
|
||||
QMultiMap<QString, QString> qnxEnv;
|
||||
QList<BlackBerryCertificate*> certificates;
|
||||
BlackBerryCertificate *activeCertificate;
|
||||
|
||||
friend class BlackBerryConfiguration;
|
||||
};
|
||||
@@ -74,22 +78,36 @@ public:
|
||||
Utils::FileName simulatorGdbPath() const;
|
||||
Utils::FileName sysRoot() const;
|
||||
QMultiMap<QString, QString> qnxEnv() const;
|
||||
void setupConfiguration(const QString &ndkPath);
|
||||
void setupNdkConfiguration(const QString &ndkPath);
|
||||
QString ndkPath() const;
|
||||
QString targetName() const;
|
||||
void loadSetting();
|
||||
void clearSetting();
|
||||
void cleanConfiguration();
|
||||
QString barsignerCskPath() const;
|
||||
QString barsignerDbPath() const;
|
||||
QString dataDirPath() const;
|
||||
QString defaultKeystorePath() const;
|
||||
void loadSettings();
|
||||
void clearNdkSettings();
|
||||
void cleanNdkConfiguration();
|
||||
void syncCertificates(QList<BlackBerryCertificate*> certificates,
|
||||
BlackBerryCertificate *activeCertificate);
|
||||
|
||||
QList<BlackBerryCertificate*> certificates() const;
|
||||
BlackBerryCertificate *activeCertificate();
|
||||
|
||||
public slots:
|
||||
void saveSetting();
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
BlackBerryConfiguration(QObject *parent = 0);
|
||||
static BlackBerryConfiguration *m_instance;
|
||||
BlackBerryConfig m_config;
|
||||
|
||||
bool setConfig(const QString &ndkPath);
|
||||
void loadCertificates();
|
||||
void loadNdkSettings();
|
||||
void saveCertificates();
|
||||
void saveNdkSettings();
|
||||
bool refresh();
|
||||
bool setNdkPath(const QString &ndkPath);
|
||||
QtSupport::BaseQtVersion* createQtVersion();
|
||||
ProjectExplorer::GccToolChain* createGccToolChain();
|
||||
ProjectExplorer::Kit* createKit(QnxArchitecture arch, QtSupport::BaseQtVersion* qtVersion, ProjectExplorer::GccToolChain* tc);
|
||||
|
||||
208
src/plugins/qnx/blackberrycreatecertificatedialog.cpp
Normal file
208
src/plugins/qnx/blackberrycreatecertificatedialog.cpp
Normal file
@@ -0,0 +1,208 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberrycreatecertificatedialog.h"
|
||||
#include "blackberrycertificate.h"
|
||||
#include "ui_blackberrycreatecertificatedialog.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BlackBerryCreateCertificateDialog::BlackBerryCreateCertificateDialog(
|
||||
QWidget *parent, Qt::WindowFlags f) :
|
||||
QDialog(parent, f),
|
||||
m_ui(new Ui_BlackBerryCreateCertificateDialog),
|
||||
m_certificate(0)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->progressBar->hide();
|
||||
m_ui->certPath->setExpectedKind(Utils::PathChooser::Any);
|
||||
m_ui->certPath->setPromptDialogTitle(tr("Create certificate"));
|
||||
m_ui->certPath->setPromptDialogFilter(tr("PKCS 12 archives (*.p12)"));
|
||||
m_ui->status->clear();
|
||||
|
||||
m_cancelButton = m_ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
Q_ASSERT(m_cancelButton);
|
||||
|
||||
m_okButton = m_ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
m_okButton->setEnabled(false);
|
||||
|
||||
connect(m_cancelButton, SIGNAL(clicked()),
|
||||
this, SLOT(reject()));
|
||||
connect(m_okButton, SIGNAL(clicked()),
|
||||
this, SLOT(createCertificate()));
|
||||
connect(m_ui->certPath, SIGNAL(changed(QString)),
|
||||
this, SLOT(validate()));
|
||||
connect(m_ui->certPath, SIGNAL(editingFinished()),
|
||||
this, SLOT(appendExtension()));
|
||||
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)));
|
||||
}
|
||||
|
||||
QString BlackBerryCreateCertificateDialog::author() const
|
||||
{
|
||||
return m_ui->author->text();
|
||||
}
|
||||
|
||||
QString BlackBerryCreateCertificateDialog::certPath() const
|
||||
{
|
||||
return m_ui->certPath->path();
|
||||
}
|
||||
|
||||
QString BlackBerryCreateCertificateDialog::keystorePassword() const
|
||||
{
|
||||
return m_ui->password->text();
|
||||
}
|
||||
|
||||
BlackBerryCertificate * BlackBerryCreateCertificateDialog::certificate() const
|
||||
{
|
||||
return m_certificate;
|
||||
}
|
||||
|
||||
void BlackBerryCreateCertificateDialog::validate()
|
||||
{
|
||||
if (!m_ui->certPath->isValid()
|
||||
|| m_ui->author->text().isEmpty()
|
||||
|| m_ui->password->text().isEmpty()
|
||||
|| m_ui->password2->text().isEmpty()) {
|
||||
m_ui->status->clear();
|
||||
m_okButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(m_ui->certPath->path());
|
||||
|
||||
if (!fileInfo.dir().exists()) {
|
||||
m_ui->status->setText(tr("Base directory does not exist"));
|
||||
m_okButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_ui->password->text() != m_ui->password2->text()) {
|
||||
m_ui->status->setText(tr("The entered passwords do not match"));
|
||||
m_okButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
m_ui->status->clear();
|
||||
m_okButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void BlackBerryCreateCertificateDialog::createCertificate()
|
||||
{
|
||||
setBusy(true);
|
||||
|
||||
QFile file(m_ui->certPath->path());
|
||||
|
||||
if (file.exists()) {
|
||||
const int result = QMessageBox::question(this, tr("Are you sure?"),
|
||||
tr("The file '%1' will be overwritten. Do you want to proceed?")
|
||||
.arg(file.fileName()), QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (result & QMessageBox::Yes) {
|
||||
file.remove();
|
||||
} else {
|
||||
setBusy(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_certificate = new BlackBerryCertificate(certPath(),
|
||||
author(), keystorePassword());
|
||||
|
||||
connect(m_certificate, SIGNAL(finished(int)), this, SLOT(certificateCreated(int)));
|
||||
m_certificate->store();
|
||||
}
|
||||
|
||||
void BlackBerryCreateCertificateDialog::appendExtension()
|
||||
{
|
||||
QString path = m_ui->certPath->path();
|
||||
|
||||
if (!path.endsWith(QLatin1String(".p12"))) {
|
||||
path += QLatin1String(".p12");
|
||||
m_ui->certPath->setPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryCreateCertificateDialog::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 BlackBerryCreateCertificateDialog::certificateCreated(int status)
|
||||
{
|
||||
if (status == BlackBerryCertificate::Success) {
|
||||
accept();
|
||||
} else {
|
||||
m_certificate->deleteLater();
|
||||
m_certificate = 0;
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("An unknown error happened while creating the certificate"));
|
||||
reject();
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryCreateCertificateDialog::setBusy(bool busy)
|
||||
{
|
||||
m_okButton->setEnabled(!busy);
|
||||
m_cancelButton->setEnabled(!busy);
|
||||
m_ui->certPath->setEnabled(!busy);
|
||||
m_ui->author->setEnabled(!busy);
|
||||
m_ui->password->setEnabled(!busy);
|
||||
m_ui->password2->setEnabled(!busy);
|
||||
m_ui->showPassword->setEnabled(!busy);
|
||||
m_ui->progressBar->setVisible(busy);
|
||||
|
||||
if (busy)
|
||||
m_ui->status->setText(tr("Please be patient..."));
|
||||
else
|
||||
m_ui->status->clear();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Qnx
|
||||
82
src/plugins/qnx/blackberrycreatecertificatedialog.h
Normal file
82
src/plugins/qnx/blackberrycreatecertificatedialog.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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_BLACKBERRYCREATECERTIFICATEDIALOG_H
|
||||
#define QNX_INTERNAL_BLACKBERRYCREATECERTIFICATEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class Ui_BlackBerryCreateCertificateDialog;
|
||||
class BlackBerryCertificate;
|
||||
|
||||
class BlackBerryCreateCertificateDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BlackBerryCreateCertificateDialog(QWidget *parent = 0,
|
||||
Qt::WindowFlags f = 0);
|
||||
|
||||
QString author() const;
|
||||
QString certPath() const;
|
||||
QString keystorePassword() const;
|
||||
|
||||
BlackBerryCertificate *certificate() const;
|
||||
|
||||
private slots:
|
||||
void validate();
|
||||
void createCertificate();
|
||||
void appendExtension();
|
||||
void checkBoxChanged(int state);
|
||||
void certificateCreated(int status);
|
||||
|
||||
private:
|
||||
void setBusy(bool busy);
|
||||
|
||||
Ui_BlackBerryCreateCertificateDialog *m_ui;
|
||||
|
||||
BlackBerryCertificate *m_certificate;
|
||||
|
||||
QPushButton *m_cancelButton;
|
||||
QPushButton *m_okButton;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYCREATECERTIFICATEDIALOG_H
|
||||
133
src/plugins/qnx/blackberrycreatecertificatedialog.ui
Normal file
133
src/plugins/qnx/blackberrycreatecertificatedialog.ui
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BlackBerryCreateCertificateDialog</class>
|
||||
<widget class="QDialog" name="Qnx::Internal::BlackBerryCreateCertificateDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>495</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create certificate</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>Path:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Utils::PathChooser" name="certPath" native="true"/>
|
||||
</item>
|
||||
<item row="1" 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="1" column="1">
|
||||
<widget class="QLineEdit" name="author"/>
|
||||
</item>
|
||||
<item row="2" 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="2" column="1">
|
||||
<widget class="QLineEdit" name="password">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" 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="3" column="1">
|
||||
<widget class="QLineEdit" name="password2">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="showPassword">
|
||||
<property name="text">
|
||||
<string>Show password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" 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>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
115
src/plugins/qnx/blackberrycsjregistrar.cpp
Normal file
115
src/plugins/qnx/blackberrycsjregistrar.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberrycsjregistrar.h"
|
||||
#include "blackberryconfiguration.h"
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BlackBerryCsjRegistrar::BlackBerryCsjRegistrar(QObject *parent) :
|
||||
QObject(parent),
|
||||
m_process(new QProcess(this))
|
||||
{
|
||||
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(processFinished()));
|
||||
connect(m_process, SIGNAL(error(QProcess::ProcessError)),
|
||||
this, SLOT(processError(QProcess::ProcessError)));
|
||||
}
|
||||
|
||||
void BlackBerryCsjRegistrar::tryRegister(const QStringList &csjFiles,
|
||||
const QString &csjPin, const QString &cskPassword)
|
||||
{
|
||||
if (m_process->state() != QProcess::NotRunning)
|
||||
return;
|
||||
|
||||
QString command = BlackBerryConfiguration::instance()
|
||||
.qnxEnv().value(QLatin1String("QNX_HOST"))
|
||||
+ (QLatin1String("/usr/bin/blackberry-signer"));
|
||||
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
command += QLatin1String(".bat");
|
||||
|
||||
QStringList arguments;
|
||||
|
||||
arguments << QLatin1String("-register")
|
||||
<< QLatin1String("-cskpass")
|
||||
<< cskPassword
|
||||
<< QLatin1String("-csjpin")
|
||||
<< csjPin
|
||||
<< csjFiles;
|
||||
|
||||
m_process->start(command, arguments);
|
||||
}
|
||||
|
||||
void BlackBerryCsjRegistrar::processFinished()
|
||||
{
|
||||
QByteArray result = m_process->readAllStandardOutput();
|
||||
|
||||
if (result.contains("Successfully registered with server."))
|
||||
emit finished(RegisterSuccess, QString());
|
||||
else
|
||||
emit finished(Error, QLatin1String(result));
|
||||
}
|
||||
|
||||
void BlackBerryCsjRegistrar::processError(QProcess::ProcessError error)
|
||||
{
|
||||
QString errorMessage;
|
||||
|
||||
switch (error) {
|
||||
case QProcess::FailedToStart:
|
||||
errorMessage = tr("Failed to start blackberry-signer process");
|
||||
break;
|
||||
case QProcess::Timedout:
|
||||
errorMessage = tr("Process timed out");
|
||||
case QProcess::Crashed:
|
||||
errorMessage = tr("Child process has crashed");
|
||||
break;
|
||||
case QProcess::WriteError:
|
||||
case QProcess::ReadError:
|
||||
errorMessage = tr("Process I/O error");
|
||||
break;
|
||||
case QProcess::UnknownError:
|
||||
errorMessage = tr("Unknown process error");
|
||||
break;
|
||||
}
|
||||
|
||||
emit finished(Error, errorMessage);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
71
src/plugins/qnx/blackberrycsjregistrar.h
Normal file
71
src/plugins/qnx/blackberrycsjregistrar.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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_BLACKBERRYCSJREGISTRAR_H
|
||||
#define QNX_INTERNAL_BLACKBERRYCSJREGISTRAR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QProcess>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryCsjRegistrar : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum RegisterStatus
|
||||
{
|
||||
RegisterSuccess,
|
||||
Error
|
||||
};
|
||||
|
||||
BlackBerryCsjRegistrar(QObject *parent = 0);
|
||||
|
||||
void tryRegister(const QStringList &csjFiles, const QString &csjPin, const QString &cskPassword);
|
||||
|
||||
signals:
|
||||
void finished(int status, const QString &errorString);
|
||||
|
||||
private slots:
|
||||
void processFinished();
|
||||
void processError(QProcess::ProcessError error);
|
||||
|
||||
private:
|
||||
QProcess *m_process;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYCSJREGISTRAR_H
|
||||
142
src/plugins/qnx/blackberryimportcertificatedialog.cpp
Normal file
142
src/plugins/qnx/blackberryimportcertificatedialog.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberryimportcertificatedialog.h"
|
||||
#include "blackberrycertificate.h"
|
||||
#include "ui_blackberryimportcertificatedialog.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BlackBerryImportCertificateDialog::BlackBerryImportCertificateDialog(
|
||||
QWidget *parent, Qt::WindowFlags f) :
|
||||
QDialog(parent, f),
|
||||
m_ui(new Ui_BlackBerryImportCertificateDialog),
|
||||
m_certificate(0)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->certPath->setExpectedKind(Utils::PathChooser::File);
|
||||
m_ui->certPath->setPromptDialogTitle(tr("Import Certificate"));
|
||||
m_ui->certPath->setPromptDialogFilter(tr("PKCS 12 Archives (*.p12)"));
|
||||
|
||||
m_cancelButton = m_ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
|
||||
m_okButton = m_ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
m_okButton->setEnabled(false);
|
||||
|
||||
connect(m_cancelButton, SIGNAL(clicked()),
|
||||
this, SLOT(reject()));
|
||||
connect(m_okButton, SIGNAL(clicked()),
|
||||
this, SLOT(importCertificate()));
|
||||
connect(m_ui->certPath, SIGNAL(changed(QString)),
|
||||
this, SLOT(validate()));
|
||||
connect(m_ui->certPass, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(validate()));
|
||||
}
|
||||
|
||||
QString BlackBerryImportCertificateDialog::author() const
|
||||
{
|
||||
return m_author;
|
||||
}
|
||||
|
||||
QString BlackBerryImportCertificateDialog::certPath() const
|
||||
{
|
||||
return m_ui->certPath->path();
|
||||
}
|
||||
|
||||
QString BlackBerryImportCertificateDialog::keystorePassword() const
|
||||
{
|
||||
return m_ui->certPass->text();
|
||||
}
|
||||
|
||||
BlackBerryCertificate * BlackBerryImportCertificateDialog::certificate() const
|
||||
{
|
||||
return m_certificate;
|
||||
}
|
||||
|
||||
void BlackBerryImportCertificateDialog::importCertificate()
|
||||
{
|
||||
setBusy(true);
|
||||
|
||||
m_certificate = new BlackBerryCertificate(certPath(),
|
||||
QString(), keystorePassword());
|
||||
|
||||
connect(m_certificate, SIGNAL(finished(int)), this, SLOT(certificateLoaded(int)));
|
||||
|
||||
m_certificate->load();
|
||||
}
|
||||
|
||||
void BlackBerryImportCertificateDialog::validate()
|
||||
{
|
||||
if (!m_ui->certPath->isValid() || m_ui->certPass->text().isEmpty()) {
|
||||
m_okButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
m_okButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void BlackBerryImportCertificateDialog::certificateLoaded(int status)
|
||||
{
|
||||
if (status != BlackBerryCertificate::Success) {
|
||||
setBusy(false);
|
||||
|
||||
m_certificate->deleteLater();
|
||||
m_certificate = 0;
|
||||
|
||||
if (status == BlackBerryCertificate::WrongPassword) {
|
||||
QMessageBox::information(this, tr("Error"),
|
||||
tr("Invalid keystore password"));
|
||||
} else {
|
||||
QMessageBox::information(this, tr("Error"),
|
||||
tr("An unknown error has happened"));
|
||||
}
|
||||
} else {
|
||||
m_author = m_certificate->author();
|
||||
accept();
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryImportCertificateDialog::setBusy(bool busy)
|
||||
{
|
||||
m_ui->certPath->setEnabled(!busy);
|
||||
m_ui->certPass->setEnabled(!busy);
|
||||
m_okButton->setEnabled(!busy);
|
||||
m_cancelButton->setEnabled(!busy);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
82
src/plugins/qnx/blackberryimportcertificatedialog.h
Normal file
82
src/plugins/qnx/blackberryimportcertificatedialog.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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_BLACKBERRYIMPORTCERTIFICATEDIALOG_H
|
||||
#define QNX_INTERNAL_BLACKBERRYIMPORTCERTIFICATEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class Ui_BlackBerryImportCertificateDialog;
|
||||
class BlackBerryCertificate;
|
||||
|
||||
class BlackBerryImportCertificateDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BlackBerryImportCertificateDialog(QWidget *parent = 0,
|
||||
Qt::WindowFlags f = 0);
|
||||
|
||||
QString author() const;
|
||||
QString certPath() const;
|
||||
QString keystorePassword() const;
|
||||
|
||||
BlackBerryCertificate *certificate() const;
|
||||
|
||||
private slots:
|
||||
void importCertificate();
|
||||
void validate();
|
||||
void certificateLoaded(int);
|
||||
|
||||
private:
|
||||
void setBusy(bool busy);
|
||||
|
||||
Ui_BlackBerryImportCertificateDialog *m_ui;
|
||||
|
||||
BlackBerryCertificate *m_certificate;
|
||||
|
||||
QString m_author;
|
||||
|
||||
QPushButton *m_cancelButton;
|
||||
QPushButton *m_okButton;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYIMPORTCERTIFICATEDIALOG_H
|
||||
70
src/plugins/qnx/blackberryimportcertificatedialog.ui
Normal file
70
src/plugins/qnx/blackberryimportcertificatedialog.ui
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BlackBerryImportCertificateDialog</class>
|
||||
<widget class="QDialog" name="Qnx::Internal::BlackBerryImportCertificateDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<height>88</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Import certificate</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>Path:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Utils::PathChooser" name="certPath" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<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="certPass">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
70
src/plugins/qnx/blackberrykeyspage.cpp
Normal file
70
src/plugins/qnx/blackberrykeyspage.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2012 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberrykeyspage.h"
|
||||
#include "blackberrykeyswidget.h"
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BlackBerryKeysPage::BlackBerryKeysPage(QObject *parent) :
|
||||
Core::IOptionsPage(parent),
|
||||
m_widget(0)
|
||||
{
|
||||
setId(Core::Id(Constants::QNX_BB_SIGNING_ID));
|
||||
setDisplayName(tr("Keys"));
|
||||
setCategory(Constants::QNX_BB_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("BlackBerry",
|
||||
Constants::QNX_BB_CATEGORY_TR));
|
||||
}
|
||||
|
||||
QWidget *BlackBerryKeysPage::createPage(QWidget *parent)
|
||||
{
|
||||
m_widget = new BlackBerryKeysWidget(parent);
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void BlackBerryKeysPage::apply()
|
||||
{
|
||||
m_widget->apply();
|
||||
}
|
||||
|
||||
void BlackBerryKeysPage::finish()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
58
src/plugins/qnx/blackberrykeyspage.h
Normal file
58
src/plugins/qnx/blackberrykeyspage.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 BLACKBERRYSIGNINGPAGE_H
|
||||
#define BLACKBERRYSIGNINGPAGE_H
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryKeysWidget;
|
||||
|
||||
class BlackBerryKeysPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BlackBerryKeysPage(QObject *parent = 0);
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
private:
|
||||
BlackBerryKeysWidget *m_widget;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // BLACKBERRYSIGNINGPAGE_H
|
||||
209
src/plugins/qnx/blackberrykeyswidget.cpp
Normal file
209
src/plugins/qnx/blackberrykeyswidget.cpp
Normal file
@@ -0,0 +1,209 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberrykeyswidget.h"
|
||||
#include "blackberryregisterkeydialog.h"
|
||||
#include "blackberryconfiguration.h"
|
||||
#include "blackberrycertificatemodel.h"
|
||||
#include "blackberryimportcertificatedialog.h"
|
||||
#include "blackberrycreatecertificatedialog.h"
|
||||
#include "blackberrycertificate.h"
|
||||
#include "ui_blackberrykeyswidget.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QHeaderView>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BlackBerryKeysWidget::BlackBerryKeysWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_ui(new Ui_BlackBerryKeysWidget),
|
||||
m_model(new BlackBerryCertificateModel(this))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->certificatesView->setModel(m_model);
|
||||
m_ui->certificatesView->resizeColumnsToContents();
|
||||
|
||||
QHeaderView *headerView = m_ui->certificatesView->horizontalHeader();
|
||||
headerView->setResizeMode(QHeaderView::Stretch);
|
||||
headerView->setResizeMode(2, QHeaderView::Fixed);
|
||||
|
||||
QItemSelectionModel *selectionModel = m_ui->certificatesView->selectionModel();
|
||||
connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(handleSelectionChanged(QItemSelection,QItemSelection)));
|
||||
|
||||
updateRegisterSection();
|
||||
|
||||
connect(m_ui->registerButton, SIGNAL(clicked()), this, SLOT(registerKey()));
|
||||
connect(m_ui->unregisterButton, SIGNAL(clicked()), this, SLOT(unregisterKey()));
|
||||
connect(m_ui->createCertificate, SIGNAL(clicked()), this, SLOT(createCertificate()));
|
||||
connect(m_ui->importCertificate, SIGNAL(clicked()), this, SLOT(importCertificate()));
|
||||
connect(m_ui->deleteCertificate, SIGNAL(clicked()), this, SLOT(deleteCertificate()));
|
||||
}
|
||||
|
||||
void BlackBerryKeysWidget::apply()
|
||||
{
|
||||
BlackBerryConfiguration &configuration = BlackBerryConfiguration::instance();
|
||||
|
||||
configuration.syncCertificates(m_model->certificates(), m_model->activeCertificate());
|
||||
}
|
||||
|
||||
void BlackBerryKeysWidget::registerKey()
|
||||
{
|
||||
BlackBerryRegisterKeyDialog dialog;
|
||||
|
||||
const int result = dialog.exec();
|
||||
|
||||
if (result != QDialog::Accepted)
|
||||
return;
|
||||
|
||||
BlackBerryCertificate *cert = dialog.certificate();
|
||||
|
||||
if (cert) {
|
||||
if (!m_model->insertCertificate(cert))
|
||||
QMessageBox::information(this, tr("Error"), tr("Could not insert default certificate"));
|
||||
}
|
||||
|
||||
updateRegisterSection();
|
||||
}
|
||||
|
||||
void BlackBerryKeysWidget::unregisterKey()
|
||||
{
|
||||
const QMessageBox::StandardButton answer =
|
||||
QMessageBox::question(this, tr("Unregister Key"),
|
||||
tr("Do you really want to unregister your key? This action cannot be undone!"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (answer & QMessageBox::No)
|
||||
return;
|
||||
|
||||
BlackBerryConfiguration &configuration = BlackBerryConfiguration::instance();
|
||||
|
||||
QFile f(configuration.barsignerCskPath());
|
||||
f.remove();
|
||||
|
||||
f.setFileName(configuration.barsignerDbPath());
|
||||
f.remove();
|
||||
|
||||
updateRegisterSection();
|
||||
}
|
||||
|
||||
void BlackBerryKeysWidget::createCertificate()
|
||||
{
|
||||
BlackBerryCreateCertificateDialog dialog;
|
||||
|
||||
const int result = dialog.exec();
|
||||
|
||||
if (result == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
BlackBerryCertificate *cert = dialog.certificate();
|
||||
|
||||
if (cert) {
|
||||
if (!m_model->insertCertificate(cert))
|
||||
QMessageBox::information(this, tr("Error"), tr("Error storing certificate"));
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryKeysWidget::importCertificate()
|
||||
{
|
||||
BlackBerryImportCertificateDialog dialog;
|
||||
|
||||
const int result = dialog.exec();
|
||||
|
||||
if (result == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
BlackBerryCertificate *cert = dialog.certificate();
|
||||
|
||||
if (cert) {
|
||||
if (!m_model->insertCertificate(cert))
|
||||
QMessageBox::information(this, tr("Error"), tr("This certificate already exists"));
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryKeysWidget::deleteCertificate()
|
||||
{
|
||||
const int result = QMessageBox::question(this, tr("Delete certificate"),
|
||||
tr("Are you sure you want to delete this certificate?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (result & QMessageBox::No)
|
||||
return;
|
||||
|
||||
m_model->removeRow(m_ui->certificatesView->selectionModel()->currentIndex().row());
|
||||
}
|
||||
|
||||
void BlackBerryKeysWidget::handleSelectionChanged(const QItemSelection &selected,
|
||||
const QItemSelection &deselected)
|
||||
{
|
||||
Q_UNUSED(deselected);
|
||||
|
||||
m_ui->deleteCertificate->setEnabled(!selected.indexes().isEmpty());
|
||||
}
|
||||
|
||||
void BlackBerryKeysWidget::updateRegisterSection()
|
||||
{
|
||||
if (hasRegisteredKey()) {
|
||||
m_ui->registerButton->hide();
|
||||
m_ui->unregisterButton->show();
|
||||
m_ui->registeredLabel->setText(tr("Registered: Yes"));
|
||||
} else {
|
||||
m_ui->registerButton->show();
|
||||
m_ui->unregisterButton->hide();
|
||||
m_ui->registeredLabel->setText(tr("Registered: No"));
|
||||
}
|
||||
}
|
||||
|
||||
bool BlackBerryKeysWidget::hasRegisteredKey() const
|
||||
{
|
||||
BlackBerryConfiguration &configuration = BlackBerryConfiguration::instance();
|
||||
|
||||
QFileInfo cskFile(configuration.barsignerCskPath());
|
||||
|
||||
if (!cskFile.exists())
|
||||
return false;
|
||||
|
||||
QFileInfo dbFile(configuration.barsignerDbPath());
|
||||
|
||||
if (!dbFile.exists())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
84
src/plugins/qnx/blackberrykeyswidget.h
Normal file
84
src/plugins/qnx/blackberrykeyswidget.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 BLACKBERRYKEYSWIDGET_H_H
|
||||
#define BLACKBERRYKEYSWIDGET_H_H
|
||||
|
||||
#include "blackberryconfiguration.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QItemSelection;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryCertificateModel;
|
||||
class Ui_BlackBerryKeysWidget;
|
||||
|
||||
class BlackBerryKeysWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BlackBerryKeysWidget(QWidget *parent = 0);
|
||||
|
||||
void apply();
|
||||
|
||||
private slots:
|
||||
void registerKey();
|
||||
void unregisterKey();
|
||||
void createCertificate();
|
||||
void importCertificate();
|
||||
void deleteCertificate();
|
||||
void handleSelectionChanged(
|
||||
const QItemSelection &selected,
|
||||
const QItemSelection &deselected);
|
||||
|
||||
private:
|
||||
void updateRegisterSection();
|
||||
|
||||
bool hasRegisteredKey() const;
|
||||
|
||||
QString dataDir() const;
|
||||
QString cskFilePath() const;
|
||||
QString dbFilePath() const;
|
||||
|
||||
Ui_BlackBerryKeysWidget *m_ui;
|
||||
BlackBerryCertificateModel *m_model;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespeace Qnx
|
||||
|
||||
#endif // BLACKBERRYKEYSWIDGET_H_H
|
||||
120
src/plugins/qnx/blackberrykeyswidget.ui
Normal file
120
src/plugins/qnx/blackberrykeyswidget.ui
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BlackBerryKeysWidget</class>
|
||||
<widget class="QWidget" name="Qnx::Internal::BlackBerryKeysWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>959</width>
|
||||
<height>390</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>RIM Signing Authority</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>658</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="registeredLabel">
|
||||
<property name="text">
|
||||
<string>Registered: Yes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="registerButton">
|
||||
<property name="text">
|
||||
<string>Register</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="unregisterButton">
|
||||
<property name="text">
|
||||
<string>Unregister</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Developer Certificate</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>189</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="4">
|
||||
<widget class="QTableView" name="certificatesView">
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="createCertificate">
|
||||
<property name="text">
|
||||
<string>Create</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="importCertificate">
|
||||
<property name="text">
|
||||
<string>Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="deleteCertificate">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -62,7 +62,7 @@ void BlackBerryNDKSettingsWidget::checkSdkPath()
|
||||
{
|
||||
if (!m_ui->sdkPath->path().isEmpty() &&
|
||||
QnxUtils::isValidNdkPath(m_ui->sdkPath->path()))
|
||||
m_bbConfig->setupConfiguration(m_ui->sdkPath->path());
|
||||
m_bbConfig->setupNdkConfiguration(m_ui->sdkPath->path());
|
||||
}
|
||||
|
||||
void BlackBerryNDKSettingsWidget::updateInfoTable()
|
||||
@@ -114,7 +114,7 @@ void BlackBerryNDKSettingsWidget::cleanConfiguration()
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (button == QMessageBox::Yes)
|
||||
m_bbConfig->cleanConfiguration();
|
||||
m_bbConfig->cleanNdkConfiguration();
|
||||
}
|
||||
|
||||
void BlackBerryNDKSettingsWidget::initInfoTable()
|
||||
|
||||
352
src/plugins/qnx/blackberryregisterkeydialog.cpp
Normal file
352
src/plugins/qnx/blackberryregisterkeydialog.cpp
Normal file
@@ -0,0 +1,352 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberryregisterkeydialog.h"
|
||||
#include "blackberrycsjregistrar.h"
|
||||
#include "blackberryconfiguration.h"
|
||||
#include "blackberrycertificate.h"
|
||||
#include "ui_blackberryregisterkeydialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QSysInfo>
|
||||
#endif
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BlackBerryRegisterKeyDialog::BlackBerryRegisterKeyDialog(QWidget *parent,
|
||||
Qt::WindowFlags f) :
|
||||
QDialog(parent, f),
|
||||
m_ui(new Ui_BlackBerryRegisterKeyDialog),
|
||||
m_registrar(new BlackBerryCsjRegistrar(this)),
|
||||
m_certificate(0)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->statusLabel->clear();
|
||||
|
||||
setupCsjPathChooser(m_ui->pbdtPath);
|
||||
setupCsjPathChooser(m_ui->rdkPath);
|
||||
|
||||
m_cancelButton = m_ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
|
||||
m_okButton = m_ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
|
||||
setBusy(false);
|
||||
|
||||
m_okButton->setEnabled(false);
|
||||
|
||||
QFileInfo authorP12(BlackBerryConfiguration::instance().defaultKeystorePath());
|
||||
|
||||
if (authorP12.exists()) {
|
||||
m_ui->genCert->setEnabled(false);
|
||||
m_ui->genCert->setChecked(false);
|
||||
m_ui->keystorePassword->setEnabled(false);
|
||||
m_ui->keystorePassword2->setEnabled(false);
|
||||
} else {
|
||||
m_ui->genCert->setEnabled(true);
|
||||
m_ui->genCert->setChecked(true);
|
||||
m_ui->keystorePassword->setEnabled(true);
|
||||
m_ui->keystorePassword2->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
connect(m_cancelButton, SIGNAL(clicked()),
|
||||
this, SLOT(reject()));
|
||||
connect(m_okButton, SIGNAL(clicked()),
|
||||
this, SLOT(createKey()));
|
||||
connect(m_ui->pbdtPath, SIGNAL(changed(QString)),
|
||||
this, SLOT(csjAutoComplete(QString)));
|
||||
connect(m_ui->rdkPath, SIGNAL(changed(QString)),
|
||||
this, SLOT(csjAutoComplete(QString)));
|
||||
connect(m_ui->showPins, SIGNAL(stateChanged(int)),
|
||||
this, SLOT(pinCheckBoxChanged(int)));
|
||||
connect(m_registrar, SIGNAL(finished(int,QString)),
|
||||
this, SLOT(registrarFinished(int,QString)));
|
||||
connect(m_ui->genCert, SIGNAL(stateChanged(int)),
|
||||
this, SLOT(certCheckBoxChanged(int)));
|
||||
connect(m_ui->pbdtPath, SIGNAL(changed(QString)), this, SLOT(validate()));
|
||||
connect(m_ui->rdkPath, SIGNAL(changed(QString)), this, SLOT(validate()));
|
||||
connect(m_ui->csjPin, SIGNAL(textChanged(QString)), this, SLOT(validate()));
|
||||
connect(m_ui->cskPin, SIGNAL(textChanged(QString)), this, SLOT(validate()));
|
||||
connect(m_ui->cskPin2, SIGNAL(textChanged(QString)), this, SLOT(validate()));
|
||||
connect(m_ui->keystorePassword, SIGNAL(textChanged(QString)), this, SLOT(validate()));
|
||||
connect(m_ui->keystorePassword2, SIGNAL(textChanged(QString)), this, SLOT(validate()));
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::csjAutoComplete(const QString &path)
|
||||
{
|
||||
Utils::PathChooser *chooser = 0;
|
||||
QString file = path;
|
||||
|
||||
if (file.contains(QLatin1String("PBDT"))) {
|
||||
file.replace(QLatin1String("PBDT"), QLatin1String("RDK"));
|
||||
chooser = m_ui->rdkPath;
|
||||
} else if (file.contains(QLatin1String("RDK"))) {
|
||||
file.replace(QLatin1String("RDK"), QLatin1String("PBDT"));
|
||||
chooser = m_ui->pbdtPath;
|
||||
}
|
||||
|
||||
if (!chooser)
|
||||
return;
|
||||
|
||||
QFileInfo fileInfo(file);
|
||||
|
||||
if (fileInfo.exists())
|
||||
chooser->setPath(file);
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::validate()
|
||||
{
|
||||
if (!m_ui->pbdtPath->isValid()
|
||||
|| !m_ui->rdkPath->isValid()
|
||||
|| m_ui->csjPin->text().isEmpty()
|
||||
|| m_ui->cskPin->text().isEmpty()
|
||||
|| m_ui->cskPin2->text().isEmpty()) {
|
||||
m_okButton->setEnabled(false);
|
||||
m_ui->statusLabel->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_ui->cskPin->text() != m_ui->cskPin2->text()) {
|
||||
m_okButton->setEnabled(false);
|
||||
m_ui->statusLabel->setText(tr("CSK PINs do not match"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_ui->genCert->isChecked()) {
|
||||
if (m_ui->keystorePassword->text().isEmpty()
|
||||
|| m_ui->keystorePassword2->text().isEmpty()) {
|
||||
m_okButton->setEnabled(false);
|
||||
m_ui->statusLabel->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_ui->keystorePassword->text()
|
||||
!= m_ui->keystorePassword2->text()) {
|
||||
m_ui->statusLabel->setText(tr("Keystore password does not match"));
|
||||
m_okButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_ui->statusLabel->clear();
|
||||
m_okButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::pinCheckBoxChanged(int state)
|
||||
{
|
||||
if (state == Qt::Checked) {
|
||||
m_ui->csjPin->setEchoMode(QLineEdit::Normal);
|
||||
m_ui->cskPin->setEchoMode(QLineEdit::Normal);
|
||||
m_ui->cskPin2->setEchoMode(QLineEdit::Normal);
|
||||
m_ui->keystorePassword->setEchoMode(QLineEdit::Normal);
|
||||
m_ui->keystorePassword2->setEchoMode(QLineEdit::Normal);
|
||||
} else {
|
||||
m_ui->csjPin->setEchoMode(QLineEdit::Password);
|
||||
m_ui->cskPin->setEchoMode(QLineEdit::Password);
|
||||
m_ui->cskPin2->setEchoMode(QLineEdit::Password);
|
||||
m_ui->keystorePassword->setEchoMode(QLineEdit::Password);
|
||||
m_ui->keystorePassword2->setEchoMode(QLineEdit::Password);
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::certCheckBoxChanged(int state)
|
||||
{
|
||||
m_ui->keystorePassword->setEnabled(state == Qt::Checked);
|
||||
m_ui->keystorePassword2->setEnabled(state == Qt::Checked);
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::createKey()
|
||||
{
|
||||
setBusy(true);
|
||||
|
||||
QStringList csjFiles;
|
||||
csjFiles << rdkPath() << pbdtPath();
|
||||
|
||||
m_registrar->tryRegister(csjFiles, csjPin(), cskPin());
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::registrarFinished(int status,
|
||||
const QString &errorString)
|
||||
{
|
||||
if (status == BlackBerryCsjRegistrar::Error) {
|
||||
QMessageBox::critical(this, tr("Error"), errorString);
|
||||
cleanup();
|
||||
setBusy(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_ui->genCert->isChecked())
|
||||
generateDeveloperCertificate();
|
||||
else
|
||||
accept();
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::certificateCreated(int status)
|
||||
{
|
||||
if (status == BlackBerryCertificate::Error) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Error creating developer certificate"));
|
||||
cleanup();
|
||||
m_certificate->deleteLater();
|
||||
m_certificate = 0;
|
||||
setBusy(false);
|
||||
} else {
|
||||
accept();
|
||||
}
|
||||
}
|
||||
|
||||
QString BlackBerryRegisterKeyDialog::pbdtPath() const
|
||||
{
|
||||
return m_ui->pbdtPath->path();
|
||||
}
|
||||
|
||||
QString BlackBerryRegisterKeyDialog::rdkPath() const
|
||||
{
|
||||
return m_ui->rdkPath->path();
|
||||
}
|
||||
|
||||
QString BlackBerryRegisterKeyDialog::csjPin() const
|
||||
{
|
||||
return m_ui->csjPin->text();
|
||||
}
|
||||
|
||||
QString BlackBerryRegisterKeyDialog::cskPin() const
|
||||
{
|
||||
return m_ui->cskPin->text();
|
||||
}
|
||||
|
||||
QString BlackBerryRegisterKeyDialog::keystorePassword() const
|
||||
{
|
||||
return m_ui->keystorePassword->text();
|
||||
}
|
||||
|
||||
QString BlackBerryRegisterKeyDialog::keystorePath() const
|
||||
{
|
||||
if (m_ui->genCert->isChecked()) {
|
||||
BlackBerryConfiguration &configuration = BlackBerryConfiguration::instance();
|
||||
return configuration.defaultKeystorePath();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
BlackBerryCertificate * BlackBerryRegisterKeyDialog::certificate() const
|
||||
{
|
||||
return m_certificate;
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::generateDeveloperCertificate()
|
||||
{
|
||||
m_certificate = new BlackBerryCertificate(keystorePath(),
|
||||
getCsjAuthor(rdkPath()), keystorePassword());
|
||||
|
||||
connect(m_certificate, SIGNAL(finished(int)), this, SLOT(certificateCreated(int)));
|
||||
|
||||
m_certificate->store();
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::cleanup() const
|
||||
{
|
||||
BlackBerryConfiguration &configuration = BlackBerryConfiguration::instance();
|
||||
|
||||
QFile f(configuration.barsignerCskPath());
|
||||
f.remove();
|
||||
|
||||
f.setFileName(configuration.barsignerDbPath());
|
||||
f.remove();
|
||||
|
||||
if (m_ui->genCert->isChecked()) {
|
||||
f.setFileName(configuration.defaultKeystorePath());
|
||||
f.remove();
|
||||
}
|
||||
}
|
||||
|
||||
void BlackBerryRegisterKeyDialog::setBusy(bool busy)
|
||||
{
|
||||
m_ui->progressBar->setVisible(busy);
|
||||
m_okButton->setEnabled(!busy);
|
||||
m_cancelButton->setEnabled(!busy);
|
||||
m_ui->rdkPath->setEnabled(!busy);
|
||||
m_ui->pbdtPath->setEnabled(!busy);
|
||||
m_ui->csjPin->setEnabled(!busy);
|
||||
m_ui->cskPin->setEnabled(!busy);
|
||||
m_ui->cskPin2->setEnabled(!busy);
|
||||
m_ui->keystorePassword->setEnabled(!busy);
|
||||
m_ui->keystorePassword2->setEnabled(!busy);
|
||||
m_ui->showPins->setEnabled(!busy);
|
||||
|
||||
}
|
||||
|
||||
QString BlackBerryRegisterKeyDialog::getCsjAuthor(const QString &fileName) const
|
||||
{
|
||||
QFile file(fileName);
|
||||
|
||||
QString author = QLatin1String("Unknown Author");
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
return author;
|
||||
|
||||
QTextStream stream(&file);
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
QString line = stream.readLine();
|
||||
|
||||
if (line.startsWith(QLatin1String("Company="))) {
|
||||
author = line.remove(QLatin1String("Company=")).trimmed();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return author;
|
||||
}
|
||||
void BlackBerryRegisterKeyDialog::setupCsjPathChooser(Utils::PathChooser *chooser)
|
||||
{
|
||||
chooser->setExpectedKind(Utils::PathChooser::File);
|
||||
chooser->setPromptDialogTitle(tr("Browse CSJ file"));
|
||||
chooser->setPromptDialogFilter(tr("CSJ files (*.csj)"));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
99
src/plugins/qnx/blackberryregisterkeydialog.h
Normal file
99
src/plugins/qnx/blackberryregisterkeydialog.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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_BLACKBERRYREGISTERKEYDIALOG_H
|
||||
#define QNX_INTERNAL_BLACKBERRYREGISTERKEYDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class PathChooser;
|
||||
}
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class Ui_BlackBerryRegisterKeyDialog;
|
||||
class BlackBerryCsjRegistrar;
|
||||
class BlackBerryCertificate;
|
||||
|
||||
class BlackBerryRegisterKeyDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BlackBerryRegisterKeyDialog(QWidget *parent = 0,
|
||||
Qt::WindowFlags f = 0);
|
||||
|
||||
QString pbdtPath() const;
|
||||
QString rdkPath() const;
|
||||
QString csjPin() const;
|
||||
QString cskPin() const;
|
||||
QString keystorePassword() const;
|
||||
QString keystorePath() const;
|
||||
|
||||
BlackBerryCertificate *certificate() const;
|
||||
|
||||
private slots:
|
||||
void csjAutoComplete(const QString &path);
|
||||
void validate();
|
||||
void createKey();
|
||||
void pinCheckBoxChanged(int state);
|
||||
void certCheckBoxChanged(int state);
|
||||
void registrarFinished(int status, const QString &errorString);
|
||||
void certificateCreated(int status);
|
||||
|
||||
private:
|
||||
void setupCsjPathChooser(Utils::PathChooser *chooser);
|
||||
void generateDeveloperCertificate();
|
||||
void cleanup() const;
|
||||
void setBusy(bool busy);
|
||||
|
||||
QString getCsjAuthor(const QString &fileName) const;
|
||||
|
||||
Ui_BlackBerryRegisterKeyDialog *m_ui;
|
||||
|
||||
BlackBerryCsjRegistrar *m_registrar;
|
||||
|
||||
BlackBerryCertificate *m_certificate;
|
||||
|
||||
QPushButton *m_okButton;
|
||||
QPushButton *m_cancelButton;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYREGISTERKEYDIALOG_H
|
||||
354
src/plugins/qnx/blackberryregisterkeydialog.ui
Normal file
354
src/plugins/qnx/blackberryregisterkeydialog.ui
Normal file
@@ -0,0 +1,354 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Qnx::Internal::BlackBerryRegisterKeyDialog</class>
|
||||
<widget class="QDialog" name="Qnx::Internal::BlackBerryRegisterKeyDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>583</width>
|
||||
<height>339</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create key</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<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::WinPanel</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">Obtaining keys</span></p><p>You will need to order a pair of CSJ files from RIM, by <a href="https://www.blackberry.com/SignedKeys/codesigning.html"><span style=" text-decoration: underline; color:#004f69;">visiting this page.</span></a></p></body></html></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>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</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>4</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>PBDT CSJ file:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="Utils::PathChooser" name="pbdtPath" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>RDK CSJ file:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="Utils::PathChooser" name="rdkPath" native="true"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>CSJ pin:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>CSK pin:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Confirm CSK pin:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Keystore password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Confirm password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="genCert">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Generate developer certificate automatically</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QCheckBox" name="showPins">
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLineEdit" name="keystorePassword2">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QLineEdit" name="keystorePassword">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="csjPin">
|
||||
<property name="maxLength">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>This is the pin you entered when you requested the CSJ files.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="cskPin">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="cskPin2">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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>Status</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>csjPin</tabstop>
|
||||
<tabstop>cskPin</tabstop>
|
||||
<tabstop>cskPin2</tabstop>
|
||||
<tabstop>genCert</tabstop>
|
||||
<tabstop>keystorePassword</tabstop>
|
||||
<tabstop>keystorePassword2</tabstop>
|
||||
<tabstop>showPins</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -60,7 +60,15 @@ SOURCES += qnxplugin.cpp \
|
||||
bardescriptoreditorwidget.cpp \
|
||||
bardescriptordocument.cpp \
|
||||
bardescriptordocumentnodehandlers.cpp \
|
||||
bardescriptorpermissionsmodel.cpp
|
||||
bardescriptorpermissionsmodel.cpp \
|
||||
blackberrykeyswidget.cpp \
|
||||
blackberrykeyspage.cpp \
|
||||
blackberrycsjregistrar.cpp \
|
||||
blackberrycertificate.cpp \
|
||||
blackberrycertificatemodel.cpp \
|
||||
blackberryregisterkeydialog.cpp \
|
||||
blackberryimportcertificatedialog.cpp \
|
||||
blackberrycreatecertificatedialog.cpp
|
||||
|
||||
HEADERS += qnxplugin.h\
|
||||
qnxconstants.h \
|
||||
@@ -117,7 +125,15 @@ HEADERS += qnxplugin.h\
|
||||
bardescriptoreditorwidget.h \
|
||||
bardescriptordocument.h \
|
||||
bardescriptordocumentnodehandlers.h \
|
||||
bardescriptorpermissionsmodel.h
|
||||
bardescriptorpermissionsmodel.h \
|
||||
blackberrykeyswidget.h \
|
||||
blackberrykeyspage.h \
|
||||
blackberrycsjregistrar.h \
|
||||
blackberrycertificate.h \
|
||||
blackberrycertificatemodel.h \
|
||||
blackberryregisterkeydialog.h \
|
||||
blackberryimportcertificatedialog.h \
|
||||
blackberrycreatecertificatedialog.h
|
||||
|
||||
FORMS += \
|
||||
blackberrydeviceconfigurationwizardsetuppage.ui \
|
||||
@@ -127,7 +143,11 @@ FORMS += \
|
||||
blackberrydeviceconfigurationwidget.ui \
|
||||
qnxbaseqtconfigwidget.ui \
|
||||
blackberryndksettingswidget.ui \
|
||||
bardescriptoreditorwidget.ui
|
||||
bardescriptoreditorwidget.ui \
|
||||
blackberrykeyswidget.ui \
|
||||
blackberryregisterkeydialog.ui \
|
||||
blackberryimportcertificatedialog.ui \
|
||||
blackberrycreatecertificatedialog.ui
|
||||
|
||||
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
|
||||
|
||||
|
||||
@@ -97,6 +97,28 @@ QtcPlugin {
|
||||
"blackberryndksettingspage.h",
|
||||
"blackberryconfiguration.cpp",
|
||||
"blackberryconfiguration.h",
|
||||
"blackberryregistrar.cpp",
|
||||
"blackberryregistrar.h",
|
||||
"blackberrycertificate.cpp",
|
||||
"blackberrycertificate.h",
|
||||
"blackberrykeyspage.cpp",
|
||||
"blackberrykeyspage.h",
|
||||
"blackberrykeyswidget.cpp",
|
||||
"blackberrykeyswidget.h",
|
||||
"blackberrykeyswidget.ui",
|
||||
"blackberrycertificatemodel.cpp",
|
||||
"blackberrycertificatemodel.h",
|
||||
"blackberryregisterkeydialog.cpp",
|
||||
"blackberryregisterkeydialog.h",
|
||||
"blackberryregisterkeydialog.ui",
|
||||
"blackberryimportcertificatedialog.cpp",
|
||||
"blackberryimportcertificatedialog.h",
|
||||
"blackberryimportcertificatedialog.ui",
|
||||
"blackberrycreatecertificatedialog.cpp",
|
||||
"blackberrycreatecertificatedialog.h",
|
||||
"blackberrycreatecertificatedialog.ui",
|
||||
"blackberrywizardextension.cpp",
|
||||
"blackberrywizardextension.h",
|
||||
"pathchooserdelegate.cpp",
|
||||
"pathchooserdelegate.h",
|
||||
"qnx.qrc",
|
||||
|
||||
@@ -93,11 +93,16 @@ const char QNX_BB_CATEGORY[] = "XF.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_NDK_SETTINGS_ID[] = "ZZ.BlackBerry NDK Configuration";
|
||||
const char QNX_BB_SIGNING_ID[] = "ZZ.BlackBerry Signing Infrastructure Configuration";
|
||||
|
||||
const char QNX_BAR_DESCRIPTOR_MIME_TYPE[] = "application/vnd.rim.qnx.bar_descriptor";
|
||||
const char QNX_BAR_DESCRIPTOR_EDITOR_ID[] = "Qnx.BarDescriptorEditor";
|
||||
|
||||
const char QNX_TASK_CATEGORY_BARDESCRIPTOR[] = "Task.Category.BarDescriptor";
|
||||
|
||||
const char QNX_KEY_AUTHOR[] = "author";
|
||||
const char QNX_KEY_PATH[] = "path";
|
||||
const char QNX_KEY_ACTIVE[] = "active";
|
||||
} // namespace Constants
|
||||
} // namespace Qnx
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "blackberryndksettingspage.h"
|
||||
#include "bardescriptoreditorfactory.h"
|
||||
#include "bardescriptormagicmatcher.h"
|
||||
#include "blackberrykeyspage.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
@@ -78,6 +79,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
addAutoReleasedObject(new BlackBerryRunConfigurationFactory);
|
||||
addAutoReleasedObject(new BlackBerryRunControlFactory);
|
||||
addAutoReleasedObject(new BlackBerryNDKSettingsPage);
|
||||
addAutoReleasedObject(new BlackBerryKeysPage);
|
||||
|
||||
// Handles QNX
|
||||
addAutoReleasedObject(new QnxQtVersionFactory);
|
||||
|
||||
Reference in New Issue
Block a user