|
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: Client class for My Videos MPX Collection.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <bldvariant.hrh> |
|
22 #include <mpxcollectionutility.h> |
|
23 #include <mpxcollectionpath.h> |
|
24 #include <mpxmediageneraldefs.h> |
|
25 #include <mpxmessagegeneraldefs.h> |
|
26 #include <mpxmessage2.h> |
|
27 #include <mpxcollectionmessagedefs.h> |
|
28 #include <mpxcollectionmessage.h> |
|
29 #include <mpxmessagecontainerdefs.h> |
|
30 #include <mpxmediacontainerdefs.h> |
|
31 #include <mpxcommandgeneraldefs.h> |
|
32 #include <mpxcollectioncommanddefs.h> |
|
33 #include <StringLoader.h> |
|
34 #include <aknnotewrappers.h> |
|
35 #include <vcxmyvideosdefs.h> |
|
36 #include <vcxhgmyvideos.rsg> |
|
37 #include <vcxmyvideosuids.h> |
|
38 #include "IptvDebug.h" |
|
39 #include "vcxhgmyvideoscollectionclient.h" |
|
40 #include "vcxhgmyvideosdownloadclient.h" |
|
41 #include "vcxhgmyvideoscategorymodelobserver.h" |
|
42 #include "vcxhgmyvideosvideomodelobserver.h" |
|
43 |
|
44 |
|
45 // CONSTANTS |
|
46 const TInt KVcxHgEventLevelRoot = 1; |
|
47 const TInt KVcxHgEventLevelCategory = 2; |
|
48 const TInt KVcxHgEventLevelVideo = 3; |
|
49 |
|
50 const TInt KVcxMpxLevelCategories = 2; |
|
51 const TInt KVcxMpxLevelVideos = 3; |
|
52 |
|
53 const TUint32 KVcxHgMyVideosTransactionId = 5; |
|
54 |
|
55 // ============================ MEMBER FUNCTIONS =============================== |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CVcxHgMyVideosCollectionClient::CVcxHgMyVideosCollectionClient() |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CVcxHgMyVideosCollectionClient::CVcxHgMyVideosCollectionClient() |
|
62 : iCollectionOpenStatus( EVcxHgCollectionNotOpen ), |
|
63 iPendingCommand( EVcxHgMyVideosCollectionCommandNone ), |
|
64 iCollectionLevel( KErrNotFound ) |
|
65 { |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CVcxHgMyVideosCollectionClient::NewL() |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CVcxHgMyVideosCollectionClient* CVcxHgMyVideosCollectionClient::NewL() |
|
73 { |
|
74 CVcxHgMyVideosCollectionClient* self = |
|
75 CVcxHgMyVideosCollectionClient::NewLC(); |
|
76 CleanupStack::Pop( self ); |
|
77 return self; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CVcxHgMyVideosCollectionClient::NewLC() |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 CVcxHgMyVideosCollectionClient* CVcxHgMyVideosCollectionClient::NewLC() |
|
85 { |
|
86 CVcxHgMyVideosCollectionClient* self = |
|
87 new (ELeave) CVcxHgMyVideosCollectionClient(); |
|
88 CleanupStack::PushL( self ); |
|
89 self->ConstructL(); |
|
90 return self; |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CVcxHgMyVideosCollectionClient::ConstructL() |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 void CVcxHgMyVideosCollectionClient::ConstructL() |
|
98 { |
|
99 iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault ); |
|
100 iDownloadClient = CVcxHgMyVideosDownloadClient::NewL( *this, *iCollectionUtility ); |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CVcxHgMyVideosCollectionClient::~CVcxHgMyVideosCollectionClient() |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 CVcxHgMyVideosCollectionClient::~CVcxHgMyVideosCollectionClient() |
|
108 { |
|
109 delete iLatestMpxMedia; |
|
110 delete iDownloadClient; |
|
111 if ( iCollectionUtility ) |
|
112 { |
|
113 iCollectionUtility->Close(); |
|
114 } |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // CVcxHgMyVideosCollectionClient::DownloadClient() |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 CVcxHgMyVideosDownloadClient& CVcxHgMyVideosCollectionClient::DownloadClient() |
|
122 { |
|
123 return *iDownloadClient; |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CVcxHgMyVideosCollectionClient::HasPendingCommand() |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TBool CVcxHgMyVideosCollectionClient::HasPendingCommand() |
|
131 { |
|
132 return iPendingCommand != EVcxHgMyVideosCollectionCommandNone; |
|
133 } |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // CVcxHgMyVideosCollectionClient::SetCategoryModelObserver() |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 void CVcxHgMyVideosCollectionClient::SetCategoryModelObserver( |
|
140 MVcxHgMyVideosCategoryModelObserver* aCategoryModelObserver ) |
|
141 { |
|
142 iCategoryModelObserver = aCategoryModelObserver; |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // CVcxHgMyVideosCollectionClient::SetVideoModelObserver() |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 void CVcxHgMyVideosCollectionClient::SetVideoModelObserver( |
|
150 MVcxHgMyVideosVideoModelObserver* aVideoModelObserver ) |
|
151 { |
|
152 iVideoModelObserver = aVideoModelObserver; |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CVcxHgMyVideosCollectionClient::CollectionLevelL() |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 TInt CVcxHgMyVideosCollectionClient::CollectionLevelL() |
|
160 { |
|
161 if ( iCollectionLevel == KErrNotFound ) |
|
162 { |
|
163 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
164 CleanupStack::PushL( path ); |
|
165 iCollectionLevel = path->Levels(); |
|
166 CleanupStack::PopAndDestroy( path ); |
|
167 } |
|
168 |
|
169 return iCollectionLevel; |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CVcxHgMyVideosCollectionClient::GetCategoryListL() |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 void CVcxHgMyVideosCollectionClient::GetCategoryListL() |
|
177 { |
|
178 IPTVLOGSTRING_LOW_LEVEL( |
|
179 "MPX My Videos UI # GetCategoryListL()" ); |
|
180 |
|
181 if ( iCollectionOpenStatus == EVcxHgCollectionNotOpen ) |
|
182 { |
|
183 CMPXCollectionPath* collectionPath = CMPXCollectionPath::NewL(); |
|
184 CleanupStack::PushL( collectionPath ); |
|
185 collectionPath->AppendL( KVcxUidMyVideosMpxCollection ); |
|
186 iCollectionUtility->Collection().OpenL( *collectionPath ); |
|
187 CleanupStack::PopAndDestroy( collectionPath ); |
|
188 |
|
189 iCollectionOpenStatus = EVcxHgCollectionOpening; |
|
190 } |
|
191 else |
|
192 { |
|
193 if ( CollectionLevelL() == KVcxMpxLevelVideos ) |
|
194 { |
|
195 iCollectionUtility->Collection().BackL(); |
|
196 } |
|
197 } |
|
198 } |
|
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // CVcxHgMyVideosCollectionClient::GetVideoListL() |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 void CVcxHgMyVideosCollectionClient::GetVideoListL( TInt aIndex ) |
|
205 { |
|
206 IPTVLOGSTRING2_LOW_LEVEL( |
|
207 "MPX My Videos UI # GetVideoListL(%d)", aIndex ); |
|
208 |
|
209 TInt collectionLevel = CollectionLevelL(); |
|
210 |
|
211 if ( collectionLevel == KVcxMpxLevelCategories ) |
|
212 { |
|
213 iCollectionUtility->Collection().OpenL( aIndex ); |
|
214 } |
|
215 else if ( collectionLevel == KVcxMpxLevelVideos ) |
|
216 { |
|
217 iCollectionUtility->Collection().BackL(); |
|
218 iCollectionUtility->Collection().OpenL( aIndex ); |
|
219 } |
|
220 else |
|
221 { |
|
222 // NOP |
|
223 } |
|
224 } |
|
225 |
|
226 // ----------------------------------------------------------------------------- |
|
227 // CVcxHgMyVideosCollectionClient::ArrayIndexToMpxItemIdL() |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 TMPXItemId CVcxHgMyVideosCollectionClient::ArrayIndexToMpxItemIdL( TInt aArrayIndex, |
|
231 CMPXMediaArray* aArray ) |
|
232 { |
|
233 if ( aArrayIndex < 0 || aArrayIndex >= aArray->Count() ) |
|
234 { |
|
235 User::Leave( KErrArgument ); |
|
236 } |
|
237 |
|
238 return (*aArray)[aArrayIndex]->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
239 } |
|
240 |
|
241 // ----------------------------------------------------------------------------- |
|
242 // CVcxHgMyVideosCollectionClient::DeleteVideosL() |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 void CVcxHgMyVideosCollectionClient::DeleteVideosL( CMPXMediaArray* aMediasToDelete ) |
|
246 { |
|
247 IPTVLOGSTRING_LOW_LEVEL( |
|
248 "MPX My Videos UI # CVcxHgMyVideosCollectionClient::DeleteVideosL()" ); |
|
249 |
|
250 if ( ! HasPendingCommand() && ! iDownloadClient->HasPendingCommand() ) |
|
251 { |
|
252 CMPXCommand* cmd = CMPXMedia::NewL(); |
|
253 CleanupStack::PushL( cmd ); |
|
254 |
|
255 cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos ); |
|
256 cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosDelete ); |
|
257 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, EFalse ); |
|
258 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, |
|
259 TUid::Uid( KVcxUidMyVideosMpxCollection ) ); |
|
260 cmd->SetCObjectValueL( KMPXMediaArrayContents, aMediasToDelete ); |
|
261 |
|
262 iCollectionUtility->Collection().CommandL( *cmd ); |
|
263 |
|
264 iPendingCommand = EVcxHgMyVideosCollectionCommandMultiDelete_Starting; |
|
265 CleanupStack::PopAndDestroy( cmd ); |
|
266 } |
|
267 else |
|
268 { |
|
269 IPTVLOGSTRING_LOW_LEVEL( |
|
270 "MPX My Videos UI # CVcxHgMyVideosCollectionClient::DeleteVideosL() LEAVE: KErrNotReady" ); |
|
271 User::Leave( KErrNotReady ); |
|
272 } |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CVcxHgMyVideosCollectionClient::CancelDeleteVideosL() |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 void CVcxHgMyVideosCollectionClient::CancelDeleteVideosL() |
|
280 { |
|
281 IPTVLOGSTRING_LOW_LEVEL( |
|
282 "MPX My Videos UI # CVcxHgMyVideosCollectionClient::CancelDeleteVideosL()" ); |
|
283 |
|
284 // Deletion can be cancelled right away if deletion has already started. If we |
|
285 // are only waiting for it, we modify the pending command to indicate cancellation. |
|
286 if ( iPendingCommand == EVcxHgMyVideosCollectionCommandMultiDelete_Started || |
|
287 iPendingCommand == EVcxHgMyVideosCollectionCommandMultiDelete_Finished ) |
|
288 { |
|
289 CMPXCommand* cmd = CMPXMedia::NewL(); |
|
290 CleanupStack::PushL( cmd ); |
|
291 cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos ); |
|
292 cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosCancelDelete ); |
|
293 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); |
|
294 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, |
|
295 TUid::Uid( KVcxUidMyVideosMpxCollection ) ); |
|
296 iCollectionUtility->Collection().CommandL( *cmd ); |
|
297 CleanupStack::PopAndDestroy( cmd ); |
|
298 |
|
299 iPendingCommand = EVcxHgMyVideosCollectionCommandCancelDelete_Completed; |
|
300 } |
|
301 else if ( iPendingCommand == EVcxHgMyVideosCollectionCommandMultiDelete_Starting ) |
|
302 { |
|
303 iPendingCommand = EVcxHgMyVideosCollectionCommandCancelDelete_Requested; |
|
304 } |
|
305 } |
|
306 |
|
307 // ----------------------------------------------------------------------------- |
|
308 // CVcxHgMyVideosCollectionClient::MoveOrCopyVideosL() |
|
309 // ----------------------------------------------------------------------------- |
|
310 // |
|
311 void CVcxHgMyVideosCollectionClient::MoveOrCopyVideosL( CMPXMediaArray* mediasToMoveOrCopy, |
|
312 TInt aTargetDrive, |
|
313 TBool aCopy ) |
|
314 { |
|
315 CMPXCommand* cmd = CMPXMedia::NewL(); |
|
316 CleanupStack::PushL( cmd ); |
|
317 |
|
318 cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos ); |
|
319 if ( aCopy ) |
|
320 { |
|
321 cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosCopy ); |
|
322 } |
|
323 else |
|
324 { |
|
325 cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosMove ); |
|
326 } |
|
327 cmd->SetTObjectValueL( KVcxMediaMyVideosInt32Value, aTargetDrive ); |
|
328 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, EFalse ); |
|
329 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, |
|
330 TUid::Uid( KVcxUidMyVideosMpxCollection ) ); |
|
331 cmd->SetCObjectValueL( KMPXMediaArrayContents, mediasToMoveOrCopy ); |
|
332 |
|
333 iCollectionUtility->Collection().CommandL(*cmd); |
|
334 iPendingCommand = EVcxHgMyVideosCollectionCommandMoveCopy_Starting; |
|
335 CleanupStack::PopAndDestroy( cmd ); |
|
336 } |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CVcxHgMyVideosCollectionClient::CancelMoveOrCopyVideosL() |
|
340 // ----------------------------------------------------------------------------- |
|
341 // |
|
342 void CVcxHgMyVideosCollectionClient::CancelMoveOrCopyVideosL() |
|
343 { |
|
344 IPTVLOGSTRING_LOW_LEVEL( |
|
345 "MPX My Videos UI # CVcxHgMyVideosCollectionClient::CancelMoveOrCopyVideosL()" ); |
|
346 |
|
347 if ( iPendingCommand == EVcxHgMyVideosCollectionCommandMoveCopy_Started || |
|
348 iPendingCommand == EVcxHgMyVideosCollectionCommandMoveCopy_Finished ) |
|
349 { |
|
350 CMPXCommand* cmd = CMPXMedia::NewL(); |
|
351 CleanupStack::PushL( cmd ); |
|
352 cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos ); |
|
353 cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosCancelMoveOrCopy ); |
|
354 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); |
|
355 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, |
|
356 TUid::Uid( KVcxUidMyVideosMpxCollection ) ); |
|
357 iCollectionUtility->Collection().CommandL( *cmd ); |
|
358 CleanupStack::PopAndDestroy( cmd ); |
|
359 |
|
360 iPendingCommand = EVcxHgMyVideosCollectionCommandCancelMoveCopy_Completed; |
|
361 } |
|
362 else if ( iPendingCommand == EVcxHgMyVideosCollectionCommandMoveCopy_Starting ) |
|
363 { |
|
364 iPendingCommand = EVcxHgMyVideosCollectionCommandCancelMoveCopy_Requested; |
|
365 } |
|
366 } |
|
367 |
|
368 // ----------------------------------------------------------------------------- |
|
369 // CVcxHgMyVideosCollectionClient::PlayVideoL() |
|
370 // ----------------------------------------------------------------------------- |
|
371 // |
|
372 void CVcxHgMyVideosCollectionClient::PlayVideoL( TMPXItemId aMpxItemId ) |
|
373 { |
|
374 IPTVLOGSTRING2_LOW_LEVEL( |
|
375 "CVcxHgMyVideosCollectionClient::PlayVideoL: Play video at collection index %d", aMpxItemId.iId1 ); |
|
376 |
|
377 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
378 CleanupStack::PushL(path); |
|
379 |
|
380 path->AppendL( KVcxUidMyVideosMpxCollection ); |
|
381 path->AppendL( KVcxMvcCategoryIdAll ); |
|
382 path->AppendL( aMpxItemId ); |
|
383 path->SelectL( aMpxItemId ); |
|
384 |
|
385 iCollectionUtility->Collection().OpenL( *path ); |
|
386 CleanupStack::PopAndDestroy(path); |
|
387 } |
|
388 |
|
389 // ----------------------------------------------------------------------------- |
|
390 // CVcxHgMyVideosCollectionClient::SetAttributeL() |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 void CVcxHgMyVideosCollectionClient::SetAttributeL( const CMPXMedia& aMedia, |
|
394 const TMPXAttribute& aAttribute, |
|
395 const TUint32 aValue ) |
|
396 { |
|
397 if ( ! HasPendingCommand() && ! iDownloadClient->HasPendingCommand() ) |
|
398 { |
|
399 CMPXMedia* updatedMedia = CMPXMedia::NewL(); |
|
400 CleanupStack::PushL( updatedMedia ); |
|
401 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
402 CleanupStack::PushL( cmd ); |
|
403 |
|
404 updatedMedia->SetTObjectValueL<TMPXItemId>( |
|
405 KMPXMediaGeneralId, |
|
406 aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
407 updatedMedia->SetTObjectValueL<TUint32>( aAttribute, aValue ); |
|
408 |
|
409 cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); |
|
410 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); |
|
411 cmd->SetCObjectValueL( KMPXCommandColSetMedia, updatedMedia ); |
|
412 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, |
|
413 KVcxUidMyVideosMpxCollection ); |
|
414 |
|
415 iCollectionUtility->Collection().CommandL( *cmd ); |
|
416 |
|
417 CleanupStack::PopAndDestroy( cmd ); |
|
418 CleanupStack::PopAndDestroy( updatedMedia ); |
|
419 } |
|
420 } |
|
421 |
|
422 // ----------------------------------------------------------------------------- |
|
423 // CVcxHgMyVideosCollectionClient::SetAttributeL() |
|
424 // ----------------------------------------------------------------------------- |
|
425 // |
|
426 void CVcxHgMyVideosCollectionClient::SetAttributeL( const CMPXMedia& aMedia, |
|
427 const TMPXAttribute& aAttribute, |
|
428 const TReal32 aValue ) |
|
429 { |
|
430 if ( ! HasPendingCommand() && ! iDownloadClient->HasPendingCommand() ) |
|
431 { |
|
432 CMPXMedia* updatedMedia = CMPXMedia::NewL(); |
|
433 CleanupStack::PushL( updatedMedia ); |
|
434 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
435 CleanupStack::PushL( cmd ); |
|
436 |
|
437 updatedMedia->SetTObjectValueL<TMPXItemId>( |
|
438 KMPXMediaGeneralId, |
|
439 aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
440 updatedMedia->SetTObjectValueL<TReal32>( aAttribute, aValue ); |
|
441 |
|
442 cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); |
|
443 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); |
|
444 cmd->SetCObjectValueL( KMPXCommandColSetMedia, updatedMedia ); |
|
445 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, |
|
446 KVcxUidMyVideosMpxCollection ); |
|
447 |
|
448 iCollectionUtility->Collection().CommandL( *cmd ); |
|
449 |
|
450 CleanupStack::PopAndDestroy( cmd ); |
|
451 CleanupStack::PopAndDestroy( updatedMedia ); |
|
452 } |
|
453 } |
|
454 |
|
455 // ----------------------------------------------------------------------------- |
|
456 // CVcxHgMyVideosCollectionClient::GetLatestFetchedMpxMediaL() |
|
457 // ----------------------------------------------------------------------------- |
|
458 // |
|
459 CMPXMedia* CVcxHgMyVideosCollectionClient::GetLatestFetchedMpxMediaL() |
|
460 { |
|
461 return iLatestMpxMedia; |
|
462 } |
|
463 |
|
464 // ----------------------------------------------------------------------------- |
|
465 // CVcxHgMyVideosCollectionClient::FetchMpxMediaByMpxIdL() |
|
466 // ----------------------------------------------------------------------------- |
|
467 // |
|
468 void CVcxHgMyVideosCollectionClient::FetchMpxMediaByMpxIdL( TMPXItemId& aMpxId ) |
|
469 { |
|
470 if ( ! iDownloadClient->HasPendingCommand() ) |
|
471 { |
|
472 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
473 CleanupStack::PushL( cmd ); |
|
474 |
|
475 cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos ); |
|
476 cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosGetMediasByMpxId ); |
|
477 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, |
|
478 TUid::Uid( KVcxUidMyVideosMpxCollection ) ); |
|
479 cmd->SetTObjectValueL( KVcxMediaMyVideosTransactionId, KVcxHgMyVideosTransactionId ); |
|
480 CMPXMediaArray* idMediaArray = CMPXMediaArray::NewL(); |
|
481 CleanupStack::PushL( idMediaArray ); |
|
482 CMPXMedia* media = CMPXMedia::NewL(); |
|
483 CleanupStack::PushL( media ); |
|
484 media->SetTObjectValueL( KMPXMessageMediaGeneralId, aMpxId ); |
|
485 idMediaArray->AppendL( *media ); |
|
486 CleanupStack::PopAndDestroy( media ); |
|
487 cmd->SetCObjectValueL<CMPXMediaArray>( KMPXMediaArrayContents, idMediaArray ); |
|
488 cmd->SetTObjectValueL( KMPXMediaArrayCount, idMediaArray->Count() ); |
|
489 |
|
490 iCollectionUtility->Collection().CommandL( *cmd ); |
|
491 |
|
492 CleanupStack::PopAndDestroy( idMediaArray ); |
|
493 CleanupStack::PopAndDestroy( cmd ); |
|
494 } |
|
495 } |
|
496 |
|
497 // ----------------------------------------------------------------------------- |
|
498 // CVcxHgMyVideosCollectionClient::GetVideoDetailsL() |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 void CVcxHgMyVideosCollectionClient::GetVideoDetailsL( TMPXItemId& aMpxId ) |
|
502 { |
|
503 if ( ! HasPendingCommand() && ! iDownloadClient->HasPendingCommand() ) |
|
504 { |
|
505 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
506 CleanupStack::PushL( cmd ); |
|
507 |
|
508 cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos ); |
|
509 cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosGetMediaFullDetailsByMpxId ); |
|
510 cmd->SetTObjectValueL( KMPXMediaGeneralId, aMpxId ); |
|
511 |
|
512 iCollectionUtility->Collection().CommandL( *cmd ); |
|
513 iPendingCommand = EVcxHgMyVideosCollectionCommandVideoDetails_Requested; |
|
514 CleanupStack::PopAndDestroy( cmd ); |
|
515 } |
|
516 } |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CVcxHgMyVideosCollectionClient::HandleCollectionMediaL() |
|
520 // ----------------------------------------------------------------------------- |
|
521 // |
|
522 void CVcxHgMyVideosCollectionClient::HandleCollectionMediaL( |
|
523 const CMPXMedia& /*aMedia*/, |
|
524 TInt /*aError*/ ) |
|
525 { |
|
526 // No implemetation required. |
|
527 } |
|
528 |
|
529 // ----------------------------------------------------------------------------- |
|
530 // CVcxHgMyVideosCollectionClient::HandleCollectionMessage() |
|
531 // ----------------------------------------------------------------------------- |
|
532 // |
|
533 void CVcxHgMyVideosCollectionClient::HandleCollectionMessage( |
|
534 CMPXMessage* aMessage, |
|
535 TInt aError ) |
|
536 { |
|
537 TRAP_IGNORE( HandleCollectionMessageL( aMessage, aError ) ); |
|
538 } |
|
539 |
|
540 // ----------------------------------------------------------------------------- |
|
541 // CVcxHgMyVideosCollectionClient::HandleCollectionMessageL() |
|
542 // ----------------------------------------------------------------------------- |
|
543 // |
|
544 void CVcxHgMyVideosCollectionClient::HandleCollectionMessageL( |
|
545 CMPXMessage* aMessage, |
|
546 TInt aError ) |
|
547 { |
|
548 TInt myVideosCmd( KErrNotFound ); |
|
549 if ( aMessage->ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) == KVcxCommandIdMyVideos ) |
|
550 { |
|
551 myVideosCmd = aMessage->ValueTObjectL<TInt>( KVcxMediaMyVideosCommandId ); |
|
552 } |
|
553 |
|
554 if ( myVideosCmd == KVcxMessageMyVideosMessageArray ) |
|
555 { |
|
556 if ( aMessage->IsSupported( KMPXMessageArrayContents ) ) |
|
557 { |
|
558 const CMPXMessageArray* messageArray = |
|
559 aMessage->Value<CMPXMessageArray>(KMPXMessageArrayContents); |
|
560 for ( TInt i = 0; i < messageArray->Count(); i++ ) |
|
561 { |
|
562 HandleSingleCollectionMessageL( (*messageArray)[i], KErrNone ); |
|
563 } |
|
564 } |
|
565 } |
|
566 else |
|
567 { |
|
568 HandleSingleCollectionMessageL( aMessage, aError ); |
|
569 } |
|
570 } |
|
571 |
|
572 // ----------------------------------------------------------------------------- |
|
573 // CVcxHgMyVideosCollectionClient::HandleSingleCollectionMessageL() |
|
574 // ----------------------------------------------------------------------------- |
|
575 // |
|
576 void CVcxHgMyVideosCollectionClient::HandleSingleCollectionMessageL( |
|
577 CMPXMessage* aMessage, |
|
578 TInt aError ) |
|
579 { |
|
580 #ifdef _DEBUG |
|
581 if ( aMessage->IsSupported( KVcxMediaMyVideosMessageId ) ) |
|
582 { |
|
583 IPTVLOGSTRING3_LOW_LEVEL( |
|
584 "MPX My Videos UI # HandleSingleCollectionMessageL(xxx,%d) MessageId: %d", |
|
585 aError, |
|
586 static_cast<TUint32>( *( aMessage->Value<TUint32>( KVcxMediaMyVideosMessageId ) ) ) ); |
|
587 } |
|
588 else |
|
589 #endif // _DEBUG |
|
590 { |
|
591 IPTVLOGSTRING2_LOW_LEVEL( |
|
592 "MPX My Videos UI # HandleSingleCollectionMessageL(xxx,%d)", aError ); |
|
593 } |
|
594 |
|
595 if ( aMessage && aError == KErrNone ) |
|
596 { |
|
597 switch ( *( aMessage->Value<TMPXMessageId>( KMPXMessageGeneralId ) ) ) |
|
598 { |
|
599 case KVcxCommandIdMyVideos: |
|
600 { |
|
601 if ( aMessage->IsSupported( KVcxMediaMyVideosCommandId ) ) |
|
602 { |
|
603 TInt mvMsgId = *(aMessage->Value<TInt>( KVcxMediaMyVideosCommandId ) ); |
|
604 |
|
605 switch ( mvMsgId ) |
|
606 { |
|
607 case KVcxMessageMyVideosGetMediasByMpxIdResp: |
|
608 HandleGetMediasByMpxIdRespL( aMessage, aError ); |
|
609 break; |
|
610 case KVcxMessageMyVideosItemsAppended: |
|
611 HandleMyVideosItemsAppendedL( aMessage, aError ); |
|
612 break; |
|
613 case KVcxMessageMyVideosDeleteStarted: |
|
614 case KVcxMessageMyVideosDeleteResp: |
|
615 HandleMyVideosDeleteMessageL( aMessage, aError ); |
|
616 break; |
|
617 case KVcxMessageMyVideosMoveOrCopyStarted: |
|
618 case KVcxMessageMyVideosMoveResp: |
|
619 case KVcxMessageMyVideosCopyResp: |
|
620 HandleMyVideosMoveOrCopyMessageL( aMessage, aError ); |
|
621 break; |
|
622 default: |
|
623 break; |
|
624 } |
|
625 } |
|
626 } |
|
627 break; |
|
628 case KMPXMessageGeneral: |
|
629 { |
|
630 IPTVLOGSTRING_LOW_LEVEL( |
|
631 "MPX My Videos UI # KMPXMessageGeneral" ); |
|
632 |
|
633 TInt event( *(aMessage->Value<TInt>( KMPXMessageGeneralEvent )) ); |
|
634 TInt data( *(aMessage->Value<TInt>( KMPXMessageGeneralData )) ); |
|
635 |
|
636 switch ( event ) |
|
637 { |
|
638 case TMPXCollectionMessage::EPathChanged: |
|
639 { |
|
640 iCollectionLevel = KErrNotFound; |
|
641 |
|
642 if ( data == EMcContainerOpened ) |
|
643 { |
|
644 if ( iCollectionOpenStatus == EVcxHgCollectionOpening ) |
|
645 { |
|
646 iCollectionOpenStatus = EVcxHgCollectionOpened; |
|
647 } |
|
648 iCollectionUtility->Collection().OpenL(); |
|
649 } |
|
650 } |
|
651 break; |
|
652 case TMPXCollectionMessage::ECollectionChanged: |
|
653 { |
|
654 // NOP, called when My Videos collection initially opened. |
|
655 } |
|
656 break; |
|
657 case TMPXCollectionMessage::EBroadcastEvent: |
|
658 case TMPXCollectionMessage::ENoEvent: |
|
659 case TMPXCollectionMessage::EError: |
|
660 case TMPXCollectionMessage::EMediaChanged: |
|
661 case TMPXCollectionMessage::EItemChanged: |
|
662 case TMPXCollectionMessage::EFocusChanged: |
|
663 case TMPXCollectionMessage::EAsyncOpComplete: |
|
664 case TMPXCollectionMessage::EExtendedMessage: |
|
665 default: |
|
666 break; |
|
667 } |
|
668 } |
|
669 break; |
|
670 case KMPXMessageIdItemChanged: |
|
671 { |
|
672 IPTVLOGSTRING_LOW_LEVEL( |
|
673 "MPX My Videos UI # HandleSingleCollectionMessageL() KMPXMessageIdItemChanged" ); |
|
674 // Handle messages from our plugin only, this check skips also array messages (KMPXMessageArrayContents) |
|
675 if ( aMessage->IsSupported( KMPXMessageCollectionId ) ) |
|
676 { |
|
677 TUid collectionUid( *(aMessage->Value<TUid>( KMPXMessageCollectionId )) ); |
|
678 IPTVLOGSTRING2_LOW_LEVEL( |
|
679 "MPX My Videos UI # HandleMyVideosItemsChangedL() CollectionUid=%X", collectionUid.iUid ); |
|
680 if ( collectionUid.iUid == KVcxUidMyVideosMpxCollection ) |
|
681 { |
|
682 HandleMyVideosItemsChangedL( aMessage, aError ); |
|
683 } |
|
684 } |
|
685 } |
|
686 break; |
|
687 default: |
|
688 { |
|
689 IPTVLOGSTRING_LOW_LEVEL( |
|
690 "MPX My Videos UI # HandleSingleCollectionMessageL() ???" ); |
|
691 } |
|
692 break; |
|
693 } |
|
694 } |
|
695 } |
|
696 |
|
697 // ----------------------------------------------------------------------------- |
|
698 // CVcxHgMyVideosCollectionClient::HandleOpenL() |
|
699 // ----------------------------------------------------------------------------- |
|
700 // |
|
701 void CVcxHgMyVideosCollectionClient::HandleOpenL( |
|
702 const CMPXMedia& aEntries, |
|
703 TInt /*aIndex*/, |
|
704 TBool /*aComplete*/, |
|
705 TInt aError ) |
|
706 { |
|
707 IPTVLOGSTRING2_LOW_LEVEL( |
|
708 "MPX My Videos UI # HandleOpenL(aError=%d)", aError ); |
|
709 |
|
710 if ( aError == KErrNone ) |
|
711 { |
|
712 TInt levels = CollectionLevelL(); |
|
713 |
|
714 if ( levels == KVcxMpxLevelCategories ) |
|
715 { |
|
716 // Check that entry has an array of contents. |
|
717 if ( aEntries.IsSupported( KMPXMediaArrayContents ) ) |
|
718 { |
|
719 CMPXMediaArray* pointerArray = |
|
720 aEntries.Value<CMPXMediaArray>(KMPXMediaArrayContents); |
|
721 CMPXMediaArray* categoryArray = CMPXMediaArray::NewL( *pointerArray ); |
|
722 CleanupStack::PushL( categoryArray ); |
|
723 |
|
724 if ( iCategoryModelObserver ) |
|
725 { |
|
726 iCategoryModelObserver->NewCategoryListL( categoryArray ); |
|
727 CleanupStack::Pop( categoryArray ); |
|
728 } |
|
729 else |
|
730 { |
|
731 CleanupStack::PopAndDestroy( categoryArray ); |
|
732 } |
|
733 } |
|
734 } |
|
735 else if ( levels == KVcxMpxLevelVideos ) |
|
736 { |
|
737 // Check that entry has an array of contents. |
|
738 if ( aEntries.IsSupported( KMPXMediaArrayContents ) ) |
|
739 { |
|
740 CMPXMediaArray* pointerArray = |
|
741 aEntries.Value<CMPXMediaArray>(KMPXMediaArrayContents); |
|
742 CMPXMediaArray* videoArray = CMPXMediaArray::NewL( *pointerArray ); |
|
743 CleanupStack::PushL( videoArray ); |
|
744 |
|
745 #if defined(_DEBUG) && IPTV_LOGGING_METHOD != 0 |
|
746 DebugPrintVideoListL( videoArray ); |
|
747 #endif // _DEBUG && IPTV_LOGGING_METHOD |
|
748 |
|
749 if ( iVideoModelObserver ) |
|
750 { |
|
751 iVideoModelObserver->NewVideoListL( *videoArray ); |
|
752 } |
|
753 CleanupStack::PopAndDestroy( videoArray ); |
|
754 } |
|
755 } |
|
756 } |
|
757 } |
|
758 |
|
759 // ----------------------------------------------------------------------------- |
|
760 // CVcxHgMyVideosCollectionClient::HandleOpenL() |
|
761 // ----------------------------------------------------------------------------- |
|
762 // |
|
763 void CVcxHgMyVideosCollectionClient::HandleOpenL( |
|
764 const CMPXCollectionPlaylist& /*aPlaylist*/, |
|
765 TInt /*aError*/ ) |
|
766 { |
|
767 } |
|
768 |
|
769 // ----------------------------------------------------------------------------- |
|
770 // CVcxHgMyVideosCollectionClient::HandleCommandComplete() |
|
771 // ----------------------------------------------------------------------------- |
|
772 // |
|
773 void CVcxHgMyVideosCollectionClient::HandleCommandComplete( |
|
774 CMPXCommand* aCommandResult, |
|
775 TInt aError ) |
|
776 { |
|
777 IPTVLOGSTRING2_LOW_LEVEL( |
|
778 "MPX My Videos UI # HandleCommandComplete(xxx,%d)", aError ); |
|
779 |
|
780 if ( iDownloadClient->HasPendingCommand() ) |
|
781 { |
|
782 TRAP_IGNORE( iDownloadClient->CommandCompleteL( aError ) ); |
|
783 } |
|
784 else if ( HasPendingCommand() ) |
|
785 { |
|
786 // If "HandleCommandComplete" is received before our state has moved to |
|
787 // "Operation_Finished", MPX has mixed the events asynchronously. In those |
|
788 // cases we don't clear the pending command yet, but instead we mark what |
|
789 // happened and the "Operation_Finished" handler will clear the command. |
|
790 if ( iPendingCommand == EVcxHgMyVideosCollectionCommandMoveCopy_Started ) |
|
791 { |
|
792 iPendingCommand = EVcxHgMyVideosCollectionCommandMoveCopy_Finished; |
|
793 } |
|
794 else if ( iPendingCommand == EVcxHgMyVideosCollectionCommandMultiDelete_Started ) |
|
795 { |
|
796 iPendingCommand = EVcxHgMyVideosCollectionCommandMultiDelete_Finished; |
|
797 } |
|
798 else if ( iPendingCommand == EVcxHgMyVideosCollectionCommandVideoDetails_Requested ) |
|
799 { |
|
800 TRAP_IGNORE( HandleGetVideoDetailsRespL( aCommandResult, aError ) ); |
|
801 iPendingCommand = EVcxHgMyVideosCollectionCommandNone; |
|
802 } |
|
803 else if ( iPendingCommand != EVcxHgMyVideosCollectionCommandCancelDelete_Completed && |
|
804 iPendingCommand != EVcxHgMyVideosCollectionCommandCancelMoveCopy_Completed ) |
|
805 { |
|
806 iPendingCommand = EVcxHgMyVideosCollectionCommandNone; |
|
807 } |
|
808 } |
|
809 } |
|
810 |
|
811 // ----------------------------------------------------------------------------- |
|
812 // CVcxHgMyVideosCollectionClient::HandleMyVideosItemsAppendedL() |
|
813 // ----------------------------------------------------------------------------- |
|
814 // |
|
815 void CVcxHgMyVideosCollectionClient::HandleMyVideosItemsAppendedL( CMPXMessage* aMessage, |
|
816 TInt /*aError*/ ) |
|
817 { |
|
818 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # HandleMyVideosItemsAppendedL()" ); |
|
819 |
|
820 TInt levels = CollectionLevelL(); |
|
821 TBool categoryEvent( EFalse ); |
|
822 |
|
823 if ( aMessage->IsSupported( KMPXMessageGeneralId ) ) |
|
824 { |
|
825 categoryEvent = ( aMessage->Value<TMPXItemId>( KMPXMessageGeneralId )->iId2 == 1 ); |
|
826 } |
|
827 |
|
828 // Check that necessary events are not filtered out. |
|
829 |
|
830 if ( levels == KVcxMpxLevelCategories ) |
|
831 { |
|
832 if ( iCategoryModelObserver && categoryEvent ) |
|
833 { |
|
834 iCategoryModelObserver->CategoryListModifiedL(); |
|
835 } |
|
836 } |
|
837 else if ( levels == KVcxMpxLevelVideos ) |
|
838 { |
|
839 if ( iVideoModelObserver && ! categoryEvent ) |
|
840 { |
|
841 iVideoModelObserver->VideoListModifiedL(); |
|
842 } |
|
843 } |
|
844 } |
|
845 |
|
846 // ----------------------------------------------------------------------------- |
|
847 // CVcxHgMyVideosCollectionClient::HandleMyVideosItemsChangedL() |
|
848 // ----------------------------------------------------------------------------- |
|
849 // |
|
850 void CVcxHgMyVideosCollectionClient::HandleMyVideosItemsChangedL( CMPXMessage* aMessage, |
|
851 TInt /*aError*/ ) |
|
852 { |
|
853 IPTVLOGSTRING_LOW_LEVEL( |
|
854 "MPX My Videos UI # HandleMyVideosItemsChangedL()" ); |
|
855 |
|
856 TMPXChangeEventType eventType( |
|
857 *aMessage->Value<TMPXChangeEventType>( KMPXMessageChangeEventType ) ); |
|
858 TMPXItemId eventData( |
|
859 *aMessage->Value<TMPXItemId>( KMPXMessageMediaGeneralId ) ); |
|
860 |
|
861 TInt levels = CollectionLevelL(); |
|
862 TInt eventlevel( KVcxHgEventLevelVideo ); |
|
863 |
|
864 if ( eventData.iId2 == KVcxUidMyVideosMpxCollection ) |
|
865 { |
|
866 eventlevel = KVcxHgEventLevelRoot; |
|
867 } |
|
868 else if ( eventData.iId2 == 1 ) |
|
869 { |
|
870 eventlevel = KVcxHgEventLevelCategory; |
|
871 } |
|
872 else |
|
873 { |
|
874 eventlevel = KVcxHgEventLevelVideo; |
|
875 } |
|
876 |
|
877 // Check that necessary events are not filtered out. |
|
878 |
|
879 // If root level is modified, it means that MMC has been plugged / |
|
880 // unplugged. For video view the changed video list will be retrieved |
|
881 // based on change of parent category, but for category view we need |
|
882 // to re-open the list. |
|
883 if ( eventlevel == KVcxHgEventLevelRoot ) |
|
884 { |
|
885 IPTVLOGSTRING_LOW_LEVEL( |
|
886 "MPX My Videos UI # HandleMyVideosItemsChangedL() - MMC plugged/unplugged." ); |
|
887 |
|
888 // Show "Refreshing view" information note. |
|
889 HBufC* text = StringLoader::LoadLC( R_VCXHGMYVIDEOS_REFRESHING ); |
|
890 CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote(); |
|
891 note->ExecuteLD( *text ); |
|
892 CleanupStack::PopAndDestroy( text ); |
|
893 |
|
894 if ( levels == KVcxMpxLevelCategories ) |
|
895 { |
|
896 iCollectionUtility->Collection().OpenL(); |
|
897 } |
|
898 } |
|
899 else |
|
900 { |
|
901 if ( levels == KVcxMpxLevelCategories ) |
|
902 { |
|
903 if ( iCategoryModelObserver && eventlevel == KVcxHgEventLevelCategory ) |
|
904 { |
|
905 iCategoryModelObserver->CategoryModifiedL( eventType, eventData ); |
|
906 } |
|
907 } |
|
908 else if ( levels == KVcxMpxLevelVideos ) |
|
909 { |
|
910 TInt32 extraInfo( EVcxMyVideosListNoInfo ); |
|
911 if ( aMessage->IsSupported( KVcxMediaMyVideosInt32Value ) ) |
|
912 { |
|
913 extraInfo = aMessage->ValueTObjectL<TInt32>( KVcxMediaMyVideosInt32Value ); |
|
914 } |
|
915 |
|
916 if ( iVideoModelObserver && |
|
917 ( eventlevel == KVcxHgEventLevelVideo || |
|
918 extraInfo == EVcxMyVideosVideoListOrderChanged ) ) |
|
919 { |
|
920 iVideoModelObserver->VideoModifiedL( eventType, eventData, extraInfo ); |
|
921 } |
|
922 } |
|
923 } |
|
924 } |
|
925 |
|
926 // ----------------------------------------------------------------------------- |
|
927 // CVcxHgMyVideosCollectionClient::HandleMyVideosDeleteMessageL() |
|
928 // ----------------------------------------------------------------------------- |
|
929 // |
|
930 void CVcxHgMyVideosCollectionClient::HandleMyVideosDeleteMessageL( CMPXMessage* aMessage, |
|
931 TInt aError ) |
|
932 { |
|
933 IPTVLOGSTRING2_LOW_LEVEL( |
|
934 "MPX My Videos UI # HandleMyVideosDeleteMessageL() aError = %d", aError ); |
|
935 |
|
936 TInt mvMsgId( aMessage->ValueTObjectL<TInt>( KVcxMediaMyVideosCommandId ) ); |
|
937 |
|
938 // CancelDelete_Requested is used to indicate that user wanted to cancel the deletion |
|
939 // when we still hadn't received KVcxMessageMyVideosDeleteStarted message. Therefore |
|
940 // we needed to wait until now to cancel the deletion. |
|
941 if ( iPendingCommand == EVcxHgMyVideosCollectionCommandCancelDelete_Requested ) |
|
942 { |
|
943 IPTVLOGSTRING_LOW_LEVEL( |
|
944 "MPX My Videos UI # HandleMyVideosDeleteMessageL() - Cancelling." ); |
|
945 |
|
946 // Use convenient value so that CancelDeleteVideosL() will perform immediate cancel. |
|
947 iPendingCommand = EVcxHgMyVideosCollectionCommandMultiDelete_Started; |
|
948 |
|
949 CancelDeleteVideosL(); |
|
950 return; |
|
951 } |
|
952 // CancelDelete_Completed is used to indicate that cancellation of deletion is now |
|
953 // completed. Cancel never shows error notes, that's why special handling is needed. |
|
954 else if ( iPendingCommand == EVcxHgMyVideosCollectionCommandCancelDelete_Completed ) |
|
955 { |
|
956 IPTVLOGSTRING_LOW_LEVEL( |
|
957 "MPX My Videos UI # HandleMyVideosDeleteMessageL() - Cancelled." ); |
|
958 |
|
959 if ( iVideoModelObserver ) |
|
960 { |
|
961 TMPXItemId emptyMpxItemId; |
|
962 iVideoModelObserver->VideoDeletionCompletedL( 0, emptyMpxItemId ); |
|
963 } |
|
964 iPendingCommand = EVcxHgMyVideosCollectionCommandNone; |
|
965 return; |
|
966 } |
|
967 |
|
968 if ( mvMsgId == KVcxMessageMyVideosDeleteStarted ) |
|
969 { |
|
970 IPTVLOGSTRING_LOW_LEVEL( |
|
971 "MPX My Videos UI # HandleMyVideosDeleteMessageL() - Delete started." ); |
|
972 |
|
973 iPendingCommand = EVcxHgMyVideosCollectionCommandMultiDelete_Started; |
|
974 } |
|
975 else // aMessage == KVcxMessageMyVideosDeleteResp |
|
976 { |
|
977 IPTVLOGSTRING_LOW_LEVEL( |
|
978 "MPX My Videos UI # HandleMyVideosDeleteMessageL() - Delete Resp (finished)." ); |
|
979 |
|
980 // See HandleCommandComplete(). |
|
981 if ( iPendingCommand == EVcxHgMyVideosCollectionCommandMultiDelete_Finished ) |
|
982 { |
|
983 iPendingCommand = EVcxHgMyVideosCollectionCommandNone; |
|
984 } |
|
985 else |
|
986 { |
|
987 iPendingCommand = EVcxHgMyVideosCollectionCommandMultiDelete_Finished; |
|
988 } |
|
989 |
|
990 CMPXMediaArray* messageArray = aMessage->Value<CMPXMediaArray>( |
|
991 KMPXMediaArrayContents ); |
|
992 |
|
993 TInt32 failedCount( 0 ); |
|
994 TMPXItemId latestMpxItemId; |
|
995 |
|
996 for ( TInt i = 0; i < messageArray->Count(); i++ ) |
|
997 { |
|
998 if ( messageArray->AtL( i )->ValueTObjectL<TInt32>( KVcxMediaMyVideosInt32Value ) |
|
999 != KErrNone ) |
|
1000 { |
|
1001 failedCount++; |
|
1002 latestMpxItemId = |
|
1003 messageArray->AtL( i )->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
1004 } |
|
1005 else |
|
1006 { |
|
1007 if ( iVideoModelObserver ) |
|
1008 { |
|
1009 // Sending remove request to video list model. This ensures that |
|
1010 // the deleted videos has removed from a video list before the |
|
1011 // progress bar disappears. |
|
1012 TMPXItemId removedItemId = |
|
1013 messageArray->AtL( i )->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
1014 iVideoModelObserver->VideoModifiedL( |
|
1015 EMPXItemDeleted, removedItemId, EVcxMyVideosListNoInfo ); |
|
1016 } |
|
1017 } |
|
1018 } |
|
1019 |
|
1020 if ( iVideoModelObserver ) |
|
1021 { |
|
1022 iVideoModelObserver->VideoDeletionCompletedL( failedCount, latestMpxItemId ); |
|
1023 } |
|
1024 } |
|
1025 } |
|
1026 |
|
1027 // ----------------------------------------------------------------------------- |
|
1028 // CVcxHgMyVideosCollectionClient::HandleMyVideosMoveOrCopyMessageL() |
|
1029 // ----------------------------------------------------------------------------- |
|
1030 // |
|
1031 void CVcxHgMyVideosCollectionClient::HandleMyVideosMoveOrCopyMessageL( CMPXMessage* aMessage, |
|
1032 TInt aError ) |
|
1033 { |
|
1034 IPTVLOGSTRING2_LOW_LEVEL( |
|
1035 "MPX My Videos UI # HandleMyVideosMoveOrCopyMessageL() aError = %d", aError ); |
|
1036 |
|
1037 TInt mvMsgId( aMessage->ValueTObjectL<TInt>( KVcxMediaMyVideosCommandId ) ); |
|
1038 |
|
1039 if ( iPendingCommand == EVcxHgMyVideosCollectionCommandCancelMoveCopy_Requested ) |
|
1040 { |
|
1041 IPTVLOGSTRING_LOW_LEVEL( |
|
1042 "MPX My Videos UI # HandleMyVideosMoveOrCopyMessageL() - Cancelling." ); |
|
1043 iPendingCommand = EVcxHgMyVideosCollectionCommandMoveCopy_Started; |
|
1044 CancelMoveOrCopyVideosL(); |
|
1045 return; |
|
1046 } |
|
1047 else if ( iPendingCommand == EVcxHgMyVideosCollectionCommandCancelMoveCopy_Completed ) |
|
1048 { |
|
1049 IPTVLOGSTRING_LOW_LEVEL( |
|
1050 "MPX My Videos UI # HandleMyVideosMoveOrCopyMessageL() - Cancelled." ); |
|
1051 if ( iVideoModelObserver ) |
|
1052 { |
|
1053 TMPXItemId emptyMpxItemId; |
|
1054 iVideoModelObserver->VideoMoveOrCopyCompletedL( 0, emptyMpxItemId ); |
|
1055 } |
|
1056 iPendingCommand = EVcxHgMyVideosCollectionCommandNone; |
|
1057 return; |
|
1058 } |
|
1059 |
|
1060 if ( mvMsgId == KVcxMessageMyVideosMoveOrCopyStarted ) |
|
1061 { |
|
1062 IPTVLOGSTRING_LOW_LEVEL( |
|
1063 "MPX My Videos UI # HandleMyVideosMoveOrCopyMessageL() - Move/copy started." ); |
|
1064 |
|
1065 iPendingCommand = EVcxHgMyVideosCollectionCommandMoveCopy_Started; |
|
1066 } |
|
1067 else // KVcxMessageMyVideosMoveResp || KVcxMessageMyVideosCopyResp |
|
1068 { |
|
1069 IPTVLOGSTRING_LOW_LEVEL( |
|
1070 "MPX My Videos UI # HandleMyVideosMoveOrCopyMessageL() - Move/copy finished." ); |
|
1071 |
|
1072 // See HandleCommandComplete(). |
|
1073 if ( iPendingCommand == EVcxHgMyVideosCollectionCommandMoveCopy_Finished ) |
|
1074 { |
|
1075 iPendingCommand = EVcxHgMyVideosCollectionCommandNone; |
|
1076 } |
|
1077 else if ( iPendingCommand != EVcxHgMyVideosCollectionCommandNone ) |
|
1078 { |
|
1079 iPendingCommand = EVcxHgMyVideosCollectionCommandMoveCopy_Finished; |
|
1080 } |
|
1081 |
|
1082 CMPXMediaArray* messageArray = aMessage->Value<CMPXMediaArray>( |
|
1083 KMPXMediaArrayContents ); |
|
1084 |
|
1085 TInt32 failedCount( 0 ); |
|
1086 TMPXItemId latestMpxItemId; |
|
1087 |
|
1088 for ( TInt i = 0; i < messageArray->Count(); i++ ) |
|
1089 { |
|
1090 if ( messageArray->AtL( i )->ValueTObjectL<TInt32>( KVcxMediaMyVideosInt32Value ) |
|
1091 != KErrNone ) |
|
1092 { |
|
1093 failedCount++; |
|
1094 |
|
1095 latestMpxItemId = |
|
1096 messageArray->AtL( i )->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
1097 } |
|
1098 } |
|
1099 |
|
1100 if ( iVideoModelObserver ) |
|
1101 { |
|
1102 iVideoModelObserver->VideoMoveOrCopyCompletedL( failedCount, latestMpxItemId ); |
|
1103 } |
|
1104 } |
|
1105 } |
|
1106 |
|
1107 // ----------------------------------------------------------------------------- |
|
1108 // CVcxHgMyVideosCollectionClient::HandleGetMediasByMpxIdRespL() |
|
1109 // ----------------------------------------------------------------------------- |
|
1110 // |
|
1111 void CVcxHgMyVideosCollectionClient::HandleGetMediasByMpxIdRespL( CMPXMessage* aMessage, |
|
1112 TInt aError ) |
|
1113 { |
|
1114 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # HandleGetMediasByMpxIdRespL()" ); |
|
1115 |
|
1116 if ( aError == KErrNone ) |
|
1117 { |
|
1118 CMPXMedia* entries = CMPXMedia::NewL( *aMessage ); |
|
1119 CleanupStack::PushL( entries ); |
|
1120 CMPXMediaArray* array = entries->Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
1121 if ( array->Count() >= 1 ) |
|
1122 { |
|
1123 TUint32 transactionId( 0 ); |
|
1124 |
|
1125 if ( aMessage->IsSupported( KVcxMediaMyVideosTransactionId ) ) |
|
1126 { |
|
1127 transactionId = aMessage->ValueTObjectL<TUint32>( KVcxMediaMyVideosTransactionId ); |
|
1128 } |
|
1129 |
|
1130 if ( transactionId == KVcxHgMyVideosTransactionId ) |
|
1131 { |
|
1132 if ( iVideoModelObserver ) |
|
1133 { |
|
1134 CMPXMedia* media = CMPXMedia::NewL( *( ( *array )[0] ) ); |
|
1135 // Ownership is transferred. |
|
1136 iVideoModelObserver->VideoFetchingCompletedL( media ); |
|
1137 } |
|
1138 |
|
1139 delete iLatestMpxMedia; |
|
1140 iLatestMpxMedia = NULL; |
|
1141 iLatestMpxMedia = CMPXMedia::NewL( *( ( *array )[0] ) ); |
|
1142 } |
|
1143 } |
|
1144 CleanupStack::PopAndDestroy( entries ); |
|
1145 } |
|
1146 } |
|
1147 |
|
1148 // ----------------------------------------------------------------------------- |
|
1149 // CVcxHgMyVideosCollectionClient::HandleGetVideoDetailsRespL() |
|
1150 // ----------------------------------------------------------------------------- |
|
1151 // |
|
1152 void CVcxHgMyVideosCollectionClient::HandleGetVideoDetailsRespL( CMPXMessage* aMessage, |
|
1153 TInt aError ) |
|
1154 { |
|
1155 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # HandleGetVideoDetailsRespL()" ); |
|
1156 |
|
1157 CMPXMedia* media( NULL ); |
|
1158 |
|
1159 if ( aError == KErrNone && aMessage && |
|
1160 aMessage->IsSupported( KMPXCommandColAddMedia ) ) |
|
1161 { |
|
1162 media = aMessage->Value<CMPXMedia>( KMPXCommandColAddMedia ); |
|
1163 } |
|
1164 |
|
1165 if ( iVideoModelObserver && media ) |
|
1166 { |
|
1167 iVideoModelObserver->VideoDetailsCompletedL( *media ); |
|
1168 } |
|
1169 } |
|
1170 |
|
1171 #if defined(_DEBUG) && IPTV_LOGGING_METHOD != 0 |
|
1172 // ----------------------------------------------------------------------------- |
|
1173 // CVcxHgMyVideosCollectionClient::DebugPrintVideoListL() |
|
1174 // ----------------------------------------------------------------------------- |
|
1175 // |
|
1176 void CVcxHgMyVideosCollectionClient::DebugPrintVideoListL( CMPXMediaArray* aVideoArray ) |
|
1177 { |
|
1178 CMPXMedia* media = NULL; |
|
1179 IPTVLOGSTRING_LOW_LEVEL( |
|
1180 "MPX My Videos UI # --------------------------------------------------------" ); |
|
1181 for ( TInt i = 0; i < aVideoArray->Count(); i++ ) |
|
1182 { |
|
1183 media = (*aVideoArray)[i]; |
|
1184 |
|
1185 if ( media->IsSupported( KMPXMediaGeneralTitle ) && |
|
1186 media->IsSupported( KMPXMediaGeneralUri ) && |
|
1187 media->IsSupported( KMPXMediaGeneralId ) ) |
|
1188 { |
|
1189 IPTVLOGSTRING4_LOW_LEVEL( |
|
1190 "Video: %S / %S / %d", |
|
1191 &media->ValueText( KMPXMediaGeneralUri ), |
|
1192 &media->ValueText( KMPXMediaGeneralTitle ), |
|
1193 ( media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ).iId1 ); |
|
1194 } |
|
1195 } |
|
1196 IPTVLOGSTRING_LOW_LEVEL( |
|
1197 "MPX My Videos UI # --------------------------------------------------------" ); |
|
1198 } |
|
1199 #endif // _DEBUG && IPTV_LOGGING_METHOD |