1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
6
<title>Plasma.ServiceJob</title>
7
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
<meta http-equiv="Content-Style-Type" content="text/css" />
9
<link rel="stylesheet" type="text/css" href="../common/doxygen.css" />
10
<link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../common/kde.css" />
18
<img alt ="" src="../common/top-kde.jpg"/>
19
KDE 4.3 PyKDE API Reference
23
<div id="header_bottom">
26
<li>KDE's Python API</li>
32
<li><a href="../modules.html">Overview</a></li>
33
<li><a href="http://techbase.kde.org/Development/Languages/Python">PyKDE Home</a></li>
34
<li><a href="http://kde.org/family/">Sitemap</a></li>
35
<li><a href="http://kde.org/contact/">Contact Us</a></li>
41
<div id="body_wrapper">
46
<div class="clearer"> </div>
48
<h1>ServiceJob Class Reference</h1>
49
<code>from PyKDE4.plasma import *</code>
51
Inherits: <a href="../kdecore/KJob.html">KJob</a> → <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qobject.html">QObject</a><br />
53
Namespace: Plasma<br />
54
<h2>Detailed Description</h2>
56
<p>ServiceJob plasma/servicejob.h <Plasma/ServiceJob>
59
This class provides jobs for use with Plasma.Service
62
Unlike KJob, you can do the work in start(), since Plasma.Service already
63
delays the call to start() until the event loop is reached.
66
If the job is quick enough that it is not worth reporting the progress,
67
you just need to implement start() to do the task, then call emitResult()
68
at the end of it. If the task does not complete successfully, you should
69
set a non-zero error code with setError(int) and an error message with
70
setErrorText(QString).
73
If the job is longer (involving network access, for instance), you should
74
report the progress at regular intervals. See the KJob documentation for
75
information on how to do this.
77
<table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><br><h2>Methods</h2></td></tr>
78
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#obj151115852">__init__</a> (self, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> destination, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> operation, QMap<QString,QVariant> parameters, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qobject.html">QObject</a> parent=0)</td></tr>
79
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#obj176586188">destination</a> (self)</td></tr>
80
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#obj181372332">operationName</a> (self)</td></tr>
81
<tr><td class="memItemLeft" nowrap align="right" valign="top">QMap<QString,QVariant> </td><td class="memItemRight" valign="bottom"><a class="el" href="#obj186824908">parameters</a> (self)</td></tr>
82
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qvariant.html">QVariant</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#obj178041644">result</a> (self)</td></tr>
83
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#obj178042892">setResult</a> (self, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qvariant.html">QVariant</a> result)</td></tr>
84
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#obj178042060">start</a> (self)</td></tr>
86
<hr><h2>Method Documentation</h2><a class="anchor" name="obj151115852"></a>
88
<div class="memproto">
89
<table class="memname"><tr>
90
<td class="memname">__init__</td>
92
<td class="paramtype"> <em>self</em>, </td>
93
<td class="paramname"></td>
95
<td class="memname"></td>
97
<td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td>
98
<td class="paramname"><em>destination</em>, </td>
101
<td class="memname"></td>
103
<td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td>
104
<td class="paramname"><em>operation</em>, </td>
107
<td class="memname"></td>
109
<td class="paramtype">QMap<QString,QVariant> </td>
110
<td class="paramname"><em>parameters</em>, </td>
113
<td class="memname"></td>
115
<td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qobject.html">QObject</a> </td>
116
<td class="paramname"><em>parent=0</em></td>
123
<td width="100%"> </td>
126
<div class="memdoc"><p>Default constructor
129
@arg destination the subject that the job is acting on
130
@arg operation the action that the job is performing on the <b>destination</b>
131
@arg parameters the parameters of the <b>action</b>
132
@arg parent the parent object for this service
133
</p></div></div><a class="anchor" name="obj176586188"></a>
134
<div class="memitem">
135
<div class="memproto">
136
<table class="memname"><tr>
137
<td class="memname"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> destination</td>
139
<td class="paramtype"> </td>
140
<td class="paramname"><em>self</em> )</td>
141
<td width="100%"> </td>
145
<div class="memdoc"><p><dl class="return" compact><dt><b>Returns:</b></dt><dd> the subject that the job is acting on
147
</p></div></div><a class="anchor" name="obj181372332"></a>
148
<div class="memitem">
149
<div class="memproto">
150
<table class="memname"><tr>
151
<td class="memname"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> operationName</td>
153
<td class="paramtype"> </td>
154
<td class="paramname"><em>self</em> )</td>
155
<td width="100%"> </td>
159
<div class="memdoc"><p><dl class="return" compact><dt><b>Returns:</b></dt><dd> the operation the job is performing on the destination
161
</p></div></div><a class="anchor" name="obj186824908"></a>
162
<div class="memitem">
163
<div class="memproto">
164
<table class="memname"><tr>
165
<td class="memname">QMap<QString,QVariant> parameters</td>
167
<td class="paramtype"> </td>
168
<td class="paramname"><em>self</em> )</td>
169
<td width="100%"> </td>
173
<div class="memdoc"><p><dl class="return" compact><dt><b>Returns:</b></dt><dd> the parameters for the operation
175
</p></div></div><a class="anchor" name="obj178041644"></a>
176
<div class="memitem">
177
<div class="memproto">
178
<table class="memname"><tr>
179
<td class="memname"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qvariant.html">QVariant</a> result</td>
181
<td class="paramtype"> </td>
182
<td class="paramname"><em>self</em> )</td>
183
<td width="100%"> </td>
187
<div class="memdoc"><p>Returns the result of the operation
190
The result will be invalid if the job has not completed yet, or
191
if the job does not have a meaningful result.
194
Note that this should not be used to find out whether the operation
195
was successful. Instead, you should check the value of error().
198
<dl class="return" compact><dt><b>Returns:</b></dt><dd> the result of the operation
200
</p></div></div><a class="anchor" name="obj178042892"></a>
201
<div class="memitem">
202
<div class="memproto">
203
<table class="memname"><tr>
204
<td class="memname"> setResult</td>
206
<td class="paramtype"> <em>self</em>, </td>
207
<td class="paramname"></td>
209
<td class="memname"></td>
211
<td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qvariant.html">QVariant</a> </td>
212
<td class="paramname"><em>result</em></td>
219
<td width="100%"> </td>
222
<div class="memdoc"><p>Sets the result for an operation.
223
</p></div></div><a class="anchor" name="obj178042060"></a>
224
<div class="memitem">
225
<div class="memproto">
226
<table class="memname"><tr>
227
<td class="memname"> start</td>
229
<td class="paramtype"> </td>
230
<td class="paramname"><em>self</em> )</td>
231
<td width="100%"> </td>
235
<div class="memdoc"><p>Default implementation of start, which simply sets the results to false.
236
This makes it easy to create a "failure" job.
244
<div class="menu_box">
245
<div class="nav_list">
247
<li><a href="../allclasses.html">Full Index</a></li>
251
<a name="cp-menu" /><div class="menutitle"><div>
252
<h2 id="cp-menu-project">Modules</h2>
254
<div class="nav_list">
256
<li><a href="../akonadi/index.html">akonadi</a></li>
257
<li><a href="../dnssd/index.html">dnssd</a></li>
258
<li><a href="../kdecore/index.html">kdecore</a></li>
259
<li><a href="../kdeui/index.html">kdeui</a></li>
260
<li><a href="../khtml/index.html">khtml</a></li>
261
<li><a href="../kio/index.html">kio</a></li>
262
<li><a href="../knewstuff/index.html">knewstuff</a></li>
263
<li><a href="../kparts/index.html">kparts</a></li>
264
<li><a href="../kutils/index.html">kutils</a></li>
265
<li><a href="../nepomuk/index.html">nepomuk</a></li>
266
<li><a href="../phonon/index.html">phonon</a></li>
267
<li><a href="../plasma/index.html">plasma</a></li>
268
<li><a href="../polkitqt/index.html">polkitqt</a></li>
269
<li><a href="../solid/index.html">solid</a></li>
270
<li><a href="../soprano/index.html">soprano</a></li>
276
<div class="clearer"/>
279
<div id="end_body"></div>
281
<div id="footer"><div id="footer_text">
282
This documentation is maintained by <a href="mailto:simon@simonzone.com">Simon Edwards</a>.<br />
283
KDE<sup>®</sup> and <a href="../images/kde_gear_black.png">the K Desktop Environment<sup>®</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> |
284
<a href="http://www.kde.org/contact/impressum.php">Legal</a>