summaryrefslogtreecommitdiffstats
path: root/doc/html/ntqurloperator.html
blob: 5cc27812725be7ebd2c8a75c5eca29a7744bb12b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qurloperator.cpp:88 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQUrlOperator Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQUrlOperator Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>

<p>The TQUrlOperator class provides common operations on URLs.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qurloperator-h.html">ntqurloperator.h</a>&gt;</tt>
<p>Inherits <a href="tqobject.html">TQObject</a> and <a href="ntqurl.html">TQUrl</a>.
<p><a href="qurloperator-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQUrlOperator"><b>TQUrlOperator</b></a> ()</li>
<li class=fn><a href="#TQUrlOperator-2"><b>TQUrlOperator</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;url )</li>
<li class=fn><a href="#TQUrlOperator-3"><b>TQUrlOperator</b></a> ( const&nbsp;TQUrlOperator&nbsp;&amp;&nbsp;url )</li>
<li class=fn><a href="#TQUrlOperator-4"><b>TQUrlOperator</b></a> ( const&nbsp;TQUrlOperator&nbsp;&amp;&nbsp;url, const&nbsp;TQString&nbsp;&amp;&nbsp;relUrl, bool&nbsp;checkSlash = FALSE )</li>
<li class=fn>virtual <a href="#~TQUrlOperator"><b>~TQUrlOperator</b></a> ()</li>
<li class=fn>virtual const TQNetworkOperation * <a href="#listChildren"><b>listChildren</b></a> ()</li>
<li class=fn>virtual const TQNetworkOperation * <a href="#mkdir"><b>mkdir</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;dirname )</li>
<li class=fn>virtual const TQNetworkOperation * <a href="#remove"><b>remove</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filename )</li>
<li class=fn>virtual const TQNetworkOperation * <a href="#rename"><b>rename</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;oldname, const&nbsp;TQString&nbsp;&amp;&nbsp;newname )</li>
<li class=fn>virtual const TQNetworkOperation * <a href="#get"><b>get</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;location = TQString::null )</li>
<li class=fn>virtual const TQNetworkOperation * <a href="#put"><b>put</b></a> ( const&nbsp;TQByteArray&nbsp;&amp;&nbsp;data, const&nbsp;TQString&nbsp;&amp;&nbsp;location = TQString::null )</li>
<li class=fn>virtual TQPtrList&lt;TQNetworkOperation&gt; <a href="#copy"><b>copy</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;from, const&nbsp;TQString&nbsp;&amp;&nbsp;to, bool&nbsp;move = FALSE, bool&nbsp;toPath = TRUE )</li>
<li class=fn>virtual void <a href="#copy-2"><b>copy</b></a> ( const&nbsp;TQStringList&nbsp;&amp;&nbsp;files, const&nbsp;TQString&nbsp;&amp;&nbsp;dest, bool&nbsp;move = FALSE )</li>
<li class=fn>virtual bool <a href="#isDir"><b>isDir</b></a> ( bool&nbsp;*&nbsp;ok = 0 )</li>
<li class=fn>virtual void <a href="#setNameFilter"><b>setNameFilter</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;nameFilter )</li>
<li class=fn>TQString <a href="#nameFilter"><b>nameFilter</b></a> () const</li>
<li class=fn>virtual TQUrlInfo <a href="#info"><b>info</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;entry ) const</li>
<li class=fn>virtual void <a href="#stop"><b>stop</b></a> ()</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#newChildren"><b>newChildren</b></a> ( const&nbsp;TQValueList&lt;TQUrlInfo&gt;&nbsp;&amp;&nbsp;i, TQNetworkOperation&nbsp;*&nbsp;op )</li>
<li class=fn>void <a href="#finished"><b>finished</b></a> ( TQNetworkOperation&nbsp;*&nbsp;op )</li>
<li class=fn>void <a href="#start"><b>start</b></a> ( TQNetworkOperation&nbsp;*&nbsp;op )</li>
<li class=fn>void <a href="#createdDirectory"><b>createdDirectory</b></a> ( const&nbsp;TQUrlInfo&nbsp;&amp;&nbsp;i, TQNetworkOperation&nbsp;*&nbsp;op )</li>
<li class=fn>void <a href="#removed"><b>removed</b></a> ( TQNetworkOperation&nbsp;*&nbsp;op )</li>
<li class=fn>void <a href="#itemChanged"><b>itemChanged</b></a> ( TQNetworkOperation&nbsp;*&nbsp;op )</li>
<li class=fn>void <a href="#data"><b>data</b></a> ( const&nbsp;TQByteArray&nbsp;&amp;&nbsp;data, TQNetworkOperation&nbsp;*&nbsp;op )</li>
<li class=fn>void <a href="#dataTransferProgress"><b>dataTransferProgress</b></a> ( int&nbsp;bytesDone, int&nbsp;bytesTotal, TQNetworkOperation&nbsp;*&nbsp;op )</li>
<li class=fn>void <a href="#startedNextCopy"><b>startedNextCopy</b></a> ( const&nbsp;TQPtrList&lt;TQNetworkOperation&gt;&nbsp;&amp;&nbsp;lst )</li>
<li class=fn>void <a href="#connectionStateChanged"><b>connectionStateChanged</b></a> ( int&nbsp;state, const&nbsp;TQString&nbsp;&amp;&nbsp;data )</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual void <a href="#clearEntries"><b>clearEntries</b></a> ()</li>
<li class=fn>void <a href="#getNetworkProtocol"><b>getNetworkProtocol</b></a> ()</li>
<li class=fn>void <a href="#deleteNetworkProtocol"><b>deleteNetworkProtocol</b></a> ()</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>void <a href="#qInitNetworkProtocols"><b>tqInitNetworkProtocols</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


<p> The TQUrlOperator class provides common operations on URLs.

<p> 


<p> 
<p> This class operates on hierarchical structures (such as
filesystems) using URLs. Its API facilitates all the common
operations:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Operation	<th valign="top">Function
<tr bgcolor="#f0f0f0"> <td valign="top">List files		<td valign="top"><a href="#listChildren">listChildren</a>()
<tr bgcolor="#d0d0d0"> <td valign="top">Make a directory	<td valign="top"><a href="#mkdir">mkdir</a>()
<tr bgcolor="#f0f0f0"> <td valign="top">Remove a file	<td valign="top"><a href="#remove">remove</a>()
<tr bgcolor="#d0d0d0"> <td valign="top">Rename a file	<td valign="top"><a href="#rename">rename</a>()
<tr bgcolor="#f0f0f0"> <td valign="top">Get a file		<td valign="top"><a href="#get">get</a>()
<tr bgcolor="#d0d0d0"> <td valign="top">Put a file		<td valign="top"><a href="#put">put</a>()
<tr bgcolor="#f0f0f0"> <td valign="top">Copy a file		<td valign="top"><a href="#copy">copy</a>()
</table></center>
<p> You can obtain additional information about the URL with <a href="#isDir">isDir</a>()
and <a href="#info">info</a>(). If a directory is to be traversed using
<a href="#listChildren">listChildren</a>(), a name filter can be set with <a href="#setNameFilter">setNameFilter</a>().
<p> A TQUrlOperator can be used like this, for example to download a
file (and assuming that the FTP protocol is <a href="#qInitNetworkProtocols">registered</a>):
<pre>
    TQUrlOperator *op = new TQUrlOperator();
    op-&gt;<a href="#copy">copy</a>( TQString("ftp://ftp.trolltech.com/qt/source/qt-2.1.0.tar.gz"),
             "file:/tmp" );
    </pre>
 
<p> If you want to be notified about success/failure, progress, etc.,
you can connect to TQUrlOperator's signals, e.g. to <a href="#start">start</a>(),
<a href="#newChildren">newChildren</a>(), <a href="#createdDirectory">createdDirectory</a>(), <a href="#removed">removed</a>(), <a href="#data">data</a>(),
<a href="#dataTransferProgress">dataTransferProgress</a>(), <a href="#startedNextCopy">startedNextCopy</a>(),
<a href="#connectionStateChanged">connectionStateChanged</a>(), <a href="#finished">finished</a>(), etc. A network operation can
be stopped with <a href="#stop">stop</a>().
<p> The class uses the functionality of registered network protocols
to perform these operations. Depending of the protocol of the URL,
it uses an appropriate network protocol class for the operations.
Each of the operation functions of TQUrlOperator creates a
<a href="qnetworkoperation.html">TQNetworkOperation</a> object that describes the operation and puts it
into the operation queue for the network protocol used. If no
suitable protocol could be found (because no implementation of the
necessary network protocol is registered), the URL operator emits
errors. Not every protocol supports every operation, but error
handling deals with this problem.
<p> To register the available network protocols, use the
<a href="#qInitNetworkProtocols">tqInitNetworkProtocols</a>() function. The protocols currently
supported are:
<ul>
<li> <a href="ntqftp.html">FTP</a>,
<li> <a href="ntqhttp.html">HTTP</a>,
<li> <a href="ntqlocalfs.html">local file system</a>.
</ul>
<p> For more information about the TQt Network Architecture see the
<a href="network.html">TQt Network Documentation</a>.
<p> <p>See also <a href="ntqnetworkprotocol.html">TQNetworkProtocol</a>, <a href="qnetworkoperation.html">TQNetworkOperation</a>, <a href="io.html">Input/Output and Networking</a>, and <a href="misc.html">Miscellaneous Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQUrlOperator"></a>TQUrlOperator::TQUrlOperator ()
</h3>
Constructs a TQUrlOperator with an empty (i.e. invalid) URL.

