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