81 } |
84 } |
82 if (iGlobalLockHandler) |
85 if (iGlobalLockHandler) |
83 { |
86 { |
84 delete iGlobalLockHandler; |
87 delete iGlobalLockHandler; |
85 } |
88 } |
86 if ( iController ) |
89 if (iAutomaticCheck) |
|
90 { |
|
91 delete iAutomaticCheck; |
|
92 } |
|
93 if (iController) |
87 { |
94 { |
88 delete iController; |
95 delete iController; |
89 } |
96 } |
90 if ( iFwUpdateHandler ) |
97 if (iFwUpdateHandler) |
91 { |
98 { |
92 delete iFwUpdateHandler; |
99 delete iFwUpdateHandler; |
93 } |
100 } |
94 if ( mServiceProvider ) |
101 if (mServiceProvider) |
95 { |
102 { |
96 delete mServiceProvider; |
103 delete mServiceProvider; |
97 } |
104 } |
98 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::~IAUpdateEngine() end"); |
105 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::~IAUpdateEngine() end"); |
99 } |
106 } |
100 |
107 |
101 // ----------------------------------------------------------------------------- |
108 // ----------------------------------------------------------------------------- |
102 // IAUpdateEngine::StartedByLauncherL |
109 // IAUpdateEngine::StartedByLauncherL |
103 // |
110 // |
104 // ----------------------------------------------------------------------------- |
111 // ----------------------------------------------------------------------------- |
105 // |
112 // |
106 void IAUpdateEngine::StartedByLauncherL( TBool aRefreshFromNetworkDenied ) |
113 void IAUpdateEngine::StartedByLauncherL(bool aRefreshFromNetworkDenied) |
107 { |
114 { |
108 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartedByLauncherL() begin"); |
115 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartedByLauncherL() begin"); |
109 iRequestIssued = ETrue; |
116 mRequestIssued = true; |
110 iRequestType = IAUpdateUiDefines::ENoRequest; |
117 mRequestType = IAUpdateUiDefines::ENoRequest; |
111 iController->SetRequestType( iRequestType ); |
118 iController->SetRequestType(mRequestType); |
112 SetVisibleL( ETrue ); |
119 SetVisibleL(true); |
113 CIAUpdateParameters* params = iController->ParamsReadAndRemoveFileL(); |
120 CIAUpdateParameters* params = iController->ParamsReadAndRemoveFileL(); |
114 iController->CheckUpdatesDeferredL( params, aRefreshFromNetworkDenied ); |
121 iController->CheckUpdatesDeferredL(params, aRefreshFromNetworkDenied); |
115 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartedByLauncherL() end"); |
|
116 } |
122 } |
117 |
123 |
118 // ----------------------------------------------------------------------------- |
124 // ----------------------------------------------------------------------------- |
119 // IAUpdateEngine::CheckUpdatesRequestL |
125 // IAUpdateEngine::CheckUpdatesRequestL |
120 // |
126 // |
121 // ----------------------------------------------------------------------------- |
127 // ----------------------------------------------------------------------------- |
122 // |
128 // |
123 void IAUpdateEngine::CheckUpdatesRequestL( int wgid, |
129 void IAUpdateEngine::CheckUpdatesRequestL(int wgid, |
124 CIAUpdateParameters* aFilterParams, |
130 CIAUpdateParameters* aFilterParams, bool aForcedRefresh) |
125 TBool aForcedRefresh ) |
131 |
126 |
|
127 { |
132 { |
128 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::CheckUpdatesRequestL() begin"); |
133 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::CheckUpdatesRequestL() begin"); |
129 SetClientWgId( wgid ); |
134 SetClientWgId(wgid); |
130 iRequestIssued = ETrue; |
135 mRequestIssued = true; |
131 iStartedFromApplication = ETrue; |
136 mStartedFromApplication = true; |
132 CleanupStack::PushL( aFilterParams ); |
137 CleanupStack::PushL(aFilterParams); |
133 if ( wgid > 0 ) |
138 if (wgid > 0) |
134 { |
139 { |
135 HideApplicationInFSWL( ETrue ); |
140 HideApplicationInFSWL(true); |
136 } |
141 } |
137 CleanupStack::Pop( aFilterParams ); |
142 CleanupStack::Pop(aFilterParams); |
138 |
143 |
139 if ( !aFilterParams->ShowProgress() ) |
144 if (!aFilterParams->ShowProgress()) |
140 { |
145 { |
141 iEikEnv->RootWin().SetOrdinalPosition( -1, ECoeWinPriorityNeverAtFront ); |
146 iEikEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront); |
142 } |
147 } |
143 |
148 |
144 iRequestType = IAUpdateUiDefines::ECheckUpdates; |
149 mRequestType = IAUpdateUiDefines::ECheckUpdates; |
145 iController->SetRequestType( iRequestType ); |
150 iController->SetRequestType(mRequestType); |
146 iController->SetForcedRefresh( aForcedRefresh ); |
151 iController->SetForcedRefresh(aForcedRefresh); |
147 |
152 |
148 iController->CheckUpdatesDeferredL( aFilterParams, EFalse ); |
153 iController->CheckUpdatesDeferredL(aFilterParams, false); |
149 |
154 |
150 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::CheckUpdatesRequestL() end"); |
155 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::CheckUpdatesRequestL() end"); |
151 } |
156 } |
152 |
157 |
153 // ----------------------------------------------------------------------------- |
158 // ----------------------------------------------------------------------------- |
154 // IAUpdateEngine::ShowUpdatesRequestL |
159 // IAUpdateEngine::ShowUpdatesRequestL |
155 // |
160 // |
156 // ----------------------------------------------------------------------------- |
161 // ----------------------------------------------------------------------------- |
157 // |
162 // |
158 void IAUpdateEngine::ShowUpdatesRequestL( int wgid, CIAUpdateParameters* aFilterParams ) |
163 void IAUpdateEngine::ShowUpdatesRequestL(int wgid, |
159 { |
164 CIAUpdateParameters* aFilterParams) |
160 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdatesRequestL() begin"); |
165 { |
161 SetClientWgId( wgid ); |
166 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdatesRequestL() begin"); |
162 iRequestIssued = ETrue; |
167 SetClientWgId(wgid); |
163 // delete iBackgroundTimer; |
168 mRequestIssued = true; |
164 // iBackgroundTimer = NULL; |
169 // delete iBackgroundTimer; |
165 iStartedFromApplication = ETrue; |
170 // iBackgroundTimer = NULL; |
166 CleanupStack::PushL( aFilterParams ); |
171 mStartedFromApplication = true; |
167 if ( wgid > 0 ) |
172 CleanupStack::PushL(aFilterParams); |
168 { |
173 if (wgid > 0) |
169 HideApplicationInFSWL( ETrue ); |
174 { |
170 } |
175 HideApplicationInFSWL(true); |
171 |
176 } |
172 //StatusPane()->MakeVisible( ETrue ); |
177 |
173 iEikEnv->RootWin().SetOrdinalPosition( 0, ECoeWinPriorityNormal ); |
178 //StatusPane()->MakeVisible( true ); |
174 |
179 iEikEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNormal); |
|
180 |
175 //iRequestObserver = &aObserver; |
181 //iRequestObserver = &aObserver; |
176 iRequestType = IAUpdateUiDefines::EShowUpdates; |
182 mRequestType = IAUpdateUiDefines::EShowUpdates; |
177 iController->SetRequestType( iRequestType ); |
183 iController->SetRequestType(mRequestType); |
178 |
|
179 |
184 |
180 //if ( !iMainView ) |
185 //if ( !iMainView ) |
181 // { |
186 // { |
182 // iMainView = CIAUpdateMainView::NewL( ClientRect() ); |
187 // iMainView = CIAUpdateMainView::NewL( ClientRect() ); |
183 // AddViewL( iMainView ); |
188 // AddViewL( iMainView ); |
184 // } |
189 // } |
185 |
190 |
186 |
191 |
187 // by pushing object to cleanup stack its destructor is called if leave happens |
192 // by pushing object to cleanup stack its destructor is called if leave happens |
188 // so global lock issued by this instance can be released in destructor of CIAUpdateGlobalLockHandler |
193 // so global lock issued by this instance can be released in destructor of CIAUpdateGlobalLockHandler |
189 CIAUpdateGlobalLockHandler* globalLockHandler = CIAUpdateGlobalLockHandler::NewLC(); |
194 CIAUpdateGlobalLockHandler* globalLockHandler = |
190 if ( !globalLockHandler->InUseByAnotherInstanceL() ) |
195 CIAUpdateGlobalLockHandler::NewLC(); |
191 { |
196 if (!globalLockHandler->InUseByAnotherInstanceL()) |
192 globalLockHandler->SetToInUseForAnotherInstancesL( ETrue ); |
197 { |
193 CleanupStack::Pop( globalLockHandler ); |
198 globalLockHandler->SetToInUseForAnotherInstancesL(true); |
194 CleanupStack::Pop( aFilterParams ); |
199 CleanupStack::Pop(globalLockHandler); |
195 CleanupStack::PushL( globalLockHandler ); |
200 CleanupStack::Pop(aFilterParams); |
196 iController->CheckUpdatesDeferredL( aFilterParams, EFalse ); |
201 CleanupStack::PushL(globalLockHandler); |
197 CleanupStack::Pop( globalLockHandler ); |
202 iController->CheckUpdatesDeferredL(aFilterParams, false); |
|
203 CleanupStack::Pop(globalLockHandler); |
198 delete iGlobalLockHandler; |
204 delete iGlobalLockHandler; |
199 iGlobalLockHandler = globalLockHandler; |
205 iGlobalLockHandler = globalLockHandler; |
200 //now possible deletion of iGlobalLockHandler in leave situation is handled |
206 //now possible deletion of iGlobalLockHandler in leave situation is handled |
201 //in HandleLeaveErrorL() and HandleLeaveErrorWithoutLeave methods. |
207 //in HandleLeaveErrorL() and HandleLeaveErrorWithoutLeave methods. |
202 } |
208 } |
203 else |
209 else |
204 { |
210 { |
205 CleanupStack::PopAndDestroy( globalLockHandler ); |
211 CleanupStack::PopAndDestroy(globalLockHandler); |
206 CleanupStack::PopAndDestroy( aFilterParams ); |
212 CleanupStack::PopAndDestroy(aFilterParams); |
207 // locked by another IAD instance, nothing else to do than just complete client's request. |
213 // locked by another IAD instance, nothing else to do than just complete client's request. |
208 InformRequestObserver( KErrNone ); |
214 InformRequestObserver(KErrNone); |
209 } |
215 } |
210 |
216 |
211 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdatesRequestL() end"); |
217 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdatesRequestL() end"); |
212 } |
218 } |
213 |
|
214 |
219 |
215 // ----------------------------------------------------------------------------- |
220 // ----------------------------------------------------------------------------- |
216 // IAUpdateEngine::ShowUpdateQueryRequestL |
221 // IAUpdateEngine::ShowUpdateQueryRequestL |
217 // |
222 // |
218 // ----------------------------------------------------------------------------- |
223 // ----------------------------------------------------------------------------- |
219 // |
224 // |
220 void IAUpdateEngine::ShowUpdateQueryRequestL( int wgid, TUint aUid ) |
225 void IAUpdateEngine::ShowUpdateQueryRequestL(int wgid, uint aUid) |
221 { |
226 { |
222 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdateQueryRequestL begin"); |
227 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdateQueryRequestL begin"); |
223 SetClientWgId( wgid ); |
228 SetClientWgId(wgid); |
224 iRequestIssued = ETrue; |
229 mRequestIssued = true; |
225 iStartedFromApplication = ETrue; |
230 mStartedFromApplication = true; |
226 iUpdatequeryUid = aUid; |
231 mUpdatequeryUid = aUid; |
227 iUpdateNow = EFalse; |
232 mUpdateNow = false; |
228 if ( wgid > 0 ) |
233 if (wgid > 0) |
229 { |
234 { |
230 HideApplicationInFSWL( ETrue ); |
235 HideApplicationInFSWL(true); |
231 } |
236 } |
232 |
237 mRequestType = IAUpdateUiDefines::EUpdateQuery; |
233 //iRequestObserver = &aObserver; |
238 |
234 iRequestType = IAUpdateUiDefines::EUpdateQuery; |
|
235 |
|
236 |
|
237 delete iIdle; |
239 delete iIdle; |
238 iIdle = NULL; |
240 iIdle = NULL; |
239 iIdle = CIdle::NewL( CActive::EPriorityIdle ); |
241 iIdle = CIdle::NewL(CActive::EPriorityIdle); |
240 iIdle->Start( TCallBack( UpdateQueryCallbackL, this ) ); |
242 iIdle->Start(TCallBack(UpdateQueryCallbackL, this)); |
241 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdateQueryRequestL end") |
243 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdateQueryRequestL end") |
242 } |
244 } |
243 |
245 |
244 // ----------------------------------------------------------------------------- |
246 // ----------------------------------------------------------------------------- |
245 // IAUpdateEngine::StartUpdate |
247 // IAUpdateEngine::StartUpdate |
246 // |
248 // |
247 // ----------------------------------------------------------------------------- |
249 // ----------------------------------------------------------------------------- |
248 // |
250 // |
249 void IAUpdateEngine::StartUpdate( TBool aFirmwareUpdate ) |
251 void IAUpdateEngine::StartUpdate(bool aFirmwareUpdate) |
250 { |
252 { |
251 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() begin"); |
253 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() begin"); |
252 if ( aFirmwareUpdate ) |
254 if (aFirmwareUpdate) |
253 { |
255 { |
254 if ( !iFwUpdateHandler ) |
256 if (!iFwUpdateHandler) |
255 { |
257 { |
256 TRAP_IGNORE( CIAUpdateFWUpdateHandler::NewL() ); |
258 TRAP_IGNORE( CIAUpdateFWUpdateHandler::NewL() ); |
257 } |
259 } |
258 if ( iFwUpdateHandler ) |
260 if (iFwUpdateHandler) |
259 { |
261 { |
260 iFwUpdateHandler->FirmWareUpdatewithFOTA(); |
262 iFwUpdateHandler->FirmWareUpdatewithFOTA(); |
261 } |
263 } |
262 } |
264 } |
263 else |
265 else |
264 { |
266 { |
265 // by pushing object to cleanup stack it's destructor is called if leave happens |
267 // by pushing object to cleanup stack it's destructor is called if leave happens |
266 // so global lock issued by this instance can be released in destructor of CIAUpdateGlobalLockHandler |
268 // so global lock issued by this instance can be released in destructor of CIAUpdateGlobalLockHandler |
267 CIAUpdateGlobalLockHandler* globalLockHandler = CIAUpdateGlobalLockHandler::NewLC(); |
269 CIAUpdateGlobalLockHandler* globalLockHandler = |
268 if ( !globalLockHandler->InUseByAnotherInstanceL() ) |
270 CIAUpdateGlobalLockHandler::NewLC(); |
269 { |
271 if (!globalLockHandler->InUseByAnotherInstanceL()) |
270 globalLockHandler->SetToInUseForAnotherInstancesL( ETrue ); |
272 { |
|
273 globalLockHandler->SetToInUseForAnotherInstancesL(true); |
271 // No need to be totally silent since the updating is started |
274 // No need to be totally silent since the updating is started |
272 // by user. |
275 // by user. |
273 SetDefaultConnectionMethodL( EFalse ); |
276 SetDefaultConnectionMethodL(false); |
274 iController->StartUpdateL(); |
277 iController->StartUpdateL(); |
275 CleanupStack::Pop( globalLockHandler ); |
278 CleanupStack::Pop(globalLockHandler); |
276 delete iGlobalLockHandler; |
279 delete iGlobalLockHandler; |
277 iGlobalLockHandler = globalLockHandler; |
280 iGlobalLockHandler = globalLockHandler; |
278 //now possible deletion of iGlobalLockHandler in leave situation is handled |
281 //now possible deletion of iGlobalLockHandler in leave situation is handled |
279 //in HandleLeaveErrorL() and HandleLeaveErrorWithoutLeave methods. |
282 //in HandleLeaveErrorL() and HandleLeaveErrorWithoutLeave methods. |
280 } |
283 } |
281 else |
284 else |
282 { |
285 { |
283 CleanupStack::PopAndDestroy( globalLockHandler ); |
286 CleanupStack::PopAndDestroy(globalLockHandler); |
284 } |
287 } |
285 } |
288 } |
286 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() end"); |
289 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() end"); |
287 } |
290 } |
288 |
291 |
289 |
|
290 // ----------------------------------------------------------------------------- |
292 // ----------------------------------------------------------------------------- |
291 // IAUpdateEngine::SetVisibleL |
293 // IAUpdateEngine::SetVisibleL |
292 // |
294 // |
293 // ----------------------------------------------------------------------------- |
295 // ----------------------------------------------------------------------------- |
294 // |
296 // |
295 void IAUpdateEngine::SetVisibleL( TBool aVisible ) |
297 void IAUpdateEngine::SetVisibleL(bool /*aVisible*/) |
296 { |
298 { |
297 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetVisibleL() begin"); |
299 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetVisibleL() begin"); |
298 IAUPDATE_TRACE_1("[IAUPDATE] visible: %d", aVisible ); |
300 //IAUPDATE_TRACE_1("[IAUPDATE] visible: %d", aVisible ); |
299 /*if ( aVisible ) |
301 /*if ( aVisible ) |
300 { |
302 { |
301 if ( iEikonEnv->RootWin().OrdinalPosition() != 0 || iEikonEnv->RootWin().OrdinalPriority() != ECoeWinPriorityNormal ) |
303 if ( iEikonEnv->RootWin().OrdinalPosition() != 0 || iEikonEnv->RootWin().OrdinalPriority() != ECoeWinPriorityNormal ) |
302 { |
304 { |
303 iEikonEnv->RootWin().SetOrdinalPosition( 0, ECoeWinPriorityNormal ); |
305 iEikonEnv->RootWin().SetOrdinalPosition( 0, ECoeWinPriorityNormal ); |
304 } |
306 } |
305 |
307 |
306 StatusPane()->MakeVisible( ETrue ); |
308 StatusPane()->MakeVisible( ETrue ); |
307 iMainView = CIAUpdateMainView::NewL( ClientRect() ); |
309 iMainView = CIAUpdateMainView::NewL( ClientRect() ); |
308 AddViewL( iMainView ); |
310 AddViewL( iMainView ); |
309 ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) ); |
311 ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) ); |
310 } |
312 } |
311 else |
313 else |
312 { |
314 { |
313 iEikonEnv->RootWin().SetOrdinalPosition( -1, ECoeWinPriorityNeverAtFront ); |
315 iEikonEnv->RootWin().SetOrdinalPosition( -1, ECoeWinPriorityNeverAtFront ); |
314 StatusPane()->MakeVisible( EFalse ); |
316 StatusPane()->MakeVisible( EFalse ); |
315 }*/ |
317 }*/ |
316 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetVisibleL() end"); |
318 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetVisibleL() end"); |
317 } |
319 } |
318 |
320 |
319 // ----------------------------------------------------------------------------- |
321 // ----------------------------------------------------------------------------- |
320 // IAUpdateEngine::SetClientWgId |
322 // IAUpdateEngine::SetClientWgId |
321 // |
323 // |
322 // ----------------------------------------------------------------------------- |
324 // ----------------------------------------------------------------------------- |
323 // |
325 // |
324 void IAUpdateEngine::SetClientWgId( TInt aWgId ) |
326 void IAUpdateEngine::SetClientWgId(int aWgId) |
325 { |
327 { |
326 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::SetClientWgId() wgId %d", aWgId ); |
328 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::SetClientWgId() wgId %d", aWgId ); |
327 iWgId = aWgId; |
329 mWgId = aWgId; |
328 } |
330 } |
329 |
331 |
330 // ----------------------------------------------------------------------------- |
332 // ----------------------------------------------------------------------------- |
331 // IAUpdateEngine::ClientInBackgroundL |
333 // IAUpdateEngine::ClientInBackgroundL |
332 // |
334 // |
333 // ----------------------------------------------------------------------------- |
335 // ----------------------------------------------------------------------------- |
334 // |
336 // |
335 TInt IAUpdateEngine::ClientInBackgroundL() const |
337 bool IAUpdateEngine::ClientInBackgroundL() const |
336 { |
338 { |
337 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ClientInBackgroundL() begin"); |
339 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ClientInBackgroundL() begin"); |
338 TBool inBackground = EFalse; |
340 bool inBackground = false; |
339 if ( iWgId > 0 ) |
341 if (mWgId > 0) |
340 { |
342 { |
341 CArrayFixFlat<TInt>* wgArray = new( ELeave ) CArrayFixFlat<TInt>(10); |
343 CArrayFixFlat<int>* wgArray = new (ELeave) CArrayFixFlat<int> (10); |
342 CleanupStack::PushL( wgArray ); |
344 CleanupStack::PushL(wgArray); |
343 User::LeaveIfError( iEikEnv->WsSession().WindowGroupList( 0, wgArray ) ); |
345 User::LeaveIfError(iEikEnv->WsSession().WindowGroupList(0, wgArray)); |
344 TInt ownWgId = iEikEnv->RootWin().Identifier(); |
346 int ownWgId = iEikEnv->RootWin().Identifier(); |
345 if ( ( wgArray->At( 0 ) != ownWgId ) && ( wgArray->At( 0 ) != iWgId ) ) |
347 if ((wgArray->At(0) != ownWgId) && (wgArray->At(0) != mWgId)) |
346 { |
348 { |
347 inBackground = ETrue; |
349 inBackground = true; |
348 } |
350 } |
349 CleanupStack::PopAndDestroy( wgArray ); |
351 CleanupStack::PopAndDestroy(wgArray); |
350 } |
352 } |
351 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::ClientInBackgroundL() inBackground: %d", inBackground ); |
353 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::ClientInBackgroundL() inBackground: %d", inBackground ); |
352 return inBackground; |
354 return inBackground; |
353 } |
355 } |
354 |
|
355 |
356 |
356 // ----------------------------------------------------------------------------- |
357 // ----------------------------------------------------------------------------- |
357 // IAUpdateEngine::handleAllClientsClosed() |
358 // IAUpdateEngine::handleAllClientsClosed() |
358 // |
359 // |
359 // ----------------------------------------------------------------------------- |
360 // ----------------------------------------------------------------------------- |
360 // |
361 // |
361 void IAUpdateEngine::handleAllClientsClosed() |
362 void IAUpdateEngine::handleAllClientsClosed() |
362 { |
363 { |
363 qApp->quit(); |
364 qApp->quit(); |
364 } |
365 } |
365 |
366 |
|
367 // ----------------------------------------------------------------------------- |
|
368 // IAUpdateEngine::dialogFinished |
|
369 // Called when dialog is finished. |
|
370 // ----------------------------------------------------------------------------- |
|
371 // |
|
372 void IAUpdateEngine::dialogFinished(HbAction *action) |
|
373 { |
|
374 DialogState dialogState = mDialogState; |
|
375 mDialogState = NoDialog; |
|
376 |
|
377 switch (dialogState) |
|
378 { |
|
379 case Results: |
|
380 mUiRefreshAllowed = true; |
|
381 if (iController->ResultsInfo().iRebootAfterInstall) |
|
382 { |
|
383 ShowRebootDialogL(); |
|
384 } |
|
385 else |
|
386 { |
|
387 if (!DoPossibleApplicationClose()) |
|
388 { |
|
389 iController->RefreshNodeList(); |
|
390 RefreshUI(); |
|
391 } |
|
392 } |
|
393 break; |
|
394 case RebootQuery: |
|
395 if (action == mPrimaryAction) |
|
396 { |
|
397 RStarterSession startersession; |
|
398 if (startersession.Connect() == KErrNone) |
|
399 { |
|
400 startersession.Reset(RStarterSession::EUnknownReset); |
|
401 startersession.Close(); |
|
402 } |
|
403 } |
|
404 else |
|
405 { |
|
406 if (!DoPossibleApplicationClose()) |
|
407 { |
|
408 iController->RefreshNodeList(); |
|
409 RefreshUI(); |
|
410 } |
|
411 } |
|
412 break; |
|
413 case ShowUpdateQuery: |
|
414 if (action == mPrimaryAction) |
|
415 { |
|
416 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::dialogFinished() Now"); |
|
417 mUpdateNow = true; |
|
418 } |
|
419 else if (action == mSecondaryAction) |
|
420 { |
|
421 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::dialogFinished() Later"); |
|
422 CIAUpdateQueryHistory* updateQueryHistory = |
|
423 CIAUpdateQueryHistory::NewL(); |
|
424 CleanupStack::PushL(updateQueryHistory); |
|
425 updateQueryHistory->SetTimeL(mUpdatequeryUid); |
|
426 CleanupStack::PopAndDestroy(updateQueryHistory); |
|
427 } |
|
428 InformRequestObserver(KErrNone); |
|
429 break; |
|
430 default: |
|
431 break; |
|
432 } |
|
433 } |
366 |
434 |
367 // ----------------------------------------------------------------------------- |
435 // ----------------------------------------------------------------------------- |
368 // IAUpdateEngine::StartupComplete |
436 // IAUpdateEngine::StartupComplete |
369 // |
437 // |
370 // ----------------------------------------------------------------------------- |
438 // ----------------------------------------------------------------------------- |
371 // |
439 // |
372 void IAUpdateEngine::StartupComplete( TInt aError ) |
440 void IAUpdateEngine::StartupComplete(TInt aError) |
373 { |
441 { |
374 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupComplete() begin"); |
442 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupComplete() begin"); |
375 IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError); |
443 IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError); |
376 |
444 |
377 if( aError != KErrNone ) |
445 if (aError != KErrNone) |
378 { |
446 { |
379 HandleLeaveErrorWithoutLeave( aError ); |
447 HandleLeaveErrorWithoutLeave(aError); |
380 } |
448 } |
381 else |
449 else |
382 { |
450 { |
383 TRAPD( err, StartupCompleteL() ); |
451 TRAPD( err, StartupCompleteL() ); |
384 if( err != KErrNone ) |
452 if (err != KErrNone) |
385 { |
453 { |
386 HandleLeaveErrorWithoutLeave( err ); |
454 HandleLeaveErrorWithoutLeave(err); |
387 } |
455 } |
388 } |
456 } |
389 |
457 |
390 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupComplete() end"); |
458 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupComplete() end"); |
391 } |
459 } |
392 |
460 |
393 // ----------------------------------------------------------------------------- |
461 // ----------------------------------------------------------------------------- |
394 // IAUpdateEngine::StartupCompleteL |
462 // IAUpdateEngine::StartupCompleteL |
395 // |
463 // |
396 // ----------------------------------------------------------------------------- |
464 // ----------------------------------------------------------------------------- |
397 // |
465 // |
398 void IAUpdateEngine::StartupCompleteL() |
466 void IAUpdateEngine::StartupCompleteL() |
399 { |
467 { |
400 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupCompleteL() begin"); |
468 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupCompleteL() begin"); |
401 |
469 |
402 delete iGlobalLockHandler; |
470 delete iGlobalLockHandler; |
403 iGlobalLockHandler = NULL; |
471 iGlobalLockHandler = NULL; |
404 iGlobalLockHandler = CIAUpdateGlobalLockHandler::NewL(); |
472 iGlobalLockHandler = CIAUpdateGlobalLockHandler::NewL(); |
405 if ( !iGlobalLockHandler->InUseByAnotherInstanceL() ) |
473 if (!iGlobalLockHandler->InUseByAnotherInstanceL()) |
406 { |
474 { |
407 TBool totalSilent( EFalse ); |
475 bool totalSilent(false); |
408 if ( iRequestType == IAUpdateUiDefines::ECheckUpdates ) |
476 if (mRequestType == IAUpdateUiDefines::ECheckUpdates) |
409 { |
477 { |
410 if ( iController->Filter() ) |
478 if (iController->Filter()) |
411 { |
479 { |
412 if ( iController->Filter()->FilterParams() ) |
480 if (iController->Filter()->FilterParams()) |
413 { |
481 { |
414 if ( iController->Filter()->FilterParams()->Refresh() ) |
482 if (iController->Filter()->FilterParams()->Refresh()) |
415 { |
483 { |
416 if ( !iController->ForcedRefresh() ) |
484 if (!iController->ForcedRefresh()) |
417 { |
485 { |
418 //from bgchecker, make it silent |
486 //from bgchecker, make it silent |
419 totalSilent = ETrue; |
487 totalSilent = true; |
420 } |
488 } |
421 } |
489 } |
422 } |
490 } |
423 } |
491 } |
424 } |
492 } |
425 SetDefaultConnectionMethodL( totalSilent ); |
493 SetDefaultConnectionMethodL(totalSilent); |
426 iGlobalLockHandler->SetToInUseForAnotherInstancesL( ETrue ); |
494 iGlobalLockHandler->SetToInUseForAnotherInstancesL(true); |
427 iController->StartRefreshL(); |
495 iController->StartRefreshL(); |
428 } |
496 } |
429 else |
497 else |
430 { |
498 { |
431 RefreshCompleteL( ETrue, KErrServerBusy ); |
499 RefreshCompleteL(true, KErrServerBusy); |
432 } |
500 } |
433 |
501 |
434 |
502 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupCompleteL() end"); |
435 |
503 } |
436 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupCompleteL() end"); |
504 |
437 } |
|
438 |
|
439 |
|
440 // ----------------------------------------------------------------------------- |
505 // ----------------------------------------------------------------------------- |
441 // IAUpdateEngine::HandleLeaveErrorL |
506 // IAUpdateEngine::HandleLeaveErrorL |
442 // |
507 // |
443 // ----------------------------------------------------------------------------- |
508 // ----------------------------------------------------------------------------- |
444 // |
509 // |
445 void IAUpdateEngine::HandleLeaveErrorL( TInt aError ) |
510 void IAUpdateEngine::HandleLeaveErrorL(TInt aError) |
446 { |
511 { |
447 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorL() begin"); |
512 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorL() begin"); |
448 //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances |
513 //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances |
449 delete iGlobalLockHandler; |
514 delete iGlobalLockHandler; |
450 iGlobalLockHandler = NULL; |
515 iGlobalLockHandler = NULL; |
451 // client request is completed before leave in case of leave error |
516 // client request is completed before leave in case of leave error |
452 if ( aError != KErrNone ) |
517 if (aError != KErrNone) |
453 { |
518 { |
454 InformRequestObserver( aError ); |
519 InformRequestObserver(aError); |
455 User::Leave( aError ); |
520 User::Leave(aError); |
456 } |
521 } |
457 |
522 |
458 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorL() end"); |
523 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorL() end"); |
459 } |
524 } |
460 |
525 |
461 |
|
462 // ----------------------------------------------------------------------------- |
526 // ----------------------------------------------------------------------------- |
463 // IAUpdateEngine::HandleLeaveErrorWithoutLeave |
527 // IAUpdateEngine::HandleLeaveErrorWithoutLeave |
464 // |
528 // |
465 // ----------------------------------------------------------------------------- |
529 // ----------------------------------------------------------------------------- |
466 // |
530 // |
467 void IAUpdateEngine::HandleLeaveErrorWithoutLeave( TInt aError ) |
531 void IAUpdateEngine::HandleLeaveErrorWithoutLeave(TInt aError) |
468 { |
532 { |
469 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorWithoutLeave() begin"); |
533 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorWithoutLeave() begin"); |
470 //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances |
534 //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances |
471 delete iGlobalLockHandler; |
535 delete iGlobalLockHandler; |
472 iGlobalLockHandler = NULL; |
536 iGlobalLockHandler = NULL; |
473 if ( aError != KErrNone ) |
537 if (aError != KErrNone) |
474 { |
538 { |
475 InformRequestObserver( aError ); |
539 InformRequestObserver(aError); |
476 } |
540 } |
477 if ( aError == KErrDiskFull ) |
541 if (aError == KErrDiskFull) |
478 { |
542 { |
479 //TRAP_IGNORE( ShowGlobalErrorNoteL( aError ) ); |
543 //TRAP_IGNORE( ShowGlobalErrorNoteL( aError ) ); |
480 } |
544 } |
481 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorWithoutLeave end"); |
545 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorWithoutLeave end"); |
482 } |
546 } |
483 |
547 |
|
548 // ----------------------------------------------------------------------------- |
|
549 // IAUpdateEngine::RefreshUI |
|
550 // |
|
551 // ----------------------------------------------------------------------------- |
|
552 // |
|
553 void IAUpdateEngine::RefreshUI() |
|
554 { |
|
555 emit refresh(iController->Nodes(), iController->FwNodes(), KErrNone); |
|
556 } |
484 |
557 |
485 // ----------------------------------------------------------------------------- |
558 // ----------------------------------------------------------------------------- |
486 // IAUpdateEngine::RefreshCompleteL |
559 // IAUpdateEngine::RefreshCompleteL |
487 // |
560 // |
488 // ----------------------------------------------------------------------------- |
561 // ----------------------------------------------------------------------------- |
489 // |
562 // |
490 void IAUpdateEngine::RefreshCompleteL( TBool /*aWithViewActivation*/, TInt aError ) |
563 void IAUpdateEngine::RefreshCompleteL(TBool /*aWithViewActivation*/, |
|
564 TInt aError) |
491 { |
565 { |
492 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::RefreshCompleteL() begin"); |
566 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::RefreshCompleteL() begin"); |
493 IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError ); |
567 IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError ); |
494 //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances |
568 //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances |
495 delete iGlobalLockHandler; |
569 delete iGlobalLockHandler; |
496 iGlobalLockHandler = NULL; |
570 iGlobalLockHandler = NULL; |
497 |
571 |
498 if ( iRequestType == IAUpdateUiDefines::ECheckUpdates ) |
572 if (mRequestType == IAUpdateUiDefines::ECheckUpdates) |
499 { |
573 { |
500 InformRequestObserver( aError ); |
574 InformRequestObserver(aError); |
501 } |
575 } |
502 else |
576 else |
503 { |
577 { |
504 emit refresh( iController->Nodes(), iController->FwNodes(), aError ); |
578 emit refresh(iController->Nodes(), iController->FwNodes(), aError); |
505 //if ( aWithViewActivation) |
579 //if ( aWithViewActivation) |
506 // { |
580 // { |
507 // ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) ); |
581 // ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) ); |
508 // } |
582 // } |
509 CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC(); |
583 CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC(); |
510 TBool agreementAccepted = agreement->AgreementAcceptedL(); |
584 bool agreementAccepted = agreement->AgreementAcceptedL(); |
511 if ( iController->ForcedRefresh() ) |
585 if (iController->ForcedRefresh()) |
512 { |
586 { |
513 if ( !agreementAccepted ) |
587 if (!agreementAccepted) |
514 { |
588 { |
515 agreement->SetAgreementAcceptedL(); |
589 agreement->SetAgreementAcceptedL(); |
516 } |
590 } |
517 } |
591 } |
518 CleanupStack::PopAndDestroy( agreement ); |
592 CleanupStack::PopAndDestroy(agreement); |
519 // By calling CIdle possible waiting dialog can be closed before |
593 // By calling CIdle possible waiting dialog can be closed before |
520 // automatic check where a new dialog may be launched |
594 // automatic check where a new dialog may be launched |
521 delete iIdleAutCheck; |
595 delete iIdleAutCheck; |
522 iIdleAutCheck = NULL; |
596 iIdleAutCheck = NULL; |
523 iIdleAutCheck = CIdle::NewL( CActive::EPriorityIdle ); |
597 iIdleAutCheck = CIdle::NewL(CActive::EPriorityIdle); |
524 iIdleAutCheck->Start( TCallBack( AutomaticCheckCallbackL, this ) ); |
598 iIdleAutCheck->Start(TCallBack(AutomaticCheckCallbackL, this)); |
525 } |
599 } |
526 |
600 |
527 |
601 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::RefreshCompleteL() end"); |
528 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::RefreshCompleteL() end"); |
602 } |
529 } |
|
530 |
|
531 |
|
532 |
|
533 |
603 |
534 // ----------------------------------------------------------------------------- |
604 // ----------------------------------------------------------------------------- |
535 // IAUpdateEngine::UpdateCompleteL |
605 // IAUpdateEngine::UpdateCompleteL |
536 // |
606 // |
537 // ----------------------------------------------------------------------------- |
607 // ----------------------------------------------------------------------------- |
538 // |
608 // |
539 void IAUpdateEngine::UpdateCompleteL( TInt aError ) |
609 void IAUpdateEngine::UpdateCompleteL(TInt aError) |
540 { |
610 { |
541 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateCompleteL begin"); |
611 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateCompleteL begin"); |
542 IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError ); |
612 IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError ); |
543 //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances |
613 //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances |
544 delete iGlobalLockHandler; |
614 delete iGlobalLockHandler; |
545 iGlobalLockHandler = NULL; |
615 iGlobalLockHandler = NULL; |
546 if ( iRequestType != IAUpdateUiDefines::ENoRequest ) |
616 if (mRequestType != IAUpdateUiDefines::ENoRequest) |
547 { |
617 { |
548 InformRequestObserver( aError ); |
618 InformRequestObserver(aError); |
549 } |
619 } |
550 |
620 |
551 emit refresh( iController->Nodes(), iController->FwNodes(), KErrNone ); |
621 ShowResultsDialogL(); |
552 |
622 |
553 ShowResultsDialogDeferredL(); |
|
554 |
|
555 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateCompleteL end"); |
623 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateCompleteL end"); |
556 } |
624 } |
557 |
|
558 |
|
559 |
625 |
560 // ----------------------------------------------------------------------------- |
626 // ----------------------------------------------------------------------------- |
561 // IAUpdateEngine::ShowResultsDialogL |
627 // IAUpdateEngine::ShowResultsDialogL |
562 // |
628 // |
563 // ----------------------------------------------------------------------------- |
629 // ----------------------------------------------------------------------------- |
564 // |
630 // |
565 void IAUpdateEngine::ShowResultsDialogL() |
631 void IAUpdateEngine::ShowResultsDialogL() |
566 { |
632 { |
567 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowResultsDialogL() begin"); |
633 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowResultsDialogL() begin"); |
568 |
634 |
569 iUiRefreshAllowed = ETrue; |
635 mUiRefreshAllowed = false; |
570 IAUpdateResultsDialog resultsDialog; |
636 mResultsDialog = new IAUpdateResultsDialog(this); |
571 resultsDialog.showResults(iController->ResultsInfo()); |
637 mResultsDialog->showResults(iController->ResultsInfo(), this, |
572 |
638 SLOT(dialogFinished(HbAction*))); |
573 //TODO: How to recognise when application is closing |
639 mDialogState = Results; |
574 if ( iController->ResultsInfo().iRebootAfterInstall ) |
640 |
575 { |
|
576 HbMessageBox messageBox(HbMessageBox::MessageTypeQuestion); |
|
577 messageBox.setText(QString("Phone restart needed. Restart now?")); |
|
578 HbAction okAction("Ok"); |
|
579 HbAction cancelAction("Cancel"); |
|
580 messageBox.setPrimaryAction(&okAction); |
|
581 messageBox.setSecondaryAction(&cancelAction); |
|
582 messageBox.setTimeout(HbPopup::NoTimeout); |
|
583 messageBox.show(); |
|
584 /*HbAction *selectedAction = messageBox.exec(); |
|
585 if (selectedAction == messageBox.primaryAction()) |
|
586 { |
|
587 RStarterSession startersession; |
|
588 if( startersession.Connect() == KErrNone ) |
|
589 { |
|
590 startersession.Reset( RStarterSession::EUnknownReset ); |
|
591 startersession.Close(); |
|
592 return; |
|
593 } |
|
594 }*/ |
|
595 } |
|
596 if ( iStartedFromApplication && |
|
597 iController->ResultsInfo().iCountCancelled == 0 && |
|
598 iController->ResultsInfo().iCountFailed == 0 ) |
|
599 { |
|
600 qApp->quit(); |
|
601 } |
|
602 |
|
603 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::ShowResultsDialogL() nodes count: %d", iController->Nodes().Count() ); |
|
604 IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::ShowResultsDialogL() fw nodes: %d", iController->FwNodes().Count() ); |
|
605 //exit from result view if there are no update left |
|
606 if ( iController->Nodes().Count() == 0 && iController->FwNodes().Count() == 0 ) |
|
607 { |
|
608 qApp->quit(); |
|
609 } |
|
610 |
|
611 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowResultsDialogL() end"); |
641 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowResultsDialogL() end"); |
612 } |
642 } |
613 |
643 |
614 // ----------------------------------------------------------------------------- |
644 // ----------------------------------------------------------------------------- |
615 // IAUpdateEngin::ShowResultsDialogDeferredL |
645 // IAUpdateEngine::ShowRebootDialogL |
616 // |
646 // |
617 // ----------------------------------------------------------------------------- |
647 // ----------------------------------------------------------------------------- |
618 // |
648 // |
619 void IAUpdateEngine::ShowResultsDialogDeferredL() |
649 void IAUpdateEngine::ShowRebootDialogL() |
620 { |
650 { |
621 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowResultsDialogDeferredL() begin"); |
651 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowRebootDialogL() begin"); |
622 delete iIdle; |
652 |
623 iIdle = NULL; |
653 HbMessageBox *messageBox = new HbMessageBox( |
624 iIdle = CIdle::NewL( CActive::EPriorityIdle ); |
654 HbMessageBox::MessageTypeQuestion); |
625 iIdle->Start( TCallBack( ShowResultsDialogCallbackL, this ) ); |
655 messageBox->setText(QString("Phone restart needed. Restart now?")); |
626 iUiRefreshAllowed = EFalse; |
656 int actionCount = messageBox->actions().count(); |
627 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowResultsDialogDeferredL() end"); |
657 for (int i = actionCount - 1; i >= 0; i--) |
628 } |
658 { |
629 |
659 messageBox->removeAction(messageBox->actions().at(i)); |
630 |
660 } |
631 |
661 mPrimaryAction = NULL; |
632 |
662 mPrimaryAction = new HbAction("Ok"); |
633 |
663 HbAction *secondaryAction = NULL; |
634 |
664 secondaryAction = new HbAction("Cancel"); |
635 |
665 |
636 |
666 messageBox->addAction(mPrimaryAction); |
|
667 messageBox->addAction(secondaryAction); |
|
668 messageBox->setTimeout(HbPopup::NoTimeout); |
|
669 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
|
670 messageBox->open(this, SLOT(dialogFinished(HbAction*))); |
|
671 mDialogState = RebootQuery; |
|
672 |
|
673 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowRebootDialogL() end"); |
|
674 } |
637 |
675 |
638 // ----------------------------------------------------------------------------- |
676 // ----------------------------------------------------------------------------- |
639 // IAUpdateEngine::InformRequestObserver |
677 // IAUpdateEngine::InformRequestObserver |
640 // |
678 // |
641 // ----------------------------------------------------------------------------- |
679 // ----------------------------------------------------------------------------- |
642 // |
680 // |
643 void IAUpdateEngine::InformRequestObserver( TInt aError ) |
681 void IAUpdateEngine::InformRequestObserver(int aError) |
644 { |
682 { |
645 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::InformRequestObserver() begin"); |
683 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::InformRequestObserver() begin"); |
646 |
684 |
647 //if ( iRequestObserver ) |
685 //if ( iRequestObserver ) |
648 if ( iRequestIssued ) |
686 if (mRequestIssued) |
649 { |
687 { |
650 if ( iController->ClosingAllowedByClient() ) |
688 if (iController->ClosingAllowedByClient()) |
651 { |
689 { |
652 if ( iRequestType != IAUpdateUiDefines::ENoRequest ) |
690 if (mRequestType != IAUpdateUiDefines::ENoRequest) |
653 { |
691 { |
654 // if ( iRequestType == IAUpdateUiDefines::EUpdateQuery && iUpdateNow ) |
692 // if ( iRequestType == IAUpdateUiDefines::EUpdateQuery && iUpdateNow ) |
655 // { |
693 // { |
656 // if ( !iBackgroundTimer ) |
694 // if ( !iBackgroundTimer ) |
657 // { |
695 // { |
658 // iBackgroundTimer = CIAUpdateUITimer::NewL( *this, CIAUpdateUITimer::EBackgroundDelay ); |
696 // iBackgroundTimer = CIAUpdateUITimer::NewL( *this, CIAUpdateUITimer::EBackgroundDelay ); |
659 // } |
697 // } |
660 // if ( !iBackgroundTimer->IsActive() ) |
698 // if ( !iBackgroundTimer->IsActive() ) |
661 // { |
699 // { |
662 // iBackgroundTimer->After( 500000 ); |
700 // iBackgroundTimer->After( 500000 ); |
663 // } |
701 // } |
664 // } |
702 // } |
665 // else |
703 // else |
666 // { |
704 // { |
667 iEikEnv->RootWin().SetOrdinalPosition( -1, ECoeWinPriorityNeverAtFront ); |
705 iEikEnv->RootWin().SetOrdinalPosition(-1, |
668 // } |
706 ECoeWinPriorityNeverAtFront); |
669 } |
707 // } |
670 } |
708 } |
671 |
709 } |
672 switch ( iRequestType ) |
710 |
|
711 switch (mRequestType) |
673 { |
712 { |
674 case IAUpdateUiDefines::ENoRequest: |
713 case IAUpdateUiDefines::ENoRequest: |
675 { |
714 { |
676 mServiceProvider->completeLauncherLaunch( aError ); |
715 mServiceProvider->completeLauncherLaunch(aError); |
677 break; |
716 break; |
678 } |
717 } |
679 case IAUpdateUiDefines::ECheckUpdates: |
718 case IAUpdateUiDefines::ECheckUpdates: |
680 { |
719 { |
681 mServiceProvider->completeCheckUpdates( iController->CountOfAvailableUpdates(), aError ); |
720 mServiceProvider->completeCheckUpdates( |
|
721 iController->CountOfAvailableUpdates(), aError); |
682 break; |
722 break; |
683 } |
723 } |
684 case IAUpdateUiDefines::EShowUpdates: |
724 case IAUpdateUiDefines::EShowUpdates: |
685 { |
725 { |
686 CIAUpdateResult* result( NULL ); |
726 CIAUpdateResult* result(NULL); |
687 TRAPD( error, result = CIAUpdateResult::NewL() ) |
727 TRAPD( error, result = CIAUpdateResult::NewL() ) |
688 if ( result ) |
728 if (result) |
689 { |
729 { |
690 TIAUpdateResultsInfo resultsInfo( iController->ResultsInfo() ); |
730 TIAUpdateResultsInfo resultsInfo( |
691 IAUPDATE_TRACE_3("[IAUPDATE] IAUpdateEngine::InformRequestObserver succeed: %d failed: %d cancelled: %d", |
731 iController->ResultsInfo()); |
692 resultsInfo.iCountSuccessfull, |
732 IAUPDATE_TRACE_3("[IAUPDATE] IAUpdateEngine::InformRequestObserver succeed: %d failed: %d cancelled: %d", |
693 resultsInfo.iCountFailed, |
733 resultsInfo.iCountSuccessfull, |
694 resultsInfo.iCountCancelled ); |
734 resultsInfo.iCountFailed, |
695 result->SetSuccessCount( resultsInfo.iCountSuccessfull ); |
735 resultsInfo.iCountCancelled ); |
696 result->SetFailCount( resultsInfo.iCountFailed ); |
736 result->SetSuccessCount(resultsInfo.iCountSuccessfull); |
697 result->SetCancelCount( resultsInfo.iCountCancelled ); |
737 result->SetFailCount(resultsInfo.iCountFailed); |
698 mServiceProvider->completeShowUpdates( result, aError ); |
738 result->SetCancelCount(resultsInfo.iCountCancelled); |
|
739 mServiceProvider->completeShowUpdates(result, aError); |
699 // Ownership of result is transferred here. |
740 // Ownership of result is transferred here. |
700 } |
741 } |
701 else |
742 else |
702 { |
743 { |
703 mServiceProvider->completeShowUpdates( NULL, error ); |
744 mServiceProvider->completeShowUpdates(NULL, error); |
704 } |
745 } |
705 break; |
746 break; |
706 } |
747 } |
707 case IAUpdateUiDefines::EUpdateQuery: |
748 case IAUpdateUiDefines::EUpdateQuery: |
708 { |
749 { |
709 mServiceProvider->completeUpdateQuery( iUpdateNow, aError ); |
750 mServiceProvider->completeUpdateQuery(mUpdateNow, aError); |
710 break; |
751 break; |
711 } |
752 } |
712 default: |
753 default: |
713 { |
754 { |
714 break; |
755 break; |
715 } |
756 } |
716 } |
757 } |
717 |
758 |
718 //iRequestObserver = NULL; |
759 mRequestIssued = false; |
719 iRequestIssued = EFalse; |
760 } |
720 } |
761 |
721 |
|
722 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::InformRequestObserver() end"); |
762 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::InformRequestObserver() end"); |
723 } |
763 } |
724 |
|
725 |
764 |
726 // --------------------------------------------------------------------------- |
765 // --------------------------------------------------------------------------- |
727 // IAUpdateEngine::SetDefaultConnectionMethodL |
766 // IAUpdateEngine::SetDefaultConnectionMethodL |
728 // Sets the connection method for the update network connection. |
767 // Sets the connection method for the update network connection. |
729 // --------------------------------------------------------------------------- |
768 // --------------------------------------------------------------------------- |
730 // |
769 // |
731 void IAUpdateEngine::SetDefaultConnectionMethodL( TBool aTotalSilent ) |
770 void IAUpdateEngine::SetDefaultConnectionMethodL(bool aTotalSilent) |
732 { |
771 { |
733 if ( aTotalSilent ) |
772 if (aTotalSilent) |
734 { |
773 { |
735 // from back ground checker, choose the IAP to make the internet access silent |
774 // from back ground checker, choose the IAP to make the internet access silent |
736 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() begin"); |
775 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() begin"); |
737 |
776 |
738 TUint32 connectionMethodId( 0 ); |
777 uint connectionMethodId(0); |
739 TInt connMethodId( 0 ); |
778 int connMethodId(0); |
740 |
779 |
741 // Let's first check whether cenrep contains SNAP id other than zero |
780 // Let's first check whether cenrep contains SNAP id other than zero |
742 CRepository* cenrep( CRepository::NewLC( KCRUidIAUpdateSettings ) ); |
781 CRepository* cenrep(CRepository::NewLC(KCRUidIAUpdateSettings)); |
743 User::LeaveIfError( |
782 User::LeaveIfError(cenrep->Get(KIAUpdateAccessPoint, connMethodId)); |
744 cenrep->Get( KIAUpdateAccessPoint, connMethodId ) ); |
783 CleanupStack::PopAndDestroy(cenrep); |
745 CleanupStack::PopAndDestroy( cenrep ); |
784 cenrep = NULL; |
746 cenrep = NULL; |
785 |
747 |
786 RCmManager cmManager; |
748 RCmManagerExt cmManagerExt; |
787 cmManager.OpenL(); |
749 cmManagerExt.OpenL(); |
788 CleanupClosePushL(cmManager); |
750 CleanupClosePushL( cmManagerExt ); |
789 |
751 |
790 if (connMethodId == -1) |
752 if ( connMethodId == -1 ) |
791 { |
753 { |
792 IAUPDATE_TRACE("[IAUPDATE] user chooses default connection, use IAP logic"); |
754 IAUPDATE_TRACE("[IAUPDATE] user chooses default connection, use IAP logic"); |
793 |
755 |
794 //check what is the default connection by users |
756 //check what is the default connection by users |
795 |
757 |
796 TCmDefConnValue DCSetting; |
758 TCmDefConnValue DCSetting; |
797 cmManager.ReadDefConnL(DCSetting); |
759 cmManagerExt.ReadDefConnL( DCSetting ); |
798 |
760 |
799 switch (DCSetting.iType) |
761 |
800 { |
762 switch ( DCSetting.iType ) |
801 case ECmDefConnAlwaysAsk: |
763 { |
802 case ECmDefConnAskOnce: |
764 case ECmDefConnAlwaysAsk: |
803 { |
765 case ECmDefConnAskOnce: |
804 //go with the best IAP under internet snap |
766 { |
805 connectionMethodId = GetBestIAPInAllSNAPsL(cmManager); |
767 //go with the best IAP under internet snap |
806 break; |
768 connectionMethodId = GetBestIAPInAllSNAPsL( cmManagerExt ); |
807 } |
769 break; |
808 case ECmDefConnDestination: |
770 } |
809 { |
771 case ECmDefConnDestination: |
810 //go with the best IAP under this snap |
772 { |
811 connectionMethodId = GetBestIAPInThisSNAPL(cmManager, |
773 //go with the best IAP under this snap |
812 DCSetting.iId); |
774 connectionMethodId = GetBestIAPInThisSNAPL( cmManagerExt, DCSetting.iId ); |
813 break; |
775 break; |
814 } |
776 } |
815 case ECmDefConnConnectionMethod: |
777 case ECmDefConnConnectionMethod: |
816 { |
778 { |
817 //go with the best IAP under this snap |
779 //go with the best IAP under this snap |
818 connectionMethodId = DCSetting.iId; |
780 connectionMethodId = DCSetting.iId; |
819 break; |
781 break; |
820 } |
782 } |
821 } |
783 } |
822 } |
784 } |
823 else if (connMethodId == 0) |
785 else if ( connMethodId == 0 ) |
824 { |
786 { |
825 //no choice from user, we go with the best IAP under Internent SNAP |
787 //no choice from user, we go with the best IAP under Internent SNAP |
826 connectionMethodId = GetBestIAPInAllSNAPsL(cmManager); |
788 connectionMethodId = GetBestIAPInAllSNAPsL( cmManagerExt ); |
827 } |
789 } |
828 else |
790 else |
829 { |
791 { |
830 IAUPDATE_TRACE("[IAUPDATE] use chooses a snap"); |
792 IAUPDATE_TRACE("[IAUPDATE] use chooses a snap"); |
831 // It was some SNAP value |
793 // It was some SNAP value |
832 connectionMethodId = GetBestIAPInThisSNAPL(cmManager, |
794 connectionMethodId = GetBestIAPInThisSNAPL( cmManagerExt, connMethodId ); |
833 connMethodId); |
795 } |
834 } |
796 |
835 |
797 CleanupStack::PopAndDestroy( &cmManagerExt ); |
836 CleanupStack::PopAndDestroy(&cmManager); |
798 |
837 |
799 if ( connectionMethodId != 0 ) |
838 if (connectionMethodId != 0) |
800 { |
839 { |
801 TIAUpdateConnectionMethod connectionMethod( |
840 TIAUpdateConnectionMethod |
802 connectionMethodId, |
841 connectionMethod( |
803 TIAUpdateConnectionMethod::EConnectionMethodTypeAccessPoint ); |
842 connectionMethodId, |
804 |
843 TIAUpdateConnectionMethod::EConnectionMethodTypeAccessPoint); |
805 iController->SetDefaultConnectionMethodL( connectionMethod ); |
844 |
806 } |
845 iController->SetDefaultConnectionMethodL(connectionMethod); |
807 else |
846 } |
808 { |
847 else |
809 //In the totally silent case, if no usable IAP, we complete the check update with 0 updates. |
848 { |
810 //the bgchecker will try again later after 1 month. |
849 //In the totally silent case, if no usable IAP, we complete the check update with 0 updates. |
811 //The LEAVE will be catched up later and complete the request from background checker. |
850 //the bgchecker will try again later after 1 month. |
812 User::LeaveIfError( KErrNotFound ); |
851 //The LEAVE will be catched up later and complete the request from background checker. |
813 |
852 User::LeaveIfError(KErrNotFound); |
814 //the following code will pop up dialog to ask from user, just for proto |
853 } |
815 /* connectionMethodId = 0; |
854 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() end"); |
816 TIAUpdateConnectionMethod connectionMethod( |
|
817 connectionMethodId, TIAUpdateConnectionMethod::EConnectionMethodTypeDefault ); |
|
818 |
|
819 iController->SetDefaultConnectionMethodL( connectionMethod );*/ |
|
820 } |
|
821 |
|
822 |
|
823 |
|
824 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() end"); |
|
825 } |
855 } |
826 else |
856 else |
827 { |
857 { |
828 // from grid, use the old logic |
858 // from grid, use the old logic |
829 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() begin"); |
859 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() begin"); |
830 TUint32 connectionMethodId( 0 ); |
860 uint connectionMethodId(0); |
831 TInt connMethodId( 0 ); |
861 int connMethodId(0); |
832 |
862 |
833 // Set initial value to always ask |
863 // Set initial value to always ask |
834 TInt connectionMethodType( TIAUpdateConnectionMethod::EConnectionMethodTypeAlwaysAsk ); |
864 int connectionMethodType( |
835 TBool needSaving(EFalse); |
865 TIAUpdateConnectionMethod::EConnectionMethodTypeAlwaysAsk); |
836 |
866 bool needSaving(false); |
837 // Let's first check whether cenrep contains SNAP id other than zero |
867 |
838 CRepository* cenrep( CRepository::NewLC( KCRUidIAUpdateSettings ) ); |
868 // Let's first check whether cenrep contains SNAP id other than zero |
839 User::LeaveIfError( |
869 CRepository* cenrep(CRepository::NewLC(KCRUidIAUpdateSettings)); |
840 cenrep->Get( KIAUpdateAccessPoint, connMethodId ) ); |
870 User::LeaveIfError(cenrep->Get(KIAUpdateAccessPoint, connMethodId)); |
841 CleanupStack::PopAndDestroy( cenrep ); |
871 CleanupStack::PopAndDestroy(cenrep); |
842 cenrep = NULL; |
872 cenrep = NULL; |
843 |
873 |
844 if ( connMethodId == -1 ) |
874 if (connMethodId == -1) |
845 { |
875 { |
846 IAUPDATE_TRACE("[IAUPDATE] user chooses default connection, use IAP logic"); |
876 IAUPDATE_TRACE("[IAUPDATE] user chooses default connection, use IAP logic"); |
847 |
877 |
848 connectionMethodId = 0; |
878 connectionMethodId = 0; |
849 connectionMethodType = TIAUpdateConnectionMethod::EConnectionMethodTypeDefault; |
879 connectionMethodType |
850 } |
880 = TIAUpdateConnectionMethod::EConnectionMethodTypeDefault; |
851 else if ( connMethodId == 0 ) |
881 } |
852 { |
882 else if (connMethodId == 0) |
853 |
883 { |
854 IAUPDATE_TRACE("[IAUPDATE] use chooses nothing, use internal IAP logic"); |
884 IAUPDATE_TRACE("[IAUPDATE] use chooses nothing, use internal IAP logic"); |
855 //if nothing is set by user, use our new logic |
885 //if nothing is set by user, use our new logic |
856 //SetDefaultConnectionMethod2L(); |
886 //SetDefaultConnectionMethod2L(); |
857 //return; |
887 //return; |
858 // CenRep didn't contain any SNAP id. Let's try Internet SNAP then. |
888 // CenRep didn't contain any SNAP id. Let's try Internet SNAP then. |
859 |
889 |
860 RCmManagerExt cmManagerExt; |
890 RCmManager cmManager; |
861 cmManagerExt.OpenL(); |
891 cmManager.OpenL(); |
862 CleanupClosePushL( cmManagerExt ); |
892 CleanupClosePushL(cmManager); |
863 iDestIdArray.Reset(); |
893 iDestIdArray.Reset(); |
864 cmManagerExt.AllDestinationsL( iDestIdArray ); |
894 cmManager.AllDestinationsL(iDestIdArray); |
865 |
895 |
866 for ( TInt i = 0; i< iDestIdArray.Count(); i++ ) |
896 for (int i = 0; i < iDestIdArray.Count(); i++) |
867 { |
897 { |
868 RCmDestinationExt dest = cmManagerExt.DestinationL( iDestIdArray[i] ); |
898 RCmDestination dest = cmManager.DestinationL(iDestIdArray[i]); |
869 CleanupClosePushL( dest ); |
899 CleanupClosePushL(dest); |
870 |
900 |
871 if ( dest.MetadataL( CMManager::ESnapMetadataInternet ) ) |
901 if (dest.MetadataL(CMManager::ESnapMetadataInternet)) |
872 { |
902 { |
873 // Check whether Internet SNAP contains any IAP. |
903 // Check whether Internet SNAP contains any IAP. |
874 if ( dest.ConnectionMethodCount() > 0 ) |
904 if (dest.ConnectionMethodCount() > 0) |
875 { |
905 { |
876 connectionMethodId = iDestIdArray[i]; |
906 connectionMethodId = iDestIdArray[i]; |
877 needSaving = ETrue; |
907 needSaving = true; |
878 IAUPDATE_TRACE_1("[IAUPDATE] connectionMethodId: %d", connectionMethodId ); |
908 IAUPDATE_TRACE_1("[IAUPDATE] connectionMethodId: %d", connectionMethodId ); |
879 } |
909 } |
880 CleanupStack::PopAndDestroy( &dest ); |
910 CleanupStack::PopAndDestroy(&dest); |
881 break; |
911 break; |
882 } |
912 } |
883 |
913 |
884 CleanupStack::PopAndDestroy( &dest ); |
914 CleanupStack::PopAndDestroy(&dest); |
885 } |
915 } |
886 iDestIdArray.Reset(); |
916 iDestIdArray.Reset(); |
887 CleanupStack::PopAndDestroy( &cmManagerExt ); |
917 CleanupStack::PopAndDestroy(&cmManager); |
888 } |
918 } |
889 else |
919 else |
890 { |
920 { |
891 IAUPDATE_TRACE("[IAUPDATE] use chooses a snap"); |
921 IAUPDATE_TRACE("[IAUPDATE] use chooses a snap"); |
892 // It was some SNAP value |
922 // It was some SNAP value |
893 connectionMethodId = connMethodId; |
923 connectionMethodId = connMethodId; |
894 } |
924 } |
895 |
925 |
896 if ( connectionMethodId > 0) |
926 if (connectionMethodId > 0) |
897 { |
927 { |
898 // We have now some valid SNAP id, either from CenRep or Internet SNAP |
928 // We have now some valid SNAP id, either from CenRep or Internet SNAP |
899 connectionMethodType = TIAUpdateConnectionMethod::EConnectionMethodTypeDestination; |
929 connectionMethodType |
900 // Save to cenrep if needed |
930 = TIAUpdateConnectionMethod::EConnectionMethodTypeDestination; |
901 if ( needSaving ) |
931 // Save to cenrep if needed |
902 { |
932 if (needSaving) |
903 cenrep = CRepository::NewLC( KCRUidIAUpdateSettings ); |
933 { |
904 TInt err = cenrep->StartTransaction( CRepository::EReadWriteTransaction ); |
934 cenrep = CRepository::NewLC(KCRUidIAUpdateSettings); |
905 User::LeaveIfError( err ); |
935 int err = cenrep->StartTransaction( |
906 cenrep->CleanupCancelTransactionPushL(); |
936 CRepository::EReadWriteTransaction); |
907 |
937 User::LeaveIfError(err); |
908 connMethodId = connectionMethodId; |
938 cenrep->CleanupCancelTransactionPushL(); |
909 err = cenrep->Set( KIAUpdateAccessPoint, connMethodId ); |
939 |
910 User::LeaveIfError( err ); |
940 connMethodId = connectionMethodId; |
911 TUint32 ignore = KErrNone; |
941 err = cenrep->Set(KIAUpdateAccessPoint, connMethodId); |
912 User::LeaveIfError( cenrep->CommitTransaction( ignore ) ); |
942 User::LeaveIfError(err); |
913 CleanupStack::PopAndDestroy(); // CleanupCancelTransactionPushL() |
943 TUint32 ignore = KErrNone; |
914 CleanupStack::PopAndDestroy( cenrep ); |
944 User::LeaveIfError(cenrep->CommitTransaction(ignore)); |
915 } |
945 CleanupStack::PopAndDestroy(); // CleanupCancelTransactionPushL() |
916 } |
946 CleanupStack::PopAndDestroy(cenrep); |
917 |
947 } |
918 TIAUpdateConnectionMethod connectionMethod( |
948 } |
919 connectionMethodId, |
949 |
920 static_cast< TIAUpdateConnectionMethod::TConnectionMethodType >( connectionMethodType ) ); |
950 TIAUpdateConnectionMethod |
921 |
951 connectionMethod( |
922 iController->SetDefaultConnectionMethodL( connectionMethod ); |
952 connectionMethodId, |
923 |
953 static_cast<TIAUpdateConnectionMethod::TConnectionMethodType> (connectionMethodType)); |
924 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() end"); |
954 |
925 } |
955 iController->SetDefaultConnectionMethodL(connectionMethod); |
926 |
956 |
927 } |
957 IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() end"); |
928 |
958 } |
|
959 } |
929 |
960 |
930 // --------------------------------------------------------------------------- |
961 // --------------------------------------------------------------------------- |
931 // IAUpdateEngine::GetBestIAPInAllSNAPsL |
962 // IAUpdateEngine::GetBestIAPInAllSNAPsL |
932 // Sets the best IAP from all snaps |
963 // Sets the best IAP from all snaps |
933 // --------------------------------------------------------------------------- |
964 // --------------------------------------------------------------------------- |
934 // |
965 // |
935 TUint32 IAUpdateEngine::GetBestIAPInAllSNAPsL( RCmManagerExt& aCmManagerExt ) |
966 uint IAUpdateEngine::GetBestIAPInAllSNAPsL(RCmManager& aCmManager) |
936 { |
967 { |
937 //go with internet SNAP first. |
968 //go with internet SNAP first. |
938 TUint32 IAPID = 0; |
969 uint IAPID = 0; |
939 IAPID = GetBestIAPInInternetSNAPL( aCmManagerExt ); |
970 IAPID = GetBestIAPInInternetSNAPL(aCmManager); |
940 |
971 |
941 if ( IAPID ) |
972 if (IAPID) |
942 { |
973 { |
943 return IAPID; |
974 return IAPID; |
944 } |
975 } |
945 |
976 |
946 //select IAP from rest of the SNAPs |
977 //select IAP from rest of the SNAPs |
947 iDestIdArray.Reset(); |
978 iDestIdArray.Reset(); |
948 aCmManagerExt.AllDestinationsL( iDestIdArray ); |
979 aCmManager.AllDestinationsL(iDestIdArray); |
949 |
980 |
950 for ( TInt i = 0; i< iDestIdArray.Count(); i++ ) |
981 for (int i = 0; i < iDestIdArray.Count(); i++) |
951 { |
982 { |
952 TUint32 SNAPID = iDestIdArray[i]; |
983 uint SNAPID = iDestIdArray[i]; |
953 IAPID = GetBestIAPInThisSNAPL( aCmManagerExt, SNAPID ); |
984 IAPID = GetBestIAPInThisSNAPL(aCmManager, SNAPID); |
954 if ( IAPID ) |
985 if (IAPID) |
955 { |
986 { |
956 break; |
987 break; |
957 } |
988 } |
958 } |
989 } |
959 iDestIdArray.Reset(); |
990 iDestIdArray.Reset(); |
960 return IAPID; |
991 return IAPID; |
961 } |
992 } |
962 |
993 |
963 |
|
964 |
|
965 // --------------------------------------------------------------------------- |
994 // --------------------------------------------------------------------------- |
966 // IAUpdateEngine::GetBestIAPInInternetSNAPL |
995 // IAUpdateEngine::GetBestIAPInInternetSNAPL |
967 // Sets the best IAP from internet snap |
996 // Sets the best IAP from internet snap |
968 // --------------------------------------------------------------------------- |
997 // --------------------------------------------------------------------------- |
969 // |
998 // |
970 TUint32 IAUpdateEngine::GetBestIAPInInternetSNAPL( RCmManagerExt& aCmManagerExt ) |
999 uint IAUpdateEngine::GetBestIAPInInternetSNAPL(RCmManager& aCmManager) |
971 { |
1000 { |
972 //select IAP from Internet SNAP |
1001 //select IAP from Internet SNAP |
973 iDestIdArray.Reset(); |
1002 iDestIdArray.Reset(); |
974 aCmManagerExt.AllDestinationsL( iDestIdArray ); |
1003 aCmManager.AllDestinationsL(iDestIdArray); |
975 TUint32 InternetSNAPID = 0; |
1004 uint InternetSNAPID = 0; |
976 for ( TInt i = 0; i< iDestIdArray.Count(); i++ ) |
1005 for (int i = 0; i < iDestIdArray.Count(); i++) |
977 { |
1006 { |
978 RCmDestinationExt dest = aCmManagerExt.DestinationL( iDestIdArray[i] ); |
1007 RCmDestination dest = aCmManager.DestinationL(iDestIdArray[i]); |
979 CleanupClosePushL( dest ); |
1008 CleanupClosePushL(dest); |
980 |
1009 |
981 if ( dest.MetadataL( CMManager::ESnapMetadataInternet ) ) |
1010 if (dest.MetadataL(CMManager::ESnapMetadataInternet)) |
982 { |
1011 { |
983 InternetSNAPID = iDestIdArray[i]; |
1012 InternetSNAPID = iDestIdArray[i]; |
984 CleanupStack::PopAndDestroy( &dest ); |
1013 CleanupStack::PopAndDestroy(&dest); |
985 break; |
1014 break; |
986 } |
1015 } |
987 CleanupStack::PopAndDestroy( &dest ); |
1016 CleanupStack::PopAndDestroy(&dest); |
988 } |
1017 } |
989 iDestIdArray.Reset(); |
1018 iDestIdArray.Reset(); |
990 |
1019 |
991 return GetBestIAPInThisSNAPL( aCmManagerExt, InternetSNAPID ); |
1020 return GetBestIAPInThisSNAPL(aCmManager, InternetSNAPID); |
992 } |
1021 } |
993 |
|
994 |
|
995 |
1022 |
996 // --------------------------------------------------------------------------- |
1023 // --------------------------------------------------------------------------- |
997 // IAUpdateEngine::GetBestIAPInThisSNAPL |
1024 // IAUpdateEngine::GetBestIAPInThisSNAPL |
998 // Sets the best IAP from the given snap |
1025 // Sets the best IAP from the given snap |
999 // --------------------------------------------------------------------------- |
1026 // --------------------------------------------------------------------------- |
1000 // |
1027 // |
1001 TUint32 IAUpdateEngine::GetBestIAPInThisSNAPL( RCmManagerExt& aCmManagerExt, TUint32 aSNAPID ) |
1028 uint IAUpdateEngine::GetBestIAPInThisSNAPL(RCmManager& aCmManager, |
|
1029 uint aSNAPID) |
1002 { |
1030 { |
1003 //get all usable IAPs |
1031 //get all usable IAPs |
1004 TConnMonIapInfoBuf iapInfo; |
1032 TConnMonIapInfoBuf iapInfo; |
1005 TRequestStatus status; |
1033 TRequestStatus status; |
1006 |
1034 |
1007 RConnectionMonitor connMon; |
1035 RConnectionMonitor connMon; |
1008 connMon.ConnectL(); |
1036 connMon.ConnectL(); |
1009 CleanupClosePushL( connMon ); |
1037 CleanupClosePushL(connMon); |
1010 |
1038 |
1011 connMon.GetPckgAttribute( EBearerIdAll, 0, KIapAvailability,iapInfo, status ); |
1039 connMon.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iapInfo, |
1012 User::WaitForRequest( status ); |
1040 status); |
1013 User::LeaveIfError( status.Int() ); |
1041 User::WaitForRequest(status); |
1014 |
1042 User::LeaveIfError(status.Int()); |
1015 CleanupStack::PopAndDestroy( &connMon ); |
1043 |
1016 |
1044 CleanupStack::PopAndDestroy(&connMon); |
1017 RCmDestinationExt dest = aCmManagerExt.DestinationL( aSNAPID ); |
1045 |
1018 CleanupClosePushL( dest ); |
1046 RCmDestination dest = aCmManager.DestinationL(aSNAPID); |
1019 |
1047 CleanupClosePushL(dest); |
|
1048 |
1020 // Check whether the SNAP contains any IAP. |
1049 // Check whether the SNAP contains any IAP. |
1021 for (TInt i = 0; i < dest.ConnectionMethodCount(); i++ ) |
1050 for (int i = 0; i < dest.ConnectionMethodCount(); i++) |
1022 { |
1051 { |
1023 RCmConnectionMethodExt cm = dest.ConnectionMethodL( i ); |
1052 RCmConnectionMethod cm = dest.ConnectionMethodL(i); |
1024 CleanupClosePushL( cm ); |
1053 CleanupClosePushL(cm); |
1025 |
1054 |
1026 TUint32 iapid= cm.GetIntAttributeL( CMManager::ECmIapId ); |
1055 uint iapid = cm.GetIntAttributeL(CMManager::ECmIapId); |
1027 |
1056 |
1028 for ( TInt i = 0; i < iapInfo().iCount; i++ ) |
1057 for (int i = 0; i < iapInfo().iCount; i++) |
1029 { |
1058 { |
1030 if ( iapInfo().iIap[i].iIapId == iapid ) |
1059 if (iapInfo().iIap[i].iIapId == iapid) |
1031 { |
1060 { |
1032 CleanupStack::PopAndDestroy( 2 ); //cm & dest; |
1061 CleanupStack::PopAndDestroy(2); //cm & dest; |
1033 return iapid; |
1062 return iapid; |
1034 } |
1063 } |
1035 } |
1064 } |
1036 |
1065 |
1037 CleanupStack::PopAndDestroy( &cm ); |
1066 CleanupStack::PopAndDestroy(&cm); |
1038 } |
1067 } |
1039 |
1068 |
1040 CleanupStack::PopAndDestroy( &dest ); |
1069 CleanupStack::PopAndDestroy(&dest); |
1041 return 0; |
1070 return 0; |
1042 } |
1071 } |
1043 |
1072 |
1044 // ----------------------------------------------------------------------------- |
1073 // ----------------------------------------------------------------------------- |
1045 // IAUpdateEngine::ShowUpdateQueryL |
1074 // IAUpdateEngine::ShowUpdateQueryL |