1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/network/qftp.cpp:1063 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QFtp Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QFtp Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
|
---|
33 |
|
---|
34 | <p>The QFtp class provides an implementation of the FTP protocol.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qftp-h.html">qftp.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qnetworkprotocol.html">QNetworkProtocol</a>.
|
---|
38 | <p><a href="qftp-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
41 | <li class=fn><a href="#QFtp"><b>QFtp</b></a> ()</li>
|
---|
42 | <li class=fn><a href="#QFtp-2"><b>QFtp</b></a> ( QObject * parent, const char * name = 0 )</li>
|
---|
43 | <li class=fn>virtual <a href="#~QFtp"><b>~QFtp</b></a> ()</li>
|
---|
44 | <li class=fn>enum <a href="#State-enum"><b>State</b></a> { Unconnected, HostLookup, Connecting, Connected, LoggedIn, Closing }</li>
|
---|
45 | <li class=fn>enum <a href="#Error-enum"><b>Error</b></a> { NoError, UnknownError, HostNotFound, ConnectionRefused, NotConnected }</li>
|
---|
46 | <li class=fn>enum <a href="#Command-enum"><b>Command</b></a> { None, ConnectToHost, Login, Close, List, Cd, Get, Put, Remove, Mkdir, Rmdir, Rename, RawCommand }</li>
|
---|
47 | <li class=fn>int <a href="#connectToHost"><b>connectToHost</b></a> ( const QString & host, Q_UINT16 port = 21 )</li>
|
---|
48 | <li class=fn>int <a href="#login"><b>login</b></a> ( const QString & user = QString::null, const QString & password = QString::null )</li>
|
---|
49 | <li class=fn>int <a href="#close"><b>close</b></a> ()</li>
|
---|
50 | <li class=fn>int <a href="#list"><b>list</b></a> ( const QString & dir = QString::null )</li>
|
---|
51 | <li class=fn>int <a href="#cd"><b>cd</b></a> ( const QString & dir )</li>
|
---|
52 | <li class=fn>int <a href="#get"><b>get</b></a> ( const QString & file, QIODevice * dev = 0 )</li>
|
---|
53 | <li class=fn>int <a href="#put-2"><b>put</b></a> ( const QByteArray & data, const QString & file )</li>
|
---|
54 | <li class=fn>int <a href="#put"><b>put</b></a> ( QIODevice * dev, const QString & file )</li>
|
---|
55 | <li class=fn>int <a href="#remove"><b>remove</b></a> ( const QString & file )</li>
|
---|
56 | <li class=fn>int <a href="#mkdir"><b>mkdir</b></a> ( const QString & dir )</li>
|
---|
57 | <li class=fn>int <a href="#rmdir"><b>rmdir</b></a> ( const QString & dir )</li>
|
---|
58 | <li class=fn>int <a href="#rename"><b>rename</b></a> ( const QString & oldname, const QString & newname )</li>
|
---|
59 | <li class=fn>int <a href="#rawCommand"><b>rawCommand</b></a> ( const QString & command )</li>
|
---|
60 | <li class=fn>Q_ULONG <a href="#bytesAvailable"><b>bytesAvailable</b></a> () const</li>
|
---|
61 | <li class=fn>Q_LONG <a href="#readBlock"><b>readBlock</b></a> ( char * data, Q_ULONG maxlen )</li>
|
---|
62 | <li class=fn>QByteArray <a href="#readAll"><b>readAll</b></a> ()</li>
|
---|
63 | <li class=fn>int <a href="#currentId"><b>currentId</b></a> () const</li>
|
---|
64 | <li class=fn>QIODevice * <a href="#currentDevice"><b>currentDevice</b></a> () const</li>
|
---|
65 | <li class=fn>Command <a href="#currentCommand"><b>currentCommand</b></a> () const</li>
|
---|
66 | <li class=fn>bool <a href="#hasPendingCommands"><b>hasPendingCommands</b></a> () const</li>
|
---|
67 | <li class=fn>void <a href="#clearPendingCommands"><b>clearPendingCommands</b></a> ()</li>
|
---|
68 | <li class=fn>State <a href="#state"><b>state</b></a> () const</li>
|
---|
69 | <li class=fn>Error <a href="#error"><b>error</b></a> () const</li>
|
---|
70 | <li class=fn>QString <a href="#errorString"><b>errorString</b></a> () const</li>
|
---|
71 | </ul>
|
---|
72 | <h2>Public Slots</h2>
|
---|
73 | <ul>
|
---|
74 | <li class=fn>void <a href="#abort"><b>abort</b></a> ()</li>
|
---|
75 | </ul>
|
---|
76 | <h2>Signals</h2>
|
---|
77 | <ul>
|
---|
78 | <li class=fn>void <a href="#stateChanged"><b>stateChanged</b></a> ( int state )</li>
|
---|
79 | <li class=fn>void <a href="#listInfo"><b>listInfo</b></a> ( const QUrlInfo & i )</li>
|
---|
80 | <li class=fn>void <a href="#readyRead"><b>readyRead</b></a> ()</li>
|
---|
81 | <li class=fn>void <a href="#dataTransferProgress"><b>dataTransferProgress</b></a> ( int done, int total )</li>
|
---|
82 | <li class=fn>void <a href="#rawCommandReply"><b>rawCommandReply</b></a> ( int replyCode, const QString & detail )</li>
|
---|
83 | <li class=fn>void <a href="#commandStarted"><b>commandStarted</b></a> ( int id )</li>
|
---|
84 | <li class=fn>void <a href="#commandFinished"><b>commandFinished</b></a> ( int id, bool error )</li>
|
---|
85 | <li class=fn>void <a href="#done"><b>done</b></a> ( bool error )</li>
|
---|
86 | </ul>
|
---|
87 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
88 |
|
---|
89 |
|
---|
90 | The QFtp class provides an implementation of the FTP protocol.
|
---|
91 |
|
---|
92 | <p>
|
---|
93 |
|
---|
94 | <p> This class provides two different interfaces: one is the
|
---|
95 | <a href="qnetworkprotocol.html">QNetworkProtocol</a> interface that allows you to use FTP through the
|
---|
96 | <a href="qurloperator.html">QUrlOperator</a> abstraction. The other is a direct interface to FTP
|
---|
97 | that gives you lower-level access to the FTP protocol for finer
|
---|
98 | control. Using the direct interface you can also execute arbitrary
|
---|
99 | FTP commands.
|
---|
100 | <p> Don't mix the two interfaces, since the behavior is not
|
---|
101 | well-defined.
|
---|
102 | <p> If you want to use QFtp with the QNetworkProtocol interface, you
|
---|
103 | do not use it directly, but rather through a QUrlOperator, for
|
---|
104 | example:
|
---|
105 | <p> <pre>
|
---|
106 | <a href="qurloperator.html">QUrlOperator</a> op( "ftp://ftp.trolltech.com" );
|
---|
107 | op.<a href="qurloperator.html#listChildren">listChildren</a>(); // Asks the server to provide a directory listing
|
---|
108 | </pre>
|
---|
109 |
|
---|
110 | <p> This code will only work if the QFtp class is registered; to
|
---|
111 | register the class, you must call <a href="qurloperator.html#qInitNetworkProtocols">qInitNetworkProtocols</a>() before
|
---|
112 | using a QUrlOperator with QFtp.
|
---|
113 | <p> The rest of this descrption describes the direct interface to FTP.
|
---|
114 | <p> The class works asynchronously, so there are no blocking
|
---|
115 | functions. If an operation cannot be executed immediately, the
|
---|
116 | function will still return straight away and the operation will be
|
---|
117 | scheduled for later execution. The results of scheduled operations
|
---|
118 | are reported via signals. This approach depends on the event loop
|
---|
119 | being in operation.
|
---|
120 | <p> The operations that can be scheduled (they are called "commands"
|
---|
121 | in the rest of the documentation) are the following:
|
---|
122 | <a href="#connectToHost">connectToHost</a>(), <a href="#login">login</a>(), <a href="#close">close</a>(), <a href="#list">list</a>(), <a href="#cd">cd</a>(), <a href="#get">get</a>(), <a href="#put">put</a>(),
|
---|
123 | <a href="#remove">remove</a>(), <a href="#mkdir">mkdir</a>(), <a href="#rmdir">rmdir</a>(), <a href="#rename">rename</a>() and <a href="#rawCommand">rawCommand</a>().
|
---|
124 | <p> All of these commands return a unique identifier that allows you
|
---|
125 | to keep track of the command that is currently being executed.
|
---|
126 | When the execution of a command starts, the <a href="#commandStarted">commandStarted</a>()
|
---|
127 | signal with the command's identifier is emitted. When the command
|
---|
128 | is finished, the <a href="#commandFinished">commandFinished</a>() signal is emitted with the
|
---|
129 | command's identifier and a bool that indicates whether the command
|
---|
130 | finished with an error.
|
---|
131 | <p> In some cases, you might want to execute a sequence of commands,
|
---|
132 | e.g. if you want to connect and login to a FTP server. This is
|
---|
133 | simply achieved:
|
---|
134 | <p> <pre>
|
---|
135 | QFtp *ftp = new QFtp( this ); // this is an optional QObject parent
|
---|
136 | ftp-><a href="#connectToHost">connectToHost</a>( "ftp.trolltech.com" );
|
---|
137 | ftp-><a href="#login">login</a>();
|
---|
138 | </pre>
|
---|
139 |
|
---|
140 | <p> In this case two FTP commands have been scheduled. When the last
|
---|
141 | scheduled command has finished, a <a href="#done">done</a>() signal is emitted with
|
---|
142 | a bool argument that tells you whether the sequence finished with
|
---|
143 | an error.
|
---|
144 | <p> If an error occurs during the execution of one of the commands in
|
---|
145 | a sequence of commands, all the pending commands (i.e. scheduled,
|
---|
146 | but not yet executed commands) are cleared and no signals are
|
---|
147 | emitted for them.
|
---|
148 | <p> Some commands, e.g. <a href="#list">list</a>(), emit additional signals to report
|
---|
149 | their results.
|
---|
150 | <p> Example: If you want to download the INSTALL file from Trolltech's
|
---|
151 | FTP server, you would write this:
|
---|
152 | <p> <pre>
|
---|
153 | ftp->connectToHost( "ftp.trolltech.com" ); // id == 1
|
---|
154 | ftp->login(); // id == 2
|
---|
155 | ftp->cd( "qt" ); // id == 3
|
---|
156 | ftp->get( "INSTALL" ); // id == 4
|
---|
157 | ftp->close(); // id == 5
|
---|
158 | </pre>
|
---|
159 |
|
---|
160 | <p> For this example the following sequence of signals is emitted
|
---|
161 | (with small variations, depending on network traffic, etc.):
|
---|
162 | <p> <pre>
|
---|
163 | <a href="qnetworkprotocol.html#start">start</a>( 1 )
|
---|
164 | <a href="#stateChanged">stateChanged</a>( <a href="#State-enum">HostLookup</a> )
|
---|
165 | <a href="#stateChanged">stateChanged</a>( <a href="#State-enum">Connecting</a> )
|
---|
166 | <a href="#stateChanged">stateChanged</a>( <a href="#State-enum">Connected</a> )
|
---|
167 | <a href="qnetworkprotocol.html#finished">finished</a>( 1, FALSE )
|
---|
168 |
|
---|
169 | <a href="qnetworkprotocol.html#start">start</a>( 2 )
|
---|
170 | <a href="#stateChanged">stateChanged</a>( <a href="#State-enum">LoggedIn</a> )
|
---|
171 | <a href="qnetworkprotocol.html#finished">finished</a>( 2, FALSE )
|
---|
172 |
|
---|
173 | <a href="qnetworkprotocol.html#start">start</a>( 3 )
|
---|
174 | <a href="qnetworkprotocol.html#finished">finished</a>( 3, FALSE )
|
---|
175 |
|
---|
176 | <a href="qnetworkprotocol.html#start">start</a>( 4 )
|
---|
177 | <a href="#dataTransferProgress">dataTransferProgress</a>( 0, 3798 )
|
---|
178 | <a href="#dataTransferProgress">dataTransferProgress</a>( 2896, 3798 )
|
---|
179 | <a href="#readyRead">readyRead</a>()
|
---|
180 | <a href="#dataTransferProgress">dataTransferProgress</a>( 3798, 3798 )
|
---|
181 | <a href="#readyRead">readyRead</a>()
|
---|
182 | <a href="qnetworkprotocol.html#finished">finished</a>( 4, FALSE )
|
---|
183 |
|
---|
184 | <a href="qnetworkprotocol.html#start">start</a>( 5 )
|
---|
185 | <a href="#stateChanged">stateChanged</a>( <a href="#State-enum">Closing</a> )
|
---|
186 | <a href="#stateChanged">stateChanged</a>( <a href="#State-enum">Unconnected</a> )
|
---|
187 | <a href="qnetworkprotocol.html#finished">finished</a>( 5, FALSE )
|
---|
188 |
|
---|
189 | <a href="#done">done</a>( FALSE )
|
---|
190 | </pre>
|
---|
191 |
|
---|
192 | <p> The <a href="#dataTransferProgress">dataTransferProgress</a>() signal in the above example is useful
|
---|
193 | if you want to show a <a href="qprogressbar.html">progressbar</a> to
|
---|
194 | inform the user about the progress of the download. The
|
---|
195 | <a href="#readyRead">readyRead</a>() signal tells you that there is data ready to be read.
|
---|
196 | The amount of data can be queried then with the <a href="#bytesAvailable">bytesAvailable</a>()
|
---|
197 | function and it can be read with the <a href="#readBlock">readBlock</a>() or <a href="#readAll">readAll</a>()
|
---|
198 | function.
|
---|
199 | <p> If the login fails for the above example, the signals would look
|
---|
200 | like this:
|
---|
201 | <p> <pre>
|
---|
202 | <a href="qnetworkprotocol.html#start">start</a>( 1 )
|
---|
203 | <a href="#stateChanged">stateChanged</a>( <a href="#State-enum">HostLookup</a> )
|
---|
204 | <a href="#stateChanged">stateChanged</a>( <a href="#State-enum">Connecting</a> )
|
---|
205 | <a href="#stateChanged">stateChanged</a>( <a href="#State-enum">Connected</a> )
|
---|
206 | <a href="qnetworkprotocol.html#finished">finished</a>( 1, FALSE )
|
---|
207 |
|
---|
208 | <a href="qnetworkprotocol.html#start">start</a>( 2 )
|
---|
209 | <a href="qnetworkprotocol.html#finished">finished</a>( 2, TRUE )
|
---|
210 |
|
---|
211 | <a href="#done">done</a>( TRUE )
|
---|
212 | </pre>
|
---|
213 |
|
---|
214 | <p> You can then get details about the error with the <a href="#error">error</a>() and
|
---|
215 | <a href="#errorString">errorString</a>() functions.
|
---|
216 | <p> The functions <a href="#currentId">currentId</a>() and <a href="#currentCommand">currentCommand</a>() provide more
|
---|
217 | information about the currently executing command.
|
---|
218 | <p> The functions <a href="#hasPendingCommands">hasPendingCommands</a>() and <a href="#clearPendingCommands">clearPendingCommands</a>()
|
---|
219 | allow you to query and clear the list of pending commands.
|
---|
220 | <p> The safest and easiest way to use the FTP protocol is to use
|
---|
221 | <a href="qurloperator.html">QUrlOperator</a>() or the FTP commands described above. If you are an
|
---|
222 | experienced network programmer and want to have complete control
|
---|
223 | you can use <a href="#rawCommand">rawCommand</a>() to execute arbitrary FTP commands.
|
---|
224 | <p> <p>See also <a href="network.html">Qt Network Documentation</a>, <a href="qnetworkprotocol.html">QNetworkProtocol</a>, <a href="qurloperator.html">QUrlOperator</a>, <a href="qhttp.html">QHttp</a>, and <a href="io.html">Input/Output and Networking</a>.
|
---|
225 |
|
---|
226 | <hr><h2>Member Type Documentation</h2>
|
---|
227 | <h3 class=fn><a name="Command-enum"></a>QFtp::Command</h3>
|
---|
228 |
|
---|
229 | <p> This enum is used as the return value for the <a href="#currentCommand">currentCommand</a>() function.
|
---|
230 | This allows you to perform specific actions for particular
|
---|
231 | commands, e.g. in a FTP client, you might want to clear the
|
---|
232 | directory view when a <a href="#list">list</a>() command is started; in this case you
|
---|
233 | can simply check in the slot connected to the <a href="qnetworkprotocol.html#start">start</a>() signal if
|
---|
234 | the currentCommand() is <a href="#Command-enum">List</a>.
|
---|
235 | <ul>
|
---|
236 | <li><tt>QFtp::None</tt> - No command is being executed.
|
---|
237 | <li><tt>QFtp::ConnectToHost</tt> - <a href="#connectToHost">connectToHost</a>() is being executed.
|
---|
238 | <li><tt>QFtp::Login</tt> - <a href="#login">login</a>() is being executed.
|
---|
239 | <li><tt>QFtp::Close</tt> - <a href="#close">close</a>() is being executed.
|
---|
240 | <li><tt>QFtp::List</tt> - list() is being executed.
|
---|
241 | <li><tt>QFtp::Cd</tt> - <a href="#cd">cd</a>() is being executed.
|
---|
242 | <li><tt>QFtp::Get</tt> - <a href="#get">get</a>() is being executed.
|
---|
243 | <li><tt>QFtp::Put</tt> - <a href="#put">put</a>() is being executed.
|
---|
244 | <li><tt>QFtp::Remove</tt> - <a href="#remove">remove</a>() is being executed.
|
---|
245 | <li><tt>QFtp::Mkdir</tt> - <a href="#mkdir">mkdir</a>() is being executed.
|
---|
246 | <li><tt>QFtp::Rmdir</tt> - <a href="#rmdir">rmdir</a>() is being executed.
|
---|
247 | <li><tt>QFtp::Rename</tt> - <a href="#rename">rename</a>() is being executed.
|
---|
248 | <li><tt>QFtp::RawCommand</tt> - <a href="#rawCommand">rawCommand</a>() is being executed.
|
---|
249 | </ul><p> <p>See also <a href="#currentCommand">currentCommand</a>().
|
---|
250 |
|
---|
251 | <h3 class=fn><a name="Error-enum"></a>QFtp::Error</h3>
|
---|
252 |
|
---|
253 | <p> This enum identifies the error that occurred.
|
---|
254 | <ul>
|
---|
255 | <li><tt>QFtp::NoError</tt> - No error occurred.
|
---|
256 | <li><tt>QFtp::HostNotFound</tt> - The host name lookup failed.
|
---|
257 | <li><tt>QFtp::ConnectionRefused</tt> - The server refused the connection.
|
---|
258 | <li><tt>QFtp::NotConnected</tt> - Tried to send a command, but there is no connection to
|
---|
259 | a server.
|
---|
260 | <li><tt>QFtp::UnknownError</tt> - An error other than those specified above
|
---|
261 | occurred.
|
---|
262 | </ul><p> <p>See also <a href="#error">error</a>().
|
---|
263 |
|
---|
264 | <h3 class=fn><a name="State-enum"></a>QFtp::State</h3>
|
---|
265 |
|
---|
266 | <p> This enum defines the connection state:
|
---|
267 | <ul>
|
---|
268 | <li><tt>QFtp::Unconnected</tt> - There is no connection to the host.
|
---|
269 | <li><tt>QFtp::HostLookup</tt> - A host name lookup is in progress.
|
---|
270 | <li><tt>QFtp::Connecting</tt> - An attempt to connect to the host is in progress.
|
---|
271 | <li><tt>QFtp::Connected</tt> - Connection to the host has been achieved.
|
---|
272 | <li><tt>QFtp::LoggedIn</tt> - Connection and user login have been achieved.
|
---|
273 | <li><tt>QFtp::Closing</tt> - The connection is closing down, but it is not yet
|
---|
274 | closed. (The state will be <a href="#State-enum">Unconnected</a> when the connection is
|
---|
275 | closed.)
|
---|
276 | </ul><p> <p>See also <a href="#stateChanged">stateChanged</a>() and <a href="#state">state</a>().
|
---|
277 |
|
---|
278 | <hr><h2>Member Function Documentation</h2>
|
---|
279 | <h3 class=fn><a name="QFtp"></a>QFtp::QFtp ()
|
---|
280 | </h3>
|
---|
281 | Constructs a QFtp object.
|
---|
282 |
|
---|
283 | <h3 class=fn><a name="QFtp-2"></a>QFtp::QFtp ( <a href="qobject.html">QObject</a> * parent, const char * name = 0 )
|
---|
284 | </h3>
|
---|
285 | Constructs a QFtp object. The <em>parent</em> and <em>name</em> parameters
|
---|
286 | are passed to the <a href="qobject.html">QObject</a> constructor.
|
---|
287 |
|
---|
288 | <h3 class=fn><a name="~QFtp"></a>QFtp::~QFtp ()<tt> [virtual]</tt>
|
---|
289 | </h3>
|
---|
290 | Destructor.
|
---|
291 |
|
---|
292 | <h3 class=fn>void <a name="abort"></a>QFtp::abort ()<tt> [slot]</tt>
|
---|
293 | </h3>
|
---|
294 | Aborts the current command and deletes all scheduled commands.
|
---|
295 | <p> If there is an unfinished command (i.e. a command for which the
|
---|
296 | <a href="#commandStarted">commandStarted</a>() signal has been emitted, but for which the
|
---|
297 | <a href="#commandFinished">commandFinished</a>() signal has not been emitted), this function
|
---|
298 | sends an <tt>ABORT</tt> command to the server. When the server replies
|
---|
299 | that the command is aborted, the commandFinished() signal with the
|
---|
300 | <tt>error</tt> argument set to <tt>TRUE</tt> is emitted for the command. Due
|
---|
301 | to timing issues, it is possible that the command had already
|
---|
302 | finished before the abort request reached the server, in which
|
---|
303 | case, the commandFinished() signal is emitted with the <tt>error</tt>
|
---|
304 | argument set to <tt>FALSE</tt>.
|
---|
305 | <p> For all other commands that are affected by the <a href="#abort">abort</a>(), no
|
---|
306 | signals are emitted.
|
---|
307 | <p> If you don't start further FTP commands directly after the
|
---|
308 | abort(), there won't be any scheduled commands and the <a href="#done">done</a>()
|
---|
309 | signal is emitted.
|
---|
310 | <p> <b>Warning:</b> Some FTP servers, for example the BSD FTP daemon (version
|
---|
311 | 0.3), wrongly return a positive reply even when an abort has
|
---|
312 | occurred. For these servers the commandFinished() signal has its
|
---|
313 | error flag set to <tt>FALSE</tt>, even though the command did not
|
---|
314 | complete successfully.
|
---|
315 | <p> <p>See also <a href="#clearPendingCommands">clearPendingCommands</a>().
|
---|
316 |
|
---|
317 | <p>Example: <a href="ftpclient-example.html#x744">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
318 | <h3 class=fn>Q_ULONG <a name="bytesAvailable"></a>QFtp::bytesAvailable () const
|
---|
319 | </h3>
|
---|
320 | Returns the number of bytes that can be read from the data socket
|
---|
321 | at the moment.
|
---|
322 | <p> <p>See also <a href="#get">get</a>(), <a href="#readyRead">readyRead</a>(), <a href="#readBlock">readBlock</a>(), and <a href="#readAll">readAll</a>().
|
---|
323 |
|
---|
324 | <h3 class=fn>int <a name="cd"></a>QFtp::cd ( const <a href="qstring.html">QString</a> & dir )
|
---|
325 | </h3>
|
---|
326 | Changes the working directory of the server to <em>dir</em>.
|
---|
327 | <p> The function does not block and returns immediately. The command
|
---|
328 | is scheduled, and its execution is performed asynchronously. The
|
---|
329 | function returns a unique identifier which is passed by
|
---|
330 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
331 | <p> When the command is started the commandStarted() signal is
|
---|
332 | emitted. When it is finished the commandFinished() signal is
|
---|
333 | emitted.
|
---|
334 | <p> <p>See also <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
335 |
|
---|
336 | <p>Example: <a href="ftpclient-example.html#x745">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
337 | <h3 class=fn>void <a name="clearPendingCommands"></a>QFtp::clearPendingCommands ()
|
---|
338 | </h3>
|
---|
339 | Deletes all pending commands from the list of scheduled commands.
|
---|
340 | This does not affect the command that is being executed. If you
|
---|
341 | want to stop this this as well, use <a href="#abort">abort</a>().
|
---|
342 | <p> <p>See also <a href="#hasPendingCommands">hasPendingCommands</a>() and <a href="#abort">abort</a>().
|
---|
343 |
|
---|
344 | <h3 class=fn>int <a name="close"></a>QFtp::close ()
|
---|
345 | </h3>
|
---|
346 | Closes the connection to the FTP server.
|
---|
347 | <p> The <a href="#stateChanged">stateChanged</a>() signal is emitted when the state of the
|
---|
348 | connecting process changes, e.g. to <a href="#State-enum">Closing</a>, then <a href="#State-enum">Unconnected</a>.
|
---|
349 | <p> The function does not block and returns immediately. The command
|
---|
350 | is scheduled, and its execution is performed asynchronously. The
|
---|
351 | function returns a unique identifier which is passed by
|
---|
352 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
353 | <p> When the command is started the commandStarted() signal is
|
---|
354 | emitted. When it is finished the commandFinished() signal is
|
---|
355 | emitted.
|
---|
356 | <p> <p>See also <a href="#stateChanged">stateChanged</a>(), <a href="#commandStarted">commandStarted</a>(), and <a href="#commandFinished">commandFinished</a>().
|
---|
357 |
|
---|
358 | <p>Example: <a href="ftpclient-example.html#x746">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
359 | <h3 class=fn>void <a name="commandFinished"></a>QFtp::commandFinished ( int id, bool error )<tt> [signal]</tt>
|
---|
360 | </h3>
|
---|
361 |
|
---|
362 | <p> This signal is emitted when processing the command identified by
|
---|
363 | <em>id</em> has finished. <em>error</em> is TRUE if an error occurred during
|
---|
364 | the processing; otherwise <em>error</em> is FALSE.
|
---|
365 | <p> <p>See also <a href="#commandStarted">commandStarted</a>(), <a href="#done">done</a>(), <a href="#error">error</a>(), and <a href="#errorString">errorString</a>().
|
---|
366 |
|
---|
367 | <p>Example: <a href="ftpclient-example.html#x747">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
368 | <h3 class=fn>void <a name="commandStarted"></a>QFtp::commandStarted ( int id )<tt> [signal]</tt>
|
---|
369 | </h3>
|
---|
370 |
|
---|
371 | <p> This signal is emitted when processing the command identified by
|
---|
372 | <em>id</em> starts.
|
---|
373 | <p> <p>See also <a href="#commandFinished">commandFinished</a>() and <a href="#done">done</a>().
|
---|
374 |
|
---|
375 | <p>Example: <a href="ftpclient-example.html#x748">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
376 | <h3 class=fn>int <a name="connectToHost"></a>QFtp::connectToHost ( const <a href="qstring.html">QString</a> & host, Q_UINT16 port = 21 )
|
---|
377 | </h3>
|
---|
378 | Connects to the FTP server <em>host</em> using port <em>port</em>.
|
---|
379 | <p> The <a href="#stateChanged">stateChanged</a>() signal is emitted when the state of the
|
---|
380 | connecting process changes, e.g. to <a href="#State-enum">HostLookup</a>, then <a href="#State-enum">Connecting</a>, then <a href="#State-enum">Connected</a>.
|
---|
381 | <p> The function does not block and returns immediately. The command
|
---|
382 | is scheduled, and its execution is performed asynchronously. The
|
---|
383 | function returns a unique identifier which is passed by
|
---|
384 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
385 | <p> When the command is started the commandStarted() signal is
|
---|
386 | emitted. When it is finished the commandFinished() signal is
|
---|
387 | emitted.
|
---|
388 | <p> <p>See also <a href="#stateChanged">stateChanged</a>(), <a href="#commandStarted">commandStarted</a>(), and <a href="#commandFinished">commandFinished</a>().
|
---|
389 |
|
---|
390 | <p>Example: <a href="ftpclient-example.html#x749">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
391 | <h3 class=fn><a href="qftp.html#Command-enum">Command</a> <a name="currentCommand"></a>QFtp::currentCommand () const
|
---|
392 | </h3>
|
---|
393 | Returns the command type of the FTP command being executed or <a href="#Command-enum">None</a> if there is no command being executed.
|
---|
394 | <p> <p>See also <a href="#currentId">currentId</a>().
|
---|
395 |
|
---|
396 | <p>Example: <a href="ftpclient-example.html#x750">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
397 | <h3 class=fn><a href="qiodevice.html">QIODevice</a> * <a name="currentDevice"></a>QFtp::currentDevice () const
|
---|
398 | </h3>
|
---|
399 | Returns the <a href="qiodevice.html">QIODevice</a> pointer that is used by the FTP command to read data
|
---|
400 | from or store data to. If there is no current FTP command being executed or
|
---|
401 | if the command does not use an IO device, this function returns 0.
|
---|
402 | <p> This function can be used to delete the QIODevice in the slot connected to
|
---|
403 | the <a href="#commandFinished">commandFinished</a>() signal.
|
---|
404 | <p> <p>See also <a href="#get">get</a>() and <a href="#put">put</a>().
|
---|
405 |
|
---|
406 | <p>Example: <a href="ftpclient-example.html#x751">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
407 | <h3 class=fn>int <a name="currentId"></a>QFtp::currentId () const
|
---|
408 | </h3>
|
---|
409 | Returns the identifier of the FTP command that is being executed
|
---|
410 | or 0 if there is no command being executed.
|
---|
411 | <p> <p>See also <a href="#currentCommand">currentCommand</a>().
|
---|
412 |
|
---|
413 | <h3 class=fn>void <a name="dataTransferProgress"></a>QFtp::dataTransferProgress ( int done, int total )<tt> [signal]</tt>
|
---|
414 | </h3>
|
---|
415 |
|
---|
416 | <p> This signal is emitted in response to a <a href="#get">get</a>() or <a href="#put">put</a>() request to
|
---|
417 | indicate the current progress of the download or upload.
|
---|
418 | <p> <em>done</em> is the amount of data that has already been transferred
|
---|
419 | and <em>total</em> is the total amount of data to be read or written. It
|
---|
420 | is possible that the QFtp class is not able to determine the total
|
---|
421 | amount of data that should be transferred, in which case <em>total</em>
|
---|
422 | is 0. (If you connect this signal to a <a href="qprogressbar.html">QProgressBar</a>, the progress
|
---|
423 | bar shows a busy indicator if the total is 0).
|
---|
424 | <p> <b>Warning:</b> <em>done</em> and <em>total</em> are not necessarily the size in
|
---|
425 | bytes, since for large files these values might need to be
|
---|
426 | "scaled" to avoid overflow.
|
---|
427 | <p> <p>See also <a href="#get">get</a>(), <a href="#put">put</a>(), and <a href="qprogressbar.html#progress-prop">QProgressBar::progress</a>.
|
---|
428 |
|
---|
429 | <p>Example: <a href="ftpclient-example.html#x752">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
430 | <h3 class=fn>void <a name="done"></a>QFtp::done ( bool error )<tt> [signal]</tt>
|
---|
431 | </h3>
|
---|
432 |
|
---|
433 | <p> This signal is emitted when the last pending command has finished;
|
---|
434 | (it is emitted after the last command's <a href="#commandFinished">commandFinished</a>() signal).
|
---|
435 | <em>error</em> is TRUE if an error occurred during the processing;
|
---|
436 | otherwise <em>error</em> is FALSE.
|
---|
437 | <p> <p>See also <a href="#commandFinished">commandFinished</a>(), <a href="#error">error</a>(), and <a href="#errorString">errorString</a>().
|
---|
438 |
|
---|
439 | <p>Example: <a href="ftpclient-example.html#x753">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
440 | <h3 class=fn><a href="qftp.html#Error-enum">Error</a> <a name="error"></a>QFtp::error () const
|
---|
441 | </h3>
|
---|
442 | Returns the last error that occurred. This is useful to find out
|
---|
443 | what when wrong when receiving a <a href="#commandFinished">commandFinished</a>() or a <a href="#done">done</a>()
|
---|
444 | signal with the <tt>error</tt> argument set to <tt>TRUE</tt>.
|
---|
445 | <p> If you start a new command, the error status is reset to <a href="#Error-enum">NoError</a>.
|
---|
446 |
|
---|
447 | <h3 class=fn><a href="qstring.html">QString</a> <a name="errorString"></a>QFtp::errorString () const
|
---|
448 | </h3>
|
---|
449 | Returns a human-readable description of the last error that
|
---|
450 | occurred. This is useful for presenting a error message to the
|
---|
451 | user when receiving a <a href="#commandFinished">commandFinished</a>() or a <a href="#done">done</a>() signal with
|
---|
452 | the <tt>error</tt> argument set to <tt>TRUE</tt>.
|
---|
453 | <p> The error string is often (but not always) the reply from the
|
---|
454 | server, so it is not always possible to translate the string. If
|
---|
455 | the message comes from Qt, the string has already passed through
|
---|
456 | <a href="qobject.html#tr">tr</a>().
|
---|
457 |
|
---|
458 | <p>Example: <a href="ftpclient-example.html#x754">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
459 | <h3 class=fn>int <a name="get"></a>QFtp::get ( const <a href="qstring.html">QString</a> & file, <a href="qiodevice.html">QIODevice</a> * dev = 0 )
|
---|
460 | </h3>
|
---|
461 | Downloads the file <em>file</em> from the server.
|
---|
462 | <p> If <em>dev</em> is 0, then the <a href="#readyRead">readyRead</a>() signal is emitted when there
|
---|
463 | is data available to read. You can then read the data with the
|
---|
464 | <a href="#readBlock">readBlock</a>() or <a href="#readAll">readAll</a>() functions.
|
---|
465 | <p> If <em>dev</em> is not 0, the data is written directly to the device <em>dev</em>. Make sure that the <em>dev</em> pointer is valid for the duration
|
---|
466 | of the operation (it is safe to delete it when the
|
---|
467 | <a href="#commandFinished">commandFinished</a>() signal is emitted). In this case the readyRead()
|
---|
468 | signal is <em>not</em> emitted and you cannot read data with the
|
---|
469 | readBlock() or readAll() functions.
|
---|
470 | <p> If you don't read the data immediately it becomes available, i.e.
|
---|
471 | when the readyRead() signal is emitted, it is still available
|
---|
472 | until the next command is started.
|
---|
473 | <p> For example, if you want to present the data to the user as soon
|
---|
474 | as there is something available, connect to the readyRead() signal
|
---|
475 | and read the data immediately. On the other hand, if you only want
|
---|
476 | to work with the complete data, you can connect to the
|
---|
477 | commandFinished() signal and read the data when the <a href="#get">get</a>() command
|
---|
478 | is finished.
|
---|
479 | <p> The function does not block and returns immediately. The command
|
---|
480 | is scheduled, and its execution is performed asynchronously. The
|
---|
481 | function returns a unique identifier which is passed by
|
---|
482 | <a href="#commandStarted">commandStarted</a>() and commandFinished().
|
---|
483 | <p> When the command is started the commandStarted() signal is
|
---|
484 | emitted. When it is finished the <a href="#commandFinished">commandFinished</a>() signal is
|
---|
485 | emitted.
|
---|
486 | <p> <p>See also <a href="#readyRead">readyRead</a>(), <a href="#dataTransferProgress">dataTransferProgress</a>(), <a href="#commandStarted">commandStarted</a>(), and <a href="#commandFinished">commandFinished</a>().
|
---|
487 |
|
---|
488 | <p>Example: <a href="ftpclient-example.html#x755">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
489 | <h3 class=fn>bool <a name="hasPendingCommands"></a>QFtp::hasPendingCommands () const
|
---|
490 | </h3>
|
---|
491 | Returns TRUE if there are any commands scheduled that have not yet
|
---|
492 | been executed; otherwise returns FALSE.
|
---|
493 | <p> The command that is being executed is <em>not</em> considered as a
|
---|
494 | scheduled command.
|
---|
495 | <p> <p>See also <a href="#clearPendingCommands">clearPendingCommands</a>(), <a href="#currentId">currentId</a>(), and <a href="#currentCommand">currentCommand</a>().
|
---|
496 |
|
---|
497 | <h3 class=fn>int <a name="list"></a>QFtp::list ( const <a href="qstring.html">QString</a> & dir = QString::null )
|
---|
498 | </h3>
|
---|
499 | Lists the contents of directory <em>dir</em> on the FTP server. If <em>dir</em> is empty, it lists the contents of the current directory.
|
---|
500 | <p> The <a href="#listInfo">listInfo</a>() signal is emitted for each directory entry found.
|
---|
501 | <p> The function does not block and returns immediately. The command
|
---|
502 | is scheduled, and its execution is performed asynchronously. The
|
---|
503 | function returns a unique identifier which is passed by
|
---|
504 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
505 | <p> When the command is started the commandStarted() signal is
|
---|
506 | emitted. When it is finished the commandFinished() signal is
|
---|
507 | emitted.
|
---|
508 | <p> <p>See also <a href="#listInfo">listInfo</a>(), <a href="#commandStarted">commandStarted</a>(), and <a href="#commandFinished">commandFinished</a>().
|
---|
509 |
|
---|
510 | <p>Example: <a href="ftpclient-example.html#x756">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
511 | <h3 class=fn>void <a name="listInfo"></a>QFtp::listInfo ( const <a href="qurlinfo.html">QUrlInfo</a> & i )<tt> [signal]</tt>
|
---|
512 | </h3>
|
---|
513 |
|
---|
514 | <p> This signal is emitted for each directory entry the <a href="#list">list</a>() command
|
---|
515 | finds. The details of the entry are stored in <em>i</em>.
|
---|
516 | <p> <p>See also <a href="#list">list</a>().
|
---|
517 |
|
---|
518 | <p>Example: <a href="ftpclient-example.html#x757">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
519 | <h3 class=fn>int <a name="login"></a>QFtp::login ( const <a href="qstring.html">QString</a> & user = QString::null, const <a href="qstring.html">QString</a> & password = QString::null )
|
---|
520 | </h3>
|
---|
521 | Logs in to the FTP server with the username <em>user</em> and the
|
---|
522 | password <em>password</em>.
|
---|
523 | <p> The <a href="#stateChanged">stateChanged</a>() signal is emitted when the state of the
|
---|
524 | connecting process changes, e.g. to <a href="#State-enum">LoggedIn</a>.
|
---|
525 | <p> The function does not block and returns immediately. The command
|
---|
526 | is scheduled, and its execution is performed asynchronously. The
|
---|
527 | function returns a unique identifier which is passed by
|
---|
528 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
529 | <p> When the command is started the commandStarted() signal is
|
---|
530 | emitted. When it is finished the commandFinished() signal is
|
---|
531 | emitted.
|
---|
532 | <p> <p>See also <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
533 |
|
---|
534 | <p>Example: <a href="ftpclient-example.html#x758">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
535 | <h3 class=fn>int <a name="mkdir"></a>QFtp::mkdir ( const <a href="qstring.html">QString</a> & dir )
|
---|
536 | </h3>
|
---|
537 | Creates a directory called <em>dir</em> on the server.
|
---|
538 | <p> The function does not block and returns immediately. The command
|
---|
539 | is scheduled, and its execution is performed asynchronously. The
|
---|
540 | function returns a unique identifier which is passed by
|
---|
541 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
542 | <p> When the command is started the commandStarted() signal is
|
---|
543 | emitted. When it is finished the commandFinished() signal is
|
---|
544 | emitted.
|
---|
545 | <p> <p>See also <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
546 |
|
---|
547 | <h3 class=fn>int <a name="put"></a>QFtp::put ( <a href="qiodevice.html">QIODevice</a> * dev, const <a href="qstring.html">QString</a> & file )
|
---|
548 | </h3>
|
---|
549 | Reads the data from the IO device <em>dev</em>, and writes it to the
|
---|
550 | file called <em>file</em> on the server. The data is read in chunks from
|
---|
551 | the IO device, so this overload allows you to transmit large
|
---|
552 | amounts of data without the need to read all the data into memory
|
---|
553 | at once.
|
---|
554 | <p> Make sure that the <em>dev</em> pointer is valid for the duration of the
|
---|
555 | operation (it is safe to delete it when the <a href="#commandFinished">commandFinished</a>() is
|
---|
556 | emitted).
|
---|
557 |
|
---|
558 | <p>Example: <a href="ftpclient-example.html#x759">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
559 | <h3 class=fn>int <a name="put-2"></a>QFtp::put ( const <a href="qbytearray.html">QByteArray</a> & data, const <a href="qstring.html">QString</a> & file )
|
---|
560 | </h3>
|
---|
561 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
562 | <p> Writes the data <em>data</em> to the file called <em>file</em> on the server.
|
---|
563 | The progress of the upload is reported by the
|
---|
564 | <a href="#dataTransferProgress">dataTransferProgress</a>() signal.
|
---|
565 | <p> The function does not block and returns immediately. The command
|
---|
566 | is scheduled, and its execution is performed asynchronously. The
|
---|
567 | function returns a unique identifier which is passed by
|
---|
568 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
569 | <p> When the command is started the commandStarted() signal is
|
---|
570 | emitted. When it is finished the commandFinished() signal is
|
---|
571 | emitted.
|
---|
572 | <p> <p>See also <a href="#dataTransferProgress">dataTransferProgress</a>(), <a href="#commandStarted">commandStarted</a>(), and <a href="#commandFinished">commandFinished</a>().
|
---|
573 |
|
---|
574 | <h3 class=fn>int <a name="rawCommand"></a>QFtp::rawCommand ( const <a href="qstring.html">QString</a> & command )
|
---|
575 | </h3>
|
---|
576 | Sends the raw FTP command <em>command</em> to the FTP server. This is
|
---|
577 | useful for low-level FTP access. If the operation you wish to
|
---|
578 | perform has an equivalent QFtp function, we recommend using the
|
---|
579 | function instead of raw FTP commands since the functions are
|
---|
580 | easier and safer.
|
---|
581 | <p> The function does not block and returns immediately. The command
|
---|
582 | is scheduled, and its execution is performed asynchronously. The
|
---|
583 | function returns a unique identifier which is passed by
|
---|
584 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
585 | <p> When the command is started the commandStarted() signal is
|
---|
586 | emitted. When it is finished the commandFinished() signal is
|
---|
587 | emitted.
|
---|
588 | <p> <p>See also <a href="#rawCommandReply">rawCommandReply</a>(), <a href="#commandStarted">commandStarted</a>(), and <a href="#commandFinished">commandFinished</a>().
|
---|
589 |
|
---|
590 | <p>Example: <a href="ftpclient-example.html#x760">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
591 | <h3 class=fn>void <a name="rawCommandReply"></a>QFtp::rawCommandReply ( int replyCode, const <a href="qstring.html">QString</a> & detail )<tt> [signal]</tt>
|
---|
592 | </h3>
|
---|
593 |
|
---|
594 | <p> This signal is emitted in response to the <a href="#rawCommand">rawCommand</a>() function.
|
---|
595 | <em>replyCode</em> is the 3 digit reply code and <em>detail</em> is the text
|
---|
596 | that follows the reply code.
|
---|
597 | <p> <p>See also <a href="#rawCommand">rawCommand</a>().
|
---|
598 |
|
---|
599 | <p>Example: <a href="ftpclient-example.html#x761">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
600 | <h3 class=fn><a href="qbytearray.html">QByteArray</a> <a name="readAll"></a>QFtp::readAll ()
|
---|
601 | </h3>
|
---|
602 | Reads all the bytes available from the data socket and returns
|
---|
603 | them.
|
---|
604 | <p> <p>See also <a href="#get">get</a>(), <a href="#readyRead">readyRead</a>(), <a href="#bytesAvailable">bytesAvailable</a>(), and <a href="#readBlock">readBlock</a>().
|
---|
605 |
|
---|
606 | <h3 class=fn>Q_LONG <a name="readBlock"></a>QFtp::readBlock ( char * data, Q_ULONG maxlen )
|
---|
607 | </h3>
|
---|
608 | Reads <em>maxlen</em> bytes from the data socket into <em>data</em> and
|
---|
609 | returns the number of bytes read. Returns -1 if an error occurred.
|
---|
610 | <p> <p>See also <a href="#get">get</a>(), <a href="#readyRead">readyRead</a>(), <a href="#bytesAvailable">bytesAvailable</a>(), and <a href="#readAll">readAll</a>().
|
---|
611 |
|
---|
612 | <h3 class=fn>void <a name="readyRead"></a>QFtp::readyRead ()<tt> [signal]</tt>
|
---|
613 | </h3>
|
---|
614 |
|
---|
615 | <p> This signal is emitted in response to a <a href="#get">get</a>() command when there
|
---|
616 | is new data to read.
|
---|
617 | <p> If you specify a device as the second argument in the get()
|
---|
618 | command, this signal is <em>not</em> emitted; instead the data is
|
---|
619 | written directly to the device.
|
---|
620 | <p> You can read the data with the <a href="#readAll">readAll</a>() or <a href="#readBlock">readBlock</a>() functions.
|
---|
621 | <p> This signal is useful if you want to process the data in chunks as
|
---|
622 | soon as it becomes available. If you are only interested in the
|
---|
623 | complete data, just connect to the <a href="#commandFinished">commandFinished</a>() signal and
|
---|
624 | read the data then instead.
|
---|
625 | <p> <p>See also <a href="#get">get</a>(), <a href="#readBlock">readBlock</a>(), <a href="#readAll">readAll</a>(), and <a href="#bytesAvailable">bytesAvailable</a>().
|
---|
626 |
|
---|
627 | <h3 class=fn>int <a name="remove"></a>QFtp::remove ( const <a href="qstring.html">QString</a> & file )
|
---|
628 | </h3>
|
---|
629 | Deletes the file called <em>file</em> from the server.
|
---|
630 | <p> The function does not block and returns immediately. The command
|
---|
631 | is scheduled, and its execution is performed asynchronously. The
|
---|
632 | function returns a unique identifier which is passed by
|
---|
633 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
634 | <p> When the command is started the commandStarted() signal is
|
---|
635 | emitted. When it is finished the commandFinished() signal is
|
---|
636 | emitted.
|
---|
637 | <p> <p>See also <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
638 |
|
---|
639 | <p>Example: <a href="ftpclient-example.html#x762">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
640 | <h3 class=fn>int <a name="rename"></a>QFtp::rename ( const <a href="qstring.html">QString</a> & oldname, const <a href="qstring.html">QString</a> & newname )
|
---|
641 | </h3>
|
---|
642 | Renames the file called <em>oldname</em> to <em>newname</em> on the server.
|
---|
643 | <p> The function does not block and returns immediately. The command
|
---|
644 | is scheduled, and its execution is performed asynchronously. The
|
---|
645 | function returns a unique identifier which is passed by
|
---|
646 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
647 | <p> When the command is started the commandStarted() signal is
|
---|
648 | emitted. When it is finished the commandFinished() signal is
|
---|
649 | emitted.
|
---|
650 | <p> <p>See also <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
651 |
|
---|
652 | <h3 class=fn>int <a name="rmdir"></a>QFtp::rmdir ( const <a href="qstring.html">QString</a> & dir )
|
---|
653 | </h3>
|
---|
654 | Removes the directory called <em>dir</em> from the server.
|
---|
655 | <p> The function does not block and returns immediately. The command
|
---|
656 | is scheduled, and its execution is performed asynchronously. The
|
---|
657 | function returns a unique identifier which is passed by
|
---|
658 | <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
659 | <p> When the command is started the commandStarted() signal is
|
---|
660 | emitted. When it is finished the commandFinished() signal is
|
---|
661 | emitted.
|
---|
662 | <p> <p>See also <a href="#commandStarted">commandStarted</a>() and <a href="#commandFinished">commandFinished</a>().
|
---|
663 |
|
---|
664 | <h3 class=fn><a href="qftp.html#State-enum">State</a> <a name="state"></a>QFtp::state () const
|
---|
665 | </h3>
|
---|
666 | Returns the current state of the object. When the state changes,
|
---|
667 | the <a href="#stateChanged">stateChanged</a>() signal is emitted.
|
---|
668 | <p> <p>See also <a href="#State-enum">State</a> and <a href="#stateChanged">stateChanged</a>().
|
---|
669 |
|
---|
670 | <p>Example: <a href="ftpclient-example.html#x763">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
671 | <h3 class=fn>void <a name="stateChanged"></a>QFtp::stateChanged ( int state )<tt> [signal]</tt>
|
---|
672 | </h3>
|
---|
673 |
|
---|
674 | <p> This signal is emitted when the state of the connection changes.
|
---|
675 | The argument <em>state</em> is the new state of the connection; it is
|
---|
676 | one of the <a href="#State-enum">State</a> values.
|
---|
677 | <p> It is usually emitted in response to a <a href="#connectToHost">connectToHost</a>() or <a href="#close">close</a>()
|
---|
678 | command, but it can also be emitted "spontaneously", e.g. when the
|
---|
679 | server closes the connection unexpectedly.
|
---|
680 | <p> <p>See also <a href="#connectToHost">connectToHost</a>(), <a href="#close">close</a>(), <a href="#state">state</a>(), and <a href="#State-enum">State</a>.
|
---|
681 |
|
---|
682 | <p>Example: <a href="ftpclient-example.html#x764">network/ftpclient/ftpmainwindow.ui.h</a>.
|
---|
683 | <!-- eof -->
|
---|
684 | <hr><p>
|
---|
685 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
686 | Copyright © 1995-2007
|
---|
687 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
688 | <table width=100% cellspacing=0 border=0><tr>
|
---|
689 | <td>Copyright © 2007
|
---|
690 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
691 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
692 | </table></div></address></body>
|
---|
693 | </html>
|
---|