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