Solid

udisksstorageaccess.h
1/*
2 SPDX-FileCopyrightText: 2009 Pino Toscano <pino@kde.org>
3 SPDX-FileCopyrightText: 2009-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 UDISKSSTORAGEACCESS_H
9#define UDISKSSTORAGEACCESS_H
10
11#include "udisksdeviceinterface.h"
12#include <solid/devices/ifaces/storageaccess.h>
13
14#include <QDBusError>
15#include <QDBusMessage>
16
17namespace Solid
18{
19namespace Backends
20{
21namespace UDisks2
22{
23class StorageAccess : public DeviceInterface, virtual public Solid::Ifaces::StorageAccess
24{
27
28public:
29 StorageAccess(Device *device);
30 ~StorageAccess() override;
31
32 bool isAccessible() const override;
33 QString filePath() const override;
34 bool isIgnored() const override;
35 bool setup() override;
36 bool teardown() override;
37 bool isEncrypted() const override;
38
40 void accessibilityChanged(bool accessible, const QString &udi) override;
41 void setupDone(Solid::ErrorType error, QVariant errorData, const QString &udi) override;
42 void teardownDone(Solid::ErrorType error, QVariant errorData, const QString &udi) override;
43 void setupRequested(const QString &udi) override;
44 void teardownRequested(const QString &udi) override;
45
46public Q_SLOTS:
47 Q_SCRIPTABLE Q_NOREPLY void passphraseReply(const QString &passphrase);
48
49private Q_SLOTS:
50 void slotDBusReply(const QDBusMessage &reply);
51 void slotDBusError(const QDBusError &error);
52
53 void connectDBusSignals();
54
55 void slotSetupRequested();
56 void slotSetupDone(int error, const QString &errorString);
57 void slotTeardownRequested();
58 void slotTeardownDone(int error, const QString &errorString);
59
60 void checkAccessibility();
61
62private:
63 /// @return true if this device is luks and unlocked
64 bool isLuksDevice() const;
65
66 void updateCache();
67
68 bool mount();
69 bool unmount();
70
71 bool requestPassphrase();
72 void callCryptoSetup(const QString &passphrase);
73 bool callCryptoTeardown(bool actOnParent = false);
74
75 QString generateReturnObjectPath();
76 QString clearTextPath() const;
77
78private:
79 bool m_isAccessible;
80 bool m_setupInProgress;
81 bool m_teardownInProgress;
82 bool m_passphraseRequested;
83 QString m_lastReturnObject;
84
85 static const int s_unmountTimeout = 0x7fffffff;
86};
87}
88}
89}
90
91#endif // UDISKSSTORAGEACCESS_H
This device interface is available on volume devices.
The single responsibility of this class is to create arguments valid for logind Inhibit call.
Definition fakebattery.h:16
Q_INTERFACES(...)
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 Tue Mar 26 2024 11:17:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.