Plasma5Support

soliddeviceengine.h
1/*
2 SPDX-FileCopyrightText: 2007 Christopher Blauvelt <cblauvelt@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-only
5*/
6
7#pragma once
8
9#include <QList>
10#include <QMap>
11#include <QObject>
12#include <QPair>
13#include <QString>
14
15#include <solid/device.h>
16#include <solid/deviceinterface.h>
17#include <solid/devicenotifier.h>
18#include <solid/predicate.h>
19
20#include "devicesignalmapmanager.h"
21#include "devicesignalmapper.h"
22#include "hddtemp.h"
23#include <KIO/FileSystemFreeSpaceJob>
24#include <Plasma5Support/DataEngine>
25#include <Plasma5Support/Service>
26
27enum State {
28 Idle = 0,
29 Mounting = 1,
30 Unmounting = 2,
31};
32
33enum OperationResult {
34 Working = 0,
35 Successful = 1,
36 Unsuccessful = 2,
37};
38
39/**
40 * This class evaluates the basic expressions given in the interface.
41 */
43{
45 friend class SolidDeviceService;
46
47public:
49 ~SolidDeviceEngine() override;
50 Plasma5Support::Service *serviceForSource(const QString &source) override;
51
52protected:
53 bool sourceRequestEvent(const QString &name) override;
54 bool updateSourceEvent(const QString &source) override;
55
56private:
57 bool populateDeviceData(const QString &name);
58 bool updateStorageSpace(const QString &udi);
59 bool updateHardDiskTemperature(const QString &udi);
60 bool updateEmblems(const QString &udi);
61 bool updateInUse(const QString &udi);
62 bool forceUpdateAccessibility(const QString &udi);
63 void listenForNewDevices();
64
65 // predicate in string form, list of devices by udi
66 QMap<QString, QStringList> m_predicatemap;
67 // udi, corresponding device
69 // udi, corresponding encrypted container udi;
70 QMap<QString, QString> m_encryptedContainerMap;
71 // path, for pending file system free space jobs
72 QSet<QString> m_paths;
73 DeviceSignalMapManager *m_signalmanager;
74
75 HddTemp *m_temperature;
76 Solid::DeviceNotifier *m_notifier;
77
78private Q_SLOTS:
79 void deviceAdded(const QString &udi);
80 void deviceRemoved(const QString &udi);
81 void deviceChanged(const QString &udi, const QString &property, const QVariant &value);
82 void sourceWasRemoved(const QString &source);
83 void setMountingState(const QString &udi);
84 void setUnmountingState(const QString &udi);
85 void setIdleState(Solid::ErrorType error, QVariant errorData, const QString &udi);
86 void deviceChanged(const QMap<QString, int> &props);
87};
Data provider for plasmoids (Plasma plugins)
Definition dataengine.h:45
This class provides a generic API for write access to settings or services.
Definition service.h:78
This class evaluates the basic expressions given in the interface.
bool updateSourceEvent(const QString &source) override
Called by internal updating mechanisms to trigger the engine to refresh the data contained in a given...
bool sourceRequestEvent(const QString &name) override
When a source that does not currently exist is requested by the consumer, this method is called to gi...
Plasma5Support::Service * serviceForSource(const QString &source) override
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
QVariant property(const char *name) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.