Solid

frontend/storageaccess.cpp
1/*
2 SPDX-FileCopyrightText: 2006-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#include "storageaccess.h"
8#include "storageaccess_p.h"
9
10#include "soliddefs_p.h"
11#include <solid/devices/ifaces/storageaccess.h>
12
13Solid::StorageAccess::StorageAccess(QObject *backendObject)
14 : DeviceInterface(*new StorageAccessPrivate(), backendObject)
15{
16 connect(backendObject, SIGNAL(setupDone(Solid::ErrorType, QVariant, QString)), this, SIGNAL(setupDone(Solid::ErrorType, QVariant, QString)));
17 connect(backendObject, SIGNAL(teardownDone(Solid::ErrorType, QVariant, QString)), this, SIGNAL(teardownDone(Solid::ErrorType, QVariant, QString)));
18 connect(backendObject, SIGNAL(setupRequested(QString)), this, SIGNAL(setupRequested(QString)));
19 connect(backendObject, SIGNAL(teardownRequested(QString)), this, SIGNAL(teardownRequested(QString)));
20
21 connect(backendObject, SIGNAL(accessibilityChanged(bool, QString)), this, SIGNAL(accessibilityChanged(bool, QString)));
22
23 connect(backendObject, SIGNAL(checkRequested(QString)), this, SIGNAL(checkRequested(QString)));
24 connect(backendObject, SIGNAL(checkDone(Solid::ErrorType, QVariant, QString)), this, SIGNAL(checkDone(Solid::ErrorType, QVariant, QString)));
25 connect(backendObject, SIGNAL(repairRequested(QString)), this, SIGNAL(repairRequested(QString)));
26 connect(backendObject, SIGNAL(repairDone(Solid::ErrorType, QVariant, QString)), this, SIGNAL(repairDone(Solid::ErrorType, QVariant, QString)));
27}
28
29Solid::StorageAccess::StorageAccess(StorageAccessPrivate &dd, QObject *backendObject)
30 : DeviceInterface(dd, backendObject)
31{
32 connect(backendObject,
33 SIGNAL(setupDone(Solid::StorageAccess::SetupResult, QVariant, QString)),
34 this,
35 SIGNAL(setupDone(Solid::StorageAccess::SetupResult, QVariant, QString)));
36 connect(backendObject,
37 SIGNAL(teardownDone(Solid::StorageAccess::TeardownResult, QVariant, QString)),
38 this,
39 SIGNAL(teardownDone(Solid::StorageAccess::TeardownResult, QVariant, QString)));
40 connect(backendObject, SIGNAL(setupRequested(QString)), this, SIGNAL(setupRequested(QString)));
41 connect(backendObject, SIGNAL(teardownRequested(QString)), this, SIGNAL(teardownRequested(QString)));
42
43 connect(backendObject, SIGNAL(accessibilityChanged(bool, QString)), this, SIGNAL(accessibilityChanged(bool, QString)));
44
45 connect(backendObject, SIGNAL(checkRequested(QString)), this, SIGNAL(checkRequested(QString)));
46 connect(backendObject, SIGNAL(checkDone(Solid::ErrorType, QVariant, QString)), this, SIGNAL(checkDone(Solid::ErrorType, QVariant, QString)));
47 connect(backendObject, SIGNAL(repairRequested(QString)), this, SIGNAL(repairRequested(QString)));
48 connect(backendObject, SIGNAL(repairDone(Solid::ErrorType, QVariant, QString)), this, SIGNAL(repairDone(Solid::ErrorType, QVariant, QString)));
49}
50
54
56{
57 Q_D(const StorageAccess);
58 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), false, isAccessible());
59}
60
61QString Solid::StorageAccess::filePath() const
62{
63 Q_D(const StorageAccess);
64 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), QString(), filePath());
65}
66
68{
69 Q_D(StorageAccess);
70 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), false, setup());
71}
72
74{
75 Q_D(StorageAccess);
76 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), false, teardown());
77}
78
80{
81 Q_D(const StorageAccess);
82 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), true, isIgnored());
83}
84
86{
87 Q_D(const StorageAccess);
88 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), false, isEncrypted());
89}
90
92{
93 Q_D(const StorageAccess);
94 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), false, canCheck());
95}
96
98{
99 Q_D(StorageAccess);
100 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), false, check());
101}
102
104{
105 Q_D(const StorageAccess);
106 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), false, canRepair());
107}
108
110{
111 Q_D(StorageAccess);
112 return_SOLID_CALL(Ifaces::StorageAccess *, d->backendObject(), false, repair());
113}
114
115#include "moc_storageaccess.cpp"
SOLID_NO_EXPORT DeviceInterface(DeviceInterfacePrivate &dd, QObject *backendObject)
This device interface is available on volume devices.
bool repair()
Tries to repair the filesystem.
void repairDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
This signal is emitted when the attempted repaired of this device is completed.
bool isEncrypted() const
Checks if source of the storage is encrypted.
void setupRequested(const QString &udi)
This signal is emitted when a setup of this device is requested.
bool canRepair() const
Indicates if the filesystem of this volume supports repair attempts.
~StorageAccess() override
Destroys a StorageAccess object.
bool check()
Checks the filesystem for consistency avoiding any modifications or repairs.
void accessibilityChanged(bool accessible, const QString &udi)
This signal is emitted when the accessiblity of this device has changed.
void checkDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
This signal is emitted when the attempted check of this device is completed.
void teardownRequested(const QString &udi)
This signal is emitted when a teardown of this device is requested.
bool isAccessible() const
Indicates if this volume is mounted.
bool teardown()
Unmounts the volume.
void teardownDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
This signal is emitted when the attempted tearing down of this device is completed.
bool setup()
Mounts the volume.
bool isIgnored() const
Indicates if this volume should be ignored by applications.
bool canCheck() const
Indicates if this volume can check for filesystem errors.
void checkRequested(const QString &udi)
This signal is emitted when a check of this device is requested.
void setupDone(Solid::ErrorType error, QVariant errorData, const QString &udi)
This signal is emitted when the attempted setting up of this device is completed.
void repairRequested(const QString &udi)
This signal is emitted when a repair of this device is requested.
QObject(QObject *parent)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:55:36 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.