| 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 UDISKSDEVICE_H |
| 9 | #define UDISKSDEVICE_H |
| 10 | |
| 11 | #include "udisks2.h" |
| 12 | |
| 13 | #include <ifaces/device.h> |
| 14 | #include <solid/deviceinterface.h> |
| 15 | #include <solid/solidnamespace.h> |
| 16 | |
| 17 | #include <QDBusObjectPath> |
| 18 | #include <QStringList> |
| 19 | |
| 20 | namespace Solid |
| 21 | { |
| 22 | namespace Backends |
| 23 | { |
| 24 | namespace UDisks2 |
| 25 | { |
| 26 | class DeviceBackend; |
| 27 | class Manager; |
| 28 | |
| 29 | class Device : public Solid::Ifaces::Device |
| 30 | { |
| 31 | Q_OBJECT |
| 32 | public: |
| 33 | Device(Manager *manager, const QString &udi); |
| 34 | ~Device() override; |
| 35 | |
| 36 | Manager *manager() const; |
| 37 | |
| 38 | QObject *createDeviceInterface(const Solid::DeviceInterface::Type &type) override; |
| 39 | bool queryDeviceInterface(const Solid::DeviceInterface::Type &type) const override; |
| 40 | QString description() const override; |
| 41 | QStringList emblems() const override; |
| 42 | QString icon() const override; |
| 43 | QString product() const override; |
| 44 | QString vendor() const override; |
| 45 | QString udi() const override; |
| 46 | QString parentUdi() const override; |
| 47 | |
| 48 | QVariant prop(const QString &key) const; |
| 49 | bool propertyExists(const QString &key) const; |
| 50 | QVariantMap allProperties() const; |
| 51 | |
| 52 | bool hasInterface(const QString &name) const; |
| 53 | |
| 54 | QString errorToString(const QString &error) const; |
| 55 | Solid::ErrorType errorToSolidError(const QString &error) const; |
| 56 | |
| 57 | bool isBlock() const; |
| 58 | bool isPartition() const; |
| 59 | bool isPartitionTable() const; |
| 60 | bool isStorageVolume() const; |
| 61 | bool isStorageAccess() const; |
| 62 | bool isDrive() const; |
| 63 | bool isOpticalDrive() const; |
| 64 | bool isOpticalDisc() const; |
| 65 | bool mightBeOpticalDisc() const; |
| 66 | bool isMounted() const; |
| 67 | bool isEncryptedContainer() const; |
| 68 | bool isEncryptedCleartext() const; |
| 69 | bool isRoot() const; |
| 70 | bool isSwap() const; |
| 71 | bool isLoop() const; |
| 72 | |
| 73 | QString drivePath() const; |
| 74 | |
| 75 | Q_SIGNALS: |
| 76 | void changed(); |
| 77 | void propertyChanged(const QMap<QString, int> &changes); |
| 78 | |
| 79 | private: |
| 80 | Manager *m_manager; |
| 81 | QString m_udi; |
| 82 | |
| 83 | QString loopDescription() const; |
| 84 | QString storageDescription() const; |
| 85 | QString volumeDescription() const; |
| 86 | }; |
| 87 | |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | #endif // UDISKSDEVICE_H |
| 93 | |