[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qftp.h:1 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>qftp.h Include File</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qftp.h</h1>
|
---|
| 33 |
|
---|
| 34 | <p>This is the verbatim text of the qftp.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
| 35 | <hr>
|
---|
| 36 | <pre>
|
---|
| 37 | /****************************************************************************
|
---|
| 38 | ** $Id: qftp-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
| 39 | **
|
---|
| 40 | ** Definition of QFtp class.
|
---|
| 41 | **
|
---|
| 42 | ** Created : 970521
|
---|
| 43 | **
|
---|
| 44 | ** Copyright (C) 1997-2007 Trolltech ASA. All rights reserved.
|
---|
| 45 | **
|
---|
| 46 | ** This file is part of the network module of the Qt GUI Toolkit.
|
---|
| 47 | **
|
---|
| 48 | ** This file may be distributed under the terms of the Q Public License
|
---|
| 49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
| 50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
| 51 | **
|
---|
| 52 | ** This file may be distributed and/or modified under the terms of the
|
---|
| 53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
| 54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 55 | ** packaging of this file.
|
---|
| 56 | **
|
---|
| 57 | ** Licensees holding valid Qt Enterprise Edition licenses may use this
|
---|
| 58 | ** file in accordance with the Qt Commercial License Agreement provided
|
---|
| 59 | ** with the Software.
|
---|
| 60 | **
|
---|
| 61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 63 | **
|
---|
| 64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 65 | ** information about Qt Commercial License Agreements.
|
---|
| 66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
| 67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
| 68 | **
|
---|
| 69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 70 | ** not clear to you.
|
---|
| 71 | **
|
---|
| 72 | **********************************************************************/
|
---|
| 73 |
|
---|
| 74 | #ifndef QFTP_H
|
---|
| 75 | #define QFTP_H
|
---|
| 76 |
|
---|
| 77 | #ifndef QT_H
|
---|
| 78 | #include "qstring.h" // char*->QString conversion
|
---|
| 79 | #include "qurlinfo.h"
|
---|
| 80 | #include "qnetworkprotocol.h"
|
---|
| 81 | #endif // QT_H
|
---|
| 82 |
|
---|
| 83 | #if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK )
|
---|
| 84 | #define QM_EXPORT_FTP
|
---|
| 85 | #else
|
---|
| 86 | #define QM_EXPORT_FTP Q_EXPORT
|
---|
| 87 | #endif
|
---|
| 88 |
|
---|
| 89 | #ifndef QT_NO_NETWORKPROTOCOL_FTP
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 | class QSocket;
|
---|
| 93 | class QFtpCommand;
|
---|
| 94 |
|
---|
| 95 | class QM_EXPORT_FTP QFtp : public QNetworkProtocol
|
---|
| 96 | {
|
---|
| 97 | Q_OBJECT
|
---|
| 98 |
|
---|
| 99 | public:
|
---|
| 100 | QFtp(); // ### Qt 4.0: get rid of this overload
|
---|
| 101 | QFtp( QObject *parent, const char *name=0 );
|
---|
| 102 | virtual ~QFtp();
|
---|
| 103 |
|
---|
| 104 | int supportedOperations() const;
|
---|
| 105 |
|
---|
| 106 | // non-QNetworkProtocol functions:
|
---|
| 107 | enum State {
|
---|
| 108 | Unconnected,
|
---|
| 109 | HostLookup,
|
---|
| 110 | Connecting,
|
---|
| 111 | Connected,
|
---|
| 112 | LoggedIn,
|
---|
| 113 | Closing
|
---|
| 114 | };
|
---|
| 115 | enum Error {
|
---|
| 116 | NoError,
|
---|
| 117 | UnknownError,
|
---|
| 118 | HostNotFound,
|
---|
| 119 | ConnectionRefused,
|
---|
| 120 | NotConnected
|
---|
| 121 | };
|
---|
| 122 | enum Command {
|
---|
| 123 | None,
|
---|
| 124 | ConnectToHost,
|
---|
| 125 | Login,
|
---|
| 126 | Close,
|
---|
| 127 | List,
|
---|
| 128 | Cd,
|
---|
| 129 | Get,
|
---|
| 130 | Put,
|
---|
| 131 | Remove,
|
---|
| 132 | Mkdir,
|
---|
| 133 | Rmdir,
|
---|
| 134 | Rename,
|
---|
| 135 | RawCommand
|
---|
| 136 | };
|
---|
| 137 |
|
---|
| 138 | int connectToHost( const QString &host, Q_UINT16 port=21 );
|
---|
| 139 | int login( const QString &user=QString::null, const QString &password=QString::null );
|
---|
| 140 | int close();
|
---|
| 141 | int list( const QString &dir=QString::null );
|
---|
| 142 | int cd( const QString &dir );
|
---|
| 143 | int get( const QString &file, QIODevice *dev=0 );
|
---|
| 144 | int put( const QByteArray &data, const QString &file );
|
---|
| 145 | int put( QIODevice *dev, const QString &file );
|
---|
| 146 | int remove( const QString &file );
|
---|
| 147 | int mkdir( const QString &dir );
|
---|
| 148 | int rmdir( const QString &dir );
|
---|
| 149 | int rename( const QString &oldname, const QString &newname );
|
---|
| 150 |
|
---|
| 151 | int rawCommand( const QString &command );
|
---|
| 152 |
|
---|
| 153 | Q_ULONG bytesAvailable() const;
|
---|
| 154 | Q_LONG readBlock( char *data, Q_ULONG maxlen );
|
---|
| 155 | QByteArray readAll();
|
---|
| 156 |
|
---|
| 157 | int currentId() const;
|
---|
| 158 | QIODevice* currentDevice() const;
|
---|
| 159 | Command currentCommand() const;
|
---|
| 160 | bool hasPendingCommands() const;
|
---|
| 161 | void clearPendingCommands();
|
---|
| 162 |
|
---|
| 163 | State state() const;
|
---|
| 164 |
|
---|
| 165 | Error error() const;
|
---|
| 166 | QString errorString() const;
|
---|
| 167 |
|
---|
| 168 | public slots:
|
---|
| 169 | void abort();
|
---|
| 170 |
|
---|
| 171 | signals:
|
---|
| 172 | void stateChanged( int );
|
---|
| 173 | void listInfo( const QUrlInfo& );
|
---|
| 174 | void readyRead();
|
---|
| 175 | void dataTransferProgress( int, int );
|
---|
| 176 | void rawCommandReply( int, const QString& );
|
---|
| 177 |
|
---|
| 178 | void commandStarted( int );
|
---|
| 179 | void commandFinished( int, bool );
|
---|
| 180 | void done( bool );
|
---|
| 181 |
|
---|
| 182 | protected:
|
---|
| 183 | void parseDir( const QString &buffer, QUrlInfo &info ); // ### Qt 4.0: delete this? (not public API)
|
---|
| 184 | void operationListChildren( QNetworkOperation *op );
|
---|
| 185 | void operationMkDir( QNetworkOperation *op );
|
---|
| 186 | void operationRemove( QNetworkOperation *op );
|
---|
| 187 | void operationRename( QNetworkOperation *op );
|
---|
| 188 | void operationGet( QNetworkOperation *op );
|
---|
| 189 | void operationPut( QNetworkOperation *op );
|
---|
| 190 |
|
---|
| 191 | // ### Qt 4.0: delete these
|
---|
| 192 | // unused variables:
|
---|
| 193 | QSocket *commandSocket, *dataSocket;
|
---|
| 194 | bool connectionReady, passiveMode;
|
---|
| 195 | int getTotalSize, getDoneSize;
|
---|
| 196 | bool startGetOnFail;
|
---|
| 197 | int putToWrite, putWritten;
|
---|
| 198 | bool errorInListChildren;
|
---|
| 199 |
|
---|
| 200 | private:
|
---|
| 201 | void init();
|
---|
| 202 | int addCommand( QFtpCommand * );
|
---|
| 203 |
|
---|
| 204 | bool checkConnection( QNetworkOperation *op );
|
---|
| 205 |
|
---|
| 206 | private slots:
|
---|
| 207 | void startNextCommand();
|
---|
| 208 | void piFinished( const QString& );
|
---|
| 209 | void piError( int, const QString& );
|
---|
| 210 | void piConnectState( int );
|
---|
| 211 | void piFtpReply( int, const QString& );
|
---|
| 212 |
|
---|
| 213 | private slots:
|
---|
| 214 | void npListInfo( const QUrlInfo & );
|
---|
| 215 | void npDone( bool );
|
---|
| 216 | void npStateChanged( int );
|
---|
| 217 | void npDataTransferProgress( int, int );
|
---|
| 218 | void npReadyRead();
|
---|
| 219 |
|
---|
| 220 | protected slots:
|
---|
| 221 | // ### Qt 4.0: delete these
|
---|
| 222 | void hostFound();
|
---|
| 223 | void connected();
|
---|
| 224 | void closed();
|
---|
| 225 | void dataHostFound();
|
---|
| 226 | void dataConnected();
|
---|
| 227 | void dataClosed();
|
---|
| 228 | void dataReadyRead();
|
---|
| 229 | void dataBytesWritten( int nbytes );
|
---|
| 230 | void error( int );
|
---|
| 231 | };
|
---|
| 232 |
|
---|
| 233 | #endif // QT_NO_NETWORKPROTOCOL_FTP
|
---|
| 234 |
|
---|
| 235 | #endif // QFTP_H
|
---|
| 236 | </pre>
|
---|
| 237 | <!-- eof -->
|
---|
| 238 | <p><address><hr><div align=center>
|
---|
| 239 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 240 | <td>Copyright © 2007
|
---|
| 241 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 242 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 243 | </table></div></address></body>
|
---|
| 244 | </html>
|
---|