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