44 #include "QtNetwork/qauthenticator.h" 45 #include "private/qnoncontiguousbytedevice_p.h" 59 return "ftp-connection:" +
103 : ftp(0), uploadDevice(0), totalBytes(0), helpId(-1), sizeId(-1), mdtmId(-1),
104 supportsSize(false), supportsMdtm(false), state(Idle)
118 #ifndef QT_NO_NETWORKPROXY 134 tr(
"No suitable proxy found"));
148 tr(
"Cannot open %1: is a directory").arg(url.
toString()));
159 #ifndef QT_NO_BEARERMANAGEMENT 163 #ifndef QT_NO_NETWORKPROXY 243 tr(
"Logging in to %1 failed: authentication required")
282 msg =
tr(
"Error while downloading %1: %2");
284 msg =
tr(
"Error while uploading %1: %2");
358 if ((
id ==
helpId) && ((code == 200) || (code == 214))) {
366 }
else if (code == 213) {
370 #ifndef QT_NO_DATESTRING 371 }
else if (
id ==
mdtmId) {
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
void ftpRawCommandReply(int code, const QString &text)
virtual void downstreamReadyWrite()
void setUserInfo(const QString &userInfo)
Sets the user info of the URL to userInfo.
qlonglong toLongLong(bool *ok=0, int base=10) const
Returns the string converted to a long long using base base, which is 10 by default and must be betwe...
int connectToHost(const QString &host, quint16 port=21)
Connects to the FTP server host using port port.
bool requestEntry(const QByteArray &key, QObject *target, const char *member)
QByteArray readAll()
Reads all the bytes available from the data socket and returns them.
#define QT_END_NAMESPACE
This macro expands to.
static QByteArray makeCacheKey(const QUrl &url)
QPointer< QNetworkAccessCachedFtpConnection > ftp
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
QNetworkAccessCachedFtpConnection()
The QByteArray class provides an array of bytes.
QString & prepend(QChar c)
int rawCommand(const QString &command)
Sends the raw FTP command command to the FTP server.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
NetworkError
Indicates all possible error conditions found during the processing of the request.
Operation
Indicates the operation this reply is processing.
void setPath(const QString &path)
Sets the path of the URL to path.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void append(QByteDataBuffer &other)
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
int put(const QByteArray &data, const QString &file, TransferType type=Binary)
Writes a copy of the given data to the file called file on the server.
QString host() const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
The QFtp class provides an implementation of the client side of FTP protocol.
void abort()
Aborts the current command and deletes all scheduled commands.
QString path() const
Returns the path of the URL.
QUrl url() const
Returns the URL this network request is referring to.
int currentId() const
Returns the identifier of the FTP command that is being executed or 0 if there is no command being ex...
void setParent(QObject *)
Makes the object a child of parent.
int port() const
Returns the port of the URL, or -1 if the port is unspecified.
The QNetworkProxy class provides a network layer proxy.
static QString toString(Register *reg, int type, bool *ok=0)
static QDateTime fromString(const QString &s, Qt::DateFormat f=Qt::TextDate)
Returns the QDateTime represented by the string, using the format given, or an invalid datetime if th...
QNonContiguousByteDevice * createUploadByteDevice()
#define QT_BEGIN_NAMESPACE
This macro expands to.
void addEntry(const QByteArray &key, CacheableObject *entry)
int get(const QString &file, QIODevice *dev=0, TransferType type=Binary)
Downloads the file file from the server.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QNetworkAccessCache * getObjectCache(QNetworkAccessBackend *backend)
QList< QNetworkProxy > proxyList() const
static const char * data(const QByteArray &arr)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
QNetworkAccessManager::Operation operation() const
The QAuthenticator class provides an authentication object.
void ftpConnectionReady(QNetworkAccessCache::CacheableObject *object)
QByteArray toEncoded(FormattingOptions options=None) const
Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returne...
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
virtual void closeDownstreamChannel()
QString userName() const
Returns the user name of the URL if it is defined; otherwise an empty string is returned.
QString scheme() const
Returns the scheme of the URL.
void authenticationRequired(QAuthenticator *auth)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
void error(QNetworkReply::NetworkError code, const QString &errorString)
QNetworkAccessFtpBackend()
int compare(const QString &s) const
The QDateTime class provides date and time functions.
void setPort(int port)
Sets the port of the URL to port.
void setUrl(const QUrl &url)
bool isNull() const
Returns true if the authenticator is null.
QString user() const
returns the user used for authentication.
quint16 port() const
Returns the port of the proxy host.
QString errorString() const
Returns a human-readable description of the last error that occurred.
qint64 bytesAvailable() const
Returns the number of bytes that can be read from the data socket at the moment.
void writeDownstreamData(QByteDataBuffer &list)
static QIODevice * wrap(QNonContiguousByteDevice *byteDevice)
Wrap the byteDevice (possibly again) into a QIODevice.
TransferType
This enum identifies the data transfer type used with get and put commands.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
QVariant property(const char *name) const
Returns the value of the object's name property.
void setCachingEnabled(bool enable)
void releaseEntry(const QByteArray &key)
int login(const QString &user=QString(), const QString &password=QString())
Logs in to the FTP server with the username user and the password password.
QString password() const
returns the password used for authentication.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Error error() const
Returns the last error that occurred.
int setProxy(const QString &host, quint16 port)
Enables use of the FTP proxy on host host and port port.
void setUserName(const QString &userName)
Sets the URL's user name to userName.
void removeEntry(const QByteArray &key)
virtual ~QNetworkAccessFtpBackend()
QString password() const
Returns the password of the URL if it is defined; otherwise an empty string is returned.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
virtual QNetworkAccessBackend * create(QNetworkAccessManager::Operation op, const QNetworkRequest &request) const
State state() const
Returns the current state of the object.
void clear()
Clears the contents of the byte array and makes it empty.
QString hostName() const
Returns the host name of the proxy host.