Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WIP: An idea about the ssu/ssu.ini.
Signed-off-by: Marko Saukko <marko.saukko@jolla.com>
  • Loading branch information
saukko committed Apr 5, 2019
1 parent a470b9b commit 68584ce
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 2 deletions.
7 changes: 7 additions & 0 deletions libssu/ssucoreconfig.cpp
Expand Up @@ -71,6 +71,13 @@ QString SsuCoreConfig::domain(bool pretty){
return "";
}

QString SsuCoreConfig::brand(){
if (contains("brand"))
return value("brand").toString();
else
return "";
}

bool SsuCoreConfig::isRegistered(){
if (!contains("privateKey"))
return false;
Expand Down
5 changes: 5 additions & 0 deletions libssu/ssucoreconfig_p.h
Expand Up @@ -64,6 +64,11 @@ class SsuCoreConfig: public SsuSettings {
* @return domain, or "" if not set
*/
Q_INVOKABLE QString domain(bool pretty=false);
/**
* Get the current brand stored in the SSU_CONFIGURATION
* @return domain, or "" if not set
*/
Q_INVOKABLE QString brand();
/**
* Return devices RND registration status
* @retval true device is registered
Expand Down
2 changes: 1 addition & 1 deletion libssu/ssudeviceinfo.h
Expand Up @@ -66,7 +66,7 @@ class SsuDeviceInfo: public QObject {
/**
* Return a string suitable for display in dialogs, ...
*
* See Ssu::DeviceTypes for supported types.
* See Ssu::DisplayType for supported types.
*
* If not configured the model name used by ssu will be returned instead
* for product and type.
Expand Down
15 changes: 15 additions & 0 deletions ssucli/ssucli.cpp
Expand Up @@ -514,6 +514,19 @@ void SsuCli::optSet(QStringList opt){
state = Idle;
}

void SsuCli::optBrand(QStringList opt){
QTextStream qout(stdout);
SsuCoreConfig *ssuSettings = SsuCoreConfig::instance();

if (opt.count() == 3 && opt.at(2) == "-s"){
qout << ssuSettings->brand();
state = Idle;
} else if (opt.count() == 2){
qout << "Brand is: " << ssuSettings->brand() << endl;
state = Idle;
}
}

void SsuCli::optStatus(QStringList opt){
QTextStream qout(stdout);
QTextStream qerr(stderr);
Expand Down Expand Up @@ -625,6 +638,7 @@ void SsuCli::run(){
"update", "up", 0, -1, &SsuCli::optUpdateCredentials,
"domain", "do", 0, -1, &SsuCli::optDomain,
"set", "set", 0, -1, &SsuCli::optSet,
"brand", "", 0, -1, &SsuCli::optBrand,
};

bool found = false;
Expand Down Expand Up @@ -701,6 +715,7 @@ void SsuCli::usage(QString message){
<< "\t [-r] \toperate on repository only variables" << endl
<< "\t <variable> \tdisplay value of <variable>" << endl
<< "\t <variable> <value> \tset value of <variable> to <value>" << endl
<< "\tbrand \tdisplay the brand" << endl
<< endl
<< "Device management:" << endl
<< "\tstatus, s \tprint registration status and device information" << endl
Expand Down
1 change: 1 addition & 0 deletions ssucli/ssucli.h
Expand Up @@ -41,6 +41,7 @@ class SsuCli: public QObject {
void optRelease(QStringList opt);
void optRepos(QStringList opt);
void optSet(QStringList opt);
void optBrand(QStringList opt);
void optStatus(QStringList opt);
void optUpdateCredentials(QStringList opt);
void optUpdateRepos(QStringList opt);
Expand Down
2 changes: 1 addition & 1 deletion ssucli/ssuproxy.cpp
Expand Up @@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -c SsuProxy -p ssucli/ssuproxy.h:ssucli/ssuproxy.cpp dbus/org.nemo.ssu.xml
*
* qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
* qdbusxml2cpp is Copyright (C) 2016 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
Expand Down

0 comments on commit 68584ce

Please sign in to comment.