add more spacing
[personal-kdebase.git] / workspace / plasma / scriptengines / webkit / plasmajs.h
blob643ab063a5dcf6df5434887cfd8c12a401f023a2
1 /*
2 Copyright (c) 2007 Zack Rusin <zack@kde.org>
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
22 #ifndef PLASMAJS_H
23 #define PLASMAJS_H
25 #include <QObject>
26 #include <KConfigGroup>
27 #include <Plasma/DataEngine>
29 class PlasmaJs : public QObject
31 Q_OBJECT
32 public:
33 PlasmaJs(QObject *parent=0);
35 public Q_SLOTS:
36 QStringList knownEngines();
39 class DataEngineDataWrapper : public QObject
41 Q_OBJECT
42 Q_PROPERTY(int size READ size)
43 public:
44 DataEngineDataWrapper(const Plasma::DataEngine::Data &data = Plasma::DataEngine::Data());
46 int size() const;
47 void setData(const Plasma::DataEngine::Data &data);
49 public Q_SLOTS:
50 bool contains(const QString &key) const;
51 QVariant value(const QString &key) const;
52 QStringList keys() const;
53 QString key(int i) const;
55 private:
56 Plasma::DataEngine::Data m_data;
59 class DataEngineWrapper : public QObject
61 Q_OBJECT
62 Q_PROPERTY(QStringList sources READ sources)
63 Q_PROPERTY(bool valid READ isValid)
64 Q_PROPERTY(QString icon READ icon)
65 Q_PROPERTY(QString engineName READ engineName)
66 public:
67 DataEngineWrapper(Plasma::DataEngine *engine, QObject *applet = 0);
68 ~DataEngineWrapper();
70 QStringList sources() const;
71 QString engineName() const;
72 bool isValid() const;
73 QString icon() const;
75 public Q_SLOTS:
76 QObject *query(const QString &str) const;
77 void connectSource(const QString& source,
78 uint pollingInterval = 0, uint intervalAlignment = 0);
80 private:
81 Plasma::DataEngine *m_engine;
82 QObject *m_applet;
85 class ConfigGroupWrapper : public QObject
87 Q_OBJECT
88 public:
89 ConfigGroupWrapper(const KConfigGroup &config = KConfigGroup());
91 void setConfig(const KConfigGroup &config);
93 public Q_SLOTS:
94 QVariant readEntry(const QString &key, const QVariant &aDefault) const;
95 void writeEntry(const QString &key, const QVariant& value);
97 private:
98 KConfigGroup m_config;
101 #endif