Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / plasma / dataengines / soliddevice / soliddeviceengine.h
blobddc5d55ebaeff37ed13d017328ccd3d9a9aaa2a9
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>
27 #include <solid/devicenotifier.h>
28 #include <solid/device.h>
29 #include <solid/deviceinterface.h>
30 #include <solid/predicate.h>
32 #include "plasma/dataengine.h"
33 #include "devicesignalmapmanager.h"
34 #include "devicesignalmapper.h"
36 /**
37 * This class evaluates the basic expressions given in the interface.
39 class SolidDeviceEngine : public Plasma::DataEngine
41 Q_OBJECT
43 public:
44 SolidDeviceEngine( QObject* parent, const QVariantList& args);
45 ~SolidDeviceEngine();
47 protected:
48 bool sourceRequested(const QString &name);
49 bool updateSource(const QString& source);
51 private:
52 bool populateDeviceData(const QString &name);
53 qlonglong freeDiskSpace(const QString &mountPoint);
54 bool updateFreeSpace(const QString &udi);
55 void listenForNewDevices();
57 QStringList devicelist;
59 //predicate in string form, list of devices by udi
60 QMap<QString, QStringList> predicatemap;
61 //udi, corresponding device
62 QMap<QString, Solid::Device> devicemap;
63 DeviceSignalMapManager *signalmanager;
65 Solid::DeviceNotifier *notifier;
67 private Q_SLOTS:
68 void deviceAdded(const QString &udi);
69 void deviceRemoved(const QString &udi);
70 void deviceChanged(const QString& udi, const QString &property, const QVariant &value);
73 K_EXPORT_PLASMA_DATAENGINE(soliddevice, SolidDeviceEngine)
75 #endif