author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:28:40 +0300 | |
branch | RCL_3 |
changeset 66 | 1f1dad4af8f8 |
parent 53 | 3de6c4cf6b67 |
permissions | -rw-r--r-- |
53 | 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: Music Player metadata editor dialog implementation |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include <eikmenub.h> |
|
21 |
#include <eikcapc.h> |
|
22 |
#include <eikdialg.h> // for dialog functions |
|
23 |
#include <eikedwin.h> // for edwins |
|
24 |
#include <eikmfne.h> // for number editor |
|
25 |
#include <AknPopupFieldText.h> |
|
26 |
#include <AknQueryValueText.h> |
|
27 |
#include <aknappui.h> |
|
28 |
#include <eikspane.h> // for status pane update/restore |
|
29 |
#include <akntitle.h> // for title pane |
|
30 |
#include <aknnavilabel.h> // for navi label |
|
31 |
#include <aknnavi.h> |
|
32 |
#include <aknnavide.h> |
|
33 |
#include <StringLoader.h> |
|
34 |
#include <aknnotewrappers.h> |
|
35 |
#include <aknlists.h> |
|
36 |
#include <aknclearer.h> |
|
37 |
#include <hlplch.h> |
|
38 |
#include <bautils.h> |
|
39 |
#include <data_caging_path_literals.hrh> |
|
40 |
#include <drmrightsmanager.rsg> |
|
41 |
#include <centralrepository.h> // for podcasting cenrep key |
|
42 |
#include <tz.h> |
|
43 |
||
44 |
#include <aknSDData.h> |
|
45 |
#include <AknMediatorFacade.h> |
|
46 |
#include <mplayersecondarydisplayapi.h> |
|
47 |
#include <aknEditStateIndicator.h> |
|
48 |
#include <AknIndicatorContainer.h> |
|
49 |
#include <avkon.hrh> |
|
50 |
#include <avkon.rsg> |
|
51 |
#include <mpxmetadataeditordialog.rsg> |
|
52 |
#include <mpxcollectionutility.h> |
|
53 |
#include <mpxmedia.h> |
|
54 |
#include <mpxmediaarray.h> |
|
55 |
#include <mpxmediamusicdefs.h> |
|
56 |
#include <mpxmediaaudiodefs.h> |
|
57 |
#include <mpxmediacontainerdefs.h> |
|
58 |
#include <mpxmediadrmdefs.h> |
|
59 |
#include <mpxpodcastdefs.h> |
|
60 |
#include <mpxcommandgeneraldefs.h> |
|
61 |
#include <mpxcollectioncommanddefs.h> |
|
62 |
||
63 |
#include <mpxcollectionframeworkdefs.h> |
|
64 |
#include <mpxcollectionmessage.h> |
|
65 |
#include <mpxcollectionpath.h> |
|
66 |
#include <mpxcollectionplaylist.h> |
|
67 |
#include <mpxconstants.h> |
|
68 |
#include <mpxcollectionhelperfactory.h> |
|
69 |
#include <mpxcollectionplugin.hrh> |
|
70 |
#include <mpxinternalcrkeys.h> |
|
71 |
#include <mpxuser.h> |
|
72 |
#include "mpxcommonuihelper.h" |
|
73 |
#include "mpxmetadataeditordialog.h" |
|
74 |
#include "mpxmetadataeditordialog.hrh" |
|
75 |
#include "mpxmetadataeditordialog.hlp.hrh" |
|
76 |
#include "mpxlog.h" |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
77 |
#include <drmuihandling.h> |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
78 |
#include <mpxplaybackutility.h> |
53 | 79 |
|
80 |
// CONSTANTS |
|
81 |
const TInt KMPXFileDetailsMaxTitleLen = 32; |
|
82 |
const TInt KMPXFileDetailsMaxBufferLen = 255; |
|
83 |
const TInt KMPXMinNumDateTrack = 0; |
|
84 |
const TInt KMPXFileDetailsExtraBufferLen = 10; |
|
85 |
||
86 |
const TInt KMPXMaxTimeLength = 36; |
|
87 |
const TInt KMPXMaxVal = 512; |
|
88 |
const TInt KMPXOneDigit = 10; |
|
89 |
const TInt KMPXTwoDigits = 100; |
|
90 |
||
91 |
const TInt KMPXBitrateFactor = 1000; |
|
92 |
const TInt KSecondInMilliseconds = 1000; |
|
93 |
const TInt KOneHourInSeconds = 3600; |
|
94 |
||
95 |
||
96 |
||
97 |
const TInt KDigitFive = 5; |
|
98 |
const TInt KDigitNine = 9; |
|
99 |
const TInt KDigitTen = 10; |
|
100 |
const TInt KDigitEleven = 11; |
|
101 |
const TInt KDigitFourTeen = 14; |
|
102 |
const TInt KDigitHundred = 100; |
|
103 |
||
104 |
const TInt KMaxDaysInOneMonths = 31; |
|
105 |
const TInt KMaxDaysInTwoMonths = 62; |
|
106 |
const TInt KMaxDaysInThreeMonths = 92; |
|
107 |
const TInt KMaxDaysInFourMonths = 123; |
|
108 |
const TInt KMaxDaysInFiveMonths = 153; |
|
109 |
const TInt KMaxDaysInSixMonths = 184; |
|
110 |
const TInt KMaxDaysInSevenMonths= 215; |
|
111 |
const TInt KMaxDaysInEightMonths = 245; |
|
112 |
const TInt KMaxDaysInNineMonths = 276; |
|
113 |
const TInt KMaxDaysInTenMonths = 306; |
|
114 |
const TInt KMaxDaysInElevenMonths = 337; |
|
115 |
const TInt KMaxDaysInTwelveMonths = 366; |
|
116 |
||
117 |
// MACROS |
|
118 |
_LIT( KMPXMetadataEditorRscPath, "mpxmetadataeditordialog.rsc" ); |
|
119 |
_LIT( KMPXDrmManagerRscPath, "drmrightsmanager.rsc" ); |
|
120 |
_LIT( KMPXSpace, " "); |
|
121 |
||
122 |
const TInt KMPXDurationDisplayResvLen( 10 ); |
|
123 |
const TInt64 KSecondInMicroSeconds( 1000000 ); |
|
124 |
||
125 |
// FUNCTION PROTOTYPES |
|
126 |
||
127 |
// ============================ MEMBER FUNCTIONS =============================== |
|
128 |
||
129 |
// ---------------------------------------------------------------------------- |
|
130 |
// CMPXQueryDialog::NewL |
|
131 |
// Two-phased constructor. |
|
132 |
// ---------------------------------------------------------------------------- |
|
133 |
// |
|
134 |
CMPXQueryDialog* CMPXQueryDialog::NewL() |
|
135 |
{ |
|
136 |
CMPXQueryDialog* self = new (ELeave) CMPXQueryDialog(); |
|
137 |
return self; |
|
138 |
} |
|
139 |
||
140 |
// ---------------------------------------------------------------------------- |
|
141 |
// CMPXQueryDialog::OfferKeyEventL |
|
142 |
// Keyevent handler. |
|
143 |
// ---------------------------------------------------------------------------- |
|
144 |
// |
|
145 |
TKeyResponse CMPXQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) |
|
146 |
{ |
|
147 |
// exit from query dialog whever lost forground, currently implementing by mornitor |
|
148 |
// application key and end key |
|
149 |
if (( aKeyEvent.iScanCode == EStdKeyNo || |
|
150 |
aKeyEvent.iScanCode == EStdKeyApplication0 && |
|
151 |
aType == EEventKey ) || |
|
152 |
( aKeyEvent.iScanCode == EStdKeyApplication6 && |
|
153 |
aType == EEventKeyDown )) |
|
154 |
{ |
|
155 |
TryExitL(EEikBidCancel); |
|
156 |
return EKeyWasNotConsumed; |
|
157 |
} |
|
158 |
else |
|
159 |
{ |
|
160 |
return CAknQueryDialog::OfferKeyEventL( aKeyEvent,aType ); |
|
161 |
} |
|
162 |
} |
|
163 |
||
164 |
// ---------------------------------------------------------------------------- |
|
165 |
// CMPXMetadataEditorDialog::NewL |
|
166 |
// Two-phased constructor. |
|
167 |
// ---------------------------------------------------------------------------- |
|
168 |
// |
|
169 |
EXPORT_C CMPXMetadataEditorDialog* CMPXMetadataEditorDialog::NewL() |
|
170 |
{ |
|
171 |
MPX_FUNC( "CMPXMetadataEditorDialog::NewL" ); |
|
172 |
CMPXMetadataEditorDialog* self = |
|
173 |
new (ELeave) CMPXMetadataEditorDialog(); |
|
174 |
CleanupStack::PushL(self); |
|
175 |
self->ConstructL(); |
|
176 |
CleanupStack::Pop(); |
|
177 |
return self; |
|
178 |
} |
|
179 |
||
180 |
// ---------------------------------------------------------------------------- |
|
181 |
// CMPXMetadataEditorDialog::~CMPXMetadataEditorDialog |
|
182 |
// Destructor. |
|
183 |
// ---------------------------------------------------------------------------- |
|
184 |
// |
|
185 |
EXPORT_C CMPXMetadataEditorDialog::~CMPXMetadataEditorDialog() |
|
186 |
{ |
|
187 |
MPX_FUNC( "CMPXMetadataEditorDialog::~CMPXMetadataEditorDialog" ); |
|
188 |
delete iEmptyNaviDecorator; |
|
189 |
delete iTitlePaneText; |
|
190 |
delete iCommonUiHelper; |
|
191 |
delete iParam; |
|
192 |
delete iIdle; |
|
193 |
delete iDrmInfo; |
|
194 |
if ( iPlaybackUtility ) |
|
195 |
{ |
|
196 |
iPlaybackUtility->CancelRequest(); |
|
197 |
iPlaybackUtility->Close(); |
|
198 |
} |
|
199 |
if ( iCollectionUtility ) |
|
200 |
{ |
|
201 |
iCollectionUtility->Close(); |
|
202 |
} |
|
203 |
if ( iCollectionUiHelper ) |
|
204 |
{ |
|
205 |
iCollectionUiHelper->Close(); |
|
206 |
} |
|
207 |
if ( iMedia ) |
|
208 |
{ |
|
209 |
delete iMedia; |
|
210 |
} |
|
211 |
if ( iTextValues ) |
|
212 |
{ |
|
213 |
delete iTextValues; |
|
214 |
} |
|
215 |
if ( iValueTextArray ) |
|
216 |
{ |
|
217 |
delete iValueTextArray; |
|
218 |
} |
|
219 |
if ( iGenreArr ) |
|
220 |
{ |
|
221 |
delete iGenreArr; |
|
222 |
} |
|
223 |
if ( iLibraryTextValues ) |
|
224 |
{ |
|
225 |
delete iLibraryTextValues; |
|
226 |
} |
|
227 |
if ( iLibraryValueTextArray ) |
|
228 |
{ |
|
229 |
delete iLibraryValueTextArray; |
|
230 |
} |
|
231 |
if ( iLibraryArr ) |
|
232 |
{ |
|
233 |
delete iLibraryArr; |
|
234 |
} |
|
235 |
if ( iResourceOffset ) |
|
236 |
{ |
|
237 |
iEikonEnv->DeleteResourceFile( iResourceOffset ); |
|
238 |
} |
|
239 |
if ( iDrmResourceOffset ) |
|
240 |
{ |
|
241 |
iEikonEnv->DeleteResourceFile( iDrmResourceOffset ); |
|
242 |
} |
|
243 |
if(iDrmUiHandler) |
|
244 |
{ |
|
245 |
delete iDrmUiHandler; |
|
246 |
} |
|
247 |
} |
|
248 |
||
249 |
// ---------------------------------------------------------------------------- |
|
250 |
// CMPXMetadataEditorDialog::SetParamL |
|
251 |
// parameter passed in from viewframework |
|
252 |
// ---------------------------------------------------------------------------- |
|
253 |
// |
|
254 |
EXPORT_C void CMPXMetadataEditorDialog::SetParamL( const TDesC* aParam ) |
|
255 |
{ |
|
256 |
MPX_FUNC( "CMPXMetadataEditorDialog::SetParamL" ); |
|
257 |
delete iParam; |
|
258 |
iParam = NULL; |
|
259 |
iParam = aParam->AllocL(); |
|
260 |
} |
|
261 |
||
262 |
// ----------------------------------------------------------------------------- |
|
263 |
// CMPXMetadataEditorDialog::OkToExitL |
|
264 |
// This function ALWAYS returns ETrue |
|
265 |
// ----------------------------------------------------------------------------- |
|
266 |
// |
|
267 |
TBool CMPXMetadataEditorDialog::OkToExitL(TInt aButtonId) |
|
268 |
{ |
|
269 |
MPX_FUNC( "CMPXMetadataEditorDialog::OkToExitL" ); |
|
270 |
TBool res = EFalse; |
|
271 |
||
272 |
switch ( aButtonId ) |
|
273 |
{ |
|
274 |
case EAknSoftkeyDone: |
|
275 |
{ |
|
276 |
SaveFormDataL(); |
|
277 |
RestoreNaviLabelL(); |
|
278 |
RestoreTitlePaneL(); |
|
279 |
res = ETrue; |
|
280 |
break; |
|
281 |
} |
|
282 |
case EAknSoftkeyBack: |
|
283 |
case EAknSoftkeyExit: |
|
284 |
{ |
|
285 |
RestoreNaviLabelL(); |
|
286 |
RestoreTitlePaneL(); |
|
287 |
res = ETrue; |
|
288 |
break; |
|
289 |
} |
|
290 |
case EAknSoftkeyOptions: |
|
291 |
default: |
|
292 |
{ |
|
293 |
// display the options menu |
|
294 |
res = CAknForm::OkToExitL( aButtonId ); |
|
295 |
break; |
|
296 |
} |
|
297 |
} |
|
298 |
return res; |
|
299 |
} |
|
300 |
||
301 |
// ----------------------------------------------------------------------------- |
|
302 |
// CMPXMetadataEditorDialog::ExecuteLD |
|
303 |
// ----------------------------------------------------------------------------- |
|
304 |
// |
|
305 |
TInt CMPXMetadataEditorDialog::ExecuteLD( TInt /*aResourceId*/ ) |
|
306 |
{ |
|
307 |
MPX_FUNC( "CMPXMetadataEditorDialog::ExecuteLD" ); |
|
308 |
TInt resId = R_MPX_CUI_SONG_DETAILS_DIALOG; |
|
309 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast ) |
|
310 |
{ |
|
311 |
resId = R_MPX_CUI_PODCAST_DETAILS_DIALOG; |
|
312 |
} |
|
313 |
else if( iDisablePodcasting ) |
|
314 |
{ |
|
315 |
resId = R_MPX_CUI_SONG_DETAILS_DIALOG_NO_MOVE_LIBRARY; |
|
316 |
} |
|
317 |
return CAknForm::ExecuteLD( resId ); |
|
318 |
} |
|
319 |
||
320 |
// ----------------------------------------------------------------------------- |
|
321 |
// CMPXMetadataEditorDialog::ViewFileDetailsPopupL |
|
322 |
// Display file details popup window |
|
323 |
// ----------------------------------------------------------------------------- |
|
324 |
// |
|
325 |
void CMPXMetadataEditorDialog::ViewFileDetailsPopupL() |
|
326 |
{ |
|
327 |
MPX_FUNC( "CMPXMetadataEditorDialog::ViewFileDetailsPopupL" ); |
|
328 |
CAknDoublePopupMenuStyleListBox* listBox = |
|
329 |
new (ELeave) CAknDoublePopupMenuStyleListBox(); |
|
330 |
CleanupStack::PushL( listBox ); |
|
331 |
CAknPopupList* popupList = CAknPopupList::NewL( |
|
332 |
listBox, |
|
333 |
R_AVKON_SOFTKEYS_OK_EMPTY, |
|
334 |
AknPopupLayouts::EMenuDoubleWindow ); |
|
335 |
CleanupStack::PushL( popupList ); |
|
336 |
||
337 |
listBox->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); |
|
338 |
listBox->CreateScrollBarFrameL( ETrue ); |
|
339 |
listBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
340 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
341 |
||
342 |
// Enable Marquee |
|
343 |
static_cast<CEikFormattedCellListBox*> |
|
344 |
( listBox )->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
|
345 |
||
346 |
// Retrieve heading array |
|
347 |
CDesCArrayFlat* headingsArray = NULL; |
|
348 |
TInt itemCount = 0; |
|
349 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection ) |
|
350 |
{ |
|
351 |
headingsArray = iCoeEnv->ReadDesCArrayResourceL( |
|
352 |
R_MPX_CUI_FD_HEADINGS_SONGS ); |
|
353 |
itemCount = EMPXSongsFileDetailsHeadingCount; |
|
354 |
} |
|
355 |
else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast ) |
|
356 |
{ |
|
357 |
headingsArray = iCoeEnv->ReadDesCArrayResourceL( |
|
358 |
R_MPX_CUI_FD_HEADINGS_PODCASTS ); |
|
359 |
itemCount = EMPXPodcastsFileDetailsHeadingCount; |
|
360 |
} |
|
361 |
else |
|
362 |
{ |
|
363 |
User::Leave( KErrArgument ); |
|
364 |
} |
|
365 |
CleanupStack::PushL( headingsArray ); |
|
366 |
||
367 |
CAknLocalScreenClearer* clearer = CAknLocalScreenClearer::NewLC( EFalse ); |
|
368 |
CDesCArray* itemArray = |
|
369 |
static_cast<CDesCArray*>( listBox->Model()->ItemTextArray() ); |
|
370 |
CDesCArrayFlat* dataArray = |
|
371 |
new ( ELeave ) CDesCArrayFlat( itemCount ); |
|
372 |
CleanupStack::PushL( dataArray ); |
|
373 |
||
374 |
if ( iMedia ) |
|
375 |
{ |
|
376 |
PopulateFileDetailsL( headingsArray, dataArray ); |
|
377 |
// item count might have been updated due to addition of |
|
378 |
// DRM content details |
|
379 |
itemCount = headingsArray->MdcaCount(); |
|
380 |
} |
|
381 |
else |
|
382 |
{ |
|
383 |
// properties not available |
|
384 |
for ( TInt i = 0; i < itemCount; i++ ) |
|
385 |
{ |
|
386 |
dataArray->AppendL( KNullDesC ); |
|
387 |
} |
|
388 |
} |
|
389 |
||
390 |
for ( TInt i = 0; i < itemCount; i++ ) |
|
391 |
{ |
|
392 |
AddItemToListBoxL( headingsArray->MdcaPoint( i ), dataArray->MdcaPoint( i ), itemArray ); |
|
393 |
} |
|
394 |
CleanupStack::PopAndDestroy( dataArray ); |
|
395 |
CleanupStack::PopAndDestroy( clearer ); |
|
396 |
CleanupStack::PopAndDestroy( headingsArray ); |
|
397 |
||
398 |
// Set title |
|
399 |
TBuf<KMPXFileDetailsMaxTitleLen> title; |
|
400 |
iCoeEnv->ReadResourceL( title, R_MPX_CUI_FD_TITLE ); |
|
401 |
popupList->SetTitleL( title ); |
|
402 |
||
403 |
// Show popup list |
|
404 |
popupList->ExecuteLD(); |
|
405 |
CleanupStack::Pop(); |
|
406 |
CleanupStack::PopAndDestroy( listBox ); |
|
407 |
} |
|
408 |
||
409 |
// --------------------------------------------------------------------------- |
|
410 |
// From MMPXCollectionObserver |
|
411 |
// Handle collection message. |
|
412 |
// --------------------------------------------------------------------------- |
|
413 |
// |
|
414 |
void CMPXMetadataEditorDialog::HandleCollectionMessage( |
|
415 |
CMPXMessage* /*aMessage*/, TInt /*aError*/ ) |
|
416 |
{ |
|
417 |
// do nothing |
|
418 |
} |
|
419 |
||
420 |
// --------------------------------------------------------------------------- |
|
421 |
// From MMPXCollectionObserver |
|
422 |
// Handles the collection entries being opened. Typically called |
|
423 |
// when client has Open()'d a folder |
|
424 |
// --------------------------------------------------------------------------- |
|
425 |
// |
|
426 |
void CMPXMetadataEditorDialog::HandleOpenL( |
|
427 |
const CMPXMedia& /*aEntries*/, |
|
428 |
TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ ) |
|
429 |
{ |
|
430 |
// do nothing |
|
431 |
} |
|
432 |
||
433 |
// --------------------------------------------------------------------------- |
|
434 |
// From MMPXCollectionObserver |
|
435 |
// Handles the item being opened. Typically called |
|
436 |
// when client has Open()'d an item. Client typically responds by |
|
437 |
// 'playing' the item via the playlist |
|
438 |
// --------------------------------------------------------------------------- |
|
439 |
// |
|
440 |
void CMPXMetadataEditorDialog::HandleOpenL( |
|
441 |
const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ ) |
|
442 |
{ |
|
443 |
// do nothing |
|
444 |
} |
|
445 |
||
446 |
// --------------------------------------------------------------------------- |
|
447 |
// From MMPXCollectionObserver |
|
448 |
// Handle media properties. |
|
449 |
// Notes: The client is responsible for delete the object of aMedia. |
|
450 |
// --------------------------------------------------------------------------- |
|
451 |
// |
|
452 |
void CMPXMetadataEditorDialog::HandleCollectionMediaL( |
|
453 |
const CMPXMedia& aMedia, |
|
454 |
TInt aError ) |
|
455 |
{ |
|
456 |
MPX_FUNC( "CMPXMetadataEditorDialog::HandleCollectionMediaL" ); |
|
457 |
TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) ); |
|
458 |
} |
|
459 |
||
460 |
// ---------------------------------------------------------------------------- |
|
461 |
// CMPXMetadataEditorDialog::CMPXMetadataEditorDialog |
|
462 |
// C++ default constructor can NOT contain any code, that |
|
463 |
// might leave. |
|
464 |
// ---------------------------------------------------------------------------- |
|
465 |
// |
|
466 |
CMPXMetadataEditorDialog::CMPXMetadataEditorDialog() |
|
467 |
{ |
|
468 |
// do nothing |
|
469 |
} |
|
470 |
||
471 |
// ---------------------------------------------------------------------------- |
|
472 |
// CMPXMetadataEditorDialog::ConstructL |
|
473 |
// Symbian 2nd phase constructor can leave. |
|
474 |
// ---------------------------------------------------------------------------- |
|
475 |
// |
|
476 |
void CMPXMetadataEditorDialog::ConstructL() |
|
477 |
{ |
|
478 |
MPX_FUNC( "CMPXMetadataEditorDialog::ConstructL" ); |
|
479 |
||
480 |
CCoeEnv* coeEnv = iEikonEnv; |
|
481 |
TParse parse; |
|
482 |
parse.Set( KMPXMetadataEditorRscPath, &KDC_APP_RESOURCE_DIR, NULL ); |
|
483 |
TFileName resourceFile( parse.FullName() ); |
|
484 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) ); |
|
485 |
BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile ); |
|
486 |
iResourceOffset = coeEnv->AddResourceFileL( resourceFile ); |
|
487 |
||
488 |
parse.Set( KMPXDrmManagerRscPath, &KDC_APP_RESOURCE_DIR, NULL ); |
|
489 |
TFileName drmResourceFile( parse.FullName() ); |
|
490 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( drmResourceFile ) ); |
|
491 |
BaflUtils::NearestLanguageFile( coeEnv->FsSession(), drmResourceFile ); |
|
492 |
TRAPD(drmResourceError,iDrmResourceOffset = coeEnv->AddResourceFileL( drmResourceFile )); |
|
493 |
iDrmDetails = (drmResourceError == KErrNone) ? ETrue: EFalse; |
|
494 |
||
495 |
iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault ); |
|
496 |
iCommonUiHelper = CMPXCommonUiHelper::NewL(); |
|
497 |
||
498 |
CAknForm::ConstructL( R_MPX_CUI_SONG_DETAILS_MENUBAR ); |
|
499 |
||
500 |
iCurrentLibrary = EMPXMetadataEditorDlgCollection; |
|
501 |
// check if it's podcast collection |
|
502 |
CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
503 |
CleanupStack::PushL( cpath ); |
|
504 |
if ( cpath->Levels() > 0 ) |
|
505 |
{ |
|
506 |
RArray<TUid> ary; |
|
507 |
CleanupClosePushL( ary ); |
|
508 |
ary.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) ); |
|
509 |
TUid podcastUid = iCollectionUtility->CollectionIDL( ary.Array() ); |
|
510 |
CleanupStack::PopAndDestroy( &ary ); |
|
511 |
||
512 |
if ( cpath->Id( 0 ) == podcastUid.iUid ) |
|
513 |
{ |
|
514 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::ConstructL Podcast collection" ); |
|
515 |
iCurrentLibrary = EMPXMetadataEditorDlgPodcast; |
|
516 |
} |
|
517 |
} |
|
518 |
iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL(); |
|
519 |
CleanupStack::PopAndDestroy( cpath ); |
|
520 |
||
521 |
// Get podcasting key |
|
522 |
TInt val(0); |
|
523 |
CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures ); |
|
524 |
repository->Get( KMPXMPLocalVariation, val ); |
|
525 |
iDisablePodcasting = val&KMPXDisablePodcastingOption ? ETrue : EFalse; |
|
526 |
delete repository; |
|
527 |
||
528 |
//DRM information popup |
|
529 |
iDrmUiHandler = DRM::CDrmUiHandling::NewL(); |
|
530 |
} |
|
531 |
||
532 |
// ----------------------------------------------------------------------------- |
|
533 |
// CMPXMetadataEditorDialog::CleanUpGenreText |
|
534 |
// Clean up function for genre related members. |
|
535 |
// ----------------------------------------------------------------------------- |
|
536 |
// |
|
537 |
void CMPXMetadataEditorDialog::CleanUpGenreText() |
|
538 |
{ |
|
539 |
MPX_FUNC( "CMPXMetadataEditorDialog::CleanUpGenreText" ); |
|
540 |
||
541 |
if ( iGenreArr ) |
|
542 |
{ |
|
543 |
delete iGenreArr; |
|
544 |
iGenreArr = NULL; |
|
545 |
} |
|
546 |
if ( iValueTextArray ) |
|
547 |
{ |
|
548 |
delete iValueTextArray; |
|
549 |
iValueTextArray = NULL; |
|
550 |
} |
|
551 |
if ( iTextValues ) |
|
552 |
{ |
|
553 |
delete iTextValues; |
|
554 |
iTextValues = NULL; |
|
555 |
} |
|
556 |
} |
|
557 |
||
558 |
// ----------------------------------------------------------------------------- |
|
559 |
// CMPXMetadataEditorDialog::FetchGenreL |
|
560 |
// Populates genre popup with genre list for tracks. |
|
561 |
// ----------------------------------------------------------------------------- |
|
562 |
// |
|
563 |
void CMPXMetadataEditorDialog::FetchGenreL() |
|
564 |
{ |
|
565 |
MPX_FUNC( "CMPXMetadataEditorDialog::FetchGenreL" ); |
|
566 |
RArray<TMPXAttribute> attrs; |
|
567 |
CleanupClosePushL( attrs ); |
|
568 |
attrs.Append( KMPXMediaGeneralTitle ); |
|
569 |
CMPXMedia* criteria = CMPXMedia::NewL(); |
|
570 |
CleanupStack::PushL( criteria ); |
|
571 |
criteria->SetTObjectValueL<TUid>( |
|
572 |
KMPXMediaGeneralCollectionId, TUid::Uid( 0x101FFC3A ) ); |
|
573 |
criteria->SetTObjectValueL<TMPXGeneralType>( |
|
574 |
KMPXMediaGeneralType, EMPXGroup ); |
|
575 |
criteria->SetTObjectValueL<TMPXGeneralCategory>( |
|
576 |
KMPXMediaGeneralCategory, EMPXGenre ); |
|
577 |
iCollectionUtility->Collection().FindAllL( *criteria, attrs.Array(), *this ); |
|
578 |
CleanupStack::PopAndDestroy( criteria ); |
|
579 |
CleanupStack::PopAndDestroy( &attrs ); |
|
580 |
} |
|
581 |
||
582 |
// --------------------------------------------------------------------------- |
|
583 |
// Handle media properties. |
|
584 |
// --------------------------------------------------------------------------- |
|
585 |
// |
|
586 |
void CMPXMetadataEditorDialog::DoHandleMediaL( |
|
587 |
const CMPXMedia& aMedia, |
|
588 |
TInt aError ) |
|
589 |
{ |
|
590 |
MPX_FUNC( "CMPXMetadataEditorDialog::DoHandleMediaL" ); |
|
591 |
||
592 |
if ( iCurrentMediaLOp == EMPXMetadataEditorGetSongInfo ) |
|
593 |
{ |
|
594 |
delete iMedia; |
|
595 |
iMedia = NULL; |
|
596 |
if ( aError == KErrNone ) |
|
597 |
{ |
|
598 |
iMedia = CMPXMedia::NewL( aMedia ); |
|
599 |
// common for both music and podcast |
|
600 |
// Fetch the artist |
|
601 |
||
602 |
if ( iMedia->IsSupported( KMPXMediaDrmProtected ) ) |
|
603 |
{ |
|
604 |
iIsDrmProtected = iMedia->ValueTObjectL<TBool>( KMPXMediaDrmProtected ); |
|
605 |
} |
|
606 |
||
607 |
SetControlTextL( EMPXMetadataEditorDlgCtrlIdArtist, |
|
608 |
iMedia->ValueText( KMPXMediaMusicArtist ), KNullDesC ); |
|
609 |
||
610 |
// Fetch the album |
|
611 |
SetControlTextL( EMPXMetadataEditorDlgCtrlIdAlbum, |
|
612 |
iMedia->ValueText( KMPXMediaMusicAlbum ), KNullDesC ); |
|
613 |
||
614 |
// Fetch the track number |
|
615 |
SetControlNumberL( EMPXMetadataEditorDlgCtrlIdTrackNumber, |
|
616 |
iMedia->ValueText( KMPXMediaMusicAlbumTrack ), |
|
617 |
KMPXSongDetailsTrackNumMin, KMPXSongDetailsTrackNumMax ); |
|
618 |
||
619 |
// Fetch the year |
|
620 |
TInt64 year(0); |
|
621 |
if ( iMedia->IsSupported (KMPXMediaMusicYear ) ) |
|
622 |
{ |
|
623 |
year = iMedia->ValueTObjectL<TInt64>( KMPXMediaMusicYear ); |
|
624 |
} |
|
625 |
TTime yearTime( year); |
|
626 |
iYear = yearTime.DateTime().Year ( ); |
|
627 |
HBufC* yearBuf = HBufC::NewLC ( KMPXMaxTimeLength ); |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
628 |
yearBuf->Des().AppendNum ( iYear ); |
53 | 629 |
SetControlNumberL ( EMPXMetadataEditorDlgCtrlIdYear, *yearBuf, |
630 |
KMPXSongDetailsYearMin, KMPXSongDetailsYearMax ); |
|
631 |
CleanupStack::PopAndDestroy ( yearBuf ); |
|
632 |
||
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
633 |
// Fetch genre |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
634 |
FetchGenreL(); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
635 |
|
53 | 636 |
// Fetch the comment |
637 |
SetControlTextL( EMPXMetadataEditorDlgCtrlIdComment, |
|
638 |
iMedia->ValueText( KMPXMediaGeneralComment ), KNullDesC ); |
|
639 |
||
640 |
// Fetch the song name |
|
641 |
TParsePtrC fileDetail( iMedia->ValueText( KMPXMediaGeneralUri ) ); |
|
642 |
SetControlTextL( EMPXMetadataEditorDlgCtrlIdSongName, |
|
643 |
iMedia->ValueText( KMPXMediaGeneralTitle ), fileDetail.Name() ); |
|
644 |
||
645 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection ) |
|
646 |
{ |
|
647 |
// Fetch the composer |
|
648 |
SetControlTextL( EMPXMetadataEditorDlgCtrlIdComposer, |
|
649 |
iMedia->ValueText( KMPXMediaMusicComposer ), KNullDesC ); |
|
650 |
} |
|
651 |
||
652 |
PopulateFileDetailsL(); |
|
653 |
DrawNow(); |
|
654 |
} |
|
655 |
else |
|
656 |
{ |
|
657 |
// if error getting metadata, exit editor |
|
658 |
iCommonUiHelper->HandleErrorL( aError ); |
|
659 |
if ( iIdle ) |
|
660 |
{ |
|
661 |
iIdle->Cancel(); |
|
662 |
delete iIdle; |
|
663 |
iIdle = NULL; |
|
664 |
} |
|
665 |
iIdle = CIdle::NewL( CActive::EPriorityStandard ); |
|
666 |
iIdle->Start( TCallBack( CMPXMetadataEditorDialog::DeferredExitCallback, this ) ); |
|
667 |
} |
|
668 |
} |
|
669 |
else if ( iCurrentMediaLOp == EMPXMetadataEditorGetDrmInfo ) |
|
670 |
{ |
|
671 |
delete iDrmInfo; |
|
672 |
iDrmInfo = NULL; |
|
673 |
if ( aError == KErrNone ) |
|
674 |
{ |
|
675 |
iDrmInfo = CMPXMedia::NewL( aMedia ); |
|
676 |
} |
|
677 |
else |
|
678 |
{ |
|
679 |
iDrmInfo = CMPXMedia::NewL(); |
|
680 |
} |
|
681 |
if ( iIdle ) |
|
682 |
{ |
|
683 |
iIdle->Cancel(); |
|
684 |
delete iIdle; |
|
685 |
iIdle = NULL; |
|
686 |
} |
|
687 |
iIdle = CIdle::NewL( CActive::EPriorityStandard ); |
|
688 |
iIdle->Start( TCallBack( CMPXMetadataEditorDialog::DeferredFileDetailsCallback, this ) ); |
|
689 |
} |
|
690 |
else |
|
691 |
{ |
|
692 |
// Should not reach here |
|
693 |
ASSERT( 0 ); |
|
694 |
} |
|
695 |
iCurrentMediaLOp = EMPXMetadataEditorIdle; |
|
696 |
} |
|
697 |
||
698 |
// ---------------------------------------------------------------------------- |
|
699 |
// CMPXMetadataEditorDialog::SaveFormDataL |
|
700 |
// Save form data. |
|
701 |
// ---------------------------------------------------------------------------- |
|
702 |
// |
|
703 |
TBool CMPXMetadataEditorDialog::SaveFormDataL() |
|
704 |
{ |
|
705 |
MPX_FUNC( "CMPXMetadataEditorDialog::SaveFormDataL" ); |
|
706 |
if ( iMedia ) |
|
707 |
{ |
|
708 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL Saving.." ); |
|
709 |
CMPXMedia* media = CMPXMedia::NewL(); |
|
710 |
CleanupStack::PushL( media ); |
|
711 |
||
712 |
TBool changed = EFalse; |
|
713 |
||
714 |
// common to both music and podcast |
|
715 |
// update local copy of media as well because getting media prop is slow |
|
716 |
changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdSongName, |
|
717 |
media, KMPXMediaGeneralTitle ); |
|
718 |
||
719 |
changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdArtist, |
|
720 |
media, KMPXMediaMusicArtist ) || changed; |
|
721 |
||
722 |
changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdAlbum, |
|
723 |
media, KMPXMediaMusicAlbum ) || changed; |
|
724 |
||
725 |
changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdTrackNumber, |
|
726 |
media, KMPXMediaMusicAlbumTrack ) || changed; |
|
727 |
||
728 |
changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdComment, |
|
729 |
media, KMPXMediaGeneralComment ) || changed; |
|
730 |
||
731 |
// special handling needed for year |
|
732 |
CCoeControl* coeControl = ControlOrNull( EMPXMetadataEditorDlgCtrlIdYear ); |
|
733 |
if ( coeControl ) |
|
734 |
{ |
|
735 |
CEikEdwin* control = static_cast<CEikEdwin*>( coeControl ); |
|
736 |
if ( control ) |
|
737 |
{ |
|
738 |
TBuf<KMPXSongDetailsNumTextWidth> num; |
|
739 |
control->GetText( num ); |
|
740 |
TLex numLex( num ); |
|
741 |
TInt LexToInt; |
|
742 |
numLex.Val( LexToInt ); |
|
743 |
if ( LexToInt != iYear ) |
|
744 |
{ |
|
745 |
MPX_DEBUG3( "CMPXMetadataEditorDialog::SaveFormDataL year changed from %d to %d", iYear, num ); |
|
746 |
TDateTime newYear; |
|
747 |
newYear.Set( LexToInt, EJanuary, 0, 0, 0, 0, 0 ); |
|
748 |
TTime year( newYear ); |
|
749 |
iMedia->SetTObjectValueL<TInt64>( |
|
750 |
KMPXMediaMusicYear, year.Int64() ); |
|
751 |
media->SetTObjectValueL<TInt64>( |
|
752 |
KMPXMediaMusicYear, year.Int64() ); |
|
753 |
iYear = LexToInt; |
|
754 |
changed = ETrue; |
|
755 |
} |
|
756 |
else |
|
757 |
{ |
|
758 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL year not changed" ); |
|
759 |
} |
|
760 |
} |
|
761 |
} |
|
762 |
||
763 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection ) |
|
764 |
{ |
|
765 |
changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdComposer, |
|
766 |
media, KMPXMediaMusicComposer ) || changed; |
|
767 |
} |
|
768 |
else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast ) |
|
769 |
{ |
|
770 |
// no special handling, all covered in common |
|
771 |
} |
|
772 |
if ( changed ) |
|
773 |
{ |
|
774 |
// save it back to collection engine |
|
775 |
SaveMediaPropertiesL( media ); |
|
776 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL Saved" ); |
|
777 |
} |
|
778 |
#ifdef _DEBUG |
|
779 |
else |
|
780 |
{ |
|
781 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL All equal, not saved" ); |
|
782 |
} |
|
783 |
#endif |
|
784 |
CleanupStack::PopAndDestroy( media ); |
|
785 |
} |
|
786 |
return ETrue; |
|
787 |
} |
|
788 |
||
789 |
// ---------------------------------------------------------------------------- |
|
790 |
// CMPXMetadataEditorDialog::DoNotSaveFormDataL |
|
791 |
// Does not save form data. |
|
792 |
// ---------------------------------------------------------------------------- |
|
793 |
// |
|
794 |
void CMPXMetadataEditorDialog::DoNotSaveFormDataL() |
|
795 |
{ |
|
796 |
// Do nothing |
|
797 |
} |
|
798 |
||
799 |
// ----------------------------------------------------------------------------- |
|
800 |
// CMPXMetadataEditorDialog::SetTitlePane |
|
801 |
// Set Title Pane from descriptor. |
|
802 |
// ----------------------------------------------------------------------------- |
|
803 |
// |
|
804 |
void CMPXMetadataEditorDialog::SetTitlePaneL() |
|
805 |
{ |
|
806 |
MPX_FUNC( "CMPXMetadataEditorDialog::SetTitlePaneL" ); |
|
807 |
// Saving the current title before it's overwritten |
|
808 |
CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); |
|
809 |
||
810 |
iTitlePane = |
|
811 |
static_cast<CAknTitlePane*> |
|
812 |
( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
813 |
const TDesC* text = iTitlePane->Text(); |
|
814 |
iTitlePaneText = text->AllocL(); |
|
815 |
||
816 |
HBufC* newText = NULL; |
|
817 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection ) |
|
818 |
{ |
|
819 |
newText = StringLoader::LoadLC( R_MPX_CUI_SONG_DETAILS_TITLE ); |
|
820 |
} |
|
821 |
else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast ) |
|
822 |
{ |
|
823 |
newText = StringLoader::LoadLC( R_MPX_CUI_SONG_DETAILS_EPISODE ); |
|
824 |
} |
|
825 |
||
826 |
// Update Title Pane |
|
827 |
if ( newText ) |
|
828 |
{ |
|
829 |
iTitlePane->SetTextL( *newText ); |
|
830 |
} |
|
831 |
CleanupStack::PopAndDestroy( newText ); |
|
832 |
} |
|
833 |
||
834 |
// ----------------------------------------------------------------------------- |
|
835 |
// CMPXMetadataEditorDialog::RestoreTitlePane |
|
836 |
// Restore Title Pane from the member data. |
|
837 |
// ----------------------------------------------------------------------------- |
|
838 |
// |
|
839 |
void CMPXMetadataEditorDialog::RestoreTitlePaneL() |
|
840 |
{ |
|
841 |
MPX_FUNC( "CMPXMetadataEditorDialog::RestoreTitlePaneL" ); |
|
842 |
// Update Title Pane |
|
843 |
iTitlePane->SetTextL( *iTitlePaneText ); |
|
844 |
} |
|
845 |
||
846 |
// ----------------------------------------------------------------------------- |
|
847 |
// CMPXMetadataEditorDialog::SetNaviLabelL |
|
848 |
// Set Navi Label from descriptor. |
|
849 |
// ----------------------------------------------------------------------------- |
|
850 |
// |
|
851 |
void CMPXMetadataEditorDialog::SetNaviLabelL() |
|
852 |
{ |
|
853 |
MPX_FUNC( "CMPXMetadataEditorDialog::SetNaviLabelL" ); |
|
854 |
MAknEditingStateIndicator *editingStateIndicator = CAknEnv::Static()->EditingStateIndicator(); |
|
855 |
CAknIndicatorContainer* indicContainerEditing = editingStateIndicator->IndicatorContainer(); |
|
856 |
indicContainerEditing->SetIndicatorValueL( TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo), KNullDesC ); |
|
857 |
// Saving the current title before it's overwritten |
|
858 |
CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); |
|
859 |
||
860 |
iNaviPane = static_cast<CAknNavigationControlContainer*> |
|
861 |
( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
862 |
||
863 |
// store the latest navi pane |
|
864 |
iNaviDecorator = iNaviPane->Top(); |
|
865 |
||
866 |
if(iNaviDecorator) |
|
867 |
{ |
|
868 |
// set the new navi label |
|
869 |
iEmptyNaviDecorator = |
|
870 |
iNaviPane->CreateNavigationLabelL(KNullDesC); |
|
871 |
||
872 |
iNaviPane->PushL( *iEmptyNaviDecorator ); |
|
873 |
} |
|
874 |
} |
|
875 |
||
876 |
// ----------------------------------------------------------------------------- |
|
877 |
// CMPXMetadataEditorDialog::RestoreNaviLabelL |
|
878 |
// Restore Navi Label from the member data. |
|
879 |
// ----------------------------------------------------------------------------- |
|
880 |
// |
|
881 |
void CMPXMetadataEditorDialog::RestoreNaviLabelL() |
|
882 |
{ |
|
883 |
MPX_FUNC( "CMPXMetadataEditorDialog::RestoreNaviLabelL" ); |
|
884 |
iNaviPane->Pop( iEmptyNaviDecorator ); // pop out the empty navi |
|
885 |
if ( iNaviDecorator ) |
|
886 |
{ |
|
887 |
iNaviPane->PushL( *iNaviDecorator ); |
|
888 |
} |
|
889 |
} |
|
890 |
||
891 |
// ----------------------------------------------------------------------------- |
|
892 |
// CMPXMetadataEditorDialog::DynInitMenuPaneL |
|
893 |
// Dynamically initialises a menu pane. |
|
894 |
// (other items were commented in a header). |
|
895 |
// ----------------------------------------------------------------------------- |
|
896 |
// |
|
897 |
void CMPXMetadataEditorDialog::DynInitMenuPaneL( |
|
898 |
TInt aResourceId, |
|
899 |
CEikMenuPane* aMenuPane) |
|
900 |
{ |
|
901 |
MPX_FUNC( "CMPXMetadataEditorDialog::DynInitMenuPaneL" ); |
|
902 |
CAknForm::DynInitMenuPaneL(aResourceId, aMenuPane); |
|
903 |
||
904 |
if ( aResourceId == R_AVKON_FORM_MENUPANE ) |
|
905 |
{ |
|
906 |
if ( ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdGenre ) || |
|
907 |
( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdLibrary ) ) |
|
908 |
{ |
|
909 |
aMenuPane->SetItemDimmed( EMPXCmdSongDetailsChange, ETrue ); |
|
910 |
} |
|
911 |
else |
|
912 |
{ |
|
913 |
aMenuPane->SetItemDimmed( EMPXCmdSongDetailsChange, ETrue ); |
|
914 |
} |
|
915 |
aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue ); |
|
916 |
||
917 |
// Dim out the Avkon menu items |
|
918 |
aMenuPane->SetItemDimmed( EAknFormCmdEdit, ETrue ); |
|
919 |
aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue ); |
|
920 |
aMenuPane->SetItemDimmed( EAknFormCmdSave, ETrue ); |
|
921 |
aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue ); |
|
922 |
aMenuPane->SetItemDimmed( EAknFormCmdDelete, ETrue ); |
|
923 |
} |
|
924 |
} |
|
925 |
||
926 |
// ---------------------------------------------------------------------------- |
|
927 |
// CMPXMetadataEditorDialog::ProcessCommandL |
|
928 |
// Act on the menu selection if menu is showing. |
|
929 |
// ---------------------------------------------------------------------------- |
|
930 |
// |
|
931 |
void CMPXMetadataEditorDialog::ProcessCommandL( TInt aCommandId ) |
|
932 |
{ |
|
933 |
MPX_FUNC( "CMPXMetadataEditorDialog::ProcessCommandL" ); |
|
934 |
CAknForm::ProcessCommandL(aCommandId); |
|
935 |
||
936 |
switch (aCommandId) |
|
937 |
{ |
|
938 |
case EMPXCmdSongDetailsChange: |
|
939 |
{ |
|
940 |
if ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdGenre ) |
|
941 |
{ |
|
942 |
iPopup = static_cast<CAknPopupField*> |
|
943 |
( ControlOrNull( EMPXMetadataEditorDlgCtrlIdGenre ) ); |
|
944 |
} |
|
945 |
else if ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdLibrary ) |
|
946 |
{ |
|
947 |
iPopup = static_cast<CAknPopupField*> |
|
948 |
( ControlOrNull( EMPXMetadataEditorDlgCtrlIdLibrary ) ); |
|
949 |
} |
|
950 |
if ( iPopup ) |
|
951 |
{ |
|
952 |
iPopup->ActivateSelectionListL(); |
|
953 |
} |
|
954 |
||
955 |
break; |
|
956 |
} |
|
957 |
case EMPXCmdSongDetails: |
|
958 |
{ |
|
959 |
if ( iIsDrmProtected && !iDrmInfo ) |
|
960 |
{ |
|
961 |
CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
962 |
CleanupStack::PushL( cpath ); |
|
963 |
if ( iParam ) |
|
964 |
{ |
|
965 |
TLex yearLex( iParam->Des() ); |
|
966 |
TInt lexToInt = NULL; |
|
967 |
if ( yearLex.Val( lexToInt ) == KErrNone ) |
|
968 |
{ |
|
969 |
cpath->Set( lexToInt ); |
|
970 |
RArray<TMPXAttribute> attrs; |
|
971 |
CleanupClosePushL(attrs); |
|
972 |
attrs.Append( KMPXMediaGeneralUri ); |
|
973 |
attrs.Append( KMPXMediaDrmAll ); |
|
974 |
iCurrentMediaLOp = EMPXMetadataEditorGetDrmInfo; |
|
975 |
iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() ); |
|
976 |
CleanupStack::PopAndDestroy( &attrs ); |
|
977 |
} |
|
978 |
} |
|
979 |
CleanupStack::PopAndDestroy( cpath ); |
|
980 |
} |
|
981 |
else |
|
982 |
{ |
|
983 |
if( iMedia ) |
|
984 |
{ |
|
985 |
ViewFileDetailsPopupL(); |
|
986 |
} |
|
987 |
} |
|
988 |
break; |
|
989 |
} |
|
990 |
case EAknCmdHelp: |
|
991 |
{ |
|
992 |
TCoeHelpContext helpContext; |
|
993 |
GetHelpContext( helpContext ); |
|
994 |
||
995 |
CArrayFixFlat<TCoeHelpContext>* array = |
|
996 |
new(ELeave)CArrayFixFlat<TCoeHelpContext>( 1 ); |
|
997 |
||
998 |
CleanupStack::PushL( array ); |
|
999 |
array->AppendL( helpContext ); |
|
1000 |
CleanupStack::Pop(); // array |
|
1001 |
||
1002 |
// HlpLauncher deletes array |
|
1003 |
HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), array ); |
|
1004 |
break; |
|
1005 |
} |
|
1006 |
case EAknCmdExit: |
|
1007 |
{ |
|
1008 |
static_cast<MEikCommandObserver*>(iEikonEnv->EikAppUi())-> |
|
1009 |
ProcessCommandL(aCommandId); |
|
1010 |
} |
|
1011 |
default : |
|
1012 |
break; |
|
1013 |
} |
|
1014 |
} |
|
1015 |
||
1016 |
// ----------------------------------------------------------------------------- |
|
1017 |
// CMPXMetadataEditorDialog::PopulateFileDetailsL |
|
1018 |
// ----------------------------------------------------------------------------- |
|
1019 |
// |
|
1020 |
void CMPXMetadataEditorDialog::PopulateFileDetailsL( |
|
1021 |
CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray ) |
|
1022 |
{ |
|
1023 |
||
1024 |
MPX_FUNC( "CMPXMetadataEditorDialog::PopulateFileDetailsL" ); |
|
1025 |
||
1026 |
TBool drmProtected( iMedia->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) ); |
|
1027 |
MPX_DEBUG2( "CMPXMetadataEditorDialog::PopulateFileDetailsL drm protected: %d", drmProtected ); |
|
1028 |
||
1029 |
if ( drmProtected ) |
|
1030 |
{ |
|
1031 |
MakeDrmItemsL( aHeadingsArray, aDataArray ); |
|
1032 |
} |
|
1033 |
||
1034 |
// Get filename |
|
1035 |
const TDesC& uri = iMedia->ValueText( KMPXMediaGeneralUri ); |
|
1036 |
TParsePtrC parse(uri); |
|
1037 |
||
1038 |
AppendStringToArrayL( aDataArray, parse.Name() ); |
|
1039 |
||
1040 |
// Get mime type |
|
1041 |
const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); |
|
1042 |
AppendStringToArrayL( aDataArray, mimeType ); |
|
1043 |
||
1044 |
// Get duration |
|
1045 |
TInt duration( iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration ) ); |
|
1046 |
if ( duration > 0 ) |
|
1047 |
{ |
|
1048 |
// convert milliseconds to seconds |
|
1049 |
duration = duration / KSecondInMilliseconds; |
|
1050 |
CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode = |
|
1051 |
CMPXCommonUiHelper::EMPXDuratAuto; |
|
1052 |
if ( duration > KOneHourInSeconds ) |
|
1053 |
{ |
|
1054 |
durationMode = CMPXCommonUiHelper::EMPXDuratHMS; |
|
1055 |
} |
|
1056 |
HBufC* stringBuf = iCommonUiHelper->DisplayableDurationL( |
|
1057 |
duration, durationMode ); |
|
1058 |
CleanupStack::PushL( stringBuf ); |
|
1059 |
aDataArray->AppendL( *stringBuf ); |
|
1060 |
CleanupStack::PopAndDestroy( stringBuf ); |
|
1061 |
} |
|
1062 |
else |
|
1063 |
{ |
|
1064 |
aDataArray->AppendL( KNullDesC ); |
|
1065 |
} |
|
1066 |
||
1067 |
// Get bitrate |
|
1068 |
TInt bitrate( iMedia->ValueTObjectL<TInt>( KMPXMediaAudioBitrate ) ); |
|
1069 |
if ( bitrate > 0 ) |
|
1070 |
{ |
|
1071 |
// convert bitrate to kpbs |
|
1072 |
bitrate = bitrate / KMPXBitrateFactor; |
|
1073 |
HBufC* bitrateText = StringLoader::LoadLC( |
|
1074 |
R_MPX_CUI_METADATAEDITOR_BITRATE_TXT, bitrate ); |
|
1075 |
aDataArray->AppendL( bitrateText->Des() ); |
|
1076 |
CleanupStack::PopAndDestroy( bitrateText ); |
|
1077 |
} |
|
1078 |
else |
|
1079 |
{ |
|
1080 |
aDataArray->AppendL( KNullDesC ); |
|
1081 |
} |
|
1082 |
||
1083 |
// Get sampling rate |
|
1084 |
TInt samplingRateNum( ( TInt )iMedia->ValueTObjectL<TInt>( KMPXMediaAudioSamplerate ) ); |
|
1085 |
if ( samplingRateNum > 0 ) |
|
1086 |
{ |
|
1087 |
HBufC* stringBuf = HBufC::NewLC( KMPXFileDetailsMaxBufferLen ); |
|
1088 |
TPtr stringBufPtr = stringBuf->Des(); |
|
1089 |
stringBufPtr.AppendNum( samplingRateNum ); |
|
1090 |
AknTextUtils::LanguageSpecificNumberConversion( stringBufPtr ); |
|
1091 |
HBufC* samplingrate = StringLoader::LoadLC( |
|
1092 |
R_MPX_CUI_METADATAEDITOR_SAMPLINGRATE_TXT, stringBufPtr ); |
|
1093 |
aDataArray->AppendL( samplingrate->Des() ); |
|
1094 |
CleanupStack::PopAndDestroy( samplingrate ); |
|
1095 |
CleanupStack::PopAndDestroy( stringBuf ); |
|
1096 |
} |
|
1097 |
else |
|
1098 |
{ |
|
1099 |
aDataArray->AppendL( KNullDesC ); |
|
1100 |
} |
|
1101 |
||
1102 |
// Get size, not stored in collection, have to use RFile |
|
1103 |
// |
|
1104 |
RFs& fs = CEikonEnv::Static()->FsSession(); |
|
1105 |
RFile file; |
|
1106 |
TInt sizeNum(0); |
|
1107 |
TInt err ( file.Open( fs, uri, EFileRead | EFileShareReadersOrWriters ) ); |
|
1108 |
if ( err == KErrNone ) |
|
1109 |
{ |
|
1110 |
file.Size(sizeNum); |
|
1111 |
file.Close(); |
|
1112 |
} |
|
1113 |
||
1114 |
if ( sizeNum > 0 ) |
|
1115 |
{ |
|
1116 |
HBufC* stringBuf = iCommonUiHelper->UnitConversionL( sizeNum ); |
|
1117 |
CleanupStack::PushL( stringBuf ); |
|
1118 |
aDataArray->AppendL( *stringBuf ); |
|
1119 |
CleanupStack::PopAndDestroy( stringBuf ); |
|
1120 |
} |
|
1121 |
else |
|
1122 |
{ |
|
1123 |
aDataArray->AppendL( KNullDesC ); |
|
1124 |
} |
|
1125 |
||
1126 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast ) |
|
1127 |
{ |
|
1128 |
PopulatePodcastFileDetailsL( aHeadingsArray, aDataArray ); |
|
1129 |
} |
|
1130 |
||
1131 |
// Get modified |
|
1132 |
TTime time; |
|
1133 |
User::LeaveIfError( fs.Modified( uri, time ) ); |
|
1134 |
ConvertToLocalTimeL( time ); |
|
1135 |
HBufC* modDateTime = HBufC::NewLC( |
|
1136 |
KMPXMaxTimeLength + KMPXDurationDisplayResvLen ); |
|
1137 |
HBufC* format = StringLoader::LoadLC( |
|
1138 |
R_QTN_DATE_USUAL_WITH_ZERO ); |
|
1139 |
TPtr modDatePtr = modDateTime->Des(); |
|
1140 |
MPX_TRAPD( error, time.FormatL( modDatePtr, *format ) ); |
|
1141 |
CleanupStack::PopAndDestroy( format ); |
|
1142 |
if (error != KErrNone) |
|
1143 |
{ |
|
1144 |
aDataArray->AppendL( KNullDesC ); |
|
1145 |
} |
|
1146 |
else |
|
1147 |
{ |
|
1148 |
format = StringLoader::LoadLC( |
|
1149 |
R_QTN_TIME_USUAL_WITH_ZERO ); |
|
1150 |
HBufC* modTime = HBufC::NewLC( |
|
1151 |
format->Length() + KMPXDurationDisplayResvLen ); |
|
1152 |
TPtr modTimePtr = modTime->Des(); |
|
1153 |
MPX_TRAPD( err, time.FormatL( modTimePtr, *format ) ); |
|
1154 |
if ( err != KErrNone ) |
|
1155 |
{ |
|
1156 |
aDataArray->AppendL( KNullDesC ); |
|
1157 |
} |
|
1158 |
else |
|
1159 |
{ |
|
1160 |
modDatePtr.Append( KMPXSpace ); |
|
1161 |
modDatePtr.Append( modTimePtr ); |
|
1162 |
aDataArray->AppendL( modDatePtr ); |
|
1163 |
} |
|
1164 |
CleanupStack::PopAndDestroy( modTime ); |
|
1165 |
CleanupStack::PopAndDestroy( format ); |
|
1166 |
} |
|
1167 |
CleanupStack::PopAndDestroy( modDateTime ); |
|
1168 |
||
1169 |
// Get filename |
|
1170 |
AppendStringToArrayL( aDataArray, iMedia->ValueText( |
|
1171 |
KMPXMediaGeneralCopyright ) ); |
|
1172 |
||
1173 |
// Get URL |
|
1174 |
AppendStringToArrayL( aDataArray, iMedia->ValueText( |
|
1175 |
KMPXMediaMusicURL ) ); |
|
1176 |
} |
|
1177 |
||
1178 |
// ----------------------------------------------------------------------------- |
|
1179 |
// CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL |
|
1180 |
// ----------------------------------------------------------------------------- |
|
1181 |
// |
|
1182 |
void CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL( |
|
1183 |
CDesCArrayFlat* /*aHeadingsArray*/, CDesCArrayFlat* aDataArray ) |
|
1184 |
{ |
|
1185 |
MPX_FUNC( "CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL" ); |
|
1186 |
// Get last playback position |
|
1187 |
||
1188 |
TInt lastPbPosition( ( TInt )iMedia->ValueTObjectL<TInt>( |
|
1189 |
KMPXMediaGeneralLastPlaybackPosition ) ); |
|
1190 |
||
1191 |
if ( lastPbPosition > 0 ) |
|
1192 |
{ |
|
1193 |
// convert milliseconds to seconds |
|
1194 |
lastPbPosition = lastPbPosition / KSecondInMilliseconds; |
|
1195 |
CMPXCommonUiHelper::TMPXDuratDisplayMode lastPbPositionMode = |
|
1196 |
CMPXCommonUiHelper::EMPXDuratAuto; |
|
1197 |
if ( lastPbPosition > KOneHourInSeconds ) |
|
1198 |
{ |
|
1199 |
lastPbPositionMode = CMPXCommonUiHelper::EMPXDuratHMS; |
|
1200 |
} |
|
1201 |
HBufC* stringBuf = iCommonUiHelper->DisplayableDurationL( |
|
1202 |
lastPbPosition, lastPbPositionMode ); |
|
1203 |
CleanupStack::PushL( stringBuf ); |
|
1204 |
aDataArray->AppendL( *stringBuf ); |
|
1205 |
CleanupStack::PopAndDestroy( stringBuf ); |
|
1206 |
} |
|
1207 |
else if(lastPbPosition == 0 && |
|
1208 |
iMedia->IsSupported(KMPXMediaGeneralPlayCount) && |
|
1209 |
iMedia->ValueTObjectL<TInt>(KMPXMediaGeneralPlayCount) > 0 ) |
|
1210 |
{ |
|
1211 |
HBufC* stringBuf = StringLoader::LoadLC( R_MPX_CUI_METADATAEDITOR_PLAYBACK_COMPLETE ); |
|
1212 |
aDataArray->AppendL( *stringBuf ); |
|
1213 |
CleanupStack::PopAndDestroy( stringBuf ); |
|
1214 |
||
1215 |
} |
|
1216 |
else |
|
1217 |
{ |
|
1218 |
aDataArray->AppendL( KNullDesC ); |
|
1219 |
} |
|
1220 |
||
1221 |
||
1222 |
// Get published |
|
1223 |
if ( iMedia->IsSupported( TMPXAttribute( KMPXMediaIdPodcast, |
|
1224 |
EMPXMediaPodcastPubDate ) ) ) |
|
1225 |
{ |
|
1226 |
TInt64 timeInt( ( TInt64 )iMedia->ValueTObjectL<TInt64>( |
|
1227 |
TMPXAttribute( KMPXMediaIdPodcast, EMPXMediaPodcastPubDate ) ) ); |
|
1228 |
TTime time( timeInt ); |
|
1229 |
ConvertToLocalTimeL(time); |
|
1230 |
HBufC* modDateTime = HBufC::NewLC( |
|
1231 |
KMPXMaxTimeLength + KMPXDurationDisplayResvLen ); |
|
1232 |
HBufC* format = StringLoader::LoadLC( |
|
1233 |
R_QTN_DATE_USUAL_WITH_ZERO ); |
|
1234 |
TPtr modDatePtr = modDateTime->Des(); |
|
1235 |
MPX_TRAPD( err, time.FormatL( modDatePtr, *format ) ); |
|
1236 |
CleanupStack::PopAndDestroy( format ); |
|
1237 |
if (err != KErrNone || |
|
1238 |
time == 0) |
|
1239 |
{ |
|
1240 |
aDataArray->AppendL( KNullDesC ); |
|
1241 |
} |
|
1242 |
else |
|
1243 |
{ |
|
1244 |
format = StringLoader::LoadLC( |
|
1245 |
R_QTN_TIME_USUAL_WITH_ZERO ); |
|
1246 |
HBufC* modTime = HBufC::NewLC( |
|
1247 |
format->Length() + KMPXDurationDisplayResvLen ); |
|
1248 |
TPtr modTimePtr = modTime->Des(); |
|
1249 |
MPX_TRAPD( err, time.FormatL( modTimePtr, *format ) ); |
|
1250 |
if ( err != KErrNone ) |
|
1251 |
{ |
|
1252 |
aDataArray->AppendL( KNullDesC ); |
|
1253 |
} |
|
1254 |
else |
|
1255 |
{ |
|
1256 |
modDatePtr.Append( KMPXSpace ); |
|
1257 |
modDatePtr.Append( modTimePtr ); |
|
1258 |
aDataArray->AppendL( modDatePtr ); |
|
1259 |
} |
|
1260 |
CleanupStack::PopAndDestroy( modTime ); |
|
1261 |
CleanupStack::PopAndDestroy( format ); |
|
1262 |
} |
|
1263 |
CleanupStack::PopAndDestroy( modDateTime ); |
|
1264 |
} |
|
1265 |
else |
|
1266 |
{ |
|
1267 |
aDataArray->AppendL( KNullDesC ); |
|
1268 |
} |
|
1269 |
} |
|
1270 |
||
1271 |
// ----------------------------------------------------------------------------- |
|
1272 |
// CMPXMetadataEditorDialog::MakeDrmItemsL |
|
1273 |
// ----------------------------------------------------------------------------- |
|
1274 |
// |
|
1275 |
void CMPXMetadataEditorDialog::MakeDrmItemsL( |
|
1276 |
CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray ) |
|
1277 |
{ |
|
1278 |
MPX_FUNC( "CMPXMetadataEditorDialog::MakeDrmItemsL" ); |
|
1279 |
if (iDrmDetails ) |
|
1280 |
{ |
|
1281 |
TInt itemCount( 0); |
|
1282 |
if ( iDrmInfo->IsSupported( KMPXMediaDrmType ) ) |
|
1283 |
{ |
|
1284 |
MPX_DEBUG2( "CMPXMetadataEditorDialog::MakeDrmItemsL drm type: %d", |
|
1285 |
iDrmInfo->ValueTObjectL<TInt>( KMPXMediaDrmType ) ); |
|
1286 |
TInt rightStatus( iDrmInfo->ValueTObjectL<TInt>( KMPXMediaDrmRightsStatus ) ); |
|
1287 |
HBufC* rights( StringLoader::LoadLC( R_QTN_DRM_MGR_DET2_PLAY ) ); |
|
1288 |
HBufC* heading( NULL); |
|
1289 |
HBufC* value( NULL); |
|
1290 |
||
1291 |
switch ( rightStatus ) |
|
1292 |
{ |
|
1293 |
case EMPXDrmRightsFull: |
|
1294 |
{ |
|
1295 |
// status |
|
1296 |
heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT ); |
|
1297 |
value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_VALID ); |
|
1298 |
aHeadingsArray->InsertL ( itemCount, heading->Des ( ) ); |
|
1299 |
aDataArray->InsertL ( itemCount, value->Des ( ) ); |
|
1300 |
CleanupStack::PopAndDestroy ( value ); |
|
1301 |
CleanupStack::PopAndDestroy ( heading ); |
|
1302 |
itemCount++; |
|
1303 |
||
1304 |
// full rights |
|
1305 |
heading = StringLoader::LoadLC ( |
|
1306 |
R_QTN_DRM_MGR_DET_FULL_X, *rights ); |
|
1307 |
value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_UNLIMITED ); |
|
1308 |
aHeadingsArray->InsertL ( itemCount, heading->Des ( ) ); |
|
1309 |
aDataArray->InsertL ( itemCount, value->Des ( ) ); |
|
1310 |
CleanupStack::PopAndDestroy ( value ); |
|
1311 |
CleanupStack::PopAndDestroy ( heading ); |
|
1312 |
itemCount++; |
|
1313 |
break; |
|
1314 |
} |
|
1315 |
case EMPXDrmRightsRestricted: |
|
1316 |
case EMPXDrmRightsPreview: |
|
1317 |
{ |
|
1318 |
// status |
|
1319 |
heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT ); |
|
1320 |
value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_VALID ); |
|
1321 |
aHeadingsArray->InsertL ( itemCount, heading->Des ( ) ); |
|
1322 |
aDataArray->InsertL ( itemCount, value->Des ( ) ); |
|
1323 |
CleanupStack::PopAndDestroy ( value ); |
|
1324 |
CleanupStack::PopAndDestroy ( heading ); |
|
1325 |
itemCount++; |
|
1326 |
// rights |
|
1327 |
MakeRestrictedDrmItemsL( |
|
1328 |
rights, itemCount, aHeadingsArray, aDataArray ); |
|
1329 |
break; |
|
1330 |
} |
|
1331 |
case EMPXDrmRightsMissing: |
|
1332 |
{ |
|
1333 |
// status |
|
1334 |
heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT ); |
|
1335 |
value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_EXP ); |
|
1336 |
aHeadingsArray->InsertL ( itemCount, heading->Des ( ) ); |
|
1337 |
aDataArray->InsertL ( itemCount, value->Des ( ) ); |
|
1338 |
CleanupStack::PopAndDestroy ( value ); |
|
1339 |
CleanupStack::PopAndDestroy ( heading ); |
|
1340 |
itemCount++; |
|
1341 |
break; |
|
1342 |
} |
|
1343 |
case EMPXDrmRightsExpired: |
|
1344 |
{ |
|
1345 |
// status |
|
1346 |
heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT ); |
|
1347 |
value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_EXP ); |
|
1348 |
aHeadingsArray->InsertL ( itemCount, heading->Des ( ) ); |
|
1349 |
aDataArray->InsertL ( itemCount, value->Des ( ) ); |
|
1350 |
CleanupStack::PopAndDestroy ( value ); |
|
1351 |
CleanupStack::PopAndDestroy ( heading ); |
|
1352 |
itemCount++; |
|
1353 |
// make rest of the drm items |
|
1354 |
MakeRestrictedDrmItemsL( |
|
1355 |
rights, itemCount, aHeadingsArray, aDataArray ); |
|
1356 |
break; |
|
1357 |
} |
|
1358 |
default: |
|
1359 |
{ |
|
1360 |
break; |
|
1361 |
} |
|
1362 |
} |
|
1363 |
||
1364 |
heading = NULL; |
|
1365 |
value = NULL; |
|
1366 |
||
1367 |
// sending |
|
1368 |
heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_CS ); |
|
1369 |
TBool forwardAllowed( iDrmInfo->ValueTObjectL<TBool>( KMPXMediaDrmSendingAllowed ) ); |
|
1370 |
if ( forwardAllowed ) |
|
1371 |
{ |
|
1372 |
value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_ALLOWED ); |
|
1373 |
} |
|
1374 |
else |
|
1375 |
{ |
|
1376 |
value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_FORBID ); |
|
1377 |
} |
|
1378 |
aHeadingsArray->InsertL ( itemCount, heading->Des ( ) ); |
|
1379 |
aDataArray->InsertL ( itemCount, value->Des ( ) ); |
|
1380 |
CleanupStack::PopAndDestroy ( value ); |
|
1381 |
CleanupStack::PopAndDestroy ( heading ); |
|
1382 |
CleanupStack::PopAndDestroy ( rights ); // heading, value, rights |
|
1383 |
} |
|
1384 |
else |
|
1385 |
{ |
|
1386 |
// if error getting drm info, drm type will not be valid |
|
1387 |
// by default assume the rights are invalid (since we can't read it) |
|
1388 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::MakeDrmItemsL unable to get drm data" ); |
|
1389 |
HBufC* heading( StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT )); |
|
1390 |
HBufC* value( StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_INVALID )); |
|
1391 |
aHeadingsArray->InsertL ( 0, heading->Des ( ) ); |
|
1392 |
aDataArray->InsertL ( 0, value->Des ( ) ); |
|
1393 |
CleanupStack::PopAndDestroy ( value ); |
|
1394 |
CleanupStack::PopAndDestroy ( heading ); |
|
1395 |
} |
|
1396 |
} |
|
1397 |
} |
|
1398 |
||
1399 |
// ----------------------------------------------------------------------------- |
|
1400 |
// CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL |
|
1401 |
// ----------------------------------------------------------------------------- |
|
1402 |
// |
|
1403 |
void CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL( |
|
1404 |
HBufC* aRights, TInt& aCurrentIndex, |
|
1405 |
CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray ) |
|
1406 |
{ |
|
1407 |
MPX_FUNC( "CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL" ); |
|
1408 |
TMPXMediaDrmRightsType expireConstraint( EMPXDrmRightsTypeNoRestriction ); |
|
1409 |
if ( iDrmInfo->IsSupported( KMPXMediaDrmRightsType ) ) |
|
1410 |
{ |
|
1411 |
expireConstraint = iDrmInfo->ValueTObjectL<TMPXMediaDrmRightsType>( |
|
1412 |
KMPXMediaDrmRightsType ); |
|
1413 |
} |
|
1414 |
MPX_DEBUG2("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): ExpireConstraint = %d", expireConstraint); |
|
1415 |
TInt64 intervalTime( KErrNotFound ); |
|
1416 |
if ( iDrmInfo->IsSupported( KMPXMediaDrmIntervalStartTime ) ) |
|
1417 |
{ |
|
1418 |
MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Interval Start Time"); |
|
1419 |
intervalTime = (TInt64)iDrmInfo->ValueTObjectL<TInt64>( KMPXMediaDrmIntervalStartTime ); |
|
1420 |
} |
|
1421 |
HBufC* heading = NULL; |
|
1422 |
HBufC* value = NULL; |
|
1423 |
// acculated time |
|
1424 |
if ( expireConstraint == EMPXDrmRightsTypeAccTime ) |
|
1425 |
{ |
|
1426 |
MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): AccTime based"); |
|
1427 |
heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_ACCUM_TIME_LEFT ); |
|
1428 |
||
1429 |
TTimeIntervalSeconds accTime = iDrmInfo->ValueTObjectL<TTimeIntervalSeconds>( KMPXMediaDrmAccumulatedTime ); |
|
1430 |
TInt years( 0 ); |
|
1431 |
TInt months( 0 ); |
|
1432 |
TInt days( 0 ); |
|
1433 |
TInt hours( 0 ); |
|
1434 |
TInt minutes( 0 ); |
|
1435 |
TInt seconds( 0 ); |
|
1436 |
SplitTime( accTime, years, months, days, hours, minutes, seconds ); |
|
1437 |
value = AddPartsOfTimeLC( years, months, days, hours, minutes, seconds ); |
|
1438 |
||
1439 |
TPtr text = value->Des(); |
|
1440 |
LanguageSpecificNumberConversion( text ); |
|
1441 |
aHeadingsArray->InsertL( aCurrentIndex, heading->Des() ); |
|
1442 |
aDataArray->InsertL( aCurrentIndex, value->Des() ); |
|
1443 |
||
1444 |
CleanupStack::PopAndDestroy( value ); |
|
1445 |
CleanupStack::PopAndDestroy( heading ); |
|
1446 |
aCurrentIndex++; |
|
1447 |
} |
|
1448 |
||
1449 |
// count |
|
1450 |
if ( expireConstraint == EMPXDrmRightsTypeCount || |
|
1451 |
expireConstraint == EMPXDrmRightsTypeTimeCount ) |
|
1452 |
{ |
|
1453 |
MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Count based"); |
|
1454 |
heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UTL_X, *aRights ); |
|
1455 |
||
1456 |
TInt counts( iDrmInfo->ValueTObjectL<TInt>( KMPXMediaDrmCount ) ); |
|
1457 |
if ( counts == 1 ) |
|
1458 |
{ |
|
1459 |
value = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_1_COUNT ); |
|
1460 |
} |
|
1461 |
else |
|
1462 |
{ |
|
1463 |
value = StringLoader::LoadLC( |
|
1464 |
R_QTN_DRM_MGR_DET_N_COUNTS, counts ); |
|
1465 |
} |
|
1466 |
TPtr text = value->Des(); |
|
1467 |
LanguageSpecificNumberConversion( text ); |
|
1468 |
aHeadingsArray->InsertL( aCurrentIndex, heading->Des() ); |
|
1469 |
aDataArray->InsertL( aCurrentIndex, value->Des() ); |
|
1470 |
CleanupStack::PopAndDestroy( value ); |
|
1471 |
CleanupStack::PopAndDestroy( heading ); |
|
1472 |
aCurrentIndex++; |
|
1473 |
} |
|
1474 |
||
1475 |
if ( expireConstraint == EMPXDrmRightsTypeTime || |
|
1476 |
expireConstraint == EMPXDrmRightsTypeTimeCount || |
|
1477 |
( expireConstraint == EMPXDrmRightsTypeInterval && |
|
1478 |
intervalTime > 0 ) ) |
|
1479 |
{ |
|
1480 |
MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Time based"); |
|
1481 |
HBufC* dateFormatString = StringLoader::LoadLC( |
|
1482 |
R_QTN_DATE_USUAL_WITH_ZERO ); |
|
1483 |
HBufC* timeFormatString = StringLoader::LoadLC( R_QTN_TIME_USUAL ); |
|
1484 |
||
1485 |
// from |
|
1486 |
if ( iDrmInfo->IsSupported( KMPXMediaDrmStartTime ) ) |
|
1487 |
{ |
|
1488 |
MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Start time found"); |
|
1489 |
TTime from( iDrmInfo->ValueTObjectL<TInt64>( KMPXMediaDrmStartTime ) ); |
|
1490 |
heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_RVF_X, *aRights ); |
|
1491 |
HBufC* datePointer = HBufC::NewLC( KMaxFileName ); |
|
1492 |
TPtr date = datePointer->Des(); |
|
1493 |
from.FormatL( date, *dateFormatString ); |
|
1494 |
TBuf<KMPXMaxTimeLength> time; |
|
1495 |
from.FormatL( time, *timeFormatString ); |
|
1496 |
date.Append( KMPXSpace ); |
|
1497 |
date.Append( time ); |
|
1498 |
LanguageSpecificNumberConversion( date ); |
|
1499 |
aHeadingsArray->InsertL( aCurrentIndex, heading->Des() ); |
|
1500 |
aDataArray->InsertL( aCurrentIndex, date ); |
|
1501 |
CleanupStack::PopAndDestroy( datePointer ); |
|
1502 |
CleanupStack::PopAndDestroy( heading ); |
|
1503 |
aCurrentIndex++; |
|
1504 |
} |
|
1505 |
||
1506 |
// until |
|
1507 |
if ( iDrmInfo->IsSupported( KMPXMediaDrmEndTime ) ) |
|
1508 |
{ |
|
1509 |
MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): End time found"); |
|
1510 |
TTime until( iDrmInfo->ValueTObjectL<TInt64>( KMPXMediaDrmEndTime ) ); |
|
1511 |
heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_RVT_X, *aRights ); |
|
1512 |
HBufC* dateToPntr = HBufC::NewLC( KMaxFileName ); |
|
1513 |
TPtr dateTo = dateToPntr->Des(); |
|
1514 |
until.FormatL( dateTo, *dateFormatString ); |
|
1515 |
TBuf<KMPXMaxTimeLength> timeTo; |
|
1516 |
until.FormatL( timeTo, *timeFormatString ); |
|
1517 |
dateTo.Append( KMPXSpace ); |
|
1518 |
dateTo.Append( timeTo ); |
|
1519 |
LanguageSpecificNumberConversion( dateTo ); |
|
1520 |
aHeadingsArray->InsertL( aCurrentIndex, heading->Des() ); |
|
1521 |
aDataArray->InsertL( aCurrentIndex, dateTo ); |
|
1522 |
CleanupStack::PopAndDestroy( dateToPntr ); |
|
1523 |
CleanupStack::PopAndDestroy( heading ); |
|
1524 |
aCurrentIndex++; |
|
1525 |
} |
|
1526 |
CleanupStack::PopAndDestroy( timeFormatString ); |
|
1527 |
CleanupStack::PopAndDestroy( dateFormatString ); |
|
1528 |
} |
|
1529 |
else if ( expireConstraint == EMPXDrmRightsTypeInterval && |
|
1530 |
intervalTime < 0 ) |
|
1531 |
{ |
|
1532 |
MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Time not activated"); |
|
1533 |
// times not activated |
|
1534 |
heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UTS_X, *aRights ); |
|
1535 |
value = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_NOT_ACT ); |
|
1536 |
aHeadingsArray->InsertL( aCurrentIndex, heading->Des() ); |
|
1537 |
aDataArray->InsertL( aCurrentIndex, value->Des() ); |
|
1538 |
CleanupStack::PopAndDestroy( value ); |
|
1539 |
CleanupStack::PopAndDestroy( heading ); |
|
1540 |
aCurrentIndex++; |
|
1541 |
||
1542 |
// query what the current time is |
|
1543 |
TTime currentTime; |
|
1544 |
currentTime.HomeTime(); |
|
1545 |
// calculate rights end time |
|
1546 |
TTimeIntervalSeconds interval = iDrmInfo->ValueTObjectL<TInt64>( KMPXMediaDrmInterval ); |
|
1547 |
TTime endTime( currentTime.Int64() + (TInt64) interval.Int() * KSecondInMicroSeconds ); |
|
1548 |
TBuf<KMPXMaxVal> val; |
|
1549 |
TInt count = 0; |
|
1550 |
||
1551 |
// years |
|
1552 |
TTimeIntervalYears years = endTime.YearsFrom( currentTime ); |
|
1553 |
if ( years.Int() ) |
|
1554 |
{ |
|
1555 |
AddSinglePartOfTimeL( years.Int(), |
|
1556 |
R_QTN_DRM_NBR_OF_YEARS_ONE, |
|
1557 |
R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL, |
|
1558 |
R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR, |
|
1559 |
R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO, |
|
1560 |
value ); |
|
1561 |
count++; |
|
1562 |
val.Append( *value ); |
|
1563 |
endTime -= years; |
|
1564 |
CleanupStack::PopAndDestroy( value ); |
|
1565 |
} |
|
1566 |
||
1567 |
// months |
|
1568 |
TTimeIntervalMonths months = endTime.MonthsFrom( currentTime ); |
|
1569 |
if ( months.Int() ) |
|
1570 |
{ |
|
1571 |
AddSinglePartOfTimeL( months.Int(), |
|
1572 |
R_QTN_DRM_NBR_OF_MONTHS_ONE, |
|
1573 |
0, |
|
1574 |
R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR, |
|
1575 |
R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO, |
|
1576 |
value ); |
|
1577 |
if ( count ) |
|
1578 |
{ |
|
1579 |
val.Append( KMPXSpace ); |
|
1580 |
} |
|
1581 |
||
1582 |
count++; |
|
1583 |
val.Append( *value ); |
|
1584 |
endTime -= months; |
|
1585 |
CleanupStack::PopAndDestroy( value ); |
|
1586 |
} |
|
1587 |
||
1588 |
// days |
|
1589 |
TTimeIntervalDays days = endTime.DaysFrom( currentTime ); |
|
1590 |
if ( days.Int() && count < 2 ) |
|
1591 |
{ |
|
1592 |
AddSinglePartOfTimeL( days.Int(), |
|
1593 |
R_QTN_DRM_NBR_OF_DAYS_ONE, |
|
1594 |
R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL, |
|
1595 |
R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR, |
|
1596 |
R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO, |
|
1597 |
value ); |
|
1598 |
if ( count ) |
|
1599 |
{ |
|
1600 |
val.Append( KMPXSpace ); |
|
1601 |
} |
|
1602 |
||
1603 |
val.Append( *value ); |
|
1604 |
endTime -= days; |
|
1605 |
CleanupStack::PopAndDestroy( value ); |
|
1606 |
count++; |
|
1607 |
} |
|
1608 |
||
1609 |
// hours |
|
1610 |
TTimeIntervalHours hours; |
|
1611 |
TInt ret = endTime.HoursFrom( currentTime, hours ); |
|
1612 |
if ( ret == KErrNone && count < 2 && hours.Int() ) |
|
1613 |
{ |
|
1614 |
AddSinglePartOfTimeL( hours.Int(), |
|
1615 |
R_QTN_DRM_NBR_OF_HOURS_ONE, |
|
1616 |
R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL, |
|
1617 |
R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR, |
|
1618 |
R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO, |
|
1619 |
value ); |
|
1620 |
if ( count ) |
|
1621 |
{ |
|
1622 |
val.Append( KMPXSpace ); |
|
1623 |
} |
|
1624 |
||
1625 |
val.Append( *value ); |
|
1626 |
endTime -= hours; |
|
1627 |
CleanupStack::PopAndDestroy( value ); |
|
1628 |
count++; |
|
1629 |
} |
|
1630 |
||
1631 |
// mins |
|
1632 |
TTimeIntervalMinutes minutes; |
|
1633 |
ret = endTime.MinutesFrom( currentTime, minutes ); |
|
1634 |
if ( ret == KErrNone && count < 2 && minutes.Int() ) |
|
1635 |
{ |
|
1636 |
AddSinglePartOfTimeL( minutes.Int(), |
|
1637 |
R_QTN_DRM_NBR_OF_MINS_ONE, |
|
1638 |
R_QTN_DRM_NBR_OF_MINS_ONE_FINAL, |
|
1639 |
R_QTN_DRM_NBR_OF_MINS_TWO_FOUR, |
|
1640 |
R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO, |
|
1641 |
value ); |
|
1642 |
if ( count ) |
|
1643 |
{ |
|
1644 |
val.Append( KMPXSpace ); |
|
1645 |
} |
|
1646 |
||
1647 |
val.Append( *value ); |
|
1648 |
endTime -= minutes; |
|
1649 |
CleanupStack::PopAndDestroy( value ); |
|
1650 |
count++; |
|
1651 |
} |
|
1652 |
||
1653 |
// seconds |
|
1654 |
TTimeIntervalSeconds seconds; |
|
1655 |
ret = endTime.SecondsFrom( currentTime,seconds ); |
|
1656 |
if ( ret == KErrNone && count < 2 && seconds.Int() ) |
|
1657 |
{ |
|
1658 |
AddSinglePartOfTimeL( seconds.Int(), |
|
1659 |
R_QTN_DRM_NBR_OF_SECS_ONE, |
|
1660 |
R_QTN_DRM_NBR_OF_SECS_ONE_FINAL, |
|
1661 |
R_QTN_DRM_NBR_OF_SECS_TWO_FOUR, |
|
1662 |
R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO, |
|
1663 |
value ); |
|
1664 |
||
1665 |
if ( count ) |
|
1666 |
{ |
|
1667 |
val.Append( KMPXSpace ); |
|
1668 |
} |
|
1669 |
||
1670 |
val.Append( *value ); |
|
1671 |
CleanupStack::PopAndDestroy(); // value |
|
1672 |
count++; |
|
1673 |
} |
|
1674 |
||
1675 |
heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UDL_X, *aRights ); |
|
1676 |
LanguageSpecificNumberConversion( val ); |
|
1677 |
aHeadingsArray->InsertL( aCurrentIndex, heading->Des() ); |
|
1678 |
aDataArray->InsertL( aCurrentIndex, val ); |
|
1679 |
CleanupStack::PopAndDestroy( heading ); |
|
1680 |
aCurrentIndex++; |
|
1681 |
} |
|
1682 |
} |
|
1683 |
||
1684 |
// ----------------------------------------------------------------------------- |
|
1685 |
// CMPXMetadataEditorDialog::AddPartsOfTimeLC |
|
1686 |
// ----------------------------------------------------------------------------- |
|
1687 |
// |
|
1688 |
HBufC* CMPXMetadataEditorDialog::AddPartsOfTimeLC( TInt aIntYrs, TInt aIntMon, TInt aIntDay, |
|
1689 |
TInt aIntHrs, TInt aIntMin, TInt aIntSec ) |
|
1690 |
{ |
|
1691 |
MPX_FUNC( "CMPXMetadataEditorDialog::AddPartsOfTimeLC" ); |
|
1692 |
// Only the two most meaningful data will be showed |
|
1693 |
TInt numOfData( 0 ); |
|
1694 |
const TInt KMaxDataItems = 2; |
|
1695 |
||
1696 |
CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( KMaxDataItems ); |
|
1697 |
CleanupStack::PushL( strings ); |
|
1698 |
||
1699 |
if ( aIntYrs > 0 ) |
|
1700 |
{ |
|
1701 |
AddSinglePartOfTimeL( aIntYrs, |
|
1702 |
R_QTN_DRM_NBR_OF_YEARS_ONE, |
|
1703 |
R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL, |
|
1704 |
R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR, |
|
1705 |
R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO, |
|
1706 |
strings ); |
|
1707 |
numOfData++; |
|
1708 |
} |
|
1709 |
||
1710 |
if ( aIntMon > 0 ) |
|
1711 |
{ |
|
1712 |
// Second type not provided because 11 is the maximum |
|
1713 |
AddSinglePartOfTimeL( aIntMon, |
|
1714 |
R_QTN_DRM_NBR_OF_MONTHS_ONE, |
|
1715 |
0, |
|
1716 |
R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR, |
|
1717 |
R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO, |
|
1718 |
strings ); |
|
1719 |
numOfData++; |
|
1720 |
} |
|
1721 |
||
1722 |
// Only if years or months were missing |
|
1723 |
if ( aIntDay > 0 && numOfData < KMaxDataItems ) |
|
1724 |
{ |
|
1725 |
AddSinglePartOfTimeL( aIntDay, |
|
1726 |
R_QTN_DRM_NBR_OF_DAYS_ONE, |
|
1727 |
R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL, |
|
1728 |
R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR, |
|
1729 |
R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO, |
|
1730 |
strings ); |
|
1731 |
numOfData++; |
|
1732 |
} |
|
1733 |
||
1734 |
if ( aIntHrs > 0 && numOfData < KMaxDataItems ) |
|
1735 |
{ |
|
1736 |
AddSinglePartOfTimeL( aIntHrs, |
|
1737 |
R_QTN_DRM_NBR_OF_HOURS_ONE, |
|
1738 |
R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL, |
|
1739 |
R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR, |
|
1740 |
R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO, |
|
1741 |
strings ); |
|
1742 |
numOfData++; |
|
1743 |
} |
|
1744 |
||
1745 |
if ( aIntMin > 0 && numOfData < KMaxDataItems ) |
|
1746 |
{ |
|
1747 |
AddSinglePartOfTimeL( aIntMin, |
|
1748 |
R_QTN_DRM_NBR_OF_MINS_ONE, |
|
1749 |
R_QTN_DRM_NBR_OF_MINS_ONE_FINAL, |
|
1750 |
R_QTN_DRM_NBR_OF_MINS_TWO_FOUR, |
|
1751 |
R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO, |
|
1752 |
strings ); |
|
1753 |
numOfData++; |
|
1754 |
} |
|
1755 |
||
1756 |
// If interval is 0, then it shows "0 seconds" anyway |
|
1757 |
if ( ( aIntSec > 0 && numOfData < KMaxDataItems ) || numOfData == 0 ) |
|
1758 |
{ |
|
1759 |
AddSinglePartOfTimeL( aIntSec, |
|
1760 |
R_QTN_DRM_NBR_OF_SECS_ONE, |
|
1761 |
R_QTN_DRM_NBR_OF_SECS_ONE_FINAL, |
|
1762 |
R_QTN_DRM_NBR_OF_SECS_TWO_FOUR, |
|
1763 |
R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO, |
|
1764 |
strings ); |
|
1765 |
numOfData++; |
|
1766 |
} |
|
1767 |
||
1768 |
HBufC* stringHolder = NULL; |
|
1769 |
if ( numOfData == 1 ) |
|
1770 |
{ |
|
1771 |
stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER, |
|
1772 |
strings->MdcaPoint(0) ); |
|
1773 |
} |
|
1774 |
else |
|
1775 |
{ |
|
1776 |
stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER_TWO, |
|
1777 |
*strings ); |
|
1778 |
} |
|
1779 |
||
1780 |
CleanupStack::PopAndDestroy( strings ); |
|
1781 |
||
1782 |
CleanupStack::PushL( stringHolder ); |
|
1783 |
||
1784 |
return stringHolder; |
|
1785 |
} |
|
1786 |
||
1787 |
// ----------------------------------------------------------------------------- |
|
1788 |
// CMPXMetadataEditorDialog::AddSinglePartOfTimeL |
|
1789 |
// ----------------------------------------------------------------------------- |
|
1790 |
// |
|
1791 |
void CMPXMetadataEditorDialog::AddSinglePartOfTimeL( TInt aNumOfElements, |
|
1792 |
TInt aResourceIdSingle, |
|
1793 |
TInt aResourceIdOneFinal, |
|
1794 |
TInt aResourceIdTwoFour, |
|
1795 |
TInt aResourceIdFiveZero, |
|
1796 |
CDesCArrayFlat* aStrings ) |
|
1797 |
{ |
|
1798 |
MPX_FUNC( "CMPXMetadataEditorDialog::AddSinglePartOfTimeL" ); |
|
1799 |
||
1800 |
HBufC* stringHolder = NULL; |
|
1801 |
TInt finalOneDigit( aNumOfElements % KDigitTen ); |
|
1802 |
TInt finalTwoDigits( aNumOfElements % KDigitHundred ); |
|
1803 |
||
1804 |
if ( aNumOfElements == 1 ) |
|
1805 |
{ |
|
1806 |
stringHolder = StringLoader::LoadLC( aResourceIdSingle ); |
|
1807 |
} |
|
1808 |
else if ( finalOneDigit == 1 && finalTwoDigits != KDigitEleven ) |
|
1809 |
{ |
|
1810 |
stringHolder = StringLoader::LoadLC( aResourceIdOneFinal, |
|
1811 |
aNumOfElements ); |
|
1812 |
} |
|
1813 |
else if ( finalOneDigit == 0 || |
|
1814 |
( finalOneDigit >= KDigitFive && finalOneDigit <= KDigitNine ) || |
|
1815 |
( finalTwoDigits >= KDigitEleven && finalTwoDigits <= KDigitFourTeen ) ) |
|
1816 |
{ |
|
1817 |
stringHolder = StringLoader::LoadLC( aResourceIdFiveZero, |
|
1818 |
aNumOfElements ); |
|
1819 |
} |
|
1820 |
else |
|
1821 |
{ |
|
1822 |
stringHolder = StringLoader::LoadLC( aResourceIdTwoFour, |
|
1823 |
aNumOfElements ); |
|
1824 |
} |
|
1825 |
||
1826 |
if ( aStrings ) |
|
1827 |
{ |
|
1828 |
aStrings->AppendL( *stringHolder ); |
|
1829 |
} |
|
1830 |
||
1831 |
CleanupStack::PopAndDestroy ( stringHolder ); |
|
1832 |
} |
|
1833 |
||
1834 |
// ----------------------------------------------------------------------------- |
|
1835 |
// CMPXMetadataEditorDialog::SplitTime |
|
1836 |
// |
|
1837 |
// ----------------------------------------------------------------------------- |
|
1838 |
// |
|
1839 |
||
1840 |
void CMPXMetadataEditorDialog::SplitTime( const TTimeIntervalSeconds& aInterval, |
|
1841 |
TInt& aIntYrs, TInt& aIntMon, TInt& aIntDay, |
|
1842 |
TInt& aIntHrs, TInt& aIntMin, TInt& aIntSec ) |
|
1843 |
{ |
|
1844 |
MPX_FUNC( "CMPXMetadataEditorDialog::SplitTime" ); |
|
1845 |
const TInt KSecsInMin( 60 ); |
|
1846 |
const TInt KSecsInHour( KSecsInMin * 60 ); |
|
1847 |
const TInt KSecsInDay( KSecsInHour * 24 ); |
|
1848 |
||
1849 |
// includes leap year day |
|
1850 |
||
1851 |
const TInt KMaxDaysInMonths[] = { |
|
1852 |
KMaxDaysInOneMonths, |
|
1853 |
KMaxDaysInTwoMonths, |
|
1854 |
KMaxDaysInThreeMonths, |
|
1855 |
KMaxDaysInFourMonths, |
|
1856 |
KMaxDaysInFiveMonths, |
|
1857 |
KMaxDaysInSixMonths, |
|
1858 |
KMaxDaysInSevenMonths, |
|
1859 |
KMaxDaysInEightMonths, |
|
1860 |
KMaxDaysInNineMonths, |
|
1861 |
KMaxDaysInTenMonths, |
|
1862 |
KMaxDaysInElevenMonths, |
|
1863 |
KMaxDaysInEightMonths }; |
|
1864 |
||
1865 |
// calculate full days |
|
1866 |
TInt temp( aInterval.Int() / KSecsInDay ); |
|
1867 |
||
1868 |
// calculate full years, calculate without leap year for user to get the |
|
1869 |
// longest time possible |
|
1870 |
aIntYrs = temp / ( KMaxDaysInMonths[KDigitEleven] - 1 ); |
|
1871 |
||
1872 |
// calc remainder days |
|
1873 |
temp = temp % ( KMaxDaysInMonths[KDigitEleven] - 1 ); |
|
1874 |
||
1875 |
aIntMon = 0; |
|
1876 |
||
1877 |
TInt i( 0 ); |
|
1878 |
if ( temp >= KMaxDaysInMonths[0] ) |
|
1879 |
{ |
|
1880 |
for ( i = 0; i < KDigitEleven; i++ ) |
|
1881 |
{ |
|
1882 |
// found correct amount of months |
|
1883 |
if ( temp >= KMaxDaysInMonths[i] && temp < KMaxDaysInMonths[i+1] ) |
|
1884 |
{ |
|
1885 |
// i now contains amount of full months (+1 because of table index) |
|
1886 |
aIntMon = i + 1; |
|
1887 |
break; |
|
1888 |
} |
|
1889 |
} |
|
1890 |
} |
|
1891 |
||
1892 |
// calc remainder days = allSecs - secsInFullYears - secsInFullMonts |
|
1893 |
if( temp >= KMaxDaysInMonths[i] ) |
|
1894 |
{ |
|
1895 |
aIntDay = temp - KMaxDaysInMonths[i]; |
|
1896 |
} |
|
1897 |
else |
|
1898 |
{ |
|
1899 |
aIntDay = temp; |
|
1900 |
} |
|
1901 |
||
1902 |
// calculate remainder secs |
|
1903 |
temp = aInterval.Int() % KSecsInDay; |
|
1904 |
||
1905 |
aIntHrs = temp / KSecsInHour; |
|
1906 |
||
1907 |
// calculate remainder secs |
|
1908 |
temp = temp % KSecsInHour; |
|
1909 |
||
1910 |
aIntMin = temp / KSecsInMin; |
|
1911 |
||
1912 |
// calculate remainder secs |
|
1913 |
aIntSec = temp % KSecsInMin; |
|
1914 |
} |
|
1915 |
||
1916 |
// ----------------------------------------------------------------------------- |
|
1917 |
// CMPXMetadataEditorDialog::AddSinglePartOfTimeL |
|
1918 |
// Language specific time formats |
|
1919 |
// ----------------------------------------------------------------------------- |
|
1920 |
// |
|
1921 |
void CMPXMetadataEditorDialog::AddSinglePartOfTimeL( |
|
1922 |
TInt aNumOfElements, |
|
1923 |
TInt aResourceIdSingle, |
|
1924 |
TInt aResourceIdOneFinal, |
|
1925 |
TInt aResourceIdTwoFour, |
|
1926 |
TInt aResourceIdFiveZero, |
|
1927 |
HBufC*& aStrings ) |
|
1928 |
{ |
|
1929 |
MPX_FUNC( "CMPXMetadataEditorDialog::AddSinglePartOfTimeL" ); |
|
1930 |
TInt finalOneDigit = aNumOfElements % KMPXOneDigit; |
|
1931 |
TInt finalTwoDigits = aNumOfElements % KMPXTwoDigits; |
|
1932 |
||
1933 |
if ( aNumOfElements == 1 ) |
|
1934 |
{ |
|
1935 |
aStrings = StringLoader::LoadLC( aResourceIdSingle ); |
|
1936 |
} |
|
1937 |
else if ( finalOneDigit == 1 && finalTwoDigits != KDigitEleven ) |
|
1938 |
{ |
|
1939 |
// Used for period of years ending with 1 from 21 (21, 31, 41, etc.) |
|
1940 |
aStrings = StringLoader::LoadLC( aResourceIdOneFinal, aNumOfElements ); |
|
1941 |
} |
|
1942 |
else if ( finalOneDigit == 0 || |
|
1943 |
( finalOneDigit >= KDigitFive && finalOneDigit <= KDigitNine ) || |
|
1944 |
( finalTwoDigits >= KDigitEleven && finalTwoDigits <= KDigitFourTeen ) ) |
|
1945 |
{ |
|
1946 |
// Used for period of minutes ending from 5 to 0 plus range between 11 |
|
1947 |
// and 14 (5-20, 25-30, 35-40, 45-50, 53-59) |
|
1948 |
aStrings = StringLoader::LoadLC( aResourceIdFiveZero, aNumOfElements ); |
|
1949 |
} |
|
1950 |
else |
|
1951 |
{ |
|
1952 |
// Used for period of minutes ending from 2 to 4, excluded 12-14 (2-4, |
|
1953 |
// 22-24, 32-34, 42-44, 52-54) |
|
1954 |
aStrings = StringLoader::LoadLC( aResourceIdTwoFour, aNumOfElements ); |
|
1955 |
} |
|
1956 |
} |
|
1957 |
||
1958 |
// ----------------------------------------------------------------------------- |
|
1959 |
// CMPXMetadataEditorDialog::LanguageSpecificNumberConversion |
|
1960 |
// ----------------------------------------------------------------------------- |
|
1961 |
// |
|
1962 |
void CMPXMetadataEditorDialog::LanguageSpecificNumberConversion( TDes& aText ) const |
|
1963 |
{ |
|
1964 |
MPX_FUNC( "CMPXMetadataEditorDialog::LanguageSpecificNumberConversion" ); |
|
1965 |
if ( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) ) |
|
1966 |
{ |
|
1967 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aText ); |
|
1968 |
} |
|
1969 |
} |
|
1970 |
||
1971 |
||
1972 |
// ---------------------------------------------------------------------------- |
|
1973 |
// Converts the time value to localtime |
|
1974 |
// ---------------------------------------------------------------------------- |
|
1975 |
// |
|
1976 |
void CMPXMetadataEditorDialog::ConvertToLocalTimeL(TTime& aTime ) |
|
1977 |
{ |
|
1978 |
RTz timeConverter; |
|
1979 |
CleanupClosePushL(timeConverter); |
|
1980 |
User::LeaveIfError( timeConverter.Connect() ); |
|
1981 |
User::LeaveIfError( timeConverter.ConvertToLocalTime( aTime ) ); |
|
1982 |
CleanupStack::PopAndDestroy(); |
|
1983 |
} |
|
1984 |
||
1985 |
// ----------------------------------------------------------------------------- |
|
1986 |
// CMPXMetadataEditorDialog::AddItemToListBoxL |
|
1987 |
// ----------------------------------------------------------------------------- |
|
1988 |
// |
|
1989 |
void CMPXMetadataEditorDialog::AddItemToListBoxL( |
|
1990 |
const TDesC& aHeading, |
|
1991 |
const TDesC& aValue, |
|
1992 |
CDesCArray* aItemArray ) |
|
1993 |
{ |
|
1994 |
MPX_FUNC( "CMPXMetadataEditorDialog::AddItemToListBoxL" ); |
|
1995 |
CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat( 2 ); |
|
1996 |
CleanupStack::PushL( items ); |
|
1997 |
items->AppendL( aHeading ); //First string (heading) |
|
1998 |
items->AppendL( aValue ); //Second string (value) |
|
1999 |
HBufC* headingAndValue = |
|
2000 |
StringLoader::LoadLC( R_MPX_CUI_METADATAEDITOR_FILE_DETAILS_ROW_FORMAT, *items ); |
|
2001 |
||
2002 |
aItemArray->AppendL( *headingAndValue ); |
|
2003 |
CleanupStack::PopAndDestroy( headingAndValue ); |
|
2004 |
CleanupStack::PopAndDestroy( items ); |
|
2005 |
} |
|
2006 |
||
2007 |
// ----------------------------------------------------------------------------- |
|
2008 |
// CMPXMetadataEditorDialog::HandleControlStateChangeL |
|
2009 |
// Handle State Changes in Genre popup. |
|
2010 |
// ----------------------------------------------------------------------------- |
|
2011 |
// |
|
2012 |
void CMPXMetadataEditorDialog::HandleControlStateChangeL( TInt aControlId ) |
|
2013 |
{ |
|
2014 |
MPX_FUNC( "CMPXMetadataEditorDialog::HandleControlStateChangeL" ); |
|
2015 |
if( !iTryingExit ) |
|
2016 |
{ |
|
2017 |
if ( aControlId == EMPXMetadataEditorDlgCtrlIdGenre ) |
|
2018 |
{ |
|
2019 |
// check to see if the genre pop has item custom selected |
|
2020 |
if ( iTextValues->CurrentValueIndex() == 0 ) |
|
2021 |
{ |
|
2022 |
HBufC* genreName = HBufC::NewLC( KMPXSongDetailsTextMaxLen ); |
|
2023 |
TPtr genrePtr = genreName->Des(); |
|
2024 |
CAknTextQueryDialog* queryDlg = |
|
2025 |
CAknTextQueryDialog::NewL( genrePtr ); |
|
2026 |
CleanupStack::PushL( queryDlg ); |
|
2027 |
HBufC* promptTxt = NULL; |
|
2028 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection ) |
|
2029 |
{ |
|
2030 |
promptTxt = StringLoader::LoadLC( R_MPX_CUI_CUSTOM_GENRE_RENAME_TEXT ); |
|
2031 |
} |
|
2032 |
else |
|
2033 |
{ |
|
2034 |
promptTxt = StringLoader::LoadLC( R_MPX_CUI_CUSTOM_CATEGORY_RENAME_TEXT ); |
|
2035 |
} |
|
2036 |
queryDlg->SetPromptL( *promptTxt ); |
|
2037 |
queryDlg->SetPredictiveTextInputPermitted( ETrue ); |
|
2038 |
CleanupStack::PopAndDestroy( promptTxt ); |
|
2039 |
CleanupStack::Pop( queryDlg ); |
|
2040 |
if ( queryDlg->ExecuteLD( R_MPX_CUI_CUSTOM_GENRE_NAME_QUERY_DLG ) ) |
|
2041 |
{ |
|
2042 |
TBool isHandled = EFalse; |
|
2043 |
TBool tryExit = EFalse; |
|
2044 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection ) |
|
2045 |
{ |
|
2046 |
// in music libray, if genre is set to podcast, ask user |
|
2047 |
// to confirm move to podcast database |
|
2048 |
HBufC* podcastText = StringLoader::LoadLC( R_MPX_QTN_NMP_GENRE_PODCAST ); |
|
2049 |
if ( genreName->Des().CompareF( *podcastText ) == 0 && |
|
2050 |
!iDisablePodcasting ) |
|
2051 |
{ |
|
2052 |
isHandled = ETrue; |
|
2053 |
// genre is set to podcast |
|
2054 |
if ( PromptForLibraryChangeL( EMPXMetadataEditorDlgPodcast ) ) |
|
2055 |
{ |
|
2056 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleControlStateChangeL Move to a different library" ); |
|
2057 |
iCollectionUiHelper->MoveL( iMedia, TUid::Uid(EMPXCollectionPluginPodCast) , this); |
|
2058 |
tryExit = ETrue; |
|
2059 |
iTryingExit = ETrue; |
|
2060 |
} |
|
2061 |
} |
|
2062 |
CleanupStack::PopAndDestroy( podcastText ); |
|
2063 |
} |
|
2064 |
if ( !isHandled ) |
|
2065 |
{ |
|
2066 |
// ok selected |
|
2067 |
CMPXMedia* media = CMPXMedia::NewL(); |
|
2068 |
CleanupStack::PushL( media ); |
|
2069 |
iMedia->SetTextValueL( |
|
2070 |
KMPXMediaMusicGenre, genreName->Des() ); |
|
2071 |
media->SetTextValueL( |
|
2072 |
KMPXMediaMusicGenre, genreName->Des() ); |
|
2073 |
SaveMediaPropertiesL( media ); |
|
2074 |
CleanupStack::PopAndDestroy( media ); |
|
2075 |
} |
|
2076 |
if ( !tryExit ) |
|
2077 |
{ |
|
2078 |
FetchGenreL(); |
|
2079 |
} |
|
2080 |
} |
|
2081 |
else |
|
2082 |
{ |
|
2083 |
// Text query cancelled. Display popup list again. |
|
2084 |
iPopup->ActivateSelectionListL(); |
|
2085 |
||
2086 |
// reset to original index |
|
2087 |
TInt genreIndex; |
|
2088 |
iGenreArr->Find( iMedia->ValueText( KMPXMediaMusicGenre ), genreIndex ); |
|
2089 |
iTextValues->SetCurrentValueIndex( genreIndex ); |
|
2090 |
} |
|
2091 |
CleanupStack::PopAndDestroy( genreName ); |
|
2092 |
} |
|
2093 |
else |
|
2094 |
{ |
|
2095 |
if ( iUnknownGenre && |
|
2096 |
( iTextValues->CurrentValueIndex() == ( iTextValues->MdcArray()->MdcaCount() - 1 ) ) ) |
|
2097 |
{ |
|
2098 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleControlStateChangeL last entry with unknown genre, do nothing" ); |
|
2099 |
} |
|
2100 |
else |
|
2101 |
{ |
|
2102 |
CMPXMedia* media = CMPXMedia::NewL(); |
|
2103 |
CleanupStack::PushL( media ); |
|
2104 |
HBufC* currentTxt = iTextValues->CurrentValueTextLC(); |
|
2105 |
iMedia->SetTextValueL( KMPXMediaMusicGenre, *currentTxt ); |
|
2106 |
media->SetTextValueL( KMPXMediaMusicGenre, *currentTxt ); |
|
2107 |
CleanupStack::PopAndDestroy( currentTxt ); |
|
2108 |
SaveMediaPropertiesL( media ); |
|
2109 |
CleanupStack::PopAndDestroy( media ); |
|
2110 |
FetchGenreL(); |
|
2111 |
} |
|
2112 |
} |
|
2113 |
} |
|
2114 |
else if ( aControlId == EMPXMetadataEditorDlgCtrlIdLibrary ) |
|
2115 |
{ |
|
2116 |
TInt currentIndex = iLibraryTextValues->CurrentValueIndex(); |
|
2117 |
if ( iCurrentLibrary != currentIndex ) |
|
2118 |
{ |
|
2119 |
if ( PromptForLibraryChangeL( currentIndex ) ) |
|
2120 |
{ |
|
2121 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleControlStateChangeL Move to a different library" ); |
|
2122 |
TUid targetCollection = TUid::Uid( EMPXCollectionPluginMusic ); |
|
2123 |
if ( currentIndex == EMPXMetadataEditorDlgPodcast ) |
|
2124 |
{ |
|
2125 |
targetCollection = TUid::Uid(EMPXCollectionPluginPodCast); |
|
2126 |
} |
|
2127 |
// before moving, save current data |
|
2128 |
SaveFormDataL(); |
|
2129 |
iCurrentLibrary = currentIndex; // Fix for ELWG-7AACMS prevent the if clause to be reentried. |
|
2130 |
iCollectionUiHelper->MoveL( iMedia, targetCollection, this ); |
|
2131 |
iTryingExit = ETrue; |
|
2132 |
} |
|
2133 |
else |
|
2134 |
{ |
|
2135 |
iLibraryTextValues->SetCurrentValueIndex( iCurrentLibrary ); |
|
2136 |
// Fix EIZU-7QQAZN, Let it display back to "Music" immediately. |
|
2137 |
if ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdLibrary ) |
|
2138 |
{ |
|
2139 |
iPopup = static_cast<CAknPopupField*> |
|
2140 |
( ControlOrNull( EMPXMetadataEditorDlgCtrlIdLibrary ) ); |
|
2141 |
if ( iPopup ) |
|
2142 |
{ |
|
2143 |
iPopup->SetQueryValueL( iLibraryTextValues ); |
|
2144 |
iPopup->DrawDeferred(); |
|
2145 |
} |
|
2146 |
} |
|
2147 |
} |
|
2148 |
} |
|
2149 |
} |
|
2150 |
} |
|
2151 |
CAknForm::HandleControlStateChangeL( aControlId ); |
|
2152 |
} |
|
2153 |
||
2154 |
// ----------------------------------------------------------------------------- |
|
2155 |
// CMPXMetadataEditorDialog::PrepareForFocusTransitionL |
|
2156 |
// Handle Focus changes for track and year controls. |
|
2157 |
// ----------------------------------------------------------------------------- |
|
2158 |
// |
|
2159 |
void CMPXMetadataEditorDialog::PrepareForFocusTransitionL() |
|
2160 |
{ |
|
2161 |
MPX_FUNC( "CMPXMetadataEditorDialog::PrepareForFocusTransitionL" ); |
|
2162 |
CAknForm::PrepareForFocusTransitionL(); |
|
2163 |
} |
|
2164 |
||
2165 |
// ----------------------------------------------------------------------------- |
|
2166 |
// CMPXMetadataEditorDialog::GetHelpContext |
|
2167 |
// Gets Help |
|
2168 |
// (other items were commented in a header). |
|
2169 |
// ----------------------------------------------------------------------------- |
|
2170 |
// |
|
2171 |
void CMPXMetadataEditorDialog::GetHelpContext( |
|
2172 |
TCoeHelpContext& aContext ) const |
|
2173 |
{ |
|
2174 |
MPX_FUNC( "CMPXMetadataEditorDialog::GetHelpContext" ); |
|
2175 |
aContext.iMajor = KAppUidMusicPlayerX; |
|
2176 |
aContext.iContext = KMUS_HLP_METADATA_EDITING; |
|
2177 |
} |
|
2178 |
||
2179 |
// ----------------------------------------------------------------------------- |
|
2180 |
// CMPXMetadataEditorDialog::HandleFindAllL |
|
2181 |
// Handle callback for "find" operation |
|
2182 |
// ----------------------------------------------------------------------------- |
|
2183 |
// |
|
2184 |
void CMPXMetadataEditorDialog::HandleFindAllL(const CMPXMedia& aResults, |
|
2185 |
TBool /*aComplete*/, TInt aError) |
|
2186 |
{ |
|
2187 |
MPX_FUNC( "CMPXMetadataEditorDialog::HandleFindAllL" ); |
|
2188 |
iPopup = static_cast<CAknPopupField*> |
|
2189 |
( ControlOrNull( EMPXMetadataEditorDlgCtrlIdGenre ) ); |
|
2190 |
CleanUpGenreText(); |
|
2191 |
// populate predefined genre |
|
2192 |
TResourceReader reader; |
|
2193 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection ) |
|
2194 |
{ |
|
2195 |
if( !iDisablePodcasting ) |
|
2196 |
{ |
|
2197 |
iEikonEnv->CreateResourceReaderLC( reader, R_MPX_MUSIC_GENRE_STRINGS ); |
|
2198 |
} |
|
2199 |
else |
|
2200 |
{ |
|
2201 |
iEikonEnv->CreateResourceReaderLC( reader, R_MPX_MUSIC_GENRE_STRINGS_PODCAST ); |
|
2202 |
} |
|
2203 |
} |
|
2204 |
else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast ) |
|
2205 |
{ |
|
2206 |
iEikonEnv->CreateResourceReaderLC( |
|
2207 |
reader, R_MPX_PODCAST_CATEGORY_STRINGS ); |
|
2208 |
} |
|
2209 |
iGenreArr = reader.ReadDesCArrayL( ); |
|
2210 |
CleanupStack::PopAndDestroy(); // reader |
|
2211 |
||
2212 |
// populate genres from database |
|
2213 |
if ( aError == KErrNone ) |
|
2214 |
{ |
|
2215 |
const CMPXMediaArray* mediaArray = |
|
2216 |
aResults.Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
2217 |
User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
2218 |
||
2219 |
TInt entriesCount( mediaArray->Count() ); |
|
2220 |
MPX_DEBUG2( "CMPXMetadataEditorDialog::HandleFindAllL genres from database count = %d", entriesCount ); |
|
2221 |
for ( TInt i = 0; i < entriesCount; i++ ) |
|
2222 |
{ |
|
2223 |
CMPXMedia* media = mediaArray->AtL( i ); |
|
2224 |
TInt location( 0 ); |
|
2225 |
const TDesC& genre = media->ValueText( KMPXMediaGeneralTitle ); |
|
2226 |
if ( i == entriesCount - 1) |
|
2227 |
{ |
|
2228 |
if ( genre.Compare( KNullDesC ) != 0 ) |
|
2229 |
{ |
|
2230 |
// if last item is a null descriptor, don't append to array |
|
2231 |
if ( iGenreArr->Find( genre, location ) != 0 ) |
|
2232 |
{ |
|
2233 |
// a match is not found |
|
2234 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleFindAllL adding to genre list" ); |
|
2235 |
iGenreArr->AppendL( genre ); |
|
2236 |
} |
|
2237 |
} |
|
2238 |
} |
|
2239 |
else |
|
2240 |
{ |
|
2241 |
if ( iGenreArr->Find( genre, location ) != 0 ) |
|
2242 |
{ |
|
2243 |
// a match is not found |
|
2244 |
MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleFindAllL adding to genre list" ); |
|
2245 |
iGenreArr->AppendL( genre ); |
|
2246 |
} |
|
2247 |
} |
|
2248 |
} |
|
2249 |
} |
|
2250 |
iGenreArr->Sort(ECmpCollated); |
|
2251 |
||
2252 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection ) |
|
2253 |
{ |
|
2254 |
HBufC* custTxt = |
|
2255 |
StringLoader::LoadLC( R_MPX_CUI_CUSTOM_GENRE_PROMPT_TEXT ); |
|
2256 |
iGenreArr->InsertL( 0, *custTxt ); |
|
2257 |
CleanupStack::PopAndDestroy( custTxt ); |
|
2258 |
} |
|
2259 |
else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast ) |
|
2260 |
{ |
|
2261 |
HBufC* custTxt = |
|
2262 |
StringLoader::LoadLC( R_MPX_CUI_PODCAST_CUSTOM_GENRE_PROMPT_TEXT ); |
|
2263 |
iGenreArr->InsertL( 0, *custTxt ); |
|
2264 |
CleanupStack::PopAndDestroy( custTxt ); |
|
2265 |
} |
|
2266 |
||
2267 |
iValueTextArray = CAknQueryValueTextArray::NewL(); |
|
2268 |
iValueTextArray->SetArray( *iGenreArr ); |
|
2269 |
||
2270 |
iTextValues = CAknQueryValueText::NewL(); |
|
2271 |
iTextValues->SetArrayL( iValueTextArray ); |
|
2272 |
if ( iMedia->ValueText( KMPXMediaMusicGenre ).Length() == 0 ) |
|
2273 |
{ |
|
2274 |
// no genre |
|
2275 |
iUnknownGenre = ETrue; |
|
2276 |
HBufC* unknownGenre( StringLoader::LoadLC( R_MPX_CUI_UNKNOWN_GENRE_TEXT ) ); |
|
2277 |
iGenreArr->AppendL( *unknownGenre ); |
|
2278 |
CleanupStack::PopAndDestroy( unknownGenre ); |
|
2279 |
iTextValues->SetCurrentValueIndex( iGenreArr->Count() - 1 ); |
|
2280 |
} |
|
2281 |
else |
|
2282 |
{ |
|
2283 |
// Find the genre |
|
2284 |
iUnknownGenre = EFalse; |
|
2285 |
TInt genreIndex; |
|
2286 |
iGenreArr->Find( iMedia->ValueText( KMPXMediaMusicGenre ), genreIndex ); |
|
2287 |
iTextValues->SetCurrentValueIndex( genreIndex ); |
|
2288 |
} |
|
2289 |
// Set values into popup fields. |
|
2290 |
iPopup->SetQueryValueL( iTextValues ); // Moved up from below. |
|
2291 |
iPopup->DrawDeferred(); |
|
2292 |
} |
|
2293 |
||
2294 |
// ---------------------------------------------------------------------------- |
|
2295 |
// void CMPXMetadataEditorDialog::HandleOperationCompleteL |
|
2296 |
// Handle callback for the ui helper. |
|
2297 |
// ---------------------------------------------------------------------------- |
|
2298 |
// |
|
2299 |
void CMPXMetadataEditorDialog::HandleOperationCompleteL( |
|
2300 |
TCHelperOperation aOperation, |
|
2301 |
TInt aErr, void* aArgument ) |
|
2302 |
{ |
|
2303 |
MPX_FUNC( "CMPXMetadataEditorDialog::HandleOperationCompleteL" ); |
|
2304 |
if ( aOperation == EMoveOp ) |
|
2305 |
{ |
|
2306 |
if ( aErr != KErrNone ) |
|
2307 |
{ |
|
2308 |
// TO-DO: error handling |
|
2309 |
} |
|
2310 |
// move complete, quit the editor |
|
2311 |
if ( iIdle ) |
|
2312 |
{ |
|
2313 |
iIdle->Cancel(); |
|
2314 |
delete iIdle; |
|
2315 |
iIdle = NULL; |
|
2316 |
} |
|
2317 |
iIdle = CIdle::NewL( CActive::EPriorityStandard ); |
|
2318 |
iIdle->Start( TCallBack( CMPXMetadataEditorDialog::DeferredExitCallback, this ) ); |
|
2319 |
} |
|
2320 |
if ( aArgument ) |
|
2321 |
{ |
|
2322 |
delete (CBase*)aArgument; |
|
2323 |
} |
|
2324 |
} |
|
2325 |
||
2326 |
// ---------------------------------------------------------------------------- |
|
2327 |
// void CMPXMetadataEditorDialog::DeferredExitCallback |
|
2328 |
// call back function for deferred exit. |
|
2329 |
// ---------------------------------------------------------------------------- |
|
2330 |
// |
|
2331 |
TInt CMPXMetadataEditorDialog::DeferredExitCallback( TAny* aPtr ) |
|
2332 |
{ |
|
2333 |
MPX_FUNC( "CMPXMetadataEditorDialog::DeferredExitCallback" ); |
|
2334 |
CMPXMetadataEditorDialog* self = |
|
2335 |
static_cast<CMPXMetadataEditorDialog*>( aPtr ); |
|
2336 |
TRAP_IGNORE( self->TryExitL( EAknSoftkeyExit ) ); |
|
2337 |
return KErrNone; |
|
2338 |
} |
|
2339 |
||
2340 |
// ---------------------------------------------------------------------------- |
|
2341 |
// void CMPXMetadataEditorDialog::DeferredFileDetailsCallback |
|
2342 |
// call back function for deferred file details dialog. |
|
2343 |
// ---------------------------------------------------------------------------- |
|
2344 |
// |
|
2345 |
TInt CMPXMetadataEditorDialog::DeferredFileDetailsCallback( TAny* aPtr ) |
|
2346 |
{ |
|
2347 |
MPX_FUNC( "CMPXMetadataEditorDialog::DeferredFileDetailsCallback" ); |
|
2348 |
CMPXMetadataEditorDialog* self = |
|
2349 |
static_cast<CMPXMetadataEditorDialog*>( aPtr ); |
|
2350 |
TRAP_IGNORE( self->ViewFileDetailsPopupL() ); |
|
2351 |
return KErrNone; |
|
2352 |
} |
|
2353 |
||
2354 |
#ifdef __ENABLE_MSK |
|
2355 |
// ----------------------------------------------------------------------------- |
|
2356 |
// CMPXAddTracksDialog::UpdateSoftkeyL() |
|
2357 |
// Update softkey. |
|
2358 |
// (other items were commented in a header). |
|
2359 |
// ----------------------------------------------------------------------------- |
|
2360 |
// |
|
2361 |
void CMPXMetadataEditorDialog::UpdateSoftkeyL() |
|
2362 |
{ |
|
2363 |
MPX_FUNC( "CMPXMetadataEditorDialog::UpdateSoftkeyL" ); |
|
2364 |
TInt resId( 0 ); |
|
2365 |
||
2366 |
if ( ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdGenre ) || |
|
2367 |
( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdLibrary ) ) |
|
2368 |
{ |
|
2369 |
resId = R_MPX_CUI_SONG_DETAILS_SOFTKEYS_OPTIONS_CHANGE_DONE; |
|
2370 |
} |
|
2371 |
else |
|
2372 |
{ |
|
2373 |
resId = R_MPX_CUI_SONG_DETAILS_SOFTKEYS_OPTIONS_EMPTY_BACK; |
|
2374 |
} |
|
2375 |
||
2376 |
ButtonGroupContainer().SetCommandSetL( resId ); |
|
2377 |
ButtonGroupContainer().DrawDeferred(); |
|
2378 |
} |
|
2379 |
||
2380 |
// ----------------------------------------------------------------------------- |
|
2381 |
// CMPXMetadataEditorDialog::OfferKeyEventL |
|
2382 |
// Handles key-events. |
|
2383 |
// (other items were commented in a header). |
|
2384 |
// ----------------------------------------------------------------------------- |
|
2385 |
// |
|
2386 |
TKeyResponse CMPXMetadataEditorDialog::OfferKeyEventL( |
|
2387 |
const TKeyEvent& aKeyEvent, |
|
2388 |
TEventCode aType ) |
|
2389 |
{ |
|
2390 |
MPX_FUNC( "CMPXMetadataEditorDialog::OfferKeyEventL" ); |
|
2391 |
TKeyResponse res = CAknForm::OfferKeyEventL( aKeyEvent, aType ); |
|
2392 |
||
2393 |
if ( aType == EEventKey ) |
|
2394 |
{ |
|
2395 |
if (aKeyEvent.iScanCode && (aKeyEvent.iScanCode == EStdKeyUpArrow |
|
2396 |
|| aKeyEvent.iScanCode == EStdKeyDownArrow)) |
|
2397 |
{ |
|
2398 |
UpdateSoftkeyL(); |
|
2399 |
} |
|
2400 |
||
2401 |
else if ((aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) |
|
2402 |
&& (IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdDRMDetail)) |
|
2403 |
{ |
|
2404 |
LaunchDrmInfoL(); |
|
2405 |
} |
|
2406 |
} |
|
2407 |
||
2408 |
return res; |
|
2409 |
} |
|
2410 |
#endif // __ENABLE_MSK |
|
2411 |
||
2412 |
// ---------------------------------------------------------------------------- |
|
2413 |
// void CMPXMetadataEditorDialog::PreLayoutDynInitL |
|
2414 |
// Initialises the dialog's controls before the dialog is sized and layed out. |
|
2415 |
// ---------------------------------------------------------------------------- |
|
2416 |
// |
|
2417 |
void CMPXMetadataEditorDialog::PreLayoutDynInitL() |
|
2418 |
{ |
|
2419 |
MPX_FUNC( "CMPXMetadataEditorDialog::PreLayoutDynInitL" ); |
|
2420 |
SetTitlePaneL(); |
|
2421 |
SetNaviLabelL(); |
|
2422 |
||
2423 |
// Get media property for the current song |
|
2424 |
||
2425 |
if ( iParam ) // Dialog launched from CollectionView |
|
2426 |
{ |
|
2427 |
CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
2428 |
CleanupStack::PushL( cpath ); |
|
2429 |
TLex yearLex( iParam->Des() ); |
|
2430 |
TInt lexToInt = NULL; |
|
2431 |
if ( yearLex.Val( lexToInt ) == KErrNone ) |
|
2432 |
{ |
|
2433 |
cpath->Set( lexToInt ); |
|
2434 |
RArray<TMPXAttribute> attrs; |
|
2435 |
CleanupClosePushL(attrs); |
|
2436 |
attrs.Append( KMPXMediaGeneralAll ); |
|
2437 |
attrs.Append( KMPXMediaAudioAudioAll ); |
|
2438 |
attrs.Append( KMPXMediaMusicAll ); |
|
2439 |
attrs.Append( KMPXMediaDrmProtected ); |
|
2440 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast ) |
|
2441 |
{ |
|
2442 |
attrs.Append( |
|
2443 |
TMPXAttribute( KMPXMediaIdPodcast, EMPXMediaPodcastAll ) ); |
|
2444 |
} |
|
2445 |
iCurrentMediaLOp = EMPXMetadataEditorGetSongInfo; |
|
2446 |
iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() ); |
|
2447 |
CleanupStack::PopAndDestroy( &attrs ); |
|
2448 |
} |
|
2449 |
CleanupStack::PopAndDestroy( cpath ); |
|
2450 |
} |
|
2451 |
else // Dialog launched from NowPlayingView |
|
2452 |
{ |
|
2453 |
// Get the playback utility instance from engine. |
|
2454 |
iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault ); |
|
2455 |
MMPXSource* s = iPlaybackUtility->Source(); |
|
2456 |
if ( s ) |
|
2457 |
{ |
|
2458 |
RArray<TMPXAttribute> attrs; |
|
2459 |
CleanupClosePushL(attrs); |
|
2460 |
attrs.Append( KMPXMediaGeneralAll ); |
|
2461 |
attrs.Append( KMPXMediaAudioAudioAll ); |
|
2462 |
attrs.Append( KMPXMediaMusicAll ); |
|
2463 |
attrs.Append( KMPXMediaDrmProtected ); |
|
2464 |
if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast ) |
|
2465 |
{ |
|
2466 |
attrs.Append( |
|
2467 |
TMPXAttribute( KMPXMediaIdPodcast, EMPXMediaPodcastAll ) ); |
|
2468 |
} |
|
2469 |
iCurrentMediaLOp = EMPXMetadataEditorGetSongInfo; |
|
2470 |
s->MediaL(attrs.Array(), *this); |
|
2471 |
CleanupStack::PopAndDestroy( &attrs ); |
|
2472 |
} |
|
2473 |
} |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2474 |
|
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2475 |
|
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2476 |
// Podcasting is enabled |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2477 |
if ( !iDisablePodcasting ) |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2478 |
{ |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2479 |
iPopup = static_cast<CAknPopupField*> |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2480 |
( ControlOrNull( EMPXMetadataEditorDlgCtrlIdLibrary ) ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2481 |
iLibraryArr = new (ELeave) CDesCArrayFlat( 1 ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2482 |
HBufC* custTxt = StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_MUSIC_TEXT ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2483 |
iLibraryArr->AppendL( *custTxt ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2484 |
CleanupStack::PopAndDestroy( custTxt ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2485 |
custTxt = StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_PODCAST_TEXT ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2486 |
iLibraryArr->AppendL( *custTxt ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2487 |
CleanupStack::PopAndDestroy( custTxt ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2488 |
iLibraryValueTextArray = CAknQueryValueTextArray::NewL(); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2489 |
iLibraryValueTextArray->SetArray( *iLibraryArr ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2490 |
iLibraryTextValues = CAknQueryValueText::NewL(); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2491 |
iLibraryTextValues->SetArrayL( iLibraryValueTextArray ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2492 |
iLibraryTextValues->SetCurrentValueIndex( iCurrentLibrary ); |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2493 |
// Set values into popup fields |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2494 |
iPopup->SetQueryValueL( iLibraryTextValues ); // Moved up from below |
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2495 |
} |
53 | 2496 |
} |
2497 |
||
2498 |
// ---------------------------------------------------------------------------- |
|
2499 |
// CMPXMetadataEditorDialog::PostLayoutDynInitL |
|
2500 |
// Set default field value to member data. |
|
2501 |
// ---------------------------------------------------------------------------- |
|
2502 |
// |
|
2503 |
void CMPXMetadataEditorDialog::PostLayoutDynInitL() |
|
2504 |
{ |
|
2505 |
MPX_FUNC( "CMPXMetadataEditorDialog::PostLayoutDynInitL" ); |
|
2506 |
CAknForm::PostLayoutDynInitL(); |
|
2507 |
SetEditableL( EFalse ); |
|
2508 |
} |
|
2509 |
||
2510 |
// ----------------------------------------------------------------------------- |
|
2511 |
// CMPXMetadataEditorDialog::SaveMediaPropertiesL |
|
2512 |
// Saves media back to collection engine |
|
2513 |
// ----------------------------------------------------------------------------- |
|
2514 |
// |
|
2515 |
void CMPXMetadataEditorDialog::SaveMediaPropertiesL( CMPXMedia* aMedia ) |
|
2516 |
{ |
|
2517 |
MPX_FUNC( "CMPXMetadataEditorDialog::SaveMediaPropertiesL" ); |
|
2518 |
if ( iMedia->IsSupported( KMPXMediaGeneralUri ) ) |
|
2519 |
{ |
|
2520 |
aMedia->SetTextValueL( |
|
2521 |
KMPXMediaGeneralUri, iMedia->ValueText( KMPXMediaGeneralUri ) ); |
|
2522 |
} |
|
2523 |
||
2524 |
if ( iMedia->IsSupported( KMPXMediaGeneralType ) ) |
|
2525 |
{ |
|
2526 |
aMedia->SetTObjectValueL<TInt>( |
|
2527 |
KMPXMediaGeneralType, iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralType ) ); |
|
2528 |
} |
|
2529 |
||
2530 |
if ( iMedia->IsSupported( KMPXMediaGeneralCategory ) ) |
|
2531 |
{ |
|
2532 |
aMedia->SetTObjectValueL<TInt>( |
|
2533 |
KMPXMediaGeneralCategory, |
|
2534 |
iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCategory ) ); |
|
2535 |
} |
|
2536 |
||
2537 |
if ( iMedia->IsSupported( KMPXMediaGeneralId ) ) |
|
2538 |
{ |
|
2539 |
aMedia->SetTObjectValueL<TMPXItemId>( |
|
2540 |
KMPXMediaGeneralId, iMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
2541 |
} |
|
2542 |
||
2543 |
if ( iMedia->IsSupported( KMPXMediaGeneralCollectionId ) ) |
|
2544 |
{ |
|
2545 |
aMedia->SetTObjectValueL<TUid>( |
|
2546 |
KMPXMediaGeneralCollectionId, |
|
2547 |
iMedia->ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId ) ); |
|
2548 |
} |
|
2549 |
||
2550 |
if ( iMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) ) |
|
2551 |
{ |
|
2552 |
aMedia->SetTextValueL( |
|
2553 |
KMPXMediaMusicAlbumArtFileName, |
|
2554 |
iMedia->ValueText( KMPXMediaMusicAlbumArtFileName ) ); |
|
2555 |
} |
|
2556 |
||
2557 |
// toggle the modified flag for the internal media reference |
|
2558 |
// or else any subsequent FindAllL calls won't be able to |
|
2559 |
// match against this object |
|
2560 |
iMedia->SetTObjectValueL<TBool>(KMPXMediaGeneralModified, ETrue); |
|
2561 |
||
2562 |
// Set to collection via command |
|
2563 |
// |
|
2564 |
CMPXCommand* cmd = CMPXCommand::NewL(); |
|
2565 |
CleanupStack::PushL( cmd ); |
|
2566 |
||
2567 |
cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); |
|
2568 |
cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); |
|
2569 |
TUid colId(iMedia->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId)); |
|
2570 |
cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid ); |
|
2571 |
cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, aMedia ); |
|
2572 |
||
2573 |
iCollectionUtility->Collection().CommandL( *cmd ); |
|
2574 |
CleanupStack::PopAndDestroy( cmd ); |
|
2575 |
} |
|
2576 |
||
2577 |
// ----------------------------------------------------------------------------- |
|
2578 |
// CMPXMetadataEditorDialog::AppendStringToArrayL |
|
2579 |
// Appends the value to the array, if the vaule has zero length, |
|
2580 |
// appends "unavailable" |
|
2581 |
// ----------------------------------------------------------------------------- |
|
2582 |
// |
|
2583 |
void CMPXMetadataEditorDialog::AppendStringToArrayL( |
|
2584 |
CDesCArrayFlat* aArray, const TDesC& aValue ) |
|
2585 |
{ |
|
2586 |
MPX_FUNC( "CMPXMetadataEditorDialog::AppendStringToArrayL" ); |
|
2587 |
if ( aValue.Length() > 0 ) |
|
2588 |
{ |
|
2589 |
HBufC* stringBuf = HBufC::NewLC( |
|
2590 |
aValue.Length() + KMPXFileDetailsExtraBufferLen ); |
|
2591 |
TPtr stringBufPtr = stringBuf->Des(); |
|
2592 |
stringBufPtr.Append( aValue ); |
|
2593 |
aArray->AppendL( stringBufPtr ); |
|
2594 |
CleanupStack::PopAndDestroy( stringBuf ); |
|
2595 |
} |
|
2596 |
else |
|
2597 |
{ |
|
2598 |
aArray->AppendL( KNullDesC ); |
|
2599 |
} |
|
2600 |
} |
|
2601 |
||
2602 |
// ----------------------------------------------------------------------------- |
|
2603 |
// CMPXMetadataEditorDialog::SetControlTextL |
|
2604 |
// Sets control text |
|
2605 |
// ----------------------------------------------------------------------------- |
|
2606 |
// |
|
2607 |
void CMPXMetadataEditorDialog::SetControlTextL( TInt aControlId, |
|
2608 |
const TDesC& aValue, const TDesC& aAlternateValue ) |
|
2609 |
{ |
|
2610 |
MPX_FUNC( "CMPXMetadataEditorDialog::SetControlTextL" ); |
|
2611 |
CEikEdwin* myEdwin = static_cast< CEikEdwin* > |
|
2612 |
( ControlOrNull( aControlId ) ); |
|
2613 |
if ( myEdwin ) |
|
2614 |
{ |
|
2615 |
if ( aValue.Length() > 0 ) |
|
2616 |
{ |
|
2617 |
myEdwin->SetTextL( &( aValue ) ); |
|
2618 |
} |
|
2619 |
else if ( aAlternateValue.Length() > 0 ) |
|
2620 |
{ |
|
2621 |
myEdwin->SetTextL( &( aAlternateValue ) ); |
|
2622 |
} |
|
2623 |
} |
|
2624 |
} |
|
2625 |
||
2626 |
// ----------------------------------------------------------------------------- |
|
2627 |
// CMPXMetadataEditorDialog::SetControlNumberL |
|
2628 |
// Sets control number |
|
2629 |
// ----------------------------------------------------------------------------- |
|
2630 |
// |
|
2631 |
void CMPXMetadataEditorDialog::SetControlNumberL( TInt aControlId, |
|
2632 |
const TDesC& aValue, TInt aMinValue, TInt aMaxValue ) |
|
2633 |
{ |
|
2634 |
MPX_FUNC( "CMPXMetadataEditorDialog::SetControlNumberL" ); |
|
2635 |
CEikEdwin* myEdwin = static_cast< CEikEdwin* > |
|
2636 |
( ControlOrNull( aControlId ) ); |
|
2637 |
||
2638 |
if ( myEdwin ) |
|
2639 |
{ |
|
2640 |
if ( aValue.Length() > 0 ) |
|
2641 |
{ |
|
2642 |
TLex numLex( aValue ); |
|
2643 |
TInt LexToInt; |
|
2644 |
if ( numLex.Val( LexToInt ) == KErrNone ) |
|
2645 |
{ |
|
2646 |
if ( LexToInt > aMaxValue ) |
|
2647 |
{ |
|
2648 |
LexToInt = aMaxValue; |
|
2649 |
} |
|
2650 |
if ( LexToInt < aMinValue ) |
|
2651 |
{ |
|
2652 |
LexToInt = aMinValue; |
|
2653 |
} |
|
2654 |
TBuf<KMPXSongDetailsNumTextWidth> num; |
|
2655 |
num.AppendNum( LexToInt ); |
|
2656 |
myEdwin->SetTextL( &num ); |
|
2657 |
} |
|
2658 |
} |
|
2659 |
} |
|
2660 |
} |
|
2661 |
||
2662 |
// ----------------------------------------------------------------------------- |
|
2663 |
// CMPXMetadataEditorDialog::PromptForLibraryChangeL |
|
2664 |
// prompt user for library change |
|
2665 |
// ----------------------------------------------------------------------------- |
|
2666 |
// |
|
2667 |
TBool CMPXMetadataEditorDialog::PromptForLibraryChangeL( TInt aMoveToLibrary ) |
|
2668 |
{ |
|
2669 |
MPX_FUNC( "CMPXMetadataEditorDialog::PromptForLibraryChangeL" ); |
|
2670 |
CMPXQueryDialog* confirmationDlg = CMPXQueryDialog::NewL(); |
|
2671 |
CleanupStack::PushL( confirmationDlg ); |
|
2672 |
HBufC* libraryName = NULL; |
|
2673 |
if ( aMoveToLibrary == EMPXMetadataEditorDlgCollection ) |
|
2674 |
{ |
|
2675 |
libraryName = |
|
2676 |
StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_MUSIC_TEXT ); |
|
2677 |
} |
|
2678 |
else if ( aMoveToLibrary == EMPXMetadataEditorDlgPodcast ) |
|
2679 |
{ |
|
2680 |
libraryName = |
|
2681 |
StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_PODCAST_TEXT ); |
|
2682 |
} |
|
2683 |
else |
|
2684 |
{ |
|
2685 |
// should not reach here |
|
2686 |
User::Leave( KErrArgument ); |
|
2687 |
} |
|
2688 |
HBufC* promptTxt = StringLoader::LoadLC( |
|
2689 |
R_MPX_CUI_QUERY_MOVE_TO_LIBRARY, libraryName->Des() ); |
|
2690 |
confirmationDlg->SetPromptL( *promptTxt ); |
|
2691 |
CleanupStack::PopAndDestroy( promptTxt ); |
|
2692 |
||
2693 |
||
2694 |
confirmationDlg->PublishDialogL( |
|
2695 |
EMPlayerQueryMoveToLibrary, |
|
2696 |
KMPlayerNoteCategory); |
|
2697 |
||
2698 |
CAknMediatorFacade* covercl( |
|
2699 |
AknMediatorFacade( confirmationDlg ) ); |
|
2700 |
if ( covercl ) |
|
2701 |
{ |
|
2702 |
covercl->BufStream() << libraryName->Des(); |
|
2703 |
} |
|
2704 |
CleanupStack::PopAndDestroy( libraryName ); |
|
2705 |
CleanupStack::Pop( confirmationDlg ); |
|
2706 |
return confirmationDlg->ExecuteLD( R_MPX_CUI_MOVE_TO_LIBRARY_CONFIRMATION_QUERY ); |
|
2707 |
} |
|
2708 |
||
2709 |
// ----------------------------------------------------------------------------- |
|
2710 |
// CMPXMetadataEditorDialog::UpdateMediaObjectWithControlL |
|
2711 |
// Updates media object with current control text, this will also |
|
2712 |
// update iMedia |
|
2713 |
// ----------------------------------------------------------------------------- |
|
2714 |
// |
|
2715 |
TBool CMPXMetadataEditorDialog::UpdateMediaObjectWithControlL( |
|
2716 |
TInt aControlId, CMPXMedia* aMedia, TMPXAttribute aAttribute ) |
|
2717 |
{ |
|
2718 |
MPX_FUNC( "CMPXMetadataEditorDialog::UpdateMediaObjectWithControlL" ); |
|
2719 |
TBool ret = EFalse; |
|
2720 |
CCoeControl* coeControl = ControlOrNull( aControlId ); |
|
2721 |
if ( coeControl ) |
|
2722 |
{ |
|
2723 |
HBufC* buf = NULL; |
|
2724 |
switch ( aControlId ) |
|
2725 |
{ |
|
2726 |
case EMPXMetadataEditorDlgCtrlIdSongName: |
|
2727 |
case EMPXMetadataEditorDlgCtrlIdArtist: |
|
2728 |
case EMPXMetadataEditorDlgCtrlIdAlbum: |
|
2729 |
case EMPXMetadataEditorDlgCtrlIdComment: |
|
2730 |
case EMPXMetadataEditorDlgCtrlIdComposer: |
|
2731 |
case EMPXMetadataEditorDlgCtrlIdTrackNumber: |
|
2732 |
{ |
|
2733 |
CEikEdwin* control = static_cast<CEikEdwin*>( coeControl ); |
|
2734 |
if ( control ) |
|
2735 |
{ |
|
2736 |
buf = control->GetTextInHBufL(); |
|
2737 |
if ( !buf ) |
|
2738 |
{ |
|
2739 |
// the text contains nothing |
|
2740 |
// special handling is needed for song name |
|
2741 |
if ( aControlId == EMPXMetadataEditorDlgCtrlIdSongName && iMedia ) |
|
2742 |
{ |
|
2743 |
if ( iMedia->IsSupported( KMPXMediaGeneralUri ) ) |
|
2744 |
{ |
|
2745 |
// if URI is defined, use filename as song name |
|
2746 |
TParsePtrC fn( iMedia->ValueText( KMPXMediaGeneralUri ) ); |
|
2747 |
buf = fn.Name().AllocL(); |
|
2748 |
} |
|
2749 |
else |
|
2750 |
{ |
|
2751 |
buf = HBufC::NewL( 0 ); |
|
2752 |
} |
|
2753 |
} |
|
2754 |
else |
|
2755 |
{ |
|
2756 |
buf = HBufC::NewL( 0 ); |
|
2757 |
} |
|
2758 |
} |
|
2759 |
CleanupStack::PushL( buf ); |
|
2760 |
} |
|
2761 |
else |
|
2762 |
{ |
|
2763 |
// should not reach here |
|
2764 |
User::Leave( KErrArgument ); |
|
2765 |
} |
|
2766 |
break; |
|
2767 |
} |
|
2768 |
default: |
|
2769 |
{ |
|
2770 |
// should not reach here |
|
2771 |
User::Leave( KErrArgument ); |
|
2772 |
break; |
|
2773 |
} |
|
2774 |
} |
|
2775 |
if ( buf ) |
|
2776 |
{ |
|
2777 |
const TDesC& origValue = iMedia->ValueText( aAttribute ); |
|
2778 |
if ( origValue.Compare( *buf ) != 0 ) |
|
2779 |
{ |
|
2780 |
//check if the track number is actually changed |
|
2781 |
if (aControlId == EMPXMetadataEditorDlgCtrlIdTrackNumber && |
|
2782 |
origValue.Compare(_L("")) == 0 && |
|
2783 |
buf->Compare(_L("0")) == 0) |
|
2784 |
{ |
|
2785 |
//nothing to do |
|
2786 |
} |
|
2787 |
else |
|
2788 |
{ |
|
2789 |
ret = ETrue; |
|
2790 |
iMedia->SetTextValueL( aAttribute , *buf ); |
|
2791 |
aMedia->SetTextValueL( aAttribute , *buf ); |
|
2792 |
} |
|
2793 |
} |
|
2794 |
CleanupStack::PopAndDestroy( buf ); |
|
2795 |
} |
|
2796 |
} |
|
2797 |
return ret; |
|
2798 |
} |
|
2799 |
||
2800 |
||
2801 |
||
2802 |
// ----------------------------------------------------------------------------- |
|
2803 |
// CMPXMetadataEditorDialog::PopulateFileDetailsL |
|
2804 |
// ----------------------------------------------------------------------------- |
|
2805 |
// |
|
2806 |
void CMPXMetadataEditorDialog::PopulateFileDetailsL() |
|
2807 |
{ |
|
2808 |
MPX_FUNC( "CMPXMetadataEditorDialog::PopulateFileDetailsL" ); |
|
2809 |
||
2810 |
ASSERT(iMedia); |
|
2811 |
TBool drmProtected(iMedia->ValueTObjectL<TBool> (KMPXMediaDrmProtected)); |
|
2812 |
MPX_DEBUG2( "CMPXMetadataEditorDialog::PopulateFileDetailsL drm protected: %d", drmProtected ); |
|
2813 |
||
2814 |
if (drmProtected) |
|
2815 |
{ |
|
2816 |
HBufC* detail = StringLoader::LoadLC( R_MPX_CUI_LICENCE_DET_LINK ); |
|
2817 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdDRMDetail, detail->Des(), |
|
2818 |
KNullDesC); |
|
2819 |
CleanupStack::PopAndDestroy( detail ); |
|
2820 |
} |
|
2821 |
else |
|
2822 |
{ |
|
2823 |
DeleteLine(EMPXMetadataEditorDlgCtrlIdDRMDetail,EFalse); |
|
2824 |
} |
|
2825 |
// Get filename |
|
2826 |
const TDesC& uri = iMedia->ValueText(KMPXMediaGeneralUri); |
|
2827 |
TParsePtrC parse(uri); |
|
2828 |
||
2829 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdFileName, parse.Name(), |
|
2830 |
KNullDesC); |
|
2831 |
||
2832 |
// Get mime type |
|
2833 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdFileFormat, iMedia->ValueText( |
|
2834 |
KMPXMediaGeneralMimeType), KNullDesC); |
|
2835 |
||
2836 |
// Get duration |
|
2837 |
TInt duration(iMedia->ValueTObjectL<TInt> (KMPXMediaGeneralDuration)); |
|
2838 |
if (duration > 0) |
|
2839 |
{ |
|
2840 |
// convert milliseconds to seconds |
|
2841 |
duration = duration / KSecondInMilliseconds; |
|
2842 |
CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode = |
|
2843 |
CMPXCommonUiHelper::EMPXDuratAuto; |
|
2844 |
if (duration > KOneHourInSeconds) |
|
2845 |
{ |
|
2846 |
durationMode = CMPXCommonUiHelper::EMPXDuratHMS; |
|
2847 |
} |
|
2848 |
HBufC* stringBuf = iCommonUiHelper->DisplayableDurationL(duration, |
|
2849 |
durationMode); |
|
2850 |
CleanupStack::PushL(stringBuf); |
|
2851 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdFileDuration, *stringBuf, |
|
2852 |
KNullDesC); |
|
2853 |
CleanupStack::PopAndDestroy(stringBuf); |
|
2854 |
} |
|
2855 |
else |
|
2856 |
{ |
|
2857 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdFileDuration, KNullDesC, |
|
2858 |
KNullDesC); |
|
2859 |
} |
|
2860 |
||
2861 |
// Get bitrate |
|
2862 |
TInt bitrate(iMedia->ValueTObjectL<TInt> (KMPXMediaAudioBitrate)); |
|
2863 |
if (bitrate > 0) |
|
2864 |
{ |
|
2865 |
// convert bitrate to kpbs |
|
2866 |
bitrate = bitrate / KMPXBitrateFactor; |
|
2867 |
HBufC* bitrateText = StringLoader::LoadLC( |
|
2868 |
R_MPX_CUI_METADATAEDITOR_BITRATE_TXT, bitrate); |
|
2869 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdFileBitrate, |
|
2870 |
bitrateText->Des(), KNullDesC); |
|
2871 |
CleanupStack::PopAndDestroy(bitrateText); |
|
2872 |
} |
|
2873 |
else |
|
2874 |
{ |
|
2875 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdFileBitrate, KNullDesC, |
|
2876 |
KNullDesC); |
|
2877 |
} |
|
2878 |
||
2879 |
// Get sampling rate |
|
2880 |
TInt samplingRateNum((TInt) iMedia->ValueTObjectL<TInt> ( |
|
2881 |
KMPXMediaAudioSamplerate)); |
|
2882 |
if (samplingRateNum > 0) |
|
2883 |
{ |
|
2884 |
HBufC* stringBuf = HBufC::NewLC(KMPXFileDetailsMaxBufferLen); |
|
2885 |
TPtr stringBufPtr = stringBuf->Des(); |
|
2886 |
stringBufPtr.AppendNum(samplingRateNum); |
|
2887 |
AknTextUtils::LanguageSpecificNumberConversion( stringBufPtr ); |
|
2888 |
HBufC* samplingrate = StringLoader::LoadLC( |
|
2889 |
R_MPX_CUI_METADATAEDITOR_SAMPLINGRATE_TXT, stringBufPtr); |
|
2890 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdSamplingrate, |
|
2891 |
samplingrate->Des(), KNullDesC); |
|
2892 |
CleanupStack::PopAndDestroy(samplingrate); |
|
2893 |
CleanupStack::PopAndDestroy(stringBuf); |
|
2894 |
} |
|
2895 |
else |
|
2896 |
{ |
|
2897 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdSamplingrate, KNullDesC, |
|
2898 |
KNullDesC); |
|
2899 |
} |
|
2900 |
||
2901 |
// Get size, not stored in collection, have to use RFile |
|
2902 |
// |
|
2903 |
RFs& fs = CEikonEnv::Static()->FsSession(); |
|
2904 |
RFile file; |
|
2905 |
TInt sizeNum(0); |
|
2906 |
TInt err(file.Open(fs, uri, EFileRead | EFileShareReadersOrWriters)); |
|
2907 |
if (err == KErrNone) |
|
2908 |
{ |
|
2909 |
file.Size(sizeNum); |
|
2910 |
file.Close(); |
|
2911 |
} |
|
2912 |
||
2913 |
if (sizeNum > 0) |
|
2914 |
{ |
|
2915 |
HBufC* stringBuf = iCommonUiHelper->UnitConversionL(sizeNum); |
|
2916 |
CleanupStack::PushL(stringBuf); |
|
2917 |
TPtr stringBufPtr = stringBuf->Des(); |
|
2918 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(stringBufPtr); |
|
2919 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdSize, stringBufPtr, |
|
2920 |
KNullDesC); |
|
2921 |
CleanupStack::PopAndDestroy(stringBuf); |
|
2922 |
} |
|
2923 |
else |
|
2924 |
{ |
|
2925 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdSize, KNullDesC, KNullDesC); |
|
2926 |
} |
|
2927 |
||
2928 |
if (iCurrentLibrary == EMPXMetadataEditorDlgPodcast) |
|
2929 |
{ |
|
2930 |
PopulatePodcastFileDetailsL(); |
|
2931 |
} |
|
2932 |
// Get last modified time |
|
2933 |
TTime time; |
|
2934 |
User::LeaveIfError( fs.Modified( uri, time ) ); |
|
2935 |
ConvertToLocalTimeL( time ); |
|
2936 |
HBufC* modDateTime = HBufC::NewLC( |
|
2937 |
KMPXMaxTimeLength + KMPXDurationDisplayResvLen ); |
|
2938 |
HBufC* format = StringLoader::LoadLC( |
|
2939 |
R_QTN_DATE_USUAL_WITH_ZERO ); |
|
2940 |
TPtr modDatePtr = modDateTime->Des(); |
|
2941 |
MPX_TRAPD( error, time.FormatL( modDatePtr, *format ) ); |
|
2942 |
CleanupStack::PopAndDestroy( format ); |
|
2943 |
if ( error != KErrNone) |
|
2944 |
{ |
|
2945 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastModified, |
|
2946 |
KNullDesC, KNullDesC); |
|
2947 |
} |
|
2948 |
else |
|
2949 |
{ |
|
2950 |
format = StringLoader::LoadLC( |
|
2951 |
R_QTN_TIME_USUAL_WITH_ZERO ); |
|
2952 |
HBufC* modTime = HBufC::NewLC( |
|
2953 |
format->Length() + KMPXDurationDisplayResvLen ); |
|
2954 |
TPtr modTimePtr = modTime->Des(); |
|
2955 |
MPX_TRAPD( err, time.FormatL( modTimePtr, *format ) ); |
|
2956 |
if ( err != KErrNone ) |
|
2957 |
{ |
|
2958 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastModified, |
|
2959 |
KNullDesC, KNullDesC); |
|
2960 |
||
2961 |
} |
|
2962 |
else |
|
2963 |
{ |
|
2964 |
modDatePtr.Append( KMPXSpace ); |
|
2965 |
modDatePtr.Append( modTimePtr ); |
|
2966 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(modDatePtr); |
|
2967 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastModified, |
|
2968 |
modDatePtr, |
|
2969 |
KNullDesC); |
|
2970 |
} |
|
2971 |
CleanupStack::PopAndDestroy( modTime ); |
|
2972 |
CleanupStack::PopAndDestroy( format ); |
|
2973 |
} |
|
2974 |
CleanupStack::PopAndDestroy( modDateTime ); |
|
2975 |
||
2976 |
// Get filename |
|
2977 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdCopyright, |
|
2978 |
iMedia->ValueText( |
|
2979 |
KMPXMediaGeneralCopyright ), KNullDesC); |
|
2980 |
||
2981 |
// Get URL |
|
2982 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdWebaddress, |
|
2983 |
iMedia->ValueText( |
|
2984 |
KMPXMediaMusicURL ), KNullDesC); |
|
2985 |
||
2986 |
CAknForm::SetInitialCurrentLine(); |
|
2987 |
} |
|
2988 |
||
2989 |
// ----------------------------------------------------------------------------- |
|
2990 |
// CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL |
|
2991 |
// ----------------------------------------------------------------------------- |
|
2992 |
// |
|
2993 |
void CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL() |
|
2994 |
{ |
|
2995 |
TInt lastPbPosition((TInt) iMedia->ValueTObjectL<TInt> ( |
|
2996 |
KMPXMediaGeneralLastPlaybackPosition )); |
|
2997 |
if (lastPbPosition > 0) |
|
2998 |
{ |
|
2999 |
// convert milliseconds to seconds |
|
3000 |
lastPbPosition = lastPbPosition / KSecondInMilliseconds; |
|
3001 |
CMPXCommonUiHelper::TMPXDuratDisplayMode lastPbPositionMode = |
|
3002 |
CMPXCommonUiHelper::EMPXDuratAuto; |
|
3003 |
if (lastPbPosition > KOneHourInSeconds) |
|
3004 |
{ |
|
3005 |
lastPbPositionMode = CMPXCommonUiHelper::EMPXDuratHMS; |
|
3006 |
} |
|
3007 |
HBufC* stringBuf = iCommonUiHelper->DisplayableDurationL( |
|
3008 |
lastPbPosition, lastPbPositionMode); |
|
3009 |
CleanupStack::PushL(stringBuf); |
|
3010 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPlayedPosition, |
|
3011 |
*stringBuf, KNullDesC); |
|
3012 |
CleanupStack::PopAndDestroy(stringBuf); |
|
3013 |
} |
|
3014 |
else if (lastPbPosition == 0 && iMedia->IsSupported( |
|
3015 |
KMPXMediaGeneralPlayCount) && iMedia->ValueTObjectL<TInt> ( |
|
3016 |
KMPXMediaGeneralPlayCount) > 0) |
|
3017 |
{ |
|
3018 |
HBufC* stringBuf = StringLoader::LoadLC( |
|
3019 |
R_MPX_CUI_METADATAEDITOR_PLAYBACK_COMPLETE); |
|
3020 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPlayedPosition, |
|
3021 |
*stringBuf, KNullDesC); |
|
3022 |
CleanupStack::PopAndDestroy(stringBuf); |
|
3023 |
} |
|
3024 |
else |
|
3025 |
{ |
|
3026 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPlayedPosition, |
|
3027 |
KNullDesC, KNullDesC); |
|
3028 |
} |
|
3029 |
||
3030 |
// Get published |
|
3031 |
if (iMedia->IsSupported(TMPXAttribute(KMPXMediaIdPodcast, |
|
3032 |
EMPXMediaPodcastPubDate))) |
|
3033 |
{ |
|
3034 |
TInt64 timeInt( |
|
3035 |
(TInt64) iMedia->ValueTObjectL<TInt64> (TMPXAttribute( |
|
3036 |
KMPXMediaIdPodcast, EMPXMediaPodcastPubDate))); |
|
3037 |
TTime time(timeInt); |
|
3038 |
ConvertToLocalTimeL(time); |
|
3039 |
HBufC* modDateTime = HBufC::NewLC(KMPXMaxTimeLength |
|
3040 |
+ KMPXDurationDisplayResvLen); |
|
3041 |
HBufC* format = StringLoader::LoadLC(R_QTN_DATE_USUAL_WITH_ZERO); |
|
3042 |
TPtr modDatePtr = modDateTime->Des(); |
|
3043 |
MPX_TRAPD( err, time.FormatL( modDatePtr, *format ) ); |
|
3044 |
CleanupStack::PopAndDestroy(format); |
|
3045 |
if (err != KErrNone || time == 0) |
|
3046 |
{ |
|
3047 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
|
3048 |
KNullDesC, KNullDesC); |
|
3049 |
} |
|
3050 |
else |
|
3051 |
{ |
|
3052 |
format = StringLoader::LoadLC(R_QTN_TIME_USUAL_WITH_ZERO); |
|
3053 |
HBufC* modTime = HBufC::NewLC(format->Length() |
|
3054 |
+ KMPXDurationDisplayResvLen); |
|
3055 |
TPtr modTimePtr = modTime->Des(); |
|
3056 |
MPX_TRAPD( err, time.FormatL( modTimePtr, *format ) ); |
|
3057 |
if (err != KErrNone) |
|
3058 |
{ |
|
3059 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
|
3060 |
KNullDesC, KNullDesC); |
|
3061 |
} |
|
3062 |
else |
|
3063 |
{ |
|
3064 |
modDatePtr.Append(KMPXSpace); |
|
3065 |
modDatePtr.Append(modTimePtr); |
|
3066 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
|
3067 |
modTimePtr, KNullDesC); |
|
3068 |
} |
|
3069 |
CleanupStack::PopAndDestroy(modTime); |
|
3070 |
CleanupStack::PopAndDestroy(format); |
|
3071 |
} |
|
3072 |
CleanupStack::PopAndDestroy(modDateTime); |
|
3073 |
} |
|
3074 |
else |
|
3075 |
{ |
|
3076 |
SetControlTextL(EMPXMetadataEditorDlgCtrlIdLastPublished, |
|
3077 |
KNullDesC, KNullDesC); |
|
3078 |
} |
|
3079 |
} |
|
3080 |
||
3081 |
// ----------------------------------------------------------------------------- |
|
3082 |
// CMPXMetadataEditorDialog::LaunchDrmInfoL |
|
3083 |
// ----------------------------------------------------------------------------- |
|
3084 |
// |
|
3085 |
void CMPXMetadataEditorDialog::LaunchDrmInfoL() |
|
3086 |
||
3087 |
{ |
|
3088 |
MPX_FUNC( "CMPXMetadataEditorDialog::LaunchDrmInfoL" ); |
|
3089 |
const TDesC& aFileName = iMedia->ValueText(KMPXMediaGeneralUri); |
|
3090 |
RFs fs; |
|
3091 |
User::LeaveIfError( fs.Connect() ); |
|
3092 |
CleanupClosePushL( fs ); |
|
3093 |
RFile64 drmFile; |
|
3094 |
User::LeaveIfError( drmFile.Open( |
|
3095 |
fs, aFileName, EFileRead | EFileShareReadersOrWriters ) ); |
|
3096 |
CleanupClosePushL( drmFile ); |
|
3097 |
iDrmUiHandler->ShowDetailsViewL( drmFile ); |
|
3098 |
CleanupStack::PopAndDestroy( &drmFile ); |
|
3099 |
CleanupStack::PopAndDestroy( &fs ); |
|
3100 |
} |
|
3101 |
||
3102 |
// --------------------------------------------------------------------------- |
|
3103 |
// From MMPXPlaybackCallback |
|
3104 |
// Handle playback property. |
|
3105 |
// --------------------------------------------------------------------------- |
|
3106 |
// |
|
3107 |
void CMPXMetadataEditorDialog::HandlePropertyL( |
|
3108 |
TMPXPlaybackProperty aProperty, |
|
3109 |
TInt aValue, |
|
3110 |
TInt aError ) |
|
3111 |
{ |
|
3112 |
MPX_FUNC( "CMPXMetadataEditorDialog::HandleSubPlayerNamesL" ); |
|
3113 |
} |
|
3114 |
||
3115 |
// --------------------------------------------------------------------------- |
|
3116 |
// From MMPXPlaybackCallback |
|
3117 |
// Method is called continously until aComplete=ETrue, signifying that |
|
3118 |
// it is done and there will be no more callbacks |
|
3119 |
// Only new items are passed each time |
|
3120 |
// --------------------------------------------------------------------------- |
|
3121 |
// |
|
3122 |
void CMPXMetadataEditorDialog::HandleSubPlayerNamesL( |
|
3123 |
TUid /* aPlayer */, |
|
3124 |
const MDesCArray* /* aSubPlayers */, |
|
3125 |
TBool /* aComplete */, |
|
3126 |
TInt /* aError */ ) |
|
3127 |
{ |
|
3128 |
MPX_FUNC( "CMPXMetadataEditorDialog::HandleSubPlayerNamesL" ); |
|
3129 |
} |
|
3130 |
||
3131 |
// --------------------------------------------------------------------------- |
|
3132 |
// From MMPXPlaybackCallback |
|
3133 |
// Handle media properties. |
|
3134 |
// Notes: The client is responsible for delete the object of aMedia. |
|
3135 |
// --------------------------------------------------------------------------- |
|
3136 |
// |
|
3137 |
void CMPXMetadataEditorDialog::HandleMediaL( |
|
3138 |
const CMPXMedia& aMedia, |
|
3139 |
TInt aError ) |
|
3140 |
{ |
|
3141 |
MPX_FUNC( "CMPXMetadataEditorDialog::HandleMediaL" ); |
|
3142 |
TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) ); |
|
3143 |
} |
|
3144 |
// End of File |