<h3 class=fn><a name="TQUrlOperator-2"></a>TQUrlOperator::TQUrlOperator ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;url )
</h3>
Constructs a TQUrlOperator using <em>url</em> and parses this string.
<p> If you pass strings like "/home/qt" the "file" protocol is
assumed.

<h3 class=fn><a name="TQUrlOperator-3"></a>TQUrlOperator::TQUrlOperator ( const&nbsp;<a href="ntqurloperator.html">TQUrlOperator</a>&nbsp;&amp;&nbsp;url )
</h3>
Constructs a copy of <em>url</em>.

<h3 class=fn><a name="TQUrlOperator-4"></a>TQUrlOperator::TQUrlOperator ( const&nbsp;<a href="ntqurloperator.html">TQUrlOperator</a>&nbsp;&amp;&nbsp;url, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;relUrl, bool&nbsp;checkSlash = FALSE )
</h3>
Constructs a TQUrlOperator. The URL on which this TQUrlOperator
operates is constructed out of the arguments <em>url</em>, <em>relUrl</em> and
<em>checkSlash</em>: see the corresponding <a href="ntqurl.html">TQUrl</a> constructor for an
explanation of these arguments.

<h3 class=fn><a name="~TQUrlOperator"></a>TQUrlOperator::~TQUrlOperator ()<tt> [virtual]</tt>
</h3>
Destructor.

<h3 class=fn>void <a name="clearEntries"></a>TQUrlOperator::clearEntries ()<tt> [virtual protected]</tt>
</h3>
Clears the cache of children.

<h3 class=fn>void <a name="connectionStateChanged"></a>TQUrlOperator::connectionStateChanged ( int&nbsp;state, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;data )<tt> [signal]</tt>
</h3>

<p> This signal is emitted whenever the URL operator's connection
state changes. <em>state</em> describes the new state, which is a
<a href="ntqnetworkprotocol.html#ConnectionState-enum">TQNetworkProtocol::ConnectionState</a> value.
<p> <em>data</em> is a string that describes the change of the connection.
This can be used to display a message to the user.

<h3 class=fn><a href="tqptrlist.html">TQPtrList</a>&lt;TQNetworkOperation&gt; <a name="copy"></a>TQUrlOperator::copy ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;from, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;to, bool&nbsp;move = FALSE, bool&nbsp;toPath = TRUE )<tt> [virtual]</tt>
</h3>
Copies the file <em>from</em> to <em>to</em>. If <em>move</em> is TRUE, the file is
moved (copied and removed). <em>from</em> must point to a file and <em>to</em>
must 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
file path + file name). The copying is done using the <a href="#get">get</a>() and
<a href="#put">put</a>() operations. If you want to be notified about the progress of
the operation, connect to the <a href="#dataTransferProgress">dataTransferProgress</a>() signal. Bear
in mind that the get() and put() operations emit this signal
through the TQUrlOperator. The number of transferred bytes and the
total bytes that you receive as arguments in this signal do not
relate to the the whole copy operation; they relate first to the
get() and then to the put() operation. Always check what type of
operation the signal comes from; this is given in the signal's
last argument.
<p> At the end, <a href="#finished">finished</a>() (with success or failure) is emitted, so
check the state of the network operation object to see whether or
not the operation was successful.
<p> Because a move or copy operation consists of multiple operations
(get(), put() and maybe <a href="#remove">remove</a>()), this function doesn't return a
single <a href="qnetworkoperation.html">TQNetworkOperation</a>, but rather a list of them. They are in
the order: <a href="#get">get</a>(), <a href="#put">put</a>() and (if applicable) remove().
<p> <p>See also <a href="#get">get</a>() and <a href="#put">put</a>().

<h3 class=fn>void <a name="copy-2"></a>TQUrlOperator::copy ( const&nbsp;<a href="tqstringlist.html">TQStringList</a>&nbsp;&amp;&nbsp;files, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;dest, bool&nbsp;move = FALSE )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Copies the <em>files</em> to the directory <em>dest</em>. If <em>move</em> is TRUE
the files are moved, not copied. <em>dest</em> must point to a
directory.
<p> This function calls <a href="#copy">copy</a>() for each entry in <em>files</em> in turn. You
don't get a result from this function; each time a new copy
begins, <a href="#startedNextCopy">startedNextCopy</a>() is emitted, with a list of
TQNetworkOperations that describe the new copy operation.

<h3 class=fn>void <a name="createdDirectory"></a>TQUrlOperator::createdDirectory ( const&nbsp;<a href="ntqurlinfo.html">TQUrlInfo</a>&nbsp;&amp;&nbsp;i, <a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when <a href="#mkdir">mkdir</a>() succeeds and the directory has
been created. <em>i</em> holds the information about the new directory.
<p> <em>op</em> is a pointer to the operation object, which contains all the
information about the operation, including the state.
<tt>op-&gt;arg(0)</tt> holds the new directory's name.
<p> <p>See also <a href="qnetworkoperation.html">TQNetworkOperation</a> and <a href="ntqnetworkprotocol.html">TQNetworkProtocol</a>.

<h3 class=fn>void <a name="data"></a>TQUrlOperator::data ( const&nbsp;<a href="tqbytearray.html">TQByteArray</a>&nbsp;&amp;&nbsp;data, <a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when new <em>data</em> has been received after calling
<a href="#get">get</a>() or <a href="#put">put</a>().
<em>op</em> is a pointer to the operation object which contains all
the information about the operation, including the state.
<tt>op-&gt;arg(0)</tt> holds the name of the file whose data is retrieved
and op->rawArg(1) holds the (raw) data.
<p> <p>See also <a href="qnetworkoperation.html">TQNetworkOperation</a> and <a href="ntqnetworkprotocol.html">TQNetworkProtocol</a>.

<h3 class=fn>void <a name="dataTransferProgress"></a>TQUrlOperator::dataTransferProgress ( int&nbsp;bytesDone, int&nbsp;bytesTotal, <a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
</h3>

<p> This signal is emitted during data transfer (using <a href="#put">put</a>() or
<a href="#get">get</a>()). <em>bytesDone</em> specifies how many bytes of <em>bytesTotal</em> have
been transferred. More information about the operation is stored in
<em>op</em>, a pointer to the network operation that is processed.
<em>bytesTotal</em> may be -1, which means that the total number of bytes
is not known.
<p> <p>See also <a href="qnetworkoperation.html">TQNetworkOperation</a> and <a href="ntqnetworkprotocol.html">TQNetworkProtocol</a>.

<h3 class=fn>void <a name="deleteNetworkProtocol"></a>TQUrlOperator::deleteNetworkProtocol ()<tt> [protected]</tt>
</h3>
Deletes the currently used network protocol.

<h3 class=fn>void <a name="finished"></a>TQUrlOperator::finished ( <a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when an operation of some sort finishes,
whether with success or failure. <em>op</em> is a pointer to the
operation object, which contains all the information, including
the state, of the operation which has been finished. Check the
state and error code of the operation object to see whether or not
the operation was successful.
<p> <p>See also <a href="qnetworkoperation.html">TQNetworkOperation</a> and <a href="ntqnetworkprotocol.html">TQNetworkProtocol</a>.

<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;* <a name="get"></a>TQUrlOperator::get ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;location = TQString::null )<tt> [virtual]</tt>
</h3>
Tells the network protocol to get data from <em>location</em> or, if
this is <a href="tqstring.html#TQString-null">TQString::null</a>, to get data from the location to which this
URL points (see <a href="ntqurl.html#fileName">TQUrl::fileName</a>() and <a href="ntqurl.html#encodedPathAndQuery">TQUrl::encodedPathAndQuery</a>()).
What happens then depends on the network protocol. The <a href="#data">data</a>()
signal is emitted when data comes in. Because it's unlikely that
all data will come in at once, it is common for multiple data()
signals to be emitted. The <a href="#dataTransferProgress">dataTransferProgress</a>() signal is
emitted while processing the operation. At the end, <a href="#finished">finished</a>()
(with success or failure) is emitted, so check the state of the
network operation object to see whether or not the operation was
successful.
<p> If <em>location</em> is TQString::null, the path of this TQUrlOperator
should point to a file when you use this operation. If <em>location</em>
is not empty, it can be a relative URL (a child of the path to
which the TQUrlOperator points) or an absolute URL.
<p> For example, to get a web page you might do something like this:
<p> <pre>
    TQUrlOperator op( "http://www.whatever.org/cgi-bin/search.pl?cmd=Hello" );
    op.<a href="#get">get</a>();
    </pre>
 
<p> For most other operations, the path of the TQUrlOperator must point
to a directory. If you want to download a file you could do the
following:
<p> <pre>
    TQUrlOperator op( "ftp://ftp.whatever.org/pub" );
    // do some other stuff like op.<a href="#listChildren">listChildren</a>() or op.<a href="#mkdir">mkdir</a>( "new_dir" )
    op.<a href="#get">get</a>( "a_file.txt" );
    </pre>
 
<p> This will get the data of ftp://ftp.whatever.org/pub/a_file.txt.
<p> <em>Never</em> do anything like this:
<pre>
    TQUrlOperator op( "http://www.whatever.org/cgi-bin" );
    op.<a href="#get">get</a>( "search.pl?cmd=Hello" ); // WRONG!
    </pre>
 
<p> If <em>location</em> is not empty and relative it must not contain any
queries or references, just the name of a child. So if you need to
specify a query or reference, do it as shown in the first example
or specify the full URL (such as
http://www.whatever.org/cgi-bin/search.pl?cmd=Hello) as <em>location</em>.
<p> <p>See also <a href="#copy">copy</a>().

<h3 class=fn>void <a name="getNetworkProtocol"></a>TQUrlOperator::getNetworkProtocol ()<tt> [protected]</tt>
</h3>
Finds a network protocol for the URL and deletes the old network protocol.

<h3 class=fn><a href="ntqurlinfo.html">TQUrlInfo</a> <a name="info"></a>TQUrlOperator::info ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;entry ) const<tt> [virtual]</tt>
</h3>
Returns the URL information for the child <em>entry</em>, or returns an
empty <a href="ntqurlinfo.html">TQUrlInfo</a> object if there is no information available about
<em>entry</em>. Information about <em>entry</em> is only available after a successfully
finished <a href="#listChildren">listChildren</a>() operation.

<h3 class=fn>bool <a name="isDir"></a>TQUrlOperator::isDir ( bool&nbsp;*&nbsp;ok = 0 )<tt> [virtual]</tt>
</h3>
Returns TRUE if the URL is a directory; otherwise returns FALSE.
This may not always work correctly, if the protocol of the URL is
something other than file (local filesystem). If you pass a bool
pointer as the <em>ok</em> argument, <em>*ok</em> is set to TRUE if the result
of this function is known to be correct, and to FALSE otherwise.

<h3 class=fn>void <a name="itemChanged"></a>TQUrlOperator::itemChanged ( <a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
</h3>

<p> This signal is emitted whenever a file which is a child of the URL
has been changed, for example by successfully calling <a href="#rename">rename</a>().
<em>op</em> is a pointer to the operation object which contains all the
information about the operation, including the state.
<tt>op-&gt;arg(0)</tt> holds the original file name and <tt>op-&gt;arg(1)</tt> holds
the new file name (if it was changed).
<p> <p>See also <a href="qnetworkoperation.html">TQNetworkOperation</a> and <a href="ntqnetworkprotocol.html">TQNetworkProtocol</a>.

<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;* <a name="listChildren"></a>TQUrlOperator::listChildren ()<tt> [virtual]</tt>
</h3>
Starts listing the children of this URL (e.g. the files in the
directory). The <a href="#start">start</a>() signal is emitted before the first entry
is listed and <a href="#finished">finished</a>() is emitted after the last one. The
<a href="#newChildren">newChildren</a>() signal is emitted for each list of new entries. If
an error occurs, the signal finished() is emitted, so be sure to
check the state of the network operation pointer.
<p> Because the operation may not be executed immediately, a pointer
to the <a href="qnetworkoperation.html">TQNetworkOperation</a> object created by this function is
returned. This object contains all the data about the operation
and is used to refer to this operation later (e.g. in the signals
that are emitted by the TQUrlOperator). The return value can also
be 0 if the operation object couldn't be created.
<p> The path of this TQUrlOperator must to point to a directory
(because the children of this directory will be listed), not to a
file.

<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;* <a name="mkdir"></a>TQUrlOperator::mkdir ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;dirname )<tt> [virtual]</tt>
</h3>
Tries to create a directory (child) with the name <em>dirname</em>. If
it is successful, a <a href="#newChildren">newChildren</a>() signal with the new child is
emitted, and the <a href="#createdDirectory">createdDirectory</a>() signal with the information
about the new child is also emitted. The <a href="#finished">finished</a>() signal (with
success or failure) is emitted after the operation has been
processed, so check the state of the network operation object to
see whether or not the operation was successful.
<p> Because the operation will not be executed immediately, a pointer
to the <a href="qnetworkoperation.html">TQNetworkOperation</a> object created by this function is
returned. This object contains all the data about the operation
and is used to refer to this operation later (e.g. in the signals
that are emitted by the TQUrlOperator). The return value can also
be 0 if the operation object couldn't be created.
<p> The path of this TQUrlOperator must to point to a directory (not a
file) because the new directory will be created in this path.

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="nameFilter"></a>TQUrlOperator::nameFilter () const
</h3>
Returns the name filter of the URL.
<p> <p>See also <a href="#setNameFilter">TQUrlOperator::setNameFilter</a>() and <a href="ntqdir.html#nameFilter">TQDir::nameFilter</a>().

<h3 class=fn>void <a name="newChildren"></a>TQUrlOperator::newChildren ( const&nbsp;<a href="tqvaluelist.html">TQValueList</a>&lt;TQUrlInfo&gt;&nbsp;&amp;&nbsp;i, <a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
</h3>

<p> This signal is emitted after <a href="#listChildren">listChildren</a>() was called and new
children (i.e. files) have been read from a list of files. <em>i</em>
holds the information about the new files. <em>op</em> is a pointer
to the operation object which contains all the information about
the operation, including the state.
<p> <p>See also <a href="qnetworkoperation.html">TQNetworkOperation</a> and <a href="ntqnetworkprotocol.html">TQNetworkProtocol</a>.

<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;* <a name="put"></a>TQUrlOperator::put ( const&nbsp;<a href="tqbytearray.html">TQByteArray</a>&nbsp;&amp;&nbsp;data, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;location = TQString::null )<tt> [virtual]</tt>
</h3>
This function tells the network protocol to put <em>data</em> in <em>location</em>. If <em>location</em> is empty (TQString::null), it puts the <em>data</em> in the location to which the URL points. What happens depends
on the network protocol. Depending on the network protocol, some
data might come back after putting data, in which case the <a href="#data">data</a>()
signal is emitted. The <a href="#dataTransferProgress">dataTransferProgress</a>() signal is emitted
during processing of the operation. At the end, <a href="#finished">finished</a>() (with
success or failure) is emitted, so check the state of the network
operation object to see whether or not the operation was
successful.
<p> If <em>location</em> is <a href="tqstring.html#TQString-null">TQString::null</a>, the path of this TQUrlOperator
should point to a file when you use this operation. If <em>location</em>
is not empty, it can be a relative (a child of the path to which
the TQUrlOperator points) or an absolute URL.
<p> For putting some data to a file you can do the following:
<p> <pre>
    TQUrlOperator op( "ftp://ftp.whatever.com/home/me/filename.dat" );
    op.<a href="#put">put</a>( data );
    </pre>
 
<p> For most other operations, the path of the TQUrlOperator must point
to a directory. If you want to upload data to a file you could do
the following:
<p> <pre>
    TQUrlOperator op( "ftp://ftp.whatever.com/home/me" );
    // do some other stuff like op.<a href="#listChildren">listChildren</a>() or op.<a href="#mkdir">mkdir</a>( "new_dir" )
    op.<a href="#put">put</a>( data, "filename.dat" );
    </pre>
 
<p> This will upload the data to ftp://ftp.whatever.com/home/me/filename.dat.
<p> <p>See also <a href="#copy">copy</a>().

<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;* <a name="remove"></a>TQUrlOperator::remove ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;filename )<tt> [virtual]</tt>
</h3>
Tries to remove the file (child) <em>filename</em>. If it succeeds the
<a href="#removed">removed</a>() signal is emitted. <a href="#finished">finished</a>() (with success or failure)
is also emitted after the operation has been processed, so check
the state of the network operation object to see whether or not
the operation was successful.
<p> Because the operation will not be executed immediately, a pointer
to the <a href="qnetworkoperation.html">TQNetworkOperation</a> object created by this function is
returned. This object contains all the data about the operation
and is used to refer to this operation later (e.g. in the signals
that are emitted by the TQUrlOperator). The return value can also
be 0 if the operation object couldn't be created.
<p> The path of this TQUrlOperator must point to a directory; because
if <em>filename</em> is relative, it will try to remove it in this
directory.

<h3 class=fn>void <a name="removed"></a>TQUrlOperator::removed ( <a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when <a href="#remove">remove</a>() has been succesful and the
file has been removed.
<p> <em>op</em> is a pointer to the operation object which contains all the
information about the operation, including the state.
<tt>op-&gt;arg(0)</tt> holds the name of the file that was removed.
<p> <p>See also <a href="qnetworkoperation.html">TQNetworkOperation</a> and <a href="ntqnetworkprotocol.html">TQNetworkProtocol</a>.

<h3 class=fn>const&nbsp;<a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;* <a name="rename"></a>TQUrlOperator::rename ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;oldname, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;newname )<tt> [virtual]</tt>
</h3>
Tries to rename the file (child) called <em>oldname</em> to <em>newname</em>.
If it succeeds, the <a href="#itemChanged">itemChanged</a>() signal is emitted. <a href="#finished">finished</a>()
(with success or failure) is also emitted after the operation has
been processed, so check the state of the network operation object
to see whether or not the operation was successful.
<p> Because the operation may not be executed immediately, a pointer
to the <a href="qnetworkoperation.html">TQNetworkOperation</a> object created by this function is
returned. This object contains all the data about the operation
and is used to refer to this operation later (e.g. in the signals
that are emitted by the TQUrlOperator). The return value can also
be 0 if the operation object couldn't be created.
<p> This path of this TQUrlOperator must to point to a directory
because <em>oldname</em> and <em>newname</em> are handled relative to this
directory.

<h3 class=fn>void <a name="setNameFilter"></a>TQUrlOperator::setNameFilter ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;nameFilter )<tt> [virtual]</tt>
</h3>
Sets the name filter of the URL to <em>nameFilter</em>.
<p> <p>See also <a href="ntqdir.html#setNameFilter">TQDir::setNameFilter</a>().

<h3 class=fn>void <a name="start"></a>TQUrlOperator::start ( <a href="qnetworkoperation.html">TQNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
</h3>

<p> Some operations (such as <a href="#listChildren">listChildren</a>()) emit this signal when
they start processing the operation. <em>op</em> is a pointer to the
operation object which contains all the information about the
operation, including the state.
<p> <p>See also <a href="qnetworkoperation.html">TQNetworkOperation</a> and <a href="ntqnetworkprotocol.html">TQNetworkProtocol</a>.

<h3 class=fn>void <a name="startedNextCopy"></a>TQUrlOperator::startedNextCopy ( const&nbsp;<a href="tqptrlist.html">TQPtrList</a>&lt;TQNetworkOperation&gt;&nbsp;&amp;&nbsp;lst )<tt> [signal]</tt>
</h3>

<p> This signal is emitted if <a href="#copy">copy</a>() starts a new copy operation. <em>lst</em> contains all TQNetworkOperations related to this copy
operation.
<p> <p>See also <a href="#copy">copy</a>().

<h3 class=fn>void <a name="stop"></a>TQUrlOperator::stop ()<tt> [virtual]</tt>
</h3>
Stops the current network operation and removes all this
TQUrlOperator's waiting network operations.

<hr><h2>Related Functions</h2>
<h3 class=fn>void <a name="qInitNetworkProtocols"></a>tqInitNetworkProtocols ()
</h3>

<p> This function registers the network protocols for FTP and HTTP.
You must call this function before you use TQUrlOperator for
these protocols.
<p> This function is declared in <a href="qnetwork-h.html">ntqnetwork.h</a>.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>