Commit c2a459be authored by pvuorela's avatar pvuorela

Merge branch 'master' into 'master'

Cleanups

See merge request !9
parents 35dba2bc aec48298
......@@ -26,7 +26,7 @@ QString DeclarativeSsuDeviceInfo::deviceModel()
return info.deviceModel();
}
QString DeclarativeSsuDeviceInfo::displayName(const int type)
QString DeclarativeSsuDeviceInfo::displayName(int type)
{
return info.displayName(type);
}
......
......@@ -32,16 +32,19 @@ public:
* multithreaded environment, unless you like funny results.
*/
Q_INVOKABLE QString deviceFamily();
/**
* Try to find the device variant for the system this is running on.
* If the device is not a variant it will return an empty string. If
* fallback is set to true it return the device model in this case.
*/
Q_INVOKABLE QString deviceVariant(bool fallback = false);
/**
* Try to find out ond what kind of system this is running
*/
Q_INVOKABLE QString deviceModel();
/**
* Return a string suitable for display in dialogs, ...
*
......@@ -52,7 +55,7 @@ public:
* If no manufacturer is found UNKNOWN is returned.
* For an invalid type an empty string is returned.
*/
Q_INVOKABLE QString displayName(const int type);
Q_INVOKABLE QString displayName(int type);
private:
SsuDeviceInfo info;
......
......@@ -79,7 +79,7 @@ Sandbox::~Sandbox()
}
if (!m_tempDir.isEmpty() && QFileInfo(m_tempDir).exists()) {
if (QProcess::execute("rm", QStringList() << "-rf" << m_tempDir) != 0) {
if (!QDir(m_tempDir).removeRecursively()) {
qWarning("%s: Failed to remove temporary directory", Q_FUNC_INFO);
}
}
......@@ -276,7 +276,7 @@ bool Sandbox::prepare()
QString Sandbox::createTmpDir(const QString &nameTemplate)
{
static const int REASONABLE_REPEAT_COUNT = 10;
const int REASONABLE_REPEAT_COUNT = 10;
for (int i = 0; i < REASONABLE_REPEAT_COUNT; ++i) {
QString path;
......
......@@ -37,7 +37,8 @@ static void restoreUid()
}
}
Ssu::Ssu(): QObject()
Ssu::Ssu()
: QObject()
{
errorFlag = false;
pendingRequests = 0;
......@@ -75,13 +76,13 @@ Ssu::Ssu(): QObject()
// FIXME, the whole credentials stuff needs reworking
// should probably be part of repo handling instead of core configuration
QPair<QString, QString> Ssu::credentials(QString scope)
QPair<QString, QString> Ssu::credentials(const QString &scope)
{
SsuCoreConfig *settings = SsuCoreConfig::instance();
return settings->credentials(scope);
}
QString Ssu::credentialsScope(QString repoName, bool rndRepo)
QString Ssu::credentialsScope(const QString &repoName, bool rndRepo)
{
SsuCoreConfig *settings = SsuCoreConfig::instance();
SsuSettings repoSettings(SSU_REPO_CONFIGURATION, QSettings::IniFormat);
......@@ -124,7 +125,7 @@ QString Ssu::credentialsScope(QString repoName, bool rndRepo)
return settings->credentialsScope(repoName, rndRepo);
}
QString Ssu::credentialsUrl(QString scope)
QString Ssu::credentialsUrl(const QString &scope)
{
SsuCoreConfig *settings = SsuCoreConfig::instance();
return settings->credentialsUrl(scope);
......@@ -178,19 +179,19 @@ void Ssu::setDeviceMode(Ssu::DeviceModeFlags mode, enum Ssu::EditMode editMode)
settings->setDeviceMode(mode, editMode);
}
void Ssu::setFlavour(QString flavour)
void Ssu::setFlavour(const QString &flavour)
{
SsuCoreConfig *settings = SsuCoreConfig::instance();
settings->setFlavour(flavour);
}
void Ssu::setRelease(QString release, bool rnd)
void Ssu::setRelease(const QString &release, bool rnd)
{
SsuCoreConfig *settings = SsuCoreConfig::instance();
settings->setRelease(release, rnd);
}
void Ssu::setDomain(QString domain)
void Ssu::setDomain(const QString &domain)
{
SsuCoreConfig *settings = SsuCoreConfig::instance();
settings->setDomain(domain);
......@@ -223,8 +224,9 @@ bool Ssu::registerDevice(QDomDocument *response)
settings->setValue("registered", false);
setError("Certificate is invalid");
return false;
} else
} else {
settings->setValue("certificate", certificate.toPem());
}
QString privateKeyString = response->elementsByTagName("privateKey").at(0).toElement().text();
QSslKey privateKey(privateKeyString.toLatin1(), QSsl::Rsa);
......@@ -233,8 +235,9 @@ bool Ssu::registerDevice(QDomDocument *response)
settings->setValue("registered", false);
setError("Private key is invalid");
return false;
} else
} else {
settings->setValue("privateKey", privateKey.toPem());
}
// oldUser is just for reference purposes, in case we want to notify
// about owner changes for the device
......@@ -256,7 +259,7 @@ bool Ssu::registerDevice(QDomDocument *response)
// RND repos have flavour (devel, testing, release), and release (latest, next)
// Release repos only have release (latest, next, version number)
QString Ssu::repoUrl(QString repoName, bool rndRepo,
QString Ssu::repoUrl(const QString &repoName, bool rndRepo,
QHash<QString, QString> repoParameters,
QHash<QString, QString> parametersOverride)
{
......@@ -289,7 +292,7 @@ void Ssu::requestFinished(QNetworkReply *reply)
/// @TODO: indicate that the device is not registered if there's a 404 on credentials update url
if (settings->contains("home-url")) {
QString homeUrl = settings->value("home-url").toString().arg("");
QString homeUrl = settings->value("home-url").toString().arg(QString());
homeUrl.remove(QRegExp("//+$"));
if (request.url().toString().startsWith(homeUrl, Qt::CaseInsensitive)) {
......@@ -353,11 +356,11 @@ success:
}
}
void Ssu::sendRegistration(QString usernameDomain, QString password)
void Ssu::sendRegistration(const QString &usernameDomain, const QString &password)
{
errorFlag = false;
QString ssuCaCertificate, ssuRegisterUrl;
QString ssuRegisterUrl;
QString username, domainName;
SsuLog *ssuLog = SsuLog::instance();
......@@ -381,7 +384,7 @@ void Ssu::sendRegistration(QString usernameDomain, QString password)
setDomain(settings->value("default-rnd-domain").toString());
}
ssuCaCertificate = SsuRepoManager::caCertificatePath();
QString ssuCaCertificate = SsuRepoManager::caCertificatePath();
if (ssuCaCertificate.isEmpty()) {
setError("CA certificate for ssu not set ('_ca-certificate in domain')");
return;
......@@ -393,11 +396,12 @@ void Ssu::sendRegistration(QString usernameDomain, QString password)
setError("URL for ssu registration not set (config key 'register-url')");
return;
}
} else
} else {
ssuRegisterUrl = settings->value("register-url").toString();
}
QString IMEI = deviceInfo.deviceUid();
if (IMEI == "") {
if (IMEI.isEmpty()) {
setError("No valid UID available for your device. For phones: is your modem online?");
return;
}
......@@ -432,10 +436,8 @@ void Ssu::sendRegistration(QString usernameDomain, QString password)
ssuLog->print(LOG_DEBUG, QString("Sending request to %1")
.arg(request.url().url()));
QNetworkReply *reply;
pendingRequests++;
reply = manager->post(request, form.query(QUrl::FullyEncoded).toStdString().c_str());
manager->post(request, form.query(QUrl::FullyEncoded).toStdString().c_str());
// we could expose downloadProgress() from reply in case we want progress info
QString homeUrl = settings->value("home-url").toString().arg(username);
......@@ -482,7 +484,7 @@ bool Ssu::setCredentials(QDomDocument *response)
credentialScopes.append(scope);
}
} else {
setError("");
setError(QString());
return false;
}
}
......@@ -494,7 +496,7 @@ bool Ssu::setCredentials(QDomDocument *response)
return true;
}
void Ssu::setError(QString errorMessage)
void Ssu::setError(const QString &errorMessage)
{
errorFlag = true;
errorString = errorMessage;
......@@ -509,7 +511,7 @@ void Ssu::setError(QString errorMessage)
emit done();
}
void Ssu::storeAuthorizedKeys(QByteArray data)
void Ssu::storeAuthorizedKeys(const QByteArray &data)
{
QDir dir;
SsuLog *ssuLog = SsuLog::instance();
......@@ -537,8 +539,9 @@ void Ssu::storeAuthorizedKeys(QByteArray data)
ssuLog->print(LOG_DEBUG, QString("Dropping to %1/%2 for writing authorized keys")
.arg(uid_min)
.arg(pw->pw_gid));
} else
} else {
return;
}
homePath = Sandbox::map(homePath);
......@@ -549,13 +552,14 @@ void Ssu::storeAuthorizedKeys(QByteArray data)
return;
}
if (!dir.exists(homePath + "/.ssh"))
if (!dir.exists(homePath + "/.ssh")) {
if (!dir.mkdir(homePath + "/.ssh")) {
ssuLog->print(LOG_DEBUG, QString("Unable to create .ssh in %1")
.arg(homePath));
restoreUid();
return;
}
}
QFile::setPermissions(homePath + "/.ssh",
QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner);
......@@ -579,7 +583,7 @@ void Ssu::updateCredentials(bool force)
SsuLog *ssuLog = SsuLog::instance();
if (deviceInfo.deviceUid() == "") {
if (deviceInfo.deviceUid().isEmpty()) {
setError("No valid UID available for your device. For phones: is your modem online?");
return;
}
......@@ -597,8 +601,9 @@ void Ssu::updateCredentials(bool force)
setError("URL for credentials update not set (config key 'credentials-url')");
return;
}
} else
} else {
ssuCredentialsUrl = settings->value("credentials-url").toString();
}
if (!isRegistered()) {
setError("Device is not registered.");
......@@ -661,8 +666,9 @@ void Ssu::updateStoreCredentials()
if (settings->value("ignore-credential-errors").toBool() == true) {
ssuLog->print(LOG_WARNING, QString("Warning: ignore-credential-errors is set, passing auth errors down to libzypp"));
ssuLog->print(LOG_WARNING, QString("Store credentials not received. %1").arg(reply.error().message()));
} else
} else {
setError(QString("Store credentials not received. %1").arg(reply.error().message()));
}
} else {
SsuCoreConfig *settings = SsuCoreConfig::instance();
settings->beginGroup("credentials-store");
......
......@@ -85,7 +85,7 @@ public:
* Find a username/password pair for the given scope
* @return a QPair with username and password, or an empty QPair if scope is invalid
*/
QPair<QString, QString> credentials(QString scope);
QPair<QString, QString> credentials(const QString &scope);
/**
* Get the scope for a repository, taking into account different scopes for
* release and RnD repositories
......@@ -95,11 +95,11 @@ public:
*
* @return a string containing the scope; it can be used to look up login credentials using credentials()
*/
QString credentialsScope(QString repoName, bool rndRepo = false);
QString credentialsScope(const QString &repoName, bool rndRepo = false);
/**
* Return the URL for which credentials scope is valid
*/
QString credentialsUrl(QString scope);
QString credentialsUrl(const QString &scope);
/**
* Returns if the last operation was successful
* @retval true last operation was successful
......@@ -116,7 +116,7 @@ public:
* Resolve a repository url
* @return the repository URL on success, an empty string on error
*/
QString repoUrl(QString repoName, bool rndRepo = false,
QString repoUrl(const QString &repoName, bool rndRepo = false,
QHash<QString, QString> repoParameters = QHash<QString, QString>(),
QHash<QString, QString> parametersOverride = QHash<QString, QString>());
/**
......@@ -146,11 +146,11 @@ public:
/// See SsuCoreConfig::setDeviceMode
Q_INVOKABLE void setDeviceMode(DeviceModeFlags mode, enum EditMode editMode = Replace);
/// See SsuCoreConfig::setFlavour
Q_INVOKABLE void setFlavour(QString flavour);
Q_INVOKABLE void setFlavour(const QString &flavour);
/// See SsuCoreConfig::setRelease
Q_INVOKABLE void setRelease(QString release, bool rnd = false);
Q_INVOKABLE void setRelease(const QString &release, bool rnd = false);
/// See SsuCoreConfig::setDomain
Q_INVOKABLE void setDomain(QString domain);
Q_INVOKABLE void setDomain(const QString &domain);
/// See SsuCoreConfig::useSslVerify
Q_INVOKABLE bool useSslVerify();
......@@ -162,7 +162,7 @@ private:
bool registerDevice(QDomDocument *response);
bool setCredentials(QDomDocument *response);
bool verifyResponse(QDomDocument *response);
void storeAuthorizedKeys(QByteArray data);
void storeAuthorizedKeys(const QByteArray &data);
private slots:
void requestFinished(QNetworkReply *reply);
......@@ -170,7 +170,7 @@ private slots:
* Set errorString returned by lastError to errorMessage, set
* errorFlag returned by error() to true, and emit done()
*/
void setError(QString errorMessage);
void setError(const QString &errorMessage);
public slots:
/**
......@@ -182,7 +182,7 @@ public slots:
* error() to check if an error occured, and use lastError() to retrieve the last
* error message.
*/
void sendRegistration(QString username, QString password);
void sendRegistration(const QString &username, const QString &password);
/**
* Try to update the RND repository credentials. The device needs to be registered
* for this to work. updateCredentials remembers the time of the last credentials
......
......@@ -25,7 +25,7 @@ SsuCoreConfig *SsuCoreConfig::instance()
return ssuCoreConfig;
}
QPair<QString, QString> SsuCoreConfig::credentials(QString scope)
QPair<QString, QString> SsuCoreConfig::credentials(const QString &scope)
{
QPair<QString, QString> ret;
beginGroup("credentials-" + scope);
......@@ -35,7 +35,7 @@ QPair<QString, QString> SsuCoreConfig::credentials(QString scope)
return ret;
}
QString SsuCoreConfig::credentialsScope(QString repoName, bool rndRepo)
QString SsuCoreConfig::credentialsScope(const QString &repoName, bool rndRepo)
{
Q_UNUSED(repoName)
Q_UNUSED(rndRepo)
......@@ -46,7 +46,7 @@ QString SsuCoreConfig::credentialsScope(QString repoName, bool rndRepo)
return "your-configuration-is-broken-and-does-not-contain-credentials-scope";
}
QString SsuCoreConfig::credentialsUrl(QString scope)
QString SsuCoreConfig::credentialsUrl(const QString &scope)
{
if (contains("credentials-url-" + scope))
return value("credentials-url-" + scope).toString();
......@@ -77,8 +77,9 @@ QString SsuCoreConfig::domain(bool pretty)
return value("domain").toString().replace(":", "-");
else
return value("domain").toString();
} else
return "";
} else {
return QString();
}
}
bool SsuCoreConfig::isRegistered()
......@@ -111,14 +112,15 @@ void SsuCoreConfig::setDeviceMode(Ssu::DeviceModeFlags mode, enum Ssu::EditMode
oldMode |= mode;
} else if ((editMode & Ssu::Remove) == Ssu::Remove) {
oldMode &= ~mode;
} else
} else {
oldMode = mode;
}
setValue("deviceMode", oldMode);
sync();
}
void SsuCoreConfig::setFlavour(QString flavour)
void SsuCoreConfig::setFlavour(const QString &flavour)
{
setValue("flavour", flavour);
// flavour is RnD only, so enable RnD mode
......@@ -126,7 +128,7 @@ void SsuCoreConfig::setFlavour(QString flavour)
sync();
}
void SsuCoreConfig::setRelease(QString release, bool rnd)
void SsuCoreConfig::setRelease(const QString &release, bool rnd)
{
if (rnd) {
setValue("rndRelease", release);
......@@ -139,11 +141,11 @@ void SsuCoreConfig::setRelease(QString release, bool rnd)
sync();
}
void SsuCoreConfig::setDomain(QString domain)
void SsuCoreConfig::setDomain(const QString &domain)
{
// - in domain messes with default section autodetection,
// so change it to :
setValue("domain", domain.replace("-", ":"));
setValue("domain", QString(domain).replace("-", ":"));
sync();
}
......
......@@ -34,7 +34,7 @@ public:
* Find a username/password pair for the given scope
* @return a QPair with username and password, or an empty QPair if scope is invalid
*/
QPair<QString, QString> credentials(QString scope);
QPair<QString, QString> credentials(const QString &scope);
/**
* Get the scope for a repository, taking into account different scopes for
* release and RnD repositories
......@@ -44,11 +44,11 @@ public:
*
* @return a string containing the scope; it can be used to look up login credentials using credentials()
*/
QString credentialsScope(QString repoName, bool rndRepo = false);
QString credentialsScope(const QString &repoName, bool rndRepo = false);
/**
* Return the URL for which credentials scope is valid
*/
QString credentialsUrl(QString scope);
QString credentialsUrl(const QString &scope);
/**
* Get the current flavour when RnD repositories are used
* @return current flavour (usually something like testing, release, ..)
......@@ -87,15 +87,15 @@ public:
/**
* Set the flavour used when resolving RND repositories
*/
Q_INVOKABLE void setFlavour(QString flavour);
Q_INVOKABLE void setFlavour(const QString &flavour);
/**
* Set the release version string for either a release, or a RnD snapshot
*/
Q_INVOKABLE void setRelease(QString release, bool rnd = false);
Q_INVOKABLE void setRelease(const QString &release, bool rnd = false);
/**
* Set the domain string (usually something like nemo, jolla, ..)
*/
Q_INVOKABLE void setDomain(QString domain);
Q_INVOKABLE void setDomain(const QString &domain);
/**
* Return configuration settings regarding ssl verification
* @retval true SSL verification must be used; that's the default if not configured
......
......@@ -23,7 +23,8 @@
#include "../constants.h"
SsuDeviceInfo::SsuDeviceInfo(QString model): QObject()
SsuDeviceInfo::SsuDeviceInfo(const QString &model)
: QObject()
{
boardMappings = new SsuSettings(SSU_BOARD_MAPPING_CONFIGURATION, SSU_BOARD_MAPPING_CONFIGURATION_DIR);
if (!model.isEmpty())
......@@ -101,9 +102,9 @@ QString SsuDeviceInfo::adaptationVariables(const QString &adaptationName, QHash<
void SsuDeviceInfo::clearCache()
{
cachedFamily = "";
cachedModel = "";
cachedVariant = "";
cachedFamily.clear();
cachedModel.clear();
cachedVariant.clear();
}
bool SsuDeviceInfo::contains(const QString &model)
......@@ -148,13 +149,11 @@ QString SsuDeviceInfo::deviceVariant(bool fallback)
if (!cachedVariant.isEmpty())
return cachedVariant;
cachedVariant = "";
if (boardMappings->contains("variants/" + deviceModel())) {
cachedVariant = boardMappings->value("variants/" + deviceModel()).toString();
}
if (cachedVariant == "" && fallback)
if (cachedVariant.isEmpty() && fallback)
return deviceModel();
return cachedVariant;
......@@ -162,19 +161,16 @@ QString SsuDeviceInfo::deviceVariant(bool fallback)
QString SsuDeviceInfo::deviceModel()
{
QDir dir;
QFile procCpuinfo;
QStringList keys;
if (!cachedModel.isEmpty())
return cachedModel;
boardMappings->beginGroup("file.exists");
keys = boardMappings->allKeys();
QStringList keys = boardMappings->allKeys();
// check if the device can be identified by testing for a file
foreach (const QString &key, keys) {
QString value = boardMappings->value(key).toString();
QDir dir;
if (dir.exists(Sandbox::map(value))) {
cachedModel = key;
break;
......@@ -184,6 +180,7 @@ QString SsuDeviceInfo::deviceModel()
if (!cachedModel.isEmpty()) return cachedModel;
// check if the device can be identified by a string in /proc/cpuinfo
QFile procCpuinfo;
procCpuinfo.setFileName(Sandbox::map("/proc/cpuinfo"));
procCpuinfo.open(QIODevice::ReadOnly | QIODevice::Text);
if (procCpuinfo.isOpen()) {
......@@ -328,7 +325,7 @@ QString SsuDeviceInfo::deviceUid()
}
ssuLog->print(LOG_CRIT, "Could not read fallback UID - returning empty string");
return "";
return QString();
}
QStringList SsuDeviceInfo::disabledRepos()
......@@ -343,13 +340,12 @@ QStringList SsuDeviceInfo::disabledRepos()
return result;
}
QString SsuDeviceInfo::displayName(const int type)
QString SsuDeviceInfo::displayName(int type)
{
QString model = deviceModel();
QString variant = deviceVariant(false);
QString value, key;
switch (type) {
case Ssu::DeviceManufacturer:
key = "/deviceManufacturer";
......@@ -361,7 +357,7 @@ QString SsuDeviceInfo::displayName(const int type)
key = "/deviceDesignation";
break;
default:
return "";
return QString();
}
/*
......@@ -374,7 +370,7 @@ QString SsuDeviceInfo::displayName(const int type)
if (boardMappings->contains(model + key))
value = boardMappings->value(model + key).toString();
else if (variant != "" && boardMappings->contains(variant + key))
else if (!variant.isEmpty() && boardMappings->contains(variant + key))
value = boardMappings->value(variant + key).toString();
else if (boardMappings->contains(key))
value = boardMappings->value(key).toString();
......@@ -433,33 +429,35 @@ QStringList SsuDeviceInfo::repos(bool rnd, int filter)
return result;
}
QVariant SsuDeviceInfo::variable(QString section, const QString &key)
QVariant SsuDeviceInfo::variable(const QString &section, const QString &key)
{
/// @todo compat-setting as ssudeviceinfo guaranteed to prepend sections with var-;
/// SsuVariables does not have this guarantee. Remove from here as well.
if (!section.startsWith("var-"))
section = "var-" + section;
QString varSection(section);
if (!varSection.startsWith("var-"))
varSection = "var-" + varSection;
return SsuVariables::variable(boardMappings, section, key);
return SsuVariables::variable(boardMappings, varSection, key);
}
void SsuDeviceInfo::variableSection(QString section, QHash<QString, QString> *storageHash)
void SsuDeviceInfo::variableSection(const QString &section, QHash<QString, QString> *storageHash)
{
if (!section.startsWith("var-"))
section = "var-" + section;
QString varSection(section);
if (!varSection.startsWith("var-"))
varSection = "var-" + varSection;
SsuVariables::variableSection(boardMappings, section, storageHash);
SsuVariables::variableSection(boardMappings, varSection, storageHash);
}
void SsuDeviceInfo::setDeviceModel(QString model)
void SsuDeviceInfo::setDeviceModel(const QString &model)
{
if (model == "")
cachedModel = "";
if (model.isEmpty())
cachedModel.clear();
else
cachedModel = model;
cachedFamily = "";
cachedVariant = "";
cachedFamily.clear();
cachedVariant.clear();
}
QVariant SsuDeviceInfo::value(const QString &key, const QVariant &value)
......
......@@ -22,7 +22,7 @@ public:
/**
* Initialize with device to override autodetection
*/
SsuDeviceInfo(QString model = "");
SsuDeviceInfo(const QString &model = QString());
virtual ~SsuDeviceInfo();
......@@ -30,43 +30,51 @@ public:
* Return the list of adaptations used for the set model
*/
QStringList adaptationRepos();
/**
* Resolve adaptation-specific variables for adaptationName, and store them in storageHash
* Returns "adaptation" if a valid adaptation was found, adaptationName otherwise
*/
QString adaptationVariables(const QString &adaptationName, QHash<QString, QString> *storageHash);
/**
* Check if a given model is available in the deviceinfo database, either directly,
* or as variant. If no model is provided as argument the autodetected or previously
* set model is used.
*/
bool contains(const QString &model = "");
bool contains(const QString &model = QString());
/**
* Try to find the device family for the system this is running on. This function
* temporarily changes the detected model, and therefore should not be used in a
* multithreaded environment, unless you like funny results.
*/
Q_INVOKABLE QString deviceFamily();
/**
* Try to find the device variant for the system this is running on.
* If the device is not a variant it will return an empty string. If
* fallback is set to true it return the device model in this case.
*/
Q_INVOKABLE QString deviceVariant(bool fallback = false);
/**
* Try to find out ond what kind of system this is running
*/
Q_INVOKABLE QString deviceModel();
/**
* Calculate the device ID used in ssu requests
* @return The first imei from oFono ModemManager API, if available, or WLAN mac address, or device uid fallback code similar to QDeviceInfo::uniqueDeviceID()
*/
Q_INVOKABLE QString deviceUid();
/**
* Return the list of repositories explicitely disabled for this device
* This does not include repositories only disabled in the user configuration.
*/
QStringList disabledRepos();
/**
* Return a string suitable for display in dialogs, ...
*
......@@ -77,7 +85,8 @@ public:
* If no manufacturer is found UNKNOWN is returned.
* For an invalid type an empty string is returned.
*/
Q_INVOKABLE QString displayName(const int type);
Q_INVOKABLE QString displayName(int type);
/**
* Return the complete list of repositories configured for a device.
* Depending on the filter options, all repostories (user and board),
......@@ -85,22 +94,26 @@ public:
* Disabled repositories are excluded depending on filter settings.
*/
QStringList repos(bool rnd = false, int filter = Ssu::NoFilter);
/**
* Override device model autodetection
*/
Q_INVOKABLE void setDeviceModel(QString model = "");
Q_INVOKABLE void setDeviceModel(const QString &model = QString());
/**
* Return a variable from the given variable section. 'var'- is automatically
* prepended to the section name if not specified already. Recursive search
* through several variable sections (specified in the section) is supported,
* returned will be the first occurence of the variable.
*/
QVariant variable(QString section, const QString &key);
QVariant variable(const QString &section, const QString &key);
/**
* Return the requested variable section. 'var-' is automatically
* prepended to the section name if not specified already.
*/
void variableSection(QString section, QHash<QString, QString> *storageHash);
void variableSection(const QString &section, QHash<QString, QString> *storageHash);
/**
* Return a value from an adaptation section. Returns an empty string
* or a given default value if key does not exist.
......@@ -111,7 +124,6 @@ public:
*/
QVariant value(const QString &key, const QVariant &value = QVariant());
private:
SsuSettings *boardMappings;
QString cachedFamily, cachedModel, cachedVariant;
......
......@@ -18,7 +18,8 @@
#include "../constants.h"