not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / dataengines / soliddevice / soliddeviceengine.h
blob566e99b95a9f384f112cb3337374291e4bb3bf5f
1 /*
2 * Copyright (C) 2007 Christopher Blauvelt <cblauvelt@gmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 as
6 * published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef SOLIDDEVICEENGINE_H
20 #define SOLIDDEVICEENGINE_H
22 #include <QObject>
23 #include <QString>
24 #include <QList>
25 #include <QMap>
26 #include <QPair>
28 #include <solid/devicenotifier.h>
29 #include <solid/device.h>
30 #include <solid/deviceinterface.h>
31 #include <solid/predicate.h>
33 #include <Plasma/DataEngine>
34 #include "devicesignalmapmanager.h"
35 #include "devicesignalmapper.h"
36 #include "hddtemp.h"
38 /**
39 * This class evaluates the basic expressions given in the interface.
41 class SolidDeviceEngine : public Plasma::DataEngine
43 Q_OBJECT
45 public:
46 SolidDeviceEngine( QObject* parent, const QVariantList& args);
47 ~SolidDeviceEngine();
49 protected:
50 bool sourceRequestEvent(const QString &name);
51 bool updateSourceEvent(const QString& source);
53 private:
54 bool populateDeviceData(const QString &name);
55 qlonglong freeDiskSpace(const QString &mountPoint);
56 bool updateFreeSpace(const QString &udi);
57 bool updateHardDiskTemperature(const QString &udi);
58 void listenForNewDevices();
60 //predicate in string form, list of devices by udi
61 QMap<QString, QStringList> predicatemap;
62 //udi, corresponding device
63 QMap<QString, Solid::Device> devicemap;
64 DeviceSignalMapManager *signalmanager;
66 HddTemp *temperature;
67 Solid::DeviceNotifier *notifier;
69 private Q_SLOTS:
70 void deviceAdded(const QString &udi);
71 void deviceRemoved(const QString &udi);
72 void deviceChanged(const QString& udi, const QString &property, const QVariant &value);
73 void sourceRemoved(const QString &source);
76 K_EXPORT_PLASMA_DATAENGINE(soliddevice, SolidDeviceEngine)
78 #endif