1/*
2 Copyright 2010 Michael Zanetti <mzanetti@kde.org>
3 Copyright 2010-2012 Lukáš Tinkl <ltinkl@redhat.com>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) version 3, or any
9 later version accepted by the membership of KDE e.V. (or its
10 successor approved by the membership of KDE e.V.), which shall
11 act as a proxy defined in Section 6 of version 3 of the license.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#ifndef UDISKS2DEVICE_H
23#define UDISKS2DEVICE_H
24
25#include "udisks2.h"
26
27#include <ifaces/device.h>
28#include <solid/deviceinterface.h>
29#include <solid/solidnamespace.h>
30
31#include <QtDBus/QDBusInterface>
32#include <QtDBus/QDBusObjectPath>
33#include <QtCore/QStringList>
34
35namespace Solid
36{
37namespace Backends
38{
39namespace UDisks2
40{
41
42class DeviceBackend;
43
44class Device: public Solid::Ifaces::Device
45{
46 Q_OBJECT
47public:
48 Device(const QString &udi);
49 virtual ~Device();
50
51 virtual QObject* createDeviceInterface(const Solid::DeviceInterface::Type& type);
52 virtual bool queryDeviceInterface(const Solid::DeviceInterface::Type& type) const;
53 virtual QString description() const;
54 virtual QStringList emblems() const;
55 virtual QString icon() const;
56 virtual QString product() const;
57 virtual QString vendor() const;
58 virtual QString udi() const;
59 virtual QString parentUdi() const;
60
61 QVariant prop(const QString &key) const;
62 bool propertyExists(const QString &key) const;
63 QVariantMap allProperties() const;
64
65 bool hasInterface(const QString & name) const;
66 QStringList interfaces() const;
67
68 QString errorToString(const QString & error) const;
69 Solid::ErrorType errorToSolidError(const QString & error) const;
70
71 bool isBlock() const;
72 bool isPartition() const;
73 bool isPartitionTable() const;
74 bool isStorageVolume() const;
75 bool isStorageAccess() const;
76 bool isDrive() const;
77 bool isOpticalDrive() const;
78 bool isOpticalDisc() const;
79 bool mightBeOpticalDisc() const;
80 bool isMounted() const;
81 bool isEncryptedContainer() const;
82 bool isEncryptedCleartext() const;
83 bool isSwap() const;
84 bool isLoop() const;
85
86 QString drivePath() const;
87
88Q_SIGNALS:
89 void changed();
90 void propertyChanged(const QMap<QString,int> &changes);
91
92protected:
93 QPointer<DeviceBackend> m_backend;
94
95private:
96 QString storageDescription() const;
97 QString volumeDescription() const;
98};
99
100}
101}
102}
103
104#endif // UDISKS2DEVICE_H
105