nfcsettings.h 1022 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#ifndef NFCSETTINGS_H
#define NFCSETTINGS_H

#include <systemsettingsglobal.h>

#include <QObject>
#include <QDBusInterface>
#include <QDBusPendingCallWatcher>
#include <QTimer>

class SYSTEMSETTINGS_EXPORT NfcSettings : public QObject
{
    Q_OBJECT
14
    Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
15 16
    Q_PROPERTY(bool available READ available NOTIFY availableChanged)
    Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
17

18 19 20 21
public:
    explicit NfcSettings(QObject *parent = nullptr);
    ~NfcSettings();

22
    bool valid() const;
23 24 25 26 27
    bool available() const;
    bool enabled() const;
    void setEnabled(bool enabled);

signals:
28
    void validChanged();
29 30 31 32
    void availableChanged();
    void enabledChanged();

private:
33
    bool m_valid;
34 35 36 37 38 39 40 41 42 43 44
    bool m_enabled;
    bool m_available;
    QDBusInterface *m_interface;
    QTimer *m_timer;

private slots:
    void getEnableStateFinished(QDBusPendingCallWatcher* call);
    void updateEnabledState(bool enabled);
};

#endif // NFCSETTINGS_H