equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
18 |
18 |
19 |
19 |
20 |
20 |
21 //INCLUDES |
21 //INCLUDES |
22 #include "iaupdatefirsttimeinfo.h" |
22 #include "iaupdatefirsttimeinfo.h" |
23 #include "iaupdatefirsttimedatefile.h" |
|
24 |
23 |
25 #include <bautils.h> // bafl.lib |
24 #include <bautils.h> // bafl.lib |
26 #include <s32file.h> // estor.lib |
25 #include <s32file.h> // estor.lib |
27 #include <sysutil.h> |
26 #include <sysutil.h> |
28 |
27 |
106 { |
105 { |
107 ReadDataL(); |
106 ReadDataL(); |
108 iAgreementAccepted = ETrue; |
107 iAgreementAccepted = ETrue; |
109 WriteDataL(); |
108 WriteDataL(); |
110 } |
109 } |
111 |
110 |
112 // --------------------------------------------------------------------------- |
111 |
113 // CIAUpdateFirstTimeInfo::SetAgreementAskedL |
|
114 // Set Nokia agreement as asked (prompted) to an user |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void CIAUpdateFirstTimeInfo::SetAgreementAskedL() |
|
118 { |
|
119 ReadDataL(); |
|
120 iAgreementAsked = ETrue; |
|
121 WriteDataL(); |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
112 // --------------------------------------------------------------------------- |
125 // CIAUpdateFirstTimeInfo::SetAutomaticUpdatesAskedL |
113 // CIAUpdateFirstTimeInfo::SetAutomaticUpdatesAskedL |
126 // Set automatic update checks as prompted to an use |
114 // Set automatic update checks as prompted to an use |
127 // --------------------------------------------------------------------------- |
115 // --------------------------------------------------------------------------- |
128 // |
116 // |
130 { |
118 { |
131 ReadDataL(); |
119 ReadDataL(); |
132 iAutomaticUpdateChecksAsked = ETrue; |
120 iAutomaticUpdateChecksAsked = ETrue; |
133 WriteDataL(); |
121 WriteDataL(); |
134 } |
122 } |
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CIAUpdateFirstTimeInfo::SetFirstTimeIfNotSetL |
|
138 // |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 void CIAUpdateFirstTimeInfo::SetFirstTimeIfNotSetL() |
|
142 { |
|
143 if ( !AutomaticUpdateChecksAskedL() ) |
|
144 { |
|
145 CIAUpdateFirstTimeDateFile* firstTimeDateFile = |
|
146 CIAUpdateFirstTimeDateFile::NewLC( KIAUpdateFirstTimeDateFile ); |
|
147 if ( firstTimeDateFile->FirstTime().Int64() == 0 ) |
|
148 { |
|
149 firstTimeDateFile->SetCurrentFirstTime(); |
|
150 firstTimeDateFile->WriteDataL(); |
|
151 } |
|
152 CleanupStack::PopAndDestroy( firstTimeDateFile ); |
|
153 } |
|
154 } |
|
155 |
123 |
156 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
157 // CIAUpdateFirstTimeInfo::AgreementAcceptedL |
125 // CIAUpdateFirstTimeInfo::AgreementAcceptedL |
158 // Is Nokia agreement of Application Update accepted by an user |
126 // Is Nokia agreement of Application Update accepted by an user |
159 // --------------------------------------------------------------------------- |
127 // --------------------------------------------------------------------------- |
162 { |
130 { |
163 ReadDataL(); |
131 ReadDataL(); |
164 return iAgreementAccepted; |
132 return iAgreementAccepted; |
165 } |
133 } |
166 |
134 |
167 |
|
168 // --------------------------------------------------------------------------- |
|
169 // CIAUpdateFirstTimeInfo::AgreementAskedL |
|
170 // Is Nokia agreement of Application Update already asked |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 TBool CIAUpdateFirstTimeInfo::AgreementAskedL() |
|
174 { |
|
175 ReadDataL(); |
|
176 return iAgreementAsked; |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------------------------- |
135 // --------------------------------------------------------------------------- |
180 // CIAUpdateFirstTimeInfo::AutomaticUpdateChecksAskedL |
136 // CIAUpdateFirstTimeInfo::AutomaticUpdateChecksAskedL |
181 // Is activation for automatic update cheks from network already asked |
137 // Is activation for automatic update cheks from network already asked |
182 // --------------------------------------------------------------------------- |
138 // --------------------------------------------------------------------------- |
183 // |
139 // |
185 { |
141 { |
186 ReadDataL(); |
142 ReadDataL(); |
187 return iAutomaticUpdateChecksAsked; |
143 return iAutomaticUpdateChecksAsked; |
188 } |
144 } |
189 |
145 |
190 // --------------------------------------------------------------------------- |
|
191 // CIAUpdateFirstTimeInfo::FirstTimeDelayL |
|
192 // |
|
193 // --------------------------------------------------------------------------- |
|
194 // |
|
195 TBool CIAUpdateFirstTimeInfo::FirstTimeDelayL() |
|
196 { |
|
197 TBool firstTimeDelay = EFalse; |
|
198 if ( !AutomaticUpdateChecksAskedL() ) |
|
199 { |
|
200 CIAUpdateFirstTimeDateFile* firstTimeDateFile = |
|
201 CIAUpdateFirstTimeDateFile::NewL( KIAUpdateFirstTimeDateFile ); |
|
202 |
|
203 TTime firstTime( firstTimeDateFile->FirstTime() ); |
|
204 |
|
205 delete firstTimeDateFile; |
|
206 |
|
207 TTime expireTime( firstTime ); |
|
208 |
|
209 expireTime += KFirstTimeDelayInDays; |
|
210 |
|
211 TTime universalTime; |
|
212 universalTime.UniversalTime(); |
|
213 |
|
214 if ( universalTime < expireTime && universalTime >= firstTime ) |
|
215 { |
|
216 firstTimeDelay = ETrue; |
|
217 } |
|
218 } |
|
219 return firstTimeDelay; |
|
220 } |
|
221 |
146 |
222 // ----------------------------------------------------------------------------- |
147 // ----------------------------------------------------------------------------- |
223 // CIAUpdateFirstTimeInfo::ReadDataL |
148 // CIAUpdateFirstTimeInfo::ReadDataL |
224 // |
149 // |
225 // ----------------------------------------------------------------------------- |
150 // ----------------------------------------------------------------------------- |
229 RFile file; |
154 RFile file; |
230 TInt err = file.Open( iFsSession, iPath, EFileRead|EFileShareAny ); |
155 TInt err = file.Open( iFsSession, iPath, EFileRead|EFileShareAny ); |
231 if ( err == KErrNotFound ) |
156 if ( err == KErrNotFound ) |
232 { |
157 { |
233 iAgreementAccepted = EFalse; |
158 iAgreementAccepted = EFalse; |
234 iAgreementAsked = EFalse; |
|
235 iAutomaticUpdateChecksAsked = EFalse; |
159 iAutomaticUpdateChecksAsked = EFalse; |
236 } |
160 } |
237 else |
161 else |
238 { |
162 { |
239 User::LeaveIfError( err ); |
163 User::LeaveIfError( err ); |
280 // ----------------------------------------------------------------------------- |
204 // ----------------------------------------------------------------------------- |
281 // |
205 // |
282 void CIAUpdateFirstTimeInfo::InternalizeL( RReadStream& aStream ) |
206 void CIAUpdateFirstTimeInfo::InternalizeL( RReadStream& aStream ) |
283 { |
207 { |
284 iAgreementAccepted = aStream.ReadInt32L(); |
208 iAgreementAccepted = aStream.ReadInt32L(); |
285 iAgreementAsked = aStream.ReadInt32L(); |
|
286 iAutomaticUpdateChecksAsked = aStream.ReadInt32L(); |
209 iAutomaticUpdateChecksAsked = aStream.ReadInt32L(); |
287 } |
210 } |
288 |
211 |
289 |
212 |
290 // ----------------------------------------------------------------------------- |
213 // ----------------------------------------------------------------------------- |
293 // ----------------------------------------------------------------------------- |
216 // ----------------------------------------------------------------------------- |
294 // |
217 // |
295 void CIAUpdateFirstTimeInfo::ExternalizeL( RWriteStream& aStream ) |
218 void CIAUpdateFirstTimeInfo::ExternalizeL( RWriteStream& aStream ) |
296 { |
219 { |
297 aStream.WriteInt32L( iAgreementAccepted ); |
220 aStream.WriteInt32L( iAgreementAccepted ); |
298 aStream.WriteInt32L( iAgreementAsked ); |
|
299 aStream.WriteInt32L( iAutomaticUpdateChecksAsked ); |
221 aStream.WriteInt32L( iAutomaticUpdateChecksAsked ); |
300 } |
222 } |
301 |
223 |
302 // End of File |
224 // End of File |