|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "iaupdatefwsyncstate.h" |
|
23 #include "iaupdatefwsyncutil.h" |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // NewL |
|
29 // |
|
30 // Two-phased constructor. |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CIAUpdateFWSyncState* CIAUpdateFWSyncState::NewL() |
|
34 { |
|
35 CIAUpdateFWSyncState* self = new(ELeave) CIAUpdateFWSyncState(); |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(self); |
|
39 return self; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // ~CIAUpdateFWSyncState |
|
44 // |
|
45 // Destructor. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CIAUpdateFWSyncState::~CIAUpdateFWSyncState() |
|
49 { |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CIAUpdateFWSyncState |
|
54 // |
|
55 // C++ default constructor can NOT contain any code, that |
|
56 // might leave. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CIAUpdateFWSyncState::CIAUpdateFWSyncState() |
|
60 { |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // ConstructL |
|
65 // |
|
66 // Symbian 2nd phase constructor can leave. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 void CIAUpdateFWSyncState::ConstructL() |
|
70 { |
|
71 Reset(); |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // Reset |
|
76 // |
|
77 // Resets all state variables. |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CIAUpdateFWSyncState::Reset() |
|
81 { |
|
82 iSyncPhase = EPhaseNone; |
|
83 } |
|
84 |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // SetSyncPhase |
|
88 // |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CIAUpdateFWSyncState::SetSyncPhase(TInt aPhase) |
|
92 { |
|
93 iSyncPhase = aPhase; |
|
94 } |
|
95 |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // SyncPhase |
|
99 // |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 TInt CIAUpdateFWSyncState::SyncPhase() |
|
103 { |
|
104 return iSyncPhase; |
|
105 } |
|
106 |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // SetProgress |
|
110 // |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 void CIAUpdateFWSyncState::SetProgress(TInt aCount) |
|
114 { |
|
115 iProgressCount = aCount; |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // IncreaseProgress |
|
120 // |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 void CIAUpdateFWSyncState::IncreaseProgress() |
|
124 { |
|
125 if (iProgressCount < iTotalProgressCount) |
|
126 { |
|
127 iProgressCount++; |
|
128 } |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // Progress |
|
133 // |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 TInt CIAUpdateFWSyncState::Progress() |
|
137 { |
|
138 return iProgressCount; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // SetTotalProgress |
|
143 // |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 void CIAUpdateFWSyncState::SetTotalProgress(TInt aCount) |
|
147 { |
|
148 iTotalProgressCount = aCount; |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // TotalProgress |
|
153 // |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 TInt CIAUpdateFWSyncState::TotalProgress() |
|
157 { |
|
158 return iTotalProgressCount; |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // SetContent |
|
163 // |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 void CIAUpdateFWSyncState::SetContent(const TDesC& aContent) |
|
167 { |
|
168 TUtil::StrCopy(iSyncContent, aContent); |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // Content |
|
173 // |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 const TDesC& CIAUpdateFWSyncState::Content() |
|
177 { |
|
178 return iSyncContent; |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // ResetProgress |
|
183 // |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 void CIAUpdateFWSyncState::ResetProgress() |
|
187 { |
|
188 iProgressCount = 0; |
|
189 iTotalProgressCount = 0; |
|
190 iSyncContent = KNullDesC; |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // ProgressKnown |
|
195 // |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 TBool CIAUpdateFWSyncState::ProgressKnown() |
|
199 { |
|
200 if (iTotalProgressCount == -1 ) |
|
201 { |
|
202 return EFalse; |
|
203 } |
|
204 |
|
205 return ETrue; |
|
206 } |
|
207 |
|
208 |