Solid

ifaces/storageaccess.h
1 /*
2  SPDX-FileCopyrightText: 2007 Kevin Ottens <[email protected]>
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 
13 namespace Solid
14 {
15 namespace 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  */
23 class StorageAccess : virtual public DeviceInterface
24 {
25 public:
26  /**
27  * Destroys a StorageVolume object.
28  */
29  virtual ~StorageAccess();
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 protected:
79  // Q_SIGNALS:
80  /**
81  * This signal is emitted when the mount state of this device
82  * has changed.
83  *
84  * @param newState true if the volume is mounted, false otherwise
85  * @param udi the UDI of the volume
86  */
87  virtual void accessibilityChanged(bool accessible, const QString &udi) = 0;
88 
89  /**
90  * This signal is emitted when the mount state of this device
91  * has changed.
92  *
93  * @param newState true if the volume is mounted, false otherwise
94  * @param udi the UDI of the volume
95  */
96  virtual void setupDone(Solid::ErrorType error, QVariant resultData, const QString &udi) = 0;
97 
98  /**
99  * This signal is emitted when the mount state of this device
100  * has changed.
101  *
102  * @param newState true if the volume is mounted, false otherwise
103  * @param udi the UDI of the volume
104  */
105  virtual void teardownDone(Solid::ErrorType error, QVariant resultData, const QString &udi) = 0;
106 
107  /**
108  * This signal is emitted when a setup of this device is requested.
109  * The signal might be spontaneous i.e. it can be triggered by
110  * another process.
111  *
112  * @param udi the UDI of the volume
113  */
114  virtual void setupRequested(const QString &udi) = 0;
115 
116  /**
117  * This signal is emitted when a teardown of this device is requested.
118  * The signal might be spontaneous i.e. it can be triggered by
119  * another process
120  *
121  * @param udi the UDI of the volume
122  */
123  virtual void teardownRequested(const QString &udi) = 0;
124 };
125 }
126 }
127 
128 Q_DECLARE_INTERFACE(Solid::Ifaces::StorageAccess, "org.kde.Solid.Ifaces.StorageAccess/0.1")
129 
130 #endif
virtual bool isEncrypted() const =0
Checks if source of the storage is encrypted.
virtual void setupRequested(const QString &udi)=0
This signal is emitted when a setup of this device is requested.
virtual QString filePath() const =0
Retrieves the absolute path of this volume mountpoint.
virtual bool isIgnored() const =0
Indicates if this volume should be ignored by applications.
Base interface of all the device interfaces.
virtual bool teardown()=0
Unmounts the volume.
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 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 setup()=0
Mounts the volume.
The single responsibility of this class is to create arguments valid for logind Inhibit call...
This device interface is available on volume devices.
virtual bool isAccessible() const =0
Indicates if this volume is mounted.
virtual void accessibilityChanged(bool accessible, const QString &udi)=0
This signal is emitted when the mount state of this device has changed.
virtual ~StorageAccess()
Destroys a StorageVolume object.
virtual void teardownRequested(const QString &udi)=0
This signal is emitted when a teardown of this device is requested.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Sep 20 2021 22:51:03 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.