ssu
Loading...
Searching...
No Matches
ssucli.h
Go to the documentation of this file.
1
8
9/*
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24
25#ifndef _SsuCli_H
26#define _SsuCli_H
27
28#include <QObject>
29#include <QSettings>
30#include <QStringList>
31#include <QDebug>
32
33#include "libssu/ssu.h"
34#include "libssu/ssuproxy.h"
35
36class SsuCli: public QObject
37{
38 Q_OBJECT
39
40public:
41 SsuCli();
42 ~SsuCli();
43
44public slots:
45 void run();
46
47private:
48 Ssu ssu;
49 SsuProxy *ssuProxy;
50 QSettings settings;
51 int state;
52 void usage(const QString &message = QString());
53 void uidWarning();
54 void optBrand(QStringList opt);
55 void optDomain(QStringList opt);
56 void optFlavour(QStringList opt);
57 QString getModeString(int mode);
58 void optMode(QStringList opt);
59 void optModel(QStringList opt);
60 void optRegister(QStringList opt);
61 void optRelease(QStringList opt);
62 void optRepos(QStringList opt);
63 void optSet(QStringList opt);
64 void optStatus(QStringList opt);
65 void optUpdateCredentials(QStringList opt);
66 void optUpdateRepos(QStringList opt);
67
68 enum Actions {
69 Remove,
70 Add,
71 Disable,
72 Enable
73 };
74
75 void optModifyRepo(enum Actions action, QStringList opt);
76
77 void optAddRepo(QStringList opt)
78 {
79 optModifyRepo(Add, opt);
80 }
81 void optRemoveRepo(QStringList opt)
82 {
83 optModifyRepo(Remove, opt);
84 }
85 void optEnableRepo(QStringList opt)
86 {
87 optModifyRepo(Enable, opt);
88 }
89 void optDisableRepo(QStringList opt)
90 {
91 optModifyRepo(Disable, opt);
92 }
93
94 enum State {
95 Idle,
96 Busy,
97 UserError
98 };
99
100 QString fallingBackToDirectUse(const QDBusError &error) const;
101
102private slots:
103 void handleResponse();
104 void handleDBusResponse();
105
106signals:
107 void done();
108
109};
110
111#endif
Definition ssu.h:37