You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
514 lines
32 KiB
514 lines
32 KiB
14 years ago
|
<!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>QUrlOperator 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 Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped 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>QUrlOperator Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
|
||
|
|
||
|
<p>The QUrlOperator class provides common operations on URLs.
|
||
|
<a href="#details">More...</a>
|
||
|
<p><tt>#include <<a href="qurloperator-h.html">qurloperator.h</a>></tt>
|
||
|
<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 class=fn><a href="#QUrlOperator"><b>QUrlOperator</b></a> ()</li>
|
||
|
<li class=fn><a href="#QUrlOperator-2"><b>QUrlOperator</b></a> ( const QString & url )</li>
|
||
|
<li class=fn><a href="#QUrlOperator-3"><b>QUrlOperator</b></a> ( const QUrlOperator & url )</li>
|
||
|
<li class=fn><a href="#QUrlOperator-4"><b>QUrlOperator</b></a> ( const QUrlOperator & url, const QString & relUrl, bool checkSlash = FALSE )</li>
|
||
|
<li class=fn>virtual <a href="#~QUrlOperator"><b>~QUrlOperator</b></a> ()</li>
|
||
|
<li class=fn>virtual const QNetworkOperation * <a href="#listChildren"><b>listChildren</b></a> ()</li>
|
||
|
<li class=fn>virtual const QNetworkOperation * <a href="#mkdir"><b>mkdir</b></a> ( const QString & dirname )</li>
|
||
|
<li class=fn>virtual const QNetworkOperation * <a href="#remove"><b>remove</b></a> ( const QString & filename )</li>
|
||
|
<li class=fn>virtual const QNetworkOperation * <a href="#rename"><b>rename</b></a> ( const QString & oldname, const QString & newname )</li>
|
||
|
<li class=fn>virtual const QNetworkOperation * <a href="#get"><b>get</b></a> ( const QString & location = QString::null )</li>
|
||
|
<li class=fn>virtual const QNetworkOperation * <a href="#put"><b>put</b></a> ( const QByteArray & data, const QString & location = QString::null )</li>
|
||
|
<li class=fn>virtual QPtrList<QNetworkOperation> <a href="#copy"><b>copy</b></a> ( const QString & from, const QString & to, bool move = FALSE, bool toPath = TRUE )</li>
|
||
|
<li class=fn>virtual void <a href="#copy-2"><b>copy</b></a> ( const QStringList & files, const QString & dest, bool move = FALSE )</li>
|
||
|
<li class=fn>virtual bool <a href="#isDir"><b>isDir</b></a> ( bool * ok = 0 )</li>
|
||
|
<li class=fn>virtual void <a href="#setNameFilter"><b>setNameFilter</b></a> ( const QString & nameFilter )</li>
|
||
|
<li class=fn>QString <a href="#nameFilter"><b>nameFilter</b></a> () const</li>
|
||
|
<li class=fn>virtual QUrlInfo <a href="#info"><b>info</b></a> ( const QString & 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 QValueList<QUrlInfo> & i, QNetworkOperation * op )</li>
|
||
|
<li class=fn>void <a href="#finished"><b>finished</b></a> ( QNetworkOperation * op )</li>
|
||
|
<li class=fn>void <a href="#start"><b>start</b></a> ( QNetworkOperation * op )</li>
|
||
|
<li class=fn>void <a href="#createdDirectory"><b>createdDirectory</b></a> ( const QUrlInfo & i, QNetworkOperation * op )</li>
|
||
|
<li class=fn>void <a href="#removed"><b>removed</b></a> ( QNetworkOperation * op )</li>
|
||
|
<li class=fn>void <a href="#itemChanged"><b>itemChanged</b></a> ( QNetworkOperation * op )</li>
|
||
|
<li class=fn>void <a href="#data"><b>data</b></a> ( const QByteArray & data, QNetworkOperation * op )</li>
|
||
|
<li class=fn>void <a href="#dataTransferProgress"><b>dataTransferProgress</b></a> ( int bytesDone, int bytesTotal, QNetworkOperation * op )</li>
|
||
|
<li class=fn>void <a href="#startedNextCopy"><b>startedNextCopy</b></a> ( const QPtrList<QNetworkOperation> & lst )</li>
|
||
|
<li class=fn>void <a href="#connectionStateChanged"><b>connectionStateChanged</b></a> ( int state, const QString & 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>qInitNetworkProtocols</b></a> ()</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
<p> The QUrlOperator 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 QUrlOperator can be used like this, for example to download a
|
||
|
file (and assuming that the FTP protocol is <a href="#qInitNetworkProtocols">registered</a>):
|
||
|
<pre>
|
||
|
QUrlOperator *op = new QUrlOperator();
|
||
|
op-><a href="#copy">copy</a>( QString("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 QUrlOperator'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 QUrlOperator creates a
|
||
|
<a href="qnetworkoperation.html">QNetworkOperation</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">qInitNetworkProtocols</a>() function. The protocols currently
|
||
|
supported are:
|
||
|
<ul>
|
||
|
<li> <a href="qftp.html">FTP</a>,
|
||
|
<li> <a href="qhttp.html">HTTP</a>,
|
||
|
<li> <a href="qlocalfs.html">local file system</a>.
|
||
|
</ul>
|
||
|
<p> For more information about the Qt Network Architecture see the
|
||
|
<a href="network.html">Qt Network Documentation</a>.
|
||
|
<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>.
|
||
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
|
<h3 class=fn><a name="QUrlOperator"></a>QUrlOperator::QUrlOperator ()
|
||
|
</h3>
|
||
|
Constructs a QUrlOperator with an empty (i.e. invalid) URL.
|
||
|
|
||
|
<h3 class=fn><a name="QUrlOperator-2"></a>QUrlOperator::QUrlOperator ( const <a href="qstring.html">QString</a> & url )
|
||
|
</h3>
|
||
|
Constructs a QUrlOperator 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="QUrlOperator-3"></a>QUrlOperator::QUrlOperator ( const <a href="qurloperator.html">QUrlOperator</a> & url )
|
||
|
</h3>
|
||
|
Constructs a copy of <em>url</em>.
|
||
|
|
||
|
<h3 class=fn><a name="QUrlOperator-4"></a>QUrlOperator::QUrlOperator ( const <a href="qurloperator.html">QUrlOperator</a> & url, const <a href="qstring.html">QString</a> & relUrl, bool checkSlash = FALSE )
|
||
|
</h3>
|
||
|
Constructs a QUrlOperator. The URL on which this QUrlOperator
|
||
|
operates is constructed out of the arguments <em>url</em>, <em>relUrl</em> and
|
||
|
<em>checkSlash</em>: see the corresponding <a href="qurl.html">QUrl</a> constructor for an
|
||
|
explanation of these arguments.
|
||
|
|
||
|
<h3 class=fn><a name="~QUrlOperator"></a>QUrlOperator::~QUrlOperator ()<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Destructor.
|
||
|
|
||
|
<h3 class=fn>void <a name="clearEntries"></a>QUrlOperator::clearEntries ()<tt> [virtual protected]</tt>
|
||
|
</h3>
|
||
|
Clears the cache of children.
|
||
|
|
||
|
<h3 class=fn>void <a name="connectionStateChanged"></a>QUrlOperator::connectionStateChanged ( int state, const <a href="qstring.html">QString</a> & 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="qnetworkprotocol.html#ConnectionState-enum">QNetworkProtocol::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="qptrlist.html">QPtrList</a><QNetworkOperation> <a name="copy"></a>QUrlOperator::copy ( const <a href="qstring.html">QString</a> & from, const <a href="qstring.html">QString</a> & to, bool move = FALSE, bool 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 QUrlOperator. 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">QNetworkOperation</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>QUrlOperator::copy ( const <a href="qstringlist.html">QStringList</a> & files, const <a href="qstring.html">QString</a> & dest, bool 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
|
||
|
QNetworkOperations that describe the new copy operation.
|
||
|
|
||
|
<h3 class=fn>void <a name="createdDirectory"></a>QUrlOperator::createdDirectory ( const <a href="qurlinfo.html">QUrlInfo</a> & i, <a href="qnetworkoperation.html">QNetworkOperation</a> * 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->arg(0)</tt> holds the new directory's name.
|
||
|
<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="data"></a>QUrlOperator::data ( const <a href="qbytearray.html">QByteArray</a> & data, <a href="qnetworkoperation.html">QNetworkOperation</a> * 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->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">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="dataTransferProgress"></a>QUrlOperator::dataTransferProgress ( int bytesDone, int bytesTotal, <a href="qnetworkoperation.html">QNetworkOperation</a> * 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">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="deleteNetworkProtocol"></a>QUrlOperator::deleteNetworkProtocol ()<tt> [protected]</tt>
|
||
|
</h3>
|
||
|
Deletes the currently used network protocol.
|
||
|
|
||
|
<h3 class=fn>void <a name="finished"></a>QUrlOperator::finished ( <a href="qnetworkoperation.html">QNetworkOperation</a> * 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">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
|
||
|
|
||
|
<h3 class=fn>const <a href="qnetworkoperation.html">QNetworkOperation</a> * <a name="get"></a>QUrlOperator::get ( const <a href="qstring.html">QString</a> & location = QString::null )<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Tells the network protocol to get data from <em>location</em> or, if
|
||
|
this is <a href="qstring.html#QString-null">QString::null</a>, to get data from the location to which this
|
||
|
URL points (see <a href="qurl.html#fileName">QUrl::fileName</a>() and <a href="qurl.html#encodedPathAndQuery">QUrl::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 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 a relative URL (a child of the path to
|
||
|
which the QUrlOperator points) or an absolute URL.
|
||
|
<p> For example, to get a web page you might do something like this:
|
||
|
<p> <pre>
|
||
|
QUrlOperator 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 QUrlOperator must point
|
||
|
to a directory. If you want to download a file you could do the
|
||
|
following:
|
||
|
<p> <pre>
|
||
|
QUrlOperator 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>
|
||
|
QUrlOperator 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>QUrlOperator::getNetworkProtocol ()<tt> [protected]</tt>
|
||
|
</h3>
|
||
|
Finds a network protocol for the URL and deletes the old network protocol.
|
||
|
|
||
|
<h3 class=fn><a href="qurlinfo.html">QUrlInfo</a> <a name="info"></a>QUrlOperator::info ( const <a href="qstring.html">QString</a> & entry ) const<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Returns the URL information for the child <em>entry</em>, or returns an
|
||
|
empty <a href="qurlinfo.html">QUrlInfo</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>QUrlOperator::isDir ( bool * 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>QUrlOperator::itemChanged ( <a href="qnetworkoperation.html">QNetworkOperation</a> * 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->arg(0)</tt> holds the original file name and <tt>op->arg(1)</tt> holds
|
||
|
the new file name (if it was changed).
|
||
|
<p> <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="listChildren"></a>QUrlOperator::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">QNetworkOperation</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 QUrlOperator). The return value can also
|
||
|
be 0 if the operation object couldn't be created.
|
||
|
<p> The path of this QUrlOperator must to point to a directory
|
||
|
(because the children of this directory will be listed), not to a
|
||
|
file.
|
||
|
|
||
|
<h3 class=fn>const <a href="qnetworkoperation.html">QNetworkOperation</a> * <a name="mkdir"></a>QUrlOperator::mkdir ( const <a href="qstring.html">QString</a> & 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">QNetworkOperation</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 QUrlOperator). The return value can also
|
||
|
be 0 if the operation object couldn't be created.
|
||
|
<p> The path of this QUrlOperator must to point to a directory (not a
|
||
|
file) because the new directory will be created in this path.
|
||
|
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="nameFilter"></a>QUrlOperator::nameFilter () const
|
||
|
</h3>
|
||
|
Returns the name filter of the URL.
|
||
|
<p> <p>See also <a href="#setNameFilter">QUrlOperator::setNameFilter</a>() and <a href="qdir.html#nameFilter">QDir::nameFilter</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="newChildren"></a>QUrlOperator::newChildren ( const <a href="qvaluelist.html">QValueList</a><QUrlInfo> & i, <a href="qnetworkoperation.html">QNetworkOperation</a> * 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">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
|
||
|
|
||
|
<h3 class=fn>const <a href="qnetworkoperation.html">QNetworkOperation</a> * <a name="put"></a>QUrlOperator::put ( const <a href="qbytearray.html">QByteArray</a> & data, const <a href="qstring.html">QString</a> & location = QString::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 (QString::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="qstring.html#QString-null">QString::null</a>, 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 a relative (a child of the path to which
|
||
|
the QUrlOperator points) or an absolute URL.
|
||
|
<p> For putting some data to a file you can do the following:
|
||
|
<p> <pre>
|
||
|
QUrlOperator 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 QUrlOperator must point
|
||
|
to a directory. If you want to upload data to a file you could do
|
||
|
the following:
|
||
|
<p> <pre>
|
||
|
QUrlOperator 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 <a href="qnetworkoperation.html">QNetworkOperation</a> * <a name="remove"></a>QUrlOperator::remove ( const <a href="qstring.html">QString</a> & 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">QNetworkOperation</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 QUrlOperator). The return value can also
|
||
|
be 0 if the operation object couldn't be created.
|
||
|
<p> The path of this QUrlOperator 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>QUrlOperator::removed ( <a href="qnetworkoperation.html">QNetworkOperation</a> * 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->arg(0)</tt> holds the name of the file that was removed.
|
||
|
<p> <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="rename"></a>QUrlOperator::rename ( const <a href="qstring.html">QString</a> & oldname, const <a href="qstring.html">QString</a> & 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">QNetworkOperation</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 QUrlOperator). The return value can also
|
||
|
be 0 if the operation object couldn't be created.
|
||
|
<p> This path of this QUrlOperator 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>QUrlOperator::setNameFilter ( const <a href="qstring.html">QString</a> & nameFilter )<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Sets the name filter of the URL to <em>nameFilter</em>.
|
||
|
<p> <p>See also <a href="qdir.html#setNameFilter">QDir::setNameFilter</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="start"></a>QUrlOperator::start ( <a href="qnetworkoperation.html">QNetworkOperation</a> * 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">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
|
||
|
|
||
|
<h3 class=fn>void <a name="startedNextCopy"></a>QUrlOperator::startedNextCopy ( const <a href="qptrlist.html">QPtrList</a><QNetworkOperation> & 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 QNetworkOperations related to this copy
|
||
|
operation.
|
||
|
<p> <p>See also <a href="#copy">copy</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="stop"></a>QUrlOperator::stop ()<tt> [virtual]</tt>
|
||
|
</h3>
|
||
|
Stops the current network operation and removes all this
|
||
|
QUrlOperator's waiting network operations.
|
||
|
|
||
|
<hr><h2>Related Functions</h2>
|
||
|
<h3 class=fn>void <a name="qInitNetworkProtocols"></a>qInitNetworkProtocols ()
|
||
|
</h3>
|
||
|
|
||
|
<p> This function registers the network protocols for FTP and HTTP.
|
||
|
You must call this function before you use QUrlOperator for
|
||
|
these protocols.
|
||
|
<p> This function is declared in <a href="qnetwork-h.html">qnetwork.h</a>.
|
||
|
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">Qt toolkit</a>.
|
||
|
Copyright © 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 © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|