~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/dataengines/soliddevice/soliddeviceengine.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright (C) 2007 Christopher Blauvelt <cblauvelt@gmail.com>
 
3
 *
 
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
 
7
 *
 
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
 
12
 *
 
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.
 
17
 */
 
18
 
 
19
#ifndef SOLIDDEVICEENGINE_H
 
20
#define SOLIDDEVICEENGINE_H
 
21
 
 
22
#include <QObject>
 
23
#include <QString>
 
24
#include <QList>
 
25
#include <QMap>
 
26
#include <QPair>
 
27
 
 
28
#include <solid/devicenotifier.h>
 
29
#include <solid/device.h>
 
30
#include <solid/deviceinterface.h>
 
31
#include <solid/predicate.h>
 
32
 
 
33
#include <Plasma/DataEngine>
 
34
#include "devicesignalmapmanager.h"
 
35
#include "devicesignalmapper.h"
 
36
#include "hddtemp.h"
 
37
 
 
38
/**
 
39
 * This class evaluates the basic expressions given in the interface.
 
40
 */
 
41
class SolidDeviceEngine : public Plasma::DataEngine
 
42
{
 
43
    Q_OBJECT
 
44
 
 
45
public:
 
46
    SolidDeviceEngine( QObject* parent, const QVariantList& args);
 
47
    ~SolidDeviceEngine();
 
48
 
 
49
protected:
 
50
    bool sourceRequestEvent(const QString &name);
 
51
    bool updateSourceEvent(const QString& source);
 
52
 
 
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
    bool updateEmblems(const QString &udi);
 
59
    bool forceUpdateAccessibility(const QString &udi);
 
60
    void listenForNewDevices();
 
61
 
 
62
    //predicate in string form, list of devices by udi
 
63
    QMap<QString, QStringList> predicatemap;
 
64
    //udi, corresponding device
 
65
    QMap<QString, Solid::Device> devicemap;
 
66
    //udi, corresponding encrypted container udi;
 
67
    QMap<QString, QString> encryptedContainerMap;
 
68
    DeviceSignalMapManager *signalmanager;
 
69
 
 
70
    HddTemp *temperature;
 
71
    Solid::DeviceNotifier *notifier;
 
72
 
 
73
private Q_SLOTS:
 
74
    void deviceAdded(const QString &udi);
 
75
    void deviceRemoved(const QString &udi);
 
76
    void deviceChanged(const QString& udi, const QString &property, const QVariant &value);
 
77
    void sourceWasRemoved(const QString &source);
 
78
};
 
79
 
 
80
K_EXPORT_PLASMA_DATAENGINE(soliddevice, SolidDeviceEngine)
 
81
 
 
82
#endif