Solid::StorageAccess Class

class Solid::StorageAccess

This device interface is available on volume devices to access them (i.e. mount or unmount them). More...

Header: #include <Solid/StorageAccess>
CMake: find_package(KF6 REQUIRED COMPONENTS Solid)
target_link_libraries(mytarget PRIVATE KF6::Solid)
Inherits: Solid::DeviceInterface

Properties

Public Functions

bool canCheck() const
bool canRepair() const
bool check()
QString filePath() const
bool isAccessible() const
bool isEncrypted() const
bool isIgnored() const
bool repair()
bool setup()
bool teardown()

Signals

void accessibilityChanged(bool accessible, const QString &udi)
(since 6.11) void checkDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
(since 6.11) void checkRequested(const QString &udi)
void repairDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
void repairRequested(const QString &udi)
void setupDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
void setupRequested(const QString &udi)
void teardownDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
void teardownRequested(const QString &udi)

Static Public Members

Solid::DeviceInterface::Type deviceInterfaceType()

Detailed Description

A volume is anything that can contain data (partition, optical disc, memory card). It's a particular kind of block device.

A StorageAccess is commonly used in conjunction with StorageDrive and StorageVolume.

StorageDriveStorageVolumeStorageAccess
drivespartition tables / filesystemsmount points / partitions
const List<Solid::Device> devices = Solid::Device::listFromType(Solid::DeviceInterface::StorageVolume, QString());
for (auto device : devices) {
    auto access = device.as<const Solid::StorageAccess>();
    if (access) {
        // ...
    }
}

Property Documentation

[read-only] accessible : bool

Access functions:

bool isAccessible() const

[read-only] encrypted : bool

Access functions:

bool isEncrypted() const

[read-only] filePath : QString

Access functions:

QString filePath() const

[read-only] ignored : bool

Access functions:

bool isIgnored() const

Member Function Documentation

[signal] void StorageAccess::accessibilityChanged(bool accessible, const QString &udi)

This signal is emitted when the accessiblity of this device has changed.

bool StorageAccess::canCheck() const

Indicates if this volume can check for filesystem errors.

bool StorageAccess::canRepair() const

Returns whether the filesystem of this volume supports repair attempts.

It does not indicate if such an attempt will succeed.

bool StorageAccess::check()

Checks the filesystem for consistency avoiding any modifications or repairs.

Returns whether the filesystem is undamaged. Mounted or unsupported filesystems will result in an error.

[signal, since 6.11] void StorageAccess::checkDone(Solid::ErrorType error, QVariant errorData, const QString &udi)

This signal is emitted when the attempted check of the device with the given udi is completed.

Returns an error followed by additional errorData information, if any.

The signal might be spontaneous i.e. it can be triggered by another process.

This function was introduced in 6.11.

[signal, since 6.11] void StorageAccess::checkRequested(const QString &udi)

This signal is emitted when a check of the device with the given udi is requested.

The signal might be spontaneous i.e. it can be triggered by another process.

This function was introduced in 6.11.

[static] Solid::DeviceInterface::Type StorageAccess::deviceInterfaceType()

Returns the Solid::DeviceInterface::Type of the StorageAccess device interface.

See also Solid::DeviceInterface::Type.

QString StorageAccess::filePath() const

Returns the absolute path to the mount point if the volume is mounted, QString() otherwise.

Note: Getter function for property filePath.

bool StorageAccess::isAccessible() const

Returns if this volume is mounted.

Note: Getter function for property accessible.

bool StorageAccess::isEncrypted() const

Returns if the source of the storage is encrypted.

Note: Getter function for property encrypted.

bool StorageAccess::isIgnored() const

Returns whether this volume should be ignored by applications.

If it should be ignored, it generally means that it should be invisible to the user. It's useful for firmware partitions or OS reinstall partitions on some systems.

Note: Getter function for property ignored.

bool StorageAccess::repair()

Tries to repair the filesystem.

Mounted or unsupported filesystems will result in an error.

Returns whether the filesystem could be successfully repaired.

[signal] void StorageAccess::repairDone(Solid::ErrorType error, QVariant errorData, const QString &udi)

This signal is emitted when the attempted repair of the device with the given udi is completed.

Returns an error followed by additional errorData information, if any.

The signal might be spontaneous i.e. it can be triggered by another process.

[signal] void StorageAccess::repairRequested(const QString &udi)

This signal is emitted when a repair of the device with the given udi is requested.

The signal might be spontaneous i.e. it can be triggered by another process.

bool StorageAccess::setup()

Mounts the volume.

Returns false if the operation is not supported, true if the operation is attempted.

[signal] void StorageAccess::setupDone(Solid::ErrorType error, QVariant errorData, const QString &udi)

This signal is emitted when the attempted setting up of the device with the given udi is completed.

Returns an error followed by additional errorData information, if any.

The signal might be spontaneous i.e. it can be triggered by another process.

[signal] void StorageAccess::setupRequested(const QString &udi)

* This signal is emitted when a setup of the device with the given udi is requested.

* The signal might be spontaneous i.e. it can be triggered by another process.

bool StorageAccess::teardown()

Unmounts the volume.

Returns false if the operation is not supported, true if the operation is attempted.

[signal] void StorageAccess::teardownDone(Solid::ErrorType error, QVariant errorData, const QString &udi)

This signal is emitted when the attempted tearing down of the device with the given udi is completed.

Returns an error followed by additional errorData information, if any.

The signal might be spontaneous i.e. it can be triggered by another process.

[signal] void StorageAccess::teardownRequested(const QString &udi)

This signal is emitted when a teardown of the device with the given udi is requested.

The signal might be spontaneous i.e. it can be triggered by another process.