Solid

ifaces/storageaccess.h
1/*
2 SPDX-FileCopyrightText: 2007 Kevin Ottens <ervin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef SOLID_IFACES_STORAGEACCESS_H
8#define SOLID_IFACES_STORAGEACCESS_H
9
10#include <solid/devices/ifaces/deviceinterface.h>
11#include <solid/storageaccess.h>
12
13namespace Solid
14{
15namespace Ifaces
16{
17/**
18 * This device interface is available on volume devices.
19 *
20 * A volume is anything that can contain data (partition, optical disc,
21 * memory card). It's a particular kind of block device.
22 */
23class StorageAccess : virtual public DeviceInterface
24{
25public:
26 /**
27 * Destroys a StorageVolume object.
28 */
29 ~StorageAccess() override;
30
31 /**
32 * Indicates if this volume is mounted.
33 *
34 * @return true if the volume is mounted
35 */
36 virtual bool isAccessible() const = 0;
37
38 /**
39 * Retrieves the absolute path of this volume mountpoint.
40 *
41 * @return the absolute path to the mount point if the volume is
42 * mounted, QString() otherwise
43 */
44 virtual QString filePath() const = 0;
45
46 /**
47 * Indicates if this volume should be ignored by applications.
48 *
49 * If it should be ignored, it generally means that it should be
50 * invisible to the user. It's useful for firmware partitions or
51 * OS reinstall partitions on some systems.
52 *
53 * @return true if the volume should be ignored
54 */
55 virtual bool isIgnored() const = 0;
56
57 /**
58 * Checks if source of the storage is encrypted.
59 *
60 * @return true if storage is encrypted one
61 */
62 virtual bool isEncrypted() const = 0;
63
64 /**
65 * Mounts the volume.
66 *
67 * @return the job handling the operation
68 */
69 virtual bool setup() = 0;
70
71 /**
72 * Unmounts the volume.
73 *
74 * @return the job handling the operation
75 */
76 virtual bool teardown() = 0;
77
78 /**
79 * Indicates if this volume can check for filesystem errors.
80 *
81 * @return true if the volume is can be checked
82 */
83 virtual bool canCheck() const;
84
85 /**
86 * Checks the filesystem for consistency avoiding any modifications or repairs.
87 *
88 * Mounted or unsupported filesystems will result in an error.
89 *
90 * @return Whether the filesystem is undamaged.
91 */
92 virtual bool check();
93
94 /**
95 * Indicates if this volume can repair filesystem errors.
96 *
97 * @return true if the volume is can be repaired
98 */
99 virtual bool canRepair() const;
100
101 /**
102 * Tries to repair the filesystem.
103 *
104 * Mounted or unsupported filesystems will result in an error.
105 *
106 * @return Whether the filesystem could be successfully repaired
107 */
108 virtual bool repair();
109
110protected:
111 // Q_SIGNALS:
112 /**
113 * This signal is emitted when the mount state of this device
114 * has changed.
115 *
116 * @param newState true if the volume is mounted, false otherwise
117 * @param udi the UDI of the volume
118 */
119 virtual void accessibilityChanged(bool accessible, const QString &udi) = 0;
120
121 /**
122 * This signal is emitted when the mount state of this device
123 * has changed.
124 *
125 * @param newState true if the volume is mounted, false otherwise
126 * @param udi the UDI of the volume
127 */
128 virtual void setupDone(Solid::ErrorType error, QVariant resultData, const QString &udi) = 0;
129
130 /**
131 * This signal is emitted when the mount state of this device
132 * has changed.
133 *
134 * @param newState true if the volume is mounted, false otherwise
135 * @param udi the UDI of the volume
136 */
137 virtual void teardownDone(Solid::ErrorType error, QVariant resultData, const QString &udi) = 0;
138
139 /**
140 * This signal is emitted when a setup of this device is requested.
141 * The signal might be spontaneous i.e. it can be triggered by
142 * another process.
143 *
144 * @param udi the UDI of the volume
145 */
146 virtual void setupRequested(const QString &udi) = 0;
147
148 /**
149 * This signal is emitted when a teardown of this device is requested.
150 * The signal might be spontaneous i.e. it can be triggered by
151 * another process
152 *
153 * @param udi the UDI of the volume
154 */
155 virtual void teardownRequested(const QString &udi) = 0;
156
157 /**
158 * This signal is emitted when a repair of this device is requested.
159 * The signal might be spontaneous i.e. it can be triggered by
160 * another process.
161 *
162 * @param udi the UDI of the volume
163 */
164 virtual void repairRequested(const QString &udi);
165
166 /**
167 * This signal is emitted when the attempted repaired of this
168 * device is completed.
169 *
170 * @param error type of error that occurred, if any
171 * @param errorData more information about the error, if any
172 * @param udi the UDI of the volume
173 */
174 virtual void repairDone(Solid::ErrorType error, QVariant resultData, const QString &udi);
175};
176}
177}
178
179Q_DECLARE_INTERFACE(Solid::Ifaces::StorageAccess, "org.kde.Solid.Ifaces.StorageAccess/0.1")
180
181#endif
Base interface of all the device interfaces.
This device interface is available on volume devices.
virtual bool isIgnored() const =0
Indicates if this volume should be ignored by applications.
virtual bool canCheck() const
Indicates if this volume can check for filesystem errors.
virtual void teardownRequested(const QString &udi)=0
This signal is emitted when a teardown of this device is requested.
virtual bool check()
Checks the filesystem for consistency avoiding any modifications or repairs.
virtual void accessibilityChanged(bool accessible, const QString &udi)=0
This signal is emitted when the mount state of this device has changed.
virtual bool repair()
Tries to repair the filesystem.
virtual bool isEncrypted() const =0
Checks if source of the storage is encrypted.
~StorageAccess() override
Destroys a StorageVolume object.
virtual void repairDone(Solid::ErrorType error, QVariant resultData, const QString &udi)
This signal is emitted when the attempted repaired of this device is completed.
virtual void setupRequested(const QString &udi)=0
This signal is emitted when a setup of this device is requested.
virtual void teardownDone(Solid::ErrorType error, QVariant resultData, const QString &udi)=0
This signal is emitted when the mount state of this device has changed.
virtual bool canRepair() const
Indicates if this volume can repair filesystem errors.
virtual void setupDone(Solid::ErrorType error, QVariant resultData, const QString &udi)=0
This signal is emitted when the mount state of this device has changed.
virtual bool isAccessible() const =0
Indicates if this volume is mounted.
virtual void repairRequested(const QString &udi)
This signal is emitted when a repair of this device is requested.
virtual bool teardown()=0
Unmounts the volume.
virtual QString filePath() const =0
Retrieves the absolute path of this volume mountpoint.
virtual bool setup()=0
Mounts the volume.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:47:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.