ssud.h 1.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/**
 * @file ssud.h
 * @copyright 2013 Jolla Ltd.
 * @author Bernd Wachter <bwachter@lart.info>
 * @date 2013
 */

#ifndef _SSUD_H
#define _SSUD_H

#include <QObject>
#include <QString>
13
#include <QTimer>
14 15

#include "libssu/ssu.h"
16
#include "ssud_dbus.h"
17

18 19
class Ssud: public QObject
{
20 21
    Q_OBJECT

22 23
public:
    Ssud(QObject *parent = NULL);
24 25
    virtual ~Ssud();

26
public slots:
27
    /* device info */
28
    QString deviceModel();
29
    QString deviceFamily();
30
    QString deviceUid();
31
    QString deviceVariant();
32
    QString displayName(int type);
33
    /* credential management */
34 35 36
    bool isRegistered();
    void registerDevice(const QString &username, const QString &password);
    void unregisterDevice();
37
    QString domain();
38
    /* repository management */
39
    int deviceMode();
40 41
    void setDeviceMode(int mode);
    void setDeviceMode(int mode, int editMode);
42 43 44 45 46 47 48
    QString flavour();
    void setFlavour(const QString &release);
    QString release(bool rnd);
    void setRelease(const QString &release, bool rnd);
    void modifyRepo(int action, const QString &repo);
    void addRepo(const QString &repo, const QString &url);
    void updateRepos();
49
    QList<SsuRepo> listRepos(bool rnd);
50 51 52 53 54 55

    bool error();
    QString lastError();

    void quit();

56

57
signals:
58 59 60 61
    void done();
    void credentialsChanged();
    void registrationStatusChanged();

62
private:
63 64 65
    Ssu ssu;
    static const char *SERVICE_NAME;
    static const char *OBJECT_PATH;
66
    QTimer autoclose;
67 68

    enum Actions {
69 70 71 72
        Remove  = 0,
        Add     = 1,
        Disable = 2,
        Enable  = 3,
73
    };
74 75 76
};

#endif