1 /* |
|
2 * Copyright (c) 2007-2007 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 |
|
155 CSCDEBUG( "CCSCServiceView::~CCSCServiceView - end" ); |
|
156 } |
|
157 |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // Updates container data because of layout change. |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 void CCSCServiceView::UpdateLayout( TInt aType ) |
|
164 { |
|
165 CSCDEBUG( "CCSCServiceView::UpdateLayout - begin" ); |
|
166 |
|
167 if ( iContainer ) |
|
168 { |
|
169 iContainer->SetRect( ClientRect() ); |
|
170 TRAP_IGNORE( iContainer->UpdateServiceViewL() ); |
|
171 iContainer->HandleResourceChange( aType ); |
|
172 } |
|
173 |
|
174 CSCDEBUG( "CCSCServiceView::UpdateLayout - end" ); |
|
175 } |
|
176 |
|
177 |
|
178 // --------------------------------------------------------------------------- |
|
179 // CCSCServiceView::InitializeWithStartupParametersL |
|
180 // --------------------------------------------------------------------------- |
|
181 // |
|
182 void CCSCServiceView::InitializeWithStartupParametersL() |
|
183 { |
|
184 CSCDEBUG( "CCSCServiceView::InitializeWithStartupParametersL" ); |
|
185 |
|
186 CCSCEngStartupHandler::TAction action = iStartupHandler.GetParamAction(); |
|
187 TBool isServiceViewDefault = |
|
188 CCSCEngStartupHandler::EOpenSettingsUi != action; |
|
189 TUint serviceId = iStartupHandler.GetParamServiceId(); |
|
190 TUid tabViewId( KNullUid ); |
|
191 tabViewId.iUid = iServiceHandler.ServiceTabViewIdL( serviceId ); |
|
192 iSettingsUi->InitializeL( |
|
193 tabViewId, serviceId, isServiceViewDefault ? this : NULL ); |
|
194 } |
|
195 |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // From class CAknView. |
|
199 // Handles the commands. If the command is command which is require to |
|
200 // display outline-screen, the command display outline-screen |
|
201 // corresponded to required. |
|
202 // --------------------------------------------------------------------------- |
|
203 // |
|
204 void CCSCServiceView::HandleCommandL( TInt aCommand ) |
|
205 { |
|
206 CSCDEBUG2( "CCSCServiceView::HandleCommandL aCommand: %d", aCommand ); |
|
207 |
|
208 switch ( aCommand ) |
|
209 { |
|
210 case EAknSoftkeyOpen: |
|
211 case ECSCCmdOpen: |
|
212 case EAknSoftkeySelect: |
|
213 HandleListboxItemOpenL(); |
|
214 break; |
|
215 case ECSCCommandDelete: |
|
216 iContainer->DeleteServiceL(); |
|
217 break; |
|
218 case EAknCmdHelp: |
|
219 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
220 { |
|
221 CArrayFix<TCoeHelpContext>* buf = AppUi()->AppHelpContextL(); |
|
222 HlpLauncher::LaunchHelpApplicationL( |
|
223 iEikonEnv->WsSession(), buf ); |
|
224 } |
|
225 break; |
|
226 // Exit menu command. |
|
227 case EAknSoftkeyExit: |
|
228 case EAknSoftkeyBack: |
|
229 AppUi()->HandleCommandL( EEikCmdExit ); |
|
230 break; |
|
231 // Let appui handle other commands. |
|
232 default: |
|
233 CSCDEBUG( "CCSCServiceView::HandleCommandL: !!DEFAULT!!" ); |
|
234 AppUi()->HandleCommandL( aCommand ); |
|
235 break; |
|
236 } |
|
237 } |
|
238 |
|
239 |
|
240 // --------------------------------------------------------------------------- |
|
241 // From class CAknView. |
|
242 // The ID of view. |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 TUid CCSCServiceView::Id() const |
|
246 { |
|
247 return KCSCServiceViewId; |
|
248 } |
|
249 |
|
250 // --------------------------------------------------------------------------- |
|
251 // From class CAknView. |
|
252 // Handle foreground event. |
|
253 // --------------------------------------------------------------------------- |
|
254 // |
|
255 void CCSCServiceView::HandleForegroundEventL( TBool aForeground ) |
|
256 { |
|
257 if ( aForeground ) |
|
258 { |
|
259 ExecuteStartupActionsL( ETrue ); |
|
260 } |
|
261 } |
|
262 |
|
263 |
|
264 // --------------------------------------------------------------------------- |
|
265 // For handling ui extension plug-in exits |
|
266 // --------------------------------------------------------------------------- |
|
267 // |
|
268 void CCSCServiceView::HandleUiExtensionExitL() |
|
269 { |
|
270 CSCDEBUG( "CCSCServiceView::HandleUiExtensionExit - begin" ); |
|
271 |
|
272 AppUi()->ActivateLocalViewL( KCSCServiceViewId ); |
|
273 |
|
274 TUid appUid = iStartupHandler.GetParamAppUid(); |
|
275 |
|
276 if ( appUid.iUid ) |
|
277 { |
|
278 // Open application matching uid |
|
279 RApaLsSession session; |
|
280 CleanupClosePushL( session ); |
|
281 |
|
282 User::LeaveIfError(session.Connect()); |
|
283 |
|
284 TFileName fileName; |
|
285 TThreadId threadId; |
|
286 |
|
287 User::LeaveIfError( |
|
288 session.StartDocument( fileName, appUid, threadId ) ); |
|
289 |
|
290 CleanupStack::PopAndDestroy( &session ); |
|
291 |
|
292 // Reset startup parameter app uid |
|
293 iStartupHandler.ResetUid( CCSCEngStartupHandler::EAppUid ); |
|
294 } |
|
295 |
|
296 CSCDEBUG( "CCSCServiceView::HandleUiExtensionExit - end" ); |
|
297 } |
|
298 |
|
299 |
|
300 // --------------------------------------------------------------------------- |
|
301 // For updating service view |
|
302 // --------------------------------------------------------------------------- |
|
303 // |
|
304 void CCSCServiceView::UpdateServiceViewL() |
|
305 { |
|
306 CSCDEBUG( "CCSCServiceView::UpdateServiceViewL - begin" ); |
|
307 |
|
308 iContainer->UpdateServiceViewL(); |
|
309 |
|
310 CSCDEBUG( "CCSCServiceView::UpdateServiceViewL - end" ); |
|
311 } |
|
312 |
|
313 |
|
314 // --------------------------------------------------------------------------- |
|
315 // For deleting service. |
|
316 // --------------------------------------------------------------------------- |
|
317 // |
|
318 void CCSCServiceView::DeleteServiceL( TUint serviceId ) |
|
319 { |
|
320 CSCDEBUG( "CCSCServiceView::DeleteServiceL - begin" ); |
|
321 |
|
322 TUid pluginUid( KNullUid ); |
|
323 TInt32 servicePluginId( 0 ); |
|
324 |
|
325 TRAPD( err, servicePluginId = |
|
326 iServiceHandler.ServiceSetupPluginIdL( serviceId ) ); |
|
327 |
|
328 if ( !err && servicePluginId ) |
|
329 { |
|
330 pluginUid.iUid = servicePluginId; |
|
331 iContainer->HandleServicePluginRemovationL( pluginUid ); |
|
332 } |
|
333 else |
|
334 { |
|
335 iContainer->DeleteServiceL(); |
|
336 } |
|
337 |
|
338 CSCDEBUG( "CCSCServiceView::DeleteServiceL - end" ); |
|
339 } |
|
340 |
|
341 // --------------------------------------------------------------------------- |
|
342 // Shows information about failed configuration. |
|
343 // --------------------------------------------------------------------------- |
|
344 // |
|
345 void CCSCServiceView::ServiceConfiguringFailedL( TInt aIndex ) |
|
346 { |
|
347 CSCDEBUG( "CCSCServiceView::ServiceConfiguringFailedL - begin" ); |
|
348 |
|
349 TServicePluginInfo pluginInfo; |
|
350 |
|
351 if ( iServicePluginHandler.PluginCount( |
|
352 CCSCEngServicePluginHandler::EInitialized ) > aIndex ) |
|
353 { |
|
354 pluginInfo = iServicePluginHandler.ItemFromPluginInfoArray( aIndex ); |
|
355 |
|
356 if ( pluginInfo.iProviderName.Length() ) |
|
357 { |
|
358 CCSCNoteUtilities::ShowInformationNoteL( |
|
359 CCSCNoteUtilities::ECSCUnableToConfigureNote, |
|
360 pluginInfo.iProviderName ); |
|
361 } |
|
362 |
|
363 // Try to remove uncomplete settings by calling service setup plugin. |
|
364 iServicePluginHandler.DoRemovationL( pluginInfo.iPluginsUid, EFalse ); |
|
365 } |
|
366 |
|
367 AppUi()->ActivateLocalViewL( KCSCServiceViewId ); |
|
368 |
|
369 CSCDEBUG( "CCSCServiceView::ServiceConfiguringFailedL - end" ); |
|
370 } |
|
371 |
|
372 |
|
373 // --------------------------------------------------------------------------- |
|
374 // Hides dialog wait note. |
|
375 // --------------------------------------------------------------------------- |
|
376 // |
|
377 void CCSCServiceView::HideDialogWaitNote() |
|
378 { |
|
379 if ( iContainer ) |
|
380 { |
|
381 iContainer->HideDialogWaitNote(); |
|
382 } |
|
383 } |
|
384 |
|
385 // --------------------------------------------------------------------------- |
|
386 // From class MEikListBoxObserver. |
|
387 // For handling list box events. |
|
388 // --------------------------------------------------------------------------- |
|
389 // |
|
390 void CCSCServiceView::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
391 TListBoxEvent aEventType ) |
|
392 { |
|
393 CSCDEBUG2( "CCSCServiceView::HandleListBoxEventL aEventType: %d", |
|
394 aEventType ); |
|
395 |
|
396 switch( aEventType ) |
|
397 { |
|
398 case EEventEnterKeyPressed: |
|
399 case EEventItemSingleClicked: |
|
400 HandleListboxItemOpenL(); |
|
401 break; |
|
402 default: |
|
403 CSCDEBUG( "CCSCServiceView::HandleListBoxEventL !!DEFAULT!!" ); |
|
404 break; |
|
405 } |
|
406 } |
|
407 |
|
408 |
|
409 // --------------------------------------------------------------------------- |
|
410 // From class MCSCServiceContainerObserver. |
|
411 // Update softkey. |
|
412 // --------------------------------------------------------------------------- |
|
413 // |
|
414 void CCSCServiceView::UpdateCbaL() |
|
415 { |
|
416 if( !Cba() ) |
|
417 { |
|
418 return; |
|
419 } |
|
420 |
|
421 TInt commandId ( EAknSoftkeyOpen ); |
|
422 HBufC* selectText = StringLoader::LoadLC( R_CSC_MSK_SELECT ); |
|
423 HBufC* openText = StringLoader::LoadLC( R_CSC_MSK_OPEN ); |
|
424 |
|
425 if( iContainer->CurrentItemIndex() >= 0 ) |
|
426 { |
|
427 if( iContainer->ListBoxItem().iPluginUid != KAccountCreationPluginUID ) |
|
428 { |
|
429 Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
430 commandId, *openText ); |
|
431 } |
|
432 else |
|
433 { |
|
434 commandId = EAknSoftkeySelect; |
|
435 Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
436 commandId, *selectText ); |
|
437 } |
|
438 } |
|
439 else |
|
440 { |
|
441 Cba()->MakeCommandVisibleByPosition( |
|
442 CEikButtonGroupContainer::EMiddleSoftkeyPosition, EFalse ); |
|
443 } |
|
444 |
|
445 Cba()->DrawDeferred(); |
|
446 CleanupStack::PopAndDestroy( openText ); |
|
447 CleanupStack::PopAndDestroy( selectText ); |
|
448 } |
|
449 |
|
450 |
|
451 // --------------------------------------------------------------------------- |
|
452 // For handling listbox item opening |
|
453 // --------------------------------------------------------------------------- |
|
454 // |
|
455 void CCSCServiceView::HandleListboxItemOpenL() |
|
456 { |
|
457 CSCDEBUG( "CCSCServiceView::HandleListboxItemOpen - begin" ); |
|
458 |
|
459 TListBoxItem item = iContainer->ListBoxItem(); |
|
460 |
|
461 switch ( item.iItemType ) |
|
462 { |
|
463 case TListBoxItem::EUiExtension: |
|
464 { |
|
465 iUiExtensionPluginHandler.LaunchUiExtensionL( |
|
466 item.iPluginUid, Id() ); |
|
467 break; |
|
468 } |
|
469 case TListBoxItem::EGeneralService: |
|
470 case TListBoxItem::EServicePlugin: |
|
471 { |
|
472 iSettingsUi->InitializeL( Id(), item.iServiceId, this ); |
|
473 iSettingsUi->LaunchSettingsUiL(); |
|
474 break; |
|
475 } |
|
476 default: |
|
477 { |
|
478 User::Leave( KErrArgument ); |
|
479 break; |
|
480 } |
|
481 } |
|
482 |
|
483 CSCDEBUG( "CCSCServiceView::HandleListboxItemOpen - end" ); |
|
484 } |
|
485 |
|
486 |
|
487 // --------------------------------------------------------------------------- |
|
488 // For changing text in the title pane. |
|
489 // --------------------------------------------------------------------------- |
|
490 // |
|
491 void CCSCServiceView::SetTitlePaneTextL() const |
|
492 { |
|
493 CSCDEBUG( "CCSCServiceView::SetTitlePaneTextL - begin" ); |
|
494 |
|
495 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
496 |
|
497 CAknTitlePane* titlePane = |
|
498 static_cast<CAknTitlePane*> ( statusPane->ControlL( |
|
499 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
500 |
|
501 HBufC* text = iEikonEnv->AllocReadResourceLC( R_CSC_SERVICE_VIEW_TITLE ); |
|
502 titlePane->SetTextL( text->Des() ); |
|
503 CleanupStack::PopAndDestroy( text ); |
|
504 |
|
505 CSCDEBUG( "CCSCServiceView::SetTitlePaneTextL - end" ); |
|
506 } |
|
507 |
|
508 |
|
509 // --------------------------------------------------------------------------- |
|
510 // Handle service configuration. |
|
511 // --------------------------------------------------------------------------- |
|
512 // |
|
513 TBool CCSCServiceView::HandleServiceConfigurationL( TUid aUid ) |
|
514 { |
|
515 CSCDEBUG( "CCSCServiceView::HandleServiceConfigurationL" ); |
|
516 |
|
517 TInt initializedCount( iServicePluginHandler.PluginCount( |
|
518 CCSCEngServicePluginHandler::EInitialized ) ); |
|
519 |
|
520 TBool canceled( EFalse ); |
|
521 TServicePluginInfo pluginInfo; |
|
522 |
|
523 if ( KNullUid != aUid ) |
|
524 { |
|
525 for ( TInt i( 0 ) ; i < initializedCount ; i++ ) |
|
526 { |
|
527 pluginInfo = iServicePluginHandler.ItemFromPluginInfoArray( i ); |
|
528 |
|
529 if ( aUid == pluginInfo.iPluginsUid && !pluginInfo.iProvisioned ) |
|
530 { |
|
531 iStartupHandler.ResetUid( CCSCEngStartupHandler::EPluginUid ); |
|
532 |
|
533 iOfferedPluginUids.Append( pluginInfo.iPluginsUid ); |
|
534 |
|
535 CCSCNoteUtilities::TCSCNoteType |
|
536 type = CCSCNoteUtilities::ECSCConfigureServiceQuery; |
|
537 |
|
538 if ( CCSCNoteUtilities::ShowCommonQueryL( |
|
539 type, pluginInfo.iProviderName ) ) |
|
540 { |
|
541 iServicePluginHandler.DoProvisioningL( |
|
542 pluginInfo.iPluginsUid, KCSCServiceViewId ); |
|
543 } |
|
544 else |
|
545 { |
|
546 canceled = ETrue; |
|
547 } |
|
548 } |
|
549 } |
|
550 |
|
551 } |
|
552 else |
|
553 { |
|
554 for ( TInt j( 0 ) ; j < initializedCount ; j++ ) |
|
555 { |
|
556 pluginInfo = iServicePluginHandler.ItemFromPluginInfoArray( j ); |
|
557 |
|
558 if ( !pluginInfo.iProvisioned ) |
|
559 { |
|
560 iOfferedPluginUids.Append( pluginInfo.iPluginsUid ); |
|
561 |
|
562 CCSCNoteUtilities::TCSCNoteType type = |
|
563 CCSCNoteUtilities::ECSCConfigureServiceQuery; |
|
564 |
|
565 if ( CCSCNoteUtilities::ShowCommonQueryL( |
|
566 type, pluginInfo.iProviderName ) ) |
|
567 { |
|
568 iServicePluginHandler.DoProvisioningL( |
|
569 pluginInfo.iPluginsUid, KCSCServiceViewId ); |
|
570 } |
|
571 else |
|
572 { |
|
573 canceled = ETrue; |
|
574 } |
|
575 } |
|
576 } |
|
577 } |
|
578 |
|
579 return canceled; |
|
580 } |
|
581 |
|
582 |
|
583 // --------------------------------------------------------------------------- |
|
584 // Executes startup actions based on startup parameters. |
|
585 // --------------------------------------------------------------------------- |
|
586 // |
|
587 void CCSCServiceView::ExecuteStartupActionsL( |
|
588 TBool aForeGroundEvent, |
|
589 TBool aLaunchedFromAi ) |
|
590 { |
|
591 CSCDEBUG( "CCSCServiceView::ExecuteStartupActionsL - begin" ); |
|
592 |
|
593 CCSCEngStartupHandler::TAction action = iStartupHandler.GetParamAction(); |
|
594 TUid pluginUid = iStartupHandler.GetParamPluginUid(); |
|
595 TUint serviceId = iStartupHandler.GetParamServiceId(); |
|
596 |
|
597 switch( action ) |
|
598 { |
|
599 case CCSCEngStartupHandler::EAddSetupPluginService: |
|
600 { |
|
601 if ( KNullUid != pluginUid ) |
|
602 { |
|
603 HandleServiceConfigurationL( pluginUid ); |
|
604 } |
|
605 break; |
|
606 } |
|
607 case CCSCEngStartupHandler::ERemoveSetupPluginService: |
|
608 { |
|
609 if ( KNullUid != pluginUid && !aForeGroundEvent ) |
|
610 { |
|
611 TRAPD( err, iContainer->HandleServicePluginRemovationL( |
|
612 pluginUid ) ); |
|
613 |
|
614 // If error in service plugin removal, close csc. |
|
615 if ( err ) |
|
616 { |
|
617 AppUi()->RunAppShutter(); |
|
618 } |
|
619 } |
|
620 break; |
|
621 } |
|
622 case CCSCEngStartupHandler::EOpenUiExtension: |
|
623 { |
|
624 if ( KNullUid != pluginUid ) |
|
625 { |
|
626 TRAP_IGNORE( |
|
627 iUiExtensionPluginHandler.LaunchUiExtensionL( |
|
628 pluginUid, Id(), aLaunchedFromAi ) ); |
|
629 |
|
630 iStartupHandler.ResetUid( |
|
631 CCSCEngStartupHandler::EPluginUid ); |
|
632 } |
|
633 break; |
|
634 } |
|
635 case CCSCEngStartupHandler::EOpenSettingsUi: |
|
636 { |
|
637 if ( serviceId ) |
|
638 { |
|
639 TUid tabview( KNullUid ); |
|
640 tabview.iUid = iServiceHandler.ServiceTabViewIdL( serviceId ); |
|
641 iSettingsUi->InitializeL( tabview, serviceId, NULL ); |
|
642 iSettingsUi->LaunchSettingsUiL(); |
|
643 iStartupHandler.ResetServiceId(); |
|
644 } |
|
645 break; |
|
646 } |
|
647 // Default action is to check unprovisioned service setup plugins. |
|
648 default: |
|
649 { |
|
650 TInt initializedCount( iServicePluginHandler.PluginCount( |
|
651 CCSCEngServicePluginHandler::EInitialized ) ); |
|
652 |
|
653 for ( TInt i( 0 ) ; i < initializedCount ; i++ ) |
|
654 { |
|
655 TBool alreadyOffered( EFalse ); |
|
656 |
|
657 TServicePluginInfo pluginInfo = |
|
658 iServicePluginHandler.ItemFromPluginInfoArray( i ); |
|
659 |
|
660 for ( TInt j( 0 ); j < iOfferedPluginUids.Count() ; j++ ) |
|
661 { |
|
662 if ( pluginInfo.iPluginsUid == iOfferedPluginUids[ j ] ) |
|
663 { |
|
664 alreadyOffered = ETrue; |
|
665 break; |
|
666 } |
|
667 } |
|
668 |
|
669 if ( !pluginInfo.iProvisioned && !alreadyOffered ) |
|
670 { |
|
671 TBool canceled = HandleServiceConfigurationL( |
|
672 pluginInfo.iPluginsUid ); |
|
673 |
|
674 if ( !canceled ) |
|
675 { |
|
676 break; |
|
677 } |
|
678 } |
|
679 } |
|
680 break; |
|
681 } |
|
682 } |
|
683 |
|
684 CSCDEBUG( "CCSCServiceView::ExecuteStartupActionsL - end" ); |
|
685 } |
|
686 |
|
687 |
|
688 // --------------------------------------------------------------------------- |
|
689 // From class CAknView. |
|
690 // Dynamically initializes the contents of the menu list |
|
691 // --------------------------------------------------------------------------- |
|
692 // |
|
693 void CCSCServiceView::DynInitMenuPaneL( TInt aResourceId, |
|
694 CEikMenuPane* aMenuPane ) |
|
695 { |
|
696 CSCDEBUG( "CCSCServiceView::DynInitMenuPaneL - begin" ); |
|
697 |
|
698 if ( R_CSC_SERVICEVIEW_MENU == aResourceId && aMenuPane ) |
|
699 { |
|
700 TBool itemSpecificCommandsEnabled = |
|
701 MenuBar()->ItemSpecificCommandsEnabled(); |
|
702 |
|
703 if( ( iContainer->CurrentItemIndex() >= 0 ) && |
|
704 itemSpecificCommandsEnabled ) |
|
705 { |
|
706 if( iContainer->ListBoxItem().iPluginUid != |
|
707 KAccountCreationPluginUID ) |
|
708 { |
|
709 aMenuPane->SetItemDimmed( EAknSoftkeySelect, ETrue ); |
|
710 aMenuPane->SetItemDimmed( EAknSoftkeyOpen, EFalse ); |
|
711 } |
|
712 else |
|
713 { |
|
714 aMenuPane->SetItemDimmed( EAknSoftkeySelect, EFalse ); |
|
715 aMenuPane->SetItemDimmed( EAknSoftkeyOpen, ETrue ); |
|
716 } |
|
717 } |
|
718 else |
|
719 { |
|
720 aMenuPane->SetItemDimmed( EAknSoftkeySelect, ETrue ); |
|
721 aMenuPane->SetItemDimmed( EAknSoftkeyOpen, ETrue ); |
|
722 } |
|
723 |
|
724 // =================================================================== |
|
725 // Delete service menu option. |
|
726 // =================================================================== |
|
727 // |
|
728 if ( !itemSpecificCommandsEnabled ) |
|
729 { |
|
730 TInt index = iContainer->CurrentItemIndex(); |
|
731 TPoint penDownPoint = iContainer->PenDownPoint(); |
|
732 iContainer->ListBox().View()->XYPosToItemIndex( |
|
733 penDownPoint, index ); |
|
734 iContainer->SetCurrentIndex( index ); |
|
735 } |
|
736 |
|
737 if ( TListBoxItem::EUiExtension == |
|
738 iContainer->ListBoxItem().iItemType ) |
|
739 { |
|
740 aMenuPane->SetItemDimmed( ECSCCommandDelete, ETrue ); |
|
741 aMenuPane->SetItemSpecific( ECSCCommandDelete, EFalse ); |
|
742 } |
|
743 else |
|
744 { |
|
745 aMenuPane->SetItemDimmed( ECSCCommandDelete, EFalse ); |
|
746 aMenuPane->SetItemSpecific( ECSCCommandDelete, ETrue ); |
|
747 } |
|
748 } |
|
749 |
|
750 CSCDEBUG( "CCSCServiceView::DynInitMenuPaneL - end" ); |
|
751 } |
|
752 |
|
753 |
|
754 // --------------------------------------------------------------------------- |
|
755 // From class CAknView. |
|
756 // Creates the Container class object. |
|
757 // --------------------------------------------------------------------------- |
|
758 // |
|
759 void CCSCServiceView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
760 TUid /*aCustomMessageId*/, |
|
761 const TDesC8& /*aCustomMessage*/) |
|
762 { |
|
763 CSCDEBUG( "CCSCServiceView::DoActivateL - begin" ); |
|
764 |
|
765 // Create container if it's not exists. |
|
766 if( !iContainer ) |
|
767 { |
|
768 iContainer = CCSCServiceContainer::NewL( |
|
769 ClientRect(), |
|
770 *this, |
|
771 iServicePluginHandler, |
|
772 iUiExtensionPluginHandler, |
|
773 iServiceHandler, |
|
774 iBrandingHandler, |
|
775 iCCHHandler ); |
|
776 |
|
777 SetTitlePaneTextL(); |
|
778 iContainer->SetMopParent( this ); |
|
779 iContainer->SetListBoxObserver( this ); |
|
780 iContainer->MakeVisible( ETrue ); |
|
781 AppUi()->AddToStackL( *this, iContainer ); |
|
782 iContainer->SetCurrentIndex( iCurrentIndex ); |
|
783 } |
|
784 |
|
785 // Check startup parameters to see is there something to do with plugins. |
|
786 if ( iStartup ) |
|
787 { |
|
788 iStartup = EFalse; |
|
789 if ( KAIAppUid == aPrevViewId.iAppUid ) |
|
790 { |
|
791 // launched from active idle |
|
792 iStartupHandler.SetStartedFromHomescreen( ETrue ); |
|
793 ExecuteStartupActionsL( EFalse, ETrue ); |
|
794 } |
|
795 else |
|
796 { |
|
797 iStartupHandler.SetStartedFromHomescreen( EFalse ); |
|
798 ExecuteStartupActionsL(); |
|
799 } |
|
800 } |
|
801 |
|
802 UpdateCbaL(); |
|
803 |
|
804 CSCDEBUG( "CCSCServiceView::DoActivateL - end" ); |
|
805 } |
|
806 |
|
807 |
|
808 // --------------------------------------------------------------------------- |
|
809 // From class CAknView. |
|
810 // Deletes the Container class object. |
|
811 // --------------------------------------------------------------------------- |
|
812 // |
|
813 void CCSCServiceView::DoDeactivate() |
|
814 { |
|
815 CSCDEBUG( "CCSCServiceView::DoDeactivate - begin" ); |
|
816 |
|
817 if ( iContainer ) |
|
818 { |
|
819 iCurrentIndex = iContainer->CurrentItemIndex(); |
|
820 AppUi()->RemoveFromStack( iContainer ); |
|
821 delete iContainer; |
|
822 iContainer = NULL; |
|
823 } |
|
824 |
|
825 CSCDEBUG( "CCSCServiceView::DoDeactivate - end" ); |
|
826 } |
|
827 |
|