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
39 bool canCheck() const override;
40 bool check() override;
41 bool canRepair() const override;
42 bool repair() override;
43
45 void accessibilityChanged(bool accessible, const QString &udi) override;
46 void setupDone(Solid::ErrorType error, QVariant errorData, const QString &udi) override;
47 void teardownDone(Solid::ErrorType error, QVariant errorData, const QString &udi) override;
48 void setupRequested(const QString &udi) override;
49 void teardownRequested(const QString &udi) override;
50 void repairRequested(const QString &udi) override;
51 void repairDone(Solid::ErrorType error, QVariant errorData, const QString &udi) override;
52
53public Q_SLOTS:
54 Q_SCRIPTABLE Q_NOREPLY void passphraseReply(const QString &passphrase);
55
56private Q_SLOTS:
57 void slotDBusReply(const QDBusMessage &reply);
58 void slotDBusError(const QDBusError &error);
59
60 void connectDBusSignals();
61
62 void slotSetupRequested();
63 void slotSetupDone(int error, const QString &errorString);
64 void slotTeardownRequested();
65 void slotTeardownDone(int error, const QString &errorString);
66 void slotRepairRequested();
67 void slotRepairDone(int error, const QString &errorString);
68
69 void checkAccessibility();
70
71private:
72 /// @return true if this device is luks and unlocked
73 bool isLuksDevice() const;
74
75 void updateCache();
76
77 bool mount();
78 bool unmount();
79
80 bool requestPassphrase();
81 void callCryptoSetup(const QString &passphrase);
82 bool callCryptoTeardown(bool actOnParent = false);
83
84 QString generateReturnObjectPath();
85 QString clearTextPath() const;
86
87 QString dbusPath() const;
88
89private:
90 bool m_isAccessible;
91 bool m_setupInProgress;
92 bool m_teardownInProgress;
93 bool m_repairInProgress;
94 bool m_passphraseRequested;
95 QString m_lastReturnObject;
96
97 static const int s_unmountTimeout = 0x7fffffff;
98};
99}
100}
101}
102
103#endif // UDISKSSTORAGEACCESS_H
This device interface is available on volume devices.
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 Fri Nov 22 2024 12:01:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.