Commit 0e67b293 authored by Tobias Hunger's avatar Tobias Hunger

Qnx: Fix lifecycle of the BlackBerryConfigurationManager

This fixes a crash when this class tries to show a UI while it is
destructed.

Task-number: QTCREATORBUG-11712
Change-Id: If4aca14a3ca4792bec1a45903a1f38287d16dbc4
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent bfd60402
......@@ -445,7 +445,7 @@ bool BlackBerryApiLevelConfiguration::activate()
if (qt5X86Version)
createKit(qt5X86Version, x86ToolChain, x86DebuggerItemId);
BlackBerryConfigurationManager::instance().emitSettingsChanged();
BlackBerryConfigurationManager::instance()->emitSettingsChanged();
return true;
}
......@@ -469,7 +469,7 @@ void BlackBerryApiLevelConfiguration::deactivate()
}
}
BlackBerryConfigurationManager::instance().emitSettingsChanged();
BlackBerryConfigurationManager::instance()->emitSettingsChanged();
}
#ifdef WITH_TESTS
......
......@@ -54,7 +54,7 @@ BlackBerryCertificate::BlackBerryCertificate(const QString &fileName,
{
m_process->setProcessChannelMode(QProcess::MergedChannels);
m_process->setEnvironment(Utils::EnvironmentItem::toStringList(
BlackBerryConfigurationManager::instance().defaultConfigurationEnv()));
BlackBerryConfigurationManager::instance()->defaultConfigurationEnv()));
}
void BlackBerryCertificate::load()
......
......@@ -62,6 +62,8 @@ using namespace ProjectExplorer;
namespace Qnx {
namespace Internal {
BlackBerryConfigurationManager *BlackBerryConfigurationManager::m_instance = 0;
namespace {
const QLatin1String SettingsGroup("BlackBerryConfiguration");
const QLatin1String NDKLocationKey("NDKLocation"); // For 10.1 NDK support (< QTC 3.0)
......@@ -93,6 +95,7 @@ BlackBerryConfigurationManager::BlackBerryConfigurationManager(QObject *parent)
m_writer = new Utils::PersistentSettingsWriter(bbConfigSettingsFileName(),
QLatin1String("BlackBerryConfigurations"));
connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings()));
m_instance = this;
}
void BlackBerryConfigurationManager::saveConfigurations()
......@@ -466,15 +469,14 @@ void BlackBerryConfigurationManager::saveSettings()
saveConfigurations();
}
BlackBerryConfigurationManager &BlackBerryConfigurationManager::instance()
BlackBerryConfigurationManager *BlackBerryConfigurationManager::instance()
{
static BlackBerryConfigurationManager instance;
return instance;
return m_instance;
}
BlackBerryConfigurationManager::~BlackBerryConfigurationManager()
{
m_instance = 0;
qDeleteAll(m_apiLevels);
qDeleteAll(m_runtimes);
delete m_writer;
......
......@@ -45,12 +45,13 @@ namespace Internal {
class BlackBerryApiLevelConfiguration;
class BlackBerryRuntimeConfiguration;
class QNXPlugin;
class BlackBerryConfigurationManager : public QObject
{
Q_OBJECT
public:
static BlackBerryConfigurationManager &instance();
static BlackBerryConfigurationManager *instance();
~BlackBerryConfigurationManager();
bool addApiLevel(BlackBerryApiLevelConfiguration *config);
void removeApiLevel(BlackBerryApiLevelConfiguration *config);
......@@ -92,6 +93,9 @@ signals:
private:
BlackBerryConfigurationManager(QObject *parent = 0);
static BlackBerryConfigurationManager *m_instance;
QList<BlackBerryApiLevelConfiguration*> m_apiLevels;
QList<BlackBerryRuntimeConfiguration*> m_runtimes;
......@@ -107,6 +111,8 @@ private:
void insertApiLevelByVersion(BlackBerryApiLevelConfiguration* apiLevel);
void insertRuntimeByVersion(BlackBerryRuntimeConfiguration* runtime);
friend class QNXPlugin;
};
} // namespace Internal
......
......@@ -79,7 +79,7 @@ QString BlackBerryCreateCertificateDialog::author() const
QString BlackBerryCreateCertificateDialog::certPath() const
{
return BlackBerryConfigurationManager::instance().defaultKeystorePath();
return BlackBerryConfigurationManager::instance()->defaultKeystorePath();
}
QString BlackBerryCreateCertificateDialog::keystorePassword() const
......
......@@ -142,8 +142,6 @@ void BlackBerryDebugTokenRequestDialog::requestDebugToken()
}
}
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
bool ok;
const QString cskPassword = m_utils.cskPassword(this, &ok);
......@@ -160,7 +158,7 @@ void BlackBerryDebugTokenRequestDialog::requestDebugToken()
}
m_requester->requestDebugToken(m_ui->debugTokenPath->path(),
cskPassword, configuration.defaultKeystorePath(),
cskPassword, BlackBerryConfigurationManager::instance()->defaultKeystorePath(),
certificatePassword, m_ui->devicePin->text());
}
......
......@@ -61,7 +61,7 @@ BlackBerryDeviceConnection::BlackBerryDeviceConnection() :
void BlackBerryDeviceConnection::connectDevice(const ProjectExplorer::IDevice::ConstPtr &device)
{
Utils::Environment env = Utils::Environment::systemEnvironment();
env.modify(BlackBerryConfigurationManager::instance().defaultConfigurationEnv());
env.modify(BlackBerryConfigurationManager::instance()->defaultConfigurationEnv());
m_process->setEnvironment(env.toStringList());
......
......@@ -114,9 +114,9 @@ void BlackBerryDeviceConnectionManager::connectDevice(Core::Id deviceId)
// BlackBerry Device connection needs the Qnx environments to be set
// in order to find the Connect.jar package.
// Let's delay the device connections at startup till the Qnx settings are loaded.
if (BlackBerryConfigurationManager::instance().apiLevels().isEmpty()) {
if (BlackBerryConfigurationManager::instance()->apiLevels().isEmpty()) {
m_pendingDeviceConnections << device;
connect(&BlackBerryConfigurationManager::instance(), SIGNAL(settingsLoaded()),
connect(BlackBerryConfigurationManager::instance(), SIGNAL(settingsLoaded()),
this, SLOT(processPendingDeviceConnections()), Qt::UniqueConnection);
return;
}
......@@ -308,14 +308,14 @@ void BlackBerryDeviceConnectionManager::handleProcessOutput(const QString &outpu
void BlackBerryDeviceConnectionManager::processPendingDeviceConnections()
{
if (m_pendingDeviceConnections.isEmpty()
|| BlackBerryConfigurationManager::instance().apiLevels().isEmpty())
|| BlackBerryConfigurationManager::instance()->apiLevels().isEmpty())
return;
foreach (ProjectExplorer::IDevice::ConstPtr device, m_pendingDeviceConnections)
connectDevice(device);
m_pendingDeviceConnections.clear();
disconnect(&BlackBerryConfigurationManager::instance(), SIGNAL(settingsLoaded()),
disconnect(BlackBerryConfigurationManager::instance(), SIGNAL(settingsLoaded()),
this, SLOT(processPendingDeviceConnections()));
}
......
......@@ -57,7 +57,7 @@ void BlackBerryDeviceListDetector::detectDeviceList()
return;
m_process->setEnvironment(Utils::EnvironmentItem::toStringList(
BlackBerryConfigurationManager::instance().defaultConfigurationEnv()));
BlackBerryConfigurationManager::instance()->defaultConfigurationEnv()));
const QString command = BlackBerryNdkProcess::resolveNdkToolPath(QLatin1String("blackberry-deploy"));
QStringList arguments;
arguments << QLatin1String("-devices");
......
......@@ -485,7 +485,7 @@ void BlackBerryInstallWizardProcessPage::processTarget()
// deactivate target if activated before uninstalling
if (m_data.mode == BlackBerryInstallerDataHandler::UninstallMode) {
foreach (BlackBerryApiLevelConfiguration *config, BlackBerryConfigurationManager::instance().apiLevels()) {
foreach (BlackBerryApiLevelConfiguration *config, BlackBerryConfigurationManager::instance()->apiLevels()) {
if (m_data.target.contains((config->targetName())) && config->isActive()) {
config->deactivate();
break;
......@@ -521,13 +521,13 @@ void BlackBerryInstallWizardFinalPage::initializePage()
layout->addWidget(label);
if (m_data.mode == BlackBerryInstallerDataHandler::ManuallMode) {
BlackBerryConfigurationManager &configManager = BlackBerryConfigurationManager::instance();
BlackBerryConfigurationManager *configManager = BlackBerryConfigurationManager::instance();
BlackBerryApiLevelConfiguration *config =
configManager.apiLevelFromEnvFile(Utils::FileName::fromString(m_data.ndkPath));
configManager->apiLevelFromEnvFile(Utils::FileName::fromString(m_data.ndkPath));
if (!config) {
config = new BlackBerryApiLevelConfiguration(Utils::FileName::fromString(m_data.ndkPath));
if (!configManager.addApiLevel(config)) {
if (!configManager->addApiLevel(config)) {
delete config;
// TODO: more explicit error message!
label->setText(tr("An error has occurred while adding target from:\n %1").arg(m_data.ndkPath));
......
......@@ -162,9 +162,7 @@ void BlackBerryKeysWidget::updateCertificateSection()
if (m_utils.hasDefaultCertificate()) {
setCreateCertificateVisible(false);
BlackBerryConfigurationManager &configManager = BlackBerryConfigurationManager::instance();
m_ui->certificatePath->setText(configManager.defaultKeystorePath());
m_ui->certificatePath->setText(BlackBerryConfigurationManager::instance()->defaultKeystorePath());
const BlackBerryCertificate *certificate = m_utils.defaultCertificate();
......@@ -279,8 +277,6 @@ void BlackBerryKeysWidget::removeDebugToken()
void BlackBerryKeysWidget::updateDebugToken(const QStringList &pins)
{
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
bool ok;
const QString cskPassword = m_utils.cskPassword(this, &ok);
if (!ok)
......@@ -292,7 +288,7 @@ void BlackBerryKeysWidget::updateDebugToken(const QStringList &pins)
const QString debugTokenPath = m_dtModel->item(m_ui->debugTokens->currentIndex().row(), 0)->text();
m_requester->requestDebugToken(debugTokenPath,
cskPassword, configuration.defaultKeystorePath(),
cskPassword, BlackBerryConfigurationManager::instance()->defaultKeystorePath(),
certificatePassword, pins.join(QLatin1String(",")));
}
......
......@@ -46,7 +46,7 @@ BlackBerryNdkProcess::BlackBerryNdkProcess(const QString &command, QObject *pare
{
m_process->setProcessChannelMode(QProcess::MergedChannels);
m_process->setEnvironment(Utils::EnvironmentItem::toStringList(
BlackBerryConfigurationManager::instance().defaultConfigurationEnv()));
BlackBerryConfigurationManager::instance()->defaultConfigurationEnv()));
connect(m_process, SIGNAL(started()), this, SIGNAL(started()));
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
......@@ -59,7 +59,7 @@ const QString BlackBerryNdkProcess::resolveNdkToolPath(const QString &tool)
{
QString toolPath;
QList<Utils::EnvironmentItem> qnxEnv =
BlackBerryConfigurationManager::instance().defaultConfigurationEnv();
BlackBerryConfigurationManager::instance()->defaultConfigurationEnv();
foreach (const Utils::EnvironmentItem &item, qnxEnv) {
if (item.name == QLatin1String("QNX_HOST") && !item.value.isEmpty()) {
toolPath = item.value
......
......@@ -72,9 +72,7 @@ void BlackBerryNDKSettingsPage::apply()
config->deactivate();
}
BlackBerryConfigurationManager &manager = BlackBerryConfigurationManager::instance();
manager.setDefaultConfiguration(m_widget->defaultApiLevel());
BlackBerryConfigurationManager::instance()->setDefaultConfiguration(m_widget->defaultApiLevel());
}
void BlackBerryNDKSettingsPage::finish()
......
......@@ -64,7 +64,7 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
updateInfoTable(0);
m_activatedApiLevel << m_bbConfigManager.activeApiLevels();
m_activatedApiLevel << m_bbConfigManager->activeApiLevels();
m_ui->ndksTreeWidget->header()->setResizeMode(QHeaderView::Stretch);
m_ui->ndksTreeWidget->header()->setStretchLastSection(false);
......@@ -105,12 +105,12 @@ BlackBerryNDKSettingsWidget::BlackBerryNDKSettingsWidget(QWidget *parent) :
connect(&m_timer, SIGNAL(timeout()), this, SLOT(updatePage()));
updatePage();
connect(&m_bbConfigManager, SIGNAL(settingsChanged()), &m_timer, SLOT(start()));
connect(m_bbConfigManager, SIGNAL(settingsChanged()), &m_timer, SLOT(start()));
}
bool BlackBerryNDKSettingsWidget::hasActiveNdk() const
{
return !m_bbConfigManager.apiLevels().isEmpty();
return !m_bbConfigManager->apiLevels().isEmpty();
}
QList<BlackBerryApiLevelConfiguration *> BlackBerryNDKSettingsWidget::activatedApiLevels()
......@@ -170,7 +170,7 @@ void BlackBerryNDKSettingsWidget::updateConfigurationList()
qDeleteAll(m_runtimes->takeChildren());
bool enableCleanUp = false;
foreach (BlackBerryApiLevelConfiguration *config, m_bbConfigManager.apiLevels()) {
foreach (BlackBerryApiLevelConfiguration *config, m_bbConfigManager->apiLevels()) {
QTreeWidgetItem *parent = config->isAutoDetected() ? m_autoDetectedNdks : m_manualApiLevel;
QTreeWidgetItem *item = new QTreeWidgetItem(parent);
item->setText(0, config->displayName());
......@@ -206,7 +206,7 @@ void BlackBerryNDKSettingsWidget::updateConfigurationList()
}
}
foreach (BlackBerryRuntimeConfiguration *runtime, m_bbConfigManager.runtimes()) {
foreach (BlackBerryRuntimeConfiguration *runtime, m_bbConfigManager->runtimes()) {
QTreeWidgetItem *item = new QTreeWidgetItem(m_runtimes);
item->setText(0, runtime->displayName());
item->setData(0, Qt::UserRole, QVariant::fromValue(static_cast<void*>(runtime)));
......@@ -250,7 +250,7 @@ void BlackBerryNDKSettingsWidget::removeConfiguration()
if (button == QMessageBox::Yes) {
m_activatedApiLevel.removeOne(config);
m_deactivatedApiLevel.removeOne(config);
m_bbConfigManager.removeApiLevel(config);
m_bbConfigManager->removeApiLevel(config);
m_manualApiLevel->removeChild(m_ui->ndksTreeWidget->currentItem());
emit configurationsUpdated();
}
......@@ -353,11 +353,11 @@ void BlackBerryNDKSettingsWidget::uninstallConfiguration(BlackBerryInstallerData
void BlackBerryNDKSettingsWidget::cleanUp()
{
foreach (BlackBerryApiLevelConfiguration *config, m_bbConfigManager.apiLevels()) {
foreach (BlackBerryApiLevelConfiguration *config, m_bbConfigManager->apiLevels()) {
if (!config->isValid()) {
m_activatedApiLevel.removeOne(config);
m_deactivatedApiLevel.removeOne(config);
m_bbConfigManager.removeApiLevel(config);
m_bbConfigManager->removeApiLevel(config);
}
}
......@@ -366,8 +366,8 @@ void BlackBerryNDKSettingsWidget::cleanUp()
void BlackBerryNDKSettingsWidget::handleInstallationFinished()
{
m_bbConfigManager.loadAutoDetectedApiLevels();
m_bbConfigManager.loadAutoDetectedRuntimes();
m_bbConfigManager->loadAutoDetectedApiLevels();
m_bbConfigManager->loadAutoDetectedRuntimes();
updateConfigurationList();
}
......@@ -380,7 +380,7 @@ void BlackBerryNDKSettingsWidget::handleUninstallationFinished()
if (current->parent() == m_runtimes) {
BlackBerryRuntimeConfiguration *runtime = static_cast<BlackBerryRuntimeConfiguration*>(
current->data(0, Qt::UserRole).value<void*>());
m_bbConfigManager.removeRuntime(runtime);
m_bbConfigManager->removeRuntime(runtime);
updateConfigurationList();
return;
}
......@@ -399,7 +399,7 @@ void BlackBerryNDKSettingsWidget::handleUninstallationFinished()
else if (m_deactivatedApiLevel.contains(config))
m_deactivatedApiLevel.removeAt(m_deactivatedApiLevel.indexOf(config));
m_bbConfigManager.removeApiLevel(config);
m_bbConfigManager->removeApiLevel(config);
updateConfigurationList();
}
......@@ -409,7 +409,7 @@ void BlackBerryNDKSettingsWidget::populateDefaultConfigurationCombo()
// prevent QComboBox::currentIndexChanged() from being emitted
m_ui->apiLevelCombo->clear();
QList<BlackBerryApiLevelConfiguration*> configurations = m_bbConfigManager.apiLevels();
QList<BlackBerryApiLevelConfiguration*> configurations = m_bbConfigManager->apiLevels();
m_ui->apiLevelCombo->addItem(tr("Newest Version"),
QVariant::fromValue(static_cast<void*>(0)));
......@@ -419,7 +419,7 @@ void BlackBerryNDKSettingsWidget::populateDefaultConfigurationCombo()
int configIndex = 0;
BlackBerryApiLevelConfiguration *defaultConfig = m_bbConfigManager.defaultApiLevel();
BlackBerryApiLevelConfiguration *defaultConfig = m_bbConfigManager->defaultApiLevel();
foreach (BlackBerryApiLevelConfiguration *config, configurations) {
m_ui->apiLevelCombo->addItem(config->displayName(),
......@@ -429,7 +429,7 @@ void BlackBerryNDKSettingsWidget::populateDefaultConfigurationCombo()
configIndex = m_ui->apiLevelCombo->count() - 1;
}
const int currentIndex = (m_bbConfigManager.newestApiLevelEnabled()) ? 0 : configIndex;
const int currentIndex = (m_bbConfigManager->newestApiLevelEnabled()) ? 0 : configIndex;
m_ui->apiLevelCombo->setCurrentIndex(currentIndex);
}
......
......@@ -86,7 +86,7 @@ private:
const QString& tagetVersion = QString());
Ui_BlackBerryNDKSettingsWidget *m_ui;
BlackBerryConfigurationManager &m_bbConfigManager;
BlackBerryConfigurationManager *m_bbConfigManager;
QTreeWidgetItem *m_apiLevels;
QTreeWidgetItem *m_runtimes;
......
......@@ -66,7 +66,7 @@ bool BlackBerryPotentialKit::isEnabled() const
bool BlackBerryPotentialKit::shouldShow()
{
QList<BlackBerryApiLevelConfiguration *> configs =
BlackBerryConfigurationManager::instance().apiLevels();
BlackBerryConfigurationManager::instance()->apiLevels();
if (configs.isEmpty())
return false; // do not display when we do not have any BlackBerry API Level registered
foreach (BlackBerryApiLevelConfiguration *config, configs) {
......@@ -104,7 +104,7 @@ BlackBerryPotentialKitWidget::BlackBerryPotentialKitWidget(QWidget *parent)
layout->addWidget(openOptions, 1, 1);
connect(openOptions, SIGNAL(clicked()), this, SLOT(openOptions()));
connect(&BlackBerryConfigurationManager::instance(), SIGNAL(settingsChanged()),
connect(BlackBerryConfigurationManager::instance(), SIGNAL(settingsChanged()),
this, SLOT(recheck()));
}
......
......@@ -129,7 +129,7 @@ APILevelSetupItem::APILevelSetupItem(QWidget *parent)
" for building BlackBerry applications."), parent)
{
validate();
connect(&BlackBerryConfigurationManager::instance(), SIGNAL(settingsChanged()),
connect(BlackBerryConfigurationManager::instance(), SIGNAL(settingsChanged()),
this, SLOT(validateLater()));
}
......@@ -158,7 +158,7 @@ void APILevelSetupItem::fix()
installAPILevel();
} else if (!found.testFlag(Active)) {
foreach (BlackBerryApiLevelConfiguration *config,
BlackBerryConfigurationManager::instance().apiLevels()) {
BlackBerryConfigurationManager::instance()->apiLevels()) {
if (config->isValid() && !config->isActive()) {
config->activate();
break;
......@@ -168,7 +168,7 @@ void APILevelSetupItem::fix()
// TODO: install filter for 10.2 only
installAPILevel();
} else if (!found.testFlag(V_10_2_AS_DEFAULT)) {
BlackBerryConfigurationManager::instance().setDefaultConfiguration(0);
BlackBerryConfigurationManager::instance()->setDefaultConfiguration(0);
}
}
......@@ -179,7 +179,7 @@ APILevelSetupItem::FoundTypes APILevelSetupItem::resolvedFoundType()
// TODO: for now, all Trunk versions are understood as 10.2 compliant
BlackBerryVersionNumber version_10_2(QLatin1String("10.2.0.0"));
foreach (BlackBerryApiLevelConfiguration *config,
BlackBerryConfigurationManager::instance().apiLevels()) {
BlackBerryConfigurationManager::instance()->apiLevels()) {
found |= Any;
if (config->isValid()) {
found |= Valid;
......@@ -191,7 +191,7 @@ APILevelSetupItem::FoundTypes APILevelSetupItem::resolvedFoundType()
}
BlackBerryApiLevelConfiguration *config =
BlackBerryConfigurationManager::instance().defaultApiLevel();
BlackBerryConfigurationManager::instance()->defaultApiLevel();
if (config && config->version() > version_10_2)
found |= V_10_2_AS_DEFAULT;
......@@ -211,7 +211,7 @@ void APILevelSetupItem::handleInstallationFinished()
{
// manually-added API Levels are automatically registered by BlackBerryInstallWizard
// auto-detected API Levels needs to reloaded explicitly
BlackBerryConfigurationManager::instance().loadAutoDetectedApiLevels();
BlackBerryConfigurationManager::instance()->loadAutoDetectedApiLevels();
validate();
}
......@@ -231,7 +231,7 @@ void SigningKeysSetupItem::validate()
set(Error, tr("Found legacy BlackBerry signing keys."), tr("Update"));
else if (!utils.hasRegisteredKeys())
set(Error, tr("Cannot find BlackBerry signing keys."), tr("Request"));
else if (!QFileInfo(BlackBerryConfigurationManager::instance().defaultKeystorePath()).exists())
else if (!QFileInfo(BlackBerryConfigurationManager::instance()->defaultKeystorePath()).exists())
set(Error, tr("Cannot find developer certificate."), tr("Create"));
else if (utils.defaultCertificateOpeningStatus() != BlackBerrySigningUtils::Opened)
set(Info, tr("Developer certificate is not opened."), tr("Open"));
......@@ -246,7 +246,7 @@ void SigningKeysSetupItem::fix()
QDesktopServices::openUrl(QUrl(QLatin1String(Qnx::Constants::QNX_LEGACY_KEYS_URL)));
} else if (!utils.hasRegisteredKeys()) {
QDesktopServices::openUrl(QUrl(QLatin1String(Qnx::Constants::QNX_REGISTER_KEYS_URL)));
} else if (!QFileInfo(BlackBerryConfigurationManager::instance().defaultKeystorePath()).exists()) {
} else if (!QFileInfo(BlackBerryConfigurationManager::instance()->defaultKeystorePath()).exists()) {
set(Info, tr("Opening certificate..."));
utils.createCertificate();
} else if (utils.defaultCertificateOpeningStatus() != BlackBerrySigningUtils::Opened) {
......
......@@ -68,27 +68,21 @@ BlackBerrySigningUtils::BlackBerrySigningUtils(QObject *parent) :
bool BlackBerrySigningUtils::hasRegisteredKeys()
{
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
QFileInfo cskFile(configuration.idTokenPath());
QFileInfo cskFile(BlackBerryConfigurationManager::instance()->idTokenPath());
return cskFile.exists();
}
bool BlackBerrySigningUtils::hasLegacyKeys()
{
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
QFileInfo cskFile(configuration.barsignerCskPath());
QFileInfo cskFile(BlackBerryConfigurationManager::instance()->barsignerCskPath());
return cskFile.exists();
}
bool BlackBerrySigningUtils::hasDefaultCertificate()
{
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
QFileInfo keystore(configuration.defaultKeystorePath());
QFileInfo keystore(BlackBerryConfigurationManager::instance()->defaultKeystorePath());
return keystore.exists();
}
......@@ -146,12 +140,10 @@ void BlackBerrySigningUtils::openDefaultCertificate(QWidget *passwordPromptParen
return;
}
BlackBerryConfigurationManager &configManager = BlackBerryConfigurationManager::instance();
if (m_defaultCertificate)
m_defaultCertificate->deleteLater();
m_defaultCertificate = new BlackBerryCertificate(configManager.defaultKeystorePath(),
m_defaultCertificate = new BlackBerryCertificate(BlackBerryConfigurationManager::instance()->defaultKeystorePath(),
QString(), password, this);
connect(m_defaultCertificate, SIGNAL(finished(int)), this, SLOT(certificateLoaded(int)));
......@@ -186,9 +178,7 @@ void BlackBerrySigningUtils::deleteDefaultCertificate()
m_defaultCertificate = 0;
m_defaultCertificateStatus = NotOpened;
BlackBerryConfigurationManager &configuration = BlackBerryConfigurationManager::instance();
QFile::remove(configuration.defaultKeystorePath());
QFile::remove(BlackBerryConfigurationManager::instance()->defaultKeystorePath());
}
QStringList BlackBerrySigningUtils::debugTokens() const
......
......@@ -93,6 +93,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
Q_UNUSED(errorString)
// Handles BlackBerry
addAutoReleasedObject(new BlackBerryConfigurationManager);
addAutoReleasedObject(new BlackBerryQtVersionFactory);
addAutoReleasedObject(new BlackBerryDeployConfigurationFactory);
addAutoReleasedObject(new BlackBerryDeviceConfigurationFactory);
......@@ -134,7 +135,8 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
}
addAutoReleasedObject(new BarDescriptorEditorFactory);
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()), &BlackBerryConfigurationManager::instance(), SLOT(loadSettings()));
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()),
BlackBerryConfigurationManager::instance(), SLOT(loadSettings()));
return true;
}
......@@ -479,12 +481,12 @@ void QNXPlugin::testConfigurationManager_data()
void QNXPlugin::testConfigurationManager()
{
BlackBerryConfigurationManager &manager = BlackBerryConfigurationManager::instance();
BlackBerryConfigurationManager *manager = BlackBerryConfigurationManager::instance();
QCOMPARE(manager.apiLevels().count(), 0);
QCOMPARE(manager.activeApiLevels().count(), 0);
QCOMPARE(manager.defaultApiLevel(), static_cast<BlackBerryApiLevelConfiguration*>(0));
QVERIFY(manager.newestApiLevelEnabled());
QCOMPARE(manager->apiLevels().count(), 0);
QCOMPARE(manager->activeApiLevels().count(), 0);
QCOMPARE(manager->defaultApiLevel(), static_cast<BlackBerryApiLevelConfiguration*>(0));
QVERIFY(manager->newestApiLevelEnabled());
QFETCH(QVariantMap, newerConfiguration);
QFETCH(QVariantMap, olderConfiguration);
......@@ -495,32 +497,32 @@ void QNXPlugin::testConfigurationManager()
BlackBerryApiLevelConfiguration *oldConfig =
new BlackBerryApiLevelConfiguration(olderConfiguration);
QVERIFY(manager.addApiLevel(oldConfig));
QVERIFY(manager.newestApiLevelEnabled());
QCOMPARE(manager.defaultApiLevel(), oldConfig);
QVERIFY(manager->addApiLevel(oldConfig));
QVERIFY(manager->newestApiLevelEnabled());
QCOMPARE(manager->defaultApiLevel(), oldConfig);
manager.setDefaultConfiguration(oldConfig);
manager->setDefaultConfiguration(oldConfig);
QCOMPARE(manager.defaultApiLevel(), oldConfig);
QCOMPARE(manager.apiLevels().first(), oldConfig);
QVERIFY(!manager.newestApiLevelEnabled());
QCOMPARE(manager->defaultApiLevel(), oldConfig);
QCOMPARE(manager->apiLevels().first(), oldConfig);
QVERIFY(!manager->newestApiLevelEnabled());
QVERIFY(manager.addApiLevel(newerConfig));
QCOMPARE(manager.apiLevels().first(), newerConfig);
QCOMPARE(manager.defaultApiLevel(), oldConfig);
QVERIFY(manager->addApiLevel(newerConfig));
QCOMPARE(manager->apiLevels().first(), newerConfig);
QCOMPARE(manager->defaultApiLevel(), oldConfig);
manager.setDefaultConfiguration(0);
QVERIFY(manager.newestApiLevelEnabled());
QCOMPARE(manager.defaultApiLevel(), newerConfig);
manager->setDefaultConfiguration(0);
QVERIFY(manager->newestApiLevelEnabled());
QCOMPARE(manager->defaultApiLevel(), newerConfig);
manager.setDefaultConfiguration(oldConfig);
manager.removeApiLevel(oldConfig);
QCOMPARE(manager.defaultApiLevel(), newerConfig);
QVERIFY(manager.newestApiLevelEnabled());
manager->setDefaultConfiguration(oldConfig);
manager->removeApiLevel(oldConfig);
QCOMPARE(manager->defaultApiLevel(), newerConfig);
QVERIFY(manager->newestApiLevelEnabled());
manager.removeApiLevel(newerConfig);
QCOMPARE(manager.defaultApiLevel(), static_cast<BlackBerryApiLevelConfiguration*>(0));
QVERIFY(manager.newestApiLevelEnabled());
manager->removeApiLevel(newerConfig);
QCOMPARE(manager->defaultApiLevel(), static_cast<BlackBerryApiLevelConfiguration*>(0));
QVERIFY(manager->newestApiLevelEnabled());
}
#endif
......
......@@ -87,8 +87,8 @@ ToolChainConfigWidget *QnxToolChain::configurationWidget()
void QnxToolChain::addToEnvironment(Utils::Environment &env) const
{