Skip to content

Latest commit

 

History

History
119 lines (107 loc) · 3.67 KB

ssucoreconfig_p.h

File metadata and controls

119 lines (107 loc) · 3.67 KB
 
Aug 21, 2015
Aug 21, 2015
2
* @file ssucoreconfig_p.h
3
4
5
6
7
* @copyright 2013 Jolla Ltd.
* @author Bernd Wachter <bwachter@lart.info>
* @date 2013
*/
Aug 21, 2015
Aug 21, 2015
8
9
#ifndef _SSUCORECONFIG_P_H
#define _SSUCORECONFIG_P_H
Aug 21, 2015
Aug 21, 2015
12
#include "ssusettings_p.h"
Apr 4, 2013
Apr 4, 2013
13
#include "ssu.h"
14
15
#ifndef SSU_CONFIGURATION
Oct 13, 2014
Oct 13, 2014
16
/// Path to the main ssu configuration file
17
18
19
20
#define SSU_CONFIGURATION "/etc/ssu/ssu.ini"
#endif
#ifndef SSU_DEFAULT_CONFIGURATION
Oct 13, 2014
Oct 13, 2014
21
/// Path to the main ssu configuration file
22
23
24
#define SSU_DEFAULT_CONFIGURATION "/usr/share/ssu/ssu-defaults.ini"
#endif
Nov 10, 2013
Nov 10, 2013
25
26
class QDBusConnection;
Oct 10, 2016
Oct 10, 2016
27
28
class SsuCoreConfig: public SsuSettings
{
Oct 10, 2016
Oct 10, 2016
31
public:
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
static SsuCoreConfig *instance();
/**
* 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);
/**
* Get the scope for a repository, taking into account different scopes for
* release and RnD repositories
*
* Please note that variable scope is not yet implemented -- one default scope is
* read from the configuration file.
*
* @return a string containing the scope; it can be used to look up login credentials using credentials()
*/
Oct 10, 2016
Oct 10, 2016
47
QString credentialsScope(QString repoName, bool rndRepo = false);
48
49
50
51
52
53
54
55
56
57
58
59
/**
* Return the URL for which credentials scope is valid
*/
QString credentialsUrl(QString scope);
/**
* Get the current flavour when RnD repositories are used
* @return current flavour (usually something like testing, release, ..)
*/
Q_INVOKABLE QString flavour();
/**
* Get the current mode bits for the device
*/
Feb 2, 2015
Feb 2, 2015
60
Q_INVOKABLE Ssu::DeviceModeFlags deviceMode();
61
62
/**
* Get the current domain used in registration
Jul 5, 2013
Jul 5, 2013
63
64
* Internally - in the domain is replaced by :, if you need
* to print the domain name set pretty to true
65
66
* @return domain, or "" if not set
*/
Oct 10, 2016
Oct 10, 2016
67
Q_INVOKABLE QString domain(bool pretty = false);
68
69
70
71
72
73
74
75
/**
* Return devices RND registration status
* @retval true device is registered
* @retval false device is not registered
*/
Q_INVOKABLE bool isRegistered();
/**
* Return the date/time when the credentials to access internal
Oct 13, 2014
Oct 13, 2014
76
* ssu servers were updated the last time
77
78
79
80
81
*/
Q_INVOKABLE QDateTime lastCredentialsUpdate();
/**
* Return the release version string for either a release, or a RnD snapshot
*/
Oct 10, 2016
Oct 10, 2016
82
Q_INVOKABLE QString release(bool rnd = false);
83
84
85
/**
* Set mode bits for the device
*/
Oct 10, 2016
Oct 10, 2016
86
Q_INVOKABLE void setDeviceMode(Ssu::DeviceModeFlags mode, enum Ssu::EditMode editMode = Ssu::Replace);
87
88
89
90
91
92
93
/**
* Set the flavour used when resolving RND repositories
*/
Q_INVOKABLE void setFlavour(QString flavour);
/**
* Set the release version string for either a release, or a RnD snapshot
*/
Oct 10, 2016
Oct 10, 2016
94
Q_INVOKABLE void setRelease(QString release, bool rnd = false);
95
96
97
98
99
100
101
102
103
104
/**
* Set the domain string (usually something like nemo, jolla, ..)
*/
Q_INVOKABLE void setDomain(QString domain);
/**
* Return configuration settings regarding ssl verification
* @retval true SSL verification must be used; that's the default if not configured
* @retval false SSL verification should be disabled
*/
Q_INVOKABLE bool useSslVerify();
Nov 10, 2013
Nov 10, 2013
105
106
107
108
/**
* Return a DBus connection object connected to the session bus of the active user
*/
static QDBusConnection userSessionBus();
Oct 10, 2016
Oct 10, 2016
111
private:
112
113
114
115
116
117
118
119
SsuCoreConfig(): SsuSettings(SSU_CONFIGURATION, QSettings::IniFormat, SSU_DEFAULT_CONFIGURATION) {};
SsuCoreConfig(const SsuCoreConfig &); // hide copy constructor
static SsuCoreConfig *ssuCoreConfig;
};
#endif