|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt3Support module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef Q3URLOPERATOR_H |
|
43 #define Q3URLOPERATOR_H |
|
44 |
|
45 #include <QtCore/qobject.h> |
|
46 #include <Qt3Support/q3url.h> |
|
47 #include <Qt3Support/q3ptrlist.h> |
|
48 #include <Qt3Support/q3networkprotocol.h> |
|
49 #include <QtCore/qstringlist.h> // QString->QStringList conversion |
|
50 |
|
51 QT_BEGIN_HEADER |
|
52 |
|
53 QT_BEGIN_NAMESPACE |
|
54 |
|
55 QT_MODULE(Qt3SupportLight) |
|
56 |
|
57 #ifndef QT_NO_NETWORKPROTOCOL |
|
58 |
|
59 class QUrlInfo; |
|
60 class Q3UrlOperatorPrivate; |
|
61 class Q3NetworkProtocol; |
|
62 |
|
63 class Q_COMPAT_EXPORT Q3UrlOperator : public QObject, public Q3Url |
|
64 { |
|
65 Q_OBJECT |
|
66 friend class Q3NetworkProtocol; |
|
67 |
|
68 public: |
|
69 Q3UrlOperator(); |
|
70 Q3UrlOperator( const QString &urL ); |
|
71 Q3UrlOperator( const Q3UrlOperator& url ); |
|
72 Q3UrlOperator( const Q3UrlOperator& url, const QString& relUrl, bool checkSlash = false ); |
|
73 virtual ~Q3UrlOperator(); |
|
74 |
|
75 virtual void setPath( const QString& path ); |
|
76 virtual bool cdUp(); |
|
77 |
|
78 virtual const Q3NetworkOperation *listChildren(); |
|
79 virtual const Q3NetworkOperation *mkdir( const QString &dirname ); |
|
80 virtual const Q3NetworkOperation *remove( const QString &filename ); |
|
81 virtual const Q3NetworkOperation *rename( const QString &oldname, const QString &newname ); |
|
82 virtual const Q3NetworkOperation *get( const QString &location = QString() ); |
|
83 virtual const Q3NetworkOperation *put( const QByteArray &data, const QString &location = QString() ); |
|
84 virtual Q3PtrList<Q3NetworkOperation> copy( const QString &from, const QString &to, bool move = false, bool toPath = true ); |
|
85 virtual void copy( const QStringList &files, const QString &dest, bool move = false ); |
|
86 virtual bool isDir( bool *ok = 0 ); |
|
87 |
|
88 virtual void setNameFilter( const QString &nameFilter ); |
|
89 QString nameFilter() const; |
|
90 |
|
91 virtual QUrlInfo info( const QString &entry ) const; |
|
92 |
|
93 Q3UrlOperator& operator=( const Q3UrlOperator &url ); |
|
94 Q3UrlOperator& operator=( const QString &url ); |
|
95 |
|
96 virtual void stop(); |
|
97 |
|
98 Q_SIGNALS: |
|
99 void newChildren( const Q3ValueList<QUrlInfo> &, Q3NetworkOperation *res ); |
|
100 void finished( Q3NetworkOperation *res ); |
|
101 void start( Q3NetworkOperation *res ); |
|
102 void createdDirectory( const QUrlInfo &, Q3NetworkOperation *res ); |
|
103 void removed( Q3NetworkOperation *res ); |
|
104 void itemChanged( Q3NetworkOperation *res ); |
|
105 void data( const QByteArray &, Q3NetworkOperation *res ); |
|
106 void dataTransferProgress( int bytesDone, int bytesTotal, Q3NetworkOperation *res ); |
|
107 void startedNextCopy( const Q3PtrList<Q3NetworkOperation> &lst ); |
|
108 void connectionStateChanged( int state, const QString &data ); |
|
109 |
|
110 protected: |
|
111 void reset(); |
|
112 bool parse( const QString& url ); |
|
113 virtual bool checkValid(); |
|
114 virtual void clearEntries(); |
|
115 void getNetworkProtocol(); |
|
116 void deleteNetworkProtocol(); |
|
117 |
|
118 private Q_SLOTS: |
|
119 const Q3NetworkOperation *startOperation( Q3NetworkOperation *op ); |
|
120 void copyGotData( const QByteArray &data, Q3NetworkOperation *op ); |
|
121 void continueCopy( Q3NetworkOperation *op ); |
|
122 void finishedCopy(); |
|
123 void addEntry( const Q3ValueList<QUrlInfo> &i ); |
|
124 void slotItemChanged( Q3NetworkOperation *op ); |
|
125 |
|
126 private: |
|
127 void deleteOperation( Q3NetworkOperation *op ); |
|
128 |
|
129 Q3UrlOperatorPrivate *d; |
|
130 }; |
|
131 |
|
132 #endif // QT_NO_NETWORKPROTOCOL |
|
133 |
|
134 QT_END_NAMESPACE |
|
135 |
|
136 QT_END_HEADER |
|
137 |
|
138 #endif // Q3URLOPERATOR_H |