|
1 /* |
|
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CSC Applicationīs Service View |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <csc.rsg> |
|
20 #include <eikclb.h> |
|
21 #include <apgcli.h> |
|
22 #include <hlplch.h> |
|
23 #include <featmgr.h> |
|
24 #include <aknview.h> |
|
25 #include <akntitle.h> |
|
26 #include <aknlists.h> |
|
27 #include <cchclient.h> |
|
28 #include <AknsUtils.h> |
|
29 #include <StringLoader.h> |
|
30 #include <cscsettingsui.h> |
|
31 #include <xSPViewServices.h> |
|
32 #include <AiwServiceHandler.h> |
|
33 #include <mspnotifychangeobserver.h> |
|
34 |
|
35 #include "csc.hrh" |
|
36 #include "cscappui.h" |
|
37 #include "csclogger.h" |
|
38 #include "cscdialog.h" |
|
39 #include "cscconstants.h" |
|
40 #include "cscserviceview.h" |
|
41 #include "cscnoteutilities.h" |
|
42 #include "cscengcchhandler.h" |
|
43 #include "cscservicecontainer.h" |
|
44 #include "cscengstartuphandler.h" |
|
45 #include "cscengservicehandler.h" |
|
46 #include "cscengbrandinghandler.h" |
|
47 #include "cscengservicepluginhandler.h" |
|
48 #include "cscenguiextensionpluginhandler.h" |
|
49 |
|
50 |
|
51 |
|
52 // ======== MEMBER FUNCTIONS ======== |
|
53 |
|
54 const TUid KAIAppUid = { 0x102750F0 }; // active idle app uid |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 CCSCServiceView::CCSCServiceView( |
|
60 CCSCEngServicePluginHandler& aServicePluginHandler, |
|
61 CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler, |
|
62 CCSCEngStartupHandler& aStartupHandler, |
|
63 CCSCEngServiceHandler& aServiceHandler, |
|
64 CCSCEngBrandingHandler& aBrandingHandler, |
|
65 CCSCEngCCHHandler& aCCHHandler ) |
|
66 : |
|
67 iServicePluginHandler( aServicePluginHandler ), |
|
68 iUiExtensionPluginHandler( aUiExtensionPluginHandler ), |
|
69 iStartupHandler( aStartupHandler ), |
|
70 iServiceHandler( aServiceHandler ), |
|
71 iBrandingHandler( aBrandingHandler ), |
|
72 iCCHHandler( aCCHHandler ), |
|
73 iStartup( ETrue ) |
|
74 { |
|
75 } |
|
76 |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void CCSCServiceView::ConstructL() |
|
82 { |
|
83 CSCDEBUG( "CCSCServiceView::ConstructL - begin" ); |
|
84 |
|
85 BaseConstructL( R_CSC_VIEW_SERVICE ); |
|
86 iSettingsUi = CCSCSettingsUi::NewL( *iEikonEnv ); |
|
87 |
|
88 CSCDEBUG( "CCSCServiceView::ConstructL - end" ); |
|
89 } |
|
90 |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 CCSCServiceView* CCSCServiceView::NewL( |
|
96 CCSCEngServicePluginHandler& aServicePluginHandler, |
|
97 CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler, |
|
98 CCSCEngStartupHandler& aStartupHandler, |
|
99 CCSCEngServiceHandler& aServiceHandler, |
|
100 CCSCEngBrandingHandler& aBrandingHandler, |
|
101 CCSCEngCCHHandler& aCCHHandler ) |
|
102 { |
|
103 CCSCServiceView* self = |
|
104 CCSCServiceView::NewLC( |
|
105 aServicePluginHandler, |
|
106 aUiExtensionPluginHandler, |
|
107 aStartupHandler, |
|
108 aServiceHandler, |
|
109 aBrandingHandler, |
|
110 aCCHHandler ); |
|
111 |
|
112 CleanupStack::Pop( self ); |
|
113 return self; |
|
114 } |
|
115 |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 CCSCServiceView* CCSCServiceView::NewLC( |
|
121 CCSCEngServicePluginHandler& aServicePluginHandler, |
|
122 CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler, |
|
123 CCSCEngStartupHandler& aStartupHandler, |
|
124 CCSCEngServiceHandler& aServiceHandler, |
|
125 CCSCEngBrandingHandler& aBrandingHandler, |
|
126 CCSCEngCCHHandler& aCCHHandler ) |
|
127 { |
|
128 CCSCServiceView* self = |
|
129 new( ELeave ) CCSCServiceView( |
|
130 aServicePluginHandler, |
|
131 aUiExtensionPluginHandler, |
|
132 aStartupHandler, |
|
133 aServiceHandler, |
|
134 aBrandingHandler, |
|
135 aCCHHandler ); |
|
136 |
|
137 CleanupStack::PushL( self ); |
|
138 self->ConstructL(); |
|
139 return self; |
|
140 } |
|
141 |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 CCSCServiceView::~CCSCServiceView() |
|
147 { |
|
148 CSCDEBUG( "CCSCServiceView::~CCSCServiceView - begin" ); |
|
149 |
|
150 iOfferedPluginUids.Reset(); |
|
151 |
|
152 delete iSettingsUi; |
|
153 delete iContainer; |
|
154 delete iEngTimer; |
|
155 |
|
156 CSCDEBUG( "CCSCServiceView::~CCSCServiceView - end" ); |
|
157 } |
|
158 |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // CCSCServiceView::InitializeWithStartupParametersL |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 void CCSCServiceView::InitializeWithStartupParametersL() |
|
165 { |
|
166 CSCDEBUG( "CCSCServiceView::InitializeWithStartupParametersL" ); |
|
167 |
|
168 CCSCEngStartupHandler::TAction action = iStartupHandler.GetParamAction(); |
|
169 TBool isServiceViewDefault = |
|
170 CCSCEngStartupHandler::EOpenSettingsUi != action; |
|
171 TUint serviceId = iStartupHandler.GetParamServiceId(); |
|
172 TUid tabViewId( KNullUid ); |
|
173 tabViewId.iUid = iServiceHandler.ServiceTabViewIdL( serviceId ); |
|
174 iSettingsUi->InitializeL( |
|
175 tabViewId, serviceId, isServiceViewDefault ? this : NULL ); |
|
176 } |
|
177 |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // From class CAknView. |
|
181 // Handles the commands. If the command is command which is require to |
|
182 // display outline-screen, the command display outline-screen |
|
183 // corresponded to required. |
|
184 // --------------------------------------------------------------------------- |
|
185 // |
|
186 void CCSCServiceView::HandleCommandL( TInt aCommand ) |
|
187 { |
|
188 CSCDEBUG2( "CCSCServiceView::HandleCommandL aCommand: %d", aCommand ); |
|
189 |
|
190 switch ( aCommand ) |
|
191 { |
|
192 case EAknSoftkeyOpen: |
|
193 case ECSCCmdOpen: |
|
194 case EAknSoftkeySelect: |
|
195 HandleListboxItemOpenL(); |
|
196 break; |
|
197 case ECSCCommandDelete: |
|
198 iContainer->DeleteServiceL(); |
|
199 break; |
|
200 case EAknCmdHelp: |
|
201 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
202 { |
|
203 CArrayFix<TCoeHelpContext>* buf = AppUi()->AppHelpContextL(); |
|
204 HlpLauncher::LaunchHelpApplicationL( |
|
205 iEikonEnv->WsSession(), buf ); |
|
206 } |
|
207 break; |
|
208 // Exit menu command. |
|
209 case EAknSoftkeyExit: |
|
210 AppUi()->HandleCommandL( EEikCmdExit ); |
|
211 break; |
|
212 case EAknSoftkeyBack: |
|
213 AppUi()->HandleCommandL( EAknSoftkeyBack ); |
|
214 break; |
|
215 // Let appui handle other commands. |
|
216 default: |
|
217 CSCDEBUG( "CCSCServiceView::HandleCommandL: !!DEFAULT!!" ); |
|
218 AppUi()->HandleCommandL( aCommand ); |
|
219 break; |
|
220 } |
|
221 } |
|
222 |
|
223 |
|
224 // --------------------------------------------------------------------------- |
|
225 // From class CAknView. |
|
226 // The ID of view. |
|
227 // --------------------------------------------------------------------------- |
|
228 // |
|
229 TUid CCSCServiceView::Id() const |
|
230 { |
|
231 return KCSCServiceViewId; |
|
232 } |
|
233 |
|
234 // --------------------------------------------------------------------------- |
|
235 // From class CAknView. |
|
236 // Handle foreground event. |
|
237 // --------------------------------------------------------------------------- |
|
238 // |
|
239 void CCSCServiceView::HandleForegroundEventL( TBool aForeground ) |
|
240 { |
|
241 if ( aForeground ) |
|
242 { |
|
243 ExecuteStartupActionsL( ETrue ); |
|
244 } |
|
245 } |
|
246 |
|
247 |
|
248 // --------------------------------------------------------------------------- |
|
249 // For handling ui extension plug-in exits |
|
250 // --------------------------------------------------------------------------- |
|
251 // |
|
252 void CCSCServiceView::HandleUiExtensionExitL() |
|
253 { |
|
254 CSCDEBUG( "CCSCServiceView::HandleUiExtensionExit - begin" ); |
|
255 |
|
256 AppUi()->ActivateLocalViewL( KCSCServiceViewId ); |
|
257 |
|
258 TUid appUid = iStartupHandler.GetParamAppUid(); |
|
259 |
|
260 if ( appUid.iUid ) |
|
261 { |
|
262 // Open application matching uid |
|
263 RApaLsSession session; |
|
264 CleanupClosePushL( session ); |
|
265 |
|
266 User::LeaveIfError(session.Connect()); |
|
267 |
|
268 TFileName fileName; |
|
269 TThreadId threadId; |
|
270 |
|
271 User::LeaveIfError( |
|
272 session.StartDocument( fileName, appUid, threadId ) ); |
|
273 |
|
274 CleanupStack::PopAndDestroy( &session ); |
|
275 |
|
276 // Reset startup parameter app uid |
|
277 iStartupHandler.ResetUid( CCSCEngStartupHandler::EAppUid ); |
|
278 } |
|
279 |
|
280 CSCDEBUG( "CCSCServiceView::HandleUiExtensionExit - end" ); |
|
281 } |
|
282 |
|
283 |
|
284 // --------------------------------------------------------------------------- |
|
285 // For updating service view |
|
286 // --------------------------------------------------------------------------- |
|
287 // |
|
288 void CCSCServiceView::UpdateServiceViewL() |
|
289 { |
|
290 CSCDEBUG( "CCSCServiceView::UpdateServiceViewL - begin" ); |
|
291 |
|
292 iContainer->UpdateServiceViewL(); |
|
293 |
|
294 CSCDEBUG( "CCSCServiceView::UpdateServiceViewL - end" ); |
|
295 } |
|
296 |
|
297 |
|
298 // --------------------------------------------------------------------------- |
|
299 // For deleting service. |
|
300 // --------------------------------------------------------------------------- |
|
301 // |
|
302 void CCSCServiceView::DeleteServiceL( TUint serviceId ) |
|
303 { |
|
304 CSCDEBUG( "CCSCServiceView::DeleteServiceL - begin" ); |
|
305 |
|
306 TUid pluginUid( KNullUid ); |
|
307 TInt32 servicePluginId( 0 ); |
|
308 |
|
309 TRAPD( err, servicePluginId = |
|
310 iServiceHandler.ServiceSetupPluginIdL( serviceId ) ); |
|
311 |
|
312 if ( !err && servicePluginId ) |
|
313 { |
|
314 pluginUid.iUid = servicePluginId; |
|
315 iContainer->HandleServicePluginRemovationL( pluginUid ); |
|
316 } |
|
317 else |
|
318 { |
|
319 iContainer->DeleteServiceL(); |
|
320 } |
|
321 |
|
322 CSCDEBUG( "CCSCServiceView::DeleteServiceL - end" ); |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // Shows information about failed configuration. |
|
327 // --------------------------------------------------------------------------- |
|
328 // |
|
329 void CCSCServiceView::ServiceConfiguringFailedL( TInt aIndex ) |
|
330 { |
|
331 CSCDEBUG( "CCSCServiceView::ServiceConfiguringFailedL - begin" ); |
|
332 |
|
333 TServicePluginInfo pluginInfo; |
|
334 |
|
335 if ( iServicePluginHandler.PluginCount( |
|
336 CCSCEngServicePluginHandler::EInitialized ) > aIndex ) |
|
337 { |
|
338 pluginInfo = iServicePluginHandler.ItemFromPluginInfoArray( aIndex ); |
|
339 |
|
340 if ( pluginInfo.iProviderName.Length() ) |
|
341 { |
|
342 CCSCNoteUtilities::ShowInformationNoteL( |
|
343 CCSCNoteUtilities::ECSCUnableToConfigureNote, |
|
344 pluginInfo.iProviderName ); |
|
345 } |
|
346 |
|
347 // Try to remove uncomplete settings by calling service setup plugin. |
|
348 iServicePluginHandler.DoRemovationL( pluginInfo.iPluginsUid, EFalse ); |
|
349 } |
|
350 |
|
351 AppUi()->ActivateLocalViewL( KCSCServiceViewId ); |
|
352 |
|
353 CSCDEBUG( "CCSCServiceView::ServiceConfiguringFailedL - end" ); |
|
354 } |
|
355 |
|
356 |
|
357 // --------------------------------------------------------------------------- |
|
358 // Hides dialog wait note. |
|
359 // --------------------------------------------------------------------------- |
|
360 // |
|
361 void CCSCServiceView::HideDialogWaitNote() |
|
362 { |
|
363 if ( iContainer ) |
|
364 { |
|
365 iContainer->HideDialogWaitNote(); |
|
366 } |
|
367 } |
|
368 |
|
369 // --------------------------------------------------------------------------- |
|
370 // From class MEikListBoxObserver. |
|
371 // For handling list box events. |
|
372 // --------------------------------------------------------------------------- |
|
373 // |
|
374 void CCSCServiceView::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
375 TListBoxEvent aEventType ) |
|
376 { |
|
377 CSCDEBUG2( "CCSCServiceView::HandleListBoxEventL aEventType: %d", |
|
378 aEventType ); |
|
379 |
|
380 switch( aEventType ) |
|
381 { |
|
382 case EEventEnterKeyPressed: |
|
383 case EEventItemSingleClicked: |
|
384 HandleListboxItemOpenL(); |
|
385 break; |
|
386 default: |
|
387 CSCDEBUG( "CCSCServiceView::HandleListBoxEventL !!DEFAULT!!" ); |
|
388 break; |
|
389 } |
|
390 } |
|
391 |
|
392 |
|
393 // --------------------------------------------------------------------------- |
|
394 // From class MCSCServiceContainerObserver. |
|
395 // Update softkey. |
|
396 // --------------------------------------------------------------------------- |
|
397 // |
|
398 void CCSCServiceView::UpdateCbaL() |
|
399 { |
|
400 if( !Cba() ) |
|
401 { |
|
402 return; |
|
403 } |
|
404 |
|
405 TInt commandId ( EAknSoftkeyOpen ); |
|
406 HBufC* selectText = StringLoader::LoadLC( R_CSC_MSK_SELECT ); |
|
407 HBufC* openText = StringLoader::LoadLC( R_CSC_MSK_OPEN ); |
|
408 |
|
409 if( iContainer->CurrentItemIndex() >= 0 ) |
|
410 { |
|
411 if( iContainer->ListBoxItem().iPluginUid != KAccountCreationPluginUID ) |
|
412 { |
|
413 Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
414 commandId, *openText ); |
|
415 } |
|
416 else |
|
417 { |
|
418 commandId = EAknSoftkeySelect; |
|
419 Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
420 commandId, *selectText ); |
|
421 } |
|
422 } |
|
423 else |
|
424 { |
|
425 Cba()->MakeCommandVisibleByPosition( |
|
426 CEikButtonGroupContainer::EMiddleSoftkeyPosition, EFalse ); |
|
427 } |
|
428 |
|
429 Cba()->DrawDeferred(); |
|
430 CleanupStack::PopAndDestroy( openText ); |
|
431 CleanupStack::PopAndDestroy( selectText ); |
|
432 } |
|
433 |
|
434 |
|
435 // --------------------------------------------------------------------------- |
|
436 // For handling listbox item opening |
|
437 // --------------------------------------------------------------------------- |
|
438 // |
|
439 void CCSCServiceView::HandleListboxItemOpenL() |
|
440 { |
|
441 CSCDEBUG( "CCSCServiceView::HandleListboxItemOpen - begin" ); |
|
442 |
|
443 TListBoxItem item = iContainer->ListBoxItem(); |
|
444 |
|
445 switch ( item.iItemType ) |
|
446 { |
|
447 case TListBoxItem::EUiExtension: |
|
448 { |
|
449 iUiExtensionPluginHandler.LaunchUiExtensionL( |
|
450 item.iPluginUid, Id() ); |
|
451 break; |
|
452 } |
|
453 case TListBoxItem::EGeneralService: |
|
454 case TListBoxItem::EServicePlugin: |
|
455 { |
|
456 iSettingsUi->InitializeL( Id(), item.iServiceId, this ); |
|
457 iSettingsUi->LaunchSettingsUiL(); |
|
458 break; |
|
459 } |
|
460 default: |
|
461 { |
|
462 User::Leave( KErrArgument ); |
|
463 break; |
|
464 } |
|
465 } |
|
466 |
|
467 CSCDEBUG( "CCSCServiceView::HandleListboxItemOpen - end" ); |
|
468 } |
|
469 |
|
470 |
|
471 // --------------------------------------------------------------------------- |
|
472 // For changing text in the title pane. |
|
473 // --------------------------------------------------------------------------- |
|
474 // |
|
475 void CCSCServiceView::SetTitlePaneTextL() const |
|
476 { |
|
477 CSCDEBUG( "CCSCServiceView::SetTitlePaneTextL - begin" ); |
|
478 |
|
479 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
480 |
|
481 CAknTitlePane* titlePane = |
|
482 static_cast<CAknTitlePane*> ( statusPane->ControlL( |
|
483 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
484 |
|
485 HBufC* text = iEikonEnv->AllocReadResourceLC( R_CSC_SERVICE_VIEW_TITLE ); |
|
486 titlePane->SetTextL( text->Des() ); |
|
487 CleanupStack::PopAndDestroy( text ); |
|
488 |
|
489 CSCDEBUG( "CCSCServiceView::SetTitlePaneTextL - end" ); |
|
490 } |
|
491 |
|
492 |
|
493 // --------------------------------------------------------------------------- |
|
494 // Handle service configuration. |
|
495 // --------------------------------------------------------------------------- |
|
496 // |
|
497 TBool CCSCServiceView::HandleServiceConfigurationL( TUid aUid ) |
|
498 { |
|
499 CSCDEBUG( "CCSCServiceView::HandleServiceConfigurationL" ); |
|
500 |
|
501 TInt initializedCount( iServicePluginHandler.PluginCount( |
|
502 CCSCEngServicePluginHandler::EInitialized ) ); |
|
503 |
|
504 TBool canceled( EFalse ); |
|
505 TServicePluginInfo pluginInfo; |
|
506 |
|
507 iUid = aUid; |
|
508 |
|
509 if ( KNullUid != aUid ) |
|
510 { |
|
511 for ( TInt i( 0 ) ; i < initializedCount ; i++ ) |
|
512 { |
|
513 pluginInfo = iServicePluginHandler.ItemFromPluginInfoArray( i ); |
|
514 |
|
515 if ( aUid == pluginInfo.iPluginsUid && !pluginInfo.iProvisioned ) |
|
516 { |
|
517 iStartupHandler.ResetUid( CCSCEngStartupHandler::EPluginUid ); |
|
518 |
|
519 iOfferedPluginUids.Append( pluginInfo.iPluginsUid ); |
|
520 |
|
521 iPluginInfo = pluginInfo; |
|
522 |
|
523 iNextPluginIndex = i; |
|
524 |
|
525 delete iEngTimer; |
|
526 iEngTimer = NULL; |
|
527 iEngTimer = CCSCEngTimer::NewL( *this ); |
|
528 |
|
529 iEngTimer->StartTimer( CCSCEngTimer::ENoteDelayTimer ); |
|
530 |
|
531 break; |
|
532 } |
|
533 } |
|
534 |
|
535 } |
|
536 else |
|
537 { |
|
538 for ( TInt j( 0 ) ; j < initializedCount ; j++ ) |
|
539 { |
|
540 pluginInfo = iServicePluginHandler.ItemFromPluginInfoArray( j ); |
|
541 |
|
542 if ( !pluginInfo.iProvisioned ) |
|
543 { |
|
544 iOfferedPluginUids.Append( pluginInfo.iPluginsUid ); |
|
545 |
|
546 iPluginInfo = pluginInfo; |
|
547 |
|
548 iNextPluginIndex = j; |
|
549 |
|
550 delete iEngTimer; |
|
551 iEngTimer = NULL; |
|
552 iEngTimer = CCSCEngTimer::NewL( *this ); |
|
553 |
|
554 iEngTimer->StartTimer( CCSCEngTimer::ENoteDelayTimer ); |
|
555 |
|
556 break; |
|
557 } |
|
558 } |
|
559 } |
|
560 |
|
561 return canceled; |
|
562 } |
|
563 |
|
564 |
|
565 // --------------------------------------------------------------------------- |
|
566 // Executes startup actions based on startup parameters. |
|
567 // --------------------------------------------------------------------------- |
|
568 // |
|
569 void CCSCServiceView::ExecuteStartupActionsL( |
|
570 TBool /*aForeGroundEvent*/, TBool aLaunchedFromAi ) |
|
571 { |
|
572 CSCDEBUG( "CCSCServiceView::ExecuteStartupActionsL - begin" ); |
|
573 |
|
574 CCSCEngStartupHandler::TAction action = iStartupHandler.GetParamAction(); |
|
575 TUid pluginUid = iStartupHandler.GetParamPluginUid(); |
|
576 TUint serviceId = iStartupHandler.GetParamServiceId(); |
|
577 |
|
578 switch( action ) |
|
579 { |
|
580 case CCSCEngStartupHandler::EAddSetupPluginService: |
|
581 { |
|
582 if ( KNullUid != pluginUid ) |
|
583 { |
|
584 HandleServiceConfigurationL( pluginUid ); |
|
585 } |
|
586 break; |
|
587 } |
|
588 case CCSCEngStartupHandler::ERemoveSetupPluginService: |
|
589 { |
|
590 if ( KNullUid != pluginUid ) |
|
591 { |
|
592 TRAPD( err, iContainer->HandleServicePluginRemovationL( |
|
593 pluginUid ) ); |
|
594 |
|
595 // If error in service plugin removal, close csc. |
|
596 if ( err ) |
|
597 { |
|
598 AppUi()->RunAppShutter(); |
|
599 } |
|
600 } |
|
601 break; |
|
602 } |
|
603 case CCSCEngStartupHandler::EOpenUiExtension: |
|
604 { |
|
605 if ( KNullUid != pluginUid ) |
|
606 { |
|
607 TRAP_IGNORE( |
|
608 iUiExtensionPluginHandler.LaunchUiExtensionL( |
|
609 pluginUid, Id(), aLaunchedFromAi ) ); |
|
610 |
|
611 iStartupHandler.ResetUid( |
|
612 CCSCEngStartupHandler::EPluginUid ); |
|
613 } |
|
614 break; |
|
615 } |
|
616 case CCSCEngStartupHandler::EOpenSettingsUi: |
|
617 { |
|
618 if ( serviceId ) |
|
619 { |
|
620 TUid tabview( KNullUid ); |
|
621 tabview.iUid = iServiceHandler.ServiceTabViewIdL( serviceId ); |
|
622 iSettingsUi->InitializeL( tabview, serviceId, NULL ); |
|
623 iSettingsUi->LaunchSettingsUiL(); |
|
624 iStartupHandler.ResetServiceId(); |
|
625 } |
|
626 break; |
|
627 } |
|
628 // Default action is to check unprovisioned service setup plugins. |
|
629 default: |
|
630 { |
|
631 TInt initializedCount( iServicePluginHandler.PluginCount( |
|
632 CCSCEngServicePluginHandler::EInitialized ) ); |
|
633 |
|
634 for ( TInt i( 0 ) ; i < initializedCount ; i++ ) |
|
635 { |
|
636 TBool alreadyOffered( EFalse ); |
|
637 |
|
638 TServicePluginInfo pluginInfo = |
|
639 iServicePluginHandler.ItemFromPluginInfoArray( i ); |
|
640 |
|
641 for ( TInt j( 0 ); j < iOfferedPluginUids.Count() ; j++ ) |
|
642 { |
|
643 if ( pluginInfo.iPluginsUid == iOfferedPluginUids[ j ] ) |
|
644 { |
|
645 alreadyOffered = ETrue; |
|
646 break; |
|
647 } |
|
648 } |
|
649 |
|
650 if ( !pluginInfo.iProvisioned && !alreadyOffered ) |
|
651 { |
|
652 TBool canceled = HandleServiceConfigurationL( |
|
653 pluginInfo.iPluginsUid ); |
|
654 |
|
655 if ( !canceled ) |
|
656 { |
|
657 break; |
|
658 } |
|
659 } |
|
660 } |
|
661 break; |
|
662 } |
|
663 } |
|
664 |
|
665 CSCDEBUG( "CCSCServiceView::ExecuteStartupActionsL - end" ); |
|
666 } |
|
667 |
|
668 |
|
669 // --------------------------------------------------------------------------- |
|
670 // From class CAknView. |
|
671 // Dynamically initializes the contents of the menu list |
|
672 // --------------------------------------------------------------------------- |
|
673 // |
|
674 void CCSCServiceView::DynInitMenuPaneL( TInt aResourceId, |
|
675 CEikMenuPane* aMenuPane ) |
|
676 { |
|
677 CSCDEBUG( "CCSCServiceView::DynInitMenuPaneL - begin" ); |
|
678 |
|
679 if ( R_CSC_SERVICEVIEW_MENU == aResourceId && aMenuPane && iContainer ) |
|
680 { |
|
681 TBool itemSpecificCommandsEnabled = |
|
682 MenuBar()->ItemSpecificCommandsEnabled(); |
|
683 |
|
684 if( ( iContainer->CurrentItemIndex() >= 0 ) && |
|
685 itemSpecificCommandsEnabled ) |
|
686 { |
|
687 if( iContainer->ListBoxItem().iPluginUid != |
|
688 KAccountCreationPluginUID ) |
|
689 { |
|
690 aMenuPane->SetItemDimmed( EAknSoftkeySelect, ETrue ); |
|
691 aMenuPane->SetItemDimmed( EAknSoftkeyOpen, EFalse ); |
|
692 } |
|
693 else |
|
694 { |
|
695 aMenuPane->SetItemDimmed( EAknSoftkeySelect, EFalse ); |
|
696 aMenuPane->SetItemDimmed( EAknSoftkeyOpen, ETrue ); |
|
697 } |
|
698 } |
|
699 else |
|
700 { |
|
701 aMenuPane->SetItemDimmed( EAknSoftkeySelect, ETrue ); |
|
702 aMenuPane->SetItemDimmed( EAknSoftkeyOpen, ETrue ); |
|
703 } |
|
704 |
|
705 // =================================================================== |
|
706 // Delete service menu option. |
|
707 // =================================================================== |
|
708 // |
|
709 if ( !itemSpecificCommandsEnabled ) |
|
710 { |
|
711 TInt index = iContainer->CurrentItemIndex(); |
|
712 TPoint penDownPoint = iContainer->PenDownPoint(); |
|
713 iContainer->ListBox().View()->XYPosToItemIndex( |
|
714 penDownPoint, index ); |
|
715 iContainer->SetCurrentIndex( index ); |
|
716 } |
|
717 |
|
718 if ( TListBoxItem::EUiExtension == |
|
719 iContainer->ListBoxItem().iItemType ) |
|
720 { |
|
721 aMenuPane->SetItemDimmed( ECSCCommandDelete, ETrue ); |
|
722 aMenuPane->SetItemSpecific( ECSCCommandDelete, EFalse ); |
|
723 } |
|
724 else |
|
725 { |
|
726 aMenuPane->SetItemDimmed( ECSCCommandDelete, EFalse ); |
|
727 aMenuPane->SetItemSpecific( ECSCCommandDelete, ETrue ); |
|
728 } |
|
729 } |
|
730 |
|
731 CSCDEBUG( "CCSCServiceView::DynInitMenuPaneL - end" ); |
|
732 } |
|
733 |
|
734 |
|
735 // --------------------------------------------------------------------------- |
|
736 // From class CAknView. |
|
737 // Creates the Container class object. |
|
738 // --------------------------------------------------------------------------- |
|
739 // |
|
740 void CCSCServiceView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
741 TUid /*aCustomMessageId*/, |
|
742 const TDesC8& /*aCustomMessage*/) |
|
743 { |
|
744 CSCDEBUG( "CCSCServiceView::DoActivateL - begin" ); |
|
745 |
|
746 // Create container if it's not exists. |
|
747 if( !iContainer ) |
|
748 { |
|
749 iContainer = CCSCServiceContainer::NewL( |
|
750 ClientRect(), |
|
751 *this, |
|
752 iServicePluginHandler, |
|
753 iUiExtensionPluginHandler, |
|
754 iServiceHandler, |
|
755 iBrandingHandler, |
|
756 iCCHHandler ); |
|
757 |
|
758 SetTitlePaneTextL(); |
|
759 iContainer->SetMopParent( this ); |
|
760 iContainer->SetListBoxObserver( this ); |
|
761 iContainer->MakeVisible( ETrue ); |
|
762 AppUi()->AddToStackL( *this, iContainer ); |
|
763 iContainer->SetCurrentIndex( iCurrentIndex ); |
|
764 } |
|
765 |
|
766 // Check startup parameters to see is there something to do with plugins. |
|
767 if ( iStartup ) |
|
768 { |
|
769 iStartup = EFalse; |
|
770 if ( KAIAppUid == aPrevViewId.iAppUid ) |
|
771 { |
|
772 // launched from active idle |
|
773 iStartupHandler.SetStartedFromHomescreen( ETrue ); |
|
774 } |
|
775 else |
|
776 { |
|
777 iStartupHandler.SetStartedFromHomescreen( EFalse ); |
|
778 } |
|
779 } |
|
780 |
|
781 UpdateCbaL(); |
|
782 |
|
783 CSCDEBUG( "CCSCServiceView::DoActivateL - end" ); |
|
784 } |
|
785 |
|
786 |
|
787 // --------------------------------------------------------------------------- |
|
788 // From class CAknView. |
|
789 // Deletes the Container class object. |
|
790 // --------------------------------------------------------------------------- |
|
791 // |
|
792 void CCSCServiceView::DoDeactivate() |
|
793 { |
|
794 CSCDEBUG( "CCSCServiceView::DoDeactivate - begin" ); |
|
795 |
|
796 if ( iContainer ) |
|
797 { |
|
798 iCurrentIndex = iContainer->CurrentItemIndex(); |
|
799 AppUi()->RemoveFromStack( iContainer ); |
|
800 delete iContainer; |
|
801 iContainer = NULL; |
|
802 } |
|
803 |
|
804 CSCDEBUG( "CCSCServiceView::DoDeactivate - end" ); |
|
805 } |
|
806 |
|
807 |
|
808 // --------------------------------------------------------------------------- |
|
809 // From class MCSCEngTimerObserver. |
|
810 // CCSCServiceView::TimerExpired |
|
811 // --------------------------------------------------------------------------- |
|
812 // |
|
813 void CCSCServiceView::TimerExpired() |
|
814 { |
|
815 CSCDEBUG( "CCSCServiceView::TimerExpired - begin" ); |
|
816 |
|
817 iStartupHandler.ResetUid( CCSCEngStartupHandler::EPluginUid ); |
|
818 iOfferedPluginUids.Append( iPluginInfo.iPluginsUid ); |
|
819 |
|
820 CCSCNoteUtilities::TCSCNoteType |
|
821 type = CCSCNoteUtilities::ECSCConfigureServiceQuery; |
|
822 TBool configure( EFalse ); |
|
823 TRAP_IGNORE |
|
824 ( |
|
825 if ( CCSCNoteUtilities::ShowCommonQueryL( |
|
826 type, iPluginInfo.iProviderName ) ) |
|
827 { |
|
828 iServicePluginHandler.DoProvisioningL( |
|
829 iPluginInfo.iPluginsUid, KCSCServiceViewId ); |
|
830 // User has accepted plugin configuration query. |
|
831 // Return to avoid launching a new query on top of |
|
832 // current configuration process. |
|
833 configure = ETrue; |
|
834 } |
|
835 ); |
|
836 if ( configure ) |
|
837 { |
|
838 return; |
|
839 } |
|
840 |
|
841 iNextPluginIndex++; |
|
842 TInt pluginCount = iServicePluginHandler.PluginCount( |
|
843 CCSCEngServicePluginHandler::EInitialized ); |
|
844 |
|
845 for ( ; iNextPluginIndex < pluginCount; iNextPluginIndex++ ) |
|
846 { |
|
847 CSCDEBUG2( "CCSCServiceView::TimerExpired -iNextPluginIndex = %d", |
|
848 iNextPluginIndex ); |
|
849 |
|
850 iPluginInfo = |
|
851 iServicePluginHandler.ItemFromPluginInfoArray( iNextPluginIndex ); |
|
852 |
|
853 if ( KNullUid != iPluginInfo.iPluginsUid && !iPluginInfo.iProvisioned ) |
|
854 { |
|
855 iEngTimer->StartTimer( CCSCEngTimer::ENoteDelayTimer ); |
|
856 break; |
|
857 } |
|
858 |
|
859 } |
|
860 CSCDEBUG( "CCSCServiceView::TimerExpired - end" ); |
|
861 } |
|
862 |