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