Solid

udisksdevicebackend.h
1/*
2 SPDX-FileCopyrightText: 2010 Michael Zanetti <mzanetti@kde.org>
3 SPDX-FileCopyrightText: 2010-2012 Lukáš Tinkl <ltinkl@redhat.com>
4 SPDX-FileCopyrightText: 2012 Dan Vrátil <dvratil@redhat.com>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#ifndef UDISKSDEVICEBACKEND_H
10#define UDISKSDEVICEBACKEND_H
11
12#include <QDBusObjectPath>
13#include <QObject>
14#include <QStringList>
15#include <QThreadStorage>
16
17#include "udisks2.h"
18
19namespace Solid
20{
21namespace Backends
22{
23namespace UDisks2
24{
25class DeviceBackend : public QObject
26{
28
29public:
30 static DeviceBackend *backendForUDI(const QString &udi, bool create = true);
31 static void destroyBackend(const QString &udi);
32
33 DeviceBackend(const QString &udi);
34 ~DeviceBackend() override;
35
36 QVariant prop(const QString &key) const;
37 bool propertyExists(const QString &key) const;
38 QVariantMap allProperties() const;
39
40 QStringList interfaces() const;
41 const QString &udi() const;
42
43 void invalidateProperties();
45 void propertyChanged(const QMap<QString, int> &changeMap);
46 void changed();
47
48private Q_SLOTS:
49 void slotInterfacesAdded(const QDBusObjectPath &object_path, const VariantMapMap &interfaces_and_properties);
50 void slotInterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces);
51 void slotPropertiesChanged(const QString &ifaceName, const QVariantMap &changedProps, const QStringList &invalidatedProps);
52
53private:
54 void initInterfaces();
55 QString introspect() const;
56 void checkCache(const QString &key) const;
57 void cacheProperty(const QString &key, const QVariant &value) const;
58
59 // NOTE: make sure to insert items only through cacheProperty
60 mutable QVariantMap m_propertyCache;
61 QStringList m_interfaces;
62 QString m_udi;
63
65};
66
67} /* namespace UDisks2 */
68} /* namespace Backends */
69} /* namespace Solid */
70
71#endif /* UDISKSDEVICEBACKEND_H */
The single responsibility of this class is to create arguments valid for logind Inhibit call.
Definition fakebattery.h:16
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:08:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.