1 | /****************************************************************************
|
---|
2 | ** $Id: qurloperator.h 2 2005-11-16 15:49:26Z dmik $
|
---|
3 | **
|
---|
4 | ** Definition of QUrlOperator class
|
---|
5 | **
|
---|
6 | ** Created : 950429
|
---|
7 | **
|
---|
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
|
---|
9 | **
|
---|
10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
11 | **
|
---|
12 | ** This file may be distributed under the terms of the Q Public License
|
---|
13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
14 | ** LICENSE.QPL included in the packaging of this file.
|
---|
15 | **
|
---|
16 | ** This file may be distributed and/or modified under the terms of the
|
---|
17 | ** GNU General Public License version 2 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
19 | ** packaging of this file.
|
---|
20 | **
|
---|
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
22 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
23 | ** Agreement provided with the Software.
|
---|
24 | **
|
---|
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
27 | **
|
---|
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
29 | ** information about Qt Commercial License Agreements.
|
---|
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
32 | **
|
---|
33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
34 | ** not clear to you.
|
---|
35 | **
|
---|
36 | **********************************************************************/
|
---|
37 |
|
---|
38 | #ifndef QURLOPERATOR_H
|
---|
39 | #define QURLOPERATOR_H
|
---|
40 |
|
---|
41 | #ifndef QT_H
|
---|
42 | #include "qobject.h"
|
---|
43 | #include "qurl.h"
|
---|
44 | #include "qptrlist.h"
|
---|
45 | #include "qnetworkprotocol.h"
|
---|
46 | #include "qstringlist.h" // QString->QStringList conversion
|
---|
47 | #endif // QT_H
|
---|
48 |
|
---|
49 | #ifndef QT_NO_NETWORKPROTOCOL
|
---|
50 |
|
---|
51 | class QUrlInfo;
|
---|
52 | class QUrlOperatorPrivate;
|
---|
53 |
|
---|
54 | class Q_EXPORT QUrlOperator : public QObject, public QUrl
|
---|
55 | {
|
---|
56 | friend class QNetworkProtocol;
|
---|
57 |
|
---|
58 | Q_OBJECT
|
---|
59 |
|
---|
60 | public:
|
---|
61 | QUrlOperator();
|
---|
62 | QUrlOperator( const QString &urL );
|
---|
63 | QUrlOperator( const QUrlOperator& url );
|
---|
64 | QUrlOperator( const QUrlOperator& url, const QString& relUrl, bool checkSlash = FALSE );
|
---|
65 | virtual ~QUrlOperator();
|
---|
66 |
|
---|
67 | virtual void setPath( const QString& path );
|
---|
68 | virtual bool cdUp();
|
---|
69 |
|
---|
70 | virtual const QNetworkOperation *listChildren();
|
---|
71 | virtual const QNetworkOperation *mkdir( const QString &dirname );
|
---|
72 | virtual const QNetworkOperation *remove( const QString &filename );
|
---|
73 | virtual const QNetworkOperation *rename( const QString &oldname, const QString &newname );
|
---|
74 | virtual const QNetworkOperation *get( const QString &location = QString::null );
|
---|
75 | virtual const QNetworkOperation *put( const QByteArray &data, const QString &location = QString::null );
|
---|
76 | virtual QPtrList<QNetworkOperation> copy( const QString &from, const QString &to, bool move = FALSE, bool toPath = TRUE );
|
---|
77 | virtual void copy( const QStringList &files, const QString &dest, bool move = FALSE );
|
---|
78 | virtual bool isDir( bool *ok = 0 );
|
---|
79 |
|
---|
80 | virtual void setNameFilter( const QString &nameFilter );
|
---|
81 | QString nameFilter() const;
|
---|
82 |
|
---|
83 | virtual QUrlInfo info( const QString &entry ) const;
|
---|
84 |
|
---|
85 | QUrlOperator& operator=( const QUrlOperator &url );
|
---|
86 | QUrlOperator& operator=( const QString &url );
|
---|
87 |
|
---|
88 | virtual void stop();
|
---|
89 |
|
---|
90 | signals:
|
---|
91 | void newChildren( const QValueList<QUrlInfo> &, QNetworkOperation *res );
|
---|
92 | void finished( QNetworkOperation *res );
|
---|
93 | void start( QNetworkOperation *res );
|
---|
94 | void createdDirectory( const QUrlInfo &, QNetworkOperation *res );
|
---|
95 | void removed( QNetworkOperation *res );
|
---|
96 | void itemChanged( QNetworkOperation *res );
|
---|
97 | void data( const QByteArray &, QNetworkOperation *res );
|
---|
98 | void dataTransferProgress( int bytesDone, int bytesTotal, QNetworkOperation *res );
|
---|
99 | void startedNextCopy( const QPtrList<QNetworkOperation> &lst );
|
---|
100 | void connectionStateChanged( int state, const QString &data );
|
---|
101 |
|
---|
102 | protected:
|
---|
103 | void reset();
|
---|
104 | bool parse( const QString& url );
|
---|
105 | virtual bool checkValid();
|
---|
106 | virtual void clearEntries();
|
---|
107 | void getNetworkProtocol();
|
---|
108 | void deleteNetworkProtocol();
|
---|
109 |
|
---|
110 | private slots:
|
---|
111 | const QNetworkOperation *startOperation( QNetworkOperation *op );
|
---|
112 | void copyGotData( const QByteArray &data, QNetworkOperation *op );
|
---|
113 | void continueCopy( QNetworkOperation *op );
|
---|
114 | void finishedCopy();
|
---|
115 | void addEntry( const QValueList<QUrlInfo> &i );
|
---|
116 | void slotItemChanged( QNetworkOperation *op );
|
---|
117 |
|
---|
118 | private:
|
---|
119 | void deleteOperation( QNetworkOperation *op );
|
---|
120 |
|
---|
121 | QUrlOperatorPrivate *d;
|
---|
122 | };
|
---|
123 |
|
---|
124 | #endif // QT_NO_NETWORKPROTOCOL
|
---|
125 |
|
---|
126 | #endif // QURLOPERATOR_H
|
---|