File indexing completed on 2024-05-12 04:01:47

0001 /*
0002     SPDX-FileCopyrightText: 2010 Michael Zanetti <mzanetti@kde.org>
0003     SPDX-FileCopyrightText: 2010-2012 Lukáš Tinkl <ltinkl@redhat.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #ifndef UDISKSMANAGER_H
0009 #define UDISKSMANAGER_H
0010 
0011 #include "dbus/manager.h"
0012 #include "udisks2.h"
0013 #include "udisksdevice.h"
0014 
0015 #include <solid/devices/ifaces/devicemanager.h>
0016 
0017 #include <QSet>
0018 
0019 namespace Solid
0020 {
0021 namespace Backends
0022 {
0023 namespace UDisks2
0024 {
0025 class Manager : public Solid::Ifaces::DeviceManager
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     Manager(QObject *parent);
0031     QObject *createDevice(const QString &udi) override;
0032     QStringList devicesFromQuery(const QString &parentUdi, Solid::DeviceInterface::Type type) override;
0033     QStringList allDevices() override;
0034     QSet<Solid::DeviceInterface::Type> supportedInterfaces() const override;
0035     QString udiPrefix() const override;
0036     ~Manager() override;
0037 
0038 private Q_SLOTS:
0039     void slotInterfacesAdded(const QDBusObjectPath &object_path, const VariantMapMap &interfaces_and_properties);
0040     void slotInterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces);
0041     void slotMediaChanged(const QDBusMessage &msg);
0042 
0043 private:
0044     const QStringList &deviceCache();
0045     void introspect(const QString &path, bool checkOptical = false);
0046     void updateBackend(const QString &udi);
0047     QSet<Solid::DeviceInterface::Type> m_supportedInterfaces;
0048     org::freedesktop::DBus::ObjectManager m_manager;
0049     QStringList m_deviceCache;
0050 };
0051 
0052 }
0053 }
0054 }
0055 #endif // UDISKSMANAGER_H