author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:34:36 +0300 | |
branch | RCL_3 |
changeset 70 | 375929f879c2 |
parent 64 | 3eb824b18d67 |
permissions | -rw-r--r-- |
57 | 1 |
/* |
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Implementation of the CMPFileDetailsDialog.* |
|
15 |
*/ |
|
16 |
||
17 |
||
70
375929f879c2
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
18 |
// Version : %version: 20 % |
57 | 19 |
|
20 |
// INCLUDE FILES |
|
21 |
#include <aknlists.h> |
|
22 |
#include <bautils.h> |
|
23 |
#include <StringLoader.h> |
|
24 |
#include <e32base.h> |
|
25 |
#include <utf.h> |
|
26 |
#include <mmf/common/mmferrors.h> |
|
27 |
#include <DRMHelper.h> |
|
28 |
#include <aknclearer.h> |
|
29 |
#include <e32math.h> //for size rounding |
|
30 |
||
31 |
#include <MPFileDetails.rsg> |
|
32 |
#include "mpxvideo_debug.h" |
|
33 |
||
34 |
#include <AiwServiceHandler.h> |
|
35 |
#include <AiwCdmaCommands.hrh> |
|
36 |
#include <featmgr.h> |
|
37 |
#include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR |
|
38 |
#include <centralrepository.h> |
|
39 |
#include "MediaPlayerVariant.hrh" |
|
40 |
#include <MetaDataUtility.h> |
|
41 |
#include <MetaDataFieldContainer.h> |
|
42 |
#include <caf/content.h> |
|
43 |
#include <Oma2Agent.h> |
|
44 |
||
45 |
#include "MediaPlayerPrivateCRKeys.h" |
|
46 |
#include "MPFileDetailsDialog.h" |
|
47 |
#include "mppopuplist.h" |
|
48 |
#include <mediarecognizer.h> |
|
49 |
#include <streaminglinkmodel.h> |
|
50 |
#include "MPFileDetails.h" |
|
51 |
#include "MediaPlayerDrmHelper.h" |
|
52 |
||
53 |
// |
|
54 |
// Inline methods |
|
55 |
// |
|
56 |
#include "MPFileDetailsDialog.inl" |
|
57 |
||
58 |
//#include "MPAppConsts.h" |
|
59 |
||
60 |
#include <drmutility.h> |
|
61 |
||
62 |
#ifdef __WINDOWS_MEDIA |
|
63 |
#include <asxparser.h> |
|
64 |
#endif |
|
65 |
||
66 |
// CONSTANTS |
|
67 |
_LIT(KResourceFile,"z:MPFileDetails.rsc"); |
|
68 |
||
69 |
const TInt KOneKilobyte = 1; |
|
70 |
const TInt KFileSizeOneKilobyte = 1024; |
|
71 |
const TInt KThousandNotKilobyte = 1000; |
|
72 |
const TInt KOneSecond(1000000); |
|
73 |
const TInt KOneHourInSeconds(3600); |
|
74 |
const TInt KMaxTimeLength = 36; |
|
75 |
const TInt KMaxFilePathLength = 2048; |
|
76 |
||
77 |
// For meta data |
|
78 |
_LIT( KMPTitle, "Title" ); |
|
79 |
_LIT( KMPArtist, "Artist" ); |
|
80 |
_LIT( KMPAuthor, "Author" ); |
|
81 |
_LIT( KMPCopyright, "Copyright" ); |
|
82 |
_LIT( KMPAbstract, "Abstract" ); |
|
83 |
||
84 |
_LIT( KExt3gpp, "3gp" ); |
|
85 |
_LIT( KExtMp4, "mp4" ); |
|
86 |
_LIT( KExtM4a, "m4a" ); |
|
87 |
||
88 |
_LIT(KDetaMime3gpp, "audio/3gpp"); |
|
89 |
_LIT(KDetaMime3gpp2, "audio/3gpp2"); |
|
90 |
_LIT(KDetaMimeMp4, "audio/mp4"); |
|
91 |
||
92 |
_LIT(KFormat,"MimeType"); |
|
93 |
_LIT(KMPX, "x"); |
|
94 |
||
95 |
||
96 |
// ================= OTHER EXPORTED FUNCTIONS ============== |
|
97 |
||
98 |
// ============================ MEMBER FUNCTIONS =============================== |
|
99 |
||
100 |
// ----------------------------------------------------------------------------- |
|
101 |
// CMPFileDetailsDialog::CMPFileDetailsDialog |
|
102 |
// C++ default constructor can NOT contain any code, that |
|
103 |
// might leave. |
|
104 |
// ----------------------------------------------------------------------------- |
|
105 |
// |
|
106 |
CMPFileDetailsDialog::CMPFileDetailsDialog() |
|
107 |
: iResourceFileOffset(0) |
|
108 |
, iResult( KErrNone ) |
|
109 |
{ |
|
110 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::CMPFileDetailsDialog()")); |
|
111 |
} |
|
112 |
||
113 |
// ----------------------------------------------------------------------------- |
|
114 |
// CMPFileDetailsDialog::ConstructL |
|
115 |
// Symbian 2nd phase constructor can leave. |
|
116 |
// ----------------------------------------------------------------------------- |
|
117 |
// |
|
118 |
void CMPFileDetailsDialog::ConstructL() |
|
119 |
{ |
|
120 |
||
121 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::ConstructL()")); |
|
122 |
||
123 |
LoadResourcesL(); |
|
124 |
iListBox = new (ELeave) CAknDoublePopupMenuStyleListBox(); |
|
125 |
iGenres = CCoeEnv::Static()->ReadDesCArrayResourceL( R_MP_GENRE_STRINGS ); |
|
126 |
||
127 |
} |
|
128 |
||
129 |
// ----------------------------------------------------------------------------- |
|
130 |
// CMPFileDetailsDialog::NewL |
|
131 |
// Two-phased constructor. |
|
132 |
// ----------------------------------------------------------------------------- |
|
133 |
// |
|
134 |
EXPORT_C CMPFileDetailsDialog* CMPFileDetailsDialog::NewL() |
|
135 |
{ |
|
136 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog* CMPFileDetailsDialog::NewL()")); |
|
137 |
||
138 |
CMPFileDetailsDialog* self = new( ELeave ) CMPFileDetailsDialog(); |
|
139 |
CleanupStack::PushL( self ); |
|
140 |
self->ConstructL(); |
|
141 |
CleanupStack::Pop(); |
|
142 |
return self; |
|
143 |
} |
|
144 |
||
145 |
// ----------------------------------------------------------------------------- |
|
146 |
// CMPFileDetailsDialog::~CMPFileDetailsDialog |
|
147 |
// Destructor |
|
148 |
// ----------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
EXPORT_C CMPFileDetailsDialog::~CMPFileDetailsDialog() |
|
151 |
{ |
|
152 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::~CMPFileDetailsDialog()")); |
|
153 |
if( iPopupList ) |
|
154 |
{ |
|
155 |
iPopupList->CancelPopup(); |
|
156 |
} |
|
157 |
delete iPopupList; // cause removal from control stack |
|
158 |
delete iListBox; |
|
159 |
delete iGenres; |
|
160 |
UnLoadResources(); |
|
161 |
} |
|
162 |
||
163 |
// ----------------------------------------------------------------------------- |
|
164 |
// CMPFileDetailsDialog::ExecuteLD |
|
165 |
// ----------------------------------------------------------------------------- |
|
166 |
// |
|
167 |
EXPORT_C void CMPFileDetailsDialog::ExecuteLD(const TDesC& aFileName) |
|
168 |
{ |
|
169 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::ExecuteLD()")); |
|
170 |
||
171 |
CleanupStack::PushL( this ); |
|
172 |
CMPFileDetails* fileDetails = new (ELeave) CMPFileDetails(); |
|
173 |
CleanupStack::PushL( fileDetails ); |
|
174 |
||
175 |
// |
|
176 |
// Obtain file path first so it can be used later |
|
177 |
// |
|
178 |
fileDetails->iFilePath = aFileName.AllocL(); |
|
179 |
||
180 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
181 |
RFile64 fileHandle; |
|
182 |
#else |
|
183 |
RFile fileHandle; |
|
184 |
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
185 |
TUint fileMode = EFileShareReadersOrWriters | EFileStream | EFileRead; |
|
186 |
RFs fs = CEikonEnv::Static()->FsSession(); |
|
187 |
||
188 |
User::LeaveIfError(fileHandle.Open(fs, aFileName, fileMode)); |
|
189 |
CleanupClosePushL(fileHandle); |
|
190 |
||
191 |
DRM::CDrmUtility* drmUtil = DRM::CDrmUtility::NewLC(); |
|
192 |
||
193 |
TRAP_IGNORE( fileDetails->iDrmProtected = |
|
194 |
drmUtil->IsProtectedL(fileHandle) ); |
|
195 |
||
196 |
CleanupStack::PopAndDestroy(2); // fileHandle, drmUtil |
|
197 |
||
198 |
if ( fileDetails->iDrmProtected ) |
|
199 |
{ |
|
200 |
// |
|
201 |
// All DRM rights are handled & displayed by DRM component. |
|
202 |
// MP only needs to display DCF header info (Title, Provider, Description). |
|
203 |
// |
|
204 |
FetchDCFHeaderDataL(aFileName, fileDetails); |
|
205 |
} |
|
206 |
||
207 |
// recognize file and get format |
|
208 |
CMediaRecognizer* recognizer = CMediaRecognizer::NewL(); |
|
209 |
CleanupStack::PushL(recognizer); |
|
210 |
CMediaRecognizer::TMediaType mediaType = |
|
211 |
recognizer->IdentifyMediaTypeL( aFileName, ETrue ); |
|
212 |
// mime type not shown for playlists and ram files |
|
213 |
if ( mediaType != CMediaRecognizer::ELocalRamFile && |
|
214 |
mediaType != CMediaRecognizer::ELocalAsxFile && |
|
215 |
mediaType != CMediaRecognizer::ELocalAudioPlaylist ) |
|
216 |
{ |
|
217 |
fileDetails->iFormat = recognizer->MimeTypeL( aFileName ).AllocL(); |
|
218 |
} |
|
219 |
CleanupStack::PopAndDestroy(); // recognizer |
|
220 |
||
221 |
// filename |
|
222 |
TParse parse; |
|
223 |
parse.Set(aFileName,NULL,NULL); |
|
224 |
fileDetails->iFileName = parse.Name().AllocL(); |
|
225 |
||
226 |
switch (mediaType) |
|
227 |
{ |
|
228 |
case CMediaRecognizer::ELocalVideoFile: |
|
229 |
{ |
|
230 |
#ifdef SYMBIAN_BUILD_GCE |
|
231 |
CVideoPlayerUtility2* videoPlayer = CVideoPlayerUtility2::NewL(*this, |
|
232 |
EMdaPriorityNormal,EMdaPriorityPreferenceNone ); |
|
233 |
#else |
|
234 |
CMPDummyController* dummy = CMPDummyController::NewLC(); |
|
235 |
TRect tmp; |
|
236 |
CVideoPlayerUtility* videoPlayer = CVideoPlayerUtility::NewL(*this, |
|
237 |
EMdaPriorityNormal,EMdaPriorityPreferenceNone, |
|
238 |
dummy->GetClientWsSession(),dummy->GetScreenDevice(), |
|
239 |
dummy->GetClientWindow(),tmp,tmp); |
|
240 |
#endif // SYMBIAN_BUILD_GCE |
|
241 |
CleanupStack::PushL(videoPlayer); |
|
242 |
// open |
|
243 |
videoPlayer->OpenFileL(aFileName); |
|
244 |
// wait open to complete |
|
245 |
iWait.Start(); |
|
246 |
||
247 |
if (iResult && iResult != KErrMMPartialPlayback) |
|
248 |
{ |
|
249 |
#ifdef SYMBIAN_BUILD_GCE |
|
250 |
CleanupStack::PopAndDestroy(1); // videoPlayer |
|
251 |
#else |
|
252 |
CleanupStack::PopAndDestroy(2); // dummy and videoPlayer |
|
253 |
#endif //SYMBIAN_BUILD_GCE |
|
254 |
break; |
|
255 |
} |
|
256 |
// prepare |
|
257 |
videoPlayer->Prepare(); |
|
258 |
// wait prepare to complete |
|
259 |
iWait.Start(); |
|
260 |
||
261 |
if (iResult && iResult != KErrMMPartialPlayback) |
|
262 |
{ |
|
263 |
#ifdef SYMBIAN_BUILD_GCE |
|
264 |
CleanupStack::PopAndDestroy(1); // videoPlayer |
|
265 |
#else |
|
266 |
CleanupStack::PopAndDestroy(2); // dummy and videoPlayer |
|
267 |
#endif //SYMBIAN_BUILD_GCE |
|
268 |
break; |
|
269 |
} |
|
270 |
// get video file details |
|
271 |
// duration |
|
272 |
fileDetails->iDurationInSeconds = |
|
273 |
videoPlayer->DurationL().Int64() / KOneSecond; |
|
274 |
// resolution |
|
275 |
TSize size; |
|
276 |
videoPlayer->VideoFrameSizeL(size); |
|
277 |
fileDetails->iResolutionHeight = size.iHeight; |
|
278 |
fileDetails->iResolutionWidth = size.iWidth; |
|
279 |
// bitrate |
|
280 |
fileDetails->iBitrate = videoPlayer->VideoBitRateL() + |
|
281 |
videoPlayer->AudioBitRateL(); |
|
282 |
||
283 |
// video track |
|
284 |
fileDetails->iVideoTrack = videoPlayer->VideoBitRateL(); |
|
285 |
||
286 |
TPtrC8 videoFormat = videoPlayer->VideoFormatMimeType(); |
|
287 |
||
288 |
delete fileDetails->iFormat; |
|
289 |
fileDetails->iFormat = NULL; |
|
290 |
||
291 |
if ( videoFormat.Length()) |
|
292 |
{ |
|
293 |
HBufC* videoFormat16 = HBufC::NewLC(videoFormat.Length()); |
|
294 |
TPtr videoFormatDes16(videoFormat16->Des()); |
|
295 |
videoFormatDes16.Copy(videoFormat); |
|
296 |
||
297 |
fileDetails->iFormat = videoFormatDes16.AllocL(); |
|
298 |
CleanupStack::PopAndDestroy(); //videoFormat16 |
|
299 |
} |
|
300 |
||
301 |
// copyright & title & format |
|
302 |
TInt metaCount = videoPlayer->NumberOfMetaDataEntriesL(); |
|
303 |
CMMFMetaDataEntry* metaData; |
|
304 |
for (TInt i = 0; i < metaCount; i++) |
|
305 |
{ |
|
306 |
metaData = videoPlayer->MetaDataEntryL(i); |
|
307 |
if (!metaData->Name().CompareF(KMPCopyright)) |
|
308 |
{ |
|
309 |
fileDetails->iCopyright = metaData->Value().AllocL(); |
|
310 |
} |
|
311 |
else if (!metaData->Name().CompareF(KMPArtist) || !metaData->Name().Compare(KMPAuthor)) |
|
312 |
{ |
|
70
375929f879c2
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
313 |
fileDetails->iArtist = metaData->Value().Alloc(); |
57 | 314 |
} |
315 |
else if (!metaData->Name().CompareF(KMPTitle)) |
|
316 |
{ |
|
317 |
fileDetails->iTitle = metaData->Value().AllocL(); |
|
318 |
} |
|
319 |
else if (!metaData->Name().CompareF(KMPAbstract)) |
|
320 |
{ |
|
321 |
fileDetails->iDescription = metaData->Value().AllocL(); |
|
322 |
} |
|
323 |
else if (!(metaData->Name().CompareF(KFormat) || fileDetails->iFormat)) |
|
324 |
{ |
|
325 |
fileDetails->iFormat = metaData->Value().AllocL(); |
|
326 |
} |
|
327 |
delete metaData; |
|
328 |
} |
|
329 |
#ifdef SYMBIAN_BUILD_GCE |
|
330 |
CleanupStack::PopAndDestroy(1); // videoPlayer |
|
331 |
#else |
|
332 |
CleanupStack::PopAndDestroy(2); // dummy and videoPlayer |
|
333 |
#endif //SYMBIAN_BUILD_GCE |
|
334 |
} |
|
335 |
break; |
|
336 |
case CMediaRecognizer::ELocalRamFile: |
|
337 |
{ |
|
338 |
// get first link |
|
339 |
CStreamingLinkModel* linkModel = CStreamingLinkModel::NewL(); |
|
340 |
CleanupStack::PushL(linkModel); |
|
341 |
User::LeaveIfError(linkModel->OpenLinkFileL( aFileName, EFalse )); |
|
342 |
fileDetails->iUrl = HBufC::NewL(linkModel->MaxLinkLength()); |
|
343 |
TPtr filePtr = fileDetails->iUrl->Des(); |
|
344 |
TBool dummy; |
|
345 |
linkModel->GetNextLinkL(filePtr,dummy); |
|
346 |
CleanupStack::PopAndDestroy(); // linkModel |
|
347 |
} |
|
348 |
break; |
|
349 |
case CMediaRecognizer::ELocalAsxFile: |
|
350 |
{ |
|
351 |
#ifdef __WINDOWS_MEDIA |
|
352 |
CAsxParser* asxParser = NULL; |
|
353 |
TRAPD(err, asxParser = CAsxParser::NewL( aFileName )); |
|
354 |
CleanupStack::PushL( asxParser ); |
|
355 |
||
356 |
if ( !err && asxParser && asxParser->FileVersion() > 0 ) |
|
357 |
{ |
|
358 |
TUint asxUrlCount = 0; |
|
359 |
TPtrC8 urlPtr; |
|
360 |
||
361 |
asxParser->GetUrlCount(asxUrlCount); |
|
362 |
if ( asxUrlCount ) |
|
363 |
{ |
|
364 |
// get first link |
|
365 |
asxParser->GetUrl(1,urlPtr); |
|
366 |
fileDetails->iUrl = HBufC::NewL(urlPtr.Length()); |
|
367 |
TPtr filePtr = fileDetails->iUrl->Des(); |
|
368 |
asxParser->PrintUrl(urlPtr,filePtr); |
|
369 |
} |
|
370 |
} |
|
371 |
CleanupStack::PopAndDestroy(); // asxparser |
|
372 |
#endif |
|
373 |
} |
|
374 |
break; |
|
375 |
case CMediaRecognizer::ELocalAudioFile: |
|
376 |
{ |
|
377 |
FetchMetaDataL( aFileName, fileDetails ); |
|
378 |
} |
|
379 |
break; |
|
380 |
default: |
|
381 |
break; |
|
382 |
} |
|
383 |
||
384 |
||
385 |
if (mediaType != CMediaRecognizer::ELocalRamFile && |
|
386 |
mediaType != CMediaRecognizer::ELocalAsxFile ) |
|
387 |
{ |
|
388 |
RFs fs = CEikonEnv::Static()->FsSession(); |
|
389 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
390 |
RFile64 file; |
|
391 |
#else |
|
392 |
RFile file; |
|
393 |
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
394 |
TInt error = file.Open(fs, aFileName, EFileRead | EFileShareReadersOnly); |
|
395 |
if (error) |
|
396 |
{ |
|
397 |
// Try different sharing method if the first one failed. |
|
398 |
error = file.Open(fs, aFileName, EFileRead | EFileShareAny); |
|
399 |
} |
|
400 |
||
401 |
if (!error) |
|
402 |
{ |
|
403 |
// Set item size, ignore error code |
|
404 |
if (mediaType != CMediaRecognizer::ELocalAudioPlaylist) |
|
405 |
{ |
|
406 |
file.Size(fileDetails->iSize); |
|
407 |
} |
|
408 |
// Set modification date & time, ignore error code |
|
409 |
file.Modified(fileDetails->iTime); |
|
410 |
file.Close(); |
|
411 |
} |
|
412 |
} |
|
413 |
||
414 |
// Show File Details in differend ExecuteLD |
|
415 |
ExecuteLD( fileDetails ); |
|
416 |
CleanupStack::PopAndDestroy(); // fileDetails |
|
417 |
CleanupStack::Pop(); // this |
|
418 |
} |
|
419 |
||
420 |
// ----------------------------------------------------------------------------- |
|
421 |
// CMPFileDetailsDialog::ExecuteLD |
|
422 |
// ----------------------------------------------------------------------------- |
|
423 |
// |
|
424 |
EXPORT_C void CMPFileDetailsDialog::ExecuteLD(CMPFileDetails* aFileDetails) |
|
425 |
{ |
|
426 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::ExecuteLD()")); |
|
427 |
||
428 |
if ( aFileDetails->iDrmProtected && aFileDetails->iFilePath ) |
|
429 |
{ |
|
430 |
// drm data |
|
431 |
FetchDrmDataL( *aFileDetails->iFilePath, aFileDetails ); |
|
432 |
} |
|
433 |
||
434 |
||
435 |
if ( iPopupList ) |
|
436 |
{ |
|
437 |
iPopupList->CancelPopup(); |
|
438 |
iPopupList = NULL; |
|
439 |
} |
|
440 |
||
441 |
// |
|
442 |
// use Media Player's own PopupList, not Avkon's PopupList |
|
443 |
// |
|
444 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
445 |
TInt64 size(0); |
|
446 |
#else |
|
447 |
TInt size(0); |
|
448 |
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
449 |
TInt error(0); |
|
450 |
TInt handleExists(0); |
|
451 |
if ( aFileDetails->iDetailsFileHandle.SubSessionHandle() ) |
|
452 |
{ |
|
453 |
error = aFileDetails->iDetailsFileHandle.Size( size ); |
|
454 |
} |
|
455 |
||
456 |
handleExists =(!error && size )? ETrue:EFalse; |
|
457 |
||
458 |
if( handleExists ) |
|
459 |
{ |
|
460 |
iPopupList = CMPPopupList::NewL( iListBox, |
|
461 |
aFileDetails->iDetailsFileHandle, |
|
462 |
aFileDetails->iDrmProtected, |
|
463 |
aFileDetails->iReadingDCFOnly ); |
|
464 |
} |
|
465 |
else |
|
466 |
{ |
|
467 |
// |
|
468 |
// file path is not available when this ExecuteLD(aFileDetails) method is |
|
469 |
// launched by MP Video View for streaming link. Hence, this value is set |
|
470 |
// to Null in such case. |
|
471 |
// |
|
472 |
HBufC* temp = HBufC::NewL(KMaxFilePathLength); |
|
473 |
CleanupStack::PushL( temp ); |
|
474 |
TPtr filePathPtr = temp->Des(); |
|
475 |
||
476 |
if ( aFileDetails->iFilePath ) |
|
477 |
{ |
|
478 |
filePathPtr.Append( aFileDetails->iFilePath->Des() ); |
|
479 |
} |
|
480 |
else |
|
481 |
{ |
|
482 |
filePathPtr.Append( KNullDesC() ); |
|
483 |
} |
|
484 |
||
485 |
// |
|
486 |
// use Media Player's own PopupList, not Avkon's PopupList |
|
487 |
// |
|
488 |
iPopupList = CMPPopupList::NewL( iListBox, |
|
489 |
filePathPtr, |
|
490 |
aFileDetails->iDrmProtected, |
|
491 |
aFileDetails->iReadingDCFOnly ); |
|
492 |
||
493 |
CleanupStack::PopAndDestroy( temp ); |
|
494 |
} |
|
495 |
||
496 |
TRAPD( err, |
|
497 |
{ |
|
498 |
iListBox->ConstructL(iPopupList, CEikListBox::EDisableHighlight ); |
|
499 |
iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); |
|
500 |
||
501 |
iListBox->CreateScrollBarFrameL(ETrue); |
|
502 |
iListBox->ScrollBarFrame()-> |
|
503 |
SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
|
504 |
CEikScrollBarFrame::EAuto ); |
|
505 |
||
506 |
SetTitleL(iPopupList); |
|
507 |
FillListBoxL(aFileDetails); |
|
508 |
||
509 |
iPopupList->ExecuteLD(); |
|
510 |
iPopupList = NULL; |
|
511 |
} );//TRAP |
|
512 |
||
513 |
//explicitly cancel the Popup if it's not terminated properly |
|
514 |
if ( err && iPopupList ) |
|
515 |
{ |
|
516 |
iPopupList->CancelPopup(); |
|
517 |
} |
|
518 |
||
519 |
delete this; |
|
520 |
||
521 |
if ( KLeaveExit == err ) |
|
522 |
{ |
|
523 |
User::Leave( err ); |
|
524 |
} |
|
525 |
} |
|
526 |
||
527 |
// ----------------------------------------------------------------------------- |
|
528 |
// CMPFileDetailsDialog::UnLoadResourceFile |
|
529 |
// ----------------------------------------------------------------------------- |
|
530 |
// |
|
531 |
void CMPFileDetailsDialog::UnLoadResources() |
|
532 |
{ |
|
533 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::UnLoadResources()")); |
|
534 |
||
535 |
if (iResourceFileOffset > 0) |
|
536 |
{ |
|
537 |
CCoeEnv::Static()->DeleteResourceFile(iResourceFileOffset); |
|
538 |
iResourceFileOffset = 0; |
|
539 |
} |
|
540 |
} |
|
541 |
// ----------------------------------------------------------------------------- |
|
542 |
// CMPFileDetailsDialog::LoadResourceFileL |
|
543 |
// ----------------------------------------------------------------------------- |
|
544 |
// |
|
545 |
void CMPFileDetailsDialog::LoadResourcesL() |
|
546 |
{ |
|
547 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::LoadResourcesL()")); |
|
548 |
||
549 |
if (iResourceFileOffset == 0) |
|
550 |
{ |
|
551 |
CCoeEnv* enviro = CCoeEnv::Static(); |
|
552 |
TFileName resourceFile; |
|
553 |
||
554 |
// |
|
555 |
// Get the path & file name with the drive not specified |
|
556 |
// |
|
557 |
_LIT(KMPTempFile,"MPFileDetails.rsc"); |
|
558 |
TParse parse; |
|
559 |
parse.Set(KMPTempFile, &KDC_APP_RESOURCE_DIR, NULL); |
|
560 |
TPtrC rscFile = parse.FullName(); |
|
561 |
||
562 |
// |
|
563 |
// This is done to ensure upgraded file is used first. |
|
564 |
// If no upgraded file is found, default file in Z: drive will be used. |
|
565 |
// |
|
566 |
TFindFile find( CCoeEnv::Static()->FsSession() ); |
|
567 |
TInt err = find.FindByDir( rscFile, KNullDesC ); |
|
568 |
MPX_DEBUG(_L("CMPFileDetailsDialog::LoadResourcesL() : err(%d)"),err ); |
|
569 |
||
570 |
if ( err ) |
|
571 |
{ |
|
572 |
parse.Set(KResourceFile, &KDC_APP_RESOURCE_DIR, NULL); |
|
573 |
TPtrC defaultRscFile = parse.FullName(); |
|
574 |
resourceFile.Append( defaultRscFile ); |
|
575 |
MPX_DEBUG(_L("CMPFileDetailsDialog::LoadResourcesL() : defaultRsc(%S)"),&resourceFile ); |
|
576 |
} |
|
577 |
else |
|
578 |
{ |
|
579 |
resourceFile.Append( find.File() ); |
|
580 |
MPX_DEBUG(_L("CMPFileDetailsDialog::LoadResourcesL() : upgradeRsc(%S)"),&resourceFile ); |
|
581 |
} |
|
582 |
||
583 |
BaflUtils::NearestLanguageFile( enviro->FsSession(), resourceFile ); |
|
584 |
iResourceFileOffset = enviro->AddResourceFileL( resourceFile ); |
|
585 |
} |
|
586 |
} |
|
587 |
||
588 |
// ----------------------------------------------------------------------------- |
|
589 |
// CMPFileDetailsDialog::SetTitleL |
|
590 |
// ----------------------------------------------------------------------------- |
|
591 |
// |
|
592 |
void CMPFileDetailsDialog::SetTitleL(CAknPopupList* aPopupList) |
|
593 |
{ |
|
594 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::SetTitleL()")); |
|
595 |
||
596 |
HBufC* title = StringLoader::LoadLC(R_MP_FILE_DETAILS); |
|
597 |
aPopupList->SetTitleL(*title); |
|
598 |
CleanupStack::PopAndDestroy(); //title |
|
599 |
} |
|
600 |
||
601 |
// ----------------------------------------------------------------------------- |
|
602 |
// CMPFileDetailsDialog::FillListBoxL |
|
603 |
// ----------------------------------------------------------------------------- |
|
604 |
// |
|
605 |
void CMPFileDetailsDialog::FillListBoxL(CMPFileDetails* aFileDetails) |
|
606 |
{ |
|
607 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::FillListBoxL()")); |
|
608 |
||
609 |
CDesCArray* itemArray = |
|
610 |
static_cast<CDesCArray*>( iListBox->Model()->ItemTextArray() ); |
|
611 |
||
612 |
TBool drmProtected = aFileDetails->iDrmProtected; |
|
613 |
||
614 |
// re-evaluate drm protection |
|
615 |
// for playlists it may be inaccurate |
|
616 |
if ( ! drmProtected ) |
|
617 |
{ |
|
618 |
if ( aFileDetails->iDetailsFileHandle.SubSessionHandle() ) |
|
619 |
{ |
|
620 |
CContent* content = CContent::NewL( aFileDetails->iDetailsFileHandle ); |
|
621 |
content->GetAttribute( EIsProtected, drmProtected ); |
|
622 |
delete content; |
|
623 |
} |
|
624 |
else if (aFileDetails->iFilePath != NULL) |
|
625 |
{ |
|
626 |
CContent* content = CContent::NewL( aFileDetails->iFilePath->Des() ); |
|
627 |
content->GetAttribute( EIsProtected, drmProtected ); |
|
628 |
delete content; |
|
629 |
} |
|
630 |
||
631 |
// |
|
632 |
// since 'aFileDetails->iDrmProtected' is EFalse earlier |
|
633 |
// and now it becomes ETrue after the re-evaluation, |
|
634 |
// the related softkeys need to be re-initalized here |
|
635 |
// |
|
636 |
if ( drmProtected ) |
|
637 |
{ |
|
638 |
iPopupList->ReConstructDrmSoftkeysL(drmProtected); |
|
639 |
} |
|
640 |
} |
|
641 |
||
642 |
// if content is drm protected, fetch the drm data |
|
643 |
if ( drmProtected && aFileDetails->iFilePath ) |
|
644 |
{ |
|
645 |
FetchDrmDataL( *aFileDetails->iFilePath, aFileDetails ); |
|
646 |
} |
|
647 |
||
648 |
if ( drmProtected && ! aFileDetails->iReadingDCFOnly ) |
|
649 |
{ |
|
650 |
// |
|
651 |
// All DRM rights & constraints are handled & displayed by DRM component. |
|
652 |
// So, MP only needs to display the Heading here. |
|
653 |
// |
|
654 |
||
655 |
// |
|
656 |
// According to UI Spec, DRM info is always the 1st entry of the Details dlg. |
|
657 |
// The softkeys of the Details pop-up (CMPPopupList) are constructed based |
|
658 |
// on this info. Hence, if the order entry of DRM is changed, softkeys in |
|
659 |
// CMPPopupList need to be updated accordingly. |
|
660 |
// |
|
661 |
DisplayDrmHeadingInfoL( itemArray ); |
|
662 |
} |
|
663 |
||
664 |
MakeTitleItemL(itemArray,aFileDetails); |
|
665 |
MakeArtistItemL(itemArray,aFileDetails); |
|
666 |
MakeOriginalArtistItemL(itemArray,aFileDetails); |
|
667 |
MakeAlbumItemL(itemArray,aFileDetails); |
|
668 |
MakeAlbumTrackItemL(itemArray,aFileDetails); |
|
669 |
MakeGenreItemL(itemArray,aFileDetails); |
|
670 |
MakeComposerItemL(itemArray,aFileDetails); |
|
671 |
MakeProviderItemL(itemArray,aFileDetails); |
|
672 |
MakeFormatItemL(itemArray,aFileDetails); |
|
673 |
MakeResolutionItemL(itemArray,aFileDetails); |
|
674 |
MakeDurationItemL(itemArray,aFileDetails); |
|
675 |
MakeBitrateItemL(itemArray,aFileDetails); |
|
676 |
MakeSamplerateItemL(itemArray,aFileDetails); |
|
677 |
MakeSizeItemL(itemArray,aFileDetails); |
|
678 |
MakeDateItemL(itemArray,aFileDetails); |
|
679 |
MakeTimeItemL(itemArray,aFileDetails); |
|
680 |
||
681 |
if ( FeatureManager::FeatureSupported( KFeatureIdLightSurf ) ) |
|
682 |
{ |
|
683 |
MakeUploadStatusL( itemArray, aFileDetails ); |
|
684 |
} |
|
685 |
||
686 |
MakeYearItemL(itemArray,aFileDetails); |
|
687 |
MakeDescriptionItemL(itemArray,aFileDetails); |
|
688 |
MakeCommentItemL(itemArray,aFileDetails); |
|
689 |
MakeUrlItemL(itemArray,aFileDetails); |
|
690 |
MakeAudioFileWebPageItemL(itemArray,aFileDetails); |
|
691 |
MakeCopyrightItemL(itemArray,aFileDetails); |
|
692 |
||
693 |
iListBox->HandleItemAdditionL(); |
|
694 |
iListBox->SetCurrentItemIndex(0); |
|
695 |
} |
|
696 |
||
697 |
// ----------------------------------------------------------------------------- |
|
698 |
// CMPFileDetailsDialog::AddItemToListBoxL |
|
699 |
// ----------------------------------------------------------------------------- |
|
700 |
// |
|
701 |
void CMPFileDetailsDialog::AddItemToListBoxL(const TDesC& aHeading, |
|
702 |
const TDesC& aValue, |
|
703 |
CDesCArray* aItemArray) |
|
704 |
{ |
|
705 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::AddItemToListBoxL()")); |
|
706 |
||
707 |
CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat(2); |
|
708 |
CleanupStack::PushL(items); |
|
709 |
items->AppendL(aHeading); //First string (heading) |
|
710 |
||
711 |
//remove tabs from aValue |
|
712 |
HBufC* aValueBuf = aValue.AllocLC(); |
|
713 |
TPtr aValuePtr = aValueBuf->Des(); |
|
714 |
||
715 |
// remove EndOfString character |
|
716 |
if (aValuePtr.Length() > 0) |
|
717 |
{ |
|
718 |
TChar c = aValuePtr[aValuePtr.Length()-1]; |
|
719 |
if (c.Eos()) |
|
720 |
{ |
|
721 |
aValuePtr.Delete(aValuePtr.Length()-1,aValuePtr.Length()); |
|
722 |
} |
|
723 |
} |
|
724 |
||
725 |
for( TInt i = 0; i < aValuePtr.Length(); i++ ) |
|
726 |
{ |
|
727 |
if( aValuePtr[i] == '\t' ) |
|
728 |
{ |
|
729 |
aValuePtr[i] = ' '; |
|
730 |
} |
|
731 |
} |
|
732 |
items->AppendL(aValuePtr); //Second string (value) |
|
733 |
CleanupStack::PopAndDestroy( aValueBuf ); //aValueBuf |
|
734 |
||
735 |
HBufC* headingAndValue = |
|
736 |
StringLoader::LoadLC( R_MP_FILE_DETAILS_ROW_FORMAT, *items ); |
|
737 |
aItemArray->AppendL(*headingAndValue); |
|
738 |
CleanupStack::PopAndDestroy(2); // items & headingAndValue |
|
739 |
} |
|
740 |
||
741 |
||
742 |
// ----------------------------------------------------------------------------- |
|
743 |
// CMPFileDetailsDialog::MakeTitleItemL |
|
744 |
// ----------------------------------------------------------------------------- |
|
745 |
// |
|
746 |
void CMPFileDetailsDialog::MakeTitleItemL( CDesCArray* aItemArray, |
|
747 |
CMPFileDetails* aFileDetails) |
|
748 |
{ |
|
749 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeTitleItemL()")); |
|
750 |
||
751 |
if (aFileDetails->iTitle) |
|
752 |
{ |
|
753 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_TITLE_HEADING); |
|
754 |
AddItemToListBoxL(*heading,*aFileDetails->iTitle,aItemArray); |
|
755 |
CleanupStack::PopAndDestroy(); // heading |
|
756 |
return; |
|
757 |
} |
|
758 |
||
759 |
if (aFileDetails->iFileName) |
|
760 |
{ |
|
761 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_NAME_HEADING); |
|
762 |
AddItemToListBoxL(*heading,*aFileDetails->iFileName,aItemArray); |
|
763 |
CleanupStack::PopAndDestroy(); // heading |
|
764 |
} |
|
765 |
} |
|
766 |
||
767 |
||
768 |
// ----------------------------------------------------------------------------- |
|
769 |
// CMPFileDetailsDialog::MakeUrlItemL |
|
770 |
// ----------------------------------------------------------------------------- |
|
771 |
// |
|
772 |
void CMPFileDetailsDialog::MakeUrlItemL( CDesCArray* aItemArray, |
|
773 |
CMPFileDetails* aFileDetails) |
|
774 |
{ |
|
775 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeUrlItemL()")); |
|
776 |
||
777 |
if (aFileDetails->iUrl) |
|
778 |
{ |
|
779 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_URL_HEADING); |
|
780 |
AddItemToListBoxL(*heading,*aFileDetails->iUrl,aItemArray); |
|
781 |
CleanupStack::PopAndDestroy(); // heading |
|
782 |
} |
|
783 |
} |
|
784 |
||
785 |
||
786 |
// ----------------------------------------------------------------------------- |
|
787 |
// CMPFileDetailsDialog::MakeFormatItemL |
|
788 |
// ----------------------------------------------------------------------------- |
|
789 |
// |
|
790 |
void CMPFileDetailsDialog::MakeFormatItemL(CDesCArray* aItemArray, |
|
791 |
CMPFileDetails* aFileDetails) |
|
792 |
{ |
|
793 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeFormatItemL()")); |
|
794 |
||
795 |
if (aFileDetails->iFormat) |
|
796 |
{ |
|
797 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_FORMAT_HEADING); |
|
798 |
AddItemToListBoxL(*heading,*aFileDetails->iFormat,aItemArray); |
|
799 |
CleanupStack::PopAndDestroy(); // heading |
|
800 |
} |
|
801 |
} |
|
802 |
||
803 |
// ----------------------------------------------------------------------------- |
|
804 |
// CMPFileDetailsDialog::MakeResolutionItemL |
|
805 |
// ----------------------------------------------------------------------------- |
|
806 |
// |
|
807 |
void CMPFileDetailsDialog::MakeResolutionItemL(CDesCArray* aItemArray, |
|
808 |
CMPFileDetails* aFileDetails) |
|
809 |
{ |
|
810 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeResolutionItemL()")); |
|
811 |
||
812 |
if (aFileDetails->iResolutionWidth && aFileDetails->iResolutionHeight) |
|
813 |
{ |
|
814 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_RESOLUTION_HEADING); |
|
815 |
CArrayFix<TInt>* items = new (ELeave) CArrayFixFlat<TInt>(2); |
|
816 |
CleanupStack::PushL(items); |
|
817 |
items->AppendL(aFileDetails->iResolutionWidth); |
|
818 |
items->AppendL(aFileDetails->iResolutionHeight); |
|
819 |
HBufC* value = StringLoader::LoadLC(R_MP_FILE_RESOLUTION,*items); |
|
820 |
TPtr text = value->Des(); |
|
821 |
TInt index = text.FindC(KMPX); |
|
822 |
LanguageSpecificNumberConversion( text ); |
|
823 |
text.Replace(index,1,KMPX); |
|
824 |
AddItemToListBoxL(*heading,*value,aItemArray); |
|
825 |
CleanupStack::PopAndDestroy(3); // heading,items,value |
|
826 |
} |
|
827 |
} |
|
828 |
||
829 |
// ----------------------------------------------------------------------------- |
|
830 |
// CMPFileDetailsDialog::MakeDurationItemL |
|
831 |
// ----------------------------------------------------------------------------- |
|
832 |
// |
|
833 |
void CMPFileDetailsDialog::MakeDurationItemL(CDesCArray* aItemArray, |
|
834 |
CMPFileDetails* aFileDetails) |
|
835 |
{ |
|
836 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeDurationItemL()")); |
|
837 |
||
838 |
TInt64 duration = aFileDetails->iDurationInSeconds; |
|
839 |
if (duration > 0) |
|
840 |
{ |
|
841 |
HBufC* dateFormatString; |
|
842 |
if (duration < KOneHourInSeconds) |
|
843 |
{ |
|
844 |
// Read time format string from AVKON resource |
|
845 |
dateFormatString = StringLoader::LoadLC(R_QTN_TIME_DURAT_MIN_SEC); |
|
846 |
} |
|
847 |
else |
|
848 |
{ |
|
849 |
// Read time format string from AVKON resource |
|
850 |
dateFormatString = StringLoader::LoadLC(R_QTN_TIME_DURAT_LONG); |
|
851 |
} |
|
852 |
TBuf<16> dur; |
|
853 |
TTime durTime = TTime(duration*KOneSecond); |
|
854 |
durTime.FormatL(dur, *dateFormatString); |
|
855 |
LanguageSpecificNumberConversion( dur ); |
|
856 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_DURATION_HEADING); |
|
857 |
AddItemToListBoxL(*heading,dur,aItemArray); |
|
858 |
CleanupStack::PopAndDestroy(2); // heading & dateFormatString |
|
859 |
} |
|
860 |
} |
|
861 |
||
862 |
// ----------------------------------------------------------------------------- |
|
863 |
// CMPFileDetailsDialog::MakeBitrateItemL |
|
864 |
// ----------------------------------------------------------------------------- |
|
865 |
// |
|
866 |
void CMPFileDetailsDialog::MakeBitrateItemL(CDesCArray* aItemArray, |
|
867 |
CMPFileDetails* aFileDetails) |
|
868 |
{ |
|
869 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeBitrateItemL()")); |
|
870 |
||
871 |
if (aFileDetails->iBitrate > 0) |
|
872 |
{ |
|
873 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_BITRATE_HEADING); |
|
874 |
HBufC* value = StringLoader::LoadLC( |
|
875 |
R_MP_FILE_BITRATE,aFileDetails->iBitrate / KThousandNotKilobyte ); |
|
876 |
TPtr text = value->Des(); |
|
877 |
LanguageSpecificNumberConversion( text ); |
|
878 |
AddItemToListBoxL(*heading,*value,aItemArray); |
|
879 |
CleanupStack::PopAndDestroy(2); // heading & value |
|
880 |
} |
|
881 |
} |
|
882 |
||
883 |
// ----------------------------------------------------------------------------- |
|
884 |
// CMPFileDetailsDialog::MakeSamplerateItemL |
|
885 |
// ----------------------------------------------------------------------------- |
|
886 |
// |
|
887 |
void CMPFileDetailsDialog::MakeSamplerateItemL(CDesCArray* aItemArray, |
|
888 |
CMPFileDetails* aFileDetails) |
|
889 |
{ |
|
890 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeSamplerateItemL()")); |
|
891 |
||
892 |
if (aFileDetails->iSamplerate > 0) |
|
893 |
{ |
|
894 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_SAMPLERATE_HEADING); |
|
895 |
HBufC* value = StringLoader::LoadLC( |
|
896 |
R_MP_FILE_SAMPLERATE,aFileDetails->iSamplerate); |
|
897 |
TPtr text = value->Des(); |
|
898 |
LanguageSpecificNumberConversion( text ); |
|
899 |
AddItemToListBoxL(*heading,*value,aItemArray); |
|
900 |
CleanupStack::PopAndDestroy(2); // heading & value |
|
901 |
} |
|
902 |
} |
|
903 |
||
904 |
// ----------------------------------------------------------------------------- |
|
905 |
// CMPFileDetailsDialog::MakeSizeItemL |
|
906 |
// ----------------------------------------------------------------------------- |
|
907 |
// |
|
908 |
void CMPFileDetailsDialog::MakeSizeItemL(CDesCArray* aItemArray, |
|
909 |
CMPFileDetails* aFileDetails) |
|
910 |
{ |
|
911 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeSizeItemL()")); |
|
912 |
||
913 |
if (aFileDetails->iSize) |
|
914 |
{ |
|
915 |
TRealFormat format = TRealFormat(KMaxFileName,2); |
|
916 |
TBuf<KMaxFileName> sizeString; |
|
917 |
HBufC* value; |
|
918 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_SIZE_HEADING); |
|
919 |
TReal size = aFileDetails->iSize; |
|
920 |
TReal truncsize; |
|
921 |
size = size/KFileSizeOneKilobyte; |
|
922 |
// Show kilobytes with 3 digits. If more digits needed, |
|
923 |
// show size in megabytes. Only round up if showing kB |
|
924 |
if ( size < KThousandNotKilobyte ) |
|
925 |
{ |
|
926 |
if (size > KOneKilobyte) // CR rounding only if size between 1kB and 1MB |
|
927 |
{ // rounding for Gallery/Messaging display equivalency |
|
928 |
const TReal tempsize = size; // need const |
|
929 |
TInt err = Math::Int(truncsize, tempsize); |
|
930 |
if (err == KErrNone) // need to catch error after convert to Tint |
|
931 |
{ |
|
932 |
if ((size > truncsize) && (size < truncsize + 1)) |
|
933 |
{ |
|
934 |
size = truncsize +1; |
|
935 |
} |
|
936 |
// else do nothing, size will be used |
|
937 |
} // if conversion failed, keep it TReal |
|
938 |
} |
|
939 |
sizeString.Num(size,format); |
|
940 |
switch (sizeString.Length()) |
|
941 |
{ |
|
942 |
case 6: |
|
943 |
sizeString = sizeString.Left(3); |
|
944 |
break; |
|
945 |
case 5: |
|
946 |
sizeString = sizeString.Left(4); |
|
947 |
break; |
|
948 |
default: |
|
949 |
break; |
|
950 |
} |
|
951 |
value = StringLoader::LoadLC(R_MP_FILE_SIZE_KB,sizeString); |
|
952 |
} |
|
953 |
else |
|
954 |
{ |
|
955 |
size = size/KFileSizeOneKilobyte; |
|
956 |
sizeString.Num(size,format); |
|
957 |
switch (sizeString.Length()) |
|
958 |
{ |
|
959 |
case 6: |
|
960 |
sizeString = sizeString.Left(3); |
|
961 |
break; |
|
962 |
case 5: |
|
963 |
sizeString = sizeString.Left(4); |
|
964 |
break; |
|
965 |
default: |
|
966 |
break; |
|
967 |
} |
|
968 |
value = StringLoader::LoadLC(R_MP_FILE_SIZE_MB,sizeString); |
|
969 |
} |
|
970 |
TPtr text = value->Des(); |
|
971 |
LanguageSpecificNumberConversion( text ); |
|
972 |
AddItemToListBoxL(*heading,*value,aItemArray); |
|
973 |
CleanupStack::PopAndDestroy(2); // heading & value |
|
974 |
} |
|
975 |
} |
|
976 |
||
977 |
// ----------------------------------------------------------------------------- |
|
978 |
// CMPFileDetailsDialog::MakeDateItemL |
|
979 |
// ----------------------------------------------------------------------------- |
|
980 |
// |
|
981 |
void CMPFileDetailsDialog::MakeDateItemL(CDesCArray* aItemArray, |
|
982 |
CMPFileDetails* aFileDetails) |
|
983 |
{ |
|
984 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeDateItemL()")); |
|
985 |
||
986 |
if (aFileDetails->iTime > TTime(0)) |
|
987 |
{ |
|
988 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_DATE_HEADING); |
|
989 |
HBufC* dateFormatString = |
|
990 |
StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ); |
|
991 |
TBuf<KMaxTimeLength> date; |
|
992 |
TTime localDate = aFileDetails->iTime + User::UTCOffset(); |
|
993 |
localDate.FormatL(date,*dateFormatString); |
|
994 |
LanguageSpecificNumberConversion( date ); |
|
995 |
AddItemToListBoxL(*heading,date,aItemArray); |
|
996 |
CleanupStack::PopAndDestroy(2); // heading & dateFormatString |
|
997 |
} |
|
998 |
} |
|
999 |
||
1000 |
// ----------------------------------------------------------------------------- |
|
1001 |
// CMPFileDetailsDialog::MakeTimeItemL |
|
1002 |
// ----------------------------------------------------------------------------- |
|
1003 |
// |
|
1004 |
void CMPFileDetailsDialog::MakeTimeItemL(CDesCArray* aItemArray, |
|
1005 |
CMPFileDetails* aFileDetails) |
|
1006 |
{ |
|
1007 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeTimeItemL()")); |
|
1008 |
||
1009 |
if (aFileDetails->iTime > TTime(0)) |
|
1010 |
{ |
|
1011 |
HBufC* heading = StringLoader::LoadLC( R_MP_FILE_TIME_HEADING ); |
|
1012 |
HBufC* timeFormatString = |
|
1013 |
StringLoader::LoadLC( R_QTN_TIME_USUAL_WITH_ZERO ); |
|
1014 |
TBuf<32> time; |
|
1015 |
TTime localTime = aFileDetails->iTime + User::UTCOffset(); |
|
1016 |
localTime.FormatL(time,*timeFormatString); |
|
1017 |
LanguageSpecificNumberConversion( time ); |
|
1018 |
AddItemToListBoxL(*heading,time,aItemArray); |
|
1019 |
CleanupStack::PopAndDestroy(2); // heading & timeFormatString |
|
1020 |
} |
|
1021 |
} |
|
1022 |
||
1023 |
// ----------------------------------------------------------------------------- |
|
1024 |
// CMPFileDetailsDialog::MakeUploadStatusL |
|
1025 |
// ----------------------------------------------------------------------------- |
|
1026 |
// |
|
1027 |
||
1028 |
void CMPFileDetailsDialog::MakeUploadStatusL(CDesCArray* aItemArray, |
|
1029 |
CMPFileDetails* aFileDetails) |
|
1030 |
{ |
|
1031 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeUploadStatusL()")); |
|
1032 |
||
1033 |
if(aFileDetails->iVideoTrack) |
|
1034 |
{ |
|
1035 |
HBufC* heading = StringLoader::LoadLC( R_QTN_MP_FILE_UPLOAD_STATUS ); |
|
1036 |
||
1037 |
CAiwServiceHandler* AIWServiceHandler = CAiwServiceHandler::NewLC(); |
|
1038 |
||
1039 |
// AIW generic input param list |
|
1040 |
CAiwGenericParamList& mpBaseInputParamsList = |
|
1041 |
AIWServiceHandler->InParamListL(); |
|
1042 |
// Aiw generic output param list |
|
1043 |
CAiwGenericParamList& mpBaseOutputParamsList = |
|
1044 |
AIWServiceHandler->OutParamListL(); |
|
1045 |
||
1046 |
//assign the file name |
|
1047 |
TAiwVariant fileNameVariant( aFileDetails->iFileName ); |
|
1048 |
TAiwGenericParam fileNameParam( EGenericParamFile, fileNameVariant ); |
|
1049 |
mpBaseInputParamsList.AppendL( fileNameParam ); //file name |
|
1050 |
||
1051 |
// Execute the AIW service command |
|
1052 |
AIWServiceHandler->ExecuteServiceCmdL( KAIWCmdAmsExtendedLightSurfData, |
|
1053 |
mpBaseInputParamsList, |
|
1054 |
mpBaseOutputParamsList ); |
|
1055 |
||
1056 |
HBufC* str; |
|
1057 |
str = StringLoader::LoadLC(R_QTN_MP_VIDEO_NOT_UPLOADED ); |
|
1058 |
//if file is uploaded, then only provider will add the result |
|
1059 |
//to the output param list |
|
1060 |
if ( mpBaseOutputParamsList.Count() > 0) |
|
1061 |
{ |
|
1062 |
TInt Index = 0; |
|
1063 |
//check for file type |
|
1064 |
const TAiwGenericParam* uploadParam = |
|
1065 |
mpBaseOutputParamsList.FindFirst( Index, |
|
1066 |
EGenericParamCharSet, EVariantTypeDesC ); |
|
1067 |
if(uploadParam != NULL ) |
|
1068 |
{ |
|
1069 |
CleanupStack::PopAndDestroy(); |
|
1070 |
str = StringLoader::LoadLC(R_QTN_MP_VIDEO_UPLOADED ); |
|
1071 |
} |
|
1072 |
} |
|
1073 |
||
1074 |
AddItemToListBoxL(*heading,*str,aItemArray); |
|
1075 |
CleanupStack::PopAndDestroy(3); // heading, str & AIWServiceHandler |
|
1076 |
} |
|
1077 |
} |
|
1078 |
||
1079 |
// ----------------------------------------------------------------------------- |
|
1080 |
// CMPFileDetailsDialog::MakeCopyrightItemL |
|
1081 |
// ----------------------------------------------------------------------------- |
|
1082 |
// |
|
1083 |
void CMPFileDetailsDialog::MakeCopyrightItemL(CDesCArray* aItemArray, |
|
1084 |
CMPFileDetails* aFileDetails) |
|
1085 |
{ |
|
1086 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeCopyrightItemL()")); |
|
1087 |
||
1088 |
if (aFileDetails->iCopyright) |
|
1089 |
{ |
|
1090 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_COPYRIGHT_HEADING); |
|
1091 |
TPtr text = aFileDetails->iCopyright->Des(); |
|
1092 |
LanguageSpecificNumberConversion( text ); |
|
1093 |
AddItemToListBoxL(*heading,*aFileDetails->iCopyright,aItemArray); |
|
1094 |
CleanupStack::PopAndDestroy(); // heading |
|
1095 |
} |
|
1096 |
} |
|
1097 |
||
1098 |
// ----------------------------------------------------------------------------- |
|
1099 |
// CMPFileDetailsDialog::MakeOriginalArtistItemL |
|
1100 |
// ----------------------------------------------------------------------------- |
|
1101 |
// |
|
1102 |
void CMPFileDetailsDialog::MakeOriginalArtistItemL(CDesCArray* aItemArray, |
|
1103 |
CMPFileDetails* aFileDetails) |
|
1104 |
{ |
|
1105 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeOriginalArtistItemL()")); |
|
1106 |
||
1107 |
if (aFileDetails->iOriginalArtist) |
|
1108 |
{ |
|
1109 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_ARTIST_ORIGINAL_HEADING); |
|
1110 |
TPtr text = aFileDetails->iOriginalArtist->Des(); |
|
1111 |
LanguageSpecificNumberConversion( text ); |
|
1112 |
AddItemToListBoxL(*heading,*aFileDetails->iOriginalArtist,aItemArray); |
|
1113 |
CleanupStack::PopAndDestroy(); // heading |
|
1114 |
} |
|
1115 |
} |
|
1116 |
||
1117 |
// ----------------------------------------------------------------------------- |
|
1118 |
// CMPFileDetailsDialog::MakeAlbumTrackItemL |
|
1119 |
// ----------------------------------------------------------------------------- |
|
1120 |
// |
|
1121 |
void CMPFileDetailsDialog::MakeAlbumTrackItemL(CDesCArray* aItemArray, |
|
1122 |
CMPFileDetails* aFileDetails) |
|
1123 |
{ |
|
1124 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeAlbumTrackItemL()")); |
|
1125 |
||
1126 |
if (aFileDetails->iAlbumTrack) |
|
1127 |
{ |
|
1128 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_ALBUM_TRACK_HEADING); |
|
1129 |
TPtr text = aFileDetails->iAlbumTrack->Des(); |
|
1130 |
LanguageSpecificNumberConversion( text ); |
|
1131 |
AddItemToListBoxL(*heading,*aFileDetails->iAlbumTrack,aItemArray); |
|
1132 |
CleanupStack::PopAndDestroy(); // heading |
|
1133 |
} |
|
1134 |
} |
|
1135 |
||
1136 |
// ----------------------------------------------------------------------------- |
|
1137 |
// CMPFileDetailsDialog::MakeGenreItemL |
|
1138 |
// ----------------------------------------------------------------------------- |
|
1139 |
// |
|
1140 |
void CMPFileDetailsDialog::MakeGenreItemL(CDesCArray* aItemArray, |
|
1141 |
CMPFileDetails* aFileDetails) |
|
1142 |
{ |
|
1143 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeGenreItemL()")); |
|
1144 |
if (aFileDetails->iGenre) |
|
1145 |
{ |
|
1146 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_GENRE_HEADING); |
|
1147 |
TPtr text = aFileDetails->iGenre->Des(); |
|
1148 |
||
1149 |
LanguageSpecificNumberConversion( text ); |
|
1150 |
AddItemToListBoxL(*heading,*aFileDetails->iGenre,aItemArray); |
|
1151 |
||
1152 |
CleanupStack::PopAndDestroy(); // heading |
|
1153 |
} |
|
1154 |
} |
|
1155 |
||
1156 |
// ----------------------------------------------------------------------------- |
|
1157 |
// CMPFileDetailsDialog::MakeComposerItemL |
|
1158 |
// ----------------------------------------------------------------------------- |
|
1159 |
// |
|
1160 |
void CMPFileDetailsDialog::MakeComposerItemL(CDesCArray* aItemArray, |
|
1161 |
CMPFileDetails* aFileDetails) |
|
1162 |
{ |
|
1163 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeComposerItemL()")); |
|
1164 |
||
1165 |
if (aFileDetails->iComposer) |
|
1166 |
{ |
|
1167 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_COMPOSER_HEADING); |
|
1168 |
TPtr text = aFileDetails->iComposer->Des(); |
|
1169 |
LanguageSpecificNumberConversion( text ); |
|
1170 |
AddItemToListBoxL(*heading,*aFileDetails->iComposer,aItemArray); |
|
1171 |
CleanupStack::PopAndDestroy(); // heading |
|
1172 |
} |
|
1173 |
} |
|
1174 |
||
1175 |
// ----------------------------------------------------------------------------- |
|
1176 |
// CMPFileDetailsDialog::MakeAudioFileWebPageItemL |
|
1177 |
// ----------------------------------------------------------------------------- |
|
1178 |
// |
|
1179 |
void CMPFileDetailsDialog::MakeAudioFileWebPageItemL( |
|
1180 |
CDesCArray* aItemArray, |
|
1181 |
CMPFileDetails* aFileDetails ) |
|
1182 |
{ |
|
1183 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeAudioFileWebPageItemL()")); |
|
1184 |
||
1185 |
if (aFileDetails->iAudioFileWebPage) |
|
1186 |
{ |
|
1187 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_INFO_URL_HEADING); |
|
1188 |
TPtr text = aFileDetails->iAudioFileWebPage->Des(); |
|
1189 |
LanguageSpecificNumberConversion( text ); |
|
1190 |
AddItemToListBoxL(*heading,*aFileDetails->iAudioFileWebPage,aItemArray); |
|
1191 |
CleanupStack::PopAndDestroy(); // heading |
|
1192 |
} |
|
1193 |
} |
|
1194 |
||
1195 |
// ----------------------------------------------------------------------------- |
|
1196 |
// CMPFileDetailsDialog::MakeCommentItemL |
|
1197 |
// ----------------------------------------------------------------------------- |
|
1198 |
// |
|
1199 |
void CMPFileDetailsDialog::MakeCommentItemL(CDesCArray* aItemArray, |
|
1200 |
CMPFileDetails* aFileDetails) |
|
1201 |
{ |
|
1202 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeCommentItemL()")); |
|
1203 |
||
1204 |
if (aFileDetails->iComment) |
|
1205 |
{ |
|
1206 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_COMMENT_HEADING); |
|
1207 |
TPtr text = aFileDetails->iComment->Des(); |
|
1208 |
LanguageSpecificNumberConversion( text ); |
|
1209 |
AddItemToListBoxL(*heading,*aFileDetails->iComment,aItemArray); |
|
1210 |
CleanupStack::PopAndDestroy(); // heading |
|
1211 |
} |
|
1212 |
} |
|
1213 |
||
1214 |
// ----------------------------------------------------------------------------- |
|
1215 |
// CMPFileDetailsDialog::MakeArtistItemL |
|
1216 |
// ----------------------------------------------------------------------------- |
|
1217 |
// |
|
1218 |
void CMPFileDetailsDialog::MakeArtistItemL(CDesCArray* aItemArray, |
|
1219 |
CMPFileDetails* aFileDetails) |
|
1220 |
{ |
|
1221 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeArtistItemL()")); |
|
1222 |
||
1223 |
if (aFileDetails->iArtist) |
|
1224 |
{ |
|
1225 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_ARTIST_HEADING); |
|
1226 |
AddItemToListBoxL(*heading,*aFileDetails->iArtist,aItemArray); |
|
1227 |
CleanupStack::PopAndDestroy(); // heading |
|
1228 |
} |
|
1229 |
} |
|
1230 |
||
1231 |
// ----------------------------------------------------------------------------- |
|
1232 |
// CMPFileDetailsDialog::MakeAlbumItemL |
|
1233 |
// ----------------------------------------------------------------------------- |
|
1234 |
// |
|
1235 |
void CMPFileDetailsDialog::MakeAlbumItemL(CDesCArray* aItemArray, |
|
1236 |
CMPFileDetails* aFileDetails) |
|
1237 |
{ |
|
1238 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeAlbumItemL()")); |
|
1239 |
||
1240 |
if (aFileDetails->iAlbum) |
|
1241 |
{ |
|
1242 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_ALBUM_HEADING); |
|
1243 |
AddItemToListBoxL(*heading,*aFileDetails->iAlbum,aItemArray); |
|
1244 |
CleanupStack::PopAndDestroy(); // heading |
|
1245 |
} |
|
1246 |
} |
|
1247 |
||
1248 |
// ----------------------------------------------------------------------------- |
|
1249 |
// CMPFileDetailsDialog::MakeYearItemL |
|
1250 |
// ----------------------------------------------------------------------------- |
|
1251 |
// |
|
1252 |
void CMPFileDetailsDialog::MakeYearItemL(CDesCArray* aItemArray, |
|
1253 |
CMPFileDetails* aFileDetails) |
|
1254 |
{ |
|
1255 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeYearItemL()")); |
|
1256 |
||
1257 |
if (aFileDetails->iYear) |
|
1258 |
{ |
|
1259 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_YEAR_HEADING); |
|
1260 |
TPtr text = aFileDetails->iYear->Des(); |
|
1261 |
LanguageSpecificNumberConversion( text ); |
|
1262 |
AddItemToListBoxL(*heading,*aFileDetails->iYear,aItemArray); |
|
1263 |
CleanupStack::PopAndDestroy(); // heading |
|
1264 |
} |
|
1265 |
} |
|
1266 |
||
1267 |
||
1268 |
// ----------------------------------------------------------------------------- |
|
1269 |
// CMPFileDetailsDialog::DisplayDrmHeadingInfoL |
|
1270 |
// ----------------------------------------------------------------------------- |
|
1271 |
// |
|
1272 |
void CMPFileDetailsDialog::DisplayDrmHeadingInfoL(CDesCArray* aItemArray) |
|
1273 |
{ |
|
1274 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::DisplayDrmHeadingInfoL()")); |
|
1275 |
||
1276 |
// |
|
1277 |
// All DRM rights & constraints are handled & displayed by DRM component. |
|
1278 |
// So, MP only needs to display the Heading here. |
|
1279 |
// |
|
1280 |
||
1281 |
// |
|
1282 |
// License |
|
1283 |
// For details click 'View' |
|
1284 |
// |
|
1285 |
HBufC* heading = StringLoader::LoadLC(R_QTN_MP_DRM_LICENSE_HEADING); |
|
1286 |
HBufC* value = StringLoader::LoadLC(R_QTN_MP_DRM_DETAILS_VIEW); |
|
1287 |
AddItemToListBoxL(*heading,*value,aItemArray); |
|
1288 |
CleanupStack::PopAndDestroy(2); // heading && value |
|
1289 |
} |
|
1290 |
||
1291 |
||
1292 |
// ----------------------------------------------------------------------------- |
|
1293 |
// CMPFileDetailsDialog::LanguageSpecificNumberConversion |
|
1294 |
// ----------------------------------------------------------------------------- |
|
1295 |
// |
|
1296 |
void CMPFileDetailsDialog::LanguageSpecificNumberConversion( TDes& aText ) const |
|
1297 |
{ |
|
1298 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::LanguageSpecificNumberConversion()")); |
|
1299 |
||
1300 |
if ( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) ) |
|
1301 |
{ |
|
1302 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aText ); |
|
1303 |
} |
|
1304 |
} |
|
1305 |
||
1306 |
// Dummy implementations for audio callback |
|
1307 |
||
1308 |
// ----------------------------------------------------------------------------- |
|
1309 |
// CMPFileDetailsDialog::MapcInitComplete |
|
1310 |
// ----------------------------------------------------------------------------- |
|
1311 |
// |
|
1312 |
void CMPFileDetailsDialog::MapcInitComplete( |
|
1313 |
TInt aError, |
|
1314 |
const TTimeIntervalMicroSeconds& /*aDuration*/) |
|
1315 |
{ |
|
1316 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MapcInitComplete()")); |
|
1317 |
||
1318 |
// Open completed, resume ExecuteLD(const TDesC& aFileName) |
|
1319 |
iResult = aError; |
|
1320 |
if ( iWait.IsStarted() ) |
|
1321 |
{ |
|
1322 |
iWait.AsyncStop(); |
|
1323 |
} |
|
1324 |
} |
|
1325 |
||
1326 |
// ----------------------------------------------------------------------------- |
|
1327 |
// CMPFileDetailsDialog::MapcPlayComplete |
|
1328 |
// ----------------------------------------------------------------------------- |
|
1329 |
// |
|
1330 |
void CMPFileDetailsDialog::MapcPlayComplete(TInt /*aError*/) |
|
1331 |
{ |
|
1332 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MapcPlayComplete()")); |
|
1333 |
} |
|
1334 |
||
1335 |
||
1336 |
// Dummy implementations for video callback |
|
1337 |
||
1338 |
// ----------------------------------------------------------------------------- |
|
1339 |
// CMPFileDetailsDialog::MvpuoOpenComplete |
|
1340 |
// ----------------------------------------------------------------------------- |
|
1341 |
// |
|
1342 |
void CMPFileDetailsDialog::MvpuoOpenComplete(TInt aError) |
|
1343 |
{ |
|
1344 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MvpuoOpenComplete()")); |
|
1345 |
||
1346 |
// Open completed, resume ExecuteLD(const TDesC& aFileName) |
|
1347 |
iResult = aError; |
|
1348 |
if ( iWait.IsStarted() ) |
|
1349 |
{ |
|
1350 |
iWait.AsyncStop(); |
|
1351 |
} |
|
1352 |
} |
|
1353 |
||
1354 |
// ----------------------------------------------------------------------------- |
|
1355 |
// CMPFileDetailsDialog::MvpuoFrameReady |
|
1356 |
// ----------------------------------------------------------------------------- |
|
1357 |
// |
|
1358 |
void CMPFileDetailsDialog::MvpuoFrameReady( CFbsBitmap& /*aFrame*/, |
|
1359 |
TInt /*aError*/ ) |
|
1360 |
{ |
|
1361 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MvpuoFrameReady()")); |
|
1362 |
} |
|
1363 |
||
1364 |
// ----------------------------------------------------------------------------- |
|
1365 |
// CMPFileDetailsDialog::MvpuoPlayComplete |
|
1366 |
// ----------------------------------------------------------------------------- |
|
1367 |
// |
|
1368 |
void CMPFileDetailsDialog::MvpuoPlayComplete(TInt /*aError*/) |
|
1369 |
{ |
|
1370 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MvpuoPlayComplete()")); |
|
1371 |
} |
|
1372 |
||
1373 |
// ----------------------------------------------------------------------------- |
|
1374 |
// CMPFileDetailsDialog::MvpuoPrepareComplete |
|
1375 |
// ----------------------------------------------------------------------------- |
|
1376 |
// |
|
1377 |
void CMPFileDetailsDialog::MvpuoPrepareComplete(TInt aError) |
|
1378 |
{ |
|
1379 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MvpuoPrepareComplete()")); |
|
1380 |
||
1381 |
// Prepare completed, resume ExecuteLD(const TDesC& aFileName) |
|
1382 |
iResult = aError; |
|
1383 |
if ( iWait.IsStarted() ) |
|
1384 |
{ |
|
1385 |
iWait.AsyncStop(); |
|
1386 |
} |
|
1387 |
} |
|
1388 |
||
1389 |
// ----------------------------------------------------------------------------- |
|
1390 |
// CMPFileDetailsDialog::MvpuoEvent |
|
1391 |
// ----------------------------------------------------------------------------- |
|
1392 |
// |
|
1393 |
void CMPFileDetailsDialog::MvpuoEvent(const TMMFEvent& /*aEvent*/) |
|
1394 |
{ |
|
1395 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MvpuoEvent()")); |
|
1396 |
} |
|
1397 |
||
1398 |
// ----------------------------------------------------------------------------- |
|
1399 |
// CMPFileDetailsDialog::FetchMetaDataL |
|
1400 |
// ----------------------------------------------------------------------------- |
|
1401 |
// |
|
1402 |
void CMPFileDetailsDialog::FetchMetaDataL( const TDesC& aFileName, |
|
1403 |
CMPFileDetails* aFileDetails ) |
|
1404 |
{ |
|
1405 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::FetchMetaDataL()")); |
|
1406 |
||
1407 |
CMdaAudioPlayerUtility* audioPlayer = CMdaAudioPlayerUtility::NewL(*this); |
|
1408 |
CleanupStack::PushL( audioPlayer ); |
|
1409 |
// Open audio player with the file. |
|
1410 |
audioPlayer->OpenFileL( aFileName ); |
|
1411 |
// Wait open to complete. Active Scheduler is resumed, when the player is |
|
1412 |
// initialized. See CMPFileDetailsDialog::MapcInitComplete. |
|
1413 |
iWait.Start(); |
|
1414 |
||
1415 |
// iResult is updated according to error code in MapcInitComplete |
|
1416 |
if ( iResult ) |
|
1417 |
{ |
|
1418 |
// Get metadata |
|
1419 |
if( aFileDetails->iDrmProtected ) |
|
1420 |
{ |
|
1421 |
switch( aFileDetails->iDRMRightsStatus ) |
|
1422 |
{ |
|
1423 |
case EMediaPlayerFull: |
|
1424 |
case EMediaPlayerRestricted: |
|
1425 |
case KMediaPlayerWmdrmValid: |
|
1426 |
{ |
|
1427 |
FetchAdditionalMetaDataL( aFileName, aFileDetails ); |
|
1428 |
break; |
|
1429 |
} |
|
1430 |
case EMediaPlayerMissing: |
|
1431 |
case EMediaPlayerExpired: |
|
1432 |
case EMediaPlayerPreview: |
|
1433 |
case KMediaPlayerWmdrmExpired: |
|
1434 |
{ |
|
1435 |
FetchDCFHeaderDataL( aFileName, aFileDetails ); |
|
1436 |
break; |
|
1437 |
} |
|
1438 |
default: |
|
1439 |
{ |
|
1440 |
// nothing to do |
|
1441 |
break; |
|
1442 |
} |
|
1443 |
} |
|
1444 |
} |
|
1445 |
else |
|
1446 |
{ |
|
1447 |
FetchAdditionalMetaDataL( aFileName, aFileDetails ); |
|
1448 |
} |
|
1449 |
CleanupStack::PopAndDestroy(); // audioPlayer |
|
1450 |
return; |
|
1451 |
} |
|
1452 |
||
1453 |
// get audio file details |
|
1454 |
aFileDetails->iDurationInSeconds = |
|
1455 |
audioPlayer->Duration().Int64() / KOneSecond; |
|
1456 |
||
1457 |
// Bitrate |
|
1458 |
TPckgBuf<TMMFAudioConfig> data; |
|
1459 |
const TMMFMessageDestinationPckg destinationPckg( |
|
1460 |
KUidInterfaceMMFAudioController ); |
|
1461 |
TInt err = audioPlayer->CustomCommandSync( destinationPckg, |
|
1462 |
EMMFAudioControllerGetSourceBitRate, |
|
1463 |
KNullDesC8, KNullDesC8, data ); |
|
1464 |
if ( !err ) |
|
1465 |
{ |
|
1466 |
aFileDetails->iBitrate = data().iSampleRate; |
|
1467 |
} |
|
1468 |
||
1469 |
// Samplerate |
|
1470 |
err = audioPlayer->CustomCommandSync( destinationPckg, |
|
1471 |
EMMFAudioControllerGetSourceSampleRate, |
|
1472 |
KNullDesC8, KNullDesC8, data ); |
|
1473 |
if ( !err ) |
|
1474 |
{ |
|
1475 |
aFileDetails->iSamplerate = data().iSampleRate; |
|
1476 |
} |
|
1477 |
||
1478 |
CleanupStack::PopAndDestroy(); // audioPlayer |
|
1479 |
||
1480 |
// get metadata |
|
1481 |
FetchAdditionalMetaDataL( aFileName, aFileDetails ); |
|
1482 |
} |
|
1483 |
||
1484 |
// ----------------------------------------------------------------------------- |
|
1485 |
// CMPFileDetailsDialog::FetchDrmDataL |
|
1486 |
// ----------------------------------------------------------------------------- |
|
1487 |
// |
|
1488 |
void CMPFileDetailsDialog::FetchDrmDataL( const TDesC& aFileName, |
|
1489 |
CMPFileDetails* aFileDetails ) |
|
1490 |
{ |
|
1491 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::FetchDrmDataL()")); |
|
1492 |
||
1493 |
// |
|
1494 |
// Only 'aFileDetails->iDRMRightsStatus' is still needed to display additional meta data. |
|
1495 |
// Those additional meta data are obtained in FetchAdditionalMetaDataL() method. |
|
1496 |
// All other DRM related info (expire constraints, counts, valid from/until, etc.) |
|
1497 |
// are obtained and displayed by DRM Details component. |
|
1498 |
// |
|
1499 |
CDRMHelper* drmHelper = CDRMHelper::NewLC(*CCoeEnv::Static()); |
|
1500 |
CMediaPlayerDrmHelper* mediaDrmHelper = CMediaPlayerDrmHelper::NewL(drmHelper); |
|
1501 |
CleanupStack::PushL(mediaDrmHelper); |
|
1502 |
||
1503 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
1504 |
TInt64 size(0); |
|
1505 |
#else |
|
1506 |
TInt size(0); |
|
1507 |
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
1508 |
TInt err(0); |
|
1509 |
||
1510 |
if ( aFileDetails->iDetailsFileHandle.SubSessionHandle() ) |
|
1511 |
err = aFileDetails->iDetailsFileHandle.Size( size ); |
|
1512 |
||
1513 |
if (!err && size ) |
|
1514 |
mediaDrmHelper->LoadDrmUsageRightsInfoL(aFileDetails->iDetailsFileHandle); |
|
1515 |
else |
|
1516 |
{ |
|
1517 |
RFs fs = CEikonEnv::Static()->FsSession(); |
|
1518 |
TInt error = aFileDetails->iDetailsFileHandle.Open(fs, aFileName, EFileRead | EFileShareReadersOnly); |
|
1519 |
if (error) |
|
1520 |
error = aFileDetails->iDetailsFileHandle.Open(fs, aFileName, EFileRead | EFileShareAny); |
|
1521 |
||
1522 |
if (!error) |
|
1523 |
mediaDrmHelper->LoadDrmUsageRightsInfoL(aFileDetails->iDetailsFileHandle); |
|
1524 |
else |
|
1525 |
mediaDrmHelper->LoadDrmUsageRightsInfoL(aFileName); |
|
1526 |
} |
|
1527 |
||
1528 |
mediaDrmHelper->GetDrmUsageRightsStatus(aFileDetails->iDRMRightsStatus); |
|
1529 |
||
1530 |
// cleanup |
|
1531 |
CleanupStack::PopAndDestroy(2); // drmHelper, mediaDrmHelper |
|
1532 |
} |
|
1533 |
||
1534 |
// ----------------------------------------------------------------------------- |
|
1535 |
// CMPFileDetailsDialog::MakeProviderItemL |
|
1536 |
// ----------------------------------------------------------------------------- |
|
1537 |
// |
|
1538 |
void CMPFileDetailsDialog::MakeProviderItemL( CDesCArray* aItemArray, |
|
1539 |
CMPFileDetails* aFileDetails ) |
|
1540 |
{ |
|
1541 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeProviderItemL()")); |
|
1542 |
||
1543 |
if (aFileDetails->iProvider) |
|
1544 |
{ |
|
1545 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_PROVIDER_HEADING); |
|
1546 |
AddItemToListBoxL(*heading,*aFileDetails->iProvider,aItemArray); |
|
1547 |
CleanupStack::PopAndDestroy(); // heading |
|
1548 |
} |
|
1549 |
} |
|
1550 |
||
1551 |
// ----------------------------------------------------------------------------- |
|
1552 |
// CMPFileDetailsDialog::MakeDescriptionItemL |
|
1553 |
// ----------------------------------------------------------------------------- |
|
1554 |
// |
|
1555 |
void CMPFileDetailsDialog::MakeDescriptionItemL( CDesCArray* aItemArray, |
|
1556 |
CMPFileDetails* aFileDetails ) |
|
1557 |
{ |
|
1558 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::MakeDescriptionItemL()")); |
|
1559 |
||
1560 |
if (aFileDetails->iDescription) |
|
1561 |
{ |
|
1562 |
HBufC* heading = StringLoader::LoadLC(R_MP_FILE_DESCRIPTION_HEADING); |
|
1563 |
AddItemToListBoxL(*heading,*aFileDetails->iDescription,aItemArray); |
|
1564 |
CleanupStack::PopAndDestroy(); // heading |
|
1565 |
} |
|
1566 |
} |
|
1567 |
||
1568 |
// ----------------------------------------------------------------------------- |
|
1569 |
// CMPFileDetailsDialog::FetchAdditionalMetaDataL |
|
1570 |
// ----------------------------------------------------------------------------- |
|
1571 |
// |
|
1572 |
void CMPFileDetailsDialog::FetchAdditionalMetaDataL( const TDesC& aFileName, |
|
1573 |
CMPFileDetails* aFileDetails ) |
|
1574 |
{ |
|
1575 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::FetchAdditionalMetaDataL()")); |
|
1576 |
||
1577 |
CMetaDataUtility *metaDataUtility = CMetaDataUtility::NewL(); |
|
1578 |
CleanupStack::PushL( metaDataUtility ); |
|
1579 |
TRAPD( err, metaDataUtility->OpenFileL( aFileName ) ); |
|
1580 |
if( err == KErrNone ) // leaves if file in use |
|
1581 |
{ |
|
1582 |
TInt count = metaDataUtility->MetaDataCount(); |
|
1583 |
for(TInt i = 0; i < count; i++) |
|
1584 |
{ |
|
1585 |
TMetaDataFieldId fieldId; |
|
1586 |
TPtrC field = metaDataUtility->MetaDataFieldsL().At( i, fieldId ); |
|
1587 |
if( field != KNullDesC ) |
|
1588 |
{ |
|
1589 |
switch( fieldId ) |
|
1590 |
{ |
|
1591 |
case EMetaDataSongTitle: |
|
1592 |
{ |
|
1593 |
SetFileDetailL( aFileDetails->iTitle, field ); |
|
1594 |
break; |
|
1595 |
} |
|
1596 |
case EMetaDataArtist: |
|
1597 |
{ |
|
1598 |
SetFileDetailL( aFileDetails->iArtist, field ); |
|
1599 |
break; |
|
1600 |
} |
|
1601 |
case EMetaDataAlbum: |
|
1602 |
{ |
|
1603 |
SetFileDetailL( aFileDetails->iAlbum, field ); |
|
1604 |
break; |
|
1605 |
} |
|
1606 |
case EMetaDataYear: |
|
1607 |
{ |
|
1608 |
SetFileDetailL( aFileDetails->iYear, field ); |
|
1609 |
break; |
|
1610 |
} |
|
1611 |
case EMetaDataCopyright: |
|
1612 |
{ |
|
1613 |
SetFileDetailL( aFileDetails->iCopyright, field ); |
|
1614 |
break; |
|
1615 |
} |
|
1616 |
case EMetaDataOriginalArtist: |
|
1617 |
{ |
|
1618 |
SetFileDetailL( aFileDetails->iOriginalArtist, field ); |
|
1619 |
break; |
|
1620 |
} |
|
1621 |
case EMetaDataAlbumTrack: |
|
1622 |
{ |
|
1623 |
SetFileDetailL( aFileDetails->iAlbumTrack, field ); |
|
1624 |
break; |
|
1625 |
} |
|
1626 |
case EMetaDataGenre: |
|
1627 |
{ |
|
1628 |
SetFileDetailL( aFileDetails->iGenre, field ); |
|
1629 |
break; |
|
1630 |
} |
|
1631 |
case EMetaDataComposer: |
|
1632 |
{ |
|
1633 |
SetFileDetailL( aFileDetails->iComposer, field ); |
|
1634 |
break; |
|
1635 |
} |
|
1636 |
case EMetaDataUserUrl: |
|
1637 |
case EMetaDataUrl: // (L616) fallthrough |
|
1638 |
{ |
|
1639 |
SetFileDetailL( aFileDetails->iAudioFileWebPage, field ); |
|
1640 |
break; |
|
1641 |
} |
|
1642 |
case EMetaDataComment: |
|
1643 |
{ |
|
1644 |
SetFileDetailL( aFileDetails->iComment, field ); |
|
1645 |
break; |
|
1646 |
} |
|
1647 |
default: |
|
1648 |
{ |
|
1649 |
// nothing to do |
|
1650 |
break; |
|
1651 |
} |
|
1652 |
} |
|
1653 |
} |
|
1654 |
} |
|
1655 |
} |
|
1656 |
CleanupStack::PopAndDestroy(); // metaDataUtility |
|
1657 |
} |
|
1658 |
||
1659 |
// ----------------------------------------------------------------------------- |
|
1660 |
// CMPFileDetailsDialog::FetchDCFHeaderDataL |
|
1661 |
// ----------------------------------------------------------------------------- |
|
1662 |
// |
|
1663 |
void CMPFileDetailsDialog::FetchDCFHeaderDataL( const TDesC& aFileName, |
|
1664 |
CMPFileDetails* aFileDetails ) |
|
1665 |
{ |
|
1666 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::FetchDCFHeaderDataL()")); |
|
1667 |
||
1668 |
TBuf <256> headerValue; |
|
1669 |
TInt err( KErrNone ); |
|
1670 |
CContent* content = CContent::NewLC( aFileName ); |
|
1671 |
||
1672 |
// Content-Name |
|
1673 |
err = content->GetStringAttribute(ETitle, headerValue); |
|
1674 |
if( err == KErrNone ) |
|
1675 |
{ |
|
1676 |
SetFileDetailL( aFileDetails->iTitle, headerValue ); |
|
1677 |
} |
|
1678 |
||
1679 |
// Content-Vendor |
|
1680 |
err = content->GetStringAttribute(EContentVendor, headerValue); |
|
1681 |
if( err == KErrNone ) |
|
1682 |
{ |
|
1683 |
SetFileDetailL( aFileDetails->iProvider, headerValue ); |
|
1684 |
} |
|
1685 |
||
1686 |
// Content-Description |
|
1687 |
err = content->GetStringAttribute(EDescription, headerValue); |
|
1688 |
if( err == KErrNone ) |
|
1689 |
{ |
|
1690 |
SetFileDetailL( aFileDetails->iDescription, headerValue ); |
|
1691 |
} |
|
1692 |
||
1693 |
// clean up |
|
1694 |
CleanupStack::PopAndDestroy(); // content |
|
1695 |
} |
|
1696 |
||
1697 |
// ----------------------------------------------------------------------------- |
|
1698 |
// CMPFileDetailsDialog::Is3gpFile |
|
1699 |
// ----------------------------------------------------------------------------- |
|
1700 |
// |
|
1701 |
TBool CMPFileDetailsDialog::Is3gpFile( const TDesC& aFileName, |
|
1702 |
CMPFileDetails* aFileDetails ) |
|
1703 |
{ |
|
1704 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::Is3gpFile()")); |
|
1705 |
||
1706 |
TBool retVal( EFalse ); |
|
1707 |
// File extension |
|
1708 |
if( aFileName.FindF( KExt3gpp ) != KErrNotFound || |
|
1709 |
aFileName.FindF( KExtMp4 ) != KErrNotFound || |
|
1710 |
aFileName.FindF( KExtM4a ) != KErrNotFound ) |
|
1711 |
{ |
|
1712 |
retVal = ETrue; |
|
1713 |
} |
|
1714 |
||
1715 |
// Mimetype |
|
1716 |
if( !retVal && aFileDetails->iFormat ) |
|
1717 |
{ |
|
1718 |
TPtrC mime = aFileDetails->iFormat->Des(); |
|
1719 |
if (mime == KDetaMime3gpp || |
|
1720 |
mime == KDetaMime3gpp2 || |
|
1721 |
mime == KDetaMimeMp4) |
|
1722 |
{ |
|
1723 |
retVal = ETrue; |
|
1724 |
} |
|
1725 |
} |
|
1726 |
||
1727 |
return retVal; |
|
1728 |
} |
|
1729 |
||
1730 |
// ----------------------------------------------------------------------------- |
|
1731 |
// CMPFileDetailsDialog::SetFileDetailL |
|
1732 |
// ----------------------------------------------------------------------------- |
|
1733 |
// |
|
1734 |
void CMPFileDetailsDialog::SetFileDetailL( HBufC*& aBuf, const TDesC& aDetail ) |
|
1735 |
{ |
|
1736 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::SetFileDetailL()")); |
|
1737 |
||
1738 |
if( !aBuf && aDetail.Length() ) |
|
1739 |
{ |
|
1740 |
aBuf = aDetail.AllocL(); |
|
1741 |
} |
|
1742 |
} |
|
1743 |
||
1744 |
// ----------------------------------------------------------------------------- |
|
1745 |
// CMPFileDetailsDialog::SetFileDetailL |
|
1746 |
// ----------------------------------------------------------------------------- |
|
1747 |
// |
|
1748 |
void CMPFileDetailsDialog::SetFileDetailL( HBufC*& aBuf, const TDesC8& aDetail ) |
|
1749 |
{ |
|
1750 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::SetFileDetailL()")); |
|
1751 |
||
1752 |
if( !aBuf && aDetail.Length()) |
|
1753 |
{ |
|
70
375929f879c2
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
1754 |
aBuf = HBufC::New( aDetail.Length() ); |
57 | 1755 |
aBuf->Des().Copy( aDetail ); |
1756 |
} |
|
1757 |
} |
|
1758 |
||
1759 |
// CMPFileDetailsDialog::Close |
|
1760 |
// ----------------------------------------------------------------------------- |
|
1761 |
// |
|
1762 |
EXPORT_C void CMPFileDetailsDialog::Close() |
|
1763 |
{ |
|
1764 |
MPX_ENTER_EXIT(_L("CMPFileDetailsDialog::Close()")); |
|
1765 |
||
1766 |
if ( iPopupList ) |
|
1767 |
{ |
|
1768 |
iPopupList->CancelPopup(); |
|
1769 |
} |
|
1770 |
} |
|
1771 |
||
1772 |
// ============================ CMPDummyController ============================ |
|
1773 |
||
1774 |
// ----------------------------------------------------------------------------- |
|
1775 |
// CMPDummyController::CMPDummyController |
|
1776 |
// C++ default constructor can NOT contain any code, that |
|
1777 |
// might leave. |
|
1778 |
// ----------------------------------------------------------------------------- |
|
1779 |
// |
|
1780 |
CMPDummyController::CMPDummyController() |
|
1781 |
{ |
|
1782 |
MPX_ENTER_EXIT(_L("CMPDummyController::CMPDummyController()")); |
|
1783 |
} |
|
1784 |
||
1785 |
// ----------------------------------------------------------------------------- |
|
1786 |
// CMPFileDetailsDialog::ConstructL |
|
1787 |
// Symbian 2nd phase constructor can leave. |
|
1788 |
// ----------------------------------------------------------------------------- |
|
1789 |
// |
|
1790 |
void CMPDummyController::ConstructL() |
|
1791 |
{ |
|
1792 |
MPX_ENTER_EXIT(_L("CMPDummyController::ConstructL()")); |
|
1793 |
||
1794 |
CreateWindowL(); |
|
1795 |
SetExtent(TPoint(), TSize()); |
|
1796 |
ActivateL(); |
|
1797 |
SetPointerCapture(ETrue); |
|
1798 |
ClaimPointerGrab(ETrue); |
|
1799 |
} |
|
1800 |
||
1801 |
// ----------------------------------------------------------------------------- |
|
1802 |
// CMPDummyController::NewLC() |
|
1803 |
// Two-phased constructor. |
|
1804 |
// ----------------------------------------------------------------------------- |
|
1805 |
// |
|
1806 |
CMPDummyController* CMPDummyController::NewLC() |
|
1807 |
{ |
|
1808 |
MPX_ENTER_EXIT(_L("CMPDummyController::NewLC()")); |
|
1809 |
||
1810 |
CMPDummyController* self= new (ELeave) CMPDummyController(); |
|
1811 |
CleanupStack::PushL(self); |
|
1812 |
self->ConstructL(); |
|
1813 |
return self; |
|
1814 |
} |
|
1815 |
||
1816 |
// ----------------------------------------------------------------------------- |
|
1817 |
// CMPDummyController::~CMPDummyController |
|
1818 |
// Destructor |
|
1819 |
// ----------------------------------------------------------------------------- |
|
1820 |
// |
|
1821 |
CMPDummyController::~CMPDummyController() |
|
1822 |
{ |
|
1823 |
MPX_ENTER_EXIT(_L("CMPDummyController::~CMPDummyController()")); |
|
1824 |
||
1825 |
if (iCoeEnv && iEikonEnv->EikAppUi()) |
|
1826 |
iEikonEnv->EikAppUi()->RemoveFromStack(this); |
|
1827 |
} |
|
1828 |
||
1829 |
// ----------------------------------------------------------------------------- |
|
1830 |
// CMPDummyController::OfferKeyEventL |
|
1831 |
// Absorbs all the key presses |
|
1832 |
// ----------------------------------------------------------------------------- |
|
1833 |
// |
|
1834 |
TKeyResponse CMPDummyController::OfferKeyEventL( |
|
1835 |
const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ ) |
|
1836 |
{ |
|
1837 |
MPX_ENTER_EXIT(_L("CMPDummyController::OfferKeyEventL()")); |
|
1838 |
return EKeyWasConsumed; |
|
1839 |
} |
|
1840 |
||
1841 |
// End of File |