1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the Qt3Support module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
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
|
---|