|
1 /* |
|
2 * Copyright (c) 2008 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 category list implementation* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #include <akntitle.h> |
|
21 #include <aknViewAppUi.h> |
|
22 #include <eikmenup.h> |
|
23 #include <StringLoader.h> |
|
24 #include <ganes/HgScroller.h> |
|
25 #include <vcxhgvodui.rsg> |
|
26 |
|
27 #include <csxhelp/iptv.hlp.hrh> |
|
28 #include "vcxhgvodcategorylistimpl.h" |
|
29 #include "vcxhgvodcategorylistmodelhandler.h" |
|
30 #include "vcxhgvodmainview.h" |
|
31 #include "vcxhgvodmainviewcontainer.h" |
|
32 #include "vcxnsserviceproviderif.h" |
|
33 #include "vcxnscategoryproviderif.h" |
|
34 #include "vcxnsuiengine.h" |
|
35 #include "vcxnsservice.h" |
|
36 #include "vcxhgvodui.hrh" |
|
37 #include "vcxhgvodutils.h" |
|
38 #include "vcxhgvodlistimplbase.h" |
|
39 #include "vcxhgvodsearchimpl.h" |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CVcxHgVodCategoryListImpl::~CVcxHgVodCategoryListImpl() |
|
43 // Destructor |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 CVcxHgVodCategoryListImpl::~CVcxHgVodCategoryListImpl() |
|
47 { |
|
48 //always set model null to widget before destroying it |
|
49 delete iModelHandler; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CVcxHgVodCategoryListImpl::NewL() |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CVcxHgVodCategoryListImpl* CVcxHgVodCategoryListImpl::NewL( |
|
57 CHgScroller& aScroller, |
|
58 CVcxNsUiEngine& aDataProviderIf, |
|
59 CVcxHgVodMainView& aView ) |
|
60 { |
|
61 CVcxHgVodCategoryListImpl* self = |
|
62 CVcxHgVodCategoryListImpl::NewLC( aScroller, aDataProviderIf, aView ); |
|
63 CleanupStack::Pop( self ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CVcxHgVodCategoryListImpl::NewLC() |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CVcxHgVodCategoryListImpl* CVcxHgVodCategoryListImpl::NewLC( |
|
72 CHgScroller& aScroller, |
|
73 CVcxNsUiEngine& aDataProviderIf, |
|
74 CVcxHgVodMainView& aView ) |
|
75 { |
|
76 CVcxHgVodCategoryListImpl* self = |
|
77 new (ELeave) CVcxHgVodCategoryListImpl( aScroller, aDataProviderIf, aView ); |
|
78 CleanupStack::PushL( self ); |
|
79 self->ConstructL( aDataProviderIf, aView ); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 // ----------------------------------------------------------------------------- |
|
86 void CVcxHgVodCategoryListImpl::DoActivateL( ) |
|
87 { |
|
88 if ( iSearchImpl ) |
|
89 { |
|
90 iSearchImpl->RegisterObserver(); |
|
91 } |
|
92 |
|
93 SetMenuResourceId( R_VCXHG_VOD_CATEGORYVIEW_MENUBAR ); |
|
94 SetEmptyListTextL( R_VCXHG_VOD_UPDATING_ITEMS ); |
|
95 SetMskL( R_VCXHG_VOD_MSK_BUTTON_OPEN ); |
|
96 |
|
97 iScroller.SetSelectionObserver( *this ); |
|
98 iView.AppUi()->AddToStackL( &iScroller ); |
|
99 iScroller.SetFocus( ETrue ); |
|
100 |
|
101 iModelHandler->DoActivateModelL(); |
|
102 |
|
103 UpdateTitlePaneL(); |
|
104 |
|
105 //Set empty list text in case that is shown if list is empty |
|
106 if ( iScroller.ItemCount() == 0 ) |
|
107 { |
|
108 SetEmptyListTextL( R_VCXHG_VOD_NO_DATA ); |
|
109 } |
|
110 if( iModel.GetServiceProviderL()->GetActiveServiceData()-> |
|
111 GetUpdateStatus() == CVcxNsService::EUpdateOngoing ) |
|
112 { |
|
113 ShowInformationPopupL( ETrue, 0, 0 ); |
|
114 } |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 // ----------------------------------------------------------------------------- |
|
120 void CVcxHgVodCategoryListImpl::DoDeactivate( ) |
|
121 { |
|
122 //Make sure that MSK is updated when returning to view |
|
123 iCurrentMskResource = 0; |
|
124 //Always hide when deactivating view |
|
125 iModelHandler->DoDeActivateModel(); |
|
126 iView.AppUi()->RemoveFromStack( &iScroller ); |
|
127 iScroller.SetFocus( EFalse ); |
|
128 |
|
129 TRAP_IGNORE( ShowInformationPopupL( EFalse, 0, 0 ) ); |
|
130 |
|
131 if ( iSearchImpl ) |
|
132 { |
|
133 iSearchImpl->DeRegisterObserver(); |
|
134 } |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CVcxHgVodCategoryListImpl::CVcxHgVodCategoryListImpl() |
|
139 // Constructor |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 CVcxHgVodCategoryListImpl::CVcxHgVodCategoryListImpl( |
|
143 CHgScroller& aScroller, |
|
144 CVcxNsUiEngine& aDataProviderIf, |
|
145 CVcxHgVodMainView& aView ) |
|
146 : CVcxHgVodListImplBase( aView, aDataProviderIf, aScroller ) |
|
147 { |
|
148 // None |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // CVcxHgVodCategoryListImpl::ConstructL() |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 void CVcxHgVodCategoryListImpl::ConstructL( |
|
156 CVcxNsUiEngine& aDataProviderIf, |
|
157 CVcxHgVodMainView& aView ) |
|
158 { |
|
159 iModelHandler = |
|
160 CVcxHgVodCategoryListModelHandler::NewL( |
|
161 aDataProviderIf, aView, iScroller, *this ); |
|
162 |
|
163 //Initialize search implementation in base class. |
|
164 CVcxHgVodListImplBase::InitSearchImplL(); |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CVcxHgVodCategoryListImpl::HandleCommandL |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 void CVcxHgVodCategoryListImpl::HandleCommandL( TInt aCommand ) |
|
172 { |
|
173 switch ( aCommand ) |
|
174 { |
|
175 case EAknSoftkeyOpen: |
|
176 case EVcxHgVodCategoryOpenCmd: |
|
177 { |
|
178 if ( iModelHandler && iModelHandler->CategoryProvider() ) |
|
179 { |
|
180 TInt selected = iScroller.SelectedIndex(); |
|
181 iModelHandler->CategoryProvider()->OpenCategoryL( selected ); |
|
182 } |
|
183 } |
|
184 break; |
|
185 case EVcxHgVodCategoryScheduleDownloadsCmd: |
|
186 { |
|
187 iView.OpenScheduleSettingsL(); |
|
188 } |
|
189 break; |
|
190 |
|
191 default: |
|
192 break; |
|
193 } |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // Activate usable menu items before showing menu |
|
198 // ----------------------------------------------------------------------------- |
|
199 void CVcxHgVodCategoryListImpl::ActivateMenuPaneItemsL( |
|
200 CEikMenuPane* /*aMenuPane*/, |
|
201 TInt /*aResourceId*/ ) |
|
202 { |
|
203 // No implementation needed |
|
204 } |
|
205 |
|
206 // ----------------------------------------------------------------------------- |
|
207 // CVcxHgVodCategoryListImpl::HandleOpenL |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 void CVcxHgVodCategoryListImpl::HandleOpenL( TInt /*aIndex*/ ) |
|
211 { |
|
212 iView.HandleCommandL( EVcxHgVodCategoryOpenCmd ); |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CVcxHgVodCategoryListImpl::GetHelpContext |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 void CVcxHgVodCategoryListImpl::GetHelpContext( TCoeHelpContext& aContext ) const |
|
220 { |
|
221 const TUid KUidIptvMainApp = { 0x102750E2 }; |
|
222 |
|
223 aContext.iMajor = KUidIptvMainApp; |
|
224 aContext.iContext = KIPTV_HLP_VOD_CATEGORIES; |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // CVcxNsVodCategoryListImpl::UpdateTitlePaneL |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 void CVcxHgVodCategoryListImpl::UpdateTitlePaneL() |
|
232 { |
|
233 CVcxNsService* currentService = |
|
234 iModel.GetServiceProviderL()->GetActiveServiceData(); |
|
235 if ( currentService ) |
|
236 { |
|
237 SetTitlePaneTextL( currentService->GetName() ); |
|
238 } |
|
239 } |