/
ssucli.h
92 lines (76 loc) · 1.7 KB
1
/**
2
* @file ssucli.h
3
4
5
6
7
* @copyright 2012 Jolla Ltd.
* @author Bernd Wachter <bernd.wachter@jollamobile.com>
* @date 2012
*/
8
9
#ifndef _SsuCli_H
#define _SsuCli_H
10
11
12
#include <QObject>
#include <QSettings>
13
#include <QStringList>
14
15
#include <QDebug>
16
#include "libssu/ssu.h"
17
#include "ssu_interface.h"
18
19
20
class SsuCli: public QObject
{
21
22
Q_OBJECT
23
public:
24
25
SsuCli();
~SsuCli();
26
27
public slots:
28
29
void run();
30
private:
31
Ssu ssu;
32
SsuProxy *ssuProxy;
33
QSettings settings;
34
int state;
35
void usage(const QString &message = QString());
36
void uidWarning();
37
void optDomain(QStringList opt);
38
39
void optFlavour(QStringList opt);
void optMode(QStringList opt);
40
void optModel(QStringList opt);
41
void optRegister(QStringList opt);
42
43
void optRelease(QStringList opt);
void optRepos(QStringList opt);
44
void optSet(QStringList opt);
45
void optStatus(QStringList opt);
46
void optUpdateCredentials(QStringList opt);
47
void optUpdateRepos(QStringList opt);
48
49
enum Actions {
50
51
52
53
Remove,
Add,
Disable,
Enable
54
55
};
56
57
void optModifyRepo(enum Actions action, QStringList opt);
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
void optAddRepo(QStringList opt)
{
optModifyRepo(Add, opt);
}
void optRemoveRepo(QStringList opt)
{
optModifyRepo(Remove, opt);
}
void optEnableRepo(QStringList opt)
{
optModifyRepo(Enable, opt);
}
void optDisableRepo(QStringList opt)
{
optModifyRepo(Disable, opt);
}
74
75
enum State {
76
77
78
Idle,
Busy,
UserError
79
};
80
81
82
QString fallingBackToDirectUse(const QDBusError &error) const;
83
private slots:
84
void handleResponse();
85
void handleDBusResponse();
86
87
signals:
88
89
90
91
92
void done();
};
#endif