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