| 1 | /* |
|---|---|
| 2 | SPDX-FileCopyrightText: 2010 Michael Zanetti <mzanetti@kde.org> |
| 3 | SPDX-FileCopyrightText: 2010-2012 Lukáš Tinkl <ltinkl@redhat.com> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 6 | */ |
| 7 | |
| 8 | #ifndef UDISKSMANAGER_H |
| 9 | #define UDISKSMANAGER_H |
| 10 | |
| 11 | #include "dbus/manager.h" |
| 12 | #include "udisks2.h" |
| 13 | #include "udisksdevice.h" |
| 14 | |
| 15 | #include <solid/devices/ifaces/devicemanager.h> |
| 16 | |
| 17 | #include <QSet> |
| 18 | |
| 19 | namespace Solid |
| 20 | { |
| 21 | namespace Backends |
| 22 | { |
| 23 | namespace UDisks2 |
| 24 | { |
| 25 | class Manager : public Solid::Ifaces::DeviceManager |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | |
| 29 | public: |
| 30 | Manager(QObject *parent); |
| 31 | QObject *createDevice(const QString &udi) override; |
| 32 | QStringList devicesFromQuery(const QString &parentUdi, Solid::DeviceInterface::Type type) override; |
| 33 | QStringList allDevices() override; |
| 34 | QSet<Solid::DeviceInterface::Type> supportedInterfaces() const override; |
| 35 | QString udiPrefix() const override; |
| 36 | ~Manager() override; |
| 37 | |
| 38 | private Q_SLOTS: |
| 39 | void slotInterfacesAdded(const QDBusObjectPath &object_path, const VariantMapMap &interfaces_and_properties); |
| 40 | void slotInterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces); |
| 41 | void slotMediaChanged(const QDBusMessage &msg); |
| 42 | |
| 43 | private: |
| 44 | const QStringList &deviceCache(); |
| 45 | void introspect(const QString &path, bool checkOptical = false); |
| 46 | void updateBackend(const QString &udi); |
| 47 | QSet<Solid::DeviceInterface::Type> m_supportedInterfaces; |
| 48 | org::freedesktop::DBus::ObjectManager m_manager; |
| 49 | QStringList m_deviceCache; |
| 50 | }; |
| 51 | |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | #endif // UDISKSMANAGER_H |
| 56 |
