1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the Qt 3 compatibility classes of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#ifndef Q3NETWORKPROTOCOL_H
30
#define Q3NETWORKPROTOCOL_H
33
#include "QtNetwork/qurlinfo.h"
34
#include "QtCore/qstring.h"
35
#include "Qt3Support/q3dict.h"
36
#include "QtCore/qobject.h"
37
#include "Qt3Support/q3valuelist.h"
40
#ifndef QT_NO_NETWORKPROTOCOL
42
class Q3NetworkProtocol;
43
class Q3NetworkOperation;
46
class Q3NetworkProtocolPrivate;
47
template <class T> class Q3ValueList;
49
class Q_COMPAT_EXPORT Q3NetworkProtocolFactoryBase
52
virtual ~Q3NetworkProtocolFactoryBase() {}
53
virtual Q3NetworkProtocol *createObject() = 0;
56
template< class Protocol >
57
class Q3NetworkProtocolFactory : public Q3NetworkProtocolFactoryBase
60
Q3NetworkProtocol *createObject() {
66
typedef Q3Dict< Q3NetworkProtocolFactoryBase > Q3NetworkProtocolDict;
68
class Q_COMPAT_EXPORT Q3NetworkProtocol : public QObject
84
OpMkdir = OpMkDir, // ### remove in 4.0
91
enum ConnectionState {
110
ErrListChlidren = ErrListChildren, // ### remove in 4.0
112
ErrMkdir = ErrMkDir, // ### remove in 4.0
122
virtual ~Q3NetworkProtocol();
124
virtual void setUrl( Q3UrlOperator *u );
126
virtual void setAutoDelete( bool b, int i = 10000 );
127
bool autoDelete() const;
129
static void registerNetworkProtocol( const QString &protocol,
130
Q3NetworkProtocolFactoryBase *protocolFactory );
131
static Q3NetworkProtocol *getNetworkProtocol( const QString &protocol );
132
static bool hasOnlyLocalFileSystem();
134
virtual int supportedOperations() const;
135
virtual void addOperation( Q3NetworkOperation *op );
137
Q3UrlOperator *url() const;
138
Q3NetworkOperation *operationInProgress() const;
139
virtual void clearOperationQueue();
143
void data( const QByteArray &, Q3NetworkOperation *res );
144
void connectionStateChanged( int state, const QString &data );
145
void finished( Q3NetworkOperation *res );
146
void start( Q3NetworkOperation *res );
147
void newChildren( const Q3ValueList<QUrlInfo> &, Q3NetworkOperation *res );
148
void newChild( const QUrlInfo &, Q3NetworkOperation *res );
149
void createdDirectory( const QUrlInfo &, Q3NetworkOperation *res );
150
void removed( Q3NetworkOperation *res );
151
void itemChanged( Q3NetworkOperation *res );
152
void dataTransferProgress( int bytesDone, int bytesTotal, Q3NetworkOperation *res );
155
virtual void processOperation( Q3NetworkOperation *op );
156
virtual void operationListChildren( Q3NetworkOperation *op );
157
virtual void operationMkDir( Q3NetworkOperation *op );
158
virtual void operationRemove( Q3NetworkOperation *op );
159
virtual void operationRename( Q3NetworkOperation *op );
160
virtual void operationGet( Q3NetworkOperation *op );
161
virtual void operationPut( Q3NetworkOperation *op );
162
virtual void operationPutChunk( Q3NetworkOperation *op );
163
virtual bool checkConnection( Q3NetworkOperation *op );
166
Q3NetworkProtocolPrivate *d;
169
void processNextOperation( Q3NetworkOperation *old );
171
void emitNewChildren( const QUrlInfo &i, Q3NetworkOperation *op );
175
private: // Disabled copy constructor and operator=
176
#if defined(Q_DISABLE_COPY)
177
Q3NetworkProtocol( const Q3NetworkProtocol & );
178
Q3NetworkProtocol &operator=( const Q3NetworkProtocol & );
182
class Q3NetworkOperationPrivate;
184
class Q_COMPAT_EXPORT Q3NetworkOperation : public QObject
187
friend class Q3UrlOperator;
190
Q3NetworkOperation( Q3NetworkProtocol::Operation operation,
191
const QString &arg0, const QString &arg1,
192
const QString &arg2 );
193
Q3NetworkOperation( Q3NetworkProtocol::Operation operation,
194
const QByteArray &arg0, const QByteArray &arg1,
195
const QByteArray &arg2 );
196
~Q3NetworkOperation();
198
void setState( Q3NetworkProtocol::State state );
199
void setProtocolDetail( const QString &detail );
200
void setErrorCode( int ec );
201
void setArg( int num, const QString &arg );
202
void setRawArg( int num, const QByteArray &arg );
204
Q3NetworkProtocol::Operation operation() const;
205
Q3NetworkProtocol::State state() const;
206
QString arg( int num ) const;
207
QByteArray rawArg( int num ) const;
208
QString protocolDetail() const;
209
int errorCode() const;
217
QByteArray &raw( int num ) const;
218
Q3NetworkOperationPrivate *d;
220
private: // Disabled copy constructor and operator=
221
#if defined(Q_DISABLE_COPY)
222
Q3NetworkOperation( const Q3NetworkOperation & );
223
Q3NetworkOperation &operator=( const Q3NetworkOperation & );
227
#endif // QT_NO_NETWORKPROTOCOL
229
#endif // Q3NETWORKPROTOCOL_H