author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:23:06 +0300 | |
branch | RCL_3 |
changeset 24 | f87e8c4ac026 |
parent 23 | befca0ec475f |
permissions | -rw-r--r-- |
23 | 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: UI level handler for category data.* |
|
15 |
*/ |
|
16 |
||
17 |
||
18 |
||
19 |
||
20 |
// INCLUDE FILES |
|
21 |
#include <StringLoader.h> |
|
22 |
||
23 |
#include <mpxmediageneraldefs.h> |
|
24 |
#include <mpxmedia.h> |
|
25 |
#include <mpxmediaarray.h> |
|
26 |
||
27 |
#include <ganes/HgScroller.h> |
|
28 |
#include <ganes/HgItem.h> |
|
29 |
#include <ganes/HgDoubleGraphicList.h> |
|
30 |
||
31 |
#include <thumbnailmanager.h> |
|
32 |
#include <thumbnailmanagerobserver.h> |
|
33 |
#include <thumbnailobjectsource.h> |
|
34 |
#include <thumbnaildata.h> |
|
35 |
#include <gulicon.h> |
|
36 |
#include <AknsUtils.h> |
|
37 |
#include <AknUtils.h> |
|
38 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
39 |
#include <coemain.h> |
|
40 |
#include <aknappui.h> |
|
41 |
#include <bautils.h> |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
42 |
#include <apgcli.h> |
23 | 43 |
|
44 |
#include <vcxhgmyvideosicons.mbg> |
|
45 |
#include <myvideosindicator.h> |
|
46 |
#include <vcxhgmyvideos.rsg> |
|
47 |
#include <vcxmyvideosdefs.h> |
|
48 |
#include <vcxmyvideosuids.h> |
|
49 |
#include "IptvDebug.h" |
|
50 |
||
51 |
#include "vcxhgmyvideoscategorymodelhandler.h" |
|
52 |
#include "vcxhgmyvideosmodel.h" |
|
53 |
#include "vcxhgmyvideoscollectionclient.h" |
|
54 |
#include "vcxhgmyvideosthumbnailmanager.h" |
|
55 |
#include "vcxhgmyvideoscenrepkeys.h" |
|
56 |
||
57 |
_LIT( KVcxHgMyVideosMifFile, "\\resource\\apps\\vcxhgmyvideosicons.mif" ); |
|
58 |
||
59 |
// ============================ MEMBER FUNCTIONS =============================== |
|
60 |
||
61 |
||
62 |
// ----------------------------------------------------------------------------- |
|
63 |
// CVcxHgMyVideosCategoryModelHandler::NewL() |
|
64 |
// ----------------------------------------------------------------------------- |
|
65 |
// |
|
66 |
CVcxHgMyVideosCategoryModelHandler* CVcxHgMyVideosCategoryModelHandler::NewL( |
|
67 |
CVcxHgMyVideosModel& aModel, |
|
68 |
CHgScroller& aScroller ) |
|
69 |
{ |
|
70 |
CVcxHgMyVideosCategoryModelHandler* self = |
|
71 |
new (ELeave) CVcxHgMyVideosCategoryModelHandler( aModel, aScroller ); |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
72 |
CleanupStack::PushL( self ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
73 |
self->ConstructL(); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
74 |
CleanupStack::Pop( self ); |
23 | 75 |
return self; |
76 |
} |
|
77 |
||
78 |
||
79 |
// ----------------------------------------------------------------------------- |
|
80 |
// CVcxHgMyVideosCategoryModelHandler::CVcxHgMyVideosCategoryModelHandler() |
|
81 |
// ----------------------------------------------------------------------------- |
|
82 |
// |
|
83 |
CVcxHgMyVideosCategoryModelHandler::CVcxHgMyVideosCategoryModelHandler( |
|
84 |
CVcxHgMyVideosModel& aModel, CHgScroller& aScroller ) |
|
85 |
: iModel( aModel ), |
|
86 |
iScroller( aScroller ), |
|
87 |
iTnManager( aModel.ThumbnailManager() ), |
|
88 |
iTnRequestId( KErrNotFound ) |
|
89 |
{ |
|
90 |
} |
|
91 |
||
92 |
// ----------------------------------------------------------------------------- |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
93 |
// CVcxHgMyVideosCategoryModelHandler::ConstructL() |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
94 |
// ----------------------------------------------------------------------------- |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
95 |
// |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
96 |
void CVcxHgMyVideosCategoryModelHandler::ConstructL() |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
97 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
98 |
CheckIfExtraItemsExistsL(); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
99 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
100 |
|
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
101 |
// ----------------------------------------------------------------------------- |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
102 |
// CVcxHgMyVideosCategoryModelHandler::CheckIfExtraItemsExistsL() |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
103 |
// ----------------------------------------------------------------------------- |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
104 |
// |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
105 |
void CVcxHgMyVideosCategoryModelHandler::CheckIfExtraItemsExistsL() |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
106 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
107 |
TInt value = 0; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
108 |
TBuf<KMyVideosTitleUrlMaxLength> url; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
109 |
// Check that cenrep exists and has some valid data |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
110 |
iModel.GetMyVideosCustomizationString( KCRVideoPlayerExtraItem2Url, url ); // ignore error code |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
111 |
if ( url.Length() == 0 ) |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
112 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
113 |
TInt err = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerExtraItem2Uid, value ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
114 |
if ( err == KErrNone && value != 0 ) |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
115 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
116 |
if ( AppExistsL( TUid::Uid( value ) ) ) |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
117 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
118 |
iExtraItem2Exists = ETrue; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
119 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
120 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
121 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
122 |
else |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
123 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
124 |
iExtraItem2Exists = ETrue; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
125 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
126 |
|
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
127 |
value = 0; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
128 |
url.Zero(); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
129 |
iModel.GetMyVideosCustomizationString( KCRVideoPlayerExtraItem3Url, url ); // ignore error code |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
130 |
if ( url.Length() == 0 ) |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
131 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
132 |
TInt err = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerExtraItem3Uid, value ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
133 |
if ( err == KErrNone && value != 0 ) |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
134 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
135 |
if ( AppExistsL( TUid::Uid( value ) ) ) |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
136 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
137 |
iExtraItem3Exists = ETrue; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
138 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
139 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
140 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
141 |
else |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
142 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
143 |
iExtraItem3Exists = ETrue; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
144 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
145 |
|
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
146 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
147 |
|
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
148 |
// ----------------------------------------------------------------------------- |
23 | 149 |
// CVcxHgMyVideosCategoryModelHandler::~CVcxHgMyVideosCategoryModelHandler() |
150 |
// ----------------------------------------------------------------------------- |
|
151 |
// |
|
152 |
CVcxHgMyVideosCategoryModelHandler::~CVcxHgMyVideosCategoryModelHandler() |
|
153 |
{ |
|
154 |
delete iCategoryList; |
|
155 |
delete iVideoIndicator; |
|
156 |
||
157 |
iCategoryIdArray.Reset(); |
|
158 |
} |
|
159 |
||
160 |
// ----------------------------------------------------------------------------- |
|
161 |
// CVcxHgMyVideosCategoryModelHandler::DoModelActivateL() |
|
162 |
// ----------------------------------------------------------------------------- |
|
163 |
// |
|
164 |
void CVcxHgMyVideosCategoryModelHandler::DoModelActivateL() |
|
165 |
{ |
|
166 |
IPTVLOGSTRING_LOW_LEVEL( |
|
167 |
"MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::DoModelActivateL() - Enter" ); |
|
168 |
||
169 |
UpdateCategoryListL(); |
|
170 |
||
171 |
iModel.CollectionClient().SetCategoryModelObserver( this ); |
|
172 |
||
173 |
iTnManager.AddObserverL( *this ); |
|
174 |
||
175 |
IPTVLOGSTRING_LOW_LEVEL( |
|
176 |
"MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::DoModelActivateL() - Exit" ); |
|
177 |
} |
|
178 |
||
179 |
// ----------------------------------------------------------------------------- |
|
180 |
// CVcxHgMyVideosCategoryModelHandler::DoModelDeactivate() |
|
181 |
// ----------------------------------------------------------------------------- |
|
182 |
// |
|
183 |
void CVcxHgMyVideosCategoryModelHandler::DoModelDeactivate() |
|
184 |
{ |
|
185 |
IPTVLOGSTRING_LOW_LEVEL( |
|
186 |
"MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::DoModelDeactivate() - Enter" ); |
|
187 |
||
188 |
iModel.CollectionClient().SetCategoryModelObserver( NULL ); |
|
189 |
||
190 |
iTnManager.RemoveObserver( *this ); |
|
191 |
||
192 |
TRAP_IGNORE( ClearLastWatchedIconL() ) |
|
193 |
||
194 |
IPTVLOGSTRING_LOW_LEVEL( |
|
195 |
"MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::DoModelDeactivate() - Exit" ); |
|
196 |
} |
|
197 |
||
198 |
// ----------------------------------------------------------------------------- |
|
199 |
// CVcxHgMyVideosCategoryModelHandler::GetCategoryListL() |
|
200 |
// ----------------------------------------------------------------------------- |
|
201 |
// |
|
202 |
void CVcxHgMyVideosCategoryModelHandler::GetCategoryListL() |
|
203 |
{ |
|
204 |
IPTVLOGSTRING_LOW_LEVEL( |
|
205 |
"MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::GetCategoryListL() - Enter" ); |
|
206 |
||
207 |
iModel.CollectionClient().GetCategoryListL(); |
|
208 |
||
209 |
IPTVLOGSTRING_LOW_LEVEL( |
|
210 |
"MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::GetCategoryListL() - Exit" ); |
|
211 |
} |
|
212 |
||
213 |
// ----------------------------------------------------------------------------- |
|
214 |
// CVcxHgMyVideosCategoryModelHandler::Highlight() |
|
215 |
// ----------------------------------------------------------------------------- |
|
216 |
// |
|
217 |
TInt CVcxHgMyVideosCategoryModelHandler::Highlight() |
|
218 |
{ |
|
219 |
return iScroller.SelectedIndex(); |
|
220 |
} |
|
221 |
||
222 |
// ----------------------------------------------------------------------------- |
|
223 |
// CVcxHgMyVideosCategoryModelHandler::GetCategoryNameLC() |
|
224 |
// ----------------------------------------------------------------------------- |
|
225 |
// |
|
226 |
HBufC* CVcxHgMyVideosCategoryModelHandler::GetCategoryNameLC( TInt aCategoryId ) |
|
227 |
{ |
|
228 |
HBufC* name = NULL; |
|
229 |
||
230 |
switch ( aCategoryId ) |
|
231 |
{ |
|
232 |
case KVcxMvcCategoryIdAll: |
|
233 |
name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_STORAGE_ALL_LIST ); |
|
234 |
break; |
|
235 |
case KVcxMvcCategoryIdDownloads: |
|
236 |
name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_STORAGE_DOWNLOADS_LIST ); |
|
237 |
break; |
|
238 |
case KVcxMvcCategoryIdCaptured: |
|
239 |
name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_STORAGE_CAPTURED_LIST ); |
|
240 |
break; |
|
241 |
case KVcxMvcCategoryIdOther: |
|
242 |
name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_STORAGE_OTHER_LIST ); |
|
243 |
break; |
|
244 |
case KCategoryIdLastWatched: |
|
245 |
if ( LastWatchedSetL() ) |
|
246 |
{ |
|
247 |
name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_LAST_WATCHED ); |
|
248 |
} |
|
249 |
else |
|
250 |
{ |
|
251 |
if ( PreloadedExistsL() ) |
|
252 |
{ |
|
253 |
TBuf<KMyVideosTitleStringMaxLength> string; |
|
254 |
TInt error = iModel.GetMyVideosCustomizationString( |
|
255 |
KCRVideoPlayerPreloadedVideoName, string ); |
|
256 |
name = error ? KNullDesC().AllocLC() : string.AllocLC(); |
|
257 |
} |
|
258 |
else |
|
259 |
{ |
|
260 |
name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_LAST_WATCHED ); |
|
261 |
} |
|
262 |
} |
|
263 |
break; |
|
264 |
case KCategoryIdExtraItem1: |
|
265 |
// ExtraItem1 is always interpreted as Ovi Store |
|
266 |
name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_OVI_STORE ); |
|
267 |
break; |
|
268 |
case KCategoryIdExtraItem2: |
|
269 |
case KCategoryIdExtraItem3: |
|
270 |
{ |
|
271 |
TInt key = 0; |
|
272 |
if ( aCategoryId == KCategoryIdExtraItem2 ) |
|
273 |
{ |
|
274 |
key = KCRVideoPlayerExtraItem2Title; |
|
275 |
} |
|
276 |
else if ( aCategoryId == KCategoryIdExtraItem3 ) |
|
277 |
{ |
|
278 |
key = KCRVideoPlayerExtraItem3Title; |
|
279 |
} |
|
280 |
||
281 |
TBuf<KMyVideosTitleStringMaxLength> titleString; |
|
282 |
TInt error = iModel.GetMyVideosCustomizationString( key, titleString ); |
|
283 |
if ( error == KErrNone ) |
|
284 |
{ |
|
285 |
name = titleString.AllocLC(); |
|
286 |
} |
|
287 |
else |
|
288 |
{ |
|
289 |
name = KNullDesC().AllocLC(); |
|
290 |
} |
|
291 |
} |
|
292 |
break; |
|
293 |
||
294 |
default: |
|
295 |
{ |
|
296 |
name = KNullDesC().AllocLC(); |
|
297 |
IPTVLOGSTRING_LOW_LEVEL( |
|
298 |
"MPX My Videos UI # GetCategoryNameLC() Unexpected category!" ); |
|
299 |
} |
|
300 |
break; |
|
301 |
} |
|
302 |
return name; |
|
303 |
} |
|
304 |
||
305 |
// ----------------------------------------------------------------------------- |
|
306 |
// CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL() |
|
307 |
// ----------------------------------------------------------------------------- |
|
308 |
// |
|
309 |
CGulIcon* CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL( TInt aCategoryId ) |
|
310 |
{ |
|
311 |
IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL() Enter! Category id = %d", aCategoryId ); |
|
312 |
||
313 |
CGulIcon* icon( NULL ); |
|
314 |
TAknsItemID skinId = KAknsIIDNone; |
|
315 |
TInt bitmapId( 0 ); |
|
316 |
TInt maskId( 0 ); |
|
317 |
TInt key( KErrNotFound ); |
|
318 |
TFileName iconFile( KNullDesC() ); |
|
319 |
||
320 |
// Find icon file & bitmap IDs or cenrep keys |
|
321 |
switch ( aCategoryId ) |
|
322 |
{ |
|
323 |
case KVcxMvcCategoryIdDownloads: // fall through |
|
324 |
case KVcxMvcCategoryIdAll: // fall through |
|
325 |
case KVcxMvcCategoryIdOther: |
|
326 |
skinId.Set( KAknsIIDQgnPropDownloadThumbnailVideo ); |
|
327 |
iconFile = KVcxHgMyVideosMifFile; |
|
328 |
bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_download_thumbnail_video; |
|
329 |
maskId = EMbmVcxhgmyvideosiconsQgn_prop_download_thumbnail_video_mask; |
|
330 |
break; |
|
331 |
case KVcxMvcCategoryIdCaptured: |
|
332 |
skinId.Set( KAknsIIDQgnPropCapturedThumbnailVideo ); |
|
333 |
iconFile = KVcxHgMyVideosMifFile; |
|
334 |
bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_captured_thumbnail_video; |
|
335 |
maskId = EMbmVcxhgmyvideosiconsQgn_prop_captured_thumbnail_video_mask; |
|
336 |
break; |
|
337 |
case KCategoryIdLastWatched: |
|
338 |
LoadLastWatchedIconL(); |
|
339 |
if ( iTnRequestId == KErrNotFound ) |
|
340 |
{ |
|
341 |
// Last watched or preloaded not found => show default icon |
|
342 |
skinId.Set( KAknsIIDQgnPropRecentThumbnailVideo ); |
|
343 |
iconFile = KVcxHgMyVideosMifFile; |
|
344 |
bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_recent_thumbnail_video; |
|
345 |
maskId = EMbmVcxhgmyvideosiconsQgn_prop_recent_thumbnail_video_mask; |
|
346 |
} |
|
347 |
break; |
|
348 |
case KCategoryIdExtraItem1: |
|
349 |
// ExtraItem1 is always interpreted as Ovi Store |
|
350 |
skinId.Set( KAknsIIDQgnPropOviThumbnailVideo ); |
|
351 |
iconFile = KVcxHgMyVideosMifFile; |
|
352 |
bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_ovi_thumbnail_video; |
|
353 |
maskId = EMbmVcxhgmyvideosiconsQgn_prop_ovi_thumbnail_video_mask; |
|
354 |
break; |
|
355 |
case KCategoryIdExtraItem2: |
|
356 |
key = KCRVideoPlayerExtraItem2IconPath; |
|
357 |
break; |
|
358 |
case KCategoryIdExtraItem3: |
|
359 |
key = KCRVideoPlayerExtraItem3IconPath; |
|
360 |
break; |
|
361 |
default: |
|
362 |
{ |
|
363 |
IPTVLOGSTRING_LOW_LEVEL( |
|
364 |
"MPX My Videos UI # GetCategoryIconLC() Unexpected category!" ); |
|
365 |
} |
|
366 |
break; |
|
367 |
} |
|
368 |
||
369 |
if ( key != KErrNotFound ) |
|
370 |
{ |
|
371 |
// Extra item 2 or 3, get icon file from cenrep |
|
372 |
TInt error = iModel.GetMyVideosCustomizationString( key, iconFile ); |
|
373 |
if ( error == KErrNone && iconFile.Length() > 0 ) |
|
374 |
{ |
|
375 |
IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL() cenrep key %d iconFile %S", key, &iconFile ); |
|
376 |
bitmapId = 0x4000; |
|
377 |
maskId = 0x4001; |
|
378 |
} |
|
379 |
else |
|
380 |
{ // Use default service icon |
|
381 |
skinId.Set( KAknsIIDQgnPropServiceThumbnailVideo ); |
|
382 |
iconFile = KVcxHgMyVideosMifFile; |
|
383 |
bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_service_thumbnail_video; |
|
384 |
maskId = EMbmVcxhgmyvideosiconsQgn_prop_service_thumbnail_video_mask; |
|
385 |
} |
|
386 |
} |
|
387 |
||
388 |
if ( bitmapId && iconFile.Length() > 0 ) |
|
389 |
{ |
|
390 |
// find mif file |
|
391 |
TFindFile findFile( iModel.FileServerSessionL() ); |
|
392 |
TInt error = findFile.FindByDir( iconFile, KNullDesC ); |
|
393 |
||
394 |
// Create icon if icon file was found |
|
395 |
if ( KErrNone == error ) |
|
396 |
{ |
|
397 |
TParse parse; |
|
398 |
parse.Set( findFile.File(), NULL, NULL ); |
|
399 |
iconFile = parse.FullName(); |
|
400 |
IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconLC() get %d from file %S", bitmapId, &iconFile ); |
|
401 |
||
402 |
icon = CreateHgListIconL( skinId, iconFile, bitmapId, maskId ); |
|
403 |
} |
|
404 |
else |
|
405 |
{ |
|
406 |
IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL() FindByDir() returned %d", error ); |
|
407 |
} |
|
408 |
} |
|
409 |
else |
|
410 |
{ |
|
411 |
IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconLC() no icon file or id" ); |
|
412 |
} |
|
413 |
||
414 |
return icon; |
|
415 |
} |
|
416 |
||
417 |
// ----------------------------------------------------------------------------- |
|
418 |
// CVcxHgMyVideosCategoryModelHandler::FormatCategorySecondRowLC() |
|
419 |
// ----------------------------------------------------------------------------- |
|
420 |
// |
|
421 |
HBufC* CVcxHgMyVideosCategoryModelHandler::FormatCategorySecondRowLC( CMPXMedia& aMedia ) |
|
422 |
{ |
|
423 |
HBufC* details = NULL; |
|
424 |
TInt newVideos = 0; |
|
425 |
TInt videos = 0; |
|
426 |
||
427 |
if ( aMedia.IsSupported( KVcxMediaMyVideosCategoryNewItemCount ) ) |
|
428 |
{ |
|
429 |
newVideos = *( aMedia.Value<TInt>( KVcxMediaMyVideosCategoryNewItemCount ) ); |
|
430 |
} |
|
431 |
if ( aMedia.IsSupported( KVcxMediaMyVideosCategoryItemCount ) ) |
|
432 |
{ |
|
433 |
videos = *( aMedia.Value<TInt>( KVcxMediaMyVideosCategoryItemCount ) ); |
|
434 |
} |
|
435 |
||
436 |
if ( newVideos > 0 ) |
|
437 |
{ |
|
438 |
if ( newVideos == 1 ) |
|
439 |
{ |
|
440 |
details = StringLoader::LoadL( R_VCXHGMYVIDEOS_ONE_NEW_VIDEO ); |
|
441 |
} |
|
442 |
else |
|
443 |
{ |
|
444 |
details = StringLoader::LoadL( R_VCXHGMYVIDEOS_N_NEW_VIDEOS, newVideos ); |
|
445 |
} |
|
446 |
CleanupStack::PushL( details ); |
|
447 |
} |
|
448 |
else |
|
449 |
{ |
|
450 |
if ( videos == 0 ) |
|
451 |
{ |
|
452 |
details = StringLoader::LoadLC( R_VCXHGMYVIDEOS_NO_VIDEOS_IN_CATEGORY ); |
|
453 |
} |
|
454 |
else if ( videos == 1 ) |
|
455 |
{ |
|
456 |
details = StringLoader::LoadLC( R_VCXHGMYVIDEOS_ONE_VIDEO_IN_CATEGORY ); |
|
457 |
} |
|
458 |
else |
|
459 |
{ |
|
460 |
details = StringLoader::LoadLC( R_VCXHGMYVIDEOS_VIDEOS_IN_CATEGORY, videos ); |
|
461 |
} |
|
462 |
} |
|
463 |
||
464 |
return details; |
|
465 |
} |
|
466 |
||
467 |
||
468 |
// ----------------------------------------------------------------------------- |
|
469 |
// CVcxHgMyVideosCategoryModelHandler::FormatCategorySecondRowLC() |
|
470 |
// ----------------------------------------------------------------------------- |
|
471 |
// |
|
472 |
HBufC* CVcxHgMyVideosCategoryModelHandler::FormatCategorySecondRowLC( TInt aCategoryId ) |
|
473 |
{ |
|
474 |
HBufC* secondRow = NULL; |
|
475 |
||
476 |
switch ( aCategoryId ) |
|
477 |
{ |
|
478 |
case KVcxMvcCategoryIdAll: |
|
479 |
case KVcxMvcCategoryIdDownloads: |
|
480 |
case KVcxMvcCategoryIdTvRecordings: |
|
481 |
case KVcxMvcCategoryIdCaptured: |
|
482 |
case KVcxMvcCategoryIdOther: |
|
483 |
{ |
|
484 |
CMPXMedia* media = GetCategoryDataL( aCategoryId ); |
|
485 |
if ( media ) |
|
486 |
{ |
|
487 |
secondRow = FormatCategorySecondRowLC( *media ); |
|
488 |
} |
|
489 |
else |
|
490 |
{ |
|
491 |
secondRow = KNullDesC().AllocLC(); |
|
492 |
} |
|
493 |
} |
|
494 |
break; |
|
495 |
case KCategoryIdLastWatched: |
|
496 |
{ |
|
497 |
if ( LastWatchedSetL() ) |
|
498 |
{ |
|
499 |
TBuf<KMaxPath> path; |
|
500 |
TInt error = iModel.GetLastWatchedPathL( path ); |
|
501 |
if ( BaflUtils::FileExists( iModel.FileServerSessionL(), path ) ) |
|
502 |
{ |
|
503 |
TBuf<KMyVideosTitleStringMaxLength> string; |
|
504 |
TInt error = iModel.GetLastWatchedNameL( string ); |
|
505 |
secondRow = error ? KNullDesC().AllocLC() : string.AllocLC(); |
|
506 |
} |
|
507 |
else |
|
508 |
{ |
|
509 |
secondRow = StringLoader::LoadLC( R_VCXHGMYVIDEOS_NO_VIDEOS_IN_CATEGORY ); |
|
510 |
} |
|
511 |
} |
|
512 |
else |
|
513 |
{ |
|
514 |
if ( PreloadedExistsL() ) |
|
515 |
{ |
|
516 |
TBuf<KMyVideosTitleStringMaxLength> string; |
|
517 |
TInt error = iModel.GetMyVideosCustomizationString( |
|
518 |
KCRVideoPlayerPreloadedVideoDescription, string ); |
|
519 |
secondRow = error ? KNullDesC().AllocLC() : string.AllocLC(); |
|
520 |
} |
|
521 |
else |
|
522 |
{ |
|
523 |
secondRow = StringLoader::LoadLC( R_VCXHGMYVIDEOS_NO_VIDEOS_IN_CATEGORY ); |
|
524 |
} |
|
525 |
} |
|
526 |
} |
|
527 |
break; |
|
528 |
||
529 |
case KCategoryIdExtraItem1: |
|
530 |
// ExtraItem1 is always interpreted as Ovi Store |
|
531 |
secondRow = StringLoader::LoadLC( R_VCXHGMYVIDEOS_OVI_STORE_VIDEOS ); |
|
532 |
break; |
|
533 |
||
534 |
case KCategoryIdExtraItem2: |
|
535 |
case KCategoryIdExtraItem3: |
|
536 |
{ |
|
537 |
TInt key = 0; |
|
538 |
if ( aCategoryId == KCategoryIdExtraItem2 ) |
|
539 |
{ |
|
540 |
key = KCRVideoPlayerExtraItem2Text; |
|
541 |
} |
|
542 |
else if ( aCategoryId == KCategoryIdExtraItem3 ) |
|
543 |
{ |
|
544 |
key = KCRVideoPlayerExtraItem3Text; |
|
545 |
} |
|
546 |
||
547 |
TBuf<KMyVideosTitleStringMaxLength> detailsString; |
|
548 |
TInt error = iModel.GetMyVideosCustomizationString( key, detailsString ); |
|
549 |
if ( error == KErrNone ) |
|
550 |
{ |
|
551 |
secondRow = detailsString.AllocLC(); |
|
552 |
} |
|
553 |
else |
|
554 |
{ |
|
555 |
secondRow = KNullDesC().AllocLC(); |
|
556 |
} |
|
557 |
break; |
|
558 |
} |
|
559 |
default: |
|
560 |
{ |
|
561 |
secondRow = KNullDesC().AllocLC(); |
|
562 |
IPTVLOGSTRING_LOW_LEVEL( |
|
563 |
"MPX My Videos UI # FormatCategorySecondRowLC() Unexpected category!" ); |
|
564 |
break; |
|
565 |
} |
|
566 |
} |
|
567 |
return secondRow; |
|
568 |
} |
|
569 |
||
570 |
// ----------------------------------------------------------------------------- |
|
571 |
// CVcxHgMyVideosCategoryModelHandler::UiIndexFromMpxItemId() |
|
572 |
// ----------------------------------------------------------------------------- |
|
573 |
// |
|
574 |
TInt CVcxHgMyVideosCategoryModelHandler::UiIndexFromMpxItemId( TMPXItemId& aMpxItemId ) |
|
575 |
{ |
|
576 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # UiIndexFromMpxItemId() - Enter" ); |
|
577 |
||
578 |
TInt index ( KErrNotFound ); |
|
579 |
||
580 |
if ( iCategoryList ) |
|
581 |
{ |
|
582 |
CMPXMedia* media = NULL; |
|
583 |
TMPXItemId mpxItemId; |
|
584 |
||
585 |
for ( TInt i = 0; i < iCategoryList->Count(); i++ ) |
|
586 |
{ |
|
587 |
media = (*iCategoryList)[i]; |
|
588 |
||
589 |
if ( media && media->IsSupported( KMPXMediaGeneralId ) ) |
|
590 |
{ |
|
591 |
mpxItemId = *media->Value<TMPXItemId>( KMPXMediaGeneralId ); |
|
592 |
||
593 |
if ( mpxItemId == aMpxItemId ) |
|
594 |
{ |
|
595 |
index = ResolveCategoryArrayIndexById( i ); |
|
596 |
break; |
|
597 |
} |
|
598 |
} |
|
599 |
} |
|
600 |
} |
|
601 |
||
602 |
IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # UiIndexFromMpxItemId(), index = %d - Exit", index ); |
|
603 |
return index; |
|
604 |
} |
|
605 |
||
606 |
// ----------------------------------------------------------------------------- |
|
607 |
// CVcxHgMyVideosCategoryModelHandler::ResolveCategoryArrayIndexById() |
|
608 |
// ----------------------------------------------------------------------------- |
|
609 |
// |
|
610 |
TInt CVcxHgMyVideosCategoryModelHandler::ResolveCategoryArrayIndexById( TInt aCategoryId ) |
|
611 |
{ |
|
612 |
TInt ret( KErrNotFound ); |
|
613 |
||
614 |
for(TInt i = 0; i < iCategoryIdArray.Count(); i++ ) |
|
615 |
{ |
|
616 |
if( iCategoryIdArray[ i ] == aCategoryId ) |
|
617 |
{ |
|
618 |
ret = i; |
|
619 |
break; |
|
620 |
} |
|
621 |
} |
|
622 |
||
623 |
return ret; |
|
624 |
} |
|
625 |
||
626 |
// ----------------------------------------------------------------------------- |
|
627 |
// CVcxHgMyVideosCategoryModelHandler::NewCategoryListL() |
|
628 |
// MPX Collection calls this callback when new category list is available. |
|
629 |
// ----------------------------------------------------------------------------- |
|
630 |
// |
|
631 |
void CVcxHgMyVideosCategoryModelHandler::NewCategoryListL( |
|
632 |
CMPXMediaArray* aCategoryList, TBool aIsPartial ) |
|
633 |
{ |
|
634 |
IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # NewCategoryListL() - Enter. IsPartial=%d", aIsPartial ); |
|
635 |
||
636 |
delete iCategoryList; |
|
637 |
iCategoryList = aCategoryList; |
|
638 |
||
639 |
UpdateCategoryListL(); |
|
640 |
||
641 |
if ( !aIsPartial ) |
|
642 |
{ |
|
643 |
// KVcxMessageMyVideosListComplete does not come, finish list fetching now |
|
644 |
CategoryListFetchingCompletedL(); |
|
645 |
} |
|
646 |
||
647 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # NewCategoryListL() - Exit" ); |
|
648 |
} |
|
649 |
||
650 |
// ----------------------------------------------------------------------------- |
|
651 |
// CVcxHgMyVideosCategoryModelHandler::CategoryListModifiedL() |
|
652 |
// MPX Collection calls this callback when the category list is modified. |
|
653 |
// ----------------------------------------------------------------------------- |
|
654 |
// |
|
655 |
void CVcxHgMyVideosCategoryModelHandler::CategoryListModifiedL() |
|
656 |
{ |
|
657 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # CategoryListModifiedL() - Enter" ); |
|
658 |
||
659 |
UpdateCategoryListL(); |
|
660 |
||
661 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # CategoryListModifiedL() - Exit" ); |
|
662 |
} |
|
663 |
||
664 |
// ----------------------------------------------------------------------------- |
|
665 |
// CVcxHgMyVideosCategoryModelHandler::CategoryModifiedL() |
|
666 |
// MPX Collection calls this callback when single category is modified. |
|
667 |
// ----------------------------------------------------------------------------- |
|
668 |
// |
|
669 |
void CVcxHgMyVideosCategoryModelHandler::CategoryModifiedL( TMPXChangeEventType aEventType, |
|
670 |
TMPXItemId& aMpxItemId ) |
|
671 |
{ |
|
672 |
IPTVLOGSTRING2_LOW_LEVEL( |
|
673 |
"MPX My Videos UI # CategoryModifiedL(event=%d)", aEventType ); |
|
674 |
||
675 |
switch ( aEventType ) |
|
676 |
{ |
|
677 |
case EMPXItemModified: |
|
678 |
{ |
|
679 |
TInt uiIndex = UiIndexFromMpxItemId( aMpxItemId ); |
|
680 |
UpdateCategoryListItemL( uiIndex ); |
|
681 |
iScroller.RefreshScreen( uiIndex ); |
|
682 |
} |
|
683 |
break; |
|
684 |
||
685 |
case EMPXItemInserted: |
|
686 |
{ |
|
687 |
TInt id1( 0 ); |
|
688 |
TInt ret = iModel.GetLastWatchedIdL( id1 ); |
|
689 |
||
690 |
if ( ret == KErrNone && |
|
691 |
id1 == aMpxItemId.iId1 ) |
|
692 |
{ |
|
693 |
ClearLastWatchedIconL(); |
|
694 |
UpdateCategoryListItemL( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
695 |
iScroller.RefreshScreen( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
696 |
} |
|
697 |
} |
|
698 |
break; |
|
699 |
case EMPXItemDeleted: |
|
700 |
{ |
|
701 |
TInt id1( 0 ); |
|
702 |
TInt ret = iModel.GetLastWatchedIdL( id1 ); |
|
703 |
||
704 |
if ( ret == KErrNone && |
|
705 |
id1 == aMpxItemId.iId1 ) |
|
706 |
{ |
|
707 |
ClearLastWatchedIconL(); |
|
708 |
UpdateCategoryListItemL( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
709 |
iScroller.RefreshScreen( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
710 |
} |
|
711 |
} |
|
712 |
break; |
|
713 |
default: |
|
714 |
{ |
|
715 |
IPTVLOGSTRING_LOW_LEVEL( |
|
716 |
"MPX My Videos UI # CategoryModifiedL() Unexpected event!" ); |
|
717 |
} |
|
718 |
break; |
|
719 |
} |
|
720 |
} |
|
721 |
||
722 |
// ----------------------------------------------------------------------------- |
|
723 |
// CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListL() |
|
724 |
// ----------------------------------------------------------------------------- |
|
725 |
// |
|
726 |
void CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListL() |
|
727 |
{ |
|
728 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # UpdateCategoryListL() - Enter" ); |
|
729 |
||
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
730 |
MakeCategoryIdArrayL(); |
23 | 731 |
|
732 |
if ( iCategoryIdArray.Count() != iScroller.ItemCount() ) |
|
733 |
{ |
|
734 |
iScroller.ResizeL( iCategoryIdArray.Count() ); |
|
735 |
} |
|
736 |
||
737 |
if ( iCategoryIdArray.Count() > 0 ) |
|
738 |
{ |
|
739 |
for ( TInt i = 0; i < iCategoryIdArray.Count(); i++ ) |
|
740 |
{ |
|
741 |
UpdateCategoryListItemL( i ); |
|
742 |
} |
|
743 |
if ( iScroller.SelectedIndex() < 0 || |
|
744 |
iScroller.SelectedIndex() >= iScroller.ItemCount() ) |
|
745 |
{ |
|
746 |
iScroller.SetSelectedIndex( 0 ); |
|
747 |
} |
|
748 |
} |
|
749 |
||
750 |
// Refresh the whole list. |
|
751 |
iScroller.DrawDeferred(); |
|
752 |
||
753 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # UpdateCategoryListL() - Exit" ); |
|
754 |
} |
|
755 |
||
756 |
// ----------------------------------------------------------------------------- |
|
757 |
// CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListItemL() |
|
758 |
// ----------------------------------------------------------------------------- |
|
759 |
// |
|
760 |
void CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListItemL( TInt aListIndex ) |
|
761 |
{ |
|
762 |
IPTVLOGSTRING2_LOW_LEVEL( |
|
763 |
"MPX My Videos UI # UpdateCategoryListItemL (index=%d)", aListIndex ); |
|
764 |
||
765 |
if( aListIndex >= 0 && |
|
766 |
aListIndex < iScroller.ItemCount() && |
|
767 |
aListIndex < iCategoryIdArray.Count() ) |
|
768 |
{ |
|
769 |
CHgItem& listItem = iScroller.ItemL( aListIndex ); |
|
770 |
||
771 |
HBufC* categoryName( NULL ); |
|
772 |
categoryName = GetCategoryNameLC( iCategoryIdArray[ aListIndex ] ); |
|
773 |
listItem.SetTitleL( *categoryName ); |
|
774 |
CleanupStack::PopAndDestroy( categoryName ); |
|
775 |
||
776 |
HBufC* secondRow( NULL ); |
|
777 |
secondRow = FormatCategorySecondRowLC( iCategoryIdArray[ aListIndex ] ); |
|
778 |
listItem.SetTextL( *secondRow ); |
|
779 |
CleanupStack::PopAndDestroy( secondRow ); |
|
780 |
||
781 |
// Set icon for category |
|
782 |
if ( !listItem.Icon() ) |
|
783 |
{ |
|
784 |
listItem.SetIcon( GetCategoryIconL( iCategoryIdArray[ aListIndex ] ) ); |
|
785 |
} |
|
786 |
} |
|
787 |
||
788 |
IPTVLOGSTRING_LOW_LEVEL( |
|
789 |
"MPX My Videos UI # UpdateCategoryListItemL() - Exit" ); |
|
790 |
} |
|
791 |
||
792 |
// ----------------------------------------------------------------------------- |
|
793 |
// CVcxHgMyVideosCategoryModelHandler::RemoveCategoryListItem() |
|
794 |
// ----------------------------------------------------------------------------- |
|
795 |
// |
|
796 |
void CVcxHgMyVideosCategoryModelHandler::RemoveCategoryListItem( TInt aListIndex ) |
|
797 |
{ |
|
798 |
if ( aListIndex >= 0 && aListIndex < iScroller.ItemCount() ) |
|
799 |
{ |
|
800 |
iScroller.RemoveItem( aListIndex ); |
|
801 |
} |
|
802 |
} |
|
803 |
||
804 |
// ----------------------------------------------------------------------------- |
|
805 |
// CVcxHgMyVideosCategoryModelHandler::ResolveCategoryId() |
|
806 |
// ----------------------------------------------------------------------------- |
|
807 |
// |
|
808 |
TInt CVcxHgMyVideosCategoryModelHandler::ResolveCategoryId( TInt aScrollerIndex ) |
|
809 |
{ |
|
810 |
TInt ret( -1 ); |
|
811 |
if ( aScrollerIndex >= 0 && |
|
812 |
aScrollerIndex <= iCategoryIdArray.Count() ) |
|
813 |
{ |
|
814 |
ret = iCategoryIdArray[ aScrollerIndex ]; |
|
815 |
} |
|
816 |
return ret; |
|
817 |
} |
|
818 |
||
819 |
// ----------------------------------------------------------------------------- |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
820 |
// CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArrayL() |
23 | 821 |
// ----------------------------------------------------------------------------- |
822 |
// |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
823 |
void CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArrayL() |
23 | 824 |
{ |
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
825 |
IPTVLOGSTRING_LOW_LEVEL("CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArrayL"); |
23 | 826 |
|
827 |
iCategoryIdArray.Reset(); |
|
828 |
||
829 |
TInt error = KErrNone; |
|
830 |
TInt value = KErrNotFound; |
|
831 |
TInt categoryId = KErrNotFound; |
|
832 |
||
833 |
// Check that cenrep exists and has some valid data |
|
834 |
error = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerItemLocation1, value ); |
|
835 |
||
836 |
if ( error == KErrNone && value > EMyVideosListItemTypeEmpty ) |
|
837 |
{ |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
838 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # MakeCategoryIdArrayL() Getting category items from cenrep" ); |
23 | 839 |
|
840 |
for ( TInt i=KCRVideoPlayerItemLocation1; i<=KCRVideoPlayerItemLocation7; i++ ) |
|
841 |
{ |
|
842 |
error = iModel.GetMyVideosCustomizationInt( i , value ); |
|
843 |
if ( error == KErrNone && value != EMyVideosListItemTypeEmpty ) |
|
844 |
{ |
|
845 |
switch ( value ) |
|
846 |
{ |
|
847 |
case EMyVideosListItemTypeLastWatched: |
|
848 |
categoryId = KCategoryIdLastWatched; |
|
849 |
break; |
|
850 |
case EMyVideosListItemTypeCapturedVideos: |
|
851 |
categoryId = KVcxMvcCategoryIdCaptured; |
|
852 |
break; |
|
853 |
case EMyVideosListItemTypeOtherVideos: |
|
854 |
categoryId = KVcxMvcCategoryIdOther; |
|
855 |
break; |
|
856 |
case EMyVideosListItemTypeExtra1: |
|
857 |
categoryId = KCategoryIdExtraItem1; |
|
858 |
break; |
|
859 |
case EMyVideosListItemTypeExtra2: |
|
860 |
categoryId = KCategoryIdExtraItem2; |
|
861 |
break; |
|
862 |
case EMyVideosListItemTypeExtra3: |
|
863 |
categoryId = KCategoryIdExtraItem3; |
|
864 |
break; |
|
865 |
case EMyVideosListItemTypeEmpty: |
|
866 |
categoryId = KErrNotFound; |
|
867 |
break; |
|
868 |
default: |
|
869 |
categoryId = KErrNotFound; |
|
870 |
break; |
|
871 |
} |
|
872 |
||
873 |
if ( AcceptCategory( categoryId ) ) |
|
874 |
{ |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
875 |
iCategoryIdArray.AppendL( categoryId ); |
23 | 876 |
} |
877 |
} |
|
878 |
} |
|
879 |
} |
|
880 |
else |
|
881 |
{ |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
882 |
iCategoryIdArray.AppendL( KCategoryIdLastWatched ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
883 |
iCategoryIdArray.AppendL( KVcxMvcCategoryIdCaptured ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
884 |
iCategoryIdArray.AppendL( KVcxMvcCategoryIdOther ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
885 |
iCategoryIdArray.AppendL( KCategoryIdExtraItem1 ); |
23 | 886 |
} |
887 |
} |
|
888 |
||
889 |
// ----------------------------------------------------------------------------- |
|
890 |
// CVcxHgMyVideosCategoryModelHandler::AcceptCategory() |
|
891 |
// ----------------------------------------------------------------------------- |
|
892 |
// |
|
893 |
TBool CVcxHgMyVideosCategoryModelHandler::AcceptCategory( TInt aCategoryId ) |
|
894 |
{ |
|
895 |
TBool ret(EFalse); |
|
896 |
switch ( aCategoryId ) |
|
897 |
{ |
|
898 |
case KVcxMvcCategoryIdAll: |
|
899 |
case KVcxMvcCategoryIdCaptured: |
|
900 |
case KVcxMvcCategoryIdOther: |
|
901 |
case KCategoryIdLastWatched: |
|
902 |
case KCategoryIdExtraItem1: |
|
903 |
IPTVLOGSTRING2_LOW_LEVEL( |
|
904 |
"MPX My Videos UI # AcceptCategory() Accepted category: %d", aCategoryId ); |
|
905 |
ret = ETrue; |
|
906 |
break; |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
907 |
case KCategoryIdExtraItem2: |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
908 |
ret = iExtraItem2Exists; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
909 |
IPTVLOGSTRING2_LOW_LEVEL( |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
910 |
"MPX My Videos UI # AcceptCategory() extra item 2 accepted: %d", ret ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
911 |
break; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
912 |
case KCategoryIdExtraItem3: |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
913 |
ret = iExtraItem3Exists; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
914 |
IPTVLOGSTRING2_LOW_LEVEL( |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
915 |
"MPX My Videos UI # AcceptCategory() extra item 3 accepted: %d", ret ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
916 |
break; |
23 | 917 |
default: |
918 |
IPTVLOGSTRING2_LOW_LEVEL( |
|
919 |
"MPX My Videos UI # AcceptCategory() Unknown category: %d", aCategoryId ); |
|
920 |
break; |
|
921 |
} |
|
922 |
||
923 |
return ret; |
|
924 |
} |
|
925 |
||
926 |
// ----------------------------------------------------------------------------- |
|
927 |
// MPX Collection calls this callback when category list items have been fetched. |
|
928 |
// ----------------------------------------------------------------------------- |
|
929 |
// |
|
930 |
void CVcxHgMyVideosCategoryModelHandler::CategoryListFetchingCompletedL() |
|
931 |
{ |
|
932 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # CategoryListFetchingCompletedL()" ); |
|
933 |
||
934 |
// Send custom command to appui that signals that the |
|
935 |
// my videos main view is constructed. |
|
936 |
CAknAppUi* appui = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
937 |
||
938 |
if ( appui ) |
|
939 |
{ |
|
940 |
appui->HandleCommandL( KVcxMyVideosCmdDoLateConstruct ); |
|
941 |
} |
|
942 |
} |
|
943 |
||
944 |
// ----------------------------------------------------------------------------- |
|
945 |
// CVcxHgMyVideosVideoModelHandler::GetCategoryDataL() |
|
946 |
// |
|
947 |
// ----------------------------------------------------------------------------- |
|
948 |
// |
|
949 |
CMPXMedia* CVcxHgMyVideosCategoryModelHandler::GetCategoryDataL( TInt aCategoryId ) |
|
950 |
{ |
|
951 |
if ( iCategoryList && aCategoryId >= 0 && iCategoryList->Count() > aCategoryId ) |
|
952 |
{ |
|
953 |
return (*iCategoryList)[ aCategoryId ]; |
|
954 |
} |
|
955 |
||
956 |
return NULL; |
|
957 |
} |
|
958 |
||
959 |
// ----------------------------------------------------------------------------- |
|
960 |
// CVcxHgMyVideosVideoModelHandler::PlayLastWatchedVidedoL() |
|
961 |
// |
|
962 |
// ----------------------------------------------------------------------------- |
|
963 |
// |
|
964 |
void CVcxHgMyVideosCategoryModelHandler::PlayLastWatchedVidedoL() |
|
965 |
{ |
|
966 |
TBuf<KMaxPath> path; |
|
967 |
TInt error( KErrNotFound ); |
|
968 |
if ( LastWatchedSetL() ) |
|
969 |
{ |
|
970 |
error = iModel.GetLastWatchedPathL( path ); |
|
971 |
} |
|
972 |
else if ( PreloadedExistsL() ) |
|
973 |
{ |
|
974 |
error = iModel.GetMyVideosCustomizationString( |
|
975 |
KCRVideoPlayerPreloadedVideoPath, path ); |
|
976 |
} |
|
977 |
||
978 |
if ( !error && path.Length() && BaflUtils::FileExists( iModel.FileServerSessionL(), path ) ) |
|
979 |
{ |
|
980 |
CAknAppUi* appui = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
981 |
||
982 |
if ( appui ) |
|
983 |
{ |
|
984 |
appui->OpenFileL( path ); |
|
985 |
iModel.SetAppState( CVcxHgMyVideosModel::EVcxMyVideosAppStatePlayer ); |
|
986 |
} |
|
987 |
} |
|
988 |
} |
|
989 |
||
990 |
// ----------------------------------------------------------------------------- |
|
991 |
// CVcxHgMyVideosVideoModelHandler::LoadLastWatchedIconL() |
|
992 |
// |
|
993 |
// ----------------------------------------------------------------------------- |
|
994 |
// |
|
995 |
void CVcxHgMyVideosCategoryModelHandler::LoadLastWatchedIconL() |
|
996 |
{ |
|
997 |
if ( LastWatchedSetL() ) |
|
998 |
{ |
|
999 |
TBuf<KMaxPath> path; |
|
1000 |
TInt error = iModel.GetLastWatchedPathL( path ); |
|
1001 |
||
1002 |
if ( BaflUtils::FileExists( iModel.FileServerSessionL(), path ) ) |
|
1003 |
{ |
|
1004 |
CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( |
|
1005 |
path, |
|
1006 |
KNullDesC ); |
|
1007 |
iTnRequestId = iTnManager.GetL( *source ); |
|
1008 |
CleanupStack::PopAndDestroy( source ); |
|
1009 |
} |
|
1010 |
} |
|
1011 |
else |
|
1012 |
{ |
|
1013 |
if ( PreloadedExistsL() ) |
|
1014 |
{ |
|
1015 |
TBuf<KMaxPath> path; |
|
1016 |
TInt error = iModel.GetMyVideosCustomizationString( |
|
1017 |
KCRVideoPlayerPreloadedVideoPath, path ); |
|
1018 |
CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( |
|
1019 |
path, |
|
1020 |
KNullDesC ); |
|
1021 |
||
1022 |
iTnRequestId = iTnManager.GetL( *source ); |
|
1023 |
CleanupStack::PopAndDestroy( source ); |
|
1024 |
} |
|
1025 |
} |
|
1026 |
} |
|
1027 |
||
1028 |
// ----------------------------------------------------------------------------- |
|
1029 |
// CVcxHgMyVideosVideoModelHandler::ClearLastWatchedIconL() |
|
1030 |
// |
|
1031 |
// ----------------------------------------------------------------------------- |
|
1032 |
// |
|
1033 |
void CVcxHgMyVideosCategoryModelHandler::ClearLastWatchedIconL() |
|
1034 |
{ |
|
1035 |
CHgItem& item = iScroller.ItemL( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
1036 |
item.ClearFlags( CHgItem::EHgItemFlagsIconOverlayIndicator ); |
|
1037 |
item.SetIcon( NULL ); |
|
1038 |
} |
|
1039 |
||
1040 |
// ----------------------------------------------------------------------------- |
|
1041 |
// CVcxHgMyVideosVideoModelHandler::SetLastWatchedIndicatorL() |
|
1042 |
// |
|
1043 |
// ----------------------------------------------------------------------------- |
|
1044 |
// |
|
1045 |
void CVcxHgMyVideosCategoryModelHandler::SetLastWatchedIndicatorL() |
|
1046 |
{ |
|
1047 |
if ( KErrNotFound != ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ) |
|
1048 |
{ |
|
1049 |
CHgItem& lastWatchedItem = iScroller.ItemL( |
|
1050 |
ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
1051 |
TInt isIndicator( 0 ); |
|
1052 |
iModel.GetLastWatchedIndicatorL( isIndicator ); |
|
1053 |
||
1054 |
TBuf<KMaxPath> path; |
|
1055 |
TInt error = iModel.GetLastWatchedPathL( path ); |
|
1056 |
TBool exist = BaflUtils::FileExists( iModel.FileServerSessionL(), path ); |
|
1057 |
if ( isIndicator && path.Length() && exist ) |
|
1058 |
{ |
|
1059 |
lastWatchedItem.SetFlags( CHgItem::EHgItemFlagsIconOverlayIndicator ); |
|
1060 |
} |
|
1061 |
else |
|
1062 |
{ |
|
1063 |
lastWatchedItem.ClearFlags( CHgItem::EHgItemFlagsIconOverlayIndicator ); |
|
1064 |
} |
|
1065 |
} |
|
1066 |
} |
|
1067 |
||
1068 |
// ----------------------------------------------------------------------------- |
|
1069 |
// CVcxHgMyVideosVideoModelHandler::VideoIndicatorL() |
|
1070 |
// |
|
1071 |
// ----------------------------------------------------------------------------- |
|
1072 |
// |
|
1073 |
CMyVideosIndicator& CVcxHgMyVideosCategoryModelHandler::VideoIndicatorL() |
|
1074 |
{ |
|
1075 |
if ( !iVideoIndicator ) |
|
1076 |
{ |
|
1077 |
iVideoIndicator = CMyVideosIndicator::NewL(); |
|
1078 |
} |
|
1079 |
return *iVideoIndicator; |
|
1080 |
} |
|
1081 |
||
1082 |
// ----------------------------------------------------------------------------- |
|
1083 |
// CVcxHgMyVideosVideoModelHandler::ThumbnailPreviewReady() |
|
1084 |
// |
|
1085 |
// ----------------------------------------------------------------------------- |
|
1086 |
// |
|
1087 |
void CVcxHgMyVideosCategoryModelHandler::ThumbnailPreviewReady( |
|
1088 |
MThumbnailData& /*aThumbnail*/, |
|
1089 |
TThumbnailRequestId /*aId*/ ) |
|
1090 |
{ |
|
1091 |
// No implementation |
|
1092 |
} |
|
1093 |
||
1094 |
// ----------------------------------------------------------------------------- |
|
1095 |
// CVcxHgMyVideosVideoModelHandler::ThumbnailReady() |
|
1096 |
// |
|
1097 |
// ----------------------------------------------------------------------------- |
|
1098 |
// |
|
1099 |
void CVcxHgMyVideosCategoryModelHandler::ThumbnailReady( |
|
1100 |
TInt aError, |
|
1101 |
MThumbnailData& aThumbnail, |
|
1102 |
TThumbnailRequestId aId ) |
|
1103 |
{ |
|
1104 |
if ( aId == iTnRequestId ) |
|
1105 |
{ |
|
1106 |
iTnRequestId = KErrNotFound; |
|
1107 |
||
1108 |
TRAP_IGNORE( ThumbnailReadyL( aError, aThumbnail, aId ) ); |
|
1109 |
} |
|
1110 |
} |
|
1111 |
||
1112 |
// ----------------------------------------------------------------------------- |
|
1113 |
// CVcxHgMyVideosVideoModelHandler::ThumbnailReady() |
|
1114 |
// |
|
1115 |
// ----------------------------------------------------------------------------- |
|
1116 |
// |
|
1117 |
void CVcxHgMyVideosCategoryModelHandler::ThumbnailReadyL( |
|
1118 |
TInt aError, |
|
1119 |
MThumbnailData& aThumbnail, |
|
1120 |
TThumbnailRequestId /*aId*/ ) |
|
1121 |
{ |
|
1122 |
TInt lastWatchedIndex = ResolveCategoryArrayIndexById( KCategoryIdLastWatched ); |
|
1123 |
if ( lastWatchedIndex != KErrNotFound ) |
|
1124 |
{ |
|
1125 |
CHgItem& listItem = iScroller.ItemL( lastWatchedIndex ); |
|
1126 |
CGulIcon* thumbnail( NULL ); |
|
1127 |
||
1128 |
if ( !aError ) |
|
1129 |
{ |
|
1130 |
thumbnail = CGulIcon::NewL( aThumbnail.DetachBitmap() ); |
|
1131 |
CleanupStack::PushL( thumbnail ); |
|
1132 |
SetLastWatchedIndicatorL(); |
|
1133 |
} |
|
1134 |
else |
|
1135 |
{ |
|
1136 |
TFileName iconFile( KVcxHgMyVideosMifFile ); |
|
1137 |
thumbnail = CreateHgListIconL( |
|
1138 |
KAknsIIDQgnPropRecentThumbnailVideo, |
|
1139 |
iconFile, |
|
1140 |
EMbmVcxhgmyvideosiconsQgn_prop_recent_thumbnail_video, |
|
1141 |
EMbmVcxhgmyvideosiconsQgn_prop_recent_thumbnail_video_mask ); |
|
1142 |
||
1143 |
CleanupStack::PushL( thumbnail ); |
|
1144 |
} |
|
1145 |
||
1146 |
listItem.SetIcon( thumbnail ); // Takes ownership |
|
1147 |
CleanupStack::Pop( thumbnail ); |
|
1148 |
iScroller.RefreshScreen( lastWatchedIndex ); |
|
1149 |
} |
|
1150 |
} |
|
1151 |
||
1152 |
||
1153 |
// ----------------------------------------------------------------------------- |
|
1154 |
// CVcxHgMyVideosVideoModelHandler::HandleExtraItemSelectionL() |
|
1155 |
// |
|
1156 |
// ----------------------------------------------------------------------------- |
|
1157 |
// |
|
1158 |
void CVcxHgMyVideosCategoryModelHandler::HandleExtraItemSelectionL( |
|
1159 |
TInt categoryId, |
|
1160 |
TVcxHgMyVideosCategoryItemType& aItemType, |
|
1161 |
TUid& aUid, |
|
1162 |
TDes& aUrl ) |
|
1163 |
{ |
|
1164 |
TInt uidKey = 0; |
|
1165 |
TInt urlKey = 0; |
|
1166 |
||
1167 |
aItemType = TVcxHgMyVideosCategoryItemTypeUndefined; |
|
1168 |
||
1169 |
switch ( categoryId ) |
|
1170 |
{ |
|
1171 |
case KCategoryIdExtraItem1: |
|
1172 |
{ |
|
1173 |
uidKey = KCRVideoPlayerExtraItem1Uid; |
|
1174 |
urlKey = KCRVideoPlayerExtraItem1Url; |
|
1175 |
break; |
|
1176 |
} |
|
1177 |
case KCategoryIdExtraItem2: |
|
1178 |
{ |
|
1179 |
uidKey = KCRVideoPlayerExtraItem2Uid; |
|
1180 |
urlKey = KCRVideoPlayerExtraItem2Url; |
|
1181 |
break; |
|
1182 |
} |
|
1183 |
case KCategoryIdExtraItem3: |
|
1184 |
{ |
|
1185 |
uidKey = KCRVideoPlayerExtraItem3Uid; |
|
1186 |
urlKey = KCRVideoPlayerExtraItem3Url; |
|
1187 |
break; |
|
1188 |
} |
|
1189 |
default: |
|
1190 |
return; |
|
1191 |
} |
|
1192 |
||
1193 |
TBuf<KMyVideosTitleUrlMaxLength> urlString; |
|
1194 |
TInt uidInt( 0 ) ; |
|
1195 |
||
1196 |
// Try to get URL. |
|
1197 |
TInt error = iModel.GetMyVideosCustomizationString( urlKey, urlString ); |
|
1198 |
if ( error == KErrNone && urlString.Size() > 0 ) |
|
1199 |
{ |
|
1200 |
aUrl = urlString; |
|
1201 |
aItemType = TVcxHgMyVideosCategoryItemTypeUrl; |
|
1202 |
} |
|
1203 |
||
1204 |
// Try to fetch application UID. |
|
1205 |
error = iModel.GetMyVideosCustomizationInt( uidKey, uidInt ); |
|
1206 |
if ( error == KErrNone && uidInt != 0 ) |
|
1207 |
{ |
|
1208 |
aUid = TUid::Uid( uidInt ); |
|
1209 |
aItemType = TVcxHgMyVideosCategoryItemTypeUid; |
|
1210 |
} |
|
1211 |
} |
|
1212 |
||
1213 |
// ----------------------------------------------------------------------------- |
|
1214 |
// CVcxHgMyVideosVideoModelHandler::CreateHgListIconL() |
|
1215 |
// |
|
1216 |
// ----------------------------------------------------------------------------- |
|
1217 |
// |
|
1218 |
CGulIcon* CVcxHgMyVideosCategoryModelHandler::CreateHgListIconL( |
|
1219 |
const TAknsItemID& aSkinId, |
|
1220 |
const TFileName& aFileName, |
|
1221 |
TInt aBitmapId, |
|
1222 |
TInt aMaskId ) |
|
1223 |
{ |
|
1224 |
IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::CreateHgListIconL() skin major=%d, skin minor=%d", aSkinId.iMajor, aSkinId.iMinor ); |
|
1225 |
IPTVLOGSTRING4_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::CreateHgListIconL() bitmap=%d mask=%d file %S", aBitmapId, aMaskId, &aFileName ); |
|
1226 |
||
1227 |
CFbsBitmap* bitmap( NULL ); |
|
1228 |
CFbsBitmap* mask( NULL ); |
|
1229 |
CGulIcon* icon( NULL ); |
|
1230 |
||
1231 |
// Create default icon for Hg list. |
|
1232 |
AknsUtils::CreateIconLC( |
|
1233 |
AknsUtils::SkinInstance(), |
|
1234 |
aSkinId, |
|
1235 |
bitmap, |
|
1236 |
mask, |
|
1237 |
aFileName, |
|
1238 |
aBitmapId, |
|
1239 |
aMaskId ); |
|
1240 |
||
1241 |
TInt error( KErrNone ); |
|
1242 |
error = AknIconUtils::SetSize( |
|
1243 |
bitmap, |
|
1244 |
CHgDoubleGraphicList::PreferredImageSize(), |
|
1245 |
EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
1246 |
User::LeaveIfError( error ); |
|
1247 |
||
1248 |
error = AknIconUtils::SetSize( |
|
1249 |
mask, |
|
1250 |
CHgDoubleGraphicList::PreferredImageSize(), |
|
1251 |
EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
1252 |
User::LeaveIfError( error ); |
|
1253 |
||
1254 |
// Ownership of bitmap and mask is transferred to icon. |
|
1255 |
icon = CGulIcon::NewL( bitmap, mask ); |
|
1256 |
CleanupStack::Pop( 2 ); // mask and bitmap |
|
1257 |
||
1258 |
IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::CreateHgListIconL() icon=0x%08x", icon ); |
|
1259 |
||
1260 |
return icon; |
|
1261 |
} |
|
1262 |
||
1263 |
// ----------------------------------------------------------------------------- |
|
1264 |
// CVcxHgMyVideosVideoModelHandler::CreateEmptyHgListIconL() |
|
1265 |
// |
|
1266 |
// ----------------------------------------------------------------------------- |
|
1267 |
// |
|
1268 |
CGulIcon* CVcxHgMyVideosCategoryModelHandler::CreateEmptyHgListIconL() |
|
1269 |
{ |
|
1270 |
IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::CreateEmptyHgListIconL()" ); |
|
1271 |
CGulIcon* icon( NULL ); |
|
1272 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
1273 |
||
1274 |
bitmap->Create( CHgDoubleGraphicList::PreferredImageSize(), ENone ); |
|
1275 |
CleanupStack::PushL( bitmap ); |
|
1276 |
icon = CGulIcon::NewL( bitmap ); |
|
1277 |
CleanupStack::Pop( bitmap ); |
|
1278 |
||
1279 |
return icon; |
|
1280 |
} |
|
1281 |
||
1282 |
// ----------------------------------------------------------------------------- |
|
1283 |
// CVcxHgMyVideosVideoModelHandler::LastWatchedSetL() |
|
1284 |
// ----------------------------------------------------------------------------- |
|
1285 |
// |
|
1286 |
TBool CVcxHgMyVideosCategoryModelHandler::LastWatchedSetL() |
|
1287 |
{ |
|
1288 |
TBuf<KMaxPath> path; |
|
1289 |
TInt error = iModel.GetLastWatchedPathL( path ); |
|
1290 |
TInt length = path.Length(); |
|
1291 |
||
1292 |
if ( error == KErrNone && length > 0 ) |
|
1293 |
{ |
|
1294 |
return ETrue; |
|
1295 |
} |
|
1296 |
else |
|
1297 |
{ |
|
1298 |
return EFalse; |
|
1299 |
} |
|
1300 |
} |
|
1301 |
// ----------------------------------------------------------------------------- |
|
1302 |
// CVcxHgMyVideosVideoModelHandler::PreloadedExistsL() |
|
1303 |
// ----------------------------------------------------------------------------- |
|
1304 |
// |
|
1305 |
TBool CVcxHgMyVideosCategoryModelHandler::PreloadedExistsL() |
|
1306 |
{ |
|
1307 |
TBuf<KMaxPath> path; |
|
1308 |
TInt error = iModel.GetMyVideosCustomizationString( KCRVideoPlayerPreloadedVideoPath, path ); |
|
1309 |
if ( !error && path.Length() && BaflUtils::FileExists( iModel.FileServerSessionL(), path ) ) |
|
1310 |
{ |
|
1311 |
return ETrue; |
|
1312 |
} |
|
1313 |
else |
|
1314 |
{ |
|
1315 |
return EFalse; |
|
1316 |
} |
|
1317 |
} |
|
24
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1318 |
|
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1319 |
// ------------------------------------------------------------------------------ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1320 |
// CVcxHgMyVideosVideoModelHandler::AppExistsL() |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1321 |
// ------------------------------------------------------------------------------ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1322 |
// |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1323 |
TBool CVcxHgMyVideosCategoryModelHandler::AppExistsL( const TUid& aAppUid ) |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1324 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1325 |
IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::AppExistsL()" ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1326 |
TBool retVal( EFalse ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1327 |
RApaLsSession appArcSession; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1328 |
User::LeaveIfError( appArcSession.Connect() ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1329 |
CleanupClosePushL( appArcSession ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1330 |
|
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1331 |
TApaAppInfo appInfo; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1332 |
TInt err = appArcSession.GetAppInfo( appInfo, aAppUid ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1333 |
if ( err == KErrNone ) |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1334 |
{ |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1335 |
IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::AppExistsL(): return TRUE" ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1336 |
retVal = ETrue; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1337 |
} |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1338 |
CleanupStack::PopAndDestroy( &appArcSession ); |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1339 |
return retVal; |
f87e8c4ac026
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
1340 |
} |