|
1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Asynchronous FSQ Atom Class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef ASYNCHATOM_H |
|
21 #define ASYNCHATOM_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <f32file.h> |
|
25 #include <e32base.h> |
|
26 |
|
27 |
|
28 // FOR DEBUGGING |
|
29 #if defined (_DEBUG) |
|
30 #include <e32svr.h> |
|
31 #define LOGTEXT(AAA) RDebug::Print(AAA) |
|
32 #define LOGTEXT2(AAA,BBB) RDebug::Print(AAA,BBB) |
|
33 #define LOGTEXT3(AAA,BBB,CC) RDebug::Print(AAA,BBB,CC) |
|
34 #else |
|
35 #define LOGTEXT(AAA) |
|
36 #define LOGTEXT2(AAA,BBB) |
|
37 #define LOGTEXT3(AAA,BBB,CC) |
|
38 #endif |
|
39 |
|
40 |
|
41 // CONSTANTS |
|
42 |
|
43 enum TFSQAtomState |
|
44 { |
|
45 EPending, |
|
46 ESaving, |
|
47 ESavePending, |
|
48 EUploading, |
|
49 EUploadPending, |
|
50 EComplete |
|
51 }; |
|
52 |
|
53 // FORWARD DECLARATIONS |
|
54 class CAsynchFSQ; |
|
55 |
|
56 // CLASS DECLARATIONS |
|
57 |
|
58 /** |
|
59 * Asynchronous file manager queue and related operations. |
|
60 * |
|
61 * @since 3.2 |
|
62 */ |
|
63 class CAsynchFSQAtom : public CActive |
|
64 { |
|
65 |
|
66 public: // Constructor and Descructor |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 */ |
|
71 static CAsynchFSQAtom* NewL( CAsynchFSQ* aOwner, |
|
72 TInt aPriority, |
|
73 TFSQActionType aActionType, |
|
74 TDesC8& aData, |
|
75 const TDesC& aPath, |
|
76 const TDesC& aURL, |
|
77 TFSQSchemaType aSchema, |
|
78 const TDesC& aUserName, |
|
79 const TDesC& aPassword ); |
|
80 |
|
81 /** |
|
82 * Two-phased constructor. |
|
83 */ |
|
84 virtual ~CAsynchFSQAtom(); |
|
85 |
|
86 public: // Data |
|
87 |
|
88 |
|
89 |
|
90 public: // Public member functions |
|
91 |
|
92 /** |
|
93 * C++ default constructor. |
|
94 */ |
|
95 CAsynchFSQAtom(); |
|
96 |
|
97 /** |
|
98 * By default Symbian 2nd phase constructor is private. |
|
99 */ |
|
100 void ConstructL( CAsynchFSQ* aOwner, |
|
101 TInt aPriority, |
|
102 TFSQActionType aActionType, |
|
103 TDesC8& aData, |
|
104 const TDesC& aPath, |
|
105 const TDesC& aURL, |
|
106 TFSQSchemaType aSchema, |
|
107 const TDesC& aUserName, |
|
108 const TDesC& aPassword ); |
|
109 |
|
110 /** |
|
111 * |
|
112 */ |
|
113 TInt Go(); |
|
114 |
|
115 /** |
|
116 * |
|
117 */ |
|
118 TInt ActionsLeft(); |
|
119 |
|
120 /** |
|
121 * |
|
122 */ |
|
123 TFSQAtomState GetState(); |
|
124 |
|
125 /** |
|
126 * |
|
127 */ |
|
128 TBool DoesLocalSave(); |
|
129 |
|
130 /** |
|
131 * |
|
132 */ |
|
133 const TDesC& GetPath() const; |
|
134 |
|
135 /** |
|
136 * |
|
137 */ |
|
138 TInt DeleteLocal(); |
|
139 |
|
140 /** |
|
141 * |
|
142 */ |
|
143 TInt RenameLocal( const TDesC& aNew ); |
|
144 |
|
145 private: // Private member functions |
|
146 |
|
147 /** |
|
148 * From CActive |
|
149 */ |
|
150 void RunL(); |
|
151 |
|
152 /** |
|
153 * From CActive |
|
154 */ |
|
155 void DoCancel(); |
|
156 |
|
157 /** |
|
158 * From CActive |
|
159 */ |
|
160 TInt RunError( TInt aError ); |
|
161 |
|
162 /** |
|
163 * |
|
164 */ |
|
165 void SaveL(); |
|
166 |
|
167 /** |
|
168 * |
|
169 */ |
|
170 void SaveCleanupL(); |
|
171 |
|
172 /** |
|
173 * |
|
174 */ |
|
175 void UploadL(); |
|
176 |
|
177 /** |
|
178 * |
|
179 */ |
|
180 void UploadCleanupL(); |
|
181 |
|
182 private: // Private data members |
|
183 |
|
184 // Activity specific items |
|
185 TFSQActionType iActionType; |
|
186 TDesC8* iData; |
|
187 HBufC* iPath; // EFileSave only |
|
188 HBufC* iURL; // EWebUpload only |
|
189 TFSQSchemaType iSchema; // EWebUpload only |
|
190 HBufC* iUserName; // EWebUpload only |
|
191 HBufC* iPassword; // EWebUpload only |
|
192 |
|
193 // Variables specifics to owning class |
|
194 CAsynchFSQ* iOwner; |
|
195 TInt iError; |
|
196 TBool iOverwrite; |
|
197 |
|
198 // State machine variable |
|
199 TFSQAtomState iState; |
|
200 |
|
201 // Helper variables |
|
202 RFile iFile; |
|
203 RFs iFs; |
|
204 TBool iDelayedLocalDelete; |
|
205 TBool iDelayedLocalRename; |
|
206 HBufC* iDelayedFileName; |
|
207 |
|
208 }; |
|
209 |
|
210 #endif // CAsynchATOM_H |