📄 qftp.3qt
字号:
.TP\fCQFtp::NoError\fR - No error occurred..TP\fCQFtp::HostNotFound\fR - The host name lookup failed..TP\fCQFtp::ConnectionRefused\fR - The server refused the connection..TP\fCQFtp::NotConnected\fR - Tried to send a command, but there is no connection to a server..TP\fCQFtp::UnknownError\fR - An error other than those specified above occurred..PPSee also error()..SH "QFtp::State"This enum defines the connection state:.TP\fCQFtp::Unconnected\fR - There is no connection to the host..TP\fCQFtp::HostLookup\fR - A host name lookup is in progress..TP\fCQFtp::Connecting\fR - An attempt to connect to the host is in progress..TP\fCQFtp::Connected\fR - Connection to the host has been achieved..TP\fCQFtp::LoggedIn\fR - Connection and user login have been achieved..TP\fCQFtp::Closing\fR - The connection is closing down, but it is not yet closed. (The state will be Unconnected when the connection is closed.).PPSee also stateChanged() and state()..SH MEMBER FUNCTION DOCUMENTATION.SH "QFtp::QFtp ()"Constructs a QFtp object..SH "QFtp::QFtp ( QObject * parent, const char * name = 0 )"Constructs a QFtp object. The \fIparent\fR and \fIname\fR parameters are passed to the QObject constructor..SH "QFtp::~QFtp ()\fC [virtual]\fR"Destructor..SH "void QFtp::abort ()\fC [slot]\fR"Aborts the current command and deletes all scheduled commands..PPIf there is an unfinished command (i.e. a command for which the commandStarted() signal has been emitted, but for which the commandFinished() signal has not been emitted), this function sends an \fCABORT\fR command to the server. When the server replies that the command is aborted, the commandFinished() signal with the \fCerror\fR argument set to \fCTRUE\fR 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 commandFinished() signal is emitted with the \fCerror\fR argument set to \fCFALSE\fR..PPFor all other commands that are affected by the abort(), no signals are emitted..PPIf you don't start further FTP commands directly after the abort(), there won't be any scheduled commands and the done() signal is emitted..PP\fBWarning:\fR 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 commandFinished() signal has its error flag set to \fCFALSE\fR, even though the command did not complete successfully..PPSee also clearPendingCommands()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "Q_ULONG QFtp::bytesAvailable () const"Returns the number of bytes that can be read from the data socket at the moment..PPSee also get(), readyRead(), readBlock(), and readAll()..SH "int QFtp::cd ( const QString & dir )"Changes the working directory of the server to \fIdir\fR..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also commandStarted() and commandFinished()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "void QFtp::clearPendingCommands ()"Deletes all pending commands from the list of scheduled commands. This does not affect the command that is being executed. If you want to stop this this as well, use abort()..PPSee also hasPendingCommands() and abort()..SH "int QFtp::close ()"Closes the connection to the FTP server..PPThe stateChanged() signal is emitted when the state of the connecting process changes, e.g. to Closing, then Unconnected..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also stateChanged(), commandStarted(), and commandFinished()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "void QFtp::commandFinished ( int id, bool error )\fC [signal]\fR"This signal is emitted when processing the command identified by \fIid\fR has finished. \fIerror\fR is TRUE if an error occurred during the processing; otherwise \fIerror\fR is FALSE..PPSee also commandStarted(), done(), error(), and errorString()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "void QFtp::commandStarted ( int id )\fC [signal]\fR"This signal is emitted when processing the command identified by \fIid\fR starts..PPSee also commandFinished() and done()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "int QFtp::connectToHost ( const QString & host, Q_UINT16 port = 21 )"Connects to the FTP server \fIhost\fR using port \fIport\fR..PPThe stateChanged() signal is emitted when the state of the connecting process changes, e.g. to HostLookup, then Connecting, then Connected..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also stateChanged(), commandStarted(), and commandFinished()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "Command QFtp::currentCommand () const"Returns the command type of the FTP command being executed or None if there is no command being executed..PPSee also currentId()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "QIODevice * QFtp::currentDevice () const"Returns the QIODevice 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..PPThis function can be used to delete the QIODevice in the slot connected to the commandFinished() signal..PPSee also get() and put()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "int QFtp::currentId () const"Returns the identifier of the FTP command that is being executed or 0 if there is no command being executed..PPSee also currentCommand()..SH "void QFtp::dataTransferProgress ( int done, int total )\fC [signal]\fR"This signal is emitted in response to a get() or put() request to indicate the current progress of the download or upload..PP\fIdone\fR is the amount of data that has already been transferred and \fItotal\fR is the total amount of data to be read or written. It is possible that the QFtp class is not able to determine the total amount of data that should be transferred, in which case \fItotal\fR is 0. (If you connect this signal to a QProgressBar, the progress bar shows a busy indicator if the total is 0)..PP\fBWarning:\fR \fIdone\fR and \fItotal\fR are not necessarily the size in bytes, since for large files these values might need to be" scaled" to avoid overflow..PPSee also get(), put(), and QProgressBar::progress..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "void QFtp::done ( bool error )\fC [signal]\fR"This signal is emitted when the last pending command has finished; (it is emitted after the last command's commandFinished() signal). \fIerror\fR is TRUE if an error occurred during the processing; otherwise \fIerror\fR is FALSE..PPSee also commandFinished(), error(), and errorString()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "Error QFtp::error () const"Returns the last error that occurred. This is useful to find out what when wrong when receiving a commandFinished() or a done() signal with the \fCerror\fR argument set to \fCTRUE\fR..PPIf you start a new command, the error status is reset to NoError..SH "QString QFtp::errorString () const"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 commandFinished() or a done() signal with the \fCerror\fR argument set to \fCTRUE\fR..PPThe 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 tr()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "int QFtp::get ( const QString & file, QIODevice * dev = 0 )"Downloads the file \fIfile\fR from the server..PPIf \fIdev\fR 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..PPIf \fIdev\fR is not 0, the data is written directly to the device \fIdev\fR. Make sure that the \fIdev\fR 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 \fInot\fR emitted and you cannot read data with the readBlcok or readAll() functions..PPIf 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..PPFor 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..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also readyRead(), dataTransferProgress(), commandStarted(), and commandFinished()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "bool QFtp::hasPendingCommands () const"Returns TRUE if there are any commands scheduled that have not yet been executed; otherwise returns FALSE..PPThe command that is being executed is \fInot\fR considered as a scheduled command..PPSee also clearPendingCommands(), currentId(), and currentCommand()..SH "int QFtp::list ( const QString & dir = QString::null )"Lists the contents of directory \fIdir\fR on the FTP server. If \fIdir\fR is empty, it lists the contents of the current directory..PPThe listInfo() signal is emitted for each directory entry found..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also listInfo(), commandStarted(), and commandFinished()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "void QFtp::listInfo ( const QUrlInfo & i )\fC [signal]\fR"This signal is emitted for each directory entry the list() command finds. The details of the entry are stored in \fIi\fR..PPSee also list()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "int QFtp::login ( const QString & user = QString::null, const QString & password = QString::null )"Logs in to the FTP server with the username \fIuser\fR and the password \fIpassword\fR..PPThe stateChanged() signal is emitted when the state of the connecting process changes, e.g. to LoggedIn..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also commandStarted() and commandFinished()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "int QFtp::mkdir ( const QString & dir )"Creates a directory called \fIdir\fR on the server..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also commandStarted() and commandFinished()..SH "int QFtp::put ( QIODevice * dev, const QString & file )"Reads the data from the IO device \fIdev\fR, and writes it to the file called \fIfile\fR 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..PPMake sure that the \fIdev\fR pointer is valid for the duration of the operation (it is safe to delete it when the commandFinished() is emitted)..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "int QFtp::put ( const QByteArray & data, const QString & file )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites the data \fIdata\fR to the file called \fIfile\fR on the server. The progress of the upload is reported by the dataTransferProgress() signal..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also dataTransferProgress(), commandStarted(), and commandFinished()..SH "int QFtp::rawCommand ( const QString & command )"Sends the raw FTP command \fIcommand\fR to the FTP server. This is useful for low-level FTP access. If the operation you wish to perform has an equivalent QFtp function, we recommend using the function instead of raw FTP commands since the functions are easier and safer..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also rawCommandReply(), commandStarted(), and commandFinished()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "void QFtp::rawCommandReply ( int replyCode, const QString & detail )\fC [signal]\fR"This signal is emitted in response to the rawCommand() function. \fIreplyCode\fR is the 3 digit reply code and \fIdetail\fR is the text that follows the reply code..PPSee also rawCommand()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "QByteArray QFtp::readAll ()"Reads all the bytes available from the data socket and returns them..PPSee also get(), readyRead(), bytesAvailable(), and readBlock()..SH "Q_LONG QFtp::readBlock ( char * data, Q_ULONG maxlen )"Reads \fImaxlen\fR bytes from the data socket into \fIdata\fR and returns the number of bytes read. Returns -1 if an error occurred..PPSee also get(), readyRead(), bytesAvailable(), and readAll()..SH "void QFtp::readyRead ()\fC [signal]\fR"This signal is emitted in response to a get() command when there is new data to read..PPIf you specify a device as the second argument in the get() command, this signal is \fInot\fR emitted; instead the data is written directly to the device..PPYou can read the data with the readAll() or readBlock() functions..PPThis 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 commandFinished() signal and read the data then instead..PPSee also get(), readBlock(), readAll(), and bytesAvailable()..SH "int QFtp::remove ( const QString & file )"Deletes the file called \fIfile\fR from the server..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also commandStarted() and commandFinished()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "int QFtp::rename ( const QString & oldname, const QString & newname )"Renames the file called \fIoldname\fR to \fInewname\fR on the server..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also commandStarted() and commandFinished()..SH "int QFtp::rmdir ( const QString & dir )"Removes the directory called \fIdir\fR from the server..PPThe 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()..PPWhen the command is started the commandStarted() signal is emitted. When it is finished the commandFinished() signal is emitted..PPSee also commandStarted() and commandFinished()..SH "State QFtp::state () const"Returns the current state of the object. When the state changes, the stateChanged() signal is emitted..PPSee also State and stateChanged()..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "void QFtp::stateChanged ( int state )\fC [signal]\fR"This signal is emitted when the state of the connection changes. The argument \fIstate\fR is the new state of the connection; it is one of the State values..PPIt is usually emitted in response to a connectToHost() or close() command, but it can also be emitted "spontaneously", e.g. when the server closes the connection unexpectedly..PPSee also connectToHost(), close(), state(), and State..PPExample: network/ftpclient/ftpmainwindow.ui.h..SH "SEE ALSO".BR http://doc.trolltech.com/qftp.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qftp.3qt) and the Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -