// qftp.sip generated by MetaSIP on Fri Sep 28 17:07:47 2007 // // This file is part of the QtNetwork Python extension module. // // Copyright (c) 2007 // Phil Thompson // // This file is part of PyQt. // // This copy of PyQt is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License version 2 as published by // the Free Software Foundation and appearing in the file LICENSE included in the // packaging of this file. // // PyQt is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // PyQt; see the file LICENSE. If not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class QFtp : QObject { %TypeHeaderCode #include %End public: explicit QFtp(QObject *parent /TransferThis/ = 0); virtual ~QFtp(); enum State { Unconnected, HostLookup, Connecting, Connected, LoggedIn, Closing, }; enum Error { NoError, UnknownError, HostNotFound, ConnectionRefused, NotConnected, }; enum Command { None, SetTransferMode, SetProxy, ConnectToHost, Login, Close, List, Cd, Get, Put, Remove, Mkdir, Rmdir, Rename, RawCommand, }; enum TransferMode { Active, Passive, }; enum TransferType { Binary, Ascii, }; int setProxy(const QString &host, quint16 port); int connectToHost(const QString &host, quint16 port = 21) /ReleaseGIL/; int login(const QString &user = QString(), const QString &password = QString()) /ReleaseGIL/; int close() /ReleaseGIL/; int setTransferMode(QFtp::TransferMode mode); int list(const QString &dir = QString()) /ReleaseGIL/; int cd(const QString &dir) /ReleaseGIL/; int get(const QString &file, QIODevice *dev = 0, QFtp::TransferType type = QFtp::Binary) /ReleaseGIL/; int put(const QByteArray &data, const QString &file, QFtp::TransferType type = QFtp::Binary) /ReleaseGIL/; int put(QIODevice *dev, const QString &file, QFtp::TransferType type = QFtp::Binary) /ReleaseGIL/; int remove(const QString &file) /ReleaseGIL/; int mkdir(const QString &dir) /ReleaseGIL/; int rmdir(const QString &dir) /ReleaseGIL/; int rename(const QString &oldname, const QString &newname) /ReleaseGIL/; int rawCommand(const QString &command) /ReleaseGIL/; qint64 bytesAvailable() const; SIP_PYOBJECT read(qint64 maxlen) /ReleaseGIL/; %MethodCode // Return the data read or None if there was an error. char *s; if ((s = (char *)sipMalloc(a0)) == NULL) sipIsErr = 1; else { qint64 len; Py_BEGIN_ALLOW_THREADS len = sipCpp->read(s, a0); Py_END_ALLOW_THREADS if (len < 0) { Py_INCREF(Py_None); sipRes = Py_None; } else { sipRes = PyString_FromStringAndSize(s, len); if (sipRes == NULL) sipIsErr = 1; } sipFree((ANY *)s); } %End QByteArray readAll() /ReleaseGIL/; int currentId() const; QIODevice *currentDevice() const; QFtp::Command currentCommand() const; bool hasPendingCommands() const; void clearPendingCommands(); QFtp::State state() const; QFtp::Error error() const; QString errorString() const; public slots: void abort(); signals: void stateChanged(int); void listInfo(const QUrlInfo &); void readyRead(); void dataTransferProgress(qint64, qint64); void rawCommandReply(int, const QString &); void commandStarted(int); void commandFinished(int, bool); void done(bool); private: QFtp(const QFtp &); };