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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QUrlOperator Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QUrlOperator Class Reference</h1><br clear="all">
<p>
The QUrlOperator class provides common operations on URLs (<a href="#d566c8">get</a>() and more).
<a href="#details">More...</a>
<p>
<code>#include <<a href="qurloperator-h.html">qurloperator.h</a>></code>
<p>
Inherits <a href="qobject.html">QObject</a> and <a href="qurl.html">QUrl</a>.
<p><a href="qurloperator-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#db0a96"><b>QUrlOperator</b></a>(constQUrlOperator&url)</div>
<li><div class="fn">virtual<a href="#6b4a99"><b>~QUrlOperator</b></a>()</div>
<li><div class="fn">virtualconstQNetworkOperation*<a href="#792154"><b>listChildren</b></a>()</div>
<li><div class="fn">virtualconstQNetworkOperation*<a href="#a89403"><b>mkdir</b></a>(constQString&dirname)</div>
<li><div class="fn">virtualconstQNetworkOperation*<a href="#26c896"><b>remove</b></a>(constQString&filename)</div>
<li><div class="fn">virtualconstQNetworkOperation*<a href="#925759"><b>rename</b></a>(constQString&oldname, constQString&newname)</div>
<li><div class="fn">virtualconstQNetworkOperation*<a href="#d566c8"><b>get</b></a>(constQString&location=QString::null)</div>
<li><div class="fn">virtualconstQNetworkOperation*<a href="#b2a801"><b>put</b></a>(constQByteArray&data, constQString&location=QString::null)</div>
<li><div class="fn">virtualQList<QNetworkOperation><a href="#6ab422"><b>copy</b></a>(constQString&from, constQString&to, boolmove=FALSE)</div>
<li><div class="fn">virtualvoid<a href="#cbc5b8"><b>copy</b></a>(constQStringList&files, constQString&dest, boolmove=FALSE)</div>
<li><div class="fn">virtualbool<a href="#3c48cc"><b>isDir</b></a>(bool*ok=0)</div>
<li><div class="fn">virtualvoid<a href="#0a2125"><b>setNameFilter</b></a>(constQString&nameFilter)</div>
<li><div class="fn">QString<a href="#403dda"><b>nameFilter</b></a>()const</div>
<li><div class="fn">virtualQUrlInfo<a href="#3cb4d0"><b>info</b></a>(constQString&entry)const</div>
<li><div class="fn">virtualvoid<a href="#8f13ba"><b>stop</b></a>()</div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#c22edd"><b>newChildren</b></a>(constQValueList<QUrlInfo>&, QNetworkOperation*res)</div>
<li><div class="fn">void<a href="#7716b5"><b>finished</b></a>(QNetworkOperation*res)</div>
<li><div class="fn">void<a href="#d35843"><b>start</b></a>(QNetworkOperation*res)</div>
<li><div class="fn">void<a href="#4e7ae4"><b>createdDirectory</b></a>(constQUrlInfo&, QNetworkOperation*res)</div>
<li><div class="fn">void<a href="#5e23f2"><b>removed</b></a>(QNetworkOperation*res)</div>
<li><div class="fn">void<a href="#fb3524"><b>itemChanged</b></a>(QNetworkOperation*res)</div>
<li><div class="fn">void<a href="#e932a0"><b>data</b></a>(constQByteArray&, QNetworkOperation*res)</div>
<li><div class="fn">void<a href="#10e693"><b>dataTransferProgress</b></a>(intbytesDone, intbytesTotal, QNetworkOperation*res)</div>
<li><div class="fn">void<a href="#a36c59"><b>startedNextCopy</b></a>(constQList<QNetworkOperation>&lst)</div>
<li><div class="fn">void<a href="#19adbe"><b>connectionStateChanged</b></a>(intstate, constQString&data)</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">virtualvoid<a href="#71f455"><b>clearEntries</b></a>()</div>
<li><div class="fn">void<a href="#c2a483"><b>getNetworkProtocol</b></a>()</div>
<li><div class="fn">void<a href="#a22f8f"><b>deleteNetworkProtocol</b></a>()</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QUrlOperator class provides common operations on URLs (<a href="#d566c8">get</a>() and more).
<p>
This class operates on hierarchical structures (like filesystems)
using URLs. Its API allows do all common operations on it
(listing children, removing children, renaming, etc.). But
the class itself contains no functionality for that. It uses
the functionality of registered network protocols. This means,
depending of the protocol of the URL, it uses a fitting
network protocol class for the operations. In detail, each of
the operation methods of QUrlOperator create a
<a href="qnetworkoperation.html">QNetworkOperation</a> object which describes the operation and
puts it into the operation queue of the used network protocol.
If no fitting protocol could be found (because no implementation
of the needed network protocol is registered), the url operator
emits errors. Also not each protocol supports each operation -
but the error handling deals with this problem.
<p>A QUrlOperator can be used like this (for e.g. downloading a file)
<pre> <a href="qurloperator.html">QUrlOperator</a> op;
op.<a href="#6ab422">copy</a>( "ftp://ftp.trolltech.com/qt/source/qt-2.1.0.tar.gz", "file:/tmp", FALSE );
</pre>
<p>Now, you also will connect to some signals of the QUrlOperator to get
informed about success, errors, progress and more things.
<p>Of course an implementation for the FTP protocol has to be registered for
this example. In the Qt Network Extension Library there is an implementation
of the FTP protocol.
<p>For more information about the Qt Network Architecture take a look
at the <a href="network.html">Qt Network Documentation</a>.
<p>See also <a href="qnetworkprotocol.html">QNetworkProtocol</a> and <a href="qnetworkoperation.html">QNetworkOperation</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="9f2492"></a>QUrlOperator::QUrlOperator()</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn"><a name="86601c"></a>QUrlOperator::QUrlOperator(const<a href="qstring.html">QString</a>&url)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn"><a name="db0a96"></a>QUrlOperator::QUrlOperator(constQUrlOperator&url)</h3>
<p>Copy constructor.
<h3 class="fn"><a name="ef44eb"></a>QUrlOperator::QUrlOperator(constQUrlOperator&url, const<a href="qstring.html">QString</a>&relUrl, boolcheckSlash=FALSE)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn"><a name="6b4a99"></a>QUrlOperator::~QUrlOperator() <code>[virtual]</code></h3>
<p>Destructor.
<h3 class="fn">bool<a name="e4fe5a"></a>QUrlOperator::cdUp() <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">bool<a name="053a8b"></a>QUrlOperator::checkValid() <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="71f455"></a>QUrlOperator::clearEntries() <code>[virtualprotected]</code></h3>
<p>Clears the cache of children.
<h3 class="fn">void<a name="19adbe"></a>QUrlOperator::connectionStateChanged(intstate, const<a href="qstring.html">QString</a>&data) <code>[signal]</code></h3>
<p>This signal is emitted whenever the state of the connection of
the network protocol of the url operator is changed. <em>state</em> describes the new state,
which is one of
QNetworkProtocol::ConHostFound,
QNetworkProtocol::ConConnected,
QNetworkProtocol::ConClosed
This enum is defined in <a href="qnetworkprotocol.html">QNetworkProtocol</a>
<em>data</em> is a message text.
<h3 class="fn"><a href="qlist.html">QList</a><<a href="qnetworkoperation.html">QNetworkOperation</a>><a name="6ab422"></a>QUrlOperator::copy(const<a href="qstring.html">QString</a>&from, const<a href="qstring.html">QString</a>&to, boolmove=FALSE) <code>[virtual]</code></h3>
<p>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> has to point to a file and
<em>to</em> must point to a directory (into which <em>from</em> is copied).
The copying is done using <a href="#d566c8">get</a>() and <a href="#b2a801">put</a>() operations. If you want to get notified
about the progress of the operation, connect to the <a href="#10e693">dataTransferProgress</a>()
signal. But you have to know, that the get() and the put() operations emit
this signal through the QUrlOperator! So, the number of transferred and total bytes
which you get as argument in this signal isn't related to the the whole copy operation, but
first to the get() and then to the put() operation. So always check for the type of
the operation from which the signal comes (you get this by asking for the type of the
<a href="qnetworkoperation.html">QNetworkOperation</a> pointer you also get as last argument of this signal).
<p>Also at the end <a href="#7716b5">finished</a>() (on success or failure) is emitted,
so check the state of the network operation object to see if the
operation was successful or not.
<p>As a copy operation consists of multiple operations (get(), put() and maybe <a href="#26c896">remove</a>()
(depending if you copy or move)) this method doesn't return a single QNetworkOperation,
but a list of them. They are in the order get(), put(), remove(). As discussed, the third one
(remove) is optional.
<p>See also <a href="#d566c8">get</a>() and <a href="#b2a801">put</a>().
<h3 class="fn">void<a name="cbc5b8"></a>QUrlOperator::copy(const<a href="qstringlist.html">QStringList</a>&files, const<a href="qstring.html">QString</a>&dest, boolmove=FALSE) <code>[virtual]</code></h3>
<p>Copies <em>files</em> to the directory <em>dest.</em> If <em>move</em> is TRUE,
the files are moved and not copied. <em>dest</em> has to point to a directory.
<p>This method is just a convenience function of the copy method above. It
calls the copy above for each entry in <em>files</em> one after the other. You
don't get a result from this method, but each time a new copy is started,
<a href="#a36c59">startedNextCopy</a>() is emitted, with a list of QNetworkOperations which
describe the new copy operation.
<h3 class="fn">void<a name="4e7ae4"></a>QUrlOperator::createdDirectory(const<a href="qurlinfo.html">QUrlInfo</a>&i, <a href="qnetworkoperation.html">QNetworkOperation</a>*op) <code>[signal]</code></h3>
<p>This signal is emitted when <a href="#a89403">mkdir</a>() has been succesful
and the directory has been created. <em>i</em> holds the information
about the new directory.
<em>op</em> is the pointer to the operation object, which contains all infos
of the operation, including the state and so on and using op->arg( 0 )
you also get the filename of the new directory.
<p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
<h3 class="fn">void<a name="e932a0"></a>QUrlOperator::data(const<a href="qbytearray.html">QByteArray</a>&data, <a href="qnetworkoperation.html">QNetworkOperation</a>*op) <code>[signal]</code></h3>
<p>This signal is emitted when new <em>data</em> has been received
after e.g. calling <a href="#d566c8">get</a>() or <a href="#b2a801">put</a>(). <em>op</em> holds the name of the file which data
is retrieved in the first argument and the data in the second argument (raw).
You get them with op->arg( 0 ) and op->rawArg( 1 ).
<p><em>op</em> is the pointer to the operation object, which contains all infos
of the operation, including the state and so on.
<p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
<h3 class="fn">void<a name="10e693"></a>QUrlOperator::dataTransferProgress(intbytesDone, intbytesTotal, <a href="qnetworkoperation.html">QNetworkOperation</a>*op) <code>[signal]</code></h3>
<p>When transferring data (using <a href="#b2a801">put</a>() or <a href="#d566c8">get</a>()) this signal is emitted during the progress.
<em>bytesDone</em> tells how many bytes of <em>bytesTotal</em> are transferred. More information
about the operation is stored in the <em>op,</em> the pointer to the network operation
which is processed. <em>bytesTotal</em> may be -1, which means that the number of total
bytes is not known.
<p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
<h3 class="fn">void<a name="a22f8f"></a>QUrlOperator::deleteNetworkProtocol() <code>[protected]</code></h3>
<p>Delete the currently used network protocol.
<h3 class="fn">void<a name="7716b5"></a>QUrlOperator::finished(<a href="qnetworkoperation.html">QNetworkOperation</a>*op) <code>[signal]</code></h3>
<p>This signal is emitted when an operation of some sort finished.
This signal is emitted always, this means on success and on failure.
<em>op</em> is the pointer to the operation object, which contains all infos
of the operation which has been finished, including the state and so on.
To check if the operation was successful or not, check the state and
error code of the operation object.
<p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
<h3 class="fn">const<a href="qnetworkoperation.html">QNetworkOperation</a>*<a name="d566c8"></a>QUrlOperator::get(const<a href="qstring.html">QString</a>&location=QString::null) <code>[virtual]</code></h3>
<p>Tells the network protocol to get data from <em>location</em> or, if this
is QString::null, to get data from the location to which this
URL points (see <a href="qurl.html#206a0a">QUrl::fileName</a>() and <a href="qurl.html#e544c0">QUrl::encodedPathAndQuery</a>()). What
exactly happens then is depending on the network protocol.
When data comes in, the <a href="#e932a0">data</a>() signal
is emitted. As it's unlikely that all the data comes in at once, multiple
data() signals will be emitted.
During processing the operation the <a href="#10e693">dataTransferProgress</a>() is emitted.
Also at the end <a href="#7716b5">finished</a>() (on success or failure) is emitted,
so check the state of the network operation object to see if the
operation was successful or not.
<p>Now, if <em>location</em> is QString::null, the path of this QUrlOperator should point to a file
when you use this operation. If <em>location</em> is not empty, it can be relative (a child of
the path to which the QUrlOperator points) or an absolute URL.
<p>E.g. for getting a Web page you might do something like
<p><pre> <a href="qurloperator.html">QUrlOperator</a> op( "http://www.whatever.org/cgi-bin/search.pl?cmd=Hallo" );
op.<a href="#d566c8">get</a>();
</pre>
<p>But as for the most other operations it is required that the path of the
QUrlOperator points to a directory, you could do following if you
want e.g. download a file
<p><pre> <a href="qurloperator.html">QUrlOperator</a> op( "ftp://ftp.whatever.org/pub" );
// do some other stuff like op.<a href="#792154">listChildren</a>() or op.<a href="#a89403">mkdir</a>( "new Dir" )
op.<a href="#d566c8">get</a>( "a_file.txt" );
</pre>
<p>This will get the data of ftp://ftp.whatever.org/pub/a_file.txt.
<p>But <b>never</b> do something like
<p><pre> <a href="qurloperator.html">QUrlOperator</a> op( "http://www.whatever.org/cgi-bin" );
op.<a href="#d566c8">get</a>( "search.pl?cmd=Hallo" );
</pre>
<p>This means 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 like in the first
example or specify the full URL (like
http://www.whatever.org/cgi-bin/search.pl?cmd=Hallo) as <em>location.</em>
<p>See also <a href="#6ab422">copy</a>().
<h3 class="fn">void<a name="c2a483"></a>QUrlOperator::getNetworkProtocol() <code>[protected]</code></h3>
<p>Finds a network protocol for the URL and deletes the old network protocol.
<h3 class="fn"><a href="qurlinfo.html">QUrlInfo</a><a name="3cb4d0"></a>QUrlOperator::info(const<a href="qstring.html">QString</a>&entry)const <code>[virtual]</code></h3>
<p>Returns the URL information for the child <em>entry</em> or en
empty <a href="qurlinfo.html">QUrlInfo</a> object of there is no information available
about <em>entry.</em>
<h3 class="fn">bool<a name="3c48cc"></a>QUrlOperator::isDir(bool*ok=0) <code>[virtual]</code></h3>
<p>Returns TRUE if the url is a directory, else
returns FALSE. This may not always work correctly,
if the protocol of the URL is something else than file
(local filesystem)! If you pass a bool as <em>ok</em> argument,
this is set to TRUE, if the result of this method is correct
for sure, else <em>ok</em> is set to FALSE.
<h3 class="fn">void<a name="fb3524"></a>QUrlOperator::itemChanged(<a href="qnetworkoperation.html">QNetworkOperation</a>*op) <code>[signal]</code></h3>
<p>This signal is emitted whenever a file, which is a child of this URL,
has been changed e.g. by successfully calling <a href="#925759">rename</a>(). <em>op</em> holds
the original and the new filenames in the first and second arguments.
You get them with op->arg( 0 ) and op->arg( 1 ).
<p><em>op</em> is the pointer to the operation object, which contains all infos
of the operation, including the state and so on.
<p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
<h3 class="fn">const<a href="qnetworkoperation.html">QNetworkOperation</a>*<a name="792154"></a>QUrlOperator::listChildren() <code>[virtual]</code></h3>
<p>Starts listing the children of this URL (e.g. of a directory). The signal
<a href="#d35843">start</a>() is emitted, before the first entry is listed,
and after the last one <a href="#7716b5">finished</a>() is emitted.
For each list of new entries, the <a href="#c22edd">newChildren</a>()
signals is emitted.
If an error occurs, also the signal finished()
is emitted, so check the state of the network operation pointer!
<p>As the operation will not be executed immediately, a pointer to the
<a href="qnetworkoperation.html">QNetworkOperation</a> object, which is created by this method, is
returned. This object contains all data about the operation and is
used to refer to this operation later (e.g. in the signals which are emitted
by the QUrlOperator). The return value can be also 0 if the operation object
couldn't be created.
<p>The path of this QUrlOperator has to point to a directory, because the children
of this directory will be listed, and not to a file, else this operation might not work!.
<h3 class="fn">const<a href="qnetworkoperation.html">QNetworkOperation</a>*<a name="a89403"></a>QUrlOperator::mkdir(const<a href="qstring.html">QString</a>&dirname) <code>[virtual]</code></h3>
<p>Tries to create a directory (child) with the name <em>dirname.</em>
If it has been successful a <a href="#c22edd">newChildren</a>()
signal with the new child is emitted, and the
<a href="#4e7ae4">createdDirectory</a>() signal with
the information about the new child is emitted too.
Also <a href="#7716b5">finished</a>() (on success or failure) is emitted,
after the operation has been processed, so check the state of the network
operation object to see if the operation was successful or not.
<p>As the operation will not be executed immediately, a pointer to the
<a href="qnetworkoperation.html">QNetworkOperation</a> object, which is created by this method, is
returned. This object contains all data about the operation and is
used to refer to this operation later (e.g. in the signals which are emitted
by the QUrlOperator). The return value can be also 0 if the operation object
couldn't be created.
<p>This path of this QUrlOperator has to point to a directory, as the new directory
will be created in this path, and not to a file,
else this operation might not work!.
<h3 class="fn"><a href="qstring.html">QString</a><a name="403dda"></a>QUrlOperator::nameFilter()const</h3>
<p>Returns the name filter of the URL
<p>See also <a href="#0a2125">QUrlOperator::setNameFilter</a>() and <a href="qdir.html#b4accc">QDir::nameFilter</a>().
<h3 class="fn">void<a name="c22edd"></a>QUrlOperator::newChildren(const<a href="qvaluelist.html">QValueList</a><<a href="qurlinfo.html">QUrlInfo</a>>&i, <a href="qnetworkoperation.html">QNetworkOperation</a>*op) <code>[signal]</code></h3>
<p>This signal is emitted after <a href="#792154">listChildren</a>() was called and
new children (e.g. files) have been read from a list of files. <em>i</em>
holds the information about the new children.
<em>op</em> is the pointer to the operation object, which contains all infos
of the operation, including the state and so on.
<p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
<h3 class="fn">QUrlOperator&<a name="8ca88d"></a>QUrlOperator::operator=(const<a href="qstring.html">QString</a>&url)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">QUrlOperator&<a name="bb7744"></a>QUrlOperator::operator=(constQUrlOperator&url)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">bool<a name="59aa77"></a>QUrlOperator::parse(const<a href="qstring.html">QString</a>&url) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">const<a href="qnetworkoperation.html">QNetworkOperation</a>*<a name="b2a801"></a>QUrlOperator::put(const<a href="qbytearray.html">QByteArray</a>&data, const<a href="qstring.html">QString</a>&location=QString::null) <code>[virtual]</code></h3>
<p>Tells the network protocol to put <em>data</em> to <em>location,</em> or if this is
empty (QString::null) it puts the <em>data</em> to the location to which the
URL points. What exactly happens is depending on the network
protocol. Also depending on the network protocol
after putting data some data might come back. In this case the
<a href="#e932a0">data</a>() signal is emitted.
During processing the operation the <a href="#10e693">dataTransferProgress</a>() is emitted.
Also at the end <a href="#7716b5">finished</a>() (on success or failure) is emitted,
so check the state of the network operation object to see if the
operation was successful or not.
<p>Now, if <em>location</em> is QString::null, the path of this QUrlOperator should point to a file
when you use this operation. If <em>location</em> is not empty, it can be relative (a child of
the path to which the QUrlOperator points) or an absolute URL.
<p>E.g. for putting some data to a file you can do
<p><pre> <a href="qurloperator.html">QUrlOperator</a> op( "ftp://ftp.whatever.com/home/me/filename" );
op.<a href="#b2a801">put</a>( data );
</pre>
<p>But as for the most other operations it is required that the path of the
QUrlOperator points to a directory, you could do following if you
want e.g. upload data to a file
<p><pre> <a href="qurloperator.html">QUrlOperator</a> op( "ftp://ftp.whatever.com/home/me" );
// do some other stuff like op.<a href="#792154">listChildren</a>() or op.<a href="#a89403">mkdir</a>( "new Dir" )
op.<a href="#b2a801">put</a>( data, "filename" );
</pre>
<p>This will upload the data to ftp://ftp.whatever.com/home/me/filename.
<p>See also <a href="#6ab422">copy</a>().
<h3 class="fn">const<a href="qnetworkoperation.html">QNetworkOperation</a>*<a name="26c896"></a>QUrlOperator::remove(const<a href="qstring.html">QString</a>&filename) <code>[virtual]</code></h3>
<p>Tries to remove the file (child) <em>filename.</em>
If it has been successful the signal <a href="#5e23f2">removed</a>() is emitted.
Also <a href="#7716b5">finished</a>() (on success or failure) is emitted after
the operation has been processed, so check the state of the network operation
object to see if the operation was successful or not.
<p>As the operation will not be executed immediately, a pointer to the
<a href="qnetworkoperation.html">QNetworkOperation</a> object, which is created by this method, is
returned. This object contains all data about the operation and is
used to refer to this operation later (e.g. in the signals which are emitted
by the QUrlOperator). The return value can be also 0 if the operation object
couldn't be created.
<p>This path of this QUrlOperator has to point to a directory, because if <em>filename</em>
is relative, it will be tried to remove it in this directory, and not to a file,
else this operation might not work!.
<h3 class="fn">void<a name="5e23f2"></a>QUrlOperator::removed(<a href="qnetworkoperation.html">QNetworkOperation</a>*op) <code>[signal]</code></h3>
<p>This signal is emitted when <a href="#26c896">remove</a>() has been succesful
and the file has been removed. <em>op</em> holds the filename
of the removed file in the first argument, you get it
with op->arg( 0 ).
<p><em>op</em> is the pointer to the operation object, which contains all infos
of the operation, including the state and so on.
<p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
<h3 class="fn">const<a href="qnetworkoperation.html">QNetworkOperation</a>*<a name="925759"></a>QUrlOperator::rename(const<a href="qstring.html">QString</a>&oldname, const<a href="qstring.html">QString</a>&newname) <code>[virtual]</code></h3>
<p>Tries to rename the file (child) <em>oldname</em> by <em>newname.</em>
If it has been successful the signal <a href="#fb3524">itemChanged</a>()
is emitted.
Also <a href="#7716b5">finished</a>() (on success or failure) is emitted after
the operation has been processed, so check the state of the network operation
object to see if the operation was successful or not.
<p>As the operation will not be executed immediately, a pointer to the
<a href="qnetworkoperation.html">QNetworkOperation</a> object, which is created by this method, is
returned. This object contains all data about the operation and is
used to refer to this operation later (e.g. in the signals which are emitted
by the QUrlOperator). The return value can be also 0 if the operation object
couldn't be created.
<p>This path of this QUrlOperator has to point to a directory, as <em>oldname</em> and
<em>newname</em> are handled relatively to this directory, and not to a file,
else this operation might not work!.
<h3 class="fn">void<a name="2b8ecb"></a>QUrlOperator::reset() <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="0a2125"></a>QUrlOperator::setNameFilter(const<a href="qstring.html">QString</a>&nameFilter) <code>[virtual]</code></h3>
<p>Sets the name filter of the URL
<p>See also <a href="qdir.html#35360c">QDir::setNameFilter</a>().
<h3 class="fn">void<a name="11092f"></a>QUrlOperator::setPath(const<a href="qstring.html">QString</a>&path) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="d35843"></a>QUrlOperator::start(<a href="qnetworkoperation.html">QNetworkOperation</a>*op) <code>[signal]</code></h3>
<p>Some operations (like <a href="#792154">listChildren</a>()) emit this signal
when they start processing the operation.
<em>op</em> is the pointer to the operation object, which contains all infos
of the operation, including the state and so on.
<p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
<h3 class="fn">void<a name="a36c59"></a>QUrlOperator::startedNextCopy(const<a href="qlist.html">QList</a><<a href="qnetworkoperation.html">QNetworkOperation</a>>&lst) <code>[signal]</code></h3>
<p>This signal is emitted if <a href="#6ab422">copy</a>() started a new copy operation. <em>lst</em> contains all
QNetworkOperations which describe this copy operation.
<p>See also <a href="#6ab422">copy</a>().
<h3 class="fn">void<a name="8f13ba"></a>QUrlOperator::stop() <code>[virtual]</code></h3>
<p>Stops the current network operation which is just processed and
removes all waiting network operations of this QUrlOperator.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.1"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2000
<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 2000 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.1</div>
</table></div></address></body></html>
|