source: trunk/doc/html/qurloperator.html@ 208

Last change on this file since 208 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 32.2 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qurloperator.cpp:88 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QUrlOperator Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QUrlOperator Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
33
34<p>The QUrlOperator class provides common operations on URLs.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qurloperator-h.html">qurloperator.h</a>&gt;</tt>
37<p>Inherits <a href="qobject.html">QObject</a> and <a href="qurl.html">QUrl</a>.
38<p><a href="qurloperator-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn><a href="#QUrlOperator"><b>QUrlOperator</b></a> ()</li>
42<li class=fn><a href="#QUrlOperator-2"><b>QUrlOperator</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;url )</li>
43<li class=fn><a href="#QUrlOperator-3"><b>QUrlOperator</b></a> ( const&nbsp;QUrlOperator&nbsp;&amp;&nbsp;url )</li>
44<li class=fn><a href="#QUrlOperator-4"><b>QUrlOperator</b></a> ( const&nbsp;QUrlOperator&nbsp;&amp;&nbsp;url, const&nbsp;QString&nbsp;&amp;&nbsp;relUrl, bool&nbsp;checkSlash = FALSE )</li>
45<li class=fn>virtual <a href="#~QUrlOperator"><b>~QUrlOperator</b></a> ()</li>
46<li class=fn>virtual const QNetworkOperation * <a href="#listChildren"><b>listChildren</b></a> ()</li>
47<li class=fn>virtual const QNetworkOperation * <a href="#mkdir"><b>mkdir</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;dirname )</li>
48<li class=fn>virtual const QNetworkOperation * <a href="#remove"><b>remove</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;filename )</li>
49<li class=fn>virtual const QNetworkOperation * <a href="#rename"><b>rename</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;oldname, const&nbsp;QString&nbsp;&amp;&nbsp;newname )</li>
50<li class=fn>virtual const QNetworkOperation * <a href="#get"><b>get</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;location = QString::null )</li>
51<li class=fn>virtual const QNetworkOperation * <a href="#put"><b>put</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;data, const&nbsp;QString&nbsp;&amp;&nbsp;location = QString::null )</li>
52<li class=fn>virtual QPtrList&lt;QNetworkOperation&gt; <a href="#copy"><b>copy</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;from, const&nbsp;QString&nbsp;&amp;&nbsp;to, bool&nbsp;move = FALSE, bool&nbsp;toPath = TRUE )</li>
53<li class=fn>virtual void <a href="#copy-2"><b>copy</b></a> ( const&nbsp;QStringList&nbsp;&amp;&nbsp;files, const&nbsp;QString&nbsp;&amp;&nbsp;dest, bool&nbsp;move = FALSE )</li>
54<li class=fn>virtual bool <a href="#isDir"><b>isDir</b></a> ( bool&nbsp;*&nbsp;ok = 0 )</li>
55<li class=fn>virtual void <a href="#setNameFilter"><b>setNameFilter</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;nameFilter )</li>
56<li class=fn>QString <a href="#nameFilter"><b>nameFilter</b></a> () const</li>
57<li class=fn>virtual QUrlInfo <a href="#info"><b>info</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;entry ) const</li>
58<li class=fn>virtual void <a href="#stop"><b>stop</b></a> ()</li>
59</ul>
60<h2>Signals</h2>
61<ul>
62<li class=fn>void <a href="#newChildren"><b>newChildren</b></a> ( const&nbsp;QValueList&lt;QUrlInfo&gt;&nbsp;&amp;&nbsp;i, QNetworkOperation&nbsp;*&nbsp;op )</li>
63<li class=fn>void <a href="#finished"><b>finished</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
64<li class=fn>void <a href="#start"><b>start</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
65<li class=fn>void <a href="#createdDirectory"><b>createdDirectory</b></a> ( const&nbsp;QUrlInfo&nbsp;&amp;&nbsp;i, QNetworkOperation&nbsp;*&nbsp;op )</li>
66<li class=fn>void <a href="#removed"><b>removed</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
67<li class=fn>void <a href="#itemChanged"><b>itemChanged</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
68<li class=fn>void <a href="#data"><b>data</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;data, QNetworkOperation&nbsp;*&nbsp;op )</li>
69<li class=fn>void <a href="#dataTransferProgress"><b>dataTransferProgress</b></a> ( int&nbsp;bytesDone, int&nbsp;bytesTotal, QNetworkOperation&nbsp;*&nbsp;op )</li>
70<li class=fn>void <a href="#startedNextCopy"><b>startedNextCopy</b></a> ( const&nbsp;QPtrList&lt;QNetworkOperation&gt;&nbsp;&amp;&nbsp;lst )</li>
71<li class=fn>void <a href="#connectionStateChanged"><b>connectionStateChanged</b></a> ( int&nbsp;state, const&nbsp;QString&nbsp;&amp;&nbsp;data )</li>
72</ul>
73<h2>Protected Members</h2>
74<ul>
75<li class=fn>virtual void <a href="#clearEntries"><b>clearEntries</b></a> ()</li>
76<li class=fn>void <a href="#getNetworkProtocol"><b>getNetworkProtocol</b></a> ()</li>
77<li class=fn>void <a href="#deleteNetworkProtocol"><b>deleteNetworkProtocol</b></a> ()</li>
78</ul>
79<h2>Related Functions</h2>
80<ul>
81<li class=fn>void <a href="#qInitNetworkProtocols"><b>qInitNetworkProtocols</b></a> ()</li>
82</ul>
83<hr><a name="details"></a><h2>Detailed Description</h2>
84
85
86<p> The QUrlOperator class provides common operations on URLs.
87
88<p>
89
90
91<p>
92<p> This class operates on hierarchical structures (such as
93filesystems) using URLs. Its API facilitates all the common
94operations:
95<center><table cellpadding="4" cellspacing="2" border="0">
96<tr bgcolor="#a2c511"> <th valign="top">Operation <th valign="top">Function
97<tr bgcolor="#f0f0f0"> <td valign="top">List files <td valign="top"><a href="#listChildren">listChildren</a>()
98<tr bgcolor="#d0d0d0"> <td valign="top">Make a directory <td valign="top"><a href="#mkdir">mkdir</a>()
99<tr bgcolor="#f0f0f0"> <td valign="top">Remove a file <td valign="top"><a href="#remove">remove</a>()
100<tr bgcolor="#d0d0d0"> <td valign="top">Rename a file <td valign="top"><a href="#rename">rename</a>()
101<tr bgcolor="#f0f0f0"> <td valign="top">Get a file <td valign="top"><a href="#get">get</a>()
102<tr bgcolor="#d0d0d0"> <td valign="top">Put a file <td valign="top"><a href="#put">put</a>()
103<tr bgcolor="#f0f0f0"> <td valign="top">Copy a file <td valign="top"><a href="#copy">copy</a>()
104</table></center>
105<p> You can obtain additional information about the URL with <a href="#isDir">isDir</a>()
106and <a href="#info">info</a>(). If a directory is to be traversed using
107<a href="#listChildren">listChildren</a>(), a name filter can be set with <a href="#setNameFilter">setNameFilter</a>().
108<p> A QUrlOperator can be used like this, for example to download a
109file (and assuming that the FTP protocol is <a href="#qInitNetworkProtocols">registered</a>):
110<pre>
111 QUrlOperator *op = new QUrlOperator();
112 op-&gt;<a href="#copy">copy</a>( QString("ftp://ftp.trolltech.com/qt/source/qt-2.1.0.tar.gz"),
113 "file:/tmp" );
114 </pre>
115
116<p> If you want to be notified about success/failure, progress, etc.,
117you can connect to QUrlOperator's signals, e.g. to <a href="#start">start</a>(),
118<a href="#newChildren">newChildren</a>(), <a href="#createdDirectory">createdDirectory</a>(), <a href="#removed">removed</a>(), <a href="#data">data</a>(),
119<a href="#dataTransferProgress">dataTransferProgress</a>(), <a href="#startedNextCopy">startedNextCopy</a>(),
120<a href="#connectionStateChanged">connectionStateChanged</a>(), <a href="#finished">finished</a>(), etc. A network operation can
121be stopped with <a href="#stop">stop</a>().
122<p> The class uses the functionality of registered network protocols
123to perform these operations. Depending of the protocol of the URL,
124it uses an appropriate network protocol class for the operations.
125Each of the operation functions of QUrlOperator creates a
126<a href="qnetworkoperation.html">QNetworkOperation</a> object that describes the operation and puts it
127into the operation queue for the network protocol used. If no
128suitable protocol could be found (because no implementation of the
129necessary network protocol is registered), the URL operator emits
130errors. Not every protocol supports every operation, but error
131handling deals with this problem.
132<p> To register the available network protocols, use the
133<a href="#qInitNetworkProtocols">qInitNetworkProtocols</a>() function. The protocols currently
134supported are:
135<ul>
136<li> <a href="qftp.html">FTP</a>,
137<li> <a href="qhttp.html">HTTP</a>,
138<li> <a href="qlocalfs.html">local file system</a>.
139</ul>
140<p> For more information about the Qt Network Architecture see the
141<a href="network.html">Qt Network Documentation</a>.
142<p> <p>See also <a href="qnetworkprotocol.html">QNetworkProtocol</a>, <a href="qnetworkoperation.html">QNetworkOperation</a>, <a href="io.html">Input/Output and Networking</a>, and <a href="misc.html">Miscellaneous Classes</a>.
143
144<hr><h2>Member Function Documentation</h2>
145<h3 class=fn><a name="QUrlOperator"></a>QUrlOperator::QUrlOperator ()
146</h3>
147Constructs a QUrlOperator with an empty (i.e. invalid) URL.
148
149<h3 class=fn><a name="QUrlOperator-2"></a>QUrlOperator::QUrlOperator ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;url )
150</h3>
151Constructs a QUrlOperator using <em>url</em> and parses this string.
152<p> If you pass strings like "/home/qt" the "file" protocol is
153assumed.
154
155<h3 class=fn><a name="QUrlOperator-3"></a>QUrlOperator::QUrlOperator ( const&nbsp;<a href="qurloperator.html">QUrlOperator</a>&nbsp;&amp;&nbsp;url )
156</h3>
157Constructs a copy of <em>url</em>.
158
159<h3 class=fn><a name="QUrlOperator-4"></a>QUrlOperator::QUrlOperator ( const&nbsp;<a href="qurloperator.html">QUrlOperator</a>&nbsp;&amp;&nbsp;url, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;relUrl, bool&nbsp;checkSlash = FALSE )
160</h3>
161Constructs a QUrlOperator. The URL on which this QUrlOperator
162operates is constructed out of the arguments <em>url</em>, <em>relUrl</em> and
163<em>checkSlash</em>: see the corresponding <a href="qurl.html">QUrl</a> constructor for an
164explanation of these arguments.
165
166<h3 class=fn><a name="~QUrlOperator"></a>QUrlOperator::~QUrlOperator ()<tt> [virtual]</tt>
167</h3>
168Destructor.
169
170<h3 class=fn>void <a name="clearEntries"></a>QUrlOperator::clearEntries ()<tt> [virtual protected]</tt>
171</h3>
172Clears the cache of children.
173
174<h3 class=fn>void <a name="connectionStateChanged"></a>QUrlOperator::connectionStateChanged ( int&nbsp;state, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;data )<tt> [signal]</tt>
175</h3>
176
177<p> This signal is emitted whenever the URL operator's connection
178state changes. <em>state</em> describes the new state, which is a
179<a href="qnetworkprotocol.html#ConnectionState-enum">QNetworkProtocol::ConnectionState</a> value.
180<p> <em>data</em> is a string that describes the change of the connection.
181This can be used to display a message to the user.
182
183<h3 class=fn><a href="qptrlist.html">QPtrList</a>&lt;QNetworkOperation&gt; <a name="copy"></a>QUrlOperator::copy ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;from, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;to, bool&nbsp;move = FALSE, bool&nbsp;toPath = TRUE )<tt> [virtual]</tt>
184</h3>
185Copies the file <em>from</em> to <em>to</em>. If <em>move</em> is TRUE, the file is
186moved (copied and removed). <em>from</em> must point to a file and <em>to</em>
187must point to a directory (into which <em>from</em> is copied) unless <em>toPath</em> is set to FALSE. If <em>toPath</em> is set to FALSE then the <em>to</em> variable is assumed to be the absolute file path (destination
188file path + file name). The copying is done using the <a href="#get">get</a>() and
189<a href="#put">put</a>() operations. If you want to be notified about the progress of
190the operation, connect to the <a href="#dataTransferProgress">dataTransferProgress</a>() signal. Bear
191in mind that the get() and put() operations emit this signal
192through the QUrlOperator. The number of transferred bytes and the
193total bytes that you receive as arguments in this signal do not
194relate to the the whole copy operation; they relate first to the
195get() and then to the put() operation. Always check what type of
196operation the signal comes from; this is given in the signal's
197last argument.
198<p> At the end, <a href="#finished">finished</a>() (with success or failure) is emitted, so
199check the state of the network operation object to see whether or
200not the operation was successful.
201<p> Because a move or copy operation consists of multiple operations
202(get(), put() and maybe <a href="#remove">remove</a>()), this function doesn't return a
203single <a href="qnetworkoperation.html">QNetworkOperation</a>, but rather a list of them. They are in
204the order: <a href="#get">get</a>(), <a href="#put">put</a>() and (if applicable) remove().
205<p> <p>See also <a href="#get">get</a>() and <a href="#put">put</a>().
206
207<h3 class=fn>void <a name="copy-2"></a>QUrlOperator::copy ( const&nbsp;<a href="qstringlist.html">QStringList</a>&nbsp;&amp;&nbsp;files, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;dest, bool&nbsp;move = FALSE )<tt> [virtual]</tt>
208</h3>
209This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
210<p> Copies the <em>files</em> to the directory <em>dest</em>. If <em>move</em> is TRUE
211the files are moved, not copied. <em>dest</em> must point to a
212directory.
213<p> This function calls <a href="#copy">copy</a>() for each entry in <em>files</em> in turn. You
214don't get a result from this function; each time a new copy
215begins, <a href="#startedNextCopy">startedNextCopy</a>() is emitted, with a list of
216QNetworkOperations that describe the new copy operation.
217
218<h3 class=fn>void <a name="createdDirectory"></a>QUrlOperator::createdDirectory ( const&nbsp;<a href="qurlinfo.html">QUrlInfo</a>&nbsp;&amp;&nbsp;i, <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
219</h3>
220
221<p> This signal is emitted when <a href="#mkdir">mkdir</a>() succeeds and the directory has
222been created. <em>i</em> holds the information about the new directory.
223<p> <em>op</em> is a pointer to the operation object, which contains all the
224information about the operation, including the state.
225<tt>op-&gt;arg(0)</tt> holds the new directory's name.
226<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
227
228<h3 class=fn>void <a name="data"></a>QUrlOperator::data ( const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;data, <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
229</h3>
230
231<p> This signal is emitted when new <em>data</em> has been received after calling
232<a href="#get">get</a>() or <a href="#put">put</a>().
233<em>op</em> is a pointer to the operation object which contains all
234the information about the operation, including the state.
235<tt>op-&gt;arg(0)</tt> holds the name of the file whose data is retrieved
236and op->rawArg(1) holds the (raw) data.
237<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
238
239<h3 class=fn>void <a name="dataTransferProgress"></a>QUrlOperator::dataTransferProgress ( int&nbsp;bytesDone, int&nbsp;bytesTotal, <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
240</h3>
241
242<p> This signal is emitted during data transfer (using <a href="#put">put</a>() or
243<a href="#get">get</a>()). <em>bytesDone</em> specifies how many bytes of <em>bytesTotal</em> have
244been transferred. More information about the operation is stored in
245<em>op</em>, a pointer to the network operation that is processed.
246<em>bytesTotal</em> may be -1, which means that the total number of bytes
247is not known.
248<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
249
250<h3 class=fn>void <a name="deleteNetworkProtocol"></a>QUrlOperator::deleteNetworkProtocol ()<tt> [protected]</tt>
251</h3>
252Deletes the currently used network protocol.
253
254<h3 class=fn>void <a name="finished"></a>QUrlOperator::finished ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
255</h3>
256
257<p> This signal is emitted when an operation of some sort finishes,
258whether with success or failure. <em>op</em> is a pointer to the
259operation object, which contains all the information, including
260the state, of the operation which has been finished. Check the
261state and error code of the operation object to see whether or not
262the operation was successful.
263<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
264
265<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;* <a name="get"></a>QUrlOperator::get ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;location = QString::null )<tt> [virtual]</tt>
266</h3>
267Tells the network protocol to get data from <em>location</em> or, if
268this is <a href="qstring.html#QString-null">QString::null</a>, to get data from the location to which this
269URL points (see <a href="qurl.html#fileName">QUrl::fileName</a>() and <a href="qurl.html#encodedPathAndQuery">QUrl::encodedPathAndQuery</a>()).
270What happens then depends on the network protocol. The <a href="#data">data</a>()
271signal is emitted when data comes in. Because it's unlikely that
272all data will come in at once, it is common for multiple data()
273signals to be emitted. The <a href="#dataTransferProgress">dataTransferProgress</a>() signal is
274emitted while processing the operation. At the end, <a href="#finished">finished</a>()
275(with success or failure) is emitted, so check the state of the
276network operation object to see whether or not the operation was
277successful.
278<p> If <em>location</em> is QString::null, the path of this QUrlOperator
279should point to a file when you use this operation. If <em>location</em>
280is not empty, it can be a relative URL (a child of the path to
281which the QUrlOperator points) or an absolute URL.
282<p> For example, to get a web page you might do something like this:
283<p> <pre>
284 QUrlOperator op( "http://www.whatever.org/cgi-bin/search.pl?cmd=Hello" );
285 op.<a href="#get">get</a>();
286 </pre>
287
288<p> For most other operations, the path of the QUrlOperator must point
289to a directory. If you want to download a file you could do the
290following:
291<p> <pre>
292 QUrlOperator op( "ftp://ftp.whatever.org/pub" );
293 // do some other stuff like op.<a href="#listChildren">listChildren</a>() or op.<a href="#mkdir">mkdir</a>( "new_dir" )
294 op.<a href="#get">get</a>( "a_file.txt" );
295 </pre>
296
297<p> This will get the data of ftp://ftp.whatever.org/pub/a_file.txt.
298<p> <em>Never</em> do anything like this:
299<pre>
300 QUrlOperator op( "http://www.whatever.org/cgi-bin" );
301 op.<a href="#get">get</a>( "search.pl?cmd=Hello" ); // WRONG!
302 </pre>
303
304<p> If <em>location</em> is not empty and relative it must not contain any
305queries or references, just the name of a child. So if you need to
306specify a query or reference, do it as shown in the first example
307or specify the full URL (such as
308http://www.whatever.org/cgi-bin/search.pl?cmd=Hello) as <em>location</em>.
309<p> <p>See also <a href="#copy">copy</a>().
310
311<h3 class=fn>void <a name="getNetworkProtocol"></a>QUrlOperator::getNetworkProtocol ()<tt> [protected]</tt>
312</h3>
313Finds a network protocol for the URL and deletes the old network protocol.
314
315<h3 class=fn><a href="qurlinfo.html">QUrlInfo</a> <a name="info"></a>QUrlOperator::info ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;entry ) const<tt> [virtual]</tt>
316</h3>
317Returns the URL information for the child <em>entry</em>, or returns an
318empty <a href="qurlinfo.html">QUrlInfo</a> object if there is no information available about
319<em>entry</em>. Information about <em>entry</em> is only available after a successfully
320finished <a href="#listChildren">listChildren</a>() operation.
321
322<h3 class=fn>bool <a name="isDir"></a>QUrlOperator::isDir ( bool&nbsp;*&nbsp;ok = 0 )<tt> [virtual]</tt>
323</h3>
324Returns TRUE if the URL is a directory; otherwise returns FALSE.
325This may not always work correctly, if the protocol of the URL is
326something other than file (local filesystem). If you pass a bool
327pointer as the <em>ok</em> argument, <em>*ok</em> is set to TRUE if the result
328of this function is known to be correct, and to FALSE otherwise.
329
330<h3 class=fn>void <a name="itemChanged"></a>QUrlOperator::itemChanged ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
331</h3>
332
333<p> This signal is emitted whenever a file which is a child of the URL
334has been changed, for example by successfully calling <a href="#rename">rename</a>().
335<em>op</em> is a pointer to the operation object which contains all the
336information about the operation, including the state.
337<tt>op-&gt;arg(0)</tt> holds the original file name and <tt>op-&gt;arg(1)</tt> holds
338the new file name (if it was changed).
339<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
340
341<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;* <a name="listChildren"></a>QUrlOperator::listChildren ()<tt> [virtual]</tt>
342</h3>
343Starts listing the children of this URL (e.g. the files in the
344directory). The <a href="#start">start</a>() signal is emitted before the first entry
345is listed and <a href="#finished">finished</a>() is emitted after the last one. The
346<a href="#newChildren">newChildren</a>() signal is emitted for each list of new entries. If
347an error occurs, the signal finished() is emitted, so be sure to
348check the state of the network operation pointer.
349<p> Because the operation may not be executed immediately, a pointer
350to the <a href="qnetworkoperation.html">QNetworkOperation</a> object created by this function is
351returned. This object contains all the data about the operation
352and is used to refer to this operation later (e.g. in the signals
353that are emitted by the QUrlOperator). The return value can also
354be 0 if the operation object couldn't be created.
355<p> The path of this QUrlOperator must to point to a directory
356(because the children of this directory will be listed), not to a
357file.
358
359<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;* <a name="mkdir"></a>QUrlOperator::mkdir ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;dirname )<tt> [virtual]</tt>
360</h3>
361Tries to create a directory (child) with the name <em>dirname</em>. If
362it is successful, a <a href="#newChildren">newChildren</a>() signal with the new child is
363emitted, and the <a href="#createdDirectory">createdDirectory</a>() signal with the information
364about the new child is also emitted. The <a href="#finished">finished</a>() signal (with
365success or failure) is emitted after the operation has been
366processed, so check the state of the network operation object to
367see whether or not the operation was successful.
368<p> Because the operation will not be executed immediately, a pointer
369to the <a href="qnetworkoperation.html">QNetworkOperation</a> object created by this function is
370returned. This object contains all the data about the operation
371and is used to refer to this operation later (e.g. in the signals
372that are emitted by the QUrlOperator). The return value can also
373be 0 if the operation object couldn't be created.
374<p> The path of this QUrlOperator must to point to a directory (not a
375file) because the new directory will be created in this path.
376
377<h3 class=fn><a href="qstring.html">QString</a> <a name="nameFilter"></a>QUrlOperator::nameFilter () const
378</h3>
379Returns the name filter of the URL.
380<p> <p>See also <a href="#setNameFilter">QUrlOperator::setNameFilter</a>() and <a href="qdir.html#nameFilter">QDir::nameFilter</a>().
381
382<h3 class=fn>void <a name="newChildren"></a>QUrlOperator::newChildren ( const&nbsp;<a href="qvaluelist.html">QValueList</a>&lt;QUrlInfo&gt;&nbsp;&amp;&nbsp;i, <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
383</h3>
384
385<p> This signal is emitted after <a href="#listChildren">listChildren</a>() was called and new
386children (i.e. files) have been read from a list of files. <em>i</em>
387holds the information about the new files. <em>op</em> is a pointer
388to the operation object which contains all the information about
389the operation, including the state.
390<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
391
392<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;* <a name="put"></a>QUrlOperator::put ( const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;data, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;location = QString::null )<tt> [virtual]</tt>
393</h3>
394This function tells the network protocol to put <em>data</em> in <em>location</em>. If <em>location</em> is empty (QString::null), it puts the <em>data</em> in the location to which the URL points. What happens depends
395on the network protocol. Depending on the network protocol, some
396data might come back after putting data, in which case the <a href="#data">data</a>()
397signal is emitted. The <a href="#dataTransferProgress">dataTransferProgress</a>() signal is emitted
398during processing of the operation. At the end, <a href="#finished">finished</a>() (with
399success or failure) is emitted, so check the state of the network
400operation object to see whether or not the operation was
401successful.
402<p> If <em>location</em> is <a href="qstring.html#QString-null">QString::null</a>, the path of this QUrlOperator
403should point to a file when you use this operation. If <em>location</em>
404is not empty, it can be a relative (a child of the path to which
405the QUrlOperator points) or an absolute URL.
406<p> For putting some data to a file you can do the following:
407<p> <pre>
408 QUrlOperator op( "ftp://ftp.whatever.com/home/me/filename.dat" );
409 op.<a href="#put">put</a>( data );
410 </pre>
411
412<p> For most other operations, the path of the QUrlOperator must point
413to a directory. If you want to upload data to a file you could do
414the following:
415<p> <pre>
416 QUrlOperator op( "ftp://ftp.whatever.com/home/me" );
417 // do some other stuff like op.<a href="#listChildren">listChildren</a>() or op.<a href="#mkdir">mkdir</a>( "new_dir" )
418 op.<a href="#put">put</a>( data, "filename.dat" );
419 </pre>
420
421<p> This will upload the data to ftp://ftp.whatever.com/home/me/filename.dat.
422<p> <p>See also <a href="#copy">copy</a>().
423
424<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;* <a name="remove"></a>QUrlOperator::remove ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filename )<tt> [virtual]</tt>
425</h3>
426Tries to remove the file (child) <em>filename</em>. If it succeeds the
427<a href="#removed">removed</a>() signal is emitted. <a href="#finished">finished</a>() (with success or failure)
428is also emitted after the operation has been processed, so check
429the state of the network operation object to see whether or not
430the operation was successful.
431<p> Because the operation will not be executed immediately, a pointer
432to the <a href="qnetworkoperation.html">QNetworkOperation</a> object created by this function is
433returned. This object contains all the data about the operation
434and is used to refer to this operation later (e.g. in the signals
435that are emitted by the QUrlOperator). The return value can also
436be 0 if the operation object couldn't be created.
437<p> The path of this QUrlOperator must point to a directory; because
438if <em>filename</em> is relative, it will try to remove it in this
439directory.
440
441<h3 class=fn>void <a name="removed"></a>QUrlOperator::removed ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
442</h3>
443
444<p> This signal is emitted when <a href="#remove">remove</a>() has been succesful and the
445file has been removed.
446<p> <em>op</em> is a pointer to the operation object which contains all the
447information about the operation, including the state.
448<tt>op-&gt;arg(0)</tt> holds the name of the file that was removed.
449<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
450
451<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;* <a name="rename"></a>QUrlOperator::rename ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;oldname, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;newname )<tt> [virtual]</tt>
452</h3>
453Tries to rename the file (child) called <em>oldname</em> to <em>newname</em>.
454If it succeeds, the <a href="#itemChanged">itemChanged</a>() signal is emitted. <a href="#finished">finished</a>()
455(with success or failure) is also emitted after the operation has
456been processed, so check the state of the network operation object
457to see whether or not the operation was successful.
458<p> Because the operation may not be executed immediately, a pointer
459to the <a href="qnetworkoperation.html">QNetworkOperation</a> object created by this function is
460returned. This object contains all the data about the operation
461and is used to refer to this operation later (e.g. in the signals
462that are emitted by the QUrlOperator). The return value can also
463be 0 if the operation object couldn't be created.
464<p> This path of this QUrlOperator must to point to a directory
465because <em>oldname</em> and <em>newname</em> are handled relative to this
466directory.
467
468<h3 class=fn>void <a name="setNameFilter"></a>QUrlOperator::setNameFilter ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;nameFilter )<tt> [virtual]</tt>
469</h3>
470Sets the name filter of the URL to <em>nameFilter</em>.
471<p> <p>See also <a href="qdir.html#setNameFilter">QDir::setNameFilter</a>().
472
473<h3 class=fn>void <a name="start"></a>QUrlOperator::start ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
474</h3>
475
476<p> Some operations (such as <a href="#listChildren">listChildren</a>()) emit this signal when
477they start processing the operation. <em>op</em> is a pointer to the
478operation object which contains all the information about the
479operation, including the state.
480<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
481
482<h3 class=fn>void <a name="startedNextCopy"></a>QUrlOperator::startedNextCopy ( const&nbsp;<a href="qptrlist.html">QPtrList</a>&lt;QNetworkOperation&gt;&nbsp;&amp;&nbsp;lst )<tt> [signal]</tt>
483</h3>
484
485<p> This signal is emitted if <a href="#copy">copy</a>() starts a new copy operation. <em>lst</em> contains all QNetworkOperations related to this copy
486operation.
487<p> <p>See also <a href="#copy">copy</a>().
488
489<h3 class=fn>void <a name="stop"></a>QUrlOperator::stop ()<tt> [virtual]</tt>
490</h3>
491Stops the current network operation and removes all this
492QUrlOperator's waiting network operations.
493
494<hr><h2>Related Functions</h2>
495<h3 class=fn>void <a name="qInitNetworkProtocols"></a>qInitNetworkProtocols ()
496</h3>
497
498<p> This function registers the network protocols for FTP and HTTP.
499You must call this function before you use QUrlOperator for
500these protocols.
501<p> This function is declared in <a href="qnetwork-h.html">qnetwork.h</a>.
502
503<!-- eof -->
504<hr><p>
505This file is part of the <a href="index.html">Qt toolkit</a>.
506Copyright &copy; 1995-2007
507<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
508<table width=100% cellspacing=0 border=0><tr>
509<td>Copyright &copy; 2007
510<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
511<td align=right><div align=right>Qt 3.3.8</div>
512</table></div></address></body>
513</html>
Note: See TracBrowser for help on using the repository browser.