Logo Search packages:      
Sourcecode: qt4-x11 version File versions

int Q3Ftp::get ( const QString file,
QIODevice dev = 0 

Downloads the file file from the server.

If dev is 0, then the readyRead() signal is emitted when there is data available to read. You can then read the data with the readBlock() or readAll() functions.

If dev is not 0, the data is written directly to the device dev. Make sure that the dev pointer is valid for the duration of the operation (it is safe to delete it when the commandFinished() signal is emitted). In this case the readyRead() signal is not emitted and you cannot read data with the readBlock() or readAll() functions.

If you don't read the data immediately it becomes available, i.e. when the readyRead() signal is emitted, it is still available until the next command is started.

For example, if you want to present the data to the user as soon as there is something available, connect to the readyRead() 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 commandFinished() signal and read the data when the get() command is finished.

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 commandStarted() and commandFinished().

When the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted.

See also:
readyRead() dataTransferProgress() commandStarted() commandFinished()

Definition at line 1546 of file q3ftp.cpp.

    QStringList cmds;
    cmds << ( QLatin1String("SIZE ") + file + QLatin1String("\r\n") );
    cmds << QLatin1String("TYPE I\r\n");
    cmds << QLatin1String("PASV\r\n");
    cmds << ( QLatin1String("RETR ") + file + QLatin1String("\r\n") );
    if ( dev )
      return addCommand( new Q3FtpCommand( Get, cmds, dev ) );
    return addCommand( new Q3FtpCommand( Get, cmds ) );

Generated by  Doxygen 1.6.0   Back to index