• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.2 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
  • scripting
dataenginescript.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2007 by Aaron Seigo <aseigo@kde.org>
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 as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #include "dataenginescript.h"
21 
22 #include "package.h"
23 #include "private/dataengine_p.h"
24 #include "private/service_p.h"
25 
26 namespace Plasma
27 {
28 
29 class DataEngineScriptPrivate
30 {
31 public:
32  DataEngine *dataEngine;
33 };
34 
35 DataEngineScript::DataEngineScript(QObject *parent)
36  : ScriptEngine(parent),
37  d(new DataEngineScriptPrivate)
38 {
39 }
40 
41 DataEngineScript::~DataEngineScript()
42 {
43  delete d;
44 }
45 
46 void DataEngineScript::setDataEngine(DataEngine *dataEngine)
47 {
48  d->dataEngine = dataEngine;
49 }
50 
51 DataEngine *DataEngineScript::dataEngine() const
52 {
53  return d->dataEngine;
54 }
55 
56 QStringList DataEngineScript::sources() const
57 {
58  return d->dataEngine->containerDict().keys();
59 }
60 
61 bool DataEngineScript::sourceRequestEvent(const QString &name)
62 {
63  Q_UNUSED(name);
64  return false;
65 }
66 
67 bool DataEngineScript::updateSourceEvent(const QString &source)
68 {
69  Q_UNUSED(source);
70  return false;
71 }
72 
73 Service *DataEngineScript::serviceForSource(const QString &source)
74 {
75  Q_ASSERT(d->dataEngine);
76  return new NullService(source, d->dataEngine);
77 }
78 
79 QString DataEngineScript::mainScript() const
80 {
81  Q_ASSERT(d->dataEngine);
82  return d->dataEngine->package()->filePath("mainscript");
83 }
84 
85 const Package *DataEngineScript::package() const
86 {
87  Q_ASSERT(d->dataEngine);
88  return d->dataEngine->package();
89 }
90 
91 KPluginInfo DataEngineScript::description() const
92 {
93  Q_ASSERT(d->dataEngine);
94  return d->dataEngine->d->dataEngineDescription;
95 }
96 
97 void DataEngineScript::setData(const QString &source, const QString &key,
98  const QVariant &value)
99 {
100  if (d->dataEngine) {
101  d->dataEngine->setData(source, key, value);
102  }
103 }
104 
105 void DataEngineScript::setData(const QString &source, const QVariant &value)
106 {
107  if (d->dataEngine) {
108  d->dataEngine->setData(source, value);
109  }
110 }
111 
112 void DataEngineScript::setData(const QString &source, const DataEngine::Data &values)
113 {
114  if (d->dataEngine) {
115  d->dataEngine->setData(source, values);
116  }
117 }
118 
119 void DataEngineScript::removeAllData(const QString &source)
120 {
121  if (d->dataEngine) {
122  d->dataEngine->removeAllData(source);
123  }
124 }
125 
126 void DataEngineScript::removeData(const QString &source, const QString &key)
127 {
128  if (d->dataEngine) {
129  d->dataEngine->removeData(source, key);
130  }
131 }
132 
133 void DataEngineScript::setMaxSourceCount(uint limit)
134 {
135  if (d->dataEngine) {
136  d->dataEngine->setMaxSourceCount(limit);
137  }
138 }
139 
140 void DataEngineScript::setMinimumPollingInterval(int minimumMs)
141 {
142  if (d->dataEngine) {
143  d->dataEngine->setMinimumPollingInterval(minimumMs);
144  }
145 }
146 
147 int DataEngineScript::minimumPollingInterval() const
148 {
149  if (d->dataEngine) {
150  return d->dataEngine->minimumPollingInterval();
151  }
152  return 0;
153 }
154 
155 void DataEngineScript::setPollingInterval(uint frequency)
156 {
157  if (d->dataEngine) {
158  d->dataEngine->setPollingInterval(frequency);
159  }
160 }
161 
162 void DataEngineScript::removeAllSources()
163 {
164  if (d->dataEngine) {
165  d->dataEngine->removeAllSources();
166  }
167 }
168 
169 void DataEngineScript::addSource(DataContainer *source)
170 {
171  if (d->dataEngine) {
172  d->dataEngine->addSource(source);
173  }
174 }
175 
176 DataEngine::SourceDict DataEngineScript::containerDict() const
177 {
178  if (d->dataEngine) {
179  return d->dataEngine->containerDict();
180  }
181  return DataEngine::SourceDict();
182 }
183 
184 void DataEngineScript::setName(const QString &name)
185 {
186  if (d->dataEngine) {
187  d->dataEngine->setName(name);
188  }
189 }
190 
191 void DataEngineScript::setIcon(const QString &icon)
192 {
193  if (d->dataEngine) {
194  d->dataEngine->setIcon(icon);
195  }
196 }
197 
198 void DataEngineScript::scheduleSourcesUpdated()
199 {
200  if (d->dataEngine) {
201  d->dataEngine->scheduleSourcesUpdated();
202  }
203 }
204 
205 void DataEngineScript::removeSource(const QString &source)
206 {
207  if (d->dataEngine) {
208  d->dataEngine->removeSource(source);
209  }
210 }
211 
212 void DataEngineScript::updateAllSources()
213 {
214  if (d->dataEngine) {
215  d->dataEngine->updateAllSources();
216  }
217 }
218 
219 void DataEngineScript::forceImmediateUpdateOfAllVisualizations()
220 {
221  if (d->dataEngine) {
222  d->dataEngine->forceImmediateUpdateOfAllVisualizations();
223  }
224 }
225 
226 } // Plasma namespace
227 
228 #include "dataenginescript.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Apr 16 2013 20:58:52 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.10.2 API Reference

Skip menu "kdelibs-4.10.2 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal