~ubuntu-branches/ubuntu/trusty/python-qt4/trusty

« back to all changes in this revision

Viewing changes to doc/html/qftp.html

  • Committer: Package Import Robot
  • Author(s): Dmitry Shachnev
  • Date: 2013-11-20 12:25:42 UTC
  • mfrom: (1.5.19) (50.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20131120122542-te7i1x9i2gi421q3
Tags: 4.10.3+dfsg1-1
* get-orig-source.sh: Only remove the _static folder, as we still
  need some files in html that are not generated by Sphinx.
* Re-add debian/python-qt4-doc.docs (closes: #729993).
* Remove obsolete README.debian, examples work fine now.
* Do not install Windows-specific activeqt examples.
* Add description to debian_configure_changes.diff.
* Remove leftover debug output from debian/rules.
* Symlink duplicate files in examples using fdupes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
3
<html><head><title>QFtp Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
 
4
a:link { color: #004faf; text-decoration: none }
 
5
a:visited { color: #672967; text-decoration: none }
 
6
td.postheader { font-family: sans-serif }
 
7
tr.address { font-family: sans-serif }
 
8
body { background: #ffffff; color: black; }
 
9
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QFtp Class Reference<br /><sup><sup>[<a href="qtnetwork.html">QtNetwork</a> module]</sup></sup></h1><p>The QFtp class provides an implementation of the client side of
 
10
FTP protocol. <a href="#details">More...</a></p>
 
11
 
 
12
<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qftp.html#Command-enum">Command</a></b> { None_, SetTransferMode, SetProxy, ConnectToHost, ..., RawCommand }</li><li><div class="fn" />enum <b><a href="qftp.html#Error-enum">Error</a></b> { NoError, UnknownError, HostNotFound, ConnectionRefused, NotConnected }</li><li><div class="fn" />enum <b><a href="qftp.html#State-enum">State</a></b> { Unconnected, HostLookup, Connecting, Connected, LoggedIn, Closing }</li><li><div class="fn" />enum <b><a href="qftp.html#TransferMode-enum">TransferMode</a></b> { Active, Passive }</li><li><div class="fn" />enum <b><a href="qftp.html#TransferType-enum">TransferType</a></b> { Binary, Ascii }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qftp.html#QFtp">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qftp.html#abort">abort</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qftp.html#bytesAvailable">bytesAvailable</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qftp.html#cd">cd</a></b> (<i>self</i>, QString&#160;<i>directory</i>)</li><li><div class="fn" /><b><a href="qftp.html#clearPendingCommands">clearPendingCommands</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qftp.html#close">close</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qftp.html#connectToHost">connectToHost</a></b> (<i>self</i>, QString&#160;<i>host</i>, int&#160;<i>port</i>&#160;=&#160;21)</li><li><div class="fn" />Command <b><a href="qftp.html#currentCommand">currentCommand</a></b> (<i>self</i>)</li><li><div class="fn" />QIODevice <b><a href="qftp.html#currentDevice">currentDevice</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qftp.html#currentId">currentId</a></b> (<i>self</i>)</li><li><div class="fn" />Error <b><a href="qftp.html#error">error</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qftp.html#errorString">errorString</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qftp.html#get">get</a></b> (<i>self</i>, QString&#160;<i>file</i>, QIODevice&#160;<i>device</i>&#160;=&#160;None, TransferType&#160;<i>type</i>&#160;=&#160;QFtp.Binary)</li><li><div class="fn" />bool <b><a href="qftp.html#hasPendingCommands">hasPendingCommands</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qftp.html#list">list</a></b> (<i>self</i>, QString&#160;<i>directory</i>&#160;=&#160;QString())</li><li><div class="fn" />int <b><a href="qftp.html#login">login</a></b> (<i>self</i>, QString&#160;<i>user</i>&#160;=&#160;QString(), QString&#160;<i>password</i>&#160;=&#160;QString())</li><li><div class="fn" />int <b><a href="qftp.html#mkdir">mkdir</a></b> (<i>self</i>, QString&#160;<i>dir</i>)</li><li><div class="fn" />int <b><a href="qftp.html#put">put</a></b> (<i>self</i>, QByteArray&#160;<i>data</i>, QString&#160;<i>file</i>, TransferType&#160;<i>type</i>&#160;=&#160;QFtp.Binary)</li><li><div class="fn" />int <b><a href="qftp.html#put-2">put</a></b> (<i>self</i>, QIODevice&#160;<i>device</i>, QString&#160;<i>file</i>, TransferType&#160;<i>type</i>&#160;=&#160;QFtp.Binary)</li><li><div class="fn" />int <b><a href="qftp.html#rawCommand">rawCommand</a></b> (<i>self</i>, QString&#160;<i>command</i>)</li><li><div class="fn" />str <b><a href="qftp.html#read">read</a></b> (<i>self</i>, int&#160;<i>maxlen</i>)</li><li><div class="fn" />QByteArray <b><a href="qftp.html#readAll">readAll</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qftp.html#remove">remove</a></b> (<i>self</i>, QString&#160;<i>file</i>)</li><li><div class="fn" />int <b><a href="qftp.html#rename">rename</a></b> (<i>self</i>, QString&#160;<i>oldname</i>, QString&#160;<i>newname</i>)</li><li><div class="fn" />int <b><a href="qftp.html#rmdir">rmdir</a></b> (<i>self</i>, QString&#160;<i>dir</i>)</li><li><div class="fn" />int <b><a href="qftp.html#setProxy">setProxy</a></b> (<i>self</i>, QString&#160;<i>host</i>, int&#160;<i>port</i>)</li><li><div class="fn" />int <b><a href="qftp.html#setTransferMode">setTransferMode</a></b> (<i>self</i>, TransferMode&#160;<i>mode</i>)</li><li><div class="fn" />State <b><a href="qftp.html#state">state</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qftp.html#commandFinished">commandFinished</a></b> (int,bool)</li><li><div class="fn" />void <b><a href="qftp.html#commandStarted">commandStarted</a></b> (int)</li><li><div class="fn" />void <b><a href="qftp.html#dataTransferProgress">dataTransferProgress</a></b> (qint64,qint64)</li><li><div class="fn" />void <b><a href="qftp.html#done">done</a></b> (bool)</li><li><div class="fn" />void <b><a href="qftp.html#listInfo">listInfo</a></b> (const QUrlInfo&amp;)</li><li><div class="fn" />void <b><a href="qftp.html#rawCommandReply">rawCommandReply</a></b> (int,const QString&amp;)</li><li><div class="fn" />void <b><a href="qftp.html#readyRead">readyRead</a></b> ()</li><li><div class="fn" />void <b><a href="qftp.html#stateChanged">stateChanged</a></b> (int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFtp class provides an implementation of the client side of
 
13
FTP protocol.</p>
 
14
<p>This class provides a direct interface to FTP that allows you to
 
15
have more control over the requests. However, for new applications,
 
16
it is recommended to use <a href="qnetworkaccessmanager.html">QNetworkAccessManager</a> and <a href="qnetworkreply.html">QNetworkReply</a>, as those classes possess a
 
17
simpler, yet more powerful API.</p>
 
18
<p>The class works asynchronously, so there are no blocking
 
19
functions. If an operation cannot be executed immediately, the
 
20
function will still return straight away and the operation will be
 
21
scheduled for later execution. The results of scheduled operations
 
22
are reported via signals. This approach depends on the event loop
 
23
being in operation.</p>
 
24
<p>The operations that can be scheduled (they are called "commands"
 
25
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>(),
 
26
<a href="qftp.html#cd">cd</a>(), <a href="qftp.html#get">get</a>(),
 
27
<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>
 
28
<p>All of these commands return a unique identifier that allows you
 
29
to keep track of the command that is currently being executed. When
 
30
the execution of a command starts, the <a href="qftp.html#commandStarted">commandStarted</a>() signal with the
 
31
command's identifier is emitted. When the command is finished, the
 
32
<a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
33
emitted with the command's identifier and a bool that indicates
 
34
whether the command finished with an error.</p>
 
35
<p>In some cases, you might want to execute a sequence of commands,
 
36
e.g. if you want to connect and login to a FTP server. This is
 
37
simply achieved:</p>
 
38
<pre class="cpp">
 
39
 <span class="type">QFtp</span> <span class="operator">*</span>ftp <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QFtp</span>(parent);
 
40
 ftp<span class="operator">-</span><span class="operator">&gt;</span><a href="qftp.html#connectToHost">connectToHost</a>(<span class="string">"ftp.qt.nokia.com"</span>);
 
41
 ftp<span class="operator">-</span><span class="operator">&gt;</span><a href="qftp.html#login">login</a>();
 
42
</pre>
 
43
<p>In this case two FTP commands have been scheduled. When the last
 
44
scheduled command has finished, a <a href="qftp.html#done">done</a>() signal is emitted with a bool argument
 
45
that tells you whether the sequence finished with an error.</p>
 
46
<p>If an error occurs during the execution of one of the commands
 
47
in a sequence of commands, all the pending commands (i.e.
 
48
scheduled, but not yet executed commands) are cleared and no
 
49
signals are emitted for them.</p>
 
50
<p>Some commands, e.g. <a href="qftp.html#list">list</a>(), emit
 
51
additional signals to report their results.</p>
 
52
<p>Example: If you want to download the INSTALL file from the Qt
 
53
FTP server, you would write this:</p>
 
54
<pre class="cpp">
 
55
 ftp<span class="operator">-</span><span class="operator">&gt;</span><a href="qftp.html#connectToHost">connectToHost</a>(<span class="string">"ftp.qt.nokia.com"</span>);   <span class="comment">// id == 1</span>
 
56
 ftp<span class="operator">-</span><span class="operator">&gt;</span><a href="qftp.html#login">login</a>();                             <span class="comment">// id == 2</span>
 
57
 ftp<span class="operator">-</span><span class="operator">&gt;</span><a href="qftp.html#cd">cd</a>(<span class="string">"qt"</span>);                            <span class="comment">// id == 3</span>
 
58
 ftp<span class="operator">-</span><span class="operator">&gt;</span><a href="qftp.html#get">get</a>(<span class="string">"INSTALL"</span>);                      <span class="comment">// id == 4</span>
 
59
 ftp<span class="operator">-</span><span class="operator">&gt;</span><a href="qftp.html#close">close</a>();                             <span class="comment">// id == 5</span>
 
60
</pre>
 
61
<p>For this example the following sequence of signals is emitted
 
62
(with small variations, depending on network traffic, etc.):</p>
 
63
<pre class="cpp">
 
64
 start(<span class="number">1</span>)
 
65
 <a href="qftp.html#stateChanged">stateChanged</a>(HostLookup)
 
66
 <a href="qftp.html#stateChanged">stateChanged</a>(Connecting)
 
67
 <a href="qftp.html#stateChanged">stateChanged</a>(Connected)
 
68
 finished(<span class="number">1</span><span class="operator">,</span> <span class="keyword">false</span>)
 
69
 
 
70
 start(<span class="number">2</span>)
 
71
 <a href="qftp.html#stateChanged">stateChanged</a>(LoggedIn)
 
72
 finished(<span class="number">2</span><span class="operator">,</span> <span class="keyword">false</span>)
 
73
 
 
74
 start(<span class="number">3</span>)
 
75
 finished(<span class="number">3</span><span class="operator">,</span> <span class="keyword">false</span>)
 
76
 
 
77
 start(<span class="number">4</span>)
 
78
 <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>(<span class="number">0</span><span class="operator">,</span> <span class="number">3798</span>)
 
79
 <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>(<span class="number">2896</span><span class="operator">,</span> <span class="number">3798</span>)
 
80
 <a href="qftp.html#readyRead">readyRead</a>()
 
81
 <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>(<span class="number">3798</span><span class="operator">,</span> <span class="number">3798</span>)
 
82
 <a href="qftp.html#readyRead">readyRead</a>()
 
83
 finished(<span class="number">4</span><span class="operator">,</span> <span class="keyword">false</span>)
 
84
 
 
85
 start(<span class="number">5</span>)
 
86
 <a href="qftp.html#stateChanged">stateChanged</a>(Closing)
 
87
 <a href="qftp.html#stateChanged">stateChanged</a>(Unconnected)
 
88
 finished(<span class="number">5</span><span class="operator">,</span> <span class="keyword">false</span>)
 
89
 
 
90
 <a href="qftp.html#done">done</a>(<span class="keyword">false</span>)
 
91
</pre>
 
92
<p>The <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>() signal
 
93
in the above example is useful if you want to show a <a href="qprogressbar.html">progress bar</a> to inform the user about the
 
94
progress of the download. The <a href="qftp.html#readyRead">readyRead</a>() signal tells you that there
 
95
is data ready to be read. The amount of data can be queried then
 
96
with the <a href="qftp.html#bytesAvailable">bytesAvailable</a>()
 
97
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>
 
98
<p>If the login fails for the above example, the signals would look
 
99
like this:</p>
 
100
<pre class="cpp">
 
101
 start(<span class="number">1</span>)
 
102
 <a href="qftp.html#stateChanged">stateChanged</a>(HostLookup)
 
103
 <a href="qftp.html#stateChanged">stateChanged</a>(Connecting)
 
104
 <a href="qftp.html#stateChanged">stateChanged</a>(Connected)
 
105
 finished(<span class="number">1</span><span class="operator">,</span> <span class="keyword">false</span>)
 
106
 
 
107
 start(<span class="number">2</span>)
 
108
 finished(<span class="number">2</span><span class="operator">,</span> <span class="keyword">true</span>)
 
109
 
 
110
 <a href="qftp.html#done">done</a>(<span class="keyword">true</span>)
 
111
</pre>
 
112
<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>
 
113
<p>For file transfer, QFtp can use both active or passive mode, and
 
114
it uses passive file transfer mode by default; see the
 
115
documentation for <a href="qftp.html#setTransferMode">setTransferMode</a>() for more details
 
116
about this.</p>
 
117
<p>Call <a href="qftp.html#setProxy">setProxy</a>() to make QFtp
 
118
connect via an FTP proxy server.</p>
 
119
<p>The functions <a href="qftp.html#currentId">currentId</a>() and
 
120
<a href="qftp.html#currentCommand">currentCommand</a>() provide
 
121
more information about the currently executing command.</p>
 
122
<p>The functions <a href="qftp.html#hasPendingCommands">hasPendingCommands</a>() and
 
123
<a href="qftp.html#clearPendingCommands">clearPendingCommands</a>()
 
124
allow you to query and clear the list of pending commands.</p>
 
125
<p>If you are an experienced network programmer and want to have
 
126
complete control you can use <a href="qftp.html#rawCommand">rawCommand</a>() to execute arbitrary FTP
 
127
commands.</p>
 
128
<p><b>Warning:</b> The current version of QFtp doesn't fully
 
129
support non-Unix FTP servers.</p>
 
130
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Command-enum" />QFtp.Command</h3><p>This enum is used as the return value for the <a href="qftp.html#currentCommand">currentCommand</a>() function. This
 
131
allows you to perform specific actions for particular commands,
 
132
e.g. in a FTP client, you might want to clear the directory view
 
133
when a <a href="qftp.html#list">list</a>() command is started; in
 
134
this case you can simply check in the slot connected to the start()
 
135
signal if the <a href="qftp.html#currentCommand">currentCommand</a>() is
 
136
<tt>List</tt>.</p>
 
137
<table class="valuelist">
 
138
<tr class="odd" valign="top">
 
139
<th class="tblConst">Constant</th>
 
140
<th class="tblval">Value</th>
 
141
<th class="tbldscr">Description</th>
 
142
</tr>
 
143
<tr>
 
144
<td class="topAlign"><tt>QFtp.None</tt></td>
 
145
<td class="topAlign"><tt>0</tt></td>
 
146
<td class="topAlign">No command is being executed.</td>
 
147
</tr>
 
148
<tr>
 
149
<td class="topAlign"><tt>QFtp.SetTransferMode</tt></td>
 
150
<td class="topAlign"><tt>1</tt></td>
 
151
<td class="topAlign">set the <a href="qftp.html#TransferMode-enum">transfer</a> mode.</td>
 
152
</tr>
 
153
<tr>
 
154
<td class="topAlign"><tt>QFtp.SetProxy</tt></td>
 
155
<td class="topAlign"><tt>2</tt></td>
 
156
<td class="topAlign">switch proxying on or off.</td>
 
157
</tr>
 
158
<tr>
 
159
<td class="topAlign"><tt>QFtp.ConnectToHost</tt></td>
 
160
<td class="topAlign"><tt>3</tt></td>
 
161
<td class="topAlign"><a href="qftp.html#connectToHost">connectToHost</a>() is being
 
162
executed.</td>
 
163
</tr>
 
164
<tr>
 
165
<td class="topAlign"><tt>QFtp.Login</tt></td>
 
166
<td class="topAlign"><tt>4</tt></td>
 
167
<td class="topAlign"><a href="qftp.html#login">login</a>() is being
 
168
executed.</td>
 
169
</tr>
 
170
<tr>
 
171
<td class="topAlign"><tt>QFtp.Close</tt></td>
 
172
<td class="topAlign"><tt>5</tt></td>
 
173
<td class="topAlign"><a href="qftp.html#close">close</a>() is being
 
174
executed.</td>
 
175
</tr>
 
176
<tr>
 
177
<td class="topAlign"><tt>QFtp.List</tt></td>
 
178
<td class="topAlign"><tt>6</tt></td>
 
179
<td class="topAlign"><a href="qftp.html#list">list</a>() is being
 
180
executed.</td>
 
181
</tr>
 
182
<tr>
 
183
<td class="topAlign"><tt>QFtp.Cd</tt></td>
 
184
<td class="topAlign"><tt>7</tt></td>
 
185
<td class="topAlign"><a href="qftp.html#cd">cd</a>() is being
 
186
executed.</td>
 
187
</tr>
 
188
<tr>
 
189
<td class="topAlign"><tt>QFtp.Get</tt></td>
 
190
<td class="topAlign"><tt>8</tt></td>
 
191
<td class="topAlign"><a href="qftp.html#get">get</a>() is being
 
192
executed.</td>
 
193
</tr>
 
194
<tr>
 
195
<td class="topAlign"><tt>QFtp.Put</tt></td>
 
196
<td class="topAlign"><tt>9</tt></td>
 
197
<td class="topAlign"><a href="qftp.html#put">put</a>() is being
 
198
executed.</td>
 
199
</tr>
 
200
<tr>
 
201
<td class="topAlign"><tt>QFtp.Remove</tt></td>
 
202
<td class="topAlign"><tt>10</tt></td>
 
203
<td class="topAlign"><a href="qftp.html#remove">remove</a>() is
 
204
being executed.</td>
 
205
</tr>
 
206
<tr>
 
207
<td class="topAlign"><tt>QFtp.Mkdir</tt></td>
 
208
<td class="topAlign"><tt>11</tt></td>
 
209
<td class="topAlign"><a href="qftp.html#mkdir">mkdir</a>() is being
 
210
executed.</td>
 
211
</tr>
 
212
<tr>
 
213
<td class="topAlign"><tt>QFtp.Rmdir</tt></td>
 
214
<td class="topAlign"><tt>12</tt></td>
 
215
<td class="topAlign"><a href="qftp.html#rmdir">rmdir</a>() is being
 
216
executed.</td>
 
217
</tr>
 
218
<tr>
 
219
<td class="topAlign"><tt>QFtp.Rename</tt></td>
 
220
<td class="topAlign"><tt>13</tt></td>
 
221
<td class="topAlign"><a href="qftp.html#rename">rename</a>() is
 
222
being executed.</td>
 
223
</tr>
 
224
<tr>
 
225
<td class="topAlign"><tt>QFtp.RawCommand</tt></td>
 
226
<td class="topAlign"><tt>14</tt></td>
 
227
<td class="topAlign"><a href="qftp.html#rawCommand">rawCommand</a>() is being executed.</td>
 
228
</tr>
 
229
</table>
 
230
<p><b>See also</b> <a href="qftp.html#currentCommand">currentCommand</a>().</p>
 
231
 
 
232
 
 
233
<h3 class="fn"><a name="Error-enum" />QFtp.Error</h3><p>This enum identifies the error that occurred.</p>
 
234
<table class="valuelist">
 
235
<tr class="odd" valign="top">
 
236
<th class="tblConst">Constant</th>
 
237
<th class="tblval">Value</th>
 
238
<th class="tbldscr">Description</th>
 
239
</tr>
 
240
<tr>
 
241
<td class="topAlign"><tt>QFtp.NoError</tt></td>
 
242
<td class="topAlign"><tt>0</tt></td>
 
243
<td class="topAlign">No error occurred.</td>
 
244
</tr>
 
245
<tr>
 
246
<td class="topAlign"><tt>QFtp.HostNotFound</tt></td>
 
247
<td class="topAlign"><tt>2</tt></td>
 
248
<td class="topAlign">The host name lookup failed.</td>
 
249
</tr>
 
250
<tr>
 
251
<td class="topAlign"><tt>QFtp.ConnectionRefused</tt></td>
 
252
<td class="topAlign"><tt>3</tt></td>
 
253
<td class="topAlign">The server refused the connection.</td>
 
254
</tr>
 
255
<tr>
 
256
<td class="topAlign"><tt>QFtp.NotConnected</tt></td>
 
257
<td class="topAlign"><tt>4</tt></td>
 
258
<td class="topAlign">Tried to send a command, but there is no
 
259
connection to a server.</td>
 
260
</tr>
 
261
<tr>
 
262
<td class="topAlign"><tt>QFtp.UnknownError</tt></td>
 
263
<td class="topAlign"><tt>1</tt></td>
 
264
<td class="topAlign">An error other than those specified above
 
265
occurred.</td>
 
266
</tr>
 
267
</table>
 
268
<p><b>See also</b> <a href="qftp.html#error">error</a>().</p>
 
269
 
 
270
 
 
271
<h3 class="fn"><a name="State-enum" />QFtp.State</h3><p>This enum defines the connection state:</p>
 
272
<table class="valuelist">
 
273
<tr class="odd" valign="top">
 
274
<th class="tblConst">Constant</th>
 
275
<th class="tblval">Value</th>
 
276
<th class="tbldscr">Description</th>
 
277
</tr>
 
278
<tr>
 
279
<td class="topAlign"><tt>QFtp.Unconnected</tt></td>
 
280
<td class="topAlign"><tt>0</tt></td>
 
281
<td class="topAlign">There is no connection to the host.</td>
 
282
</tr>
 
283
<tr>
 
284
<td class="topAlign"><tt>QFtp.HostLookup</tt></td>
 
285
<td class="topAlign"><tt>1</tt></td>
 
286
<td class="topAlign">A host name lookup is in progress.</td>
 
287
</tr>
 
288
<tr>
 
289
<td class="topAlign"><tt>QFtp.Connecting</tt></td>
 
290
<td class="topAlign"><tt>2</tt></td>
 
291
<td class="topAlign">An attempt to connect to the host is in
 
292
progress.</td>
 
293
</tr>
 
294
<tr>
 
295
<td class="topAlign"><tt>QFtp.Connected</tt></td>
 
296
<td class="topAlign"><tt>3</tt></td>
 
297
<td class="topAlign">Connection to the host has been achieved.</td>
 
298
</tr>
 
299
<tr>
 
300
<td class="topAlign"><tt>QFtp.LoggedIn</tt></td>
 
301
<td class="topAlign"><tt>4</tt></td>
 
302
<td class="topAlign">Connection and user login have been
 
303
achieved.</td>
 
304
</tr>
 
305
<tr>
 
306
<td class="topAlign"><tt>QFtp.Closing</tt></td>
 
307
<td class="topAlign"><tt>5</tt></td>
 
308
<td class="topAlign">The connection is closing down, but it is not
 
309
yet closed. (The state will be <tt>Unconnected</tt> when the
 
310
connection is closed.)</td>
 
311
</tr>
 
312
</table>
 
313
<p><b>See also</b> <a href="qftp.html#stateChanged">stateChanged</a>() and <a href="qftp.html#state">state</a>().</p>
 
314
 
 
315
 
 
316
<h3 class="fn"><a name="TransferMode-enum" />QFtp.TransferMode</h3><p>FTP works with two socket connections; one for commands and
 
317
another for transmitting data. While the command connection is
 
318
always initiated by the client, the second connection can be
 
319
initiated by either the client or the server.</p>
 
320
<p>This enum defines whether the client (Passive mode) or the
 
321
server (Active mode) should set up the data connection.</p>
 
322
<table class="valuelist">
 
323
<tr class="odd" valign="top">
 
324
<th class="tblConst">Constant</th>
 
325
<th class="tblval">Value</th>
 
326
<th class="tbldscr">Description</th>
 
327
</tr>
 
328
<tr>
 
329
<td class="topAlign"><tt>QFtp.Passive</tt></td>
 
330
<td class="topAlign"><tt>1</tt></td>
 
331
<td class="topAlign">The client connects to the server to transmit
 
332
its data.</td>
 
333
</tr>
 
334
<tr>
 
335
<td class="topAlign"><tt>QFtp.Active</tt></td>
 
336
<td class="topAlign"><tt>0</tt></td>
 
337
<td class="topAlign">The server connects to the client to transmit
 
338
its data.</td>
 
339
</tr>
 
340
</table>
 
341
 
 
342
 
 
343
<h3 class="fn"><a name="TransferType-enum" />QFtp.TransferType</h3><p>This enum identifies the data transfer type used with get and
 
344
put commands.</p>
 
345
<table class="valuelist">
 
346
<tr class="odd" valign="top">
 
347
<th class="tblConst">Constant</th>
 
348
<th class="tblval">Value</th>
 
349
<th class="tbldscr">Description</th>
 
350
</tr>
 
351
<tr>
 
352
<td class="topAlign"><tt>QFtp.Binary</tt></td>
 
353
<td class="topAlign"><tt>0</tt></td>
 
354
<td class="topAlign">The data will be transferred in Binary
 
355
mode.</td>
 
356
</tr>
 
357
<tr>
 
358
<td class="topAlign"><tt>QFtp.Ascii</tt></td>
 
359
<td class="topAlign"><tt>1</tt></td>
 
360
<td class="topAlign">The data will be transferred in Ascii mode and
 
361
new line characters will be converted to the local format.</td>
 
362
</tr>
 
363
</table>
 
364
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFtp" />QFtp.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qftp.html">QFtp</a> object with the given
 
365
<i>parent</i>.</p>
 
366
 
 
367
 
 
368
<h3 class="fn"><a name="abort" />QFtp.abort (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void abort()</tt>.</p><p>Aborts the current command and deletes all scheduled
 
369
commands.</p>
 
370
<p>If there is an unfinished command (i.e. a command for which the
 
371
<a href="qftp.html#commandStarted">commandStarted</a>() signal has
 
372
been emitted, but for which the <a href="qftp.html#commandFinished">commandFinished</a>() signal has not
 
373
been emitted), this function sends an <tt>ABORT</tt> command to the
 
374
server. When the server replies that the command is aborted, the
 
375
<a href="qftp.html#commandFinished">commandFinished</a>() signal
 
376
with the <tt>error</tt> argument set to <tt>true</tt> is emitted
 
377
for the command. Due to timing issues, it is possible that the
 
378
command had already finished before the abort request reached the
 
379
server, in which case, the <a href="qftp.html#commandFinished">commandFinished</a>() signal is emitted
 
380
with the <tt>error</tt> argument set to <tt>false</tt>.</p>
 
381
<p>For all other commands that are affected by the abort(), no
 
382
signals are emitted.</p>
 
383
<p>If you don't start further FTP commands directly after the
 
384
abort(), there won't be any scheduled commands and the <a href="qftp.html#done">done</a>() signal is emitted.</p>
 
385
<p><b>Warning:</b> Some FTP servers, for example the BSD FTP daemon
 
386
(version 0.3), wrongly return a positive reply even when an abort
 
387
has occurred. For these servers the <a href="qftp.html#commandFinished">commandFinished</a>() signal has its
 
388
error flag set to <tt>false</tt>, even though the command did not
 
389
complete successfully.</p>
 
390
<p><b>See also</b> <a href="qftp.html#clearPendingCommands">clearPendingCommands</a>().</p>
 
391
 
 
392
 
 
393
<h3 class="fn"><a name="bytesAvailable" />int QFtp.bytesAvailable (<i>self</i>)</h3><p>Returns the number of bytes that can be read from the data
 
394
socket at the moment.</p>
 
395
<p><b>See also</b> <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>
 
396
 
 
397
 
 
398
<h3 class="fn"><a name="cd" />int QFtp.cd (<i>self</i>, QString&#160;<i>directory</i>)</h3><p>Changes the working directory of the server to <i>dir</i>.</p>
 
399
<p>The function does not block and returns immediately. The command
 
400
is scheduled, and its execution is performed asynchronously. The
 
401
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>
 
402
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
403
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
404
emitted.</p>
 
405
<p><b>See also</b> <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
406
 
 
407
 
 
408
<h3 class="fn"><a name="clearPendingCommands" />QFtp.clearPendingCommands (<i>self</i>)</h3><p>Deletes all pending commands from the list of scheduled
 
409
commands. This does not affect the command that is being executed.
 
410
If you want to stop this as well, use <a href="qftp.html#abort">abort</a>().</p>
 
411
<p><b>See also</b> <a href="qftp.html#hasPendingCommands">hasPendingCommands</a>() and
 
412
<a href="qftp.html#abort">abort</a>().</p>
 
413
 
 
414
 
 
415
<h3 class="fn"><a name="close" />int QFtp.close (<i>self</i>)</h3><p>Closes the connection to the FTP server.</p>
 
416
<p>The <a href="qftp.html#stateChanged">stateChanged</a>() signal
 
417
is emitted when the state of the connecting process changes, e.g.
 
418
to <tt>Closing</tt>, then <tt>Unconnected</tt>.</p>
 
419
<p>The function does not block and returns immediately. The command
 
420
is scheduled, and its execution is performed asynchronously. The
 
421
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>
 
422
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
423
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
424
emitted.</p>
 
425
<p><b>See also</b> <a href="qftp.html#stateChanged">stateChanged</a>(), <a href="qftp.html#commandStarted">commandStarted</a>(), and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
426
 
 
427
 
 
428
<h3 class="fn"><a name="connectToHost" />int QFtp.connectToHost (<i>self</i>, QString&#160;<i>host</i>, int&#160;<i>port</i>&#160;=&#160;21)</h3><p>Connects to the FTP server <i>host</i> using port
 
429
<i>port</i>.</p>
 
430
<p>The <a href="qftp.html#stateChanged">stateChanged</a>() signal
 
431
is emitted when the state of the connecting process changes, e.g.
 
432
to <tt>HostLookup</tt>, then <tt>Connecting</tt>, then
 
433
<tt>Connected</tt>.</p>
 
434
<p>The function does not block and returns immediately. The command
 
435
is scheduled, and its execution is performed asynchronously. The
 
436
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>
 
437
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
438
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
439
emitted.</p>
 
440
<p><b>See also</b> <a href="qftp.html#stateChanged">stateChanged</a>(), <a href="qftp.html#commandStarted">commandStarted</a>(), and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
441
 
 
442
 
 
443
<h3 class="fn"><a name="currentCommand" /><a href="qftp.html#Command-enum">Command</a> QFtp.currentCommand (<i>self</i>)</h3><p>Returns the command type of the FTP command being executed or
 
444
<tt>None</tt> if there is no command being executed.</p>
 
445
<p><b>See also</b> <a href="qftp.html#currentId">currentId</a>().</p>
 
446
 
 
447
 
 
448
<h3 class="fn"><a name="currentDevice" /><a href="qiodevice.html">QIODevice</a> QFtp.currentDevice (<i>self</i>)</h3><p>Returns the <a href="qiodevice.html">QIODevice</a> pointer that
 
449
is used by the FTP command to read data from or store data to. If
 
450
there is no current FTP command being executed or if the command
 
451
does not use an IO device, this function returns 0.</p>
 
452
<p>This function can be used to delete the <a href="qiodevice.html">QIODevice</a> in the slot connected to the
 
453
<a href="qftp.html#commandFinished">commandFinished</a>()
 
454
signal.</p>
 
455
<p><b>See also</b> <a href="qftp.html#get">get</a>() and <a href="qftp.html#put">put</a>().</p>
 
456
 
 
457
 
 
458
<h3 class="fn"><a name="currentId" />int QFtp.currentId (<i>self</i>)</h3><p>Returns the identifier of the FTP command that is being executed
 
459
or 0 if there is no command being executed.</p>
 
460
<p><b>See also</b> <a href="qftp.html#currentCommand">currentCommand</a>().</p>
 
461
 
 
462
 
 
463
<h3 class="fn"><a name="error" /><a href="qftp.html#Error-enum">Error</a> QFtp.error (<i>self</i>)</h3><p>Returns the last error that occurred. This is useful to find out
 
464
what went 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
 
465
set to <tt>true</tt>.</p>
 
466
<p>If you start a new command, the error status is reset to
 
467
<tt>NoError</tt>.</p>
 
468
 
 
469
 
 
470
<h3 class="fn"><a name="errorString" />QString QFtp.errorString (<i>self</i>)</h3><p>Returns a human-readable description of the last error that
 
471
occurred. This is useful for presenting a error message to the user
 
472
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
 
473
set to <tt>true</tt>.</p>
 
474
<p>The error string is often (but not always) the reply from the
 
475
server, so it is not always possible to translate the string. If
 
476
the message comes from Qt, the string has already passed through
 
477
<a href="qobject.html#tr">tr</a>().</p>
 
478
 
 
479
 
 
480
<h3 class="fn"><a name="get" />int QFtp.get (<i>self</i>, QString&#160;<i>file</i>, <a href="qiodevice.html">QIODevice</a>&#160;<i>device</i>&#160;=&#160;None, <a href="qftp.html#TransferType-enum">TransferType</a>&#160;<i>type</i>&#160;=&#160;QFtp.Binary)</h3><p>Downloads the file <i>file</i> from the server.</p>
 
481
<p>If <i>dev</i> is 0, then the <a href="qftp.html#readyRead">readyRead</a>() signal is emitted when there
 
482
is data available to read. You can then read the data with the
 
483
<a href="qftp.html#read">read</a>() or <a href="qftp.html#readAll">readAll</a>() functions.</p>
 
484
<p>If <i>dev</i> is not 0, the data is written directly to the
 
485
device <i>dev</i>. Make sure that the <i>dev</i> pointer is valid
 
486
for the duration of the operation (it is safe to delete it when the
 
487
<a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
488
emitted). In this case the <a href="qftp.html#readyRead">readyRead</a>() signal is <i>not</i> emitted
 
489
and you cannot read data with the <a href="qftp.html#read">read</a>() or <a href="qftp.html#readAll">readAll</a>() functions.</p>
 
490
<p>If you don't read the data immediately it becomes available,
 
491
i.e. when the <a href="qftp.html#readyRead">readyRead</a>() signal
 
492
is emitted, it is still available until the next command is
 
493
started.</p>
 
494
<p>For example, if you want to present the data to the user as soon
 
495
as there is something available, connect to the <a href="qftp.html#readyRead">readyRead</a>() signal and read the data
 
496
immediately. On the other hand, if you only want to work with the
 
497
complete data, you can connect to the <a href="qftp.html#commandFinished">commandFinished</a>() signal and read
 
498
the data when the get() command is finished.</p>
 
499
<p>The data is transferred as Binary or Ascii depending on the
 
500
value of <i>type</i>.</p>
 
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 <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
504
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
505
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
506
emitted.</p>
 
507
<p><a href="qftp.html#commandFinished">commandFinished</a>()</p>
 
508
<p><b>See also</b> <a href="qftp.html#readyRead">readyRead</a>(),
 
509
<a href="qftp.html#dataTransferProgress">dataTransferProgress</a>(), and
 
510
<a href="qftp.html#commandStarted">commandStarted</a>().</p>
 
511
 
 
512
 
 
513
<h3 class="fn"><a name="hasPendingCommands" />bool QFtp.hasPendingCommands (<i>self</i>)</h3><p>Returns true if there are any commands scheduled that have not
 
514
yet been executed; otherwise returns false.</p>
 
515
<p>The command that is being executed is <i>not</i> considered as a
 
516
scheduled command.</p>
 
517
<p><b>See also</b> <a href="qftp.html#clearPendingCommands">clearPendingCommands</a>(),
 
518
<a href="qftp.html#currentId">currentId</a>(), and <a href="qftp.html#currentCommand">currentCommand</a>().</p>
 
519
 
 
520
 
 
521
<h3 class="fn"><a name="list" />int QFtp.list (<i>self</i>, QString&#160;<i>directory</i>&#160;=&#160;QString())</h3><p>Lists the contents of directory <i>dir</i> on the FTP server. If
 
522
<i>dir</i> is empty, it lists the contents of the current
 
523
directory.</p>
 
524
<p>The <a href="qftp.html#listInfo">listInfo</a>() signal is
 
525
emitted for each directory entry found.</p>
 
526
<p>The function does not block and returns immediately. The command
 
527
is scheduled, and its execution is performed asynchronously. The
 
528
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>
 
529
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
530
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
531
emitted.</p>
 
532
<p><b>See also</b> <a href="qftp.html#listInfo">listInfo</a>(),
 
533
<a href="qftp.html#commandStarted">commandStarted</a>(), and
 
534
<a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
535
 
 
536
 
 
537
<h3 class="fn"><a name="login" />int QFtp.login (<i>self</i>, QString&#160;<i>user</i>&#160;=&#160;QString(), QString&#160;<i>password</i>&#160;=&#160;QString())</h3><p>Logs in to the FTP server with the username <i>user</i> and the
 
538
password <i>password</i>.</p>
 
539
<p>The <a href="qftp.html#stateChanged">stateChanged</a>() signal
 
540
is emitted when the state of the connecting process changes, e.g.
 
541
to <tt>LoggedIn</tt>.</p>
 
542
<p>The function does not block and returns immediately. The command
 
543
is scheduled, and its execution is performed asynchronously. The
 
544
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>
 
545
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
546
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
547
emitted.</p>
 
548
<p><b>See also</b> <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
549
 
 
550
 
 
551
<h3 class="fn"><a name="mkdir" />int QFtp.mkdir (<i>self</i>, QString&#160;<i>dir</i>)</h3><p>Creates a directory called <i>dir</i> on the server.</p>
 
552
<p>The function does not block and returns immediately. The command
 
553
is scheduled, and its execution is performed asynchronously. The
 
554
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>
 
555
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
556
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
557
emitted.</p>
 
558
<p><b>See also</b> <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
559
 
 
560
 
 
561
<h3 class="fn"><a name="put" />int QFtp.put (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>data</i>, QString&#160;<i>file</i>, <a href="qftp.html#TransferType-enum">TransferType</a>&#160;<i>type</i>&#160;=&#160;QFtp.Binary)</h3><p>Reads the data from the IO device <i>dev</i>, and writes it to
 
562
the file called <i>file</i> on the server. The data is read in
 
563
chunks from the IO device, so this overload allows you to transmit
 
564
large amounts of data without the need to read all the data into
 
565
memory at once.</p>
 
566
<p>The data is transferred as Binary or Ascii depending on the
 
567
value of <i>type</i>.</p>
 
568
<p>Make sure that the <i>dev</i> pointer is valid for the duration
 
569
of the operation (it is safe to delete it when the <a href="qftp.html#commandFinished">commandFinished</a>() is emitted).</p>
 
570
 
 
571
 
 
572
<h3 class="fn"><a name="put-2" />int QFtp.put (<i>self</i>, <a href="qiodevice.html">QIODevice</a>&#160;<i>device</i>, QString&#160;<i>file</i>, <a href="qftp.html#TransferType-enum">TransferType</a>&#160;<i>type</i>&#160;=&#160;QFtp.Binary)</h3><p>This is an overloaded function.</p>
 
573
<p>Writes a copy of the given <i>data</i> to the file called
 
574
<i>file</i> on the server. The progress of the upload is reported
 
575
by the <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>()
 
576
signal.</p>
 
577
<p>The data is transferred as Binary or Ascii depending on the
 
578
value of <i>type</i>.</p>
 
579
<p>The function does not block and returns immediately. The command
 
580
is scheduled, and its execution is performed asynchronously. The
 
581
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>
 
582
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
583
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
584
emitted.</p>
 
585
<p>Since this function takes a copy of the <i>data</i>, you can
 
586
discard your own copy when this function returns.</p>
 
587
<p><b>See also</b> <a href="qftp.html#dataTransferProgress">dataTransferProgress</a>(),
 
588
<a href="qftp.html#commandStarted">commandStarted</a>(), and
 
589
<a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
590
 
 
591
 
 
592
<h3 class="fn"><a name="rawCommand" />int QFtp.rawCommand (<i>self</i>, QString&#160;<i>command</i>)</h3><p>Sends the raw FTP command <i>command</i> to the FTP server. This
 
593
is useful for low-level FTP access. If the operation you wish to
 
594
perform has an equivalent <a href="qftp.html">QFtp</a> function, we
 
595
recommend using the function instead of raw FTP commands since the
 
596
functions are easier and safer.</p>
 
597
<p>The function does not block and returns immediately. The command
 
598
is scheduled, and its execution is performed asynchronously. The
 
599
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>
 
600
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
601
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
602
emitted.</p>
 
603
<p><b>See also</b> <a href="qftp.html#rawCommandReply">rawCommandReply</a>(), <a href="qftp.html#commandStarted">commandStarted</a>(), and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
604
 
 
605
 
 
606
<h3 class="fn"><a name="read" />str QFtp.read (<i>self</i>, int&#160;<i>maxlen</i>)</h3><p>Reads <i>maxlen</i> bytes from the data socket into <i>data</i>
 
607
and returns the number of bytes read. Returns -1 if an error
 
608
occurred.</p>
 
609
<p><b>See also</b> <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>
 
610
 
 
611
 
 
612
<h3 class="fn"><a name="readAll" /><a href="qbytearray.html">QByteArray</a> QFtp.readAll (<i>self</i>)</h3><p>Reads all the bytes available from the data socket and returns
 
613
them.</p>
 
614
<p><b>See also</b> <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>
 
615
 
 
616
 
 
617
<h3 class="fn"><a name="remove" />int QFtp.remove (<i>self</i>, QString&#160;<i>file</i>)</h3><p>Deletes the file called <i>file</i> from the server.</p>
 
618
<p>The function does not block and returns immediately. The command
 
619
is scheduled, and its execution is performed asynchronously. The
 
620
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>
 
621
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
622
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
623
emitted.</p>
 
624
<p><b>See also</b> <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
625
 
 
626
 
 
627
<h3 class="fn"><a name="rename" />int QFtp.rename (<i>self</i>, QString&#160;<i>oldname</i>, QString&#160;<i>newname</i>)</h3><p>Renames the file called <i>oldname</i> to <i>newname</i> on the
 
628
server.</p>
 
629
<p>The function does not block and returns immediately. The command
 
630
is scheduled, and its execution is performed asynchronously. The
 
631
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>
 
632
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
633
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
634
emitted.</p>
 
635
<p><b>See also</b> <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
636
 
 
637
 
 
638
<h3 class="fn"><a name="rmdir" />int QFtp.rmdir (<i>self</i>, QString&#160;<i>dir</i>)</h3><p>Removes the directory called <i>dir</i> from the server.</p>
 
639
<p>The function does not block and returns immediately. The command
 
640
is scheduled, and its execution is performed asynchronously. The
 
641
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>
 
642
<p>When the command is started the <a href="qftp.html#commandStarted">commandStarted</a>() signal is emitted.
 
643
When it is finished the <a href="qftp.html#commandFinished">commandFinished</a>() signal is
 
644
emitted.</p>
 
645
<p><b>See also</b> <a href="qftp.html#commandStarted">commandStarted</a>() and <a href="qftp.html#commandFinished">commandFinished</a>().</p>
 
646
 
 
647
 
 
648
<h3 class="fn"><a name="setProxy" />int QFtp.setProxy (<i>self</i>, QString&#160;<i>host</i>, int&#160;<i>port</i>)</h3><p>Enables use of the FTP proxy on host <i>host</i> and port
 
649
<i>port</i>. Calling this function with <i>host</i> empty disables
 
650
proxying.</p>
 
651
<p><a href="qftp.html">QFtp</a> does not support FTP-over-HTTP
 
652
proxy servers. Use <a href="qnetworkaccessmanager.html">QNetworkAccessManager</a> for
 
653
this.</p>
 
654
 
 
655
 
 
656
<h3 class="fn"><a name="setTransferMode" />int QFtp.setTransferMode (<i>self</i>, <a href="qftp.html#TransferMode-enum">TransferMode</a>&#160;<i>mode</i>)</h3><p>Sets the current FTP transfer mode to <i>mode</i>. The default
 
657
is <a href="qftp.html#TransferMode-enum">QFtp.Passive</a>.</p>
 
658
<p><b>See also</b> <a href="qftp.html#TransferMode-enum">QFtp.TransferMode</a>.</p>
 
659
 
 
660
 
 
661
<h3 class="fn"><a name="state" /><a href="qftp.html#State-enum">State</a> QFtp.state (<i>self</i>)</h3><p>Returns the current state of the object. When the state changes,
 
662
the <a href="qftp.html#stateChanged">stateChanged</a>() signal is
 
663
emitted.</p>
 
664
<p><b>See also</b> <a href="qftp.html#State-enum">State</a> and
 
665
<a href="qftp.html#stateChanged">stateChanged</a>().</p>
 
666
 
 
667
 
 
668
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="commandFinished" />void commandFinished (int,bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when processing the command identified by
 
669
<i>id</i> has finished. <i>error</i> is true if an error occurred
 
670
during the processing; otherwise <i>error</i> is false.</p>
 
671
<p><b>See also</b> <a href="qftp.html#commandStarted">commandStarted</a>(), <a href="qftp.html#done">done</a>(), <a href="qftp.html#error">error</a>(),
 
672
and <a href="qftp.html#errorString">errorString</a>().</p>
 
673
 
 
674
 
 
675
<h3 class="fn"><a name="commandStarted" />void commandStarted (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when processing the command identified by
 
676
<i>id</i> starts.</p>
 
677
<p><b>See also</b> <a href="qftp.html#commandFinished">commandFinished</a>() and <a href="qftp.html#done">done</a>().</p>
 
678
 
 
679
 
 
680
<h3 class="fn"><a name="dataTransferProgress" />void dataTransferProgress (qint64,qint64)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted in response to a <a href="qftp.html#get">get</a>() or <a href="qftp.html#put">put</a>()
 
681
request to indicate the current progress of the download or
 
682
upload.</p>
 
683
<p><i>done</i> is the amount of data that has already been
 
684
transferred and <i>total</i> is the total amount of data to be read
 
685
or written. It is possible that the <a href="qftp.html">QFtp</a>
 
686
class is not able to determine the total amount of data that should
 
687
be transferred, in which case <i>total</i> is 0. (If you connect
 
688
this signal to a <a href="qprogressbar.html">QProgressBar</a>, the
 
689
progress bar shows a busy indicator if the total is 0).</p>
 
690
<p><b>Warning:</b> <i>done</i> and <i>total</i> are not necessarily
 
691
the size in bytes, since for large files these values might need to
 
692
be "scaled" to avoid overflow.</p>
 
693
<p><b>See also</b> <a href="qftp.html#get">get</a>(), <a href="qftp.html#put">put</a>(), and <a href="qprogressbar.html">QProgressBar</a>.</p>
 
694
 
 
695
 
 
696
<h3 class="fn"><a name="done" />void done (bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the last pending command has
 
697
finished; (it is emitted after the last command's <a href="qftp.html#commandFinished">commandFinished</a>() signal).
 
698
<i>error</i> is true if an error occurred during the processing;
 
699
otherwise <i>error</i> is false.</p>
 
700
<p><b>See also</b> <a href="qftp.html#commandFinished">commandFinished</a>(), <a href="qftp.html#error">error</a>(), and <a href="qftp.html#errorString">errorString</a>().</p>
 
701
 
 
702
 
 
703
<h3 class="fn"><a name="listInfo" />void listInfo (const QUrlInfo&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted for each directory entry the <a href="qftp.html#list">list</a>() command finds. The details of the entry
 
704
are stored in <i>i</i>.</p>
 
705
<p><b>See also</b> <a href="qftp.html#list">list</a>().</p>
 
706
 
 
707
 
 
708
<h3 class="fn"><a name="rawCommandReply" />void rawCommandReply (int,const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted in response to the <a href="qftp.html#rawCommand">rawCommand</a>() function. <i>replyCode</i>
 
709
is the 3 digit reply code and <i>detail</i> is the text that
 
710
follows the reply code.</p>
 
711
<p><b>See also</b> <a href="qftp.html#rawCommand">rawCommand</a>().</p>
 
712
 
 
713
 
 
714
<h3 class="fn"><a name="readyRead" />void readyRead ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted in response to a <a href="qftp.html#get">get</a>() command when there is new data to
 
715
read.</p>
 
716
<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>
 
717
emitted; instead the data is written directly to the device.</p>
 
718
<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>
 
719
<p>This signal is useful if you want to process the data in chunks
 
720
as soon as it becomes available. If you are only interested in the
 
721
complete data, just connect to the <a href="qftp.html#commandFinished">commandFinished</a>() signal and read
 
722
the data then instead.</p>
 
723
<p><b>See also</b> <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>
 
724
 
 
725
 
 
726
<h3 class="fn"><a name="stateChanged" />void stateChanged (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the state of the connection changes.
 
727
The argument <i>state</i> is the new state of the connection; it is
 
728
one of the <a href="qftp.html#State-enum">State</a> values.</p>
 
729
<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
 
730
"spontaneously", e.g. when the server closes the connection
 
731
unexpectedly.</p>
 
732
<p><b>See also</b> <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>
 
733
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>
 
 
b'\\ No newline at end of file'