Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.

Commit 44716f0

Browse files
monichneochapay
authored andcommitted
[settings-nfc] Add valid property to NfcSettings. Contibutes JB#48464
1 parent 1d160e3 commit 44716f0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/nfcsettings.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
NfcSettings::NfcSettings(QObject *parent)
4040
: QObject(parent)
41+
, m_valid(false)
4142
, m_enabled(false)
4243
, m_available(false)
4344
{
@@ -67,6 +68,11 @@ NfcSettings::~NfcSettings()
6768
{
6869
}
6970

71+
bool NfcSettings::valid() const
72+
{
73+
return m_valid;
74+
}
75+
7076
bool NfcSettings::available() const
7177
{
7278
return m_available;
@@ -89,6 +95,8 @@ void NfcSettings::getEnableStateFinished(QDBusPendingCallWatcher *call)
8995
qWarning() << "Get dbus error:" << reply.error();
9096
} else {
9197
updateEnabledState(reply.value());
98+
m_valid = true;
99+
emit validChanged();
92100
}
93101
call->deleteLater();
94102
}

src/nfcsettings.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,26 @@
1111
class SYSTEMSETTINGS_EXPORT NfcSettings : public QObject
1212
{
1313
Q_OBJECT
14-
14+
Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
1515
Q_PROPERTY(bool available READ available NOTIFY availableChanged)
1616
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
17+
1718
public:
1819
explicit NfcSettings(QObject *parent = nullptr);
1920
~NfcSettings();
2021

22+
bool valid() const;
2123
bool available() const;
2224
bool enabled() const;
2325
void setEnabled(bool enabled);
2426

2527
signals:
28+
void validChanged();
2629
void availableChanged();
2730
void enabledChanged();
2831

2932
private:
33+
bool m_valid;
3034
bool m_enabled;
3135
bool m_available;
3236
QDBusInterface *m_interface;

0 commit comments

Comments
 (0)