Commit 6b2162f2 authored by El Mehdi Fekari's avatar El Mehdi Fekari Committed by Mehdi Fekari

Qnx: Move the dataDirPath() method to QnxUtils class

Change-Id: I6bc02a83263da4ce01fe3238aefee20a68507595
Reviewed-by: default avatarTobias Nätterlund <tobias.naetterlund@kdab.com>
Reviewed-by: Nicolas Arnaud-Cormos's avatarNicolas Arnaud-Cormos <nicolas@kdab.com>
parent ab94f6eb
......@@ -56,7 +56,6 @@
#include <QFileInfo>
#include <QDir>
#include <QMessageBox>
#include <QDesktopServices>
namespace Qnx {
namespace Internal {
......@@ -449,46 +448,24 @@ 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 (Utils::HostOsInfo::isWindowsHost()) {
// Get the proper storage location on Windows using QDesktopServices,
// to not hardcode "AppData/Local", as it might refer to "AppData/Roaming".
QString dataDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
dataDir = dataDir.left(dataDir.indexOf(QCoreApplication::organizationName()));
dataDir.append(QLatin1String("Research in Motion"));
return dataDir;
}
return QString();
}
QString BlackBerryConfiguration::barsignerCskPath() const
{
return dataDirPath() + QLatin1String("/barsigner.csk");
return QnxUtils::dataDirPath() + QLatin1String("/barsigner.csk");
}
QString BlackBerryConfiguration::barsignerDbPath() const
{
return dataDirPath() + QLatin1String("/barsigner.db");
return QnxUtils::dataDirPath() + QLatin1String("/barsigner.db");
}
QString BlackBerryConfiguration::defaultKeystorePath() const
{
return dataDirPath() + QLatin1String("/author.p12");
return QnxUtils::dataDirPath() + QLatin1String("/author.p12");
}
QString BlackBerryConfiguration::defaultDebugTokenPath() const
{
return dataDirPath() + QLatin1String("/debugtoken.bar");
return QnxUtils::dataDirPath() + QLatin1String("/debugtoken.bar");
}
// TODO: QnxUtils::parseEnvFile() and qnxEnv() to return Util::Enviroment instead(?)
......
......@@ -83,7 +83,6 @@ public:
QString targetName() const;
QString barsignerCskPath() const;
QString barsignerDbPath() const;
QString dataDirPath() const;
QString defaultKeystorePath() const;
QString defaultDebugTokenPath() const;
void loadSettings();
......
......@@ -36,6 +36,7 @@
#include "blackberryconfiguration.h"
#include "blackberrydeviceconnectionmanager.h"
#include "qnxconstants.h"
#include "qnxutils.h"
#include <ssh/sshconnection.h>
#include <texteditor/texteditorsettings.h>
......@@ -81,7 +82,7 @@ BlackBerryDeviceConfigurationWidget::BlackBerryDeviceConfigurationWidget(const I
ui->debugToken->addButton(tr("Upload"), this, SLOT(uploadDebugToken()));
uploadButton = ui->debugToken->buttonAtIndex(2);
QString debugTokenBrowsePath = BlackBerryConfiguration::instance().dataDirPath();
QString debugTokenBrowsePath = QnxUtils::dataDirPath();
if (!QFileInfo(debugTokenBrowsePath).exists())
debugTokenBrowsePath = QDir::homePath();
ui->debugToken->setInitialBrowsePathBackup(debugTokenBrowsePath);
......
......@@ -36,6 +36,7 @@
#include "ui_blackberrydeviceconfigurationwizardsetuppage.h"
#include "ui_blackberrydeviceconfigurationwizardsshkeypage.h"
#include "blackberryconfiguration.h"
#include "qnxutils.h"
#include <coreplugin/icore.h>
#include <ssh/sshkeygenerator.h>
......@@ -70,7 +71,7 @@ BlackBerryDeviceConfigurationWizardSetupPage::BlackBerryDeviceConfigurationWizar
m_ui->debugToken->setExpectedKind(Utils::PathChooser::File);
m_ui->debugToken->setPromptDialogFilter(QLatin1String("*.bar"));
QString debugTokenBrowsePath = BlackBerryConfiguration::instance().dataDirPath();
QString debugTokenBrowsePath = QnxUtils::dataDirPath();
if (!QFileInfo(debugTokenBrowsePath).exists())
debugTokenBrowsePath = QDir::homePath();
m_ui->debugToken->setInitialBrowsePathBackup(debugTokenBrowsePath);
......@@ -168,7 +169,7 @@ BlackBerryDeviceConfigurationWizardSshKeyPage::BlackBerryDeviceConfigurationWiza
m_ui->privateKey->setExpectedKind(Utils::PathChooser::File);
m_ui->progressBar->hide();
QString initialBrowsePath = BlackBerryConfiguration::instance().dataDirPath();
QString initialBrowsePath = QnxUtils::dataDirPath();
if (!QFileInfo(initialBrowsePath).exists())
initialBrowsePath = QDir::homePath();
m_ui->privateKey->setInitialBrowsePathBackup(initialBrowsePath);
......@@ -267,7 +268,7 @@ bool BlackBerryDeviceConfigurationWizardSshKeyPage::saveKeys(const QString &priv
void BlackBerryDeviceConfigurationWizardSshKeyPage::generateSshKeys()
{
QString lookInDir = BlackBerryConfiguration::instance().dataDirPath();
QString lookInDir = QnxUtils::dataDirPath();
if (!QFileInfo(lookInDir).exists())
lookInDir = QDir::homePath();
......
......@@ -35,6 +35,7 @@
#include <utils/hostosinfo.h>
#include <QDir>
#include <QDesktopServices>
using namespace Qnx;
using namespace Qnx::Internal;
......@@ -213,3 +214,26 @@ Utils::FileName QnxUtils::executableWithExtension(const Utils::FileName &fileNam
result.append(QLatin1String(".exe"));
return result;
}
QString QnxUtils::dataDirPath()
{
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 (Utils::HostOsInfo::isWindowsHost()) {
// Get the proper storage location on Windows using QDesktopServices,
// to not hardcode "AppData/Local", as it might refer to "AppData/Roaming".
QString dataDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
dataDir = dataDir.left(dataDir.indexOf(QCoreApplication::organizationName()));
dataDir.append(QLatin1String("Research in Motion"));
return dataDir;
}
return QString();
}
......@@ -57,6 +57,7 @@ public:
static QString envFilePath(const QString & ndkPath);
static void prependQnxMapToEnvironment(const QMultiMap<QString, QString> &qnxMap, Utils::Environment &env);
static Utils::FileName executableWithExtension(const Utils::FileName &fileName);
static QString dataDirPath();
};
} // namespace Internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment