~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qftp.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/network/qftp.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QFtp Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QFtp Class Reference</h1>
 
21
<p>The QFtp class provides an implementation of the FTP protocol. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QFtp&gt;</pre><p>Part of the <a href="qtnetwork.html">QtNetwork</a> module.</p>
 
23
<p>Inherits <a href="qobject.html">QObject</a>.</p>
 
24
<ul>
 
25
<li><a href="qftp-members.html">List of all members, including inherited members</a></li>
 
26
<li><a href="qftp-qt3.html">Qt 3 support members</a></li>
 
27
</ul>
 
28
<a name="public-types"></a>
 
29
<h3>Public Types</h3>
 
30
<ul>
 
31
<li><div class="fn"/>enum <b><a href="qftp.html#Command-enum">Command</a></b> { None, SetTransferMode, SetProxy, ConnectToHost, ..., RawCommand }</li>
 
32
<li><div class="fn"/>enum <b><a href="qftp.html#Error-enum">Error</a></b> { NoError, HostNotFound, ConnectionRefused, NotConnected, UnknownError }</li>
 
33
<li><div class="fn"/>enum <b><a href="qftp.html#State-enum">State</a></b> { Unconnected, HostLookup, Connecting, Connected, LoggedIn, Closing }</li>
 
34
<li><div class="fn"/>enum <b><a href="qftp.html#TransferMode-enum">TransferMode</a></b> { Passive, Active }</li>
 
35
<li><div class="fn"/>enum <b><a href="qftp.html#TransferType-enum">TransferType</a></b> { Binary, Ascii }</li>
 
36
</ul>
 
37
<a name="public-functions"></a>
 
38
<h3>Public Functions</h3>
 
39
<ul>
 
40
<li><div class="fn"/><b><a href="qftp.html#QFtp">QFtp</a></b> ( QObject * <i>parent</i> = 0 )</li>
 
41
<li><div class="fn"/>virtual <b><a href="qftp.html#dtor.QFtp">~QFtp</a></b> ()</li>
 
42
<li><div class="fn"/>qint64 <b><a href="qftp.html#bytesAvailable">bytesAvailable</a></b> () const</li>
 
43
<li><div class="fn"/>int <b><a href="qftp.html#cd">cd</a></b> ( const QString &amp; <i>dir</i> )</li>
 
44
<li><div class="fn"/>void <b><a href="qftp.html#clearPendingCommands">clearPendingCommands</a></b> ()</li>
 
45
<li><div class="fn"/>int <b><a href="qftp.html#close">close</a></b> ()</li>
 
46
<li><div class="fn"/>int <b><a href="qftp.html#connectToHost">connectToHost</a></b> ( const QString &amp; <i>host</i>, quint16 <i>port</i> = 21 )</li>
 
47
<li><div class="fn"/>Command <b><a href="qftp.html#currentCommand">currentCommand</a></b> () const</li>
 
48
<li><div class="fn"/>QIODevice * <b><a href="qftp.html#currentDevice">currentDevice</a></b> () const</li>
 
49
<li><div class="fn"/>int <b><a href="qftp.html#currentId">currentId</a></b> () const</li>
 
50
<li><div class="fn"/>Error <b><a href="qftp.html#error">error</a></b> () const</li>
 
51
<li><div class="fn"/>QString <b><a href="qftp.html#errorString">errorString</a></b> () const</li>
 
52
<li><div class="fn"/>int <b><a href="qftp.html#get">get</a></b> ( const QString &amp; <i>file</i>, QIODevice * <i>dev</i> = 0, TransferType <i>type</i> = Binary )</li>
 
53
<li><div class="fn"/>bool <b><a href="qftp.html#hasPendingCommands">hasPendingCommands</a></b> () const</li>
 
54
<li><div class="fn"/>int <b><a href="qftp.html#list">list</a></b> ( const QString &amp; <i>dir</i> = QString() )</li>
 
55
<li><div class="fn"/>int <b><a href="qftp.html#login">login</a></b> ( const QString &amp; <i>user</i> = QString(), const QString &amp; <i>password</i> = QString() )</li>
 
56
<li><div class="fn"/>int <b><a href="qftp.html#mkdir">mkdir</a></b> ( const QString &amp; <i>dir</i> )</li>
 
57
<li><div class="fn"/>int <b><a href="qftp.html#put">put</a></b> ( QIODevice * <i>dev</i>, const QString &amp; <i>file</i>, TransferType <i>type</i> = Binary )</li>
 
58
<li><div class="fn"/>int <b><a href="qftp.html#put-2">put</a></b> ( const QByteArray &amp; <i>data</i>, const QString &amp; <i>file</i>, TransferType <i>type</i> = Binary )</li>
 
59
<li><div class="fn"/>int <b><a href="qftp.html#rawCommand">rawCommand</a></b> ( const QString &amp; <i>command</i> )</li>
 
60
<li><div class="fn"/>qint64 <b><a href="qftp.html#read">read</a></b> ( char * <i>data</i>, qint64 <i>maxlen</i> )</li>
 
61
<li><div class="fn"/>QByteArray <b><a href="qftp.html#readAll">readAll</a></b> ()</li>
 
62
<li><div class="fn"/>int <b><a href="qftp.html#remove">remove</a></b> ( const QString &amp; <i>file</i> )</li>
 
63
<li><div class="fn"/>int <b><a href="qftp.html#rename">rename</a></b> ( const QString &amp; <i>oldname</i>, const QString &amp; <i>newname</i> )</li>
 
64
<li><div class="fn"/>int <b><a href="qftp.html#rmdir">rmdir</a></b> ( const QString &amp; <i>dir</i> )</li>
 
65
<li><div class="fn"/>int <b><a href="qftp.html#setProxy">setProxy</a></b> ( const QString &amp; <i>host</i>, quint16 <i>port</i> )</li>
 
66
<li><div class="fn"/>int <b><a href="qftp.html#setTransferMode">setTransferMode</a></b> ( TransferMode <i>mode</i> )</li>
 
67
<li><div class="fn"/>State <b><a href="qftp.html#state">state</a></b> () const</li>
 
68
</ul>
 
69
<ul>
 
70
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
71
</ul>
 
72
<a name="public-slots"></a>
 
73
<h3>Public Slots</h3>
 
74
<ul>
 
75
<li><div class="fn"/>void <b><a href="qftp.html#abort">abort</a></b> ()</li>
 
76
</ul>
 
77
<ul>
 
78
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
 
79
</ul>
 
80
<a name="signals"></a>
 
81
<h3>Signals</h3>
 
82
<ul>
 
83
<li><div class="fn"/>void <b><a href="qftp.html#commandFinished">commandFinished</a></b> ( int <i>id</i>, bool <i>error</i> )</li>
 
84
<li><div class="fn"/>void <b><a href="qftp.html#commandStarted">commandStarted</a></b> ( int <i>id</i> )</li>
 
85
<li><div class="fn"/>void <b><a href="qftp.html#dataTransferProgress">dataTransferProgress</a></b> ( qint64 <i>done</i>, qint64 <i>total</i> )</li>
 
86
<li><div class="fn"/>void <b><a href="qftp.html#done">done</a></b> ( bool <i>error</i> )</li>
 
87
<li><div class="fn"/>void <b><a href="qftp.html#listInfo">listInfo</a></b> ( const QUrlInfo &amp; <i>i</i> )</li>
 
88
<li><div class="fn"/>void <b><a href="qftp.html#rawCommandReply">rawCommandReply</a></b> ( int <i>replyCode</i>, const QString &amp; <i>detail</i> )</li>
 
89
<li><div class="fn"/>void <b><a href="qftp.html#readyRead">readyRead</a></b> ()</li>
 
90
<li><div class="fn"/>void <b><a href="qftp.html#stateChanged">stateChanged</a></b> ( int <i>state</i> )</li>
 
91
</ul>
 
92
<ul>
 
93
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
 
94
</ul>
 
95
<h3>Additional Inherited Members</h3>
 
96
<ul>
 
97
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
98
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
99
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
100
</ul>
 
101
<a name="details"></a>
 
102
<hr />
 
103
<h2>Detailed Description</h2>
 
104
<p>The QFtp class provides an implementation of the FTP protocol.</p>
 
105
<p>This class provides a client for the FTP protocol.</p>
 
106
<p>The class works asynchronously, so there are no blocking functions. If an operation cannot be executed immediately, the function will still return straight away and the operation will be scheduled for later execution. The results of scheduled operations are reported via signals. This approach depends on the event loop being in operation.</p>
 
107
<p>The operations that can be scheduled (they are called &quot;commands&quot; in the rest of the documentation) are the following: <a href="qftp.html#connectToHost">connectToHost</a>(), <a href="qftp.html#login">login</a>(), <a href="qftp.html#close">close</a>(), <a href="qftp.html#list">list</a>(), <a href="qftp.html#cd">cd</a>(), <a href="qftp.html#get">get</a>(), <a href="qftp.html#put">put</a>(), <a href="qftp.html#remove">remove</a>(), <a href="qftp.html#mkdir">mkdir</a>(), <a href="qftp.html#rmdir">rmdir</a>(), <a href="qftp.html#rename">rename</a>() and <a href="qftp.html#rawCommand">rawCommand</a>().</p>
 
108
<p>All of these commands return a unique identifier that allows you to keep track of the command that is currently being executed. When the execution of a command starts, the <a href="qftp.html#commandStarted">commandStarted</a>() signal with the command's identifier is emitted. When the command is finished, the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted with the command's identifier and a bool that indicates whether the command finished with an error.</p>
 
109
<p>In some cases, you might want to execute a sequence of commands, e.g. if you want to connect and login to a FTP server. This is simply achieved:</p>
 
110
<pre>&nbsp;   QFtp *ftp = new QFtp(this); // this is an optional QObject parent
 
111
    ftp-&gt;connectToHost(&quot;ftp.trolltech.com&quot;);
 
112
    ftp-&gt;login();</pre>
 
113
<p>In this case two FTP commands have been scheduled. When the last scheduled command has finished, a <a href="qftp.html#done">done</a>() signal is emitted with a bool argument that tells you whether the sequence finished with an error.</p>
 
114
<p>If an error occurs during the execution of one of the commands in a sequence of commands, all the pending commands (i.e. scheduled, but not yet executed commands) are cleared and no signals are emitted for them.</p>
 
115
<p>Some commands, e.g. <a href="qftp.html#list">list</a>(), emit additional signals to report their results.</p>
 
116
<p>Example: If you want to download the INSTALL file from Trolltech's FTP server, you would write this:</p>
 
117
<pre>&nbsp;   ftp-&gt;connectToHost(&quot;ftp.trolltech.com&quot;);  // id == 1
 
118
    ftp-&gt;login();                             // id == 2
 
119
    ftp-&gt;cd(&quot;qt&quot;);                            // id == 3
 
120
    ftp-&gt;get(&quot;INSTALL&quot;);                      // id == 4
 
121
    ftp-&gt;close();                             // id == 5</pre>
 
122
<p>For this example the following sequence of signals is emitted (with small variations, depending on network traffic, etc.):</p>
 
123
<pre>&nbsp;   start(1)
 
124
    stateChanged(HostLookup)
 
125
    stateChanged(Connecting)
 
126
    stateChanged(Connected)
 
127
    finished(1, false)
 
128
 
 
129
    start(2)
 
130
    stateChanged(LoggedIn)
 
131
    finished(2, false)
 
132
 
 
133
    start(3)
 
134
    finished(3, false)
 
135
 
 
136
    start(4)
 
137
    dataTransferProgress(0, 3798)
 
138
    dataTransferProgress(2896, 3798)
 
139
    readyRead()
 
140
    dataTransferProgress(3798, 3798)
 
141
    readyRead()
 
142
    finished(4, false)
 
143
 
 
144
    start(5)
 
145
    stateChanged(Closing)
 
146
    stateChanged(Unconnected)
 
147
    finished(5, false)
 
148
 
 
149
    done(false)</pre>
 
150
<p>The <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>() signal in the above example is useful if you want to show a <a href="qprogressbar.html">progressbar</a> to inform the user about the progress of the download. The <a href="qftp.html#readyRead">readyRead</a>() signal tells you that there is data ready to be read. The amount of data can be queried then with the <a href="qftp.html#bytesAvailable">bytesAvailable</a>() function and it can be read with the <a href="qftp.html#read">read</a>() or <a href="qftp.html#readAll">readAll</a>() function.</p>
 
151
<p>If the login fails for the above example, the signals would look like this:</p>
 
152
<pre>&nbsp;   start(1)
 
153
    stateChanged(HostLookup)
 
154
    stateChanged(Connecting)
 
155
    stateChanged(Connected)
 
156
    finished(1, false)
 
157
 
 
158
    start(2)
 
159
    finished(2, true)
 
160
 
 
161
    done(true)</pre>
 
162
<p>You can then get details about the error with the <a href="qftp.html#error">error</a>() and <a href="qftp.html#errorString">errorString</a>() functions.</p>
 
163
<p>For file transfer, QFtp can use both active or passive mode, and it uses passive file transfer mode by default; see the documentation for <a href="qftp.html#setTransferMode">setTransferMode</a>() for more details about this.</p>
 
164
<p>Call <a href="qftp.html#setProxy">setProxy</a>() to make QFtp connect via an FTP proxy server.</p>
 
165
<p>The functions <a href="qftp.html#currentId">currentId</a>() and <a href="qftp.html#currentCommand">currentCommand</a>() provide more information about the currently executing command.</p>
 
166
<p>The functions <a href="qftp.html#hasPendingCommands">hasPendingCommands</a>() and <a href="qftp.html#clearPendingCommands">clearPendingCommands</a>() allow you to query and clear the list of pending commands.</p>
 
167
<p>If you are an experienced network programmer and want to have complete control you can use <a href="qftp.html#rawCommand">rawCommand</a>() to execute arbitrary FTP commands.</p>
 
168
<p>The <a href="network-ftp.html">FTP</a> example illustrates how to write FTP clients using QFtp.</p>
 
169
<p>See also <a href="networking.html">Network Module</a> and <a href="qhttp.html">QHttp</a>.</p>
 
170
<hr />
 
171
<h2>Member Type Documentation</h2>
 
172
<h3 class="fn"><a name="Command-enum"></a>enum QFtp::Command</h3>
 
173
<p>This enum is used as the return value for the <a href="qftp.html#currentCommand">currentCommand</a>() function. This allows you to perform specific actions for particular commands, e.g. in a FTP client, you might want to clear the directory view when a <a href="qftp.html#list">list</a>() command is started; in this case you can simply check in the slot connected to the start() signal if the <a href="qftp.html#currentCommand">currentCommand</a>() is <tt>List</tt>.</p>
 
174
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
175
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
176
<tr><td valign="top"><tt>QFtp::None</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">No command is being executed.</td></tr>
 
177
<tr><td valign="top"><tt>QFtp::SetTransferMode</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">set the <a href="qftp.html#TransferMode-enum">transfer</a> mode.</td></tr>
 
178
<tr><td valign="top"><tt>QFtp::SetProxy</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">switch proxying on or off.</td></tr>
 
179
<tr><td valign="top"><tt>QFtp::ConnectToHost</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top"><a href="qftp.html#connectToHost">connectToHost</a>() is being executed.</td></tr>
 
180
<tr><td valign="top"><tt>QFtp::Login</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top"><a href="qftp.html#login">login</a>() is being executed.</td></tr>
 
181
<tr><td valign="top"><tt>QFtp::Close</tt></td><td align="center" valign="top"><tt>5</tt></td><td valign="top"><a href="qftp.html#close">close</a>() is being executed.</td></tr>
 
182
<tr><td valign="top"><tt>QFtp::List</tt></td><td align="center" valign="top"><tt>6</tt></td><td valign="top"><a href="qftp.html#list">list</a>() is being executed.</td></tr>
 
183
<tr><td valign="top"><tt>QFtp::Cd</tt></td><td align="center" valign="top"><tt>7</tt></td><td valign="top"><a href="qftp.html#cd">cd</a>() is being executed.</td></tr>
 
184
<tr><td valign="top"><tt>QFtp::Get</tt></td><td align="center" valign="top"><tt>8</tt></td><td valign="top"><a href="qftp.html#get">get</a>() is being executed.</td></tr>
 
185
<tr><td valign="top"><tt>QFtp::Put</tt></td><td align="center" valign="top"><tt>9</tt></td><td valign="top"><a href="qftp.html#put">put</a>() is being executed.</td></tr>
 
186
<tr><td valign="top"><tt>QFtp::Remove</tt></td><td align="center" valign="top"><tt>10</tt></td><td valign="top"><a href="qftp.html#remove">remove</a>() is being executed.</td></tr>
 
187
<tr><td valign="top"><tt>QFtp::Mkdir</tt></td><td align="center" valign="top"><tt>11</tt></td><td valign="top"><a href="qftp.html#mkdir">mkdir</a>() is being executed.</td></tr>
 
188
<tr><td valign="top"><tt>QFtp::Rmdir</tt></td><td align="center" valign="top"><tt>12</tt></td><td valign="top"><a href="qftp.html#rmdir">rmdir</a>() is being executed.</td></tr>
 
189
<tr><td valign="top"><tt>QFtp::Rename</tt></td><td align="center" valign="top"><tt>13</tt></td><td valign="top"><a href="qftp.html#rename">rename</a>() is being executed.</td></tr>
 
190
<tr><td valign="top"><tt>QFtp::RawCommand</tt></td><td align="center" valign="top"><tt>14</tt></td><td valign="top"><a href="qftp.html#rawCommand">rawCommand</a>() is being executed.</td></tr>
 
191
</table>
 
192
<p>See also <a href="qftp.html#currentCommand">currentCommand</a>().</p>
 
193
<h3 class="fn"><a name="Error-enum"></a>enum QFtp::Error</h3>
 
194
<p>This enum identifies the error that occurred.</p>
 
195
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
196
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
197
<tr><td valign="top"><tt>QFtp::NoError</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">No error occurred.</td></tr>
 
198
<tr><td valign="top"><tt>QFtp::HostNotFound</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The host name lookup failed.</td></tr>
 
199
<tr><td valign="top"><tt>QFtp::ConnectionRefused</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The server refused the connection.</td></tr>
 
200
<tr><td valign="top"><tt>QFtp::NotConnected</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">Tried to send a command, but there is no connection to a server.</td></tr>
 
201
<tr><td valign="top"><tt>QFtp::UnknownError</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">An error other than those specified above occurred.</td></tr>
 
202
</table>
 
203
<p>See also <a href="qftp.html#error">error</a>().</p>
 
204
<h3 class="fn"><a name="State-enum"></a>enum QFtp::State</h3>
 
205
<p>This enum defines the connection state:</p>
 
206
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
207
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
208
<tr><td valign="top"><tt>QFtp::Unconnected</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">There is no connection to the host.</td></tr>
 
209
<tr><td valign="top"><tt>QFtp::HostLookup</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">A host name lookup is in progress.</td></tr>
 
210
<tr><td valign="top"><tt>QFtp::Connecting</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">An attempt to connect to the host is in progress.</td></tr>
 
211
<tr><td valign="top"><tt>QFtp::Connected</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Connection to the host has been achieved.</td></tr>
 
212
<tr><td valign="top"><tt>QFtp::LoggedIn</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">Connection and user login have been achieved.</td></tr>
 
213
<tr><td valign="top"><tt>QFtp::Closing</tt></td><td align="center" valign="top"><tt>5</tt></td><td valign="top">The connection is closing down, but it is not yet closed. (The state will be <tt>Unconnected</tt> when the connection is closed.)</td></tr>
 
214
</table>
 
215
<p>See also <a href="qftp.html#stateChanged">stateChanged</a>() and <a href="qftp.html#state">state</a>().</p>
 
216
<h3 class="fn"><a name="TransferMode-enum"></a>enum QFtp::TransferMode</h3>
 
217
<p>FTP works with two socket connections; one for commands and another for transmitting data. While the command connection is always initiated by the client, the second connection can be initiated by either the client or the server.</p>
 
218
<p>This enum defines whether the client (Passive mode) or the server (Active mode) should set up the data connection.</p>
 
219
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
220
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
221
<tr><td valign="top"><tt>QFtp::Passive</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The client connects to the server to transmit its data.</td></tr>
 
222
<tr><td valign="top"><tt>QFtp::Active</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The server connects to the client to transmit its data.</td></tr>
 
223
</table>
 
224
<h3 class="fn"><a name="TransferType-enum"></a>enum QFtp::TransferType</h3>
 
225
<p>This enum identifies the data transfer type used with get and put commands.</p>
 
226
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
227
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
228
<tr><td valign="top"><tt>QFtp::Binary</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The data will be transferred in Binary mode.</td></tr>
 
229
<tr><td valign="top"><tt>QFtp::Ascii</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The data will be transferred in Ascii mode and new line characters will be converted to the local format.</td></tr>
 
230
</table>
 
231
<hr />
 
232
<h2>Member Function Documentation</h2>
 
233
<h3 class="fn"><a name="QFtp"></a>QFtp::QFtp ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
 
234
<p>Constructs a <a href="qftp.html">QFtp</a> object with the given <i>parent</i>.</p>
 
235
<h3 class="fn"><a name="dtor.QFtp"></a>QFtp::~QFtp ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
236
<p>Destructor.</p>
 
237
<h3 class="fn"><a name="abort"></a>void QFtp::abort ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
238
<p>Aborts the current command and deletes all scheduled commands.</p>
 
239
<p>If there is an unfinished command (i.e. a command for which the <a href="qftp.html#commandStarted">commandStarted</a>() signal has been emitted, but for which the <a href="qftp.html#commandFinished">commandFinished</a>() signal has not been emitted), this function sends an <tt>ABORT</tt> command to the server. When the server replies that the command is aborted, the <a href="qftp.html#commandFinished">commandFinished</a>() signal with the <tt>error</tt> argument set to <tt>true</tt> is emitted for the command. Due to timing issues, it is possible that the command had already finished before the abort request reached the server, in which case, the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted with the <tt>error</tt> argument set to <tt>false</tt>.</p>
 
240
<p>For all other commands that are affected by the abort(), no signals are emitted.</p>
 
241
<p>If you don't start further FTP commands directly after the abort(), there won't be any scheduled commands and the <a href="qftp.html#done">done</a>() signal is emitted.</p>
 
242
<p><b>Warning:</b> Some FTP servers, for example the BSD FTP daemon (version 0.3), wrongly return a positive reply even when an abort has occurred. For these servers the <a href="qftp.html#commandFinished">commandFinished</a>() signal has its error flag set to <tt>false</tt>, even though the command did not complete successfully.</p>
 
243
<p>See also <a href="qftp.html#clearPendingCommands">clearPendingCommands</a>().</p>
 
244
<h3 class="fn"><a name="bytesAvailable"></a><a href="qtglobal.html#qint64-typedef">qint64</a> QFtp::bytesAvailable () const</h3>
 
245
<p>Returns the number of bytes that can be read from the data socket at the moment.</p>
 
246
<p>See also <a href="qftp.html#get">get</a>(), <a href="qftp.html#readyRead">readyRead</a>(), <a href="qftp.html#read">read</a>(), and <a href="qftp.html#readAll">readAll</a>().</p>
 
247
<h3 class="fn"><a name="cd"></a>int QFtp::cd ( const <a href="qstring.html">QString</a> &amp; <i>dir</i> )</h3>
 
248
<p>Changes the working directory of the server to <i>dir</i>.</p>
 
249
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
250
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
251
<p>See also <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
252
<h3 class="fn"><a name="clearPendingCommands"></a>void QFtp::clearPendingCommands ()</h3>
 
253
<p>Deletes all pending commands from the list of scheduled commands. This does not affect the command that is being executed. If you want to stop this this as well, use <a href="qftp.html#abort">abort</a>().</p>
 
254
<p>See also <a href="qftp.html#hasPendingCommands">hasPendingCommands</a>() and <a href="qftp.html#abort">abort</a>().</p>
 
255
<h3 class="fn"><a name="close"></a>int QFtp::close ()</h3>
 
256
<p>Closes the connection to the FTP server.</p>
 
257
<p>The <a href="qftp.html#stateChanged">stateChanged</a>() signal is emitted when the state of the connecting process changes, e.g. to <tt>Closing</tt>, then <tt>Unconnected</tt>.</p>
 
258
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
259
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
260
<p>See also <a href="qftp.html#stateChanged">stateChanged</a>(), <a href="qftp.html#commandStarted">commandStarted</a>(), and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
261
<h3 class="fn"><a name="commandFinished"></a>void QFtp::commandFinished ( int <i>id</i>, bool <i>error</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
262
<p>This signal is emitted when processing the command identified by <i>id</i> has finished. <i>error</i> is true if an error occurred during the processing; otherwise <i>error</i> is false.</p>
 
263
<p>See also <a href="qftp.html#commandStarted">commandStarted</a>(), <a href="qftp.html#done">done</a>(), <a href="qftp.html#error">error</a>(), and <a href="qftp.html#errorString">errorString</a>().</p>
 
264
<h3 class="fn"><a name="commandStarted"></a>void QFtp::commandStarted ( int <i>id</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
265
<p>This signal is emitted when processing the command identified by <i>id</i> starts.</p>
 
266
<p>See also <a href="qftp.html#commandFinished">commandFinished</a>() and <a href="qftp.html#done">done</a>().</p>
 
267
<h3 class="fn"><a name="connectToHost"></a>int QFtp::connectToHost ( const <a href="qstring.html">QString</a> &amp; <i>host</i>, <a href="qtglobal.html#quint16-typedef">quint16</a> <i>port</i> = 21 )</h3>
 
268
<p>Connects to the FTP server <i>host</i> using port <i>port</i>.</p>
 
269
<p>The <a href="qftp.html#stateChanged">stateChanged</a>() signal is emitted when the state of the connecting process changes, e.g. to <tt>HostLookup</tt>, then <tt>Connecting</tt>, then <tt>Connected</tt>.</p>
 
270
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
271
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
272
<p>See also <a href="qftp.html#stateChanged">stateChanged</a>(), <a href="qftp.html#commandStarted">commandStarted</a>(), and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
273
<h3 class="fn"><a name="currentCommand"></a><a href="qftp.html#Command-enum">Command</a> QFtp::currentCommand () const</h3>
 
274
<p>Returns the command type of the FTP command being executed or <tt>None</tt> if there is no command being executed.</p>
 
275
<p>See also <a href="qftp.html#currentId">currentId</a>().</p>
 
276
<h3 class="fn"><a name="currentDevice"></a><a href="qiodevice.html">QIODevice</a> * QFtp::currentDevice () const</h3>
 
277
<p>Returns the <a href="qiodevice.html">QIODevice</a> pointer that is used by the FTP command to read data from or store data to. If there is no current FTP command being executed or if the command does not use an IO device, this function returns 0.</p>
 
278
<p>This function can be used to delete the <a href="qiodevice.html">QIODevice</a> in the slot connected to the <a href="qftp.html#commandFinished">commandFinished</a>() signal.</p>
 
279
<p>See also <a href="qftp.html#get">get</a>() and <a href="qftp.html#put">put</a>().</p>
 
280
<h3 class="fn"><a name="currentId"></a>int QFtp::currentId () const</h3>
 
281
<p>Returns the identifier of the FTP command that is being executed or 0 if there is no command being executed.</p>
 
282
<p>See also <a href="qftp.html#currentCommand">currentCommand</a>().</p>
 
283
<h3 class="fn"><a name="dataTransferProgress"></a>void QFtp::dataTransferProgress ( <a href="qtglobal.html#qint64-typedef">qint64</a> <i>done</i>, <a href="qtglobal.html#qint64-typedef">qint64</a> <i>total</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
284
<p>This signal is emitted in response to a <a href="qftp.html#get">get</a>() or <a href="qftp.html#put">put</a>() request to indicate the current progress of the download or upload.</p>
 
285
<p><i>done</i> is the amount of data that has already been transferred and <i>total</i> is the total amount of data to be read or written. It is possible that the <a href="qftp.html">QFtp</a> class is not able to determine the total amount of data that should be transferred, in which case <i>total</i> is 0. (If you connect this signal to a <a href="qprogressbar.html">QProgressBar</a>, the progress bar shows a busy indicator if the total is 0).</p>
 
286
<p><b>Warning:</b> <i>done</i> and <i>total</i> are not necessarily the size in bytes, since for large files these values might need to be &quot;scaled&quot; to avoid overflow.</p>
 
287
<p>See also <a href="qftp.html#get">get</a>(), <a href="qftp.html#put">put</a>(), and <a href="qprogressbar.html">QProgressBar</a>.</p>
 
288
<h3 class="fn"><a name="done"></a>void QFtp::done ( bool <i>error</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
289
<p>This signal is emitted when the last pending command has finished; (it is emitted after the last command's <a href="qftp.html#commandFinished">commandFinished</a>() signal). <i>error</i> is true if an error occurred during the processing; otherwise <i>error</i> is false.</p>
 
290
<p>See also <a href="qftp.html#commandFinished">commandFinished</a>(), <a href="qftp.html#error">error</a>(), and <a href="qftp.html#errorString">errorString</a>().</p>
 
291
<h3 class="fn"><a name="error"></a><a href="qftp.html#Error-enum">Error</a> QFtp::error () const</h3>
 
292
<p>Returns the last error that occurred. This is useful to find out what when wrong when receiving a <a href="qftp.html#commandFinished">commandFinished</a>() or a <a href="qftp.html#done">done</a>() signal with the <tt>error</tt> argument set to <tt>true</tt>.</p>
 
293
<p>If you start a new command, the error status is reset to <tt>NoError</tt>.</p>
 
294
<h3 class="fn"><a name="errorString"></a><a href="qstring.html">QString</a> QFtp::errorString () const</h3>
 
295
<p>Returns a human-readable description of the last error that occurred. This is useful for presenting a error message to the user when receiving a <a href="qftp.html#commandFinished">commandFinished</a>() or a <a href="qftp.html#done">done</a>() signal with the <tt>error</tt> argument set to <tt>true</tt>.</p>
 
296
<p>The error string is often (but not always) the reply from the server, so it is not always possible to translate the string. If the message comes from Qt, the string has already passed through <a href="qobject.html#tr">tr</a>().</p>
 
297
<h3 class="fn"><a name="get"></a>int QFtp::get ( const <a href="qstring.html">QString</a> &amp; <i>file</i>, <a href="qiodevice.html">QIODevice</a> * <i>dev</i> = 0, <a href="qftp.html#TransferType-enum">TransferType</a> <i>type</i> = Binary )</h3>
 
298
<p>Downloads the file <i>file</i> from the server.</p>
 
299
<p>If <i>dev</i> is 0, then the <a href="qftp.html#readyRead">readyRead</a>() signal is emitted when there is data available to read. You can then read the data with the <a href="qftp.html#read">read</a>() or <a href="qftp.html#readAll">readAll</a>() functions.</p>
 
300
<p>If <i>dev</i> is not 0, the data is written directly to the device <i>dev</i>. Make sure that the <i>dev</i> pointer is valid for the duration of the operation (it is safe to delete it when the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted). In this case the <a href="qftp.html#readyRead">readyRead</a>() signal is <i>not</i> emitted and you cannot read data with the readBlcok or <a href="qftp.html#readAll">readAll</a>() functions.</p>
 
301
<p>If you don't read the data immediately it becomes available, i.e. when the <a href="qftp.html#readyRead">readyRead</a>() signal is emitted, it is still available until the next command is started.</p>
 
302
<p>For example, if you want to present the data to the user as soon as there is something available, connect to the <a href="qftp.html#readyRead">readyRead</a>() signal and read the data immediately. On the other hand, if you only want to work with the complete data, you can connect to the <a href="qftp.html#commandFinished">commandFinished</a>() signal and read the data when the get() command is finished.</p>
 
303
<p>The data is transferred as Binary or Ascii depending on the value of <i>type</i>.</p>
 
304
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
305
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
306
<p><a href="qftp.html#commandFinished">commandFinished</a>()</p>
 
307
<p>See also <a href="qftp.html#readyRead">readyRead</a>(), <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>(), and <a href="qftp.html#commandStarted">commandStarted</a>().</p>
 
308
<h3 class="fn"><a name="hasPendingCommands"></a>bool QFtp::hasPendingCommands () const</h3>
 
309
<p>Returns true if there are any commands scheduled that have not yet been executed; otherwise returns false.</p>
 
310
<p>The command that is being executed is <i>not</i> considered as a scheduled command.</p>
 
311
<p>See also <a href="qftp.html#clearPendingCommands">clearPendingCommands</a>(), <a href="qftp.html#currentId">currentId</a>(), and <a href="qftp.html#currentCommand">currentCommand</a>().</p>
 
312
<h3 class="fn"><a name="list"></a>int QFtp::list ( const <a href="qstring.html">QString</a> &amp; <i>dir</i> = QString() )</h3>
 
313
<p>Lists the contents of directory <i>dir</i> on the FTP server. If <i>dir</i> is empty, it lists the contents of the current directory.</p>
 
314
<p>The <a href="qftp.html#listInfo">listInfo</a>() signal is emitted for each directory entry found.</p>
 
315
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
316
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
317
<p>See also <a href="qftp.html#listInfo">listInfo</a>(), <a href="qftp.html#commandStarted">commandStarted</a>(), and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
318
<h3 class="fn"><a name="listInfo"></a>void QFtp::listInfo ( const <a href="qurlinfo.html">QUrlInfo</a> &amp; <i>i</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
319
<p>This signal is emitted for each directory entry the <a href="qftp.html#list">list</a>() command finds. The details of the entry are stored in <i>i</i>.</p>
 
320
<p>See also <a href="qftp.html#list">list</a>().</p>
 
321
<h3 class="fn"><a name="login"></a>int QFtp::login ( const <a href="qstring.html">QString</a> &amp; <i>user</i> = QString(), const <a href="qstring.html">QString</a> &amp; <i>password</i> = QString() )</h3>
 
322
<p>Logs in to the FTP server with the username <i>user</i> and the password <i>password</i>.</p>
 
323
<p>The <a href="qftp.html#stateChanged">stateChanged</a>() signal is emitted when the state of the connecting process changes, e.g. to <tt>LoggedIn</tt>.</p>
 
324
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
325
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
326
<p>See also <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
327
<h3 class="fn"><a name="mkdir"></a>int QFtp::mkdir ( const <a href="qstring.html">QString</a> &amp; <i>dir</i> )</h3>
 
328
<p>Creates a directory called <i>dir</i> on the server.</p>
 
329
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
330
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
331
<p>See also <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
332
<h3 class="fn"><a name="put"></a>int QFtp::put ( <a href="qiodevice.html">QIODevice</a> * <i>dev</i>, const <a href="qstring.html">QString</a> &amp; <i>file</i>, <a href="qftp.html#TransferType-enum">TransferType</a> <i>type</i> = Binary )</h3>
 
333
<p>Reads the data from the IO device <i>dev</i>, and writes it to the file called <i>file</i> on the server. The data is read in chunks from the IO device, so this overload allows you to transmit large amounts of data without the need to read all the data into memory at once.</p>
 
334
<p>The data is transferred as Binary or Ascii depending on the value of <i>type</i>.</p>
 
335
<p>Make sure that the <i>dev</i> pointer is valid for the duration of the operation (it is safe to delete it when the <a href="qftp.html#commandFinished">commandFinished</a>() is emitted).</p>
 
336
<h3 class="fn"><a name="put-2"></a>int QFtp::put ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>data</i>, const <a href="qstring.html">QString</a> &amp; <i>file</i>, <a href="qftp.html#TransferType-enum">TransferType</a> <i>type</i> = Binary )</h3>
 
337
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
338
<p>Writes a copy of the given <i>data</i> to the file called <i>file</i> on the server. The progress of the upload is reported by the <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>() signal.</p>
 
339
<p>The data is transferred as Binary or Ascii depending on the value of <i>type</i>.</p>
 
340
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
341
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
342
<p>Since this function takes a copy of the <i>data</i>, you can discard your own copy when this function returns.</p>
 
343
<p>See also <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>(), <a href="qftp.html#commandStarted">commandStarted</a>(), and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
344
<h3 class="fn"><a name="rawCommand"></a>int QFtp::rawCommand ( const <a href="qstring.html">QString</a> &amp; <i>command</i> )</h3>
 
345
<p>Sends the raw FTP command <i>command</i> to the FTP server. This is useful for low-level FTP access. If the operation you wish to perform has an equivalent <a href="qftp.html">QFtp</a> function, we recommend using the function instead of raw FTP commands since the functions are easier and safer.</p>
 
346
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
347
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
348
<p>See also <a href="qftp.html#rawCommandReply">rawCommandReply</a>(), <a href="qftp.html#commandStarted">commandStarted</a>(), and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
349
<h3 class="fn"><a name="rawCommandReply"></a>void QFtp::rawCommandReply ( int <i>replyCode</i>, const <a href="qstring.html">QString</a> &amp; <i>detail</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
350
<p>This signal is emitted in response to the <a href="qftp.html#rawCommand">rawCommand</a>() function. <i>replyCode</i> is the 3 digit reply code and <i>detail</i> is the text that follows the reply code.</p>
 
351
<p>See also <a href="qftp.html#rawCommand">rawCommand</a>().</p>
 
352
<h3 class="fn"><a name="read"></a><a href="qtglobal.html#qint64-typedef">qint64</a> QFtp::read ( char * <i>data</i>, <a href="qtglobal.html#qint64-typedef">qint64</a> <i>maxlen</i> )</h3>
 
353
<p>Reads <i>maxlen</i> bytes from the data socket into <i>data</i> and returns the number of bytes read. Returns -1 if an error occurred.</p>
 
354
<p>See also <a href="qftp.html#get">get</a>(), <a href="qftp.html#readyRead">readyRead</a>(), <a href="qftp.html#bytesAvailable">bytesAvailable</a>(), and <a href="qftp.html#readAll">readAll</a>().</p>
 
355
<h3 class="fn"><a name="readAll"></a><a href="qbytearray.html">QByteArray</a> QFtp::readAll ()</h3>
 
356
<p>Reads all the bytes available from the data socket and returns them.</p>
 
357
<p>See also <a href="qftp.html#get">get</a>(), <a href="qftp.html#readyRead">readyRead</a>(), <a href="qftp.html#bytesAvailable">bytesAvailable</a>(), and <a href="qftp.html#read">read</a>().</p>
 
358
<h3 class="fn"><a name="readyRead"></a>void QFtp::readyRead ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
359
<p>This signal is emitted in response to a <a href="qftp.html#get">get</a>() command when there is new data to read.</p>
 
360
<p>If you specify a device as the second argument in the <a href="qftp.html#get">get</a>() command, this signal is <i>not</i> emitted; instead the data is written directly to the device.</p>
 
361
<p>You can read the data with the <a href="qftp.html#readAll">readAll</a>() or <a href="qftp.html#read">read</a>() functions.</p>
 
362
<p>This signal is useful if you want to process the data in chunks as soon as it becomes available. If you are only interested in the complete data, just connect to the <a href="qftp.html#commandFinished">commandFinished</a>() signal and read the data then instead.</p>
 
363
<p>See also <a href="qftp.html#get">get</a>(), <a href="qftp.html#read">read</a>(), <a href="qftp.html#readAll">readAll</a>(), and <a href="qftp.html#bytesAvailable">bytesAvailable</a>().</p>
 
364
<h3 class="fn"><a name="remove"></a>int QFtp::remove ( const <a href="qstring.html">QString</a> &amp; <i>file</i> )</h3>
 
365
<p>Deletes the file called <i>file</i> from the server.</p>
 
366
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
367
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
368
<p>See also <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
369
<h3 class="fn"><a name="rename"></a>int QFtp::rename ( const <a href="qstring.html">QString</a> &amp; <i>oldname</i>, const <a href="qstring.html">QString</a> &amp; <i>newname</i> )</h3>
 
370
<p>Renames the file called <i>oldname</i> to <i>newname</i> on the server.</p>
 
371
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
372
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
373
<p>See also <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
374
<h3 class="fn"><a name="rmdir"></a>int QFtp::rmdir ( const <a href="qstring.html">QString</a> &amp; <i>dir</i> )</h3>
 
375
<p>Removes the directory called <i>dir</i> from the server.</p>
 
376
<p>The function does not block and returns immediately. The command is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
377
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted. When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted.</p>
 
378
<p>See also <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
379
<h3 class="fn"><a name="setProxy"></a>int QFtp::setProxy ( const <a href="qstring.html">QString</a> &amp; <i>host</i>, <a href="qtglobal.html#quint16-typedef">quint16</a> <i>port</i> )</h3>
 
380
<p>Enables use of the FTP proxy on host <i>host</i> and port <i>port</i>. Calling this function with <i>host</i> empty disables proxying.</p>
 
381
<p><a href="qftp.html">QFtp</a> does not support FTP-over-HTTP proxy servers. Use <a href="qhttp.html">QHttp</a> for this.</p>
 
382
<h3 class="fn"><a name="setTransferMode"></a>int QFtp::setTransferMode ( <a href="qftp.html#TransferMode-enum">TransferMode</a> <i>mode</i> )</h3>
 
383
<p>Sets the current FTP transfer mode to <i>mode</i>. The default is <a href="qftp.html#TransferMode-enum">QFtp::Passive</a>.</p>
 
384
<p>See also <a href="qftp.html#TransferMode-enum">QFtp::TransferMode</a>.</p>
 
385
<h3 class="fn"><a name="state"></a><a href="qftp.html#State-enum">State</a> QFtp::state () const</h3>
 
386
<p>Returns the current state of the object. When the state changes, the <a href="qftp.html#stateChanged">stateChanged</a>() signal is emitted.</p>
 
387
<p>See also <a href="qftp.html#State-enum">State</a> and <a href="qftp.html#stateChanged">stateChanged</a>().</p>
 
388
<h3 class="fn"><a name="stateChanged"></a>void QFtp::stateChanged ( int <i>state</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
389
<p>This signal is emitted when the state of the connection changes. The argument <i>state</i> is the new state of the connection; it is one of the <a href="qftp.html#State-enum">State</a> values.</p>
 
390
<p>It is usually emitted in response to a <a href="qftp.html#connectToHost">connectToHost</a>() or <a href="qftp.html#close">close</a>() command, but it can also be emitted &quot;spontaneously&quot;, e.g. when the server closes the connection unexpectedly.</p>
 
391
<p>See also <a href="qftp.html#connectToHost">connectToHost</a>(), <a href="qftp.html#close">close</a>(), <a href="qftp.html#state">state</a>(), and <a href="qftp.html#State-enum">State</a>.</p>
 
392
<p /><address><hr /><div align="center">
 
393
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
394
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
395
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
396
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
397
</tr></table></div></address></body>
 
398
</html>