|
1 /* |
|
2 * Copyright (c) 2005 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: Utility class to handle sync phases during progress |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ASPSTATE_H |
|
20 #define ASPSTATE_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 const TInt KTotalProgressUnknown = -1; |
|
30 const TInt KTotalProgress = 100; |
|
31 |
|
32 |
|
33 /** |
|
34 * CAspState |
|
35 * |
|
36 * CAspState contains sync state information. |
|
37 */ |
|
38 NONSHARABLE_CLASS (CAspState) : public CBase |
|
39 { |
|
40 public: |
|
41 enum TSyncPhase |
|
42 { |
|
43 EPhaseConnecting = 0, |
|
44 EPhaseInitialising, |
|
45 EPhaseSending, |
|
46 EPhaseReceiving, |
|
47 EPhaseSynchronizing, |
|
48 EPhaseDisconnecting, |
|
49 EPhaseCanceling, |
|
50 EPhaseNone |
|
51 }; |
|
52 |
|
53 |
|
54 public: |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 */ |
|
58 static CAspState* NewL(); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 ~CAspState(); |
|
64 |
|
65 private: |
|
66 /** |
|
67 * C++ default constructor. |
|
68 */ |
|
69 CAspState(); |
|
70 |
|
71 /** |
|
72 * By default Symbian 2nd phase constructor is private. |
|
73 */ |
|
74 void ConstructL(); |
|
75 |
|
76 public: |
|
77 /** |
|
78 * Reset state variables. |
|
79 * @param None. |
|
80 * @return None. |
|
81 */ |
|
82 void Reset(); |
|
83 |
|
84 public: |
|
85 /** |
|
86 * Set synchronization phase. |
|
87 * @param aPhase synchronization phase. |
|
88 * @return None. |
|
89 */ |
|
90 void SetSyncPhase(TInt aPhase); |
|
91 |
|
92 /** |
|
93 * Get synchronization phase. |
|
94 * @param None. |
|
95 * @return Synchronization phase. |
|
96 */ |
|
97 TInt SyncPhase(); |
|
98 |
|
99 /** |
|
100 * Set total sync progress. |
|
101 * @param aCount Progress count. |
|
102 * @return None. |
|
103 */ |
|
104 void SetTotalProgress(TInt aCount); |
|
105 |
|
106 /** |
|
107 * Set sync progress. |
|
108 * @param aCount Progress count. |
|
109 * @return None. |
|
110 */ |
|
111 //void SetProgress(TInt aCount); |
|
112 |
|
113 /** |
|
114 * Get total sync progress. |
|
115 * @param None. |
|
116 * @return Progress count. |
|
117 */ |
|
118 TInt TotalProgress(); |
|
119 |
|
120 /** |
|
121 * Increase sync progress. |
|
122 * @param None. |
|
123 * @return None. |
|
124 */ |
|
125 void IncreaseProgress(); |
|
126 |
|
127 /** |
|
128 * Increase sync progress. |
|
129 * @param aCount. |
|
130 * @return None. |
|
131 */ |
|
132 void IncreaseProgress(TInt aCount); |
|
133 |
|
134 /** |
|
135 * Get sync progress. |
|
136 * @param None. |
|
137 * @return Progress count. |
|
138 */ |
|
139 TInt Progress(); |
|
140 |
|
141 /** |
|
142 * Has IncreaseProgress been called once. |
|
143 * @param None. |
|
144 * @return Boolean. |
|
145 */ |
|
146 TBool FirstProgress(); |
|
147 |
|
148 /** |
|
149 * Set sync content name. |
|
150 * @param aText Content name. |
|
151 * @return None. |
|
152 */ |
|
153 void SetContentL(const TDesC& aText); |
|
154 |
|
155 /** |
|
156 * Get sync content name. |
|
157 * @param None. |
|
158 * @return Content name. |
|
159 */ |
|
160 const TDesC& Content(); |
|
161 |
|
162 /** |
|
163 * Resets progress state. |
|
164 * @param None. |
|
165 * @return None. |
|
166 */ |
|
167 void ResetProgress(); |
|
168 |
|
169 /** |
|
170 * Finds out whether total progress count is known. |
|
171 * @param None. |
|
172 * @return ETrue if total progress count is known, EFalse otherwise. |
|
173 */ |
|
174 TBool ProgressKnown(); |
|
175 |
|
176 private: |
|
177 // synchronization phase |
|
178 TInt iSyncPhase; |
|
179 |
|
180 // total number of sent/received sync items |
|
181 TInt iTotalProgressCount; |
|
182 |
|
183 // number of sent/received sync items |
|
184 TInt iProgressCount; |
|
185 |
|
186 // number of increase progress calls, can different than iProgressCount |
|
187 TInt iProgressCount2; |
|
188 |
|
189 // name of the content being synced |
|
190 HBufC* iSyncContent; |
|
191 }; |
|
192 |
|
193 #endif // ASPSTATE_H |
|
194 |
|
195 // End of File |