Commit 44716f0a authored by Slava Monich's avatar Slava Monich Committed by neochapay

[settings-nfc] Add valid property to NfcSettings. Contibutes JB#48464

parent 1d160e35
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
NfcSettings::NfcSettings(QObject *parent) NfcSettings::NfcSettings(QObject *parent)
: QObject(parent) : QObject(parent)
, m_valid(false)
, m_enabled(false) , m_enabled(false)
, m_available(false) , m_available(false)
{ {
...@@ -67,6 +68,11 @@ NfcSettings::~NfcSettings() ...@@ -67,6 +68,11 @@ NfcSettings::~NfcSettings()
{ {
} }
bool NfcSettings::valid() const
{
return m_valid;
}
bool NfcSettings::available() const bool NfcSettings::available() const
{ {
return m_available; return m_available;
...@@ -89,6 +95,8 @@ void NfcSettings::getEnableStateFinished(QDBusPendingCallWatcher *call) ...@@ -89,6 +95,8 @@ void NfcSettings::getEnableStateFinished(QDBusPendingCallWatcher *call)
qWarning() << "Get dbus error:" << reply.error(); qWarning() << "Get dbus error:" << reply.error();
} else { } else {
updateEnabledState(reply.value()); updateEnabledState(reply.value());
m_valid = true;
emit validChanged();
} }
call->deleteLater(); call->deleteLater();
} }
......
...@@ -11,22 +11,26 @@ ...@@ -11,22 +11,26 @@
class SYSTEMSETTINGS_EXPORT NfcSettings : public QObject class SYSTEMSETTINGS_EXPORT NfcSettings : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
Q_PROPERTY(bool available READ available NOTIFY availableChanged) Q_PROPERTY(bool available READ available NOTIFY availableChanged)
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
public: public:
explicit NfcSettings(QObject *parent = nullptr); explicit NfcSettings(QObject *parent = nullptr);
~NfcSettings(); ~NfcSettings();
bool valid() const;
bool available() const; bool available() const;
bool enabled() const; bool enabled() const;
void setEnabled(bool enabled); void setEnabled(bool enabled);
signals: signals:
void validChanged();
void availableChanged(); void availableChanged();
void enabledChanged(); void enabledChanged();
private: private:
bool m_valid;
bool m_enabled; bool m_enabled;
bool m_available; bool m_available;
QDBusInterface *m_interface; QDBusInterface *m_interface;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment