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
26 #include <KConfigGroup>
27 #include <Plasma/DataEngine>
29 class PlasmaJs
: public QObject
33 PlasmaJs(QObject
*parent
=0);
36 QStringList
knownEngines();
39 class DataEngineDataWrapper
: public QObject
42 Q_PROPERTY(int size READ size
)
44 DataEngineDataWrapper(const Plasma::DataEngine::Data
&data
= Plasma::DataEngine::Data());
47 void setData(const Plasma::DataEngine::Data
&data
);
50 bool contains(const QString
&key
) const;
51 QVariant
value(const QString
&key
) const;
52 QStringList
keys() const;
53 QString
key(int i
) const;
56 Plasma::DataEngine::Data m_data
;
59 class DataEngineWrapper
: public QObject
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
)
67 DataEngineWrapper(Plasma::DataEngine
*engine
, QObject
*applet
= 0);
70 QStringList
sources() const;
71 QString
engineName() const;
76 QObject
*query(const QString
&str
) const;
77 void connectSource(const QString
& source
,
78 uint pollingInterval
= 0, uint intervalAlignment
= 0);
81 Plasma::DataEngine
*m_engine
;
85 class ConfigGroupWrapper
: public QObject
89 ConfigGroupWrapper(const KConfigGroup
&config
= KConfigGroup());
91 void setConfig(const KConfigGroup
&config
);
94 QVariant
readEntry(const QString
&key
, const QVariant
&aDefault
) const;
95 void writeEntry(const QString
&key
, const QVariant
& value
);
98 KConfigGroup m_config
;