48 #include <qtcpsocket.h>
49 #include <qtcpserver.h>
50 #include <qstringlist.h>
51 #include <qbytearray.h>
57 class QFtp :
public QObject
62 explicit QFtp(QObject * parent = 0);
111 int setProxy(
const QString & host, quint16 port);
113 int login(
const QString & user = QString(),
const QString & password = QString());
116 int list(
const QString & dir = QString());
117 int cd(
const QString & dir);
121 int remove(
const QString & file);
122 int mkdir(
const QString & dir);
123 int rmdir(
const QString & dir);
124 int rename(
const QString & oldname,
const QString & newname);
129 qint64
read(
char * data, qint64 maxlen);
188 QFtpDTP(QFtpPI *
p, QObject * parent = 0);
190 void setData(QByteArray *);
191 void setDevice(QIODevice *);
193 void setBytesTotal(qint64 bytes);
195 bool hasError()
const;
196 QString errorMessage()
const;
200 int setupListener(
const QHostAddress & address);
201 void waitForConnection();
203 QTcpSocket::SocketState
state()
const;
205 qint64
read(
char * data, qint64 maxlen);
208 void abortConnection();
210 static bool parseDir(
const QByteArray & buffer,
const QString & userName,
QUrlInfo * info);
217 void connectState(
int);
220 void socketConnected();
221 void socketReadyRead();
222 void socketError(QAbstractSocket::SocketError);
223 void socketConnectionClosed();
224 void socketBytesWritten(qint64);
227 void dataReadyRead();
263 QFtpPI(QObject * parent = 0);
267 bool sendCommands(
const QStringList & cmds);
270 return sendCommands(QStringList(cmd));
287 void connectState(
int);
288 void finished(
const QString &);
289 void error(
int,
const QString &);
290 void rawFtpReply(
int,
const QString &);
295 void connectionClosed();
296 void delayedCloseFinished();
298 void error(QAbstractSocket::SocketError);
300 void dtpConnectState(
int);
bool transferConnectionExtended
Definition: qftp.h:282
QString currentCommand() const
Definition: qftp.h:276
int connectToHost(const QString &host, quint16 port=21)
Definition: qftp.cpp:1600
bool callWriteData
Definition: qftp.h:239
QByteArray readAll()
Definition: qftp.cpp:1988
void _q_piError(int, const QString &)
Definition: qftp.cpp:1377
State state
Definition: qftp.h:327
void _q_piFinished(const QString &)
Definition: qftp.cpp:1373
int cd(const QString &dir)
Definition: qftp.cpp:1729
State
Definition: NotifierSettings.h:61
void _q_piFtpReply(int, const QString &)
Definition: qftp.cpp:1385
qint64 bytesTotal
Definition: qftp.h:238
int rawCommand(const QString &command)
Definition: qftp.cpp:1949
QString currentCmd
Definition: qftp.h:330
Command
Definition: qftp.h:82
State
Definition: qftp.h:65
int rmdir(const QString &dir)
Definition: qftp.cpp:1904
int put(const QByteArray &data, const QString &file, TransferType type=Binary)
Definition: qftp.cpp:1811
Definition: qftp.cpp:1186
The QFtp class provides an implementation of the client side of FTP protocol.
Definition: qftp.h:57
int setTransferMode(TransferMode mode)
Definition: qftp.cpp:1664
void abort()
Definition: qftp.cpp:2022
QIODevice * currentDevice() const
Definition: qftp.cpp:2067
QString type()
Definition: KviRuntimeInfo.cpp:646
bool hasPendingCommands() const
Definition: qftp.cpp:2086
ConnectState
Definition: qftp.h:179
The QUrlInfo class stores information about URLs.
Definition: qurlinfo.h:54
TransferMode
Definition: qftp.h:100
bool waitForDtpToConnect
Definition: qftp.h:332
qint64 read(char *data, qint64 maxlen)
Definition: qftp.cpp:1977
void clearPendingCommands()
Definition: qftp.cpp:2098
Error
Definition: qftp.h:74
QString replyText
Definition: qftp.h:325
void commandFinished(int, bool)
QString err
Definition: qftp.h:236
QTcpSocket * socket
Definition: qftp.h:232
QByteArray * ba
Definition: qftp.h:244
void dataTransferProgress(qint64, qint64)
void listInfo(const QUrlInfo &)
QIODevice * dev
Definition: qftp.h:245
int mkdir(const QString &dir)
Definition: qftp.cpp:1885
bool waitForDtpToClose
Definition: qftp.h:333
AbortState abortState
Definition: qftp.h:328
void _q_startNextCommand()
Definition: qftp.cpp:1369
bool is_ba
Definition: qftp.h:247
QScopedPointer< QFtpPrivate > d
Definition: qftp.h:159
qint64 bytesDone
Definition: qftp.h:237
QFtp(QObject *parent=0)
Definition: qftp.cpp:1347
int list(const QString &dir=QString())
Definition: qftp.cpp:1703
int currentId() const
Definition: qftp.cpp:2037
int rename(const QString &oldname, const QString &newname)
Definition: qftp.cpp:1923
qint64 bytesAvailable() const
Definition: qftp.cpp:1961
Error error() const
Definition: qftp.cpp:2123
QString errorString() const
Definition: qftp.cpp:2139
int close()
Definition: qftp.cpp:1654
QTcpSocket commandSocket
Definition: qftp.h:324
TransferType
Definition: qftp.h:105
QByteArray bytesFromSocket
Definition: qftp.h:335
QStringList pendingCommands
Definition: qftp.h:329
QTcpServer listener
Definition: qftp.h:233
void rawCommandReply(int, const QString &)
void _q_piConnectState(int)
Definition: qftp.cpp:1381
virtual ~QFtp()
Definition: qftp.cpp:2383
int login(const QString &user=QString(), const QString &password=QString())
Definition: qftp.cpp:1628
State
Definition: qftp.h:305
int setProxy(const QString &host, quint16 port)
Definition: qftp.cpp:1679
QByteArray bytesFromSocket
Definition: qftp.h:249
bool sendCommand(const QString &cmd)
Definition: qftp.h:268
#define p
Definition: detector.cpp:80
State state() const
Definition: qftp.cpp:2111
QFtpDTP dtp
Definition: qftp.h:284
AbortState
Definition: qftp.h:314
Command currentCommand() const
Definition: qftp.cpp:2050
bool rawCommand
Definition: qftp.h:281
QFtpPI * pi
Definition: qftp.h:235