|
1 /* |
|
2 * Copyright (c) 2006 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 "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: Implementation of Podcast Collection view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <aknlists.h> |
|
21 #include <aknViewAppUi.h> |
|
22 #include <eikmenub.h> |
|
23 #include <StringLoader.h> |
|
24 #include <aknnavilabel.h> |
|
25 #include <aknnavide.h> |
|
26 #include <eikapp.h> |
|
27 #include <AknUtils.h> |
|
28 #include <AknsUtils.h> |
|
29 #include <AknIconUtils.h> // Icon no skin |
|
30 #include <akntitle.h> |
|
31 #include <aknconsts.h> |
|
32 #include <avkon.mbg> |
|
33 #include <textresolver.h> |
|
34 #include <aknnotewrappers.h> |
|
35 #include <aknnavi.h> |
|
36 #include <hlplch.h> |
|
37 #include <bautils.h> |
|
38 #include <eikspmod.h> |
|
39 #include <eikclb.h> |
|
40 #include <avkon.hrh> |
|
41 #include <avkon.rsg> |
|
42 #include <sendui.h> |
|
43 #include <CMessageData.h> |
|
44 #include <centralrepository.h> |
|
45 #include <avkon.rsg> |
|
46 #include <eikbtgpc.h> |
|
47 #include <AknWaitDialog.h> |
|
48 #include <apgcli.h> // RApaLsSession |
|
49 #include <akncontext.h> // Context Pane |
|
50 #include <fbs.h> // CFbsBitmap |
|
51 #include <bldvariant.hrh> |
|
52 #include <coeutils.h> |
|
53 #include <AknDlgShut.h> |
|
54 #ifdef RD_MULTIPLE_DRIVE |
|
55 #include <driveinfo.h> |
|
56 #endif //RD_MULTIPLE_DRIVE |
|
57 #include <mpxuser.h> |
|
58 |
|
59 #ifdef UPNP_INCLUDED |
|
60 #include <upnpcopycommand.h> |
|
61 #endif |
|
62 #include <e32const.h> |
|
63 #include <AiwServiceHandler.h> //Copy to remote feature |
|
64 |
|
65 //#ifdef __COVER_DISPLAY |
|
66 #include <aknSDData.h> |
|
67 #include <AknMediatorFacade.h> |
|
68 #include "mplayersecondarydisplayapi.h" |
|
69 //#endif |
|
70 |
|
71 #include <mpxappui.hrh> |
|
72 #include <data_caging_path_literals.hrh> |
|
73 #include <layoutmetadata.cdl.h> |
|
74 #include <mpxplaybackframeworkdefs.h> |
|
75 #include <mpxcollectionmessage.h> |
|
76 #include <mpxviewutility.h> |
|
77 #include <mpxmusicplayerviewplugin.hrh> |
|
78 #include <mpxpodcastcollectionview.rsg> |
|
79 #include <mpxcollectionview.mbg> |
|
80 #include <mpxcollectionutility.h> |
|
81 #include <mpxplaybackutility.h> |
|
82 #include <mpxplaybackmessage.h> |
|
83 #include <mpxmedia.h> |
|
84 #include <mpxcollectionhelperfactory.h> |
|
85 #include <mpxcollectionplaylist.h> |
|
86 #include <mpxmediacontainerdefs.h> |
|
87 #include <mpxmediacollectiondetaildefs.h> |
|
88 #include <mpxmediadrmdefs.h> |
|
89 #include <mpxmediaarray.h> |
|
90 #include <mpxpodcastdefs.h> // Podcast specific |
|
91 #include <mpxmessagegeneraldefs.h> |
|
92 #include <mpxcommandgeneraldefs.h> |
|
93 #include <mpxcollectioncommanddefs.h> |
|
94 #include <mpxconstants.h> |
|
95 #include "mpxwaitnotedefs.h" |
|
96 |
|
97 #include <mpxinternalcrkeys.h> |
|
98 #include "mpxpodcastcollectionviewlistboxarray.h" |
|
99 #include "mpxcommoncontainer.hrh" |
|
100 #include "mpxcommoncontainer.h" |
|
101 #include "mpxcommonuihelper.h" |
|
102 #include "mpxpodcastcollectionviewcontainer.h" |
|
103 #include "mpxpodcastcollectionview.hrh" |
|
104 #include "mpxpodcastcollectionview.hlp.hrh" |
|
105 #include "mpxpodcastcollectionviewimp.h" |
|
106 #include "mpxlog.h" |
|
107 #include "mpxviewprivatepskeys.h" |
|
108 |
|
109 |
|
110 // CONSTANTS |
|
111 _LIT(KMPXPodcastCollectionRscPath, "mpxpodcastcollectionview.rsc"); |
|
112 |
|
113 // Nokia Podcasting Application Uid |
|
114 const TUid KNPodAppUid = { 0x1028190B }; |
|
115 |
|
116 const TInt KMilliSecondsToSeconds(1000); |
|
117 const TInt KMPXMaxBufferLength(160); |
|
118 const TInt KMPXMaxTimeLength(36); |
|
119 const TInt KMPXDurationDisplayResvLen(10); |
|
120 const TInt KPodcastCollectionMenuLevel( 2 ); |
|
121 |
|
122 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
123 const TInt KMPXLastDirectoryLevel( 2 ); |
|
124 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
125 // MACROS |
|
126 _LIT(KMPXCollDetailsItemsFormat, "%S\t%S"); |
|
127 |
|
128 const TInt KProgressBarMaxValue = 100; // Max Value for the Progress Info bar |
|
129 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
130 #define KMusicCollectionUid 0x101FFC3A |
|
131 #endif |
|
132 |
|
133 // ======== MEMBER FUNCTIONS ======== |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // Two-phased constructor. |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 CMPXPodcastCollectionViewImp* CMPXPodcastCollectionViewImp::NewL() |
|
140 { |
|
141 MPX_FUNC("CMPXPodcastCollectionViewImp::NewL"); |
|
142 CMPXPodcastCollectionViewImp* self = CMPXPodcastCollectionViewImp::NewLC(); |
|
143 CleanupStack::Pop(self); |
|
144 return self; |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // Two-phased constructor. |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 CMPXPodcastCollectionViewImp* CMPXPodcastCollectionViewImp::NewLC() |
|
152 { |
|
153 CMPXPodcastCollectionViewImp* self = new (ELeave) CMPXPodcastCollectionViewImp(); |
|
154 CleanupStack::PushL(self); |
|
155 self->ConstructL(); |
|
156 return self; |
|
157 } |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // Destructor |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 CMPXPodcastCollectionViewImp::~CMPXPodcastCollectionViewImp() |
|
164 { |
|
165 MPX_DEBUG1("CMPXPodcastCollectionViewImp::~CMPXPodcastCollectionViewImp entering"); |
|
166 |
|
167 if (iCollectionUtility) |
|
168 { |
|
169 iCollectionUtility->Close(); |
|
170 } |
|
171 |
|
172 if (iPlaybackUtility) |
|
173 { |
|
174 TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); |
|
175 iPlaybackUtility->Close(); |
|
176 } |
|
177 |
|
178 if (iViewUtility) |
|
179 { |
|
180 iViewUtility->Close(); |
|
181 } |
|
182 |
|
183 if (iCollectionUiHelper) |
|
184 { |
|
185 iCollectionUiHelper->Close(); |
|
186 } |
|
187 |
|
188 if ( iUpnpFrameworkSupport ) |
|
189 { |
|
190 MPX_DEBUG1(_L("CMPXCollectionViewImp::~CMPXCollectionViewImp Detaching 'Copy to external' menu service...")); |
|
191 if ((iServiceHandler) && |
|
192 (iCurrentlyAttachedCopyToMenuPane != KErrNotFound)) |
|
193 { |
|
194 iServiceHandler->DetachMenu(iCurrentlyAttachedCopyToMenuPane, |
|
195 R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST); |
|
196 } |
|
197 delete iServiceHandler; |
|
198 iPlayersList.Close(); |
|
199 delete iSubPlayerName; |
|
200 } |
|
201 #ifdef UPNP_INCLUDED |
|
202 if (iUpnpCopyCommand) |
|
203 { |
|
204 delete iUpnpCopyCommand; |
|
205 } |
|
206 #endif |
|
207 if (iResourceOffset) |
|
208 { |
|
209 iEikonEnv->DeleteResourceFile(iResourceOffset); |
|
210 } |
|
211 |
|
212 if (iContainer) |
|
213 { |
|
214 AppUi()->RemoveFromStack( iContainer->Common()->CoeControl() ); |
|
215 delete iContainer; |
|
216 } |
|
217 |
|
218 if (iNaviDecorator) |
|
219 { |
|
220 delete iNaviDecorator; |
|
221 } |
|
222 |
|
223 if (iMediaToSet) |
|
224 { |
|
225 delete iMediaToSet; |
|
226 } |
|
227 |
|
228 delete iCommonUiHelper; |
|
229 delete iSendUi; |
|
230 delete iTitle; |
|
231 delete iNumEpisode; |
|
232 delete iDuration; |
|
233 delete iOriginalTitle; |
|
234 delete iOriginalDuration; |
|
235 delete iBottomIndex; |
|
236 delete iCba; |
|
237 |
|
238 |
|
239 MPX_DEBUG1("CMPXPodcastCollectionViewImp::~CMPXPodcastCollectionViewImp exiting"); |
|
240 } |
|
241 |
|
242 // --------------------------------------------------------------------------- |
|
243 // Delete the selected items |
|
244 // --------------------------------------------------------------------------- |
|
245 // |
|
246 void CMPXPodcastCollectionViewImp::DeleteSelectedItemsL() |
|
247 { |
|
248 MPX_FUNC("CMPXPodcastCollectionViewImp::DeleteSelectedItemsL"); |
|
249 |
|
250 TBool isIgnore(EFalse); |
|
251 if (iContainer->Common()->CurrentListItemCount() == 0) |
|
252 { |
|
253 // list is empty |
|
254 isIgnore = ETrue; |
|
255 } |
|
256 |
|
257 if (!isIgnore) |
|
258 { |
|
259 CMPXCommonListBoxArrayBase* listboxArray = |
|
260 iContainer->Common()->ListBoxArray(); |
|
261 TInt currentIndex = iContainer->Common()->CurrentLbxItemIndex(); |
|
262 // Create a copy of collection path |
|
263 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
264 CleanupStack::PushL(path); |
|
265 CAknQueryDialog* confirmationDlg = NULL; |
|
266 HBufC* promptTxt = NULL; |
|
267 HBufC* waitNoteText = NULL; |
|
268 // TInt waitNoteCBA = R_AVKON_SOFTKEYS_EMPTY; |
|
269 |
|
270 // Marked indicies |
|
271 const CArrayFix<TInt>* array = |
|
272 iContainer->Common()->CurrentSelectionIndicesL(); |
|
273 TInt arrayCount = array->Count(); |
|
274 MPX_DEBUG2("CMPXPodcastCollectionViewImp::DeleteSelectedItemsL delete array count = %d", arrayCount); |
|
275 |
|
276 if ( arrayCount > 1 ) |
|
277 { |
|
278 waitNoteText = StringLoader::LoadLC( |
|
279 R_MPX_QTN_NMP_DEL_SONGS_WAIT_NOTE); |
|
280 promptTxt = StringLoader::LoadLC( |
|
281 R_MPX_QTN_NMP_DEL_SONGS_QUERY, |
|
282 arrayCount); |
|
283 // waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP; |
|
284 confirmationDlg = CAknQueryDialog::NewL( |
|
285 CAknQueryDialog::EConfirmationTone); |
|
286 CleanupStack::PushL(confirmationDlg); |
|
287 |
|
288 //#ifdef __COVER_DISPLAY |
|
289 confirmationDlg->PublishDialogL( |
|
290 EMPlayerQueryDeleteTracks, |
|
291 KMPlayerNoteCategory); |
|
292 CAknMediatorFacade* covercl = |
|
293 AknMediatorFacade(confirmationDlg); |
|
294 if (covercl) |
|
295 { |
|
296 covercl->BufStream().WriteInt32L(arrayCount); |
|
297 } |
|
298 //#endif //__COVER_DISPLAY |
|
299 |
|
300 for (TInt i = 0; i < arrayCount; i++) |
|
301 { |
|
302 MPX_DEBUG2("CMPXPodcastCollectionViewImp::DeleteSelectedItemsL delete array index = %d", array->At(i)); |
|
303 path->SelectL(array->At(i)); |
|
304 } |
|
305 } |
|
306 else |
|
307 { |
|
308 const CMPXMedia& media( listboxArray->MediaL( |
|
309 ( arrayCount > 0 ) ? array->At( 0 ) : currentIndex ) ); |
|
310 const TDesC& title = media.ValueText(KMPXMediaGeneralTitle); |
|
311 |
|
312 TMPXGeneralType type = EMPXNoType; |
|
313 TMPXGeneralCategory category = EMPXNoCategory; |
|
314 |
|
315 if (media.IsSupported(KMPXMediaGeneralType)) |
|
316 { |
|
317 type = |
|
318 media.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType); |
|
319 } |
|
320 if (media.IsSupported(KMPXMediaGeneralCategory)) |
|
321 { |
|
322 category = |
|
323 media.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory); |
|
324 } |
|
325 |
|
326 if (type == EMPXItem && category == EMPXPodcast) |
|
327 { |
|
328 // tracks level |
|
329 waitNoteText = StringLoader::LoadLC( |
|
330 R_MPX_QTN_ALBUM_WAITING_DELETING, title); |
|
331 promptTxt = StringLoader::LoadLC( |
|
332 R_MPX_QTN_QUERY_COMMON_CONF_DELETE, |
|
333 title); |
|
334 } |
|
335 else |
|
336 { |
|
337 waitNoteText = StringLoader::LoadLC( |
|
338 R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, title); |
|
339 // waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP; |
|
340 promptTxt = StringLoader::LoadLC( |
|
341 R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP, |
|
342 title); |
|
343 } |
|
344 confirmationDlg = CAknQueryDialog::NewL( |
|
345 CAknQueryDialog::EConfirmationTone); |
|
346 CleanupStack::PushL(confirmationDlg); |
|
347 //#ifdef __COVER_DISPLAY |
|
348 if (type == EMPXItem && category == EMPXPodcast) |
|
349 { |
|
350 // tracks level |
|
351 confirmationDlg->PublishDialogL( |
|
352 EMPlayerQueryDeleteCategory, |
|
353 KMPlayerNoteCategory); |
|
354 } |
|
355 else |
|
356 { |
|
357 confirmationDlg->PublishDialogL( |
|
358 EMPlayerQueryDeleteTrack, |
|
359 KMPlayerNoteCategory); |
|
360 } |
|
361 CAknMediatorFacade* covercl = |
|
362 AknMediatorFacade(confirmationDlg); |
|
363 if (covercl) |
|
364 { |
|
365 covercl->BufStream() << title; |
|
366 } |
|
367 //#endif //__COVER_DISPLAY |
|
368 path->Set( arrayCount > 0 ? array->At( 0 ) : currentIndex ); |
|
369 } |
|
370 confirmationDlg->SetPromptL(*promptTxt); |
|
371 CleanupStack::Pop(confirmationDlg); |
|
372 CleanupStack::PopAndDestroy(promptTxt); |
|
373 if (confirmationDlg->ExecuteLD(R_MPX_CUI_DELETE_CONFIRMATION_QUERY)) |
|
374 { |
|
375 HandleCommandL( EMPXCmdIgnoreExternalCommand ); |
|
376 StartProgressNoteL(); |
|
377 TPtr buf = waitNoteText->Des(); |
|
378 UpdateProcessL(0, buf); |
|
379 iCollectionUiHelper->DeleteL(*path, this); |
|
380 iIsDeleting = ETrue; |
|
381 |
|
382 } |
|
383 CleanupStack::PopAndDestroy(waitNoteText); |
|
384 CleanupStack::PopAndDestroy(path); |
|
385 } |
|
386 } |
|
387 |
|
388 // --------------------------------------------------------------------------- |
|
389 // C++ default constructor can NOT contain any code, that |
|
390 // might leave. |
|
391 // --------------------------------------------------------------------------- |
|
392 // |
|
393 CMPXPodcastCollectionViewImp::CMPXPodcastCollectionViewImp() |
|
394 : iMediaToSet(NULL) |
|
395 , iCurrNotYetPlayedListIndex(-1) |
|
396 #ifdef __ENABLE_MSK |
|
397 , iCurrentMskId(KErrNotFound) |
|
398 , iShowContextMenu(EFalse) |
|
399 #endif // __ENABLE_MSK |
|
400 { |
|
401 MPX_FUNC("CMPXPodcastCollectionViewImp::CMPXPodcastCollectionViewImp"); |
|
402 } |
|
403 |
|
404 // --------------------------------------------------------------------------- |
|
405 // Symbian 2nd phase constructor can leave. |
|
406 // --------------------------------------------------------------------------- |
|
407 // |
|
408 void CMPXPodcastCollectionViewImp::ConstructL() |
|
409 { |
|
410 MPX_FUNC("CMPXPodcastCollectionViewImp::ConstructL"); |
|
411 |
|
412 CCoeEnv* coeEnv( iEikonEnv ); |
|
413 TParse parse; |
|
414 parse.Set(KMPXPodcastCollectionRscPath, &KDC_APP_RESOURCE_DIR, NULL); |
|
415 TFileName resourceFile(parse.FullName()); |
|
416 User::LeaveIfError(MPXUser::CompleteWithDllPath(resourceFile)); |
|
417 BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resourceFile); |
|
418 iResourceOffset = coeEnv->AddResourceFileL(resourceFile); |
|
419 |
|
420 BaseConstructL(R_MPX_PODCAST_COLLECTION_VIEW); |
|
421 |
|
422 // Get the collection utility instance from engine. |
|
423 iCollectionUtility = MMPXCollectionUtility::NewL(this, KMcModeDefault); |
|
424 iBackOneLevel = EFalse; |
|
425 iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault ); |
|
426 iPlaybackUtility->AddObserverL( *this ); |
|
427 iViewUtility = MMPXViewUtility::UtilityL(); |
|
428 iViewUtility->AddObserverL(this); |
|
429 iBottomIndex = new (ELeave) CArrayFixFlat<TInt>(1); |
|
430 |
|
431 iCommonUiHelper = CMPXCommonUiHelper::NewL(iCollectionUtility); |
|
432 iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL(); |
|
433 |
|
434 // Monitor for view activation |
|
435 AppUi()->AddViewActivationObserverL( this ); |
|
436 #ifdef UPNP_INCLUDED |
|
437 if(!iUpnpCopyCommand) |
|
438 { |
|
439 MPX_TRAPD ( error, iUpnpCopyCommand = CUpnpCopyCommand::NewL() ); |
|
440 if ( error == KErrNone ) |
|
441 { |
|
442 iUpnpFrameworkSupport = ETrue; |
|
443 iServiceHandler = CAiwServiceHandler::NewL(); |
|
444 MPX_DEBUG1("CMPXPodcastCollectionViewImp::ConstructL() Attaching 'Copy to external' menu service..."); |
|
445 MPX_TRAP(iErrorAttachCopyMenu, iServiceHandler->AttachMenuL(R_MPX_PODCAST_COLLECTION_VIEW_MENU_1, |
|
446 R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST)); |
|
447 if ( iErrorAttachCopyMenu == KErrNotSupported ) |
|
448 { |
|
449 // when CCoeEnv is not available |
|
450 User::Leave( iErrorAttachCopyMenu ); |
|
451 } |
|
452 MPX_DEBUG2("CMPXPodcastCollectionViewImp::ConstructL(): attach Copy menu error: %d", iErrorAttachCopyMenu); |
|
453 } |
|
454 else |
|
455 { |
|
456 iUpnpFrameworkSupport = EFalse; |
|
457 iUpnpCopyCommand = NULL; |
|
458 } |
|
459 } |
|
460 #endif |
|
461 |
|
462 TUid naviPaneUid; |
|
463 naviPaneUid.iUid = EEikStatusPaneUidNavi; |
|
464 iNaviPane = |
|
465 static_cast<CAknNavigationControlContainer*> |
|
466 (iAvkonViewAppUi->StatusPane()->ControlL(naviPaneUid)); |
|
467 iNaviDecorator = iNaviPane->CreateNavigationLabelL(KNullDesC); |
|
468 //Create label to change text in Navi pane |
|
469 iNaviLabel = static_cast<CAknNaviLabel*> |
|
470 (iNaviDecorator->DecoratedControl()); |
|
471 |
|
472 TInt flags(0); |
|
473 CRepository* repository = CRepository::NewL(KCRUidMPXMPFeatures); |
|
474 repository->Get(KMPXMPLocalVariation, flags); |
|
475 delete repository; |
|
476 iChangeRTForAllProfiles = |
|
477 static_cast<TBool>(flags & KMPXChangeRTForAll); |
|
478 |
|
479 iLastDepth = 1; |
|
480 MPX_DEBUG2("CMPXPodcastCollectionViewImp::ConstructL iLastDepth = %d", iLastDepth); |
|
481 iBottomIndex->AppendL(0); |
|
482 |
|
483 #ifdef _DEBUG |
|
484 iExitOptionHidden = EFalse; |
|
485 #else // _DEBUG |
|
486 iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL(); |
|
487 #endif // _DEBUG |
|
488 |
|
489 // used to know if HandleOpen was called -> we cannot update the playback |
|
490 // status of listbox items before the list box is updated in HandleOpen |
|
491 iHandleOpenProcessed = EFalse; |
|
492 iSelectedItem = KMPXInvalidItemId; |
|
493 } |
|
494 |
|
495 // --------------------------------------------------------------------------- |
|
496 // Updates list box |
|
497 // --------------------------------------------------------------------------- |
|
498 // |
|
499 void CMPXPodcastCollectionViewImp::UpdateListBoxL( |
|
500 CMPXMedia& aEntries, |
|
501 TInt aIndex) |
|
502 { |
|
503 MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateListBox"); |
|
504 MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateListBox aIndex = %d", aIndex); |
|
505 if (iContainer) |
|
506 { |
|
507 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
508 CleanupStack::PushL(cpath); |
|
509 |
|
510 CMPXCommonListBoxArrayBase* array = |
|
511 iContainer->Common()->ListBoxArray(); |
|
512 array->ResetMediaArrayL(); |
|
513 iContainer->Common()->HandleLbxItemRemovalL(); |
|
514 |
|
515 |
|
516 array->AppendMediaL(aEntries); |
|
517 // this needs to be before HandleLbxItemAdditionL so that the items |
|
518 // are redrawn properly after playback status has been updated. |
|
519 UpdatePlaybackStatusL(EFalse); |
|
520 |
|
521 iContainer->Common()->HandleLbxItemAdditionL(); |
|
522 MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateListBox List box contains %d items", iContainer->Common()->TotalListItemCount()); |
|
523 |
|
524 // Display empty List Box string if list box is empty |
|
525 // Display different empty string if Podcast App does not exist |
|
526 HBufC* emptyText = NULL; |
|
527 if (CheckPodcastAppL() == KErrNone) |
|
528 { |
|
529 emptyText = StringLoader::LoadLC( |
|
530 R_MPX_QTN_NMP_NO_EPISODES_GO_TO_APP); |
|
531 } |
|
532 else |
|
533 { |
|
534 emptyText = StringLoader::LoadLC( |
|
535 R_MPX_QTN_NMP_NO_EPISODES); |
|
536 } |
|
537 iContainer->Common()->SetLbxEmptyTextL(*emptyText); |
|
538 CleanupStack::PopAndDestroy(emptyText); |
|
539 |
|
540 if (iBackOneLevel || iPossibleJump) |
|
541 { |
|
542 if (cpath->Levels() == (iLastDepth)) |
|
543 { |
|
544 iLastDepth--; |
|
545 TInt topIndex = iContainer->Common()->CalculateTopIndex( |
|
546 iBottomIndex->At(iLastDepth)); |
|
547 iContainer->Common()->SetLbxTopItemIndex(topIndex); |
|
548 iContainer->Common()->SetLbxCurrentItemIndexAndDraw(aIndex); |
|
549 iBottomIndex->Delete(iLastDepth); |
|
550 } |
|
551 else |
|
552 { |
|
553 MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateListBox Invalid history, rebuilding"); |
|
554 // invalid path, rebuild with all 0. possibily caused by a jump in views |
|
555 iBottomIndex->Reset(); |
|
556 iLastDepth = cpath->Levels(); |
|
557 for (TInt i = 0; i < iLastDepth; i++) |
|
558 { |
|
559 iBottomIndex->AppendL(0); |
|
560 } |
|
561 iContainer->Common()->SetLbxCurrentItemIndexAndDraw(aIndex); |
|
562 } |
|
563 iPossibleJump = EFalse; |
|
564 iBackOneLevel = EFalse; |
|
565 } |
|
566 else |
|
567 { |
|
568 if ((aIndex > 0) && |
|
569 (aIndex < iContainer->Common()->CurrentListItemCount())) |
|
570 { |
|
571 iContainer->Common()->SetLbxCurrentItemIndexAndDraw(aIndex); |
|
572 } |
|
573 else if(aIndex == 0 && |
|
574 iCurrNotYetPlayedListIndex > 0 && |
|
575 iCurrNotYetPlayedListIndex < iContainer->Common()->CurrentListItemCount()) |
|
576 { |
|
577 iContainer->Common()->SetLbxCurrentItemIndexAndDraw(iCurrNotYetPlayedListIndex); |
|
578 } |
|
579 else |
|
580 { |
|
581 if ( iSelectedItem != KMPXInvalidItemId ) |
|
582 { |
|
583 iContainer->Common()->SetLbxCurrentItemIndexAndDraw(cpath->IndexOfId(iSelectedItem)); |
|
584 } |
|
585 else |
|
586 { |
|
587 iContainer->Common()->SetLbxCurrentItemIndexAndDraw(0); |
|
588 } |
|
589 } |
|
590 iCurrNotYetPlayedListIndex = -1; |
|
591 } |
|
592 CleanupStack::PopAndDestroy(cpath); |
|
593 } |
|
594 } |
|
595 |
|
596 // --------------------------------------------------------------------------- |
|
597 // Displays error notes. |
|
598 // --------------------------------------------------------------------------- |
|
599 // |
|
600 void CMPXPodcastCollectionViewImp::HandleErrorL(TInt aError) |
|
601 { |
|
602 MPX_DEBUG2( "CMPXPodcastCollectionViewImp::HandleError(%d)", aError ); |
|
603 ASSERT( aError ); |
|
604 |
|
605 // only display error message if postcastcollection view is in the foreground |
|
606 if ( iContainer ) |
|
607 { |
|
608 TRAP_IGNORE( iCommonUiHelper->HandleErrorL( aError ) ); |
|
609 } |
|
610 } |
|
611 |
|
612 // --------------------------------------------------------------------------- |
|
613 // Updates the navi pane |
|
614 // --------------------------------------------------------------------------- |
|
615 // |
|
616 void CMPXPodcastCollectionViewImp::UpdateNaviPaneL() |
|
617 { |
|
618 MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateNaviPaneL"); |
|
619 TUid activeView = iViewUtility->ActiveViewType(); |
|
620 if (activeView == TUid::Uid(KMPXPluginTypeCollectionUid) || |
|
621 activeView == TUid::Uid(KMPXPluginTypeWaitNoteDialogUid)) // the harvester |
|
622 // might have a |
|
623 // scanning note |
|
624 // displayed |
|
625 { |
|
626 MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateNaviPaneL updating %d", iNumEpisode); |
|
627 if (iNumEpisode) |
|
628 { |
|
629 iNaviLabel->SetTextL(*iNumEpisode); |
|
630 iNaviPane->PushL(*iNaviDecorator); |
|
631 } |
|
632 else |
|
633 { |
|
634 iNaviPane->Pop(iNaviDecorator); |
|
635 } |
|
636 iNaviPane->DrawNow(); |
|
637 } |
|
638 } |
|
639 |
|
640 // --------------------------------------------------------------------------- |
|
641 // Updates the title pane |
|
642 // --------------------------------------------------------------------------- |
|
643 // |
|
644 void CMPXPodcastCollectionViewImp::UpdateTitlePaneL() |
|
645 { |
|
646 MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateTitlePaneL"); |
|
647 // Set title |
|
648 TUid activeView = iViewUtility->ActiveViewType(); |
|
649 if (activeView == TUid::Uid(KMPXPluginTypeCollectionUid)) |
|
650 { |
|
651 CAknTitlePane* title(NULL); |
|
652 |
|
653 TRAP_IGNORE( |
|
654 { |
|
655 title = static_cast<CAknTitlePane*> |
|
656 (StatusPane()->ControlL(TUid::Uid(EEikStatusPaneUidTitle))); |
|
657 }); |
|
658 |
|
659 if (title) |
|
660 { |
|
661 if (iTitle) |
|
662 { |
|
663 MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateTitlePaneL Title is %S", iTitle); |
|
664 if (iTitle->Length() == 0) |
|
665 { |
|
666 HBufC* titleText = StringLoader::LoadLC(R_MPX_QTN_NMP_UNKNOWN_TITLE); |
|
667 title->SetTextL(*titleText); |
|
668 CleanupStack::PopAndDestroy(titleText); |
|
669 } |
|
670 else |
|
671 { |
|
672 title->SetTextL(*iTitle); |
|
673 } |
|
674 } |
|
675 else |
|
676 { |
|
677 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
678 CleanupStack::PushL(cpath); |
|
679 TInt currentDepth = cpath->Levels(); |
|
680 if(currentDepth == 2) |
|
681 { |
|
682 // use default title if no metadata is available |
|
683 HBufC* titleText = StringLoader::LoadLC( |
|
684 R_MPX_PODCAST_COLLECTION_VIEW_TITLE); |
|
685 title->SetTextL(*titleText); |
|
686 CleanupStack::PopAndDestroy(titleText); |
|
687 } |
|
688 CleanupStack::PopAndDestroy(cpath); |
|
689 } // if (iTitle) |
|
690 } |
|
691 } |
|
692 } |
|
693 |
|
694 // --------------------------------------------------------------------------- |
|
695 // Updates the option menu |
|
696 // --------------------------------------------------------------------------- |
|
697 // |
|
698 void CMPXPodcastCollectionViewImp::UpdateOptionMenuL() |
|
699 { |
|
700 MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateOptionMenuL"); |
|
701 if(iContainer) |
|
702 { |
|
703 // Check collection path level and change title resource id |
|
704 CEikMenuBar* menubar = MenuBar(); |
|
705 TInt attachCopyToMenu = KErrNotFound; |
|
706 |
|
707 if ( menubar ) |
|
708 { |
|
709 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
710 CleanupStack::PushL(cpath); |
|
711 MPX_DEBUG_PATH(*cpath); |
|
712 TInt depth = cpath->Levels(); |
|
713 MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateOptionMenuL cpath depth = %d", depth); |
|
714 // root |
|
715 if ( depth == 2 ) |
|
716 { |
|
717 iContainer->Common()->EnableMarking( EFalse ); |
|
718 iContainer->SetCurrentView(EMPXTitlesView); |
|
719 menubar->SetMenuTitleResourceId(R_MPX_PODCAST_COLLECTION_TITLES_VIEW_MENUBAR); |
|
720 if ( iUpnpFrameworkSupport ) |
|
721 { |
|
722 attachCopyToMenu = R_MPX_PODCAST_COLLECTION_VIEW_MENU_1; |
|
723 } |
|
724 } |
|
725 else if ( depth == 3 ) |
|
726 { |
|
727 #ifdef SINGLE_CLICK_INCLUDED |
|
728 iContainer->Common()->EnableMarking( EFalse ); |
|
729 #else |
|
730 iContainer->Common()->EnableMarking( ETrue ); |
|
731 #endif |
|
732 iContainer->SetCurrentView(EMPXEpisodesView); |
|
733 #ifdef SINGLE_CLICK_INCLUDED |
|
734 menubar->SetMenuTitleResourceId(R_MPX_PODCAST_COLLECTION_EPISODES_VIEW_NO_MARKING); |
|
735 #else |
|
736 menubar->SetMenuTitleResourceId(R_MPX_PODCAST_COLLECTION_EPISODES_VIEW_MENUBAR); |
|
737 #endif |
|
738 if ( iUpnpFrameworkSupport ) |
|
739 { |
|
740 attachCopyToMenu = R_MPX_PODCAST_COLLECTION_VIEW_MENU_2; |
|
741 } |
|
742 } |
|
743 else // (depth > 3) |
|
744 { |
|
745 MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateOptionMenuL ERROR cpath depth > 3"); |
|
746 ASSERT(0); |
|
747 } |
|
748 CleanupStack::PopAndDestroy(cpath); |
|
749 } |
|
750 |
|
751 if ( iUpnpFrameworkSupport ) |
|
752 { |
|
753 UpdateCopyToRemoteMenu(attachCopyToMenu); |
|
754 } |
|
755 } |
|
756 else |
|
757 { |
|
758 MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateOptionMenuL NULL iContainer"); |
|
759 } |
|
760 } |
|
761 |
|
762 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
763 // --------------------------------------------------------------------------- |
|
764 // Updates the copy to remote menu attachment |
|
765 // --------------------------------------------------------------------------- |
|
766 // |
|
767 void CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu(TInt aMenuPane) |
|
768 { |
|
769 MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu"); |
|
770 MPX_DEBUG3("CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu(): aMenuPane %d, iCurrentlyAttachedCopyToMenuPane %d", aMenuPane, iCurrentlyAttachedCopyToMenuPane); |
|
771 |
|
772 if (iServiceHandler && |
|
773 (iCurrentlyAttachedCopyToMenuPane != aMenuPane)) |
|
774 { |
|
775 if (iCurrentlyAttachedCopyToMenuPane != KErrNotFound) |
|
776 { |
|
777 MPX_DEBUG1(_L("CMPXCollectionViewImp::UpdateCopyToRemoteMenu() Detaching 'Copy to external' menu service...")); |
|
778 iServiceHandler->DetachMenu(iCurrentlyAttachedCopyToMenuPane, |
|
779 R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST); |
|
780 } |
|
781 |
|
782 if (aMenuPane != KErrNotFound) |
|
783 { |
|
784 MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu() Attaching 'Copy to external' menu service..."); |
|
785 MPX_TRAP(iErrorAttachCopyMenu, iServiceHandler->AttachMenuL(aMenuPane, |
|
786 R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST)); |
|
787 if (iErrorAttachCopyMenu == KErrNone) |
|
788 { |
|
789 iCurrentlyAttachedCopyToMenuPane = aMenuPane; |
|
790 } |
|
791 else |
|
792 { |
|
793 iCurrentlyAttachedCopyToMenuPane = KErrNotFound; |
|
794 } |
|
795 MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu(): iErrorAttachCopyMenu: %d", iErrorAttachCopyMenu); |
|
796 } |
|
797 else |
|
798 { |
|
799 iCurrentlyAttachedCopyToMenuPane = aMenuPane; |
|
800 } |
|
801 } |
|
802 } |
|
803 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
804 |
|
805 // --------------------------------------------------------------------------- |
|
806 // Updates playback status indicatior |
|
807 // --------------------------------------------------------------------------- |
|
808 // |
|
809 TInt CMPXPodcastCollectionViewImp::UpdatePlaybackStatusL(TBool aStatusChangeFlag) |
|
810 { |
|
811 MPX_FUNC("CMPXPodcastCollectionViewImp::UpdatePlaybackStatusL"); |
|
812 TInt ret( KErrNotFound ); // default selection |
|
813 if ( iContainer ) |
|
814 { |
|
815 TMPXPlaybackState pbState( EPbStateNotInitialised ); |
|
816 TInt selectedIndex( KErrNotFound ); |
|
817 TMPXItemId selectedItemId( KMPXInvalidItemId ); |
|
818 CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() ); |
|
819 CleanupStack::PushL( cpath ); |
|
820 |
|
821 MMPXSource* source( iPlaybackUtility->Source() ); |
|
822 if ( source ) |
|
823 { |
|
824 CMPXCollectionPlaylist* playlist( source->PlaylistL() ); |
|
825 if ( playlist ) |
|
826 { |
|
827 CleanupStack::PushL( playlist ); |
|
828 CMPXCollectionPath* pbPath( |
|
829 CMPXCollectionPath::NewL( playlist->Path() ) ); |
|
830 CleanupStack::PushL( pbPath ); |
|
831 TInt playbackPathCount( pbPath->Levels() ); |
|
832 if ( cpath->Levels() == playbackPathCount ) |
|
833 { |
|
834 // not comparing the index |
|
835 TBool isEqual( ETrue ); |
|
836 for ( TInt i = 0; i < playbackPathCount - 1; i++ ) |
|
837 { |
|
838 if ( cpath->Id( i ) != pbPath->Id( i ) ) |
|
839 { |
|
840 isEqual = EFalse; |
|
841 break; |
|
842 } |
|
843 } |
|
844 if ( isEqual ) |
|
845 { |
|
846 selectedIndex = pbPath->Index(); |
|
847 selectedItemId = pbPath->Id(); |
|
848 ret = selectedIndex; |
|
849 pbState = iPlaybackUtility->StateL(); |
|
850 } |
|
851 } |
|
852 CleanupStack::PopAndDestroy( pbPath ); |
|
853 CleanupStack::PopAndDestroy( playlist ); |
|
854 } |
|
855 } |
|
856 CleanupStack::PopAndDestroy( cpath ); |
|
857 |
|
858 CMPXCommonListBoxArrayBase* listboxArray = |
|
859 iContainer->Common()->ListBoxArray(); |
|
860 const CMPXMedia* containerMedia = &listboxArray->ContainerMedia(); |
|
861 |
|
862 if (!containerMedia || |
|
863 !containerMedia->IsSupported(KMPXMediaPodcastCategoryGroup) || |
|
864 EMPXNotYetPlayed != containerMedia->ValueTObjectL<TMPXPodcastCategory>(KMPXMediaPodcastCategoryGroup)) |
|
865 { |
|
866 if ( iHandleOpenProcessed ) |
|
867 { |
|
868 // Might make performance worse if there are lots of episodes |
|
869 iContainer->SetPlaybackStatusByIdL( selectedItemId, pbState ); |
|
870 } |
|
871 } |
|
872 |
|
873 if (iMediaToSet && |
|
874 aStatusChangeFlag && |
|
875 (pbState == EPbStateStopped || |
|
876 pbState == EPbStateNotInitialised)) |
|
877 { |
|
878 DoSetCollectionL(iMediaToSet, EFalse ); |
|
879 delete iMediaToSet; |
|
880 iMediaToSet = NULL; |
|
881 } |
|
882 } |
|
883 return ret; |
|
884 } |
|
885 |
|
886 // --------------------------------------------------------------------------- |
|
887 // Start a Progress note |
|
888 // --------------------------------------------------------------------------- |
|
889 // |
|
890 void CMPXPodcastCollectionViewImp::StartProgressNoteL() |
|
891 { |
|
892 iProgressDialog = new (ELeave) CAknProgressDialog( |
|
893 (REINTERPRET_CAST(CEikDialog**, &iProgressDialog)), |
|
894 ETrue); |
|
895 iProgressDialog->PrepareLC(R_MPX_PROGRESS_NOTE); |
|
896 iProgressInfo = iProgressDialog->GetProgressInfoL(); |
|
897 iProgressDialog->SetCallback(this); |
|
898 iProgressDialog->RunLD(); |
|
899 iProgressInfo->SetFinalValue(KProgressBarMaxValue); |
|
900 } |
|
901 |
|
902 // --------------------------------------------------------------------------- |
|
903 // Update the Progress note |
|
904 // --------------------------------------------------------------------------- |
|
905 // |
|
906 void CMPXPodcastCollectionViewImp::UpdateProcessL(TInt aProgress,const TDesC& aProgressText) |
|
907 { |
|
908 if(iProgressDialog) |
|
909 { |
|
910 iProgressDialog->SetTextL(aProgressText); |
|
911 iProgressInfo->SetAndDraw(aProgress); |
|
912 } |
|
913 } |
|
914 |
|
915 // ----------------------------------------------------------------------------- |
|
916 // Change the button group |
|
917 // ----------------------------------------------------------------------------- |
|
918 // |
|
919 void CMPXPodcastCollectionViewImp::SetNewCbaL(TInt aResId) |
|
920 { |
|
921 MPX_FUNC("CMPXPodcastCollectionViewImp::SetNewCbaL"); |
|
922 if (!iCba) |
|
923 { |
|
924 CCoeControl* coeControl = iContainer->Common()->CoeControl(); |
|
925 iCba = CEikButtonGroupContainer::NewL( |
|
926 CEikButtonGroupContainer::ECba, |
|
927 CEikButtonGroupContainer::EHorizontal, |
|
928 this, |
|
929 aResId, *coeControl ); |
|
930 } |
|
931 else |
|
932 { |
|
933 iCba->SetCommandSetL(aResId); |
|
934 iCba->DrawDeferred(); |
|
935 } |
|
936 } |
|
937 |
|
938 // ----------------------------------------------------------------------------- |
|
939 // Display collection details |
|
940 // ----------------------------------------------------------------------------- |
|
941 // |
|
942 void CMPXPodcastCollectionViewImp::ShowCollectionDetailsL(const CMPXMedia& aMedia) |
|
943 { |
|
944 MPX_FUNC("CMPXPodcastCollectionViewImp::ShowCollectionDetailsL"); |
|
945 CAknSingleHeadingPopupMenuStyleListBox* list = |
|
946 new (ELeave) CAknSingleHeadingPopupMenuStyleListBox; |
|
947 |
|
948 CleanupStack::PushL(list); |
|
949 CAknPopupList* popupList = CAknPopupList::NewL( |
|
950 list, R_AVKON_SOFTKEYS_OK_EMPTY, |
|
951 AknPopupLayouts::EMenuGraphicHeadingWindow); |
|
952 |
|
953 CleanupStack::PushL(popupList); |
|
954 list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); |
|
955 list->CreateScrollBarFrameL(ETrue); |
|
956 list->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
957 CEikScrollBarFrame::EOff, |
|
958 CEikScrollBarFrame::EAuto); |
|
959 |
|
960 CDesCArrayFlat* dataArray = |
|
961 new (ELeave) CDesCArrayFlat(EMPXCollectionDetailsCount); |
|
962 CleanupStack::PushL(dataArray); |
|
963 |
|
964 // Enable Marquee |
|
965 static_cast<CEikFormattedCellListBox*>(list)->ItemDrawer()->ColumnData()-> |
|
966 EnableMarqueeL(ETrue); |
|
967 |
|
968 // number of items |
|
969 HBufC* dataToAppend = HBufC::NewLC(KMPXMaxBufferLength); |
|
970 TInt songsCount = 0; |
|
971 if (aMedia.IsSupported(KMPXMediaColDetailNumberOfItems)) |
|
972 { |
|
973 songsCount = aMedia.ValueTObjectL<TInt>(KMPXMediaColDetailNumberOfItems); |
|
974 } |
|
975 TPtr ptr = dataToAppend->Des(); |
|
976 ptr.AppendNum(songsCount); |
|
977 AknTextUtils::LanguageSpecificNumberConversion(ptr); |
|
978 dataArray->AppendL(ptr); |
|
979 CleanupStack::PopAndDestroy(dataToAppend); |
|
980 dataToAppend = NULL; |
|
981 |
|
982 // total duration |
|
983 TInt duration = 0; |
|
984 if (aMedia.IsSupported(KMPXMediaColDetailDuration)) |
|
985 { |
|
986 duration = aMedia.ValueTObjectL<TInt>(KMPXMediaColDetailDuration); |
|
987 } |
|
988 if (duration > 0) |
|
989 { |
|
990 dataToAppend = iCommonUiHelper->DisplayableDurationInTextL(duration/KMilliSecondsToSeconds); |
|
991 CleanupStack::PushL(dataToAppend); |
|
992 ptr.Set(dataToAppend->Des()); |
|
993 AknTextUtils::LanguageSpecificNumberConversion(ptr); |
|
994 dataArray->AppendL(ptr); |
|
995 CleanupStack::PopAndDestroy(dataToAppend); |
|
996 dataToAppend = NULL; |
|
997 } |
|
998 else |
|
999 { |
|
1000 dataArray->AppendL(KNullDesC); |
|
1001 } |
|
1002 |
|
1003 #ifdef RD_MULTIPLE_DRIVE |
|
1004 RFs& fileSession( iCoeEnv->FsSession() ); |
|
1005 TDriveList driveList; |
|
1006 TInt driveCount(0); |
|
1007 TInt64 freePhoneMemory(KErrNotFound); |
|
1008 TInt64 freeInternalMemory(KErrNotFound); |
|
1009 TInt64 freeExternalMemory(KErrNotFound); |
|
1010 TVolumeInfo volInfo; |
|
1011 |
|
1012 // Get all visible drives |
|
1013 User::LeaveIfError( DriveInfo::GetUserVisibleDrives( |
|
1014 fileSession, driveList, driveCount ) ); |
|
1015 MPX_DEBUG2 ("CMPXCollectionViewImp::ShowCollectionDetailsL - driveCount = %d", driveCount); |
|
1016 |
|
1017 for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) |
|
1018 { |
|
1019 if (driveList[driveNum]) |
|
1020 { |
|
1021 // Get the volume information |
|
1022 if ( fileSession.Volume( volInfo, driveNum ) == KErrNone ) |
|
1023 { |
|
1024 // Get the drive status |
|
1025 TUint driveStatus(0); |
|
1026 DriveInfo::GetDriveStatus( fileSession, driveNum, driveStatus ); |
|
1027 |
|
1028 // Add up free memory depending on memory location |
|
1029 if ( driveNum == EDriveC ) |
|
1030 { |
|
1031 if ( freePhoneMemory == KErrNotFound ) |
|
1032 { |
|
1033 freePhoneMemory = 0; |
|
1034 } |
|
1035 freePhoneMemory += volInfo.iFree; |
|
1036 } |
|
1037 else if ( driveStatus & DriveInfo::EDriveInternal ) |
|
1038 { |
|
1039 if ( freeInternalMemory == KErrNotFound ) |
|
1040 { |
|
1041 freeInternalMemory = 0; |
|
1042 } |
|
1043 freeInternalMemory += volInfo.iFree; |
|
1044 } |
|
1045 else if ( driveStatus & |
|
1046 (DriveInfo::EDriveRemovable | DriveInfo::EDriveRemote) ) |
|
1047 { |
|
1048 if ( freeExternalMemory == KErrNotFound ) |
|
1049 { |
|
1050 freeExternalMemory = 0; |
|
1051 } |
|
1052 freeExternalMemory += volInfo.iFree; |
|
1053 } |
|
1054 } |
|
1055 } |
|
1056 } |
|
1057 |
|
1058 // phone memory free |
|
1059 if ( freePhoneMemory != KErrNotFound ) |
|
1060 { |
|
1061 dataToAppend = iCommonUiHelper->UnitConversionL( |
|
1062 freePhoneMemory, ETrue ); |
|
1063 ptr.Set(dataToAppend->Des()); |
|
1064 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1065 } |
|
1066 else |
|
1067 { |
|
1068 dataToAppend = StringLoader::LoadL( |
|
1069 R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE ); |
|
1070 ptr.Set(dataToAppend->Des()); |
|
1071 } |
|
1072 |
|
1073 CleanupStack::PushL( dataToAppend ); |
|
1074 dataArray->AppendL( ptr ); |
|
1075 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1076 |
|
1077 // internal memory (mass storage) free |
|
1078 if ( freeInternalMemory != KErrNotFound ) |
|
1079 { |
|
1080 dataToAppend = iCommonUiHelper->UnitConversionL( |
|
1081 freeInternalMemory, ETrue ); |
|
1082 ptr.Set(dataToAppend->Des()); |
|
1083 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1084 } |
|
1085 else |
|
1086 { |
|
1087 dataToAppend = StringLoader::LoadL( |
|
1088 R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE ); |
|
1089 ptr.Set(dataToAppend->Des()); |
|
1090 } |
|
1091 |
|
1092 CleanupStack::PushL( dataToAppend ); |
|
1093 dataArray->AppendL( ptr ); |
|
1094 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1095 |
|
1096 // removable/remote (memory card) memory free |
|
1097 if ( freeExternalMemory != KErrNotFound ) |
|
1098 { |
|
1099 dataToAppend = iCommonUiHelper->UnitConversionL( |
|
1100 freeExternalMemory, ETrue ); |
|
1101 ptr.Set(dataToAppend->Des()); |
|
1102 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1103 } |
|
1104 else |
|
1105 { |
|
1106 dataToAppend = StringLoader::LoadL( |
|
1107 R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM ); |
|
1108 ptr.Set(dataToAppend->Des()); |
|
1109 } |
|
1110 CleanupStack::PushL( dataToAppend ); |
|
1111 dataArray->AppendL( ptr ); |
|
1112 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1113 #else |
|
1114 // phone memory free |
|
1115 HBufC* driveLetter = StringLoader::LoadLC(R_MPX_COLLECTION_PHONE_MEMORY_ROOT_PATH); |
|
1116 CEikonEnv* coeEnv = CEikonEnv::Static(); |
|
1117 RFs& fileSession = coeEnv->FsSession(); |
|
1118 TVolumeInfo volInfo; |
|
1119 TDriveUnit driveUnit(*driveLetter); // Get the drive |
|
1120 CleanupStack::PopAndDestroy(driveLetter); |
|
1121 driveLetter = NULL; |
|
1122 TInt err = fileSession.Volume(volInfo, (TInt)driveUnit); |
|
1123 MPX_DEBUG2("CMPXCollectionViewImp::ShowCollectionDetailsL phonemem err = %d", err); |
|
1124 if (KErrNone == err) |
|
1125 { |
|
1126 dataToAppend = iCommonUiHelper->UnitConversionL(volInfo.iFree, ETrue); |
|
1127 ptr.Set(dataToAppend->Des()); |
|
1128 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1129 } |
|
1130 else |
|
1131 { |
|
1132 dataToAppend = StringLoader::LoadL( |
|
1133 R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM); |
|
1134 ptr.Set(dataToAppend->Des()); |
|
1135 } |
|
1136 CleanupStack::PushL(dataToAppend); |
|
1137 dataArray->AppendL( ptr ); |
|
1138 CleanupStack::PopAndDestroy(dataToAppend); |
|
1139 dataToAppend = NULL; |
|
1140 |
|
1141 // memory card |
|
1142 driveLetter = StringLoader::LoadLC(R_MPX_COLLECTION_MEMORY_CARD_ROOT_PATH); |
|
1143 driveUnit = *driveLetter; // Get the drive |
|
1144 CleanupStack::PopAndDestroy(driveLetter); |
|
1145 driveLetter = NULL; |
|
1146 err = fileSession.Volume(volInfo, (TInt)driveUnit); |
|
1147 MPX_DEBUG2("CMPXPodcastCollectionViewImp::ShowCollectionDetailsL memcard err = %d", err); |
|
1148 if (err == KErrNone) |
|
1149 { |
|
1150 dataToAppend = iCommonUiHelper->UnitConversionL(volInfo.iFree, ETrue); |
|
1151 ptr.Set(dataToAppend->Des()); |
|
1152 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1153 } |
|
1154 else if (err == KErrNotReady || err == KErrCorrupt) |
|
1155 { |
|
1156 dataToAppend = StringLoader::LoadLC( |
|
1157 R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM); |
|
1158 ptr.Set(dataToAppend->Des()); |
|
1159 } |
|
1160 // else ignore |
|
1161 CleanupStack::PushL( dataToAppend ); |
|
1162 |
|
1163 dataArray->AppendL( ptr ); |
|
1164 CleanupStack::PopAndDestroy(dataToAppend); |
|
1165 dataToAppend = NULL; |
|
1166 #endif // RD_MULTIPLE_DRIVE |
|
1167 |
|
1168 // last refreshed |
|
1169 TInt64 lastRefreshed( 0 ); |
|
1170 if (aMedia.IsSupported(KMPXMediaColDetailLastRefreshed)) |
|
1171 { |
|
1172 lastRefreshed = aMedia.ValueTObjectL<TInt64>(KMPXMediaColDetailLastRefreshed); |
|
1173 } |
|
1174 TTime time(lastRefreshed); |
|
1175 dataToAppend = HBufC::NewLC( |
|
1176 KMPXMaxTimeLength + KMPXDurationDisplayResvLen); |
|
1177 HBufC* format = StringLoader::LoadLC(R_QTN_DATE_USUAL_WITH_ZERO); |
|
1178 TPtr modDatePtr = dataToAppend->Des(); |
|
1179 time.FormatL(modDatePtr, *format); |
|
1180 CleanupStack::PopAndDestroy(format); |
|
1181 format = NULL; |
|
1182 AknTextUtils::LanguageSpecificNumberConversion( modDatePtr ); |
|
1183 dataArray->AppendL(modDatePtr); |
|
1184 CleanupStack::PopAndDestroy(dataToAppend); |
|
1185 dataToAppend = NULL; |
|
1186 |
|
1187 // Retrieve heading array |
|
1188 CDesCArrayFlat* headingsArray = NULL; |
|
1189 headingsArray = iCoeEnv->ReadDesCArrayResourceL( |
|
1190 R_MPX_PODCAST_CUI_COLLECTION_DETAILS_HEADINGS); |
|
1191 CleanupStack::PushL(headingsArray); |
|
1192 |
|
1193 // Item array combines heading array and data array |
|
1194 CDesCArrayFlat* itemArray = |
|
1195 new (ELeave) CDesCArrayFlat(headingsArray->Count()); |
|
1196 CleanupStack::PushL(itemArray); |
|
1197 |
|
1198 for (TInt i = 0; i < headingsArray->Count(); i++) |
|
1199 { |
|
1200 HBufC *item = HBufC::NewLC( |
|
1201 headingsArray->MdcaPoint(i).Length() + |
|
1202 dataArray->MdcaPoint(i).Length() + |
|
1203 KMPXDurationDisplayResvLen); |
|
1204 |
|
1205 TPtrC tempPtr1 = headingsArray->MdcaPoint(i); |
|
1206 TPtrC tempPtr2 = dataArray->MdcaPoint(i); |
|
1207 |
|
1208 item->Des().Format(KMPXCollDetailsItemsFormat, |
|
1209 &tempPtr1, |
|
1210 &tempPtr2); |
|
1211 |
|
1212 itemArray->AppendL(*item); |
|
1213 CleanupStack::PopAndDestroy(item); |
|
1214 } |
|
1215 |
|
1216 CleanupStack::Pop(itemArray); |
|
1217 CleanupStack::PopAndDestroy(headingsArray); |
|
1218 CleanupStack::PopAndDestroy(dataArray); |
|
1219 |
|
1220 // Set list items |
|
1221 CTextListBoxModel* model = list->Model(); |
|
1222 model->SetOwnershipType(ELbmOwnsItemArray); |
|
1223 model->SetItemTextArray(itemArray); |
|
1224 |
|
1225 // Set title |
|
1226 HBufC* title = |
|
1227 StringLoader::LoadLC(R_MPX_QTN_NMP_TITLE_COLLECTION_DETAILS); |
|
1228 popupList->SetTitleL(*title); |
|
1229 CleanupStack::PopAndDestroy(title); |
|
1230 |
|
1231 // Show popup list |
|
1232 CleanupStack::Pop(popupList); |
|
1233 popupList->ExecuteLD(); |
|
1234 CleanupStack::PopAndDestroy(list); |
|
1235 } |
|
1236 |
|
1237 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
1238 // --------------------------------------------------------------------------- |
|
1239 // Handles Upnp menus from DynInitMenuPaneL() |
|
1240 // --------------------------------------------------------------------------- |
|
1241 // |
|
1242 void CMPXPodcastCollectionViewImp::HandleDynInitUpnpL( |
|
1243 TInt aResourceId, |
|
1244 CEikMenuPane& aMenuPane ) |
|
1245 { |
|
1246 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL()"); |
|
1247 |
|
1248 if ( !IsUpnpVisible() ) |
|
1249 { |
|
1250 GetCurrentPlayerDetails(); |
|
1251 |
|
1252 if ( iCurrentPlayerType == EPbLocal ) |
|
1253 { |
|
1254 aMenuPane.SetItemDimmed( |
|
1255 EMPXCmdUpnpPlayVia, |
|
1256 ETrue); |
|
1257 } |
|
1258 aMenuPane.SetItemDimmed( |
|
1259 EMPXCmdUPnPAiwCmdCopyToExternalCriteria, |
|
1260 ETrue); |
|
1261 } |
|
1262 else |
|
1263 { |
|
1264 MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): UPnP visible and media"); |
|
1265 TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() ); |
|
1266 |
|
1267 const CMPXMedia& media = |
|
1268 (iContainer->Common()->ListBoxArray())->MediaL( currentItem ); |
|
1269 TMPXGeneralType type( EMPXNoType ); |
|
1270 if (media.IsSupported(KMPXMediaGeneralType)) |
|
1271 { |
|
1272 type = |
|
1273 media.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType); |
|
1274 } |
|
1275 |
|
1276 if ( ( type == EMPXItem ) || |
|
1277 ( type == EMPXGroup ) ) |
|
1278 { |
|
1279 MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): folder or song"); |
|
1280 if (iErrorAttachCopyMenu != KErrNone) |
|
1281 { |
|
1282 MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): error, Dim Copy"); |
|
1283 aMenuPane.SetItemDimmed( |
|
1284 EMPXCmdUPnPAiwCmdCopyToExternalCriteria, |
|
1285 ETrue); |
|
1286 } |
|
1287 else |
|
1288 { |
|
1289 if (iServiceHandler->HandleSubmenuL(aMenuPane)) |
|
1290 { |
|
1291 return; |
|
1292 } |
|
1293 |
|
1294 if (iServiceHandler->IsAiwMenu(aResourceId)) |
|
1295 { |
|
1296 MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): Aiw menu"); |
|
1297 CAiwGenericParamList& in = iServiceHandler->InParamListL(); |
|
1298 |
|
1299 iServiceHandler->InitializeMenuPaneL(aMenuPane, aResourceId, EMPXCmdUPnPAiwCmdCopyToExternalCriteria, in); |
|
1300 MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): after InitializeMenuPaneL"); |
|
1301 } |
|
1302 } |
|
1303 } |
|
1304 else |
|
1305 { |
|
1306 aMenuPane.SetItemDimmed( |
|
1307 EMPXCmdUpnpPlayVia, |
|
1308 ETrue); |
|
1309 aMenuPane.SetItemDimmed( |
|
1310 EMPXCmdUPnPAiwCmdCopyToExternalCriteria, |
|
1311 ETrue); |
|
1312 } |
|
1313 } |
|
1314 } |
|
1315 |
|
1316 // ----------------------------------------------------------------------------- |
|
1317 // CMPXPodcastCollectionViewImp::IsUpnpVisible |
|
1318 // Checks if UPnP access point is defined |
|
1319 // ----------------------------------------------------------------------------- |
|
1320 // |
|
1321 TBool CMPXPodcastCollectionViewImp::IsUpnpVisible() |
|
1322 { |
|
1323 MPX_FUNC( "CMPXPodcastCollectionViewImp::IsUpnpVisible" ); |
|
1324 |
|
1325 TBool returnValue = EFalse; |
|
1326 #ifdef UPNP_INCLUDED |
|
1327 if ( iUpnpCopyCommand && iUpnpFrameworkSupport ) |
|
1328 { |
|
1329 returnValue = iUpnpCopyCommand->IsAvailableL(); |
|
1330 } |
|
1331 #endif |
|
1332 return returnValue; |
|
1333 |
|
1334 } |
|
1335 |
|
1336 // ----------------------------------------------------------------------------- |
|
1337 // CMPXPodcastCollectionViewImp::AddPlayersNamesToMenuL |
|
1338 // Taken from Gallery upnp support implementation |
|
1339 // ----------------------------------------------------------------------------- |
|
1340 // |
|
1341 void CMPXPodcastCollectionViewImp::AddPlayersNamesToMenuL(CEikMenuPane& aMenuPane) |
|
1342 { |
|
1343 RArray<TMPXPlaybackPlayerType> playerTypes; |
|
1344 CleanupClosePushL(playerTypes); |
|
1345 |
|
1346 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
1347 manager.GetPlayerTypesL(playerTypes); |
|
1348 |
|
1349 GetCurrentPlayerDetails(); |
|
1350 |
|
1351 TInt countPlayersTypes( playerTypes.Count() ); |
|
1352 TInt countLocalType(0); |
|
1353 TInt countRemoteType(0); |
|
1354 |
|
1355 if ( countPlayersTypes >= 1 ) |
|
1356 { |
|
1357 iPlayersList.Close(); |
|
1358 |
|
1359 for ( TInt i = 0; i < countPlayersTypes; i++ ) |
|
1360 { |
|
1361 MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] ); |
|
1362 switch (playerTypes[i]) |
|
1363 { |
|
1364 case EPbLocal: |
|
1365 { |
|
1366 // we only show 1 specific type once in the menu |
|
1367 if ( countLocalType == 0 ) |
|
1368 { |
|
1369 AddPlayerNameToMenuL( aMenuPane, |
|
1370 EMPXCmdUpnpPlayViaLocal, |
|
1371 manager, |
|
1372 playerTypes[i] ); |
|
1373 |
|
1374 countLocalType++; |
|
1375 } |
|
1376 break; |
|
1377 } |
|
1378 case EPbRemote: |
|
1379 { |
|
1380 // we only show 1 specific type once in the menu |
|
1381 if ( countRemoteType == 0 ) |
|
1382 { |
|
1383 AddPlayerNameToMenuL( aMenuPane, |
|
1384 EMPXCmdUpnpPlayViaRemotePlayer, |
|
1385 manager, |
|
1386 playerTypes[i] ); |
|
1387 countRemoteType++; |
|
1388 } |
|
1389 break; |
|
1390 } |
|
1391 default: |
|
1392 { |
|
1393 // default case is handled in the next loop, we want |
|
1394 // to add any "other" player at the end of the list |
|
1395 break; |
|
1396 } |
|
1397 } |
|
1398 } // for loop |
|
1399 |
|
1400 for ( TInt i = 0; i < countPlayersTypes; i++ ) |
|
1401 { |
|
1402 MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] ); |
|
1403 // EPbLocal and EPbRemote were already added to the |
|
1404 // submenu in the previous loop |
|
1405 if ( playerTypes[i] != EPbLocal && |
|
1406 playerTypes[i] != EPbRemote ) |
|
1407 { |
|
1408 // EPbUnknown or else |
|
1409 TBool alreadyInTheList( EFalse ); |
|
1410 |
|
1411 for ( TInt j = 0; j < i; j++) |
|
1412 { |
|
1413 // if the new playertype is already in the list |
|
1414 if ( playerTypes[i] == playerTypes[j] ) |
|
1415 { |
|
1416 alreadyInTheList = ETrue; |
|
1417 break; |
|
1418 } |
|
1419 } |
|
1420 |
|
1421 if ( !alreadyInTheList ) |
|
1422 { |
|
1423 HBufC* buf = manager.PlayerTypeDisplayNameL(playerTypes[i]); |
|
1424 |
|
1425 if ( buf ) |
|
1426 { |
|
1427 CleanupStack::PushL(buf); |
|
1428 AddPlayerNameToMenuL( aMenuPane, |
|
1429 EMPXCmdUpnpPlayViaRemotePlayer, |
|
1430 manager, |
|
1431 playerTypes[i], |
|
1432 *buf ); |
|
1433 CleanupStack::PopAndDestroy(buf); |
|
1434 } |
|
1435 // else we don't do anything. other player type is not |
|
1436 // currently supported. Implementation will be finalized |
|
1437 // when the requirement is defined. |
|
1438 } |
|
1439 } |
|
1440 } |
|
1441 } |
|
1442 |
|
1443 CleanupStack::PopAndDestroy(&playerTypes); |
|
1444 |
|
1445 if ( iPlayersList.Count() <= 1 ) |
|
1446 { |
|
1447 aMenuPane.SetItemDimmed( EMPXCmdUpnpPlayViaRemotePlayer, |
|
1448 ETrue ); |
|
1449 } |
|
1450 } |
|
1451 |
|
1452 // ----------------------------------------------------------------------------- |
|
1453 // CMPXPodcastCollectionViewImp::AddPlayerNameToMenuL |
|
1454 // Taken from Gallery upnp support implementation |
|
1455 // ----------------------------------------------------------------------------- |
|
1456 // |
|
1457 void CMPXPodcastCollectionViewImp::AddPlayerNameToMenuL(CEikMenuPane& aMenuPane, |
|
1458 TInt aCommandId, |
|
1459 MMPXPlayerManager& aPlayerManager, |
|
1460 TMPXPlaybackPlayerType& aPlayerType, |
|
1461 const TDesC& aMenuText) |
|
1462 { |
|
1463 RArray<TUid> players; |
|
1464 CleanupClosePushL(players); |
|
1465 aPlayerManager.GetPlayerListL(players, aPlayerType); |
|
1466 |
|
1467 // For now we only keep the first player we find |
|
1468 // Local player is always the first one in the list |
|
1469 // Ui spec limitation |
|
1470 MPX_DEBUG2( "players[0]: %d", players[0].iUid ); |
|
1471 if ( aCommandId == EMPXCmdUpnpPlayViaLocal ) |
|
1472 { |
|
1473 iPlayersList.Insert(players[0], 0); |
|
1474 } |
|
1475 else if ( ( aCommandId == EMPXCmdUpnpPlayViaRemotePlayer ) && |
|
1476 (iPlayersList.Count() > 1) ) |
|
1477 { |
|
1478 iPlayersList.Insert(players[0], 1); |
|
1479 } |
|
1480 else |
|
1481 { |
|
1482 iPlayersList.AppendL(players[0]); |
|
1483 } |
|
1484 CleanupStack::PopAndDestroy(&players); |
|
1485 |
|
1486 // if the player is of unknown type |
|
1487 if ( ( aCommandId != EMPXCmdUpnpPlayViaRemotePlayer ) && |
|
1488 ( aCommandId != EMPXCmdUpnpPlayViaLocal ) ) |
|
1489 { |
|
1490 CEikMenuPaneItem::SData menuItem; |
|
1491 menuItem.iText.Copy( aMenuText ); |
|
1492 menuItem.iCascadeId = 0; |
|
1493 menuItem.iFlags = EEikMenuItemRadioEnd; |
|
1494 |
|
1495 menuItem.iCommandId = aCommandId + (iPlayersList.Count() - 1); |
|
1496 aCommandId = menuItem.iCommandId; |
|
1497 |
|
1498 aMenuPane.AddMenuItemL( menuItem ); |
|
1499 } |
|
1500 |
|
1501 if ( iCurrentPlayerType == aPlayerType ) |
|
1502 { |
|
1503 aMenuPane.SetItemButtonState( aCommandId, EEikMenuItemSymbolOn ); |
|
1504 } |
|
1505 } |
|
1506 |
|
1507 // ----------------------------------------------------------------------------- |
|
1508 // CMPXPodcastCollectionViewImp::GetCurrentPlayerDetails |
|
1509 // Retrieves the current player name and type |
|
1510 // ----------------------------------------------------------------------------- |
|
1511 // |
|
1512 void CMPXPodcastCollectionViewImp::GetCurrentPlayerDetails() |
|
1513 { |
|
1514 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
1515 TUid currentlyUsedPlayer; |
|
1516 TInt currentlyUsedSubPlayer; |
|
1517 iCurrentPlayerType = EPbLocal; |
|
1518 delete iSubPlayerName; |
|
1519 iSubPlayerName = NULL; |
|
1520 TRAP_IGNORE( manager.GetSelectionL( iCurrentPlayerType, |
|
1521 currentlyUsedPlayer, |
|
1522 currentlyUsedSubPlayer, |
|
1523 iSubPlayerName)); |
|
1524 } |
|
1525 |
|
1526 // ----------------------------------------------------------------------------- |
|
1527 // CMPXPodcastCollectionViewImp::SelectNewPlayerL |
|
1528 // Selects a new player for audio playback |
|
1529 // ----------------------------------------------------------------------------- |
|
1530 // |
|
1531 void CMPXPodcastCollectionViewImp::SelectNewPlayerL(TInt aCommand) |
|
1532 { |
|
1533 MPX_FUNC("CMPXPodcastCollectionViewImp::SelectNewPlayerL()"); |
|
1534 MPX_DEBUG2("CMPXPodcastCollectionViewImp::SelectNewPlayerL(%d)", aCommand); |
|
1535 |
|
1536 TInt errorSelectPlayer( KErrCancel ); |
|
1537 |
|
1538 switch (aCommand) |
|
1539 { |
|
1540 case EMPXCmdUpnpPlayViaLocal: |
|
1541 { |
|
1542 // if Local is not already the current player, select it |
|
1543 if ( iCurrentPlayerType != EPbLocal ) |
|
1544 { |
|
1545 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
1546 MPX_TRAP( errorSelectPlayer, manager.ClearSelectPlayersL() ); |
|
1547 } |
|
1548 else // no need to reselect it but always start playback |
|
1549 { |
|
1550 errorSelectPlayer = KErrNone; |
|
1551 } |
|
1552 break; |
|
1553 } |
|
1554 default: |
|
1555 { |
|
1556 if ( aCommand >= EMPXCmdUpnpPlayViaRemotePlayer ) |
|
1557 { |
|
1558 HBufC* buf = HBufC::NewLC( KMaxUidName ); |
|
1559 buf->Des().AppendNum( |
|
1560 (iPlayersList[aCommand - |
|
1561 EMPXCmdUpnpPlayViaLocal]).iUid ); |
|
1562 |
|
1563 // ActivateViewL leaves with KErrCancel if the dialog is |
|
1564 // cancelled |
|
1565 // ActivateViewL leaves with KErrInUse if the selected player |
|
1566 // is already the active player |
|
1567 MPX_TRAP(errorSelectPlayer, iViewUtility->ActivateViewL( |
|
1568 TUid::Uid( KMPXPluginTypeUPnPBrowseDialogUid ), |
|
1569 buf )); |
|
1570 CleanupStack::PopAndDestroy( buf ); |
|
1571 } |
|
1572 break; |
|
1573 } |
|
1574 } |
|
1575 |
|
1576 GetCurrentPlayerDetails(); |
|
1577 |
|
1578 // If InUse, the player selected is already the current one, we start playback anyway |
|
1579 // contrary to Playback view |
|
1580 if ( ( errorSelectPlayer == KErrNone ) || |
|
1581 ( errorSelectPlayer == KErrInUse ) ) |
|
1582 { |
|
1583 // Starts playback by calling OpenL() for the selected track |
|
1584 CMPXCommonListBoxArrayBase* array = iContainer->Common()->ListBoxArray(); |
|
1585 if ( array ) |
|
1586 { |
|
1587 MPX_DEBUG1("CMPXPodcastCollectionViewImp::SelectNewPlayerL() before MediaL()"); |
|
1588 |
|
1589 TInt currentListBoxItemIndex( |
|
1590 iContainer->Common()->CurrentLbxItemIndex() ); |
|
1591 |
|
1592 if ( currentListBoxItemIndex >= 0 ) |
|
1593 { |
|
1594 const CMPXMedia& media = array->MediaL( currentListBoxItemIndex ); |
|
1595 |
|
1596 TMPXGeneralType type( EMPXNoType ); |
|
1597 TMPXGeneralCategory category( EMPXNoCategory ); |
|
1598 |
|
1599 if ( media.IsSupported( KMPXMediaGeneralType ) ) |
|
1600 { |
|
1601 type = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ); |
|
1602 } |
|
1603 |
|
1604 if ( media.IsSupported( KMPXMediaGeneralCategory ) ) |
|
1605 { |
|
1606 category = media.ValueTObjectL<TMPXGeneralCategory>( |
|
1607 KMPXMediaGeneralCategory ); |
|
1608 } |
|
1609 |
|
1610 // Needed to reset the status of iPreservedState |
|
1611 iPlaybackUtility->CommandL(EPbCmdResetPreserveState); |
|
1612 RArray<TMPXAttribute> attrs; |
|
1613 CleanupClosePushL(attrs); |
|
1614 // Append the signal to set IsPlaying flag |
|
1615 MPX_DEBUG2("CMPXPodcastCollectionViewImp::SelectNewPlayerL() currentIndex %d", currentListBoxItemIndex ); |
|
1616 |
|
1617 if ((type == EMPXItem) && (category == EMPXPodcast)) |
|
1618 { |
|
1619 MPX_DEBUG1("CMPXPodcastCollectionViewImp::SelectNewPlayerL() type is EMPXItem"); |
|
1620 iCollectionUtility->Collection().OpenL( currentListBoxItemIndex, attrs.Array() ); |
|
1621 } |
|
1622 else // if a folder is selected |
|
1623 { |
|
1624 MPX_DEBUG1("CMPXPodcastCollectionViewImp::SelectNewPlayerL() type is EMPXGroup"); |
|
1625 iCollectionUtility->Collection().OpenL( currentListBoxItemIndex, |
|
1626 EMPXOpenPlaylistOnly); |
|
1627 } |
|
1628 CleanupStack::PopAndDestroy(&attrs); |
|
1629 } |
|
1630 } |
|
1631 } |
|
1632 else if ( errorSelectPlayer != KErrCancel ) |
|
1633 { |
|
1634 User::LeaveIfError(errorSelectPlayer); |
|
1635 } |
|
1636 } |
|
1637 |
|
1638 // ----------------------------------------------------------------------------- |
|
1639 // CMPXPodcastCollectionViewImp::CopySelectedItemsToRemoteL |
|
1640 // Copies selected file(s) to remote player |
|
1641 // ----------------------------------------------------------------------------- |
|
1642 // |
|
1643 void CMPXPodcastCollectionViewImp::CopySelectedItemsToRemoteL() |
|
1644 { |
|
1645 MPX_FUNC("CMPXPodcastCollectionViewImp::CopySelectedItemsToRemoteL()"); |
|
1646 |
|
1647 TInt index( iContainer->Common()->CurrentLbxItemIndex() ); |
|
1648 if ( index >= 0 ) |
|
1649 { |
|
1650 CMPXCommonListBoxArrayBase* array = |
|
1651 iContainer->Common()->ListBoxArray(); |
|
1652 const CMPXMedia& media = array->MediaL( index ); |
|
1653 |
|
1654 TMPXGeneralType type( EMPXNoType ); |
|
1655 TMPXGeneralCategory category( EMPXNoCategory ); |
|
1656 |
|
1657 if ( media.IsSupported( KMPXMediaGeneralType ) ) |
|
1658 { |
|
1659 type = |
|
1660 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ); |
|
1661 } |
|
1662 if ( media.IsSupported( KMPXMediaGeneralCategory ) ) |
|
1663 { |
|
1664 category = |
|
1665 media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ); |
|
1666 } |
|
1667 |
|
1668 CMPXCollectionPath* cpath = |
|
1669 iCollectionUtility->Collection().PathL(); |
|
1670 CleanupStack::PushL( cpath ); |
|
1671 |
|
1672 if ( ( type == EMPXItem ) && ( category == EMPXPodcast ) ) |
|
1673 { |
|
1674 const CArrayFix<TInt>* arrayIndex = |
|
1675 iContainer->Common()->CurrentSelectionIndicesL(); |
|
1676 TInt arrayCount( arrayIndex->Count() ); |
|
1677 |
|
1678 cpath->ClearSelection(); |
|
1679 if ( arrayCount > 0 ) |
|
1680 { |
|
1681 for (TInt index=0; index < arrayCount; index++) |
|
1682 { |
|
1683 cpath->SelectL(arrayIndex->At(index)); |
|
1684 } |
|
1685 } |
|
1686 else |
|
1687 { |
|
1688 cpath->Set( index ); |
|
1689 } |
|
1690 |
|
1691 // Ask for the list of selected song paths: will return in HandleMedia() |
|
1692 ASSERT( iCurrentMediaLOp == EMPXOpMediaLIdle ); |
|
1693 RArray<TMPXAttribute> attrs; |
|
1694 CleanupClosePushL(attrs); |
|
1695 attrs.Append( KMPXMediaGeneralUri ); |
|
1696 iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() ); |
|
1697 iCurrentMediaLOp = EMPXOpMediaLCopyToRemote; |
|
1698 CleanupStack::PopAndDestroy( &attrs ); |
|
1699 } |
|
1700 else // if a folder is selected |
|
1701 { |
|
1702 TMPXItemId id(0); |
|
1703 if ( media.IsSupported( KMPXMediaGeneralId ) ) |
|
1704 { |
|
1705 id = media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
1706 } |
|
1707 |
|
1708 RArray<TInt> supportedIds; |
|
1709 CleanupClosePushL(supportedIds); |
|
1710 supportedIds.AppendL(KMPXMediaIdGeneral); |
|
1711 |
|
1712 CMPXMedia* entry = CMPXMedia::NewL(supportedIds.Array()); |
|
1713 CleanupStack::PushL(entry); |
|
1714 entry->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup ); |
|
1715 |
|
1716 entry->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPodcast ); |
|
1717 |
|
1718 entry->SetTObjectValueL( KMPXMediaGeneralId, id ); |
|
1719 |
|
1720 TInt depth( cpath->Levels() ); |
|
1721 // last level, we need to specify the container Id for the search |
|
1722 if(depth > KMPXLastDirectoryLevel) |
|
1723 { |
|
1724 const TMPXItemId& containerId = cpath->Id(depth-1); |
|
1725 entry->SetTObjectValueL( KMPXMediaGeneralContainerId, |
|
1726 containerId); |
|
1727 } |
|
1728 |
|
1729 RArray<TMPXAttribute> attrs; |
|
1730 CleanupClosePushL(attrs); |
|
1731 attrs.Append( KMPXMediaGeneralUri ); |
|
1732 |
|
1733 ASSERT( iCurrentFindAllLOp == EMPXOpFindAllLIdle ); |
|
1734 iCollectionUtility->Collection().FindAllL( *entry, |
|
1735 attrs.Array(), |
|
1736 *this ); |
|
1737 iCurrentFindAllLOp = EMPXOpFindAllLUpnp; |
|
1738 |
|
1739 CleanupStack::PopAndDestroy( &attrs ); |
|
1740 CleanupStack::PopAndDestroy( entry ); |
|
1741 CleanupStack::PopAndDestroy( &supportedIds ); |
|
1742 } |
|
1743 CleanupStack::PopAndDestroy( cpath ); |
|
1744 } |
|
1745 } |
|
1746 |
|
1747 // ----------------------------------------------------------------------------- |
|
1748 // CMPXPodcastCollectionViewImp::DoHandleCopyToRemoteL |
|
1749 // Handle call back from collectionframework for Copy to Remote command |
|
1750 // ----------------------------------------------------------------------------- |
|
1751 // |
|
1752 void CMPXPodcastCollectionViewImp::DoHandleCopyToRemoteL( |
|
1753 const CMPXMedia& aMedia, TBool aComplete ) |
|
1754 { |
|
1755 MPX_FUNC("CMPXPodcastCollectionViewImp::DoHandleCopyToRemoteL()"); |
|
1756 |
|
1757 CMPXMediaArray* mediaArray( NULL ); |
|
1758 TInt fileCount( 0 ); |
|
1759 |
|
1760 if ( aMedia.IsSupported( KMPXMediaArrayContents ) ) |
|
1761 { |
|
1762 mediaArray = |
|
1763 aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
1764 if ( mediaArray ) |
|
1765 { |
|
1766 fileCount = mediaArray->Count(); |
|
1767 } |
|
1768 } |
|
1769 MPX_DEBUG2("CMPXPodcastCollectionViewImp::DoHandleCopyToRemoteL Entry count = %d", fileCount); |
|
1770 |
|
1771 // Change this to Global will be needed if FindAll() is called |
|
1772 // repeatedly until aComplete is ETrue (Inc9?) |
|
1773 CAiwGenericParamList* aiwCopyInParamList = CAiwGenericParamList::NewLC(); |
|
1774 |
|
1775 // multiple files or folder |
|
1776 if ( fileCount > 0 ) |
|
1777 { |
|
1778 if ( mediaArray ) |
|
1779 { |
|
1780 for ( TInt i = 0; i < fileCount; i++ ) |
|
1781 { |
|
1782 CMPXMedia* media( mediaArray->AtL( i ) ); |
|
1783 |
|
1784 if ( media->IsSupported( KMPXMediaGeneralUri ) ) |
|
1785 { |
|
1786 const TDesC& location = |
|
1787 media->ValueText( KMPXMediaGeneralUri ); |
|
1788 MPX_DEBUG3( "CMPXPodcastCollectionViewImp::DoHandleCopyToRemote %d filePath = %S", i, &location ); |
|
1789 |
|
1790 TAiwVariant path( location ); |
|
1791 TAiwGenericParam fileParameter( EGenericParamFile, |
|
1792 path ); |
|
1793 aiwCopyInParamList->AppendL( fileParameter ); |
|
1794 } |
|
1795 } |
|
1796 } |
|
1797 } |
|
1798 else // single file |
|
1799 { |
|
1800 TMPXGeneralType type( EMPXNoType ); |
|
1801 |
|
1802 if ( aMedia.IsSupported( KMPXMediaGeneralType ) ) |
|
1803 { |
|
1804 type = aMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ); |
|
1805 } |
|
1806 |
|
1807 if ( type == EMPXItem ) |
|
1808 { |
|
1809 if ( aMedia.IsSupported( KMPXMediaGeneralUri ) ) |
|
1810 { |
|
1811 const TDesC& location = |
|
1812 aMedia.ValueText( KMPXMediaGeneralUri ); |
|
1813 TAiwVariant path( location ); |
|
1814 MPX_DEBUG2( "CMPXPodcastCollectionViewImp::DoHandleCopyToRemote filePath = %S", &location ); |
|
1815 |
|
1816 TAiwGenericParam fileParameter( EGenericParamFile, path ); |
|
1817 aiwCopyInParamList->AppendL( fileParameter ); |
|
1818 } |
|
1819 } |
|
1820 } |
|
1821 |
|
1822 if ( ( aiwCopyInParamList->Count() > 0 ) && |
|
1823 aComplete ) |
|
1824 { |
|
1825 CAiwGenericParamList* outParamList = CAiwGenericParamList::NewLC(); |
|
1826 // do not allow the copy dialog to be dismissed by external command |
|
1827 HandleCommandL( EMPXCmdIgnoreExternalCommand ); |
|
1828 iServiceHandler->ExecuteMenuCmdL( |
|
1829 EMPXCmdUPnPAiwCmdCopyToExternalCriteria, /* command id */ |
|
1830 *aiwCopyInParamList, /* in parameters */ |
|
1831 *outParamList, /* out parameters */ |
|
1832 0, /* options */ |
|
1833 NULL ); /* call back */ |
|
1834 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
1835 |
|
1836 CleanupStack::PopAndDestroy( outParamList ); |
|
1837 } |
|
1838 |
|
1839 // Clear selection |
|
1840 if( iContainer ) |
|
1841 { |
|
1842 iContainer->Common()->ClearLbxSelection(); |
|
1843 } |
|
1844 |
|
1845 CleanupStack::PopAndDestroy( aiwCopyInParamList ); |
|
1846 } |
|
1847 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
1848 |
|
1849 // ----------------------------------------------------------------------------- |
|
1850 // checks if send option should be shown the option is selected. |
|
1851 // ----------------------------------------------------------------------------- |
|
1852 // |
|
1853 TBool CMPXPodcastCollectionViewImp::SendOptionVisibilityL() |
|
1854 { |
|
1855 MPX_FUNC("CMPXPodcastCollectionViewImp::SendOptionVisibilityL"); |
|
1856 TBool isHidden( iContainer->Common()->TotalListItemCount() < 1 ); |
|
1857 |
|
1858 if ( !isHidden ) |
|
1859 { |
|
1860 CMPXCommonListBoxArrayBase* baseArray = |
|
1861 iContainer->Common()->ListBoxArray(); |
|
1862 CMPXPodcastCollectionViewListBoxArray* array = |
|
1863 static_cast<CMPXPodcastCollectionViewListBoxArray*>( baseArray ); |
|
1864 const CArrayFix<TInt>* selectedIndexArray = |
|
1865 iContainer->Common()->CurrentSelectionIndicesL(); |
|
1866 TInt selectionCount( selectedIndexArray->Count() ); |
|
1867 |
|
1868 if ( selectionCount > 0 ) |
|
1869 { |
|
1870 TBool isValid( EFalse ); |
|
1871 for ( TInt i = 0; i < selectionCount && !isValid; i++ ) |
|
1872 { |
|
1873 // multiple selection |
|
1874 // corrupted song can be sent in this case |
|
1875 isValid = !array->IsItemBrokenLinkL( |
|
1876 selectedIndexArray->At( i ) ) && |
|
1877 !array->IsItemCorruptedL( |
|
1878 selectedIndexArray->At( i ) ); |
|
1879 } |
|
1880 // if anything is valid, display the item |
|
1881 isHidden = !isValid; |
|
1882 } |
|
1883 else |
|
1884 { |
|
1885 //single selection |
|
1886 TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() ); |
|
1887 isHidden = array->IsItemBrokenLinkL( currentItem ) || |
|
1888 array->IsItemCorruptedL( currentItem ); |
|
1889 } |
|
1890 } |
|
1891 |
|
1892 return isHidden; |
|
1893 } |
|
1894 |
|
1895 // ----------------------------------------------------------------------------- |
|
1896 // Checks if file details option should be shown |
|
1897 // ----------------------------------------------------------------------------- |
|
1898 // |
|
1899 TBool CMPXPodcastCollectionViewImp::FileDetailsOptionVisibilityL() |
|
1900 { |
|
1901 MPX_FUNC( "CMPXPodcastCollectionViewImp::FileDetailsOptionVisibilityL" ); |
|
1902 TBool isHidden( iContainer->Common()->TotalListItemCount() < 1 || |
|
1903 iContainer->Common()->CurrentSelectionIndicesL()->Count() ); |
|
1904 if ( !isHidden ) |
|
1905 { |
|
1906 CMPXPodcastCollectionViewListBoxArray* array = |
|
1907 static_cast<CMPXPodcastCollectionViewListBoxArray*>( |
|
1908 iContainer->Common()->ListBoxArray() ); |
|
1909 const CMPXMedia& media = |
|
1910 array->MediaL( iContainer->Common()->CurrentLbxItemIndex() ); |
|
1911 |
|
1912 if ( media.IsSupported( KMPXMediaGeneralFlags ) ) |
|
1913 { |
|
1914 TUint flags( media.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) ); |
|
1915 if ( ( flags ) & ( KMPXMediaGeneralFlagsIsMissingDetails ) ) |
|
1916 { |
|
1917 isHidden = ETrue; |
|
1918 } |
|
1919 } |
|
1920 } |
|
1921 return isHidden; |
|
1922 } |
|
1923 // ----------------------------------------------------------------------------- |
|
1924 // Handle send command. |
|
1925 // ----------------------------------------------------------------------------- |
|
1926 // |
|
1927 void CMPXPodcastCollectionViewImp::DoSendL() |
|
1928 { |
|
1929 MPX_FUNC("CMPXPodcastCollectionViewImp::DoSendL"); |
|
1930 iCurrentMediaLOp = EMPXOpMediaLSend; |
|
1931 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
1932 CleanupStack::PushL(path); |
|
1933 |
|
1934 // Marked indicies |
|
1935 const CArrayFix<TInt>* array = |
|
1936 iContainer->Common()->CurrentSelectionIndicesL(); |
|
1937 TInt arrayCount = array->Count(); |
|
1938 MPX_DEBUG2("CMPXPodcastCollectionViewImp::DoSendL array count = %d", arrayCount); |
|
1939 if (arrayCount > 1) |
|
1940 { |
|
1941 // if more than 1 selected |
|
1942 for (TInt i = 0; i < arrayCount; i++) |
|
1943 { |
|
1944 MPX_DEBUG2("CMPXCollectionViewImp::DoSendL array index = %d", array->At(i)); |
|
1945 path->SelectL(array->At(i)); |
|
1946 } |
|
1947 } |
|
1948 else if (arrayCount == 1) |
|
1949 { |
|
1950 // if only 1 item is marked, treat it as single selection |
|
1951 path->Set(array->At(0)); |
|
1952 } |
|
1953 else |
|
1954 { |
|
1955 path->Set(iContainer->Common()->CurrentLbxItemIndex()); |
|
1956 } |
|
1957 |
|
1958 |
|
1959 RArray<TMPXAttribute> attrs; |
|
1960 CleanupClosePushL(attrs); |
|
1961 attrs.Append( |
|
1962 TMPXAttribute(KMPXMediaIdGeneral, |
|
1963 EMPXMediaGeneralUri | |
|
1964 EMPXMediaGeneralSize | |
|
1965 EMPXMediaGeneralCollectionId | |
|
1966 EMPXMediaGeneralFlags | |
|
1967 EMPXMediaGeneralId | |
|
1968 EMPXMediaGeneralType | |
|
1969 EMPXMediaGeneralCategory)); |
|
1970 iCollectionUtility->Collection().MediaL(*path, attrs.Array()); |
|
1971 CleanupStack::PopAndDestroy(&attrs); |
|
1972 CleanupStack::PopAndDestroy(path); |
|
1973 } |
|
1974 |
|
1975 |
|
1976 // ----------------------------------------------------------------------------- |
|
1977 // Handle call back from collectionframework for send command |
|
1978 // ----------------------------------------------------------------------------- |
|
1979 // |
|
1980 void CMPXPodcastCollectionViewImp::DoHandleSendL( |
|
1981 const CMPXMedia& aMedia, TInt aError) |
|
1982 { |
|
1983 MPX_FUNC("CMPXPodcastCollectionViewImp::DoHandleSendL"); |
|
1984 if (aError == KErrNone) |
|
1985 { |
|
1986 TInt invalidFileCount(0); |
|
1987 TInt corruptedFileCount(0); |
|
1988 TInt maxSize(0); |
|
1989 CMessageData* messageData = CMessageData::NewLC(); |
|
1990 |
|
1991 TInt fileCount(0); |
|
1992 if(aMedia.IsSupported(KMPXMediaArrayContents)) |
|
1993 { |
|
1994 const CMPXMediaArray* mediaArray = |
|
1995 aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents); |
|
1996 User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
1997 |
|
1998 fileCount = mediaArray->Count(); |
|
1999 } |
|
2000 MPX_DEBUG2("CMPXCollectionViewImp::DoHandleSendL Entry count = %d", fileCount); |
|
2001 |
|
2002 if (fileCount > 0) |
|
2003 { |
|
2004 const CMPXMediaArray* mediaArray = |
|
2005 aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents); |
|
2006 User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
2007 |
|
2008 for (TInt i = 0; i < fileCount; i++) |
|
2009 { |
|
2010 CMPXMedia* media( mediaArray->AtL( i ) ); |
|
2011 TUint flags = 0; |
|
2012 |
|
2013 if (aMedia.IsSupported(KMPXMediaGeneralFlags)) |
|
2014 { |
|
2015 flags = media->ValueTObjectL<TUint>(KMPXMediaGeneralFlags); |
|
2016 } |
|
2017 |
|
2018 TUint isCorrupted( ( flags ) & ( KMPXMediaGeneralFlagsIsCorrupted ) ); |
|
2019 TUint isInvalid( ( flags ) & ( KMPXMediaGeneralFlagsIsInvalid ) ); |
|
2020 const TDesC& location = media->ValueText(KMPXMediaGeneralUri); |
|
2021 |
|
2022 if (!isCorrupted && !isInvalid && ConeUtils::FileExists(location)) |
|
2023 { |
|
2024 TInt fileSize = 0; |
|
2025 if (isCorrupted) |
|
2026 { |
|
2027 corruptedFileCount++; |
|
2028 } |
|
2029 if (aMedia.IsSupported(KMPXMediaGeneralSize)) |
|
2030 { |
|
2031 fileSize = media->ValueTObjectL<TInt>(KMPXMediaGeneralSize); |
|
2032 } |
|
2033 else |
|
2034 { |
|
2035 RFs& fileSession = iCoeEnv->FsSession(); |
|
2036 TEntry pl; |
|
2037 fileSession.Entry(location, pl); |
|
2038 fileSize = pl.iSize; |
|
2039 } |
|
2040 |
|
2041 if (maxSize < fileSize) |
|
2042 { |
|
2043 maxSize = fileSize; |
|
2044 } |
|
2045 messageData->AppendAttachmentL(location); |
|
2046 } |
|
2047 else |
|
2048 { |
|
2049 UpdateDatabaseFlagL(KErrNotFound, *media, |
|
2050 KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse); |
|
2051 invalidFileCount++; |
|
2052 } |
|
2053 } |
|
2054 } |
|
2055 else |
|
2056 { |
|
2057 // single file |
|
2058 fileCount = 1; |
|
2059 TUint flags = 0; |
|
2060 |
|
2061 if (aMedia.IsSupported(KMPXMediaGeneralFlags)) |
|
2062 { |
|
2063 flags = aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags); |
|
2064 } |
|
2065 |
|
2066 TUint isCorrupted( ( flags ) & ( KMPXMediaGeneralFlagsIsCorrupted ) ); |
|
2067 TUint isInvalid( ( flags ) & ( KMPXMediaGeneralFlagsIsInvalid ) ); |
|
2068 const TDesC& location = aMedia.ValueText(KMPXMediaGeneralUri); |
|
2069 |
|
2070 if (!isInvalid && ConeUtils::FileExists(location)) |
|
2071 { |
|
2072 TInt fileSize(0); |
|
2073 if (isCorrupted) |
|
2074 { |
|
2075 corruptedFileCount++; |
|
2076 } |
|
2077 if (aMedia.IsSupported(KMPXMediaGeneralSize)) |
|
2078 { |
|
2079 fileSize = aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralSize); |
|
2080 } |
|
2081 else |
|
2082 { |
|
2083 RFs& fileSession = iCoeEnv->FsSession(); |
|
2084 TEntry pl; |
|
2085 fileSession.Entry(location, pl); |
|
2086 fileSize = pl.iSize; |
|
2087 } |
|
2088 |
|
2089 if (maxSize < fileSize) |
|
2090 { |
|
2091 maxSize = fileSize; |
|
2092 } |
|
2093 messageData->AppendAttachmentL(location); |
|
2094 } |
|
2095 else |
|
2096 { |
|
2097 UpdateDatabaseFlagL(KErrNotFound, aMedia, |
|
2098 KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse); |
|
2099 invalidFileCount++; |
|
2100 } |
|
2101 } |
|
2102 |
|
2103 TBool confirmOk = EFalse; |
|
2104 MPX_DEBUG4("CMPXCollectionViewImp::DoHandleSendL Invalid Count = %d, Corrupted Count = %d, Total Count = %d", invalidFileCount, corruptedFileCount, fileCount); |
|
2105 if (invalidFileCount || corruptedFileCount) |
|
2106 { |
|
2107 if (invalidFileCount == fileCount) |
|
2108 { |
|
2109 // all files are invalid |
|
2110 if (invalidFileCount == 1) |
|
2111 { |
|
2112 iCommonUiHelper->DisplayInfoNoteL( |
|
2113 R_MPX_COLLECTION_INFO_FILE_NOT_FOUND); |
|
2114 } |
|
2115 else |
|
2116 { |
|
2117 // Show information note if all files are invalid |
|
2118 iCommonUiHelper->DisplayInfoNoteL( |
|
2119 R_MPX_COLLECTION_SEND_ALL_INVALID_SONGS_NOTE_TXT); |
|
2120 } |
|
2121 } |
|
2122 else |
|
2123 { |
|
2124 // Show confirmation query if invalid/corrupted file found |
|
2125 HBufC* queryTxt = StringLoader::LoadLC( |
|
2126 R_MPX_COLLECTION_QUERY_SEND_INVALID_SONGS_TXT); |
|
2127 CAknQueryDialog* query = CAknQueryDialog::NewL( |
|
2128 CAknQueryDialog::EConfirmationTone); |
|
2129 //#ifdef __COVER_DISPLAY |
|
2130 CleanupStack::PushL(query); |
|
2131 query->PublishDialogL(EMPlayerNoteSendInvalidSongs, |
|
2132 KMPlayerNoteCategory); |
|
2133 CleanupStack::Pop(query); |
|
2134 //#endif //__COVER_DISPLAY |
|
2135 if (query->ExecuteLD( |
|
2136 R_MPX_COLLECTION_GENERIC_CONFIRMATION_QUERY, |
|
2137 *queryTxt)) |
|
2138 { |
|
2139 confirmOk = ETrue; |
|
2140 } |
|
2141 CleanupStack::PopAndDestroy(queryTxt); |
|
2142 } |
|
2143 } |
|
2144 |
|
2145 if ((!invalidFileCount && !corruptedFileCount) || // everything is ok |
|
2146 (invalidFileCount && confirmOk) || // invalid files exist |
|
2147 (corruptedFileCount && confirmOk)) // courrupt files exist |
|
2148 { |
|
2149 if (!iSendUi) |
|
2150 { |
|
2151 iSendUi = CSendUi::NewL(); |
|
2152 } |
|
2153 TSendingCapabilities capabilities( |
|
2154 0, |
|
2155 maxSize, |
|
2156 TSendingCapabilities::ESupportsAttachments); |
|
2157 HandleCommandL( EMPXCmdIgnoreExternalCommand ); |
|
2158 MPX_TRAPD(err, iSendUi->ShowQueryAndSendL(messageData, capabilities)); |
|
2159 if ( err != KErrNone ) |
|
2160 { |
|
2161 HandleErrorL( err ); |
|
2162 } |
|
2163 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
2164 } |
|
2165 |
|
2166 // Clear selection |
|
2167 if (iContainer) |
|
2168 { |
|
2169 iContainer->Common()->ClearLbxSelection(); |
|
2170 } |
|
2171 CleanupStack::PopAndDestroy(messageData); |
|
2172 } |
|
2173 else |
|
2174 { |
|
2175 HandleErrorL(aError); |
|
2176 } |
|
2177 } |
|
2178 |
|
2179 |
|
2180 // ----------------------------------------------------------------------------- |
|
2181 // Prepares media object for selected items |
|
2182 // ----------------------------------------------------------------------------- |
|
2183 // |
|
2184 TInt CMPXPodcastCollectionViewImp::PrepareMediaForSelectedItemsL(CMPXMedia* aMedia) |
|
2185 { |
|
2186 MPX_FUNC("CMPXPodcastCollectionViewImp::PrepareMediaForSelectedItemsL"); |
|
2187 TInt ret(KErrNone); |
|
2188 |
|
2189 if (aMedia) |
|
2190 { |
|
2191 CMPXMediaArray* mediaArray = CMPXMediaArray::NewL(); |
|
2192 CleanupStack::PushL(mediaArray); |
|
2193 const CArrayFix<TInt>* array = |
|
2194 iContainer->Common()->CurrentSelectionIndicesL(); |
|
2195 CMPXCommonListBoxArrayBase* listBoxArray = |
|
2196 iContainer->Common()->ListBoxArray(); |
|
2197 TInt count = array->Count(); |
|
2198 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
2199 CleanupStack::PushL(path); |
|
2200 TMPXItemId id = path->Id(0); |
|
2201 MPX_DEBUG2("CMPXCollectionViewImp::PrepareMediaForSelectedItemsL collection ID = 0x%x", id.iId1); |
|
2202 CleanupStack::PopAndDestroy(path); |
|
2203 if (count > 0) |
|
2204 { |
|
2205 for (TInt i = 0; i < count; i++) |
|
2206 { |
|
2207 const CMPXMedia& listBoxMedia = listBoxArray->MediaL(array->At(i)); |
|
2208 CMPXMedia* entry = CMPXMedia::NewL(); |
|
2209 CleanupStack::PushL(entry); |
|
2210 entry->SetTextValueL(KMPXMediaGeneralTitle, |
|
2211 listBoxMedia.ValueText(KMPXMediaGeneralTitle)); |
|
2212 entry->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); |
|
2213 entry->SetTObjectValueL(KMPXMediaGeneralCategory, |
|
2214 EMPXSong); |
|
2215 |
|
2216 if (listBoxMedia.IsSupported(KMPXMediaGeneralId)) |
|
2217 { |
|
2218 entry->SetTObjectValueL( |
|
2219 KMPXMediaGeneralId, |
|
2220 listBoxMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)); |
|
2221 } |
|
2222 else |
|
2223 { |
|
2224 User::Leave(KErrArgument); |
|
2225 } |
|
2226 |
|
2227 entry->SetTObjectValueL(KMPXMediaGeneralCollectionId, id); |
|
2228 |
|
2229 mediaArray->AppendL(entry); |
|
2230 CleanupStack::Pop(entry); |
|
2231 } |
|
2232 } |
|
2233 else |
|
2234 { |
|
2235 count = 1; |
|
2236 TInt currentItem = iContainer->Common()->CurrentLbxItemIndex(); |
|
2237 const CMPXMedia& listBoxMedia = listBoxArray->MediaL(currentItem); |
|
2238 CMPXMedia* entry = CMPXMedia::NewL(); |
|
2239 CleanupStack::PushL(entry); |
|
2240 entry->SetTextValueL( |
|
2241 KMPXMediaGeneralTitle, |
|
2242 listBoxMedia.ValueText( |
|
2243 KMPXMediaGeneralTitle)); |
|
2244 entry->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); |
|
2245 entry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong); |
|
2246 |
|
2247 if (listBoxMedia.IsSupported(KMPXMediaGeneralId)) |
|
2248 { |
|
2249 entry->SetTObjectValueL(KMPXMediaGeneralId, |
|
2250 listBoxMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)); |
|
2251 } |
|
2252 else |
|
2253 { |
|
2254 User::Leave(KErrArgument); |
|
2255 } |
|
2256 |
|
2257 entry->SetTObjectValueL(KMPXMediaGeneralCollectionId, id); |
|
2258 |
|
2259 mediaArray->AppendL(entry); |
|
2260 CleanupStack::Pop(entry); |
|
2261 } |
|
2262 aMedia->SetTObjectValueL(KMPXMediaGeneralCollectionId, id); |
|
2263 |
|
2264 aMedia->SetCObjectValueL(KMPXMediaArrayContents, |
|
2265 mediaArray); |
|
2266 aMedia->SetTObjectValueL(KMPXMediaArrayCount, |
|
2267 mediaArray->Count()); |
|
2268 CleanupStack::PopAndDestroy(mediaArray); |
|
2269 } |
|
2270 else |
|
2271 { |
|
2272 ret = KErrArgument; |
|
2273 } |
|
2274 return ret; |
|
2275 } |
|
2276 |
|
2277 // --------------------------------------------------------------------------- |
|
2278 // Set/clears the flags for item in database |
|
2279 // --------------------------------------------------------------------------- |
|
2280 // |
|
2281 void CMPXPodcastCollectionViewImp::UpdateDatabaseFlagL(TInt aIndex, |
|
2282 const CMPXMedia& aMedia, |
|
2283 TUint aFlag, |
|
2284 TBool aSet, |
|
2285 TBool aEnableInfoDialog) |
|
2286 { |
|
2287 MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateDatabaseFlagL"); |
|
2288 CMPXCommonListBoxArrayBase* array = iContainer->Common()->ListBoxArray(); |
|
2289 if (array) |
|
2290 { |
|
2291 // set the item as invalid |
|
2292 TUint flags(0); |
|
2293 if (aSet) |
|
2294 { |
|
2295 flags = KMPXMediaGeneralFlagsSetOrUnsetBit; |
|
2296 } |
|
2297 flags |= aFlag; |
|
2298 |
|
2299 MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateDatabaseFlagL flag after 0x%x", flags); |
|
2300 CMPXMedia* entry = CMPXMedia::NewL(); |
|
2301 CleanupStack::PushL(entry); |
|
2302 if (aIndex > KErrNotFound) |
|
2303 { |
|
2304 MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateDatabaseFlagL using aIndex = %d", aIndex); |
|
2305 const CMPXMedia& media = array->MediaL(aIndex); |
|
2306 |
|
2307 TMPXItemId id( 0 ); |
|
2308 TMPXGeneralType type( EMPXNoType ); |
|
2309 TMPXGeneralCategory category( EMPXNoCategory ); |
|
2310 |
|
2311 if (media.IsSupported(KMPXMediaGeneralId)) |
|
2312 { |
|
2313 id = media.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId); |
|
2314 } |
|
2315 |
|
2316 if (media.IsSupported(KMPXMediaGeneralType)) |
|
2317 { |
|
2318 type = |
|
2319 media.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType); |
|
2320 } |
|
2321 |
|
2322 if (media.IsSupported(KMPXMediaGeneralCategory)) |
|
2323 { |
|
2324 category = |
|
2325 media.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory); |
|
2326 } |
|
2327 |
|
2328 entry->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, id); |
|
2329 entry->SetTObjectValueL<TMPXGeneralType>( |
|
2330 KMPXMediaGeneralType, |
|
2331 type); |
|
2332 entry->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, |
|
2333 category); |
|
2334 } |
|
2335 else |
|
2336 { |
|
2337 // try to look for the info inside aMedia |
|
2338 if (aMedia.IsSupported(KMPXMediaGeneralId)) |
|
2339 { |
|
2340 TMPXItemId id( aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId) ); |
|
2341 entry->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, id); |
|
2342 } |
|
2343 if (aMedia.IsSupported(KMPXMediaGeneralType)) |
|
2344 { |
|
2345 TMPXGeneralType type( |
|
2346 aMedia.ValueTObjectL<TMPXGeneralType>( |
|
2347 KMPXMediaGeneralType) ); |
|
2348 entry->SetTObjectValueL<TMPXGeneralType>( |
|
2349 KMPXMediaGeneralType, |
|
2350 type); |
|
2351 } |
|
2352 if (aMedia.IsSupported(KMPXMediaGeneralCategory)) |
|
2353 { |
|
2354 TMPXGeneralCategory category( |
|
2355 aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory) ); |
|
2356 entry->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, |
|
2357 category); |
|
2358 } |
|
2359 } |
|
2360 |
|
2361 TUid collectionId = TUid::Uid(0); |
|
2362 if (aMedia.IsSupported(KMPXMediaGeneralCollectionId)) |
|
2363 { |
|
2364 collectionId = aMedia.ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId); |
|
2365 } |
|
2366 else |
|
2367 { |
|
2368 User::Leave(KErrArgument); |
|
2369 } |
|
2370 |
|
2371 entry->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, |
|
2372 collectionId); |
|
2373 entry->SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, flags); |
|
2374 DoSetCollectionL( entry, ETrue ); |
|
2375 CleanupStack::PopAndDestroy(entry); |
|
2376 } |
|
2377 if (aEnableInfoDialog) |
|
2378 { |
|
2379 if (KMPXMediaGeneralFlagsIsInvalid == aFlag) |
|
2380 { |
|
2381 iCommonUiHelper->DisplayInfoNoteL(R_MPX_COLLECTION_INFO_FILE_NOT_FOUND); |
|
2382 } |
|
2383 } |
|
2384 } |
|
2385 |
|
2386 // ----------------------------------------------------------------------------- |
|
2387 // Handle playback message |
|
2388 // ----------------------------------------------------------------------------- |
|
2389 // |
|
2390 void CMPXPodcastCollectionViewImp::DoHandlePlaybackMessageL( const CMPXMessage& aMessage ) |
|
2391 { |
|
2392 MPX_FUNC( "CMPXPodcastCollectionViewImp::DoHandlePlaybackMessageL" ); |
|
2393 TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) ); |
|
2394 if ( KMPXMessageGeneral == id ) |
|
2395 { |
|
2396 TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
2397 TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
2398 switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) ) |
|
2399 { |
|
2400 case TMPXPlaybackMessage::EActivePlayerChanged: |
|
2401 case TMPXPlaybackMessage::EStateChanged: |
|
2402 { |
|
2403 MPX_DEBUG2("CMPXPodcastCollectionViewImp::DoHandlePlaybackMessageL - EStateChanged(%d)", type ); |
|
2404 UpdatePlaybackStatusL(ETrue); |
|
2405 break; |
|
2406 } |
|
2407 case TMPXPlaybackMessage::EError: |
|
2408 { |
|
2409 if (iCommonUiHelper) |
|
2410 { |
|
2411 iCommonUiHelper->DismissWaitNoteL(); |
|
2412 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
2413 } |
|
2414 if (iProgressDialog) |
|
2415 { |
|
2416 iProgressDialog->ProcessFinishedL(); |
|
2417 } |
|
2418 if (iIsDeleting) |
|
2419 { |
|
2420 iCollectionUiHelper->Cancel(); |
|
2421 iIsDeleting = EFalse; |
|
2422 // if delete is interrupted, reopen |
|
2423 iCollectionUtility->Collection().OpenL(); |
|
2424 } |
|
2425 MPX_DEBUG2("CMPXCollectionViewImp::DoHandlePlaybackMessageL Error = %d", data ); |
|
2426 break; |
|
2427 } |
|
2428 case TMPXPlaybackMessage::EPlayerUnavailable: |
|
2429 { |
|
2430 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
2431 if ( iUpnpFrameworkSupport ) |
|
2432 { |
|
2433 if ( data == KErrNotFound) |
|
2434 { |
|
2435 if ( iViewUtility->ActiveViewType() == |
|
2436 TUid::Uid( KMPXPluginTypeCollectionUid ) ) |
|
2437 { |
|
2438 if ( iSubPlayerName ) |
|
2439 { |
|
2440 HBufC* dialogText = StringLoader::LoadLC( |
|
2441 R_MPX_COLLECTION_NOTE_REMOTE_CONNECTION_FAILED, |
|
2442 *iSubPlayerName); |
|
2443 CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue); |
|
2444 errNote->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
2445 errNote->ExecuteLD( *dialogText ); |
|
2446 CleanupStack::PopAndDestroy( dialogText ); |
|
2447 } |
|
2448 } |
|
2449 } |
|
2450 } |
|
2451 //#endif // __UPNP_FRAMEWORK_2_0_ |
|
2452 break; |
|
2453 } |
|
2454 default: |
|
2455 { |
|
2456 break; |
|
2457 } |
|
2458 } |
|
2459 } |
|
2460 } |
|
2461 |
|
2462 // ----------------------------------------------------------------------------- |
|
2463 // Handle collection message |
|
2464 // ----------------------------------------------------------------------------- |
|
2465 // |
|
2466 void CMPXPodcastCollectionViewImp::DoHandleCollectionMessageL( const CMPXMessage& aMessage ) |
|
2467 { |
|
2468 MPX_FUNC( "CMPXPodcastCollectionViewImp::DoHandleCollectionMessageL" ); |
|
2469 TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) ); |
|
2470 if ( KMPXMessageGeneral == id ) |
|
2471 { |
|
2472 TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) ); |
|
2473 TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
2474 TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
2475 MPX_DEBUG3( "CMPXPodcastCollectionViewImp::HandleCollectionMessage Event = %d, Type() = %d", |
|
2476 event, type ); |
|
2477 |
|
2478 // Only handle collection messages while collection view is in focus |
|
2479 // and not transitioning views |
|
2480 if( iContainer ) |
|
2481 { |
|
2482 if ( event == TMPXCollectionMessage::EPathChanged && |
|
2483 type == EMcPathChangedByOpen && |
|
2484 data == EMcContainerOpened) |
|
2485 { // Open new entries |
|
2486 iCollectionUtility->Collection().OpenL(); |
|
2487 } |
|
2488 else if ( event == TMPXCollectionMessage::EPathChanged && |
|
2489 type == EMcPathChangedByCollectionChange) |
|
2490 { |
|
2491 if(!iIsDeleting) |
|
2492 { |
|
2493 // Re-Fetch entries only if we are in playlist |
|
2494 iCollectionUtility->Collection().OpenL(); |
|
2495 } |
|
2496 } |
|
2497 else if ( event == TMPXCollectionMessage::EPathChanged && |
|
2498 type == EMcPathChangedByOpen && |
|
2499 data == EMcItemOpened) |
|
2500 { |
|
2501 // opened a song, revert back one level |
|
2502 iBackOneLevel = ETrue; |
|
2503 } |
|
2504 else if( event == TMPXCollectionMessage::EBroadcastEvent && |
|
2505 iViewUtility->ActiveViewType() != TUid::Uid(KMPXPluginTypeWaitNoteDialogUid)) |
|
2506 { |
|
2507 MPX_DEBUG2( "CMPXPodcastCollectionViewImp::DoHandleCollectionMessageL - broadcast type = %d", type ); |
|
2508 if ( type == EMcMsgDiskRemoved ) |
|
2509 { |
|
2510 AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() ); |
|
2511 } |
|
2512 } |
|
2513 #ifdef __COVER_DISPLAY |
|
2514 else if ( event == TMPXCollectionMessage::EFocusChanged ) |
|
2515 { |
|
2516 if ( data != KErrNotFound && |
|
2517 data < iContainer->Common()->CurrentListItemCount() && |
|
2518 !iIgnoreNextFocusChangedMessage ) |
|
2519 { |
|
2520 iContainer->Common()->SetLbxCurrentItemIndexAndDraw( data ); |
|
2521 } |
|
2522 iIgnoreNextFocusChangedMessage = EFalse; |
|
2523 } |
|
2524 #endif // __COVER_DISPLAY |
|
2525 // else ignore |
|
2526 } |
|
2527 } |
|
2528 } |
|
2529 |
|
2530 // ----------------------------------------------------------------------------- |
|
2531 // CMPXAlbumArtEditorDialog::DoSetCollectionL |
|
2532 // Perform a set operation |
|
2533 // ----------------------------------------------------------------------------- |
|
2534 // |
|
2535 void CMPXPodcastCollectionViewImp::DoSetCollectionL( CMPXMedia* aMedia, TBool aSync ) |
|
2536 { |
|
2537 MPX_FUNC("CMPXPodcastCollectionViewImp::DoSetCollectionL"); |
|
2538 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
2539 CleanupStack::PushL( cmd ); |
|
2540 |
|
2541 cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); |
|
2542 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, aSync ); |
|
2543 TUid colId( aMedia->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId) ); |
|
2544 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid ); |
|
2545 cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, aMedia ); |
|
2546 |
|
2547 iCollectionUtility->Collection().CommandL( *cmd ); |
|
2548 CleanupStack::PopAndDestroy( cmd ); |
|
2549 } |
|
2550 |
|
2551 #ifdef __ENABLE_MSK |
|
2552 // --------------------------------------------------------------------------- |
|
2553 // Updates the middle softkey display |
|
2554 // --------------------------------------------------------------------------- |
|
2555 // |
|
2556 void CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL(TInt aMskId) |
|
2557 { |
|
2558 MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL"); |
|
2559 if (iContainer) |
|
2560 { |
|
2561 CEikButtonGroupContainer* cba = Cba(); |
|
2562 if (cba) |
|
2563 { |
|
2564 if (!iContainer->Common()->CurrentListItemCount()) // list is empty |
|
2565 { |
|
2566 iCommonUiHelper->RemoveMiddleSoftKeyLabel(*cba); |
|
2567 MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL - remove label, list is empty"); |
|
2568 } |
|
2569 else if (iContainer->Common()->CurrentSelectionIndicesL()->Count()) // marked items |
|
2570 { |
|
2571 CFbsBitmap* bitmap = NULL; |
|
2572 CFbsBitmap* mask = NULL; |
|
2573 AknsUtils::CreateColorIconL( |
|
2574 AknsUtils::SkinInstance(), |
|
2575 KAknsIIDQgnPropMskMenu, |
|
2576 KAknsIIDQsnComponentColors, |
|
2577 EAknsCIQsnComponentColorsCG13, |
|
2578 bitmap, |
|
2579 mask, |
|
2580 AknIconUtils::AvkonIconFileName(), |
|
2581 EMbmAvkonQgn_prop_msk_menu, |
|
2582 EMbmAvkonQgn_prop_msk_menu_mask, |
|
2583 KRgbBlack); |
|
2584 |
|
2585 CleanupStack::PushL(bitmap); |
|
2586 CleanupStack::PushL(mask); |
|
2587 |
|
2588 // set middle softkey icon |
|
2589 iCommonUiHelper->SetMiddleSoftKeyIconL(*cba, bitmap, mask); |
|
2590 |
|
2591 CleanupStack::PopAndDestroy(2, bitmap); |
|
2592 MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL - items marked, show icon"); |
|
2593 } |
|
2594 else |
|
2595 { |
|
2596 iCommonUiHelper->SetMiddleSoftKeyLabelL( |
|
2597 *cba, |
|
2598 aMskId, |
|
2599 EAknSoftkeyForwardKeyEvent); |
|
2600 iCurrentMskId = aMskId; |
|
2601 MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL - new label displayed"); |
|
2602 } |
|
2603 cba->DrawDeferred(); |
|
2604 } |
|
2605 } |
|
2606 } |
|
2607 #endif // __ENABLE_MSK |
|
2608 |
|
2609 // --------------------------------------------------------------------------- |
|
2610 // From MProgressDialogCallback |
|
2611 // Callback method. Get's called when a dialog is dismissed |
|
2612 // --------------------------------------------------------------------------- |
|
2613 // |
|
2614 void CMPXPodcastCollectionViewImp::DialogDismissedL(TInt aButtonId) |
|
2615 { |
|
2616 MPX_FUNC("CMPXPodcastCollectionViewImp::DialogDismissedL"); |
|
2617 switch (aButtonId) |
|
2618 { |
|
2619 case EAknSoftkeyCancel: |
|
2620 { |
|
2621 iIsWaitNoteCanceled = ETrue; |
|
2622 if(iIsDeleting) |
|
2623 { |
|
2624 iCollectionUiHelper->Cancel(); |
|
2625 iIsDeleting = EFalse; |
|
2626 // if delete is interrupted, reopen |
|
2627 iCollectionUtility->Collection().OpenL(); |
|
2628 } |
|
2629 |
|
2630 break; |
|
2631 } |
|
2632 default: |
|
2633 { |
|
2634 break; |
|
2635 } |
|
2636 } |
|
2637 } |
|
2638 |
|
2639 // --------------------------------------------------------------------------- |
|
2640 // From MMPXCollectionObserver |
|
2641 // Handle collection message |
|
2642 // --------------------------------------------------------------------------- |
|
2643 // |
|
2644 void CMPXPodcastCollectionViewImp::HandleCollectionMessage( |
|
2645 CMPXMessage* aMessage, TInt aError ) |
|
2646 { |
|
2647 if ( aError == KErrNone && aMessage ) |
|
2648 { |
|
2649 TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) ); |
|
2650 } |
|
2651 } |
|
2652 |
|
2653 // --------------------------------------------------------------------------- |
|
2654 // From MMPXCollectionObserver |
|
2655 // Handles the collection entries being opened. Typically called |
|
2656 // when client has Open()'d a folder |
|
2657 // --------------------------------------------------------------------------- |
|
2658 // |
|
2659 void CMPXPodcastCollectionViewImp::HandleOpenL( |
|
2660 const CMPXMedia& aEntries, |
|
2661 TInt aIndex, |
|
2662 TBool /*aComplete*/, |
|
2663 TInt aError) |
|
2664 { |
|
2665 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleOpenL 4"); |
|
2666 iHandlingKeyEvent = EFalse; |
|
2667 |
|
2668 if(aError == KErrNone) |
|
2669 { |
|
2670 if ( !iContainer ) |
|
2671 { |
|
2672 // View is not active. Ignore. |
|
2673 return; |
|
2674 } |
|
2675 #ifdef __ENABLE_MSK |
|
2676 TInt mskId(R_QTN_MSK_OPEN); |
|
2677 TMPXPodcastCategory pCategory = aEntries.ValueTObjectL<TMPXPodcastCategory>(KMPXMediaPodcastCategoryGroup); |
|
2678 TMPXPodcastType pType = aEntries.ValueTObjectL<TMPXPodcastType>(KMPXMediaPodcastType); |
|
2679 if ((pCategory == EMPXAll) || (pCategory == EMPXRecentlyAdded) || |
|
2680 (pCategory == EMPXNotYetPlayed)|| |
|
2681 ((pCategory == EMPXEpisode) && (pType == EMPXPodcastItem))) |
|
2682 { |
|
2683 mskId = R_QTN_MSK_PLAY; |
|
2684 } |
|
2685 #endif // __ENABLE_MSK |
|
2686 UpdateOptionMenuL(); |
|
2687 MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleOpenL Number of Entries: %d", aEntries.Count()); |
|
2688 UpdateListBoxL(const_cast<CMPXMedia&>(aEntries), aIndex); |
|
2689 |
|
2690 delete iNumEpisode; |
|
2691 iNumEpisode = NULL; |
|
2692 |
|
2693 if(aEntries.IsSupported(KMPXMediaGeneralCount)) |
|
2694 { |
|
2695 CMPXMediaArray* mediaArray = |
|
2696 const_cast<CMPXMediaArray*>(aEntries.Value<CMPXMediaArray>(KMPXMediaArrayContents)); |
|
2697 User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
2698 |
|
2699 TInt number( mediaArray->Count() ); |
|
2700 HBufC* text( NULL ); |
|
2701 |
|
2702 if (number == 1) |
|
2703 { |
|
2704 text = StringLoader::LoadLC(R_MPX_QTN_NMP_ONE_EPISODE); |
|
2705 } |
|
2706 else if (number > 1) |
|
2707 { |
|
2708 text = StringLoader::LoadLC(R_MPX_QTN_NMP_NUM_EPISODES, number); |
|
2709 } |
|
2710 // else ignore |
|
2711 |
|
2712 if ((mskId == R_QTN_MSK_PLAY) && (number <= 0)) |
|
2713 { |
|
2714 mskId = 0; |
|
2715 } |
|
2716 if (number >= 1) |
|
2717 { |
|
2718 #ifdef __ENABLE_MSK |
|
2719 #endif // __ENABLE_MSK |
|
2720 iNumEpisode = text->Alloc(); |
|
2721 CleanupStack::PopAndDestroy(text); |
|
2722 } |
|
2723 } |
|
2724 |
|
2725 UpdateNaviPaneL(); |
|
2726 |
|
2727 if ( iContainer ) |
|
2728 { |
|
2729 // this has to be done after the list box media is properly |
|
2730 // updated |
|
2731 if ( !iContainer->Common()->FindBoxVisibility() ) |
|
2732 { |
|
2733 MPX_DEBUG1( "CMPXPodcastCollectionViewImp::HandleOpenL find box not visible" ); |
|
2734 |
|
2735 CEikButtonGroupContainer* cba = Cba(); |
|
2736 if ( cba ) |
|
2737 { |
|
2738 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
2739 cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
2740 #else |
|
2741 cba->SetCommandSetL( |
|
2742 ( iViewUtility->ViewHistoryDepth() == 1) ? |
|
2743 R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
2744 |
|
2745 #endif |
|
2746 |
|
2747 #ifdef __ENABLE_MSK |
|
2748 if (mskId != 0) |
|
2749 { |
|
2750 UpdateMiddleSoftKeyDisplayL(mskId); |
|
2751 } |
|
2752 #endif // __ENABLE_MSK |
|
2753 |
|
2754 cba->DrawDeferred(); |
|
2755 } |
|
2756 } |
|
2757 else |
|
2758 { |
|
2759 MPX_DEBUG1( "CMPXPodcastCollectionViewImp::HandleOpenL find box visible" ); |
|
2760 } |
|
2761 |
|
2762 CMPXCommonListBoxArrayBase* array( |
|
2763 iContainer->Common()->ListBoxArray() ); |
|
2764 const CMPXMedia& containerMedia = array->ContainerMedia(); |
|
2765 |
|
2766 delete iTitle; |
|
2767 iTitle = NULL; |
|
2768 |
|
2769 if (containerMedia.IsSupported( KMPXMediaGeneralTitle )) |
|
2770 { |
|
2771 iTitle = |
|
2772 containerMedia.ValueText( KMPXMediaGeneralTitle ).AllocL(); |
|
2773 } |
|
2774 UpdateTitlePaneL(); |
|
2775 } |
|
2776 |
|
2777 iHandleOpenProcessed = ETrue; |
|
2778 } |
|
2779 else |
|
2780 { |
|
2781 if ( iContainer ) |
|
2782 { |
|
2783 CEikButtonGroupContainer* cba = Cba(); |
|
2784 if ( cba ) |
|
2785 { |
|
2786 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
2787 cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
2788 #else |
|
2789 cba->SetCommandSetL( |
|
2790 ( iViewUtility->ViewHistoryDepth() == 1 ) ? |
|
2791 R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
2792 #endif |
|
2793 cba->DrawDeferred(); |
|
2794 } |
|
2795 } |
|
2796 |
|
2797 HandleErrorL(aError); |
|
2798 } |
|
2799 |
|
2800 if (iIsDeleting) |
|
2801 { |
|
2802 // nothing else to delete |
|
2803 iIsDeleting = EFalse; |
|
2804 if (iProgressDialog) |
|
2805 { |
|
2806 iProgressDialog->ProcessFinishedL(); |
|
2807 } |
|
2808 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
2809 } |
|
2810 MPX_PERF_CHECKPT("Collection View opened"); |
|
2811 } |
|
2812 |
|
2813 // --------------------------------------------------------------------------- |
|
2814 // From MMPXCollectionObserver |
|
2815 // Handles the collection entries being opened. Typically called |
|
2816 // when client has Open()'d an item. Client typically responds by |
|
2817 // 'playing' the item |
|
2818 // --------------------------------------------------------------------------- |
|
2819 // |
|
2820 void CMPXPodcastCollectionViewImp::HandleOpenL( |
|
2821 const CMPXCollectionPlaylist& /*aPlaylist*/, |
|
2822 TInt /*aError*/) |
|
2823 { |
|
2824 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleOpenL 2"); |
|
2825 iHandlingKeyEvent = EFalse; |
|
2826 // Do Nothing: playback/fetch client should handle this stage |
|
2827 } |
|
2828 |
|
2829 // --------------------------------------------------------------------------- |
|
2830 // From MMPXCollectionObserver |
|
2831 // Handle media properties |
|
2832 // --------------------------------------------------------------------------- |
|
2833 // |
|
2834 void CMPXPodcastCollectionViewImp::HandleCollectionMediaL( |
|
2835 const CMPXMedia& aMedia, |
|
2836 TInt aError) |
|
2837 { |
|
2838 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleCollectionMediaL"); |
|
2839 if (aError == KErrNone) |
|
2840 { |
|
2841 switch (iCurrentMediaLOp) |
|
2842 { |
|
2843 case EMPXOpMediaLGetContainerInfo: |
|
2844 { |
|
2845 delete iTitle; |
|
2846 iTitle = NULL; |
|
2847 |
|
2848 TMPXGeneralType type = EMPXNoType; |
|
2849 if (aMedia.IsSupported(KMPXMediaGeneralType)) |
|
2850 { |
|
2851 type = |
|
2852 aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType); |
|
2853 } |
|
2854 |
|
2855 if (aMedia.IsSupported(KMPXMediaGeneralTitle) && |
|
2856 type != EMPXItem) |
|
2857 { |
|
2858 iTitle = aMedia.ValueText(KMPXMediaGeneralTitle).AllocL(); |
|
2859 MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleCollectionMediaL Title is %S", iTitle); |
|
2860 } |
|
2861 UpdateTitlePaneL(); |
|
2862 break; |
|
2863 } |
|
2864 case EMPXOpMediaLSongDetailsFileCheck: |
|
2865 { |
|
2866 const TDesC& location = aMedia.ValueText(KMPXMediaGeneralUri); |
|
2867 |
|
2868 TInt currentLbxItemIndex( |
|
2869 iContainer->Common()->CurrentLbxItemIndex()); |
|
2870 |
|
2871 if (location.Length() == 0 || ConeUtils::FileExists(location)) |
|
2872 { |
|
2873 HBufC* buf = HBufC::NewLC(5); // magic number |
|
2874 buf->Des().AppendNum(currentLbxItemIndex); |
|
2875 // Activate metadata editor dialog via View Framework |
|
2876 iViewUtility->ActivateViewL( |
|
2877 TUid::Uid(KMPXPluginTypeMetadataEditorUid), buf); |
|
2878 CleanupStack::PopAndDestroy(buf); |
|
2879 } |
|
2880 else |
|
2881 { |
|
2882 // mark database for invalid |
|
2883 UpdateDatabaseFlagL(currentLbxItemIndex, |
|
2884 aMedia, KMPXMediaGeneralFlagsIsInvalid, ETrue); |
|
2885 } |
|
2886 break; |
|
2887 } |
|
2888 case EMPXOpMediaLSend: |
|
2889 { |
|
2890 DoHandleSendL(aMedia, aError); |
|
2891 break; |
|
2892 } |
|
2893 case EMPXOpMediaLCollectionDetails: |
|
2894 { |
|
2895 ShowCollectionDetailsL(aMedia); |
|
2896 break; |
|
2897 } |
|
2898 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
2899 case EMPXOpMediaLCopyToRemote: |
|
2900 { |
|
2901 if ( iUpnpFrameworkSupport ) |
|
2902 { |
|
2903 DoHandleCopyToRemoteL( aMedia ); |
|
2904 } |
|
2905 break; |
|
2906 } |
|
2907 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
2908 default: |
|
2909 { |
|
2910 break; |
|
2911 } |
|
2912 } |
|
2913 } |
|
2914 else |
|
2915 { |
|
2916 HandleErrorL(aError); |
|
2917 } |
|
2918 iCurrentMediaLOp = EMPXOpMediaLIdle; |
|
2919 } |
|
2920 |
|
2921 // --------------------------------------------------------------------------- |
|
2922 // From MMPXCHelperObserver |
|
2923 // Handles the completion of helper events |
|
2924 // --------------------------------------------------------------------------- |
|
2925 // |
|
2926 |
|
2927 void CMPXPodcastCollectionViewImp::HandleOperationCompleteL( |
|
2928 TCHelperOperation aOperation, |
|
2929 TInt aErr, |
|
2930 void* aArgument) |
|
2931 { |
|
2932 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleOperationCompleteL"); |
|
2933 switch(aOperation) |
|
2934 { |
|
2935 case EDeleteOp: |
|
2936 { |
|
2937 // do not dismiss the wait note until HandleOpenL is called, |
|
2938 if(aErr == KErrInUse) |
|
2939 { |
|
2940 iIsDeleting = EFalse; |
|
2941 if (iProgressDialog) |
|
2942 { |
|
2943 iProgressDialog->ProcessFinishedL(); |
|
2944 } |
|
2945 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
2946 aErr = KErrNone; //handled here |
|
2947 HBufC* text(NULL); |
|
2948 if(iContainer->Common()->CurrentSelectionIndicesL()->Count() == 0) |
|
2949 { |
|
2950 // Single selection |
|
2951 text = StringLoader::LoadLC(R_MPX_COLLECTION_NOTE_DELETE_FAIL); |
|
2952 } |
|
2953 else |
|
2954 { |
|
2955 // Multi selection |
|
2956 text = StringLoader::LoadLC( |
|
2957 R_MPX_COLLECTION_NOTE_DELETE_FAIL_MULTI_SELECTION); |
|
2958 } |
|
2959 |
|
2960 CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue); |
|
2961 dlg->ExecuteLD(*text); |
|
2962 CleanupStack::PopAndDestroy(text); |
|
2963 } |
|
2964 else if (aErr != KErrNone) |
|
2965 { |
|
2966 iIsDeleting = EFalse; |
|
2967 if(!iIsWaitNoteCanceled) |
|
2968 { |
|
2969 if (iProgressDialog) |
|
2970 { |
|
2971 iProgressDialog->ProcessFinishedL(); |
|
2972 } |
|
2973 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
2974 iIsWaitNoteCanceled = EFalse; |
|
2975 } |
|
2976 |
|
2977 HandleErrorL(aErr); |
|
2978 } |
|
2979 // else do nothing |
|
2980 |
|
2981 iContainer->Common()->ClearLbxSelection(); |
|
2982 |
|
2983 // reopen collection |
|
2984 iCollectionUtility->Collection().OpenL(); |
|
2985 break; |
|
2986 } |
|
2987 case EDeleteStatusOp: |
|
2988 { |
|
2989 if ( aArgument ) |
|
2990 { |
|
2991 CMPXMedia* media = (CMPXMedia*)aArgument; |
|
2992 CleanupStack::PushL( media ); |
|
2993 if ( media->IsSupported( KMPXMediaGeneralCount ) ) |
|
2994 { |
|
2995 TInt deletePercent = media->ValueTObjectL<TInt>( KMPXMediaGeneralCount ); |
|
2996 MPX_DEBUG2( "CMPXCollectionViewImp::HandleOperationCompleteL % Files Deleted: %d", deletePercent ); |
|
2997 // update WaitNote dialog. |
|
2998 HBufC* string = StringLoader::LoadLC(R_MPX_QTN_NMP_DEL_BATCH_SONGS_WAIT_NOTE, deletePercent); |
|
2999 TPtr buf = string->Des(); |
|
3000 |
|
3001 UpdateProcessL(deletePercent, buf); |
|
3002 CleanupStack::PopAndDestroy( string ); |
|
3003 } |
|
3004 CleanupStack::PopAndDestroy( media ); |
|
3005 aArgument = NULL; |
|
3006 } |
|
3007 break; |
|
3008 } |
|
3009 case ERenameOp: // fall through |
|
3010 case ESetOp: |
|
3011 case EAddOp: |
|
3012 default: |
|
3013 break; |
|
3014 } |
|
3015 |
|
3016 |
|
3017 if(aArgument) |
|
3018 { |
|
3019 delete (CBase*)aArgument; |
|
3020 } |
|
3021 } |
|
3022 |
|
3023 // --------------------------------------------------------------------------- |
|
3024 // From MMPXPlaybackObserver |
|
3025 // Handle playback message. |
|
3026 // --------------------------------------------------------------------------- |
|
3027 // |
|
3028 void CMPXPodcastCollectionViewImp::HandlePlaybackMessage( |
|
3029 CMPXMessage* aMessage, TInt aError ) |
|
3030 { |
|
3031 if ( aError == KErrNone && aMessage ) |
|
3032 { |
|
3033 TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) ); |
|
3034 } |
|
3035 } |
|
3036 |
|
3037 // --------------------------------------------------------------------------- |
|
3038 // From MMPXPlaybackCallback |
|
3039 // Handle playback property. |
|
3040 // --------------------------------------------------------------------------- |
|
3041 // |
|
3042 void CMPXPodcastCollectionViewImp::HandlePropertyL( |
|
3043 TMPXPlaybackProperty /*aProperty*/, |
|
3044 TInt /*aValue*/, |
|
3045 TInt /*aError*/) |
|
3046 { |
|
3047 MPX_FUNC("CMPXPodcastCollectionViewImp::HandlePropertyL"); |
|
3048 } |
|
3049 |
|
3050 // --------------------------------------------------------------------------- |
|
3051 // From MMPXPlaybackCallback |
|
3052 // Method is called continously until aComplete=ETrue, signifying that |
|
3053 // it is done and there will be no more callbacks |
|
3054 // Only new items are passed each time |
|
3055 // --------------------------------------------------------------------------- |
|
3056 // |
|
3057 void CMPXPodcastCollectionViewImp::HandleSubPlayerNamesL( |
|
3058 TUid /* aPlayer */, |
|
3059 const MDesCArray* /* aSubPlayers */, |
|
3060 TBool /* aComplete */, |
|
3061 TInt /* aError */) |
|
3062 { |
|
3063 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleSubPlayerNamesL"); |
|
3064 // do nothing |
|
3065 } |
|
3066 |
|
3067 // --------------------------------------------------------------------------- |
|
3068 // From MMPXPlaybackCallback |
|
3069 // Handle media event. |
|
3070 // --------------------------------------------------------------------------- |
|
3071 // |
|
3072 void CMPXPodcastCollectionViewImp::HandleMediaL( |
|
3073 const CMPXMedia& /*aMedia*/, |
|
3074 TInt /*aError*/) |
|
3075 { |
|
3076 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleMediaL"); |
|
3077 // do nothing |
|
3078 } |
|
3079 |
|
3080 // --------------------------------------------------------------------------- |
|
3081 // From CAknView |
|
3082 // Returns views id. |
|
3083 // --------------------------------------------------------------------------- |
|
3084 // |
|
3085 TUid CMPXPodcastCollectionViewImp::Id() const |
|
3086 { |
|
3087 return TUid::Uid(KMPXPodcastCollectionViewId); |
|
3088 } |
|
3089 |
|
3090 // --------------------------------------------------------------------------- |
|
3091 // From CAknView |
|
3092 // Command handling function. |
|
3093 // --------------------------------------------------------------------------- |
|
3094 // |
|
3095 void CMPXPodcastCollectionViewImp::HandleCommandL(TInt aCommand) |
|
3096 { |
|
3097 MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleCommandL(%d) entering", |
|
3098 aCommand); |
|
3099 |
|
3100 switch (aCommand) |
|
3101 { |
|
3102 case EAknCmdMark: |
|
3103 case EAknCmdUnmark: |
|
3104 case EAknMarkAll: |
|
3105 case EAknUnmarkAll: |
|
3106 { |
|
3107 // Custom handling of markable lists |
|
3108 iContainer->Common()->HandleMarkableListProcessCommandL( |
|
3109 aCommand ); |
|
3110 #ifdef __ENABLE_MSK |
|
3111 // Determine middle soft key labeling |
|
3112 UpdateMiddleSoftKeyDisplayL(iCurrentMskId); |
|
3113 #endif // __ENABLE_MSK |
|
3114 break; |
|
3115 } |
|
3116 case EMPXCmdGoToNowPlaying: |
|
3117 { |
|
3118 AppUi()->HandleCommandL( aCommand ); |
|
3119 break; |
|
3120 } |
|
3121 case EMPXCmdAddSongs: |
|
3122 { |
|
3123 iViewUtility->ActivateViewL( |
|
3124 TUid::Uid(KMPXPluginTypeAddSongsEditorUid)); |
|
3125 iCollectionUtility->Collection().OpenL(); |
|
3126 break; |
|
3127 } |
|
3128 case EMPXCmdDelete: // fall through |
|
3129 case EMPXCmdRemove: |
|
3130 { |
|
3131 StoreListboxItemIndexL(); |
|
3132 DeleteSelectedItemsL(); |
|
3133 break; |
|
3134 } |
|
3135 case EMPXCmdSend: |
|
3136 { |
|
3137 DoSendL(); |
|
3138 break; |
|
3139 } |
|
3140 case EMPXCmdEpisodeDetails: |
|
3141 { |
|
3142 StoreListboxItemIndexL(); |
|
3143 |
|
3144 iCurrentMediaLOp = EMPXOpMediaLSongDetailsFileCheck; |
|
3145 |
|
3146 iSelectedItem = KMPXInvalidItemId; |
|
3147 TInt currentIndex = iContainer->Common()->CurrentLbxItemIndex(); |
|
3148 CMPXCommonListBoxArrayBase* listboxArray = iContainer->Common()->ListBoxArray(); |
|
3149 const CMPXMedia& currentSelectedMedia = listboxArray->MediaL(currentIndex); |
|
3150 iSelectedItem = currentSelectedMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
3151 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
3152 CleanupStack::PushL(path); |
|
3153 |
|
3154 path->Set(iContainer->Common()->CurrentLbxItemIndex()); |
|
3155 |
|
3156 RArray<TMPXAttribute> attrs; |
|
3157 CleanupClosePushL(attrs); |
|
3158 attrs.Append( |
|
3159 TMPXAttribute(KMPXMediaIdGeneral, |
|
3160 EMPXMediaGeneralUri | EMPXMediaGeneralCollectionId)); |
|
3161 iCollectionUtility->Collection().MediaL(*path, attrs.Array()); |
|
3162 CleanupStack::PopAndDestroy(&attrs); |
|
3163 CleanupStack::PopAndDestroy(path); |
|
3164 break; |
|
3165 } |
|
3166 case EMPXCmdPodcasting: |
|
3167 { |
|
3168 LaunchPodcastAppL(); |
|
3169 break; |
|
3170 } |
|
3171 case EMPXCmdLibraryDetails: |
|
3172 { |
|
3173 iCurrentMediaLOp = EMPXOpMediaLCollectionDetails; |
|
3174 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
3175 CleanupStack::PushL(path); |
|
3176 RArray<TMPXAttribute> attrs; |
|
3177 CleanupClosePushL(attrs); |
|
3178 attrs.Append(KMPXMediaColDetailNumberOfItems); |
|
3179 attrs.Append(KMPXMediaColDetailDuration); |
|
3180 attrs.Append(KMPXMediaColDetailLastRefreshed); |
|
3181 path->Back(); |
|
3182 iCollectionUtility->Collection().MediaL(*path, attrs.Array()); |
|
3183 CleanupStack::PopAndDestroy(&attrs); |
|
3184 CleanupStack::PopAndDestroy(path); |
|
3185 break; |
|
3186 } |
|
3187 case EMPXCmdSetPlayed: |
|
3188 { |
|
3189 SetPlayedStatusL( ETrue ); |
|
3190 break; |
|
3191 } |
|
3192 case EMPXCmdSetUnplayed: |
|
3193 { |
|
3194 SetPlayedStatusL( EFalse ); |
|
3195 break; |
|
3196 } |
|
3197 case EAknCmdHelp: |
|
3198 { |
|
3199 HlpLauncher::LaunchHelpApplicationL( |
|
3200 iEikonEnv->WsSession(), |
|
3201 AppUi()->AppHelpContextL()); |
|
3202 break; |
|
3203 } |
|
3204 case EAknSoftkeyBack: |
|
3205 { |
|
3206 if(!iHandlingKeyEvent) |
|
3207 { |
|
3208 iContainer->Common()->ClearLbxSelection(); |
|
3209 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
3210 CleanupStack::PushL(cpath); |
|
3211 TInt currentDepth = cpath->Levels(); |
|
3212 cpath->Back(); |
|
3213 cpath->Back(); |
|
3214 |
|
3215 #ifndef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
3216 iCollectionUtility->Collection().BackL(); |
|
3217 #endif |
|
3218 |
|
3219 if (currentDepth == 2) |
|
3220 { |
|
3221 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
3222 // open the podcast collection db plugin |
|
3223 CMPXCollectionPath* mainPodcastMenu = CMPXCollectionPath::NewL(); |
|
3224 CleanupStack::PushL( mainPodcastMenu ); |
|
3225 mainPodcastMenu->AppendL(KMusicCollectionUid); |
|
3226 iCollectionUtility->Collection().OpenL( *mainPodcastMenu ); |
|
3227 CleanupStack::PopAndDestroy( mainPodcastMenu ); |
|
3228 |
|
3229 // activate the podcast collection view |
|
3230 RArray<TUid> uids; |
|
3231 CleanupClosePushL( uids ); |
|
3232 uids.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) ); |
|
3233 uids.AppendL( TUid::Uid( KMusicCollectionUid )); |
|
3234 iViewUtility->ActivateViewL(uids); |
|
3235 |
|
3236 CleanupStack::PopAndDestroy( &uids ); |
|
3237 #else |
|
3238 AppUi()->HandleCommandL(aCommand); |
|
3239 #endif |
|
3240 } |
|
3241 else if (currentDepth == 3) // jumping back to the main podcast menu |
|
3242 { |
|
3243 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
3244 iCollectionUtility->Collection().BackL(); |
|
3245 #endif |
|
3246 RArray<TMPXAttribute> attrs; |
|
3247 CleanupClosePushL(attrs); |
|
3248 iHandlingKeyEvent = ETrue; |
|
3249 iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo; |
|
3250 attrs.Append( |
|
3251 TMPXAttribute(KMPXMediaIdGeneral, |
|
3252 EMPXMediaGeneralDuration| |
|
3253 EMPXMediaGeneralCount)); |
|
3254 attrs.Append( |
|
3255 TMPXAttribute(KMPXMediaIdPodcast, |
|
3256 EMPXMediaPodcastType| |
|
3257 EMPXMediaPodcastCategoryGroup)); |
|
3258 iCollectionUtility->Collection().MediaL(*cpath, attrs.Array()); |
|
3259 CleanupStack::PopAndDestroy(&attrs); |
|
3260 iBackOneLevel = ETrue; |
|
3261 } |
|
3262 else |
|
3263 { |
|
3264 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
3265 iCollectionUtility->Collection().BackL(); |
|
3266 #endif |
|
3267 RArray<TMPXAttribute> attrs; |
|
3268 CleanupClosePushL(attrs); |
|
3269 iHandlingKeyEvent = ETrue; |
|
3270 iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo; |
|
3271 attrs.Append( |
|
3272 TMPXAttribute(KMPXMediaIdGeneral, |
|
3273 EMPXMediaGeneralTitle | |
|
3274 EMPXMediaGeneralDuration | |
|
3275 EMPXMediaGeneralCount)); |
|
3276 attrs.Append( |
|
3277 TMPXAttribute(KMPXMediaIdPodcast, |
|
3278 EMPXMediaPodcastType | |
|
3279 EMPXMediaPodcastCategoryGroup)); |
|
3280 iCollectionUtility->Collection().MediaL(*cpath, attrs.Array()); |
|
3281 CleanupStack::PopAndDestroy(&attrs); |
|
3282 iBackOneLevel = ETrue; |
|
3283 } |
|
3284 CleanupStack::PopAndDestroy(cpath); |
|
3285 } |
|
3286 else |
|
3287 { |
|
3288 MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleCommandL Busy, ignoring command"); |
|
3289 } |
|
3290 break; |
|
3291 } |
|
3292 case EAknCmdExit: |
|
3293 case EAknSoftkeyExit: |
|
3294 { |
|
3295 AppUi()->HandleCommandL( aCommand ); |
|
3296 break; |
|
3297 } |
|
3298 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
3299 case EMPXCmdUpnpPlayViaLocal: |
|
3300 { |
|
3301 if ( iUpnpFrameworkSupport ) |
|
3302 { |
|
3303 SelectNewPlayerL( aCommand ); |
|
3304 } |
|
3305 break; |
|
3306 } |
|
3307 case EMPXCmdUPnPAiwCmdCopyToExternalCriteria: |
|
3308 { |
|
3309 if ( iUpnpFrameworkSupport ) |
|
3310 { |
|
3311 CopySelectedItemsToRemoteL(); |
|
3312 } |
|
3313 break; |
|
3314 } |
|
3315 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
3316 case EMPXCmdPlay: |
|
3317 case EMPXCmdPlayPause: |
|
3318 { |
|
3319 TMPXPlaybackState state(iPlaybackUtility->StateL()); |
|
3320 if ((EPbStateNotInitialised == state || |
|
3321 EPbStateStopped == state) && |
|
3322 iContainer->Common()->CurrentListItemCount() > 0) |
|
3323 { |
|
3324 // Needed to reset the status of iPreservedState |
|
3325 if ( EPbStateStopped == state ) |
|
3326 { |
|
3327 iPlaybackUtility->CommandL(EPbCmdResetPreserveState); |
|
3328 } |
|
3329 |
|
3330 RArray<TMPXAttribute> attrs; |
|
3331 CleanupClosePushL(attrs); |
|
3332 |
|
3333 // specifying this attribute acts as a signal to the |
|
3334 // podcast collection plugin that this media file |
|
3335 // is currently being played |
|
3336 |
|
3337 TInt currentItem(iContainer->Common()->CurrentLbxItemIndex()); |
|
3338 MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleCommandL playing index %d", currentItem); |
|
3339 if (currentItem != KErrNotFound) |
|
3340 { |
|
3341 iCollectionUtility->Collection().OpenL(currentItem, attrs.Array(), EMPXOpenPlaylistOnly); |
|
3342 } |
|
3343 // else ignore |
|
3344 CleanupStack::PopAndDestroy(&attrs); |
|
3345 } |
|
3346 else |
|
3347 { |
|
3348 AppUi()->HandleCommandL(aCommand); |
|
3349 } |
|
3350 break; |
|
3351 } |
|
3352 case EMPXCmdPause: |
|
3353 case EMPXCmdStop: |
|
3354 case EMPXCmdNext: |
|
3355 case EMPXCmdPrevious: |
|
3356 case EMPXCmdSeekForward: |
|
3357 case EMPXCmdSeekBackward: |
|
3358 case EMPXCmdStopSeeking: |
|
3359 case EMPXCmdVolumeUp: |
|
3360 case EMPXCmdVolumeDown: |
|
3361 { |
|
3362 AppUi()->HandleCommandL(aCommand); |
|
3363 break; |
|
3364 } |
|
3365 default: |
|
3366 { |
|
3367 MPX_PERF_CHECKPT("Handle Collection view unknown command"); |
|
3368 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
3369 if ( iUpnpFrameworkSupport ) |
|
3370 { |
|
3371 if (aCommand >= EMPXCmdUpnpPlayViaRemotePlayer && |
|
3372 aCommand < EMPXCmdUpnpLastCommandId) |
|
3373 { |
|
3374 SelectNewPlayerL(aCommand); |
|
3375 } |
|
3376 else |
|
3377 { |
|
3378 AppUi()->HandleCommandL(aCommand); |
|
3379 } |
|
3380 } |
|
3381 else |
|
3382 { |
|
3383 AppUi()->HandleCommandL(aCommand); |
|
3384 } |
|
3385 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
3386 break; |
|
3387 } |
|
3388 } |
|
3389 MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleCommandL() exiting"); |
|
3390 } |
|
3391 |
|
3392 // --------------------------------------------------------------------------- |
|
3393 // From CAknView |
|
3394 // Handles a view activation. |
|
3395 // --------------------------------------------------------------------------- |
|
3396 // |
|
3397 void CMPXPodcastCollectionViewImp::DoActivateL( |
|
3398 const TVwsViewId& /* aPrevViewId */, |
|
3399 TUid /* aCustomMessageId */, |
|
3400 const TDesC8& /* aCustomMessage */) |
|
3401 { |
|
3402 MPX_FUNC("CMPXPodcastCollectionViewImp::DoActivateL()"); |
|
3403 |
|
3404 iHandleOpenProcessed = EFalse; |
|
3405 |
|
3406 // Add view deactivation observer |
|
3407 AppUi()->AddViewDeactivationObserverL( this ); |
|
3408 |
|
3409 // Set status pane layout if switched here directly from another view, |
|
3410 // such as when using the AnyKey |
|
3411 StatusPane()->MakeVisible(ETrue); |
|
3412 if ( StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL ) |
|
3413 { |
|
3414 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL); |
|
3415 } |
|
3416 |
|
3417 if ( !iContainer ) |
|
3418 { |
|
3419 iContainer = CMPXPodcastCollectionViewContainer::NewL(this, this); |
|
3420 } |
|
3421 CCoeControl* coeControl = iContainer->Common()->CoeControl(); |
|
3422 coeControl->SetMopParent( this ); |
|
3423 AppUi()->AddToStackL( *this, coeControl ); |
|
3424 coeControl->SetRect( ClientRect() ); |
|
3425 iContainer->Common()->SetLbxEmptyTextL(KNullDesC); |
|
3426 iContainer->Common()->ActivateContainerL(); |
|
3427 |
|
3428 // media is not valid until the first HandleOpenL call |
|
3429 CEikButtonGroupContainer* cba = Cba(); |
|
3430 if ( cba ) |
|
3431 { |
|
3432 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
3433 cba->SetCommandSetL( R_MPX_OPTIONS_BACK_CBA_NO_ACTION ); |
|
3434 #else |
|
3435 cba->SetCommandSetL( |
|
3436 ( iViewUtility->ViewHistoryDepth() == 1 ) ? |
|
3437 R_MPX_OPTIONS_EXIT_CBA_NO_ACTION : R_MPX_OPTIONS_BACK_CBA_NO_ACTION ); |
|
3438 #endif |
|
3439 cba->DrawDeferred(); |
|
3440 } |
|
3441 |
|
3442 UpdateTitlePaneL(); |
|
3443 UpdateNaviPaneL(); |
|
3444 |
|
3445 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
3446 CleanupStack::PushL(cpath); |
|
3447 if (iViewUtility->PreviousViewType().iUid == KMPXPluginTypePlaybackUid) |
|
3448 { |
|
3449 // return back from playback view and in episodes level, |
|
3450 // highlight the new playing song |
|
3451 MMPXSource* source = iPlaybackUtility->Source(); |
|
3452 |
|
3453 if (source) |
|
3454 { |
|
3455 CMPXCollectionPlaylist* playlist = source->PlaylistL(); |
|
3456 if (playlist) |
|
3457 { |
|
3458 CleanupStack::PushL(playlist); |
|
3459 CMPXCollectionPath* plPath = |
|
3460 CMPXCollectionPath::NewL(playlist->Path()); |
|
3461 CleanupStack::PushL(plPath); |
|
3462 |
|
3463 // Going from NPV -> Collection, same collection level |
|
3464 if(plPath->Levels() == cpath->Levels()) |
|
3465 { |
|
3466 iPossibleJump = ETrue; |
|
3467 } |
|
3468 CleanupStack::PopAndDestroy(plPath); |
|
3469 CleanupStack::PopAndDestroy(playlist); |
|
3470 } |
|
3471 } |
|
3472 |
|
3473 if (cpath->Levels() > 1) |
|
3474 { |
|
3475 // valid path in collection |
|
3476 cpath->Back(); |
|
3477 RArray<TMPXAttribute> attrs; |
|
3478 CleanupClosePushL(attrs); |
|
3479 iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo; |
|
3480 |
|
3481 // don't ask for the title if jumping back to the |
|
3482 // main podcast menu, since the default title |
|
3483 // will be used |
|
3484 if(cpath->Levels() == 1) |
|
3485 { |
|
3486 attrs.Append(KMPXMediaGeneralDuration); |
|
3487 } |
|
3488 else |
|
3489 { |
|
3490 attrs.Append( |
|
3491 TMPXAttribute(KMPXMediaIdGeneral, |
|
3492 EMPXMediaGeneralTitle | |
|
3493 EMPXMediaGeneralDuration)); |
|
3494 } |
|
3495 |
|
3496 iCollectionUtility->Collection().MediaL(*cpath, attrs.Array()); |
|
3497 CleanupStack::PopAndDestroy(&attrs); |
|
3498 iCollectionUtility->Collection().OpenL(); |
|
3499 } |
|
3500 else |
|
3501 { |
|
3502 TUid defaultView = iViewUtility->DefaultViewUid(); |
|
3503 if (defaultView != KNullUid) |
|
3504 { |
|
3505 MPX_DEBUG2("CMPXCollectionViewImp::DoActivateL() Activating default view 0x%x", defaultView.iUid); |
|
3506 iViewUtility->ActivateViewL(defaultView); |
|
3507 } |
|
3508 else |
|
3509 { |
|
3510 MPX_DEBUG1("CMPXCollectionViewImp::DoActivateL() Activating main view"); |
|
3511 iViewUtility->ActivateViewL(TUid::Uid(KMPXPluginTypeMainUid)); |
|
3512 } |
|
3513 } |
|
3514 } |
|
3515 else |
|
3516 { |
|
3517 cpath->Back(); |
|
3518 RArray<TMPXAttribute> attrs; |
|
3519 CleanupClosePushL(attrs); |
|
3520 iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo; |
|
3521 attrs.Append(KMPXMediaGeneralDuration); |
|
3522 attrs.Append( |
|
3523 TMPXAttribute(KMPXMediaIdPodcast, |
|
3524 EMPXMediaPodcastType | |
|
3525 EMPXMediaPodcastCategoryGroup)); |
|
3526 iCollectionUtility->Collection().MediaL(*cpath, attrs.Array()); |
|
3527 CleanupStack::PopAndDestroy(&attrs); |
|
3528 iCollectionUtility->Collection().OpenL(); |
|
3529 } |
|
3530 CleanupStack::PopAndDestroy(cpath); |
|
3531 } |
|
3532 |
|
3533 // --------------------------------------------------------------------------- |
|
3534 // From CAknView |
|
3535 // View deactivation function. |
|
3536 // --------------------------------------------------------------------------- |
|
3537 // |
|
3538 void CMPXPodcastCollectionViewImp::DoDeactivate() |
|
3539 { |
|
3540 MPX_FUNC("CMPXPodcastCollectionViewImp::DoDeactivate"); |
|
3541 if (iContainer) |
|
3542 { |
|
3543 AppUi()->RemoveFromStack( iContainer->Common()->CoeControl() ); |
|
3544 delete iContainer; |
|
3545 iContainer = NULL; |
|
3546 } |
|
3547 |
|
3548 if (iNumEpisode) |
|
3549 { |
|
3550 delete iNumEpisode; |
|
3551 iNumEpisode = NULL; |
|
3552 TRAP_IGNORE(UpdateNaviPaneL()); |
|
3553 } |
|
3554 } |
|
3555 |
|
3556 // --------------------------------------------------------------------------- |
|
3557 // From CAknView |
|
3558 // Foreground event handling function. |
|
3559 // --------------------------------------------------------------------------- |
|
3560 // |
|
3561 void CMPXPodcastCollectionViewImp::HandleForegroundEventL(TBool aForeground) |
|
3562 { |
|
3563 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleForegroundEventL"); |
|
3564 CAknView::HandleForegroundEventL(aForeground); |
|
3565 } |
|
3566 |
|
3567 // --------------------------------------------------------------------------- |
|
3568 // From MEikMenuObserver |
|
3569 // Dynamically initialises a menu pane. |
|
3570 // --------------------------------------------------------------------------- |
|
3571 // |
|
3572 void CMPXPodcastCollectionViewImp::DynInitMenuPaneL( |
|
3573 TInt aResourceId, |
|
3574 CEikMenuPane* aMenuPane) |
|
3575 { |
|
3576 MPX_FUNC("CMPXPodcastCollectionViewImp::DynInitMenuPaneL"); |
|
3577 |
|
3578 // check number of items on the list |
|
3579 TInt count = iContainer->Common()->TotalListItemCount(); |
|
3580 MPX_DEBUG2("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() %d items on list", count); |
|
3581 |
|
3582 TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() ); |
|
3583 TBool isListEmpty( currentItem < 0 ); |
|
3584 |
|
3585 // check number of marked items on the list |
|
3586 TInt marked = iContainer->Common()->CurrentSelectionIndicesL()->Count(); |
|
3587 MPX_DEBUG2("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() %d items marked", marked); |
|
3588 |
|
3589 TInt usbUnblockingStatus; |
|
3590 RProperty::Get( KMPXViewPSUid, |
|
3591 KMPXUSBUnblockingPSStatus, |
|
3592 usbUnblockingStatus); |
|
3593 |
|
3594 switch (aResourceId) |
|
3595 { |
|
3596 case R_MPX_PODCAST_COLLECTION_VIEW_PODCAST_MENU: |
|
3597 { |
|
3598 if ( !iPlaybackUtility->Source() ) |
|
3599 { |
|
3600 aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue ); |
|
3601 } |
|
3602 // Dim "Go to Podcasting" if Podcasting App is not installed on device |
|
3603 if (CheckPodcastAppL() == KErrNotFound) |
|
3604 { |
|
3605 // Not displayed if Podcasting App is not installed |
|
3606 aMenuPane->SetItemDimmed(EMPXCmdPodcasting, ETrue); |
|
3607 } |
|
3608 |
|
3609 aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden ); |
|
3610 break; |
|
3611 } |
|
3612 case R_MPX_PODCAST_COLLECTION_VIEW_MENU_1: |
|
3613 { |
|
3614 aMenuPane->SetItemDimmed(EMPXCmdFind, ETrue); |
|
3615 if ( !iPlaybackUtility->Source() ) |
|
3616 { |
|
3617 aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue ); |
|
3618 } |
|
3619 if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive) |
|
3620 { |
|
3621 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Delete"); |
|
3622 aMenuPane->SetItemDimmed(EMPXCmdDelete, ETrue); |
|
3623 } |
|
3624 // Delete is displayed only if list is not empty |
|
3625 if (count == 0 || isListEmpty) |
|
3626 { |
|
3627 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Delete"); |
|
3628 aMenuPane->SetItemDimmed(EMPXCmdDelete, ETrue); |
|
3629 // UPNP options will be displayed if list is not empty |
|
3630 aMenuPane->SetItemDimmed(EMPXCmdUpnpPlayVia, ETrue); |
|
3631 aMenuPane->SetItemDimmed(EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue); |
|
3632 } |
|
3633 else |
|
3634 { |
|
3635 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
3636 if ( iUpnpFrameworkSupport ) |
|
3637 { |
|
3638 HandleDynInitUpnpL(aResourceId, *aMenuPane); |
|
3639 } |
|
3640 else |
|
3641 { |
|
3642 aMenuPane->SetItemDimmed(EMPXCmdUpnpPlayVia, ETrue); |
|
3643 aMenuPane->SetItemDimmed(EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue); |
|
3644 } |
|
3645 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
3646 } |
|
3647 |
|
3648 // Dim "Go to Podcasting" if Podcasting App is not installed on device |
|
3649 if (CheckPodcastAppL() == KErrNotFound) |
|
3650 { |
|
3651 // Not displayed if Podcasting App is not installed |
|
3652 aMenuPane->SetItemDimmed(EMPXCmdPodcasting, ETrue); |
|
3653 } |
|
3654 aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden ); |
|
3655 break; |
|
3656 } |
|
3657 case R_MPX_PODCAST_COLLECTION_VIEW_MENU_2: |
|
3658 { |
|
3659 aMenuPane->SetItemDimmed(EMPXCmdFind, ETrue); |
|
3660 if ( !iPlaybackUtility->Source() ) |
|
3661 { |
|
3662 aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue ); |
|
3663 } |
|
3664 #ifdef __ENABLE_MSK |
|
3665 // multiple selection in episodes view |
|
3666 if (marked && iShowContextMenu) |
|
3667 { |
|
3668 MenuBar()->SetMenuType(CEikMenuBar::EMenuContext); |
|
3669 iShowContextMenu = EFalse; |
|
3670 } |
|
3671 else |
|
3672 { |
|
3673 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); |
|
3674 } |
|
3675 #endif //__ENABLE_MSK |
|
3676 |
|
3677 if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive) |
|
3678 { |
|
3679 aMenuPane->SetItemDimmed(EMPXCmdDelete, ETrue); |
|
3680 aMenuPane->SetItemDimmed(EMPXCmdSetPlayed, ETrue); |
|
3681 aMenuPane->SetItemDimmed(EMPXCmdSetUnplayed, ETrue); |
|
3682 } |
|
3683 |
|
3684 // Delete is not displayed if list is empty |
|
3685 // Mark/Unmark is not displayed if list is empty |
|
3686 if ( count == 0 || isListEmpty) |
|
3687 { |
|
3688 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Send"); |
|
3689 aMenuPane->SetItemDimmed(EMPXCmdSend, ETrue); |
|
3690 |
|
3691 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Delete"); |
|
3692 aMenuPane->SetItemDimmed(EMPXCmdDelete, ETrue); |
|
3693 |
|
3694 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Set to played"); |
|
3695 aMenuPane->SetItemDimmed(EMPXCmdSetPlayed, ETrue); |
|
3696 |
|
3697 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Set to unplayed"); |
|
3698 aMenuPane->SetItemDimmed(EMPXCmdSetUnplayed, ETrue); |
|
3699 |
|
3700 // UPNP options will be displayed if list is not empty |
|
3701 aMenuPane->SetItemDimmed(EMPXCmdUpnpPlayVia, ETrue); |
|
3702 aMenuPane->SetItemDimmed(EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue); |
|
3703 } |
|
3704 else |
|
3705 { |
|
3706 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
3707 if ( iUpnpFrameworkSupport ) |
|
3708 { |
|
3709 HandleDynInitUpnpL(aResourceId, *aMenuPane); |
|
3710 } |
|
3711 else |
|
3712 { |
|
3713 aMenuPane->SetItemDimmed(EMPXCmdUpnpPlayVia, ETrue); |
|
3714 aMenuPane->SetItemDimmed(EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue); |
|
3715 } |
|
3716 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
3717 |
|
3718 TInt completePlayed = 0; |
|
3719 // check episode state: New, partially played or completely played |
|
3720 CMPXCommonListBoxArrayBase* baseArray = |
|
3721 iContainer->Common()->ListBoxArray(); |
|
3722 CMPXPodcastCollectionViewListBoxArray* array = |
|
3723 static_cast<CMPXPodcastCollectionViewListBoxArray*>(baseArray); |
|
3724 TInt currentItem = iContainer->Common()->CurrentLbxItemIndex(); |
|
3725 const CMPXMedia& media = array->MediaL(currentItem); |
|
3726 TUint32 playCount = 0; |
|
3727 |
|
3728 if (media.IsSupported(KMPXMediaGeneralPlayCount)) |
|
3729 { |
|
3730 playCount = |
|
3731 media.ValueTObjectL<TUint32>(KMPXMediaGeneralPlayCount); |
|
3732 } |
|
3733 |
|
3734 MPX_DEBUG2("CMPXCollectionViewImp::DynInitMenuPaneL item PlayCount = %d", playCount); |
|
3735 |
|
3736 // playback engine increments the playcount after a song has finished playing |
|
3737 if (playCount >= 1) |
|
3738 { |
|
3739 completePlayed = 1; |
|
3740 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() item is completely played"); |
|
3741 } |
|
3742 |
|
3743 // Set to played. |
|
3744 // If marking is off, only displayed if podcast is New Podcast or |
|
3745 // Partially Played states. |
|
3746 if (!marked && completePlayed) |
|
3747 { |
|
3748 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Set to played"); |
|
3749 aMenuPane->SetItemDimmed(EMPXCmdSetPlayed, ETrue); |
|
3750 } |
|
3751 |
|
3752 // Set to unplayed. |
|
3753 // If marking is off, only displayed if podcast is Completely |
|
3754 // Played states. |
|
3755 if (!marked && !completePlayed) |
|
3756 { |
|
3757 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Set to unplayed"); |
|
3758 aMenuPane->SetItemDimmed(EMPXCmdSetUnplayed, ETrue); |
|
3759 } |
|
3760 aMenuPane->SetItemDimmed(EMPXCmdSend, SendOptionVisibilityL()); |
|
3761 TBool isInvalid = array->IsItemBrokenLinkL(currentItem); |
|
3762 TBool isCorrupted = array->IsItemCorruptedL(currentItem); |
|
3763 if (isInvalid || isCorrupted) |
|
3764 { |
|
3765 aMenuPane->SetItemDimmed(EMPXCmdSetUnplayed, ETrue); |
|
3766 aMenuPane->SetItemDimmed(EMPXCmdSetPlayed, ETrue); |
|
3767 } |
|
3768 } |
|
3769 break; |
|
3770 } |
|
3771 case R_AVKON_MENUPANE_MARKABLE_LIST: |
|
3772 { |
|
3773 // Mark/Unmark submenu is displayed only if list is not empty |
|
3774 if (count == 0 || |
|
3775 usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive || |
|
3776 isListEmpty) |
|
3777 { |
|
3778 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Mark/Unmark submenu"); |
|
3779 aMenuPane->SetItemDimmed(EAknCmdEditListMenu, ETrue); |
|
3780 } |
|
3781 break; |
|
3782 } |
|
3783 case R_MPX_PODCAST_COLLECTION_VIEW_MENU_3: |
|
3784 { |
|
3785 CMPXCommonListBoxArrayBase* baseArray = |
|
3786 iContainer->Common()->ListBoxArray(); |
|
3787 CMPXPodcastCollectionViewListBoxArray* array = |
|
3788 static_cast<CMPXPodcastCollectionViewListBoxArray*>(baseArray); |
|
3789 TInt currentItem = iContainer->Common()->CurrentLbxItemIndex(); |
|
3790 |
|
3791 // Episode details is not displayed if list is empty. |
|
3792 // Not displayed if marking is on. |
|
3793 // TODO: Not displayed if item in active focus is tagged as unavailable |
|
3794 // or corrupt. |
|
3795 if(isListEmpty) |
|
3796 { |
|
3797 aMenuPane->SetItemDimmed( EMPXCmdEpisodeDetails, |
|
3798 ETrue); |
|
3799 } |
|
3800 else if (count == 0 || marked ) |
|
3801 { |
|
3802 MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Episode details"); |
|
3803 aMenuPane->SetItemDimmed( EMPXCmdEpisodeDetails, |
|
3804 FileDetailsOptionVisibilityL() ); |
|
3805 } |
|
3806 else |
|
3807 { |
|
3808 TBool isInvalid = array->IsItemBrokenLinkL(currentItem); |
|
3809 TBool isCorrupted = array->IsItemCorruptedL(currentItem); |
|
3810 if (isInvalid || isCorrupted) |
|
3811 { |
|
3812 aMenuPane->SetItemDimmed( EMPXCmdEpisodeDetails, |
|
3813 ETrue); |
|
3814 } |
|
3815 else |
|
3816 { |
|
3817 aMenuPane->SetItemDimmed( EMPXCmdEpisodeDetails, |
|
3818 FileDetailsOptionVisibilityL() ); |
|
3819 } |
|
3820 } |
|
3821 |
|
3822 // Dim "Go to Podcasting" if Podcasting App is not installed on device |
|
3823 if (CheckPodcastAppL() == KErrNotFound) |
|
3824 { |
|
3825 // Not displayed if Podcasting App is not installed |
|
3826 aMenuPane->SetItemDimmed(EMPXCmdPodcasting, ETrue); |
|
3827 } |
|
3828 |
|
3829 aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden ); |
|
3830 |
|
3831 break; |
|
3832 } |
|
3833 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
3834 case R_MPX_PODCAST_COLLECTION_PLAY_VIA_SUB_MENU: |
|
3835 { |
|
3836 if ( iUpnpFrameworkSupport ) |
|
3837 { |
|
3838 AddPlayersNamesToMenuL( *aMenuPane ); |
|
3839 } |
|
3840 break; |
|
3841 } |
|
3842 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
3843 default: |
|
3844 { |
|
3845 // Do nothing |
|
3846 break; |
|
3847 } |
|
3848 } |
|
3849 |
|
3850 if (!(aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST && usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)) |
|
3851 { |
|
3852 // Custom handling of menu pane for markable lists |
|
3853 iContainer->Common()->HandleMarkableListDynInitMenuPane( |
|
3854 aResourceId, |
|
3855 aMenuPane ); |
|
3856 } |
|
3857 } |
|
3858 |
|
3859 // --------------------------------------------------------------------------- |
|
3860 // From MEikListBoxObserver |
|
3861 // Handles listbox events. |
|
3862 // --------------------------------------------------------------------------- |
|
3863 // |
|
3864 void CMPXPodcastCollectionViewImp::HandleListBoxEventL( |
|
3865 CEikListBox* /*aListBox*/, |
|
3866 TListBoxEvent aEventType) |
|
3867 { |
|
3868 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleListBoxEventL"); |
|
3869 MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleListBoxEventL iLastDepth = %d", iLastDepth); |
|
3870 MPX_PERF_CHECKPT("Select collection item to open"); |
|
3871 |
|
3872 //handle this thouch screen event to tell to engine the index of selected song |
|
3873 //to keep/change focus on right song in rename/remove |
|
3874 #ifdef SINGLE_CLICK_INCLUDED |
|
3875 if ( aEventType == EEventItemSingleClicked ) |
|
3876 #else |
|
3877 if ( aEventType == EEventItemClicked ) |
|
3878 #endif |
|
3879 { |
|
3880 if ( !iHandlingKeyEvent ) |
|
3881 { |
|
3882 CMPXCommonListBoxArrayBase* listboxArray( iContainer->Common()->ListBoxArray() ); |
|
3883 TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() ); |
|
3884 |
|
3885 CMPXCommand* command = CMPXCommand::NewL(); |
|
3886 CleanupStack::PushL( command ); |
|
3887 command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId, |
|
3888 KMPXCommandIdCollectionSelect ); |
|
3889 command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex ); |
|
3890 command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
3891 iCollectionUtility->Collection().CommandL( *command ); |
|
3892 CleanupStack::PopAndDestroy( command ); |
|
3893 } |
|
3894 } |
|
3895 |
|
3896 if (aEventType == EEventEnterKeyPressed|| aEventType == EEventItemDoubleClicked |
|
3897 #ifdef SINGLE_CLICK_INCLUDED |
|
3898 || aEventType == EEventItemSingleClicked |
|
3899 #endif |
|
3900 ) |
|
3901 { |
|
3902 if (!iHandlingKeyEvent) |
|
3903 { |
|
3904 TMPXPlaybackState pbState( iPlaybackUtility->StateL() ); |
|
3905 TBool isEqual( EFalse ); |
|
3906 if ( pbState == EPbStatePlaying || pbState == EPbStatePaused ) |
|
3907 { |
|
3908 // in currently playing view, check if current item is playing |
|
3909 if ( iContainer->Common()->CurrentLbxItemIndex() == |
|
3910 iContainer->PlaybackIndex() ) |
|
3911 { |
|
3912 isEqual = ETrue; |
|
3913 } |
|
3914 } |
|
3915 |
|
3916 if ( isEqual ) |
|
3917 { |
|
3918 MPX_DEBUG1( "CMPXPodcastCollectionViewImp::HandleListBoxEventL going to now playing view" ); |
|
3919 if ( pbState == EPbStatePaused ) |
|
3920 { |
|
3921 MPX_DEBUG1( "CMPXPodcastCollectionViewImp::HandleListBoxEventL resuming playback" ); |
|
3922 iPlaybackUtility->CommandL( EPbCmdPlay ); |
|
3923 } |
|
3924 HandleCommandL( EMPXCmdGoToNowPlaying ); |
|
3925 } |
|
3926 else |
|
3927 { |
|
3928 CMPXCommonListBoxArrayBase* listboxArray = |
|
3929 iContainer->Common()->ListBoxArray(); |
|
3930 TInt currentItem = iContainer->Common()->CurrentLbxItemIndex(); |
|
3931 const CMPXMedia& containerMedia = listboxArray->ContainerMedia(); |
|
3932 |
|
3933 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
3934 CleanupStack::PushL(cpath); |
|
3935 |
|
3936 MPX_DEBUG_PATH(*cpath); |
|
3937 if (cpath->Levels() == (iLastDepth + 1)) |
|
3938 { |
|
3939 // navigated in one level |
|
3940 iLastDepth++; |
|
3941 iBottomIndex->AppendL( |
|
3942 iContainer->Common()->BottomLbxItemIndex()); |
|
3943 } |
|
3944 else |
|
3945 { |
|
3946 // invalid path, rebuild with all 0 |
|
3947 iBottomIndex->Reset(); |
|
3948 iLastDepth = cpath->Levels(); |
|
3949 for (TInt i = 0; i < iLastDepth; i++) |
|
3950 { |
|
3951 iBottomIndex->AppendL(0); |
|
3952 } |
|
3953 } |
|
3954 CleanupStack::PopAndDestroy(cpath); |
|
3955 |
|
3956 MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleListBoxEventL Opening Item: %d", currentItem); |
|
3957 iHandlingKeyEvent = ETrue; |
|
3958 |
|
3959 // Needed to reset the status of iPreservedState |
|
3960 if ( EPbStateStopped == iPlaybackUtility->StateL() ) |
|
3961 { |
|
3962 iPlaybackUtility->CommandL(EPbCmdResetPreserveState); |
|
3963 } |
|
3964 |
|
3965 RArray<TMPXAttribute> attrs; |
|
3966 CleanupClosePushL(attrs); |
|
3967 |
|
3968 iCollectionUtility->Collection().OpenL(currentItem, |
|
3969 attrs.Array(), |
|
3970 EMPXOpenDefault); |
|
3971 |
|
3972 CleanupStack::PopAndDestroy(&attrs); |
|
3973 |
|
3974 } |
|
3975 } |
|
3976 else |
|
3977 { |
|
3978 MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleListBoxEventL Busy, ignoring command"); |
|
3979 } |
|
3980 } |
|
3981 } |
|
3982 |
|
3983 // --------------------------------------------------------------------------- |
|
3984 // From MEikCommandObserver |
|
3985 // Processes user commands. |
|
3986 // --------------------------------------------------------------------------- |
|
3987 // |
|
3988 void CMPXPodcastCollectionViewImp::ProcessCommandL(TInt aCommandId) |
|
3989 { |
|
3990 MPX_FUNC("CMPXPodcastCollectionViewImp::ProcessCommandL"); |
|
3991 |
|
3992 switch(aCommandId) |
|
3993 { |
|
3994 case EMPXCmdUpArrow: |
|
3995 case EMPXCmdDownArrow: |
|
3996 { |
|
3997 #ifdef __COVER_DISPLAY |
|
3998 iIgnoreNextFocusChangedMessage = ETrue; |
|
3999 #endif |
|
4000 break; |
|
4001 } |
|
4002 case EMPXCmdCommonDelete: |
|
4003 { |
|
4004 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
4005 CleanupStack::PushL(cpath); |
|
4006 TInt depth = cpath->Levels(); |
|
4007 #ifndef __HG_COLLECTIONVIEW |
|
4008 if(depth > 2) // 'C' key is invalid within the main Podcast Collection |
|
4009 // View menu |
|
4010 #endif // __HG_COLLECTIONVIEW |
|
4011 { |
|
4012 StoreListboxItemIndexL(); |
|
4013 DeleteSelectedItemsL(); |
|
4014 } |
|
4015 CleanupStack::PopAndDestroy(cpath); |
|
4016 break; |
|
4017 } |
|
4018 case EMPXCmdCommonResourceChange: |
|
4019 { |
|
4020 iContainer->Common()->CoeControl()->SetRect( ClientRect() ); |
|
4021 break; |
|
4022 } |
|
4023 case EAknSoftkeyEmpty: |
|
4024 { |
|
4025 // do nothing. handled to avoid "unsupported" message |
|
4026 break; |
|
4027 } |
|
4028 case EMPXCmdCommonEnterKey: |
|
4029 { |
|
4030 // Handle list box event for enter key pressed |
|
4031 TInt currentItem = iContainer->Common()->CurrentLbxItemIndex(); |
|
4032 if( currentItem >= 0 ) |
|
4033 { |
|
4034 HandleListBoxEventL( |
|
4035 NULL, // ignore |
|
4036 EEventEnterKeyPressed ); |
|
4037 } |
|
4038 break; |
|
4039 } |
|
4040 #ifdef __ENABLE_MSK |
|
4041 case EMPXCmdCommonUpdateMiddleSoftKey: |
|
4042 { |
|
4043 // Determine middle soft key labeling |
|
4044 UpdateMiddleSoftKeyDisplayL(iCurrentMskId); |
|
4045 break; |
|
4046 } |
|
4047 case EAknSoftkeyContextOptions : |
|
4048 { |
|
4049 // set context menu flag |
|
4050 iShowContextMenu = ETrue; |
|
4051 // open context menu (by processing "Options" command) |
|
4052 CAknView::ProcessCommandL(EAknSoftkeyOptions); |
|
4053 break; |
|
4054 } |
|
4055 #endif // __ENABLE_MSK |
|
4056 case EAknCmdExit: |
|
4057 { |
|
4058 HandleCommandL( aCommandId ); |
|
4059 } |
|
4060 default: |
|
4061 { |
|
4062 CAknView::ProcessCommandL(aCommandId); |
|
4063 break; |
|
4064 } |
|
4065 } |
|
4066 } |
|
4067 |
|
4068 // ----------------------------------------------------------------------------- |
|
4069 // CMPXCollectionViewImp::HandleFindAllL |
|
4070 // Handle callback for "find" operation |
|
4071 // ----------------------------------------------------------------------------- |
|
4072 // |
|
4073 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
4074 void CMPXPodcastCollectionViewImp::HandleFindAllL( |
|
4075 const CMPXMedia& aResults, |
|
4076 TBool aComplete, |
|
4077 TInt aError) |
|
4078 { |
|
4079 MPX_FUNC("CMPXPodcastCollectionViewImp::HandleFindAllL"); |
|
4080 if (aError == KErrNone) |
|
4081 { |
|
4082 switch (iCurrentFindAllLOp) |
|
4083 { |
|
4084 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
4085 case EMPXOpFindAllLUpnp: |
|
4086 { |
|
4087 if ( iUpnpFrameworkSupport ) |
|
4088 { |
|
4089 DoHandleCopyToRemoteL( aResults, aComplete ); |
|
4090 } |
|
4091 break; |
|
4092 } |
|
4093 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
4094 default: |
|
4095 { |
|
4096 break; |
|
4097 } |
|
4098 } |
|
4099 } |
|
4100 else |
|
4101 { |
|
4102 HandleErrorL(aError); |
|
4103 } |
|
4104 iCurrentFindAllLOp = EMPXOpFindAllLIdle; |
|
4105 |
|
4106 //#ifndef __UPNP_FRAMEWORK_2_0_ |
|
4107 if ( !iUpnpFrameworkSupport ) |
|
4108 { |
|
4109 // Remove compilation warnings |
|
4110 (void)aComplete; |
|
4111 } |
|
4112 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
4113 } |
|
4114 |
|
4115 // --------------------------------------------------------------------------- |
|
4116 // Check presence of Nokia Podcasting Application. |
|
4117 // --------------------------------------------------------------------------- |
|
4118 // |
|
4119 TInt CMPXPodcastCollectionViewImp::CheckPodcastAppL() |
|
4120 { |
|
4121 MPX_FUNC("CMPXPodcastCollectionViewImp::CheckPodcastAppL"); |
|
4122 |
|
4123 TApaAppInfo appInfo; |
|
4124 RApaLsSession session; |
|
4125 User::LeaveIfError( session.Connect() ); |
|
4126 CleanupClosePushL(session); |
|
4127 // Check Nokia Podcasting Application |
|
4128 TInt err = session.GetAppInfo(appInfo, KNPodAppUid); |
|
4129 CleanupStack::PopAndDestroy(); // Close RApaLsSession session |
|
4130 if (err == KErrNone) |
|
4131 { |
|
4132 MPX_DEBUG2("CMPXPodcastCollectionViewImp::CheckPodcastAppL() found %S", &appInfo.iFullName); |
|
4133 } |
|
4134 else if (err == KErrNotFound) |
|
4135 { |
|
4136 MPX_DEBUG1("CMPXPodcastCollectionViewImp::CheckPodcastAppL() Podcast app does not exist"); |
|
4137 } |
|
4138 // else ignore |
|
4139 |
|
4140 return err; |
|
4141 } |
|
4142 |
|
4143 // --------------------------------------------------------------------------- |
|
4144 // Launch Nokia Podcasting Application. |
|
4145 // --------------------------------------------------------------------------- |
|
4146 // |
|
4147 void CMPXPodcastCollectionViewImp::LaunchPodcastAppL() |
|
4148 { |
|
4149 MPX_FUNC("CMPXPodcastCollectionViewImp::LaunchPodcastAppL"); |
|
4150 TApaTaskList tasList(iEikonEnv->WsSession()); |
|
4151 TApaTask task = tasList.FindApp(KNPodAppUid); |
|
4152 |
|
4153 // The check for whether task exists or not is not needed. The reason is that when |
|
4154 // process.create() is called, CAknApplicaiton class will first check if an instance of the |
|
4155 // applicaiton is present. If an instance is present, it will invoke/activate the |
|
4156 // existing application and then exit. |
|
4157 |
|
4158 //if (task.Exists()) |
|
4159 // { |
|
4160 // MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() Podcast app exist"); |
|
4161 // Bring Podcast App to foreground |
|
4162 // task.BringToForeground(); |
|
4163 // } |
|
4164 //else |
|
4165 // { |
|
4166 |
|
4167 // Launch Nokia Podcasting Application |
|
4168 TApaAppInfo appInfo; |
|
4169 RApaLsSession session; |
|
4170 User::LeaveIfError( session.Connect() ); |
|
4171 CleanupClosePushL(session); |
|
4172 TInt err = session.GetAppInfo(appInfo, KNPodAppUid); |
|
4173 if (err == KErrNone) |
|
4174 { |
|
4175 MPX_TRAP(err, |
|
4176 { |
|
4177 CApaCommandLine* commandLine = CApaCommandLine::NewLC(); |
|
4178 commandLine->SetDocumentNameL(KNullDesC); |
|
4179 commandLine->SetExecutableNameL(appInfo.iFullName); |
|
4180 session.StartApp(*commandLine); |
|
4181 CleanupStack::PopAndDestroy(); |
|
4182 }); |
|
4183 } |
|
4184 CleanupStack::PopAndDestroy(); // Close RApaLsSession session |
|
4185 // } |
|
4186 } |
|
4187 |
|
4188 // --------------------------------------------------------------------------- |
|
4189 // Helper method that checks to see if the specified item is currently playing |
|
4190 // --------------------------------------------------------------------------- |
|
4191 // |
|
4192 TBool CMPXPodcastCollectionViewImp::IsCurrentlyPlayingL(const TMPXItemId& aItem) |
|
4193 { |
|
4194 MPX_FUNC("CMPXPodcastCollectionViewImp::IsCurrentlyPlaying"); |
|
4195 |
|
4196 TBool currentlyPlaying(EFalse); |
|
4197 |
|
4198 if ( (iPlaybackUtility->StateL() == EPbStatePlaying || |
|
4199 iPlaybackUtility->StateL() == EPbStatePaused) && |
|
4200 iContainer ) |
|
4201 { |
|
4202 MMPXSource* source( iPlaybackUtility->Source() ); |
|
4203 if ( source ) |
|
4204 { |
|
4205 CMPXCollectionPlaylist* playlist( source->PlaylistL() ); |
|
4206 if ( playlist ) |
|
4207 { |
|
4208 CleanupStack::PushL( playlist ); |
|
4209 CMPXCollectionPath* pbPath( |
|
4210 CMPXCollectionPath::NewL( playlist->Path() ) ); |
|
4211 CleanupStack::PushL( pbPath ); |
|
4212 |
|
4213 if (aItem == pbPath->IdOfIndex( playlist->Index() ) ) |
|
4214 { |
|
4215 currentlyPlaying = ETrue; |
|
4216 } |
|
4217 CleanupStack::PopAndDestroy( pbPath ); |
|
4218 CleanupStack::PopAndDestroy( playlist ); |
|
4219 } |
|
4220 } |
|
4221 } |
|
4222 return currentlyPlaying; |
|
4223 } |
|
4224 |
|
4225 // ----------------------------------------------------------------------------- |
|
4226 // CMPXPodcastCollectionViewImp::HandleViewActivation |
|
4227 // Handle view activation |
|
4228 // ----------------------------------------------------------------------------- |
|
4229 // |
|
4230 void CMPXPodcastCollectionViewImp::HandleViewActivation( |
|
4231 const TUid& aCurrentViewType, |
|
4232 const TUid& /*aPreviousViewType*/ ) |
|
4233 { |
|
4234 MPX_FUNC( "CMPXPodcastCollectionViewImp::HandleViewActivation" ); |
|
4235 if ( aCurrentViewType.iUid == KMPXPluginTypeCollectionUid ) |
|
4236 { |
|
4237 TRAP_IGNORE( UpdateNaviPaneL() ); |
|
4238 } |
|
4239 } |
|
4240 |
|
4241 // ----------------------------------------------------------------------------- |
|
4242 // CMPXPodcastCollectionViewImp::HandleViewActivation |
|
4243 // ----------------------------------------------------------------------------- |
|
4244 // |
|
4245 void CMPXPodcastCollectionViewImp::HandleViewActivation( |
|
4246 const TVwsViewId& aNewlyActivatedViewId, |
|
4247 const TVwsViewId& /*aViewIdToBeDeactivated */) |
|
4248 { |
|
4249 if( aNewlyActivatedViewId.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) && |
|
4250 aNewlyActivatedViewId.iViewUid == Id() ) |
|
4251 { |
|
4252 TRAP_IGNORE( UpdateNaviPaneL() ); |
|
4253 } |
|
4254 } |
|
4255 |
|
4256 // ----------------------------------------------------------------------------- |
|
4257 // CMPXPodcastCollectionViewImp::HandleViewDeactivation |
|
4258 // ----------------------------------------------------------------------------- |
|
4259 // |
|
4260 void CMPXPodcastCollectionViewImp::HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated, |
|
4261 const TVwsViewId& /*aNewlyActivatedViewId*/) |
|
4262 { |
|
4263 if( aViewIdToBeDeactivated.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) && |
|
4264 aViewIdToBeDeactivated.iViewUid == Id() ) |
|
4265 { |
|
4266 if( iContainer ) |
|
4267 { |
|
4268 if ( iNaviPane && iNaviDecorator ) |
|
4269 { |
|
4270 iNaviPane->Pop( iNaviDecorator ); |
|
4271 } |
|
4272 } |
|
4273 } |
|
4274 } |
|
4275 |
|
4276 // ----------------------------------------------------------------------------- |
|
4277 // CMPXPodcastCollectionViewImp::SetPlayedStatusL |
|
4278 // ----------------------------------------------------------------------------- |
|
4279 // |
|
4280 void CMPXPodcastCollectionViewImp::SetPlayedStatusL( TBool aPlayed ) |
|
4281 { |
|
4282 MPX_FUNC( "CMPXPodcastCollectionViewImp::SetPlayedStatus" ); |
|
4283 |
|
4284 const CArrayFix<TInt>* array = |
|
4285 iContainer->Common()->CurrentSelectionIndicesL(); |
|
4286 TInt arrayCount = array->Count(); |
|
4287 |
|
4288 CMPXCommonListBoxArrayBase* listboxArray = |
|
4289 iContainer->Common()->ListBoxArray(); |
|
4290 |
|
4291 TMPXGeneralType type = EMPXNoType; |
|
4292 TMPXGeneralCategory category = EMPXNoCategory; |
|
4293 |
|
4294 if (arrayCount > 0) |
|
4295 { |
|
4296 CMPXMediaArray* setArray( CMPXMediaArray::NewL() ); |
|
4297 CleanupStack::PushL( setArray ); |
|
4298 |
|
4299 // playback needs to be stopped only once |
|
4300 TBool checkIfPlaying(ETrue); |
|
4301 |
|
4302 // iterate through and toggle the episode state for each selection |
|
4303 for (TInt i = 0; i < arrayCount; i++) |
|
4304 { |
|
4305 /*CMPXPodcastCollectionViewListBoxArray* podcastArray = |
|
4306 static_cast<CMPXPodcastCollectionViewListBoxArray*>(listboxArray); |
|
4307 TBool isInvalid = podcastArray->IsItemBrokenLinkL(array->At(i)); |
|
4308 TBool isCorrupted = podcastArray->IsItemCorruptedL(array->At(i)); |
|
4309 |
|
4310 if ( !isInvalid && !isCorrupted ) |
|
4311 {*/ |
|
4312 CMPXMedia* currentSelectedMedia = |
|
4313 CMPXMedia::NewL(listboxArray->MediaL(array->At(i))); |
|
4314 CleanupStack::PushL(currentSelectedMedia); |
|
4315 |
|
4316 if (currentSelectedMedia->IsSupported(KMPXMediaGeneralType)) |
|
4317 { |
|
4318 type = |
|
4319 currentSelectedMedia->ValueTObjectL<TMPXGeneralType>( |
|
4320 KMPXMediaGeneralType); |
|
4321 } |
|
4322 if (currentSelectedMedia->IsSupported(KMPXMediaGeneralCategory)) |
|
4323 { |
|
4324 category = |
|
4325 currentSelectedMedia->ValueTObjectL<TMPXGeneralCategory>( |
|
4326 KMPXMediaGeneralCategory); |
|
4327 } |
|
4328 |
|
4329 if (( type == EMPXItem ) && ( category == EMPXPodcast )) |
|
4330 { |
|
4331 TUint32 playCount = aPlayed; |
|
4332 TInt lastPlayPos = 0; |
|
4333 |
|
4334 if ( checkIfPlaying && |
|
4335 currentSelectedMedia->IsSupported(KMPXMediaGeneralId) && |
|
4336 IsCurrentlyPlayingL( |
|
4337 currentSelectedMedia->ValueTObjectL<TMPXItemId>( |
|
4338 KMPXMediaGeneralId))) |
|
4339 { |
|
4340 iPlaybackUtility->CommandL(EPbCmdStop); |
|
4341 checkIfPlaying = EFalse; |
|
4342 |
|
4343 // save off a copy of the media so Set can |
|
4344 // be run after EPbCmdStop returns |
|
4345 if(iMediaToSet) |
|
4346 { |
|
4347 delete iMediaToSet; |
|
4348 iMediaToSet = NULL; |
|
4349 } |
|
4350 |
|
4351 iMediaToSet = CMPXMedia::NewL(); |
|
4352 iMediaToSet->SetTObjectValueL( KMPXMediaGeneralType, |
|
4353 EMPXItem ); |
|
4354 iMediaToSet->SetTObjectValueL( KMPXMediaGeneralCategory, |
|
4355 EMPXPodcast); |
|
4356 iMediaToSet->SetTObjectValueL( KMPXMediaGeneralCollectionId, |
|
4357 currentSelectedMedia->ValueTObjectL<TUid>( |
|
4358 KMPXMediaGeneralCollectionId)); |
|
4359 iMediaToSet->SetTObjectValueL( KMPXMediaGeneralId, |
|
4360 currentSelectedMedia->ValueTObjectL<TMPXItemId>( |
|
4361 KMPXMediaGeneralId)); |
|
4362 |
|
4363 iMediaToSet->SetTObjectValueL<TUint32> ( |
|
4364 KMPXMediaGeneralPlayCount, playCount); |
|
4365 iMediaToSet->SetTObjectValueL ( |
|
4366 KMPXMediaGeneralLastPlaybackPosition, lastPlayPos); |
|
4367 iMediaToSet->SetTObjectValueL<TBool> ( |
|
4368 KMPXMediaPodcastIsPlaying, EFalse); |
|
4369 } |
|
4370 else |
|
4371 { |
|
4372 currentSelectedMedia->SetTObjectValueL<TUint32> ( |
|
4373 KMPXMediaGeneralPlayCount, playCount); |
|
4374 currentSelectedMedia->SetTObjectValueL ( |
|
4375 KMPXMediaGeneralLastPlaybackPosition, lastPlayPos); |
|
4376 currentSelectedMedia->SetTObjectValueL<TBool> ( |
|
4377 KMPXMediaPodcastIsPlaying, EFalse); |
|
4378 |
|
4379 setArray->AppendL( *currentSelectedMedia ); |
|
4380 //DoSetCollectionL( currentSelectedMedia, ETrue ); |
|
4381 } |
|
4382 } |
|
4383 |
|
4384 CleanupStack::PopAndDestroy(currentSelectedMedia); |
|
4385 /*}*/ |
|
4386 } |
|
4387 |
|
4388 if( setArray->Count() > 0 ) |
|
4389 { |
|
4390 CMPXMedia* groupMedia( CMPXMedia::NewL() ); |
|
4391 CleanupStack::PushL( groupMedia ); |
|
4392 groupMedia->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup); |
|
4393 groupMedia->SetCObjectValueL<CMPXMediaArray>(KMPXMediaArrayContents, setArray ); |
|
4394 CMPXMedia* first( setArray->AtL( 0 ) ); |
|
4395 TUid colId( first->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId) ); |
|
4396 groupMedia->SetTObjectValueL<TUid>( KMPXMediaGeneralCollectionId, colId ); |
|
4397 DoSetCollectionL( groupMedia, EFalse ); |
|
4398 CleanupStack::PopAndDestroy( groupMedia ); |
|
4399 } |
|
4400 CleanupStack::PopAndDestroy( setArray ); |
|
4401 } |
|
4402 else |
|
4403 { |
|
4404 TInt currentIndex = iContainer->Common()->CurrentLbxItemIndex(); |
|
4405 CMPXMedia* currentSelectedMedia = |
|
4406 CMPXMedia::NewL(listboxArray->MediaL(currentIndex)); |
|
4407 CleanupStack::PushL(currentSelectedMedia); |
|
4408 |
|
4409 if (currentSelectedMedia->IsSupported(KMPXMediaGeneralType)) |
|
4410 { |
|
4411 type = |
|
4412 currentSelectedMedia->ValueTObjectL<TMPXGeneralType>( |
|
4413 KMPXMediaGeneralType); |
|
4414 } |
|
4415 if (currentSelectedMedia->IsSupported(KMPXMediaGeneralCategory)) |
|
4416 { |
|
4417 category = |
|
4418 currentSelectedMedia->ValueTObjectL<TMPXGeneralCategory>( |
|
4419 KMPXMediaGeneralCategory); |
|
4420 } |
|
4421 |
|
4422 if ((type == EMPXItem) && (category == EMPXPodcast)) |
|
4423 { |
|
4424 TUint32 playCount = aPlayed; |
|
4425 TInt lastPlayPos = 0; |
|
4426 |
|
4427 if ( currentSelectedMedia->IsSupported(KMPXMediaGeneralId) && |
|
4428 IsCurrentlyPlayingL( |
|
4429 currentSelectedMedia->ValueTObjectL<TMPXItemId>( |
|
4430 KMPXMediaGeneralId)) ) |
|
4431 { |
|
4432 iPlaybackUtility->CommandL(EPbCmdStop); |
|
4433 |
|
4434 // save off a copy of the media so Set can |
|
4435 // be run after EPbCmdStop returns |
|
4436 if(iMediaToSet) |
|
4437 { |
|
4438 delete iMediaToSet; |
|
4439 iMediaToSet = NULL; |
|
4440 } |
|
4441 |
|
4442 iMediaToSet = CMPXMedia::NewL(); |
|
4443 iMediaToSet->SetTObjectValueL( KMPXMediaGeneralType, |
|
4444 EMPXItem ); |
|
4445 iMediaToSet->SetTObjectValueL( KMPXMediaGeneralCategory, |
|
4446 EMPXPodcast); |
|
4447 iMediaToSet->SetTObjectValueL( KMPXMediaGeneralCollectionId, |
|
4448 currentSelectedMedia->ValueTObjectL<TUid>( |
|
4449 KMPXMediaGeneralCollectionId)); |
|
4450 iMediaToSet->SetTObjectValueL( KMPXMediaGeneralId, |
|
4451 currentSelectedMedia->ValueTObjectL<TMPXItemId>( |
|
4452 KMPXMediaGeneralId)); |
|
4453 |
|
4454 iMediaToSet->SetTObjectValueL<TUint32> ( |
|
4455 KMPXMediaGeneralPlayCount, playCount); |
|
4456 iMediaToSet->SetTObjectValueL ( |
|
4457 KMPXMediaGeneralLastPlaybackPosition, lastPlayPos); |
|
4458 iMediaToSet->SetTObjectValueL<TBool> ( |
|
4459 KMPXMediaPodcastIsPlaying, EFalse); |
|
4460 } |
|
4461 else |
|
4462 { |
|
4463 currentSelectedMedia->SetTObjectValueL<TUint32> ( |
|
4464 KMPXMediaGeneralPlayCount, playCount); |
|
4465 currentSelectedMedia->SetTObjectValueL ( |
|
4466 KMPXMediaGeneralLastPlaybackPosition, lastPlayPos); |
|
4467 currentSelectedMedia->SetTObjectValueL<TBool> ( |
|
4468 KMPXMediaPodcastIsPlaying, EFalse); |
|
4469 |
|
4470 DoSetCollectionL( currentSelectedMedia, EFalse ); |
|
4471 } |
|
4472 } |
|
4473 CleanupStack::PopAndDestroy(currentSelectedMedia); |
|
4474 } |
|
4475 |
|
4476 // Clear selection |
|
4477 if(iContainer) |
|
4478 { |
|
4479 iContainer->Common()->ClearLbxSelection(); |
|
4480 } |
|
4481 } |
|
4482 |
|
4483 // ----------------------------------------------------------------------------- |
|
4484 // CMPXPodcastCollectionViewImp::StoreListboxItemIndexL |
|
4485 // ----------------------------------------------------------------------------- |
|
4486 // |
|
4487 void CMPXPodcastCollectionViewImp::StoreListboxItemIndexL() |
|
4488 { |
|
4489 TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() ); |
|
4490 |
|
4491 CMPXCommand* command = CMPXCommand::NewL(); |
|
4492 CleanupStack::PushL( command ); |
|
4493 command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId, |
|
4494 KMPXCommandIdCollectionSelect ); |
|
4495 command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex ); |
|
4496 command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
4497 iCollectionUtility->Collection().CommandL( *command ); |
|
4498 CleanupStack::PopAndDestroy( command ); |
|
4499 } |
|
4500 |
|
4501 // End of File |