|
1 /* |
|
2 * Copyright (c) 2008-2009 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 the License "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: HG VOD Main view implementation* |
|
15 */ |
|
16 |
|
17 // Version : %version: REL6_37 % |
|
18 |
|
19 #include <aknview.h> |
|
20 #include <aknViewAppUi.h> |
|
21 #include <akntitle.h> |
|
22 #include <aknnavi.h> |
|
23 #include <gulicon.h> |
|
24 |
|
25 #include <eikenv.h> |
|
26 #include <AknsBasicBackgroundControlContext.h> |
|
27 #include <aknlayoutscalable_avkon.cdl.h> |
|
28 #include <AknUtils.h> |
|
29 #include <AknsUtils.h> |
|
30 #include <AknIconUtils.h> |
|
31 #include <akntoolbar.h> |
|
32 #include <centralrepository.h> |
|
33 #include <ganes/HgDoubleGraphicList.h> |
|
34 #include <ganes/HgDoubleTextList.h> |
|
35 #include <data_caging_path_literals.hrh> |
|
36 |
|
37 #include <mpxviewutility.h> |
|
38 |
|
39 #include <vcxhgvodui.rsg> |
|
40 #include <vcxhgvoddefaulticons.mbg> |
|
41 #include "vcxnsuiengine.h" |
|
42 #include <hlplch.h> |
|
43 #include "vcxnscontentproviderif.h" |
|
44 |
|
45 #include "vcxhgvodmainview.h" |
|
46 #include "vcxhgvodmainviewcontainer.h" |
|
47 #include "vcxhgvodservicelistimpl.h" |
|
48 #include "vcxhgvodcategorylistimpl.h" |
|
49 #include "vcxhgvodcontentlistimpl.h" |
|
50 #include "vcxhgvodservicegrouplistimpl.h" |
|
51 #include "vcxhgvodlistimplbase.h" |
|
52 #include "vcxhgvodutils.h" |
|
53 #include "vcxhgvodtelephonyclient.h" |
|
54 #include "vcxhgvodui.hrh" |
|
55 #include "CIptvResourceLoader.h" |
|
56 #include "vcxnssettingsplugin.hrh" |
|
57 |
|
58 #include <avkon.rsg> |
|
59 #include <videoplayeractivationmessage.h> |
|
60 |
|
61 #include "vcxhgvodutils.h" |
|
62 #include "vcxviewmessageutility.h" |
|
63 #include "vcxnsserviceproviderif.h" |
|
64 #include "vcxnsservice.h" |
|
65 #include "vcxnsscheduleplugin.hrh" |
|
66 #include "mpxvideoplayercustomviewmsgconsts.h" |
|
67 |
|
68 _LIT( KVodViewResFile, "\\resource\\apps\\vcxhgvodui." ); |
|
69 _LIT( KVodDefaultIconsMifFile, "vcxhgvoddefaulticons.mif" ); |
|
70 |
|
71 const TUint32 KVcxNsFeedsViewUid = 0x102750DB; |
|
72 const TInt KVcxNsCenRepUid = 0x102750E2; |
|
73 const TInt KVcxNsCenRepParentControlKey = 0xC; |
|
74 |
|
75 void ScaleGulIconL( CGulIcon* aIcon, const TSize aSize ) |
|
76 { |
|
77 User::LeaveIfError( AknIconUtils::SetSize( aIcon->Bitmap(), aSize, |
|
78 EAspectRatioPreservedAndUnusedSpaceRemoved ) ); |
|
79 User::LeaveIfError( AknIconUtils::SetSize( aIcon->Mask(), aSize, |
|
80 EAspectRatioPreservedAndUnusedSpaceRemoved ) ); |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CVcxHgVodMainView::~CVcxHgVodMainView() |
|
85 // Destructor |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 EXPORT_C CVcxHgVodMainView::~CVcxHgVodMainView() |
|
89 { |
|
90 if ( iActiveList ) |
|
91 { |
|
92 iActiveList->DoDeactivate(); |
|
93 } |
|
94 |
|
95 if ( iContainer ) |
|
96 { |
|
97 AppUi()->RemoveFromStack( iContainer ); |
|
98 delete iContainer; |
|
99 } |
|
100 |
|
101 delete iServiceList; |
|
102 delete iCategoryList; |
|
103 delete iContentList; |
|
104 delete iServiceGroupList; |
|
105 delete iResourceLoader; |
|
106 delete iBgContext; |
|
107 |
|
108 if ( iViewUtility ) |
|
109 { |
|
110 iViewUtility->Close(); |
|
111 } |
|
112 |
|
113 if( iModel ) |
|
114 { |
|
115 iModel->ResetStates(); |
|
116 iModel->DecreaseReferenceCount(); |
|
117 } |
|
118 |
|
119 delete iGraphicScroller; |
|
120 delete iTextScroller; |
|
121 |
|
122 delete iContentDefaultIcon; |
|
123 delete iServiceDefaultIcon; |
|
124 |
|
125 delete iCenRep; |
|
126 delete iTelephonyClient; |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // CVcxHgVodMainView::NewL() |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C CVcxHgVodMainView* CVcxHgVodMainView::NewL( ) |
|
134 { |
|
135 CVcxHgVodMainView* self = CVcxHgVodMainView::NewLC( ); |
|
136 CleanupStack::Pop( self ); |
|
137 return self; |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CVcxHgVodMainView::NewLC() |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 EXPORT_C CVcxHgVodMainView* CVcxHgVodMainView::NewLC( ) |
|
145 { |
|
146 CVcxHgVodMainView* self = new (ELeave) CVcxHgVodMainView( ); |
|
147 CleanupStack::PushL( self ); |
|
148 self->ConstructL(); |
|
149 return self; |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // Return view id |
|
154 // ----------------------------------------------------------------------------- |
|
155 TUid CVcxHgVodMainView::Id() const |
|
156 { |
|
157 return TUid::Uid( KVcxNsFeedsViewUid ); |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 // ----------------------------------------------------------------------------- |
|
163 void CVcxHgVodMainView::DoActivateL( |
|
164 const TVwsViewId& /*aPrevViewId*/, |
|
165 TUid /*aCustomMessageId*/, |
|
166 const TDesC8& aCustomMessage ) |
|
167 { |
|
168 // ### |
|
169 if ( aCustomMessage.Length() > KVideoPlayerActivationMessageMinLength ) |
|
170 { |
|
171 ProcessCustomMessageL( aCustomMessage ); |
|
172 } |
|
173 else |
|
174 { |
|
175 // Normal startup, set UI engine's first state |
|
176 if ( iModel->VcAppState() == EStateNoState ) |
|
177 { |
|
178 iModel->SetVcAppState( EStateServiceView ); |
|
179 } |
|
180 |
|
181 // Back from player, pop ui engine's state. |
|
182 else if ( iModel->VcAppState() == EStatePlayback ) |
|
183 { |
|
184 TBool consumed = iModel->HandleBack(); |
|
185 |
|
186 // If player was strated directly, exit the app. |
|
187 if ( !consumed ) |
|
188 { |
|
189 AppUi()->HandleCommandL( EAknSoftkeyBack ); |
|
190 } |
|
191 } |
|
192 } |
|
193 |
|
194 if ( !iContainer ) |
|
195 { |
|
196 iContainer = |
|
197 new (ELeave) CVcxHgVodMainViewContainer( AppUi(), *this ); |
|
198 iContainer->ConstructL( ClientRect() ); |
|
199 iContainer->SetMopParent( this ); |
|
200 } |
|
201 |
|
202 iContainer->MakeVisible( ETrue ); |
|
203 AppUi()->AddToStackL( *this, iContainer ); |
|
204 |
|
205 |
|
206 if ( IsTouchSupported() ) |
|
207 { |
|
208 CAknToolbar* fixedToolbar( NULL ); |
|
209 fixedToolbar = AppUi()->CurrentFixedToolbar(); |
|
210 |
|
211 if ( fixedToolbar ) |
|
212 { |
|
213 fixedToolbar->SetToolbarVisibility( ETrue ); |
|
214 } |
|
215 } |
|
216 |
|
217 // Activate correct list view |
|
218 if( iModel->VcAppState() == EStateServiceView || |
|
219 iModel->VcAppState() == EStateCategoryView || |
|
220 iModel->VcAppState() == EStateContentView || |
|
221 iModel->VcAppState() == EStateCustomView ) |
|
222 { |
|
223 // Activate correct list view |
|
224 ChangeListViewL(); |
|
225 } |
|
226 |
|
227 CVcxViewMessageUtility::InstanceL()->AddObserverL( *this ); |
|
228 |
|
229 HandleStatusPaneSizeChange(); // make sure that all rects are correct. |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------------------------- |
|
233 // Deactivating of view |
|
234 // ----------------------------------------------------------------------------- |
|
235 // |
|
236 void CVcxHgVodMainView::DoDeactivate( ) |
|
237 { |
|
238 if ( iActiveList ) |
|
239 { |
|
240 iActiveList->DoDeactivate(); |
|
241 SetActiveList( NULL ); |
|
242 } |
|
243 |
|
244 if ( iContainer ) |
|
245 { |
|
246 AppUi()->RemoveFromStack( iContainer ); |
|
247 delete iContainer; |
|
248 iContainer = NULL; |
|
249 } |
|
250 |
|
251 TRAP_IGNORE( CVcxViewMessageUtility::InstanceL()->RemoveObserver( *this ) ); |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CVcxHgVodMainView::HandleCommandL |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 void CVcxHgVodMainView::HandleCommandL( TInt aCommand ) |
|
259 { |
|
260 if ( iActiveList ) |
|
261 { |
|
262 //Active list handles command first |
|
263 iActiveList->HandleCommandL( aCommand ); |
|
264 } |
|
265 |
|
266 //Handle cases, that need list view changes |
|
267 switch ( aCommand ) |
|
268 { |
|
269 case EAknSoftkeyOpen: |
|
270 case EVcxHgVodServiceOpenCmd: |
|
271 case EVcxHgVodCategoryOpenCmd: |
|
272 case EVcxHgVodServiceGroupOpenCmd: |
|
273 { |
|
274 ChangeListViewL(); |
|
275 } |
|
276 break; |
|
277 |
|
278 case KVcxCustomViewMessageCmd: |
|
279 { |
|
280 HandleCustomViewMessageL(); |
|
281 } |
|
282 break; |
|
283 |
|
284 case EAknCmdHelp: |
|
285 { |
|
286 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
287 AppUi()->AppHelpContextL() ); |
|
288 } |
|
289 break; |
|
290 |
|
291 case EAknSoftkeyBack: |
|
292 { |
|
293 // Playback state may remain even if we're really in content |
|
294 // view when playback starting is canceled, because there may |
|
295 // not be any view transitions. |
|
296 if ( iModel->VcAppState() == EStatePlayback ) |
|
297 { |
|
298 iModel->HandleBack(); |
|
299 } |
|
300 |
|
301 TBool consumed = iModel->HandleBack(); |
|
302 |
|
303 ChangeListViewL(); |
|
304 |
|
305 if ( !consumed ) |
|
306 { |
|
307 AppUi()->HandleCommandL( aCommand ); |
|
308 } |
|
309 } |
|
310 break; |
|
311 |
|
312 case EAknCmdExit: |
|
313 case EEikCmdExit: |
|
314 { |
|
315 if ( iActiveList ) |
|
316 { |
|
317 iActiveList->DoDeactivate(); |
|
318 iActiveList = NULL; |
|
319 } |
|
320 |
|
321 iModel->SetVcAppState( EStateNoState ); |
|
322 |
|
323 AppUi()->HandleCommandL( aCommand ); |
|
324 } |
|
325 break; |
|
326 |
|
327 default: |
|
328 { |
|
329 AppUi()->HandleCommandL( aCommand ); |
|
330 } |
|
331 break; |
|
332 } |
|
333 } |
|
334 |
|
335 // ----------------------------------------------------------------------------- |
|
336 // CVcxHgVodMainView::CVcxHgVodMainView() |
|
337 // Constructor |
|
338 // ----------------------------------------------------------------------------- |
|
339 // |
|
340 CVcxHgVodMainView::CVcxHgVodMainView( ) |
|
341 : iViewId( TUid::Uid( EIptvVodFeedView ) ), |
|
342 iTouchSupport ( EFalse ) |
|
343 { |
|
344 // None |
|
345 } |
|
346 |
|
347 |
|
348 // ----------------------------------------------------------------------------- |
|
349 // CVcxHgVodMainView::ConstructL() |
|
350 // ----------------------------------------------------------------------------- |
|
351 // |
|
352 void CVcxHgVodMainView::ConstructL() |
|
353 { |
|
354 iResourceLoader = CIptvResourceLoader::NewL( *iEikonEnv ); |
|
355 |
|
356 if ( iResourceLoader ) |
|
357 { |
|
358 iResourceLoader->AddResourceL( KVodViewResFile ); |
|
359 } |
|
360 |
|
361 BaseConstructL( R_VCXHG_VOD_MAIN_VIEW ); |
|
362 |
|
363 iModel = CVcxNsUiEngine::InstanceL(); |
|
364 |
|
365 // Create background context. |
|
366 iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
|
367 ClientRect(), |
|
368 ETrue ); |
|
369 |
|
370 if ( AknLayoutUtils::PenEnabled() ) |
|
371 { |
|
372 iTouchSupport = ETrue; |
|
373 } |
|
374 } |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 // ----------------------------------------------------------------------------- |
|
379 // |
|
380 CVcxHgVodListImplBase* CVcxHgVodMainView::ActiveList( ) |
|
381 { |
|
382 return iActiveList; |
|
383 } |
|
384 |
|
385 // ----------------------------------------------------------------------------- |
|
386 // |
|
387 // ----------------------------------------------------------------------------- |
|
388 // |
|
389 void CVcxHgVodMainView::SetActiveList( CVcxHgVodListImplBase* aList ) |
|
390 { |
|
391 iActiveList = aList; |
|
392 } |
|
393 |
|
394 // ----------------------------------------------------------------------------- |
|
395 // |
|
396 // ----------------------------------------------------------------------------- |
|
397 // |
|
398 CVcxNsPlayerWrapper* CVcxHgVodMainView::PlayerWrapper() |
|
399 { |
|
400 return NULL; |
|
401 } |
|
402 |
|
403 // ----------------------------------------------------------------------------- |
|
404 // |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 CVcxHgVodMainViewContainer* CVcxHgVodMainView::Container() |
|
408 { |
|
409 return iContainer; |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 TKeyResponse CVcxHgVodMainView::HandleKeyEventL( |
|
417 const TKeyEvent& aKeyEvent, |
|
418 TEventCode aType ) |
|
419 { |
|
420 // Add checks for application state. |
|
421 |
|
422 TKeyResponse response( EKeyWasNotConsumed ); |
|
423 |
|
424 if( iActiveList && MenuBar()->ItemSpecificCommandsEnabled() ) |
|
425 { |
|
426 if ( ( aKeyEvent.iScanCode == EStdKeyEnter || aKeyEvent.iScanCode == EStdKeyDevice3 ) && |
|
427 aType == EEventKey && |
|
428 aKeyEvent.iRepeats == 0 ) |
|
429 { |
|
430 iActiveList->HandleOpenL( KErrNotFound ); // index not needed or used in list impl. |
|
431 response = EKeyWasConsumed; |
|
432 } |
|
433 else |
|
434 { |
|
435 response = iActiveList->HandleKeyEventL( aKeyEvent, aType ); |
|
436 } |
|
437 } |
|
438 |
|
439 return response; |
|
440 } |
|
441 |
|
442 // ----------------------------------------------------------------------------- |
|
443 // Menu handling |
|
444 // ----------------------------------------------------------------------------- |
|
445 // |
|
446 void CVcxHgVodMainView::DynInitMenuPaneL( |
|
447 TInt aResourceId, |
|
448 CEikMenuPane* aMenuPane ) |
|
449 { |
|
450 if ( iActiveList ) |
|
451 { |
|
452 iActiveList->ActivateMenuPaneItemsL( aMenuPane, aResourceId ); |
|
453 } |
|
454 } |
|
455 |
|
456 // ----------------------------------------------------------------------------- |
|
457 // Handle custom view message |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 void CVcxHgVodMainView::HandleCustomViewMessageL( |
|
461 const TUid /*aMessageUid*/, |
|
462 const TDesC8& aCustomMessage ) |
|
463 { |
|
464 if ( aCustomMessage.Length() > KVideoPlayerActivationMessageMinLength ) |
|
465 { |
|
466 ProcessCustomMessageL( aCustomMessage ); |
|
467 } |
|
468 } |
|
469 |
|
470 // ----------------------------------------------------------------------------- |
|
471 // Get pointer to title pane |
|
472 // ----------------------------------------------------------------------------- |
|
473 // |
|
474 CAknTitlePane* CVcxHgVodMainView::TitlePaneL() |
|
475 { |
|
476 return static_cast<CAknTitlePane*>( StatusPane()-> |
|
477 ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
478 } |
|
479 |
|
480 // ----------------------------------------------------------------------------- |
|
481 // Get pointer to navi pane |
|
482 // ----------------------------------------------------------------------------- |
|
483 // |
|
484 CAknNavigationControlContainer* CVcxHgVodMainView::NaviPaneL() |
|
485 { |
|
486 return static_cast<CAknNavigationControlContainer*>( StatusPane()-> |
|
487 ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
488 } |
|
489 |
|
490 // --------------------------------------------------------- |
|
491 // Create list |
|
492 // --------------------------------------------------------- |
|
493 // |
|
494 void CVcxHgVodMainView::CreateListL( |
|
495 TVcxHgVodListType aType ) |
|
496 { |
|
497 if ( !iTextScroller && aType == EVcxNsCategoryList ) |
|
498 { |
|
499 iTextScroller = CHgDoubleTextList::NewL( ClientRect(), 0 ); |
|
500 } |
|
501 else if ( !iGraphicScroller ) |
|
502 { |
|
503 iGraphicScroller = CHgDoubleGraphicList::NewL( ClientRect(), 0 ); |
|
504 |
|
505 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
506 |
|
507 TFileName fileName; |
|
508 LocateMifFileL( fileName ); |
|
509 |
|
510 if ( !iContentDefaultIcon ) // paranoia |
|
511 { |
|
512 iContentDefaultIcon = AknsUtils::CreateGulIconL( skin, |
|
513 KAknsIIDQgnPropMtvProgClip, |
|
514 fileName, |
|
515 EMbmVcxhgvoddefaulticonsQgn_prop_mtv_prog_clip, |
|
516 EMbmVcxhgvoddefaulticonsQgn_prop_mtv_prog_clip_mask ); |
|
517 |
|
518 ScaleGulIconL( iContentDefaultIcon, |
|
519 CHgDoubleGraphicList::PreferredImageSize() ); |
|
520 } |
|
521 |
|
522 if ( !iServiceDefaultIcon ) // paranoia |
|
523 { |
|
524 iServiceDefaultIcon = AknsUtils::CreateGulIconL( skin, |
|
525 KAknsIIDQgnPropMtvProgClip, |
|
526 fileName, |
|
527 EMbmVcxhgvoddefaulticonsQgn_prop_mtv_vodcast_feed, |
|
528 EMbmVcxhgvoddefaulticonsQgn_prop_mtv_vodcast_feed_mask ); |
|
529 |
|
530 ScaleGulIconL( iServiceDefaultIcon, |
|
531 CHgDoubleGraphicList::PreferredImageSize() ); |
|
532 } |
|
533 } |
|
534 |
|
535 if ( aType == EVcxNsServiceList && !iServiceList ) |
|
536 { |
|
537 iServiceList = CVcxHgVodServiceListImpl::NewL( |
|
538 *iGraphicScroller, *iModel, *this ); |
|
539 } |
|
540 else if ( ( aType == EVcxNsCategoryList ) && !iCategoryList ) |
|
541 { |
|
542 iCategoryList = CVcxHgVodCategoryListImpl::NewL( |
|
543 *iTextScroller, *iModel, *this ); |
|
544 } |
|
545 else if ( ( aType == EVcxNsContentList ) && !iContentList ) |
|
546 { |
|
547 iContentList = CVcxHgVodContentListImpl::NewL( |
|
548 *iGraphicScroller, *iModel, *this ); |
|
549 } |
|
550 else if ( ( aType == EVcxNsCustomList ) && !iServiceGroupList ) |
|
551 { |
|
552 iServiceGroupList = CVcxHgVodServiceGroupListImpl::NewL( |
|
553 *iGraphicScroller, *iModel, *this ); |
|
554 } |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------- |
|
558 // Activate list according to current state |
|
559 // --------------------------------------------------------- |
|
560 // |
|
561 void CVcxHgVodMainView::ChangeListViewL() |
|
562 { |
|
563 //Get application state from ui engine |
|
564 TVcxNsAppState newState = iModel->VcAppState(); |
|
565 |
|
566 if ( iActiveList ) |
|
567 { |
|
568 iActiveList->DoDeactivate(); |
|
569 SetActiveList( NULL ); |
|
570 } |
|
571 |
|
572 if ( newState == EStateNoState ) |
|
573 { |
|
574 // return, model not ready or application is closing. |
|
575 return; |
|
576 } |
|
577 |
|
578 |
|
579 if ( newState == EStateServiceView ) |
|
580 { |
|
581 CreateListL( EVcxNsServiceList ); |
|
582 |
|
583 iGraphicScroller->SetDefaultIconL( CVcxHgVodUtils::DuplicateGulIconL( iServiceDefaultIcon ) ); |
|
584 |
|
585 iServiceList->DoActivateL(); |
|
586 SetActiveList( iServiceList ); |
|
587 } |
|
588 else if ( newState == EStateCategoryView ) |
|
589 { |
|
590 CreateListL( EVcxNsCategoryList ); |
|
591 iCategoryList->DoActivateL(); |
|
592 SetActiveList( iCategoryList ); |
|
593 } |
|
594 else if ( newState == EStateContentView ) |
|
595 { |
|
596 CreateListL( EVcxNsContentList ); |
|
597 |
|
598 iGraphicScroller->SetDefaultIconL( CVcxHgVodUtils::DuplicateGulIconL( iContentDefaultIcon ) ); |
|
599 |
|
600 iContentList->DoActivateL(); |
|
601 SetActiveList( iContentList ); |
|
602 } |
|
603 else if ( newState == EStateCustomView ) |
|
604 { |
|
605 CreateListL( EVcxNsCustomList ); |
|
606 |
|
607 iGraphicScroller->SetDefaultIconL( CVcxHgVodUtils::DuplicateGulIconL( iServiceDefaultIcon ) ); |
|
608 |
|
609 iServiceGroupList->DoActivateL(); |
|
610 SetActiveList( iServiceGroupList ); |
|
611 } |
|
612 } |
|
613 |
|
614 // --------------------------------------------------------- |
|
615 // Activate settings view |
|
616 // --------------------------------------------------------- |
|
617 // |
|
618 void CVcxHgVodMainView::OpenSettingsL( TInt aCommand ) |
|
619 { |
|
620 // ### |
|
621 TVideoPlayerActivationMessage params; |
|
622 |
|
623 if ( aCommand == EVcxHgVodServiceSubscriptionsCmd ) |
|
624 { |
|
625 params.iMsgType = |
|
626 TVideoPlayerActivationMessage::EOpenVCSettingsFeedSubscriptions; |
|
627 } |
|
628 else if ( aCommand == EVcxHgVodServiceAddManuallyCmd ) |
|
629 { |
|
630 params.iMsgType = |
|
631 TVideoPlayerActivationMessage::EOpenVCSettingsAddFeed; |
|
632 } |
|
633 |
|
634 TPckg<TVideoPlayerActivationMessage> paramsPckg( params ); |
|
635 HBufC* customMsg = HBufC::NewLC( paramsPckg.Length() ); |
|
636 customMsg->Des().Copy( paramsPckg ); |
|
637 |
|
638 if ( !iViewUtility ) |
|
639 { |
|
640 iViewUtility = MMPXViewUtility::UtilityL(); |
|
641 } |
|
642 |
|
643 iViewUtility->ActivateViewL( |
|
644 TUid::Uid ( KVcxNsSettingsPluginSettingsViewTypeId ), customMsg ); |
|
645 |
|
646 CleanupStack::PopAndDestroy( customMsg ); |
|
647 } |
|
648 |
|
649 // --------------------------------------------------------- |
|
650 // Activate schedule settings view |
|
651 // --------------------------------------------------------- |
|
652 // |
|
653 void CVcxHgVodMainView::OpenScheduleSettingsL() |
|
654 { |
|
655 CVcxNsService* service = iModel->GetServiceProviderL()->GetActiveServiceData(); |
|
656 |
|
657 if ( !service ) |
|
658 { |
|
659 return; |
|
660 } |
|
661 |
|
662 TUint32 id = service->GetServiceId(); |
|
663 TPckg<TUint32> paramsPckg( id ); |
|
664 HBufC* customMsg = HBufC::NewLC( paramsPckg.Length() ); |
|
665 customMsg->Des().Copy( paramsPckg ); |
|
666 |
|
667 if ( !iViewUtility ) |
|
668 { |
|
669 iViewUtility = MMPXViewUtility::UtilityL(); |
|
670 } |
|
671 |
|
672 iViewUtility->ActivateViewL( |
|
673 TUid::Uid ( KVcxNsSchedulePluginScheduleViewTypeId ), customMsg ); |
|
674 |
|
675 CleanupStack::PopAndDestroy( customMsg ); |
|
676 } |
|
677 |
|
678 // --------------------------------------------------------- |
|
679 // PlayInternalVideoL |
|
680 // --------------------------------------------------------- |
|
681 // |
|
682 void CVcxHgVodMainView::PlayInternalVideoL( CVcxNsContent* aContent ) |
|
683 { |
|
684 if ( aContent ) |
|
685 { |
|
686 if ( aContent->GetContentTypes() & CVcxNsContent::EVcxContentTypeVideo && |
|
687 aContent->GetDlStatus() == CVcxNsContent::EVcxContentDlStateDownloading || |
|
688 aContent->GetDlStatus() == CVcxNsContent::EVcxContentDlStateFailed || |
|
689 aContent->GetDlStatus() == CVcxNsContent::EVcxContentDlStatePaused || |
|
690 aContent->GetDlStatus() == CVcxNsContent::EVcxContentDlStateDownloaded ) |
|
691 { |
|
692 iModel->PlayVideoL( aContent ); |
|
693 iModel->VideoPlaybackStartingL( aContent ); |
|
694 iModel->SetVcAppState( EStatePlayback ); |
|
695 } |
|
696 else if ( aContent->GetContentTypes() & CVcxNsContent::EVcxContentTypeStream && |
|
697 aContent->GetUrl( CVcxNsContent::EVcxContentTypeStream ).Length() > 0 ) |
|
698 { |
|
699 iModel->PlayStreamL( aContent ); |
|
700 iModel->VideoPlaybackStartingL( aContent ); |
|
701 iModel->SetVcAppState( EStatePlayback ); |
|
702 } |
|
703 } |
|
704 } |
|
705 |
|
706 |
|
707 // --------------------------------------------------------- |
|
708 // Stream video |
|
709 // --------------------------------------------------------- |
|
710 // |
|
711 void CVcxHgVodMainView::PlayStreamL( const TDesC& aUrl ) |
|
712 { |
|
713 AppUi()->OpenFileL( aUrl ); |
|
714 iModel->SetVcAppState( EStatePlayback ); |
|
715 } |
|
716 |
|
717 // ----------------------------------------------------------------------------- |
|
718 // |
|
719 // ----------------------------------------------------------------------------- |
|
720 // |
|
721 TTypeUid::Ptr CVcxHgVodMainView::MopSupplyObject( TTypeUid aId ) |
|
722 { |
|
723 if ( iBgContext && aId.iUid == MAknsControlContext::ETypeId ) |
|
724 { |
|
725 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
726 } |
|
727 return CAknView::MopSupplyObject( aId ); |
|
728 } |
|
729 |
|
730 // ----------------------------------------------------------------------------- |
|
731 // |
|
732 // ----------------------------------------------------------------------------- |
|
733 // |
|
734 void CVcxHgVodMainView::HandleStatusPaneSizeChange() |
|
735 { |
|
736 // This function uses fonts from CCoeEnv, so we cannot |
|
737 // execute function if the environment is already destroyed. This can |
|
738 // happen e.g. when End key has pressed and application is closing. |
|
739 if ( iCoeEnv->NormalFont() ) |
|
740 { |
|
741 TRect cr = ClientRect(); |
|
742 |
|
743 TRect containerRect; |
|
744 if ( !AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, containerRect ) ) |
|
745 { |
|
746 containerRect = cr; |
|
747 } |
|
748 |
|
749 if ( iBgContext ) |
|
750 { |
|
751 iBgContext->SetRect( containerRect ); |
|
752 } |
|
753 |
|
754 if ( iContainer ) |
|
755 { |
|
756 iContainer->SetRect( containerRect ); |
|
757 } |
|
758 |
|
759 if ( iGraphicScroller ) |
|
760 { |
|
761 TRAP_IGNORE( iGraphicScroller->InitScreenL( cr ) ); |
|
762 } |
|
763 |
|
764 if ( iTextScroller ) |
|
765 { |
|
766 TRAP_IGNORE( iTextScroller->InitScreenL( cr ) ); |
|
767 } |
|
768 |
|
769 if ( iActiveList ) |
|
770 { |
|
771 iActiveList->HandleSizeChange(); |
|
772 } |
|
773 } |
|
774 } |
|
775 |
|
776 // ----------------------------------------------------------------------------- |
|
777 // |
|
778 // ----------------------------------------------------------------------------- |
|
779 // |
|
780 void CVcxHgVodMainView::HandleForegroundEventL( TBool aForeground ) |
|
781 { |
|
782 CAknView::HandleForegroundEventL( aForeground ); |
|
783 if ( iActiveList ) |
|
784 { |
|
785 iActiveList->HandleForegroundEventL( aForeground ); |
|
786 } |
|
787 } |
|
788 |
|
789 // --------------------------------------------------------- |
|
790 // Called by list implementation(s) when layout is changed. |
|
791 // --------------------------------------------------------- |
|
792 // |
|
793 void CVcxHgVodMainView::LayoutChanged() |
|
794 { |
|
795 HandleStatusPaneSizeChange(); |
|
796 } |
|
797 |
|
798 // --------------------------------------------------------- |
|
799 // Get eikon env |
|
800 // --------------------------------------------------------- |
|
801 // |
|
802 CEikonEnv& CVcxHgVodMainView::EikonEnv() |
|
803 { |
|
804 return *iEikonEnv; |
|
805 } |
|
806 |
|
807 // --------------------------------------------------------- |
|
808 // Get Cba |
|
809 // --------------------------------------------------------- |
|
810 // |
|
811 CEikButtonGroupContainer* CVcxHgVodMainView::ViewCba() |
|
812 { |
|
813 return Cba(); |
|
814 } |
|
815 |
|
816 // --------------------------------------------------------- |
|
817 // Touch support |
|
818 // --------------------------------------------------------- |
|
819 // |
|
820 TBool CVcxHgVodMainView::IsTouchSupported() |
|
821 { |
|
822 return iTouchSupport; |
|
823 } |
|
824 |
|
825 // --------------------------------------------------------- |
|
826 // |
|
827 // --------------------------------------------------------- |
|
828 // |
|
829 void CVcxHgVodMainView::ProcessCustomMessageL( const TDesC8& aCustomMessage ) |
|
830 { |
|
831 TVideoPlayerActivationMessage params; |
|
832 TPckg<TVideoPlayerActivationMessage> paramsPckg( params ); |
|
833 paramsPckg.Copy( aCustomMessage ); |
|
834 |
|
835 // Message coming from note, |
|
836 // open to specified service |
|
837 if ( params.iMsgType == TVideoPlayerActivationMessage::ELaunchServiceById ) |
|
838 { |
|
839 // Close the embedded browser if opened from here: |
|
840 TVcxNsAppState appState = iModel->VcAppState(); |
|
841 if ( appState == EStateBrowser ) |
|
842 { |
|
843 // Step the state back |
|
844 iModel->HandleBack(); |
|
845 appState = iModel->VcAppState(); |
|
846 |
|
847 if ( iServiceList && appState == EStateServiceView ) |
|
848 { |
|
849 iServiceList->CloseEmbeddedBrowser(); |
|
850 } |
|
851 } |
|
852 |
|
853 // Reset previous states. |
|
854 iModel->ResetStates(); |
|
855 |
|
856 // Set state, where to return from content view |
|
857 iModel->SetVcAppState( EStateServiceView ); |
|
858 |
|
859 // Open the actual service: |
|
860 iModel->GetServiceProviderL()->OpenServiceL( params.iServiceId ); |
|
861 |
|
862 // Switch to correct view |
|
863 ChangeListViewL(); |
|
864 } |
|
865 |
|
866 // Message coming from note or suite, |
|
867 // launch last watched video |
|
868 else if ( params.iMsgType == TVideoPlayerActivationMessage::ELaunchVideoToPlayer ) |
|
869 { |
|
870 iModel->PlayLastWatchedL(); |
|
871 |
|
872 iModel->SetVcAppState( EStatePlayback ); |
|
873 |
|
874 // Switch to correct view |
|
875 ChangeListViewL(); |
|
876 } |
|
877 } |
|
878 |
|
879 // ----------------------------------------------------------------------------- |
|
880 // |
|
881 // ----------------------------------------------------------------------------- |
|
882 // |
|
883 void CVcxHgVodMainView::CheckParentalControlL( TUint32 aAgeProfile ) |
|
884 { |
|
885 TInt parentControlSetting( 0 ); |
|
886 TInt error( KErrNone ); |
|
887 if ( !iCenRep ) |
|
888 { |
|
889 TRAP( error, iCenRep = CRepository::NewL( TUid::Uid( KVcxNsCenRepUid ) ) ) |
|
890 } |
|
891 if ( error == KErrNone ) |
|
892 { |
|
893 error = iCenRep->Get( KVcxNsCenRepParentControlKey, parentControlSetting ); |
|
894 if ( error == KErrNone && parentControlSetting != 0 ) |
|
895 { |
|
896 // Parental control has been set |
|
897 if ( static_cast<TInt>( aAgeProfile ) >= parentControlSetting ) |
|
898 { |
|
899 // Must ask lock code to allow playing |
|
900 if ( !iTelephonyClient ) |
|
901 { |
|
902 iTelephonyClient = new( ELeave ) CVcxHgVodTelephonyClient(); |
|
903 } |
|
904 if ( !iTelephonyClient->CheckLockCodeL() ) |
|
905 { |
|
906 User::Leave( KErrPermissionDenied ); |
|
907 } |
|
908 } |
|
909 } |
|
910 } |
|
911 } |
|
912 |
|
913 // ----------------------------------------------------------------------------- |
|
914 // CVcxHgVodMainView::HandleCustomViewMessageL |
|
915 // ----------------------------------------------------------------------------- |
|
916 // |
|
917 void CVcxHgVodMainView::HandleCustomViewMessageL() |
|
918 { |
|
919 TAny* ptr = UserSvr::DllTls( KVcxCustomViewMessagePtr ); |
|
920 |
|
921 if ( ptr ) |
|
922 { |
|
923 HBufC8* bufptr = ( HBufC8* ) ptr; |
|
924 |
|
925 if ( bufptr->Length() > KVideoPlayerActivationMessageMinLength ) |
|
926 { |
|
927 ProcessCustomMessageL( *bufptr ); |
|
928 } |
|
929 } |
|
930 } |
|
931 |
|
932 // ----------------------------------------------------------------------------- |
|
933 // CVcxHgVodMainView::LocateMifFileL |
|
934 // ----------------------------------------------------------------------------- |
|
935 // |
|
936 void CVcxHgVodMainView::LocateMifFileL( TFileName& aFileName ) |
|
937 { |
|
938 // Get the path & file name with the drive not specified. |
|
939 TParse parse; |
|
940 parse.Set( KVodDefaultIconsMifFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
941 TPtrC mifFile = parse.FullName(); |
|
942 |
|
943 // This is done to ensure upgraded file is used first. |
|
944 TFindFile find( iCoeEnv->FsSession() ); |
|
945 TInt err = find.FindByDir( mifFile, KNullDesC ); |
|
946 |
|
947 if ( err ) |
|
948 { |
|
949 User::Leave( KErrNotFound ); |
|
950 } |
|
951 else |
|
952 { |
|
953 aFileName.Append( find.File() ); |
|
954 } |
|
955 } |
|
956 |