|
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 album art editor dialog implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <StringLoader.h> |
|
21 #include <MGFetch.h> |
|
22 #include <aknnotewrappers.h> |
|
23 |
|
24 #include <aknSDData.h> |
|
25 #include <AknMediatorFacade.h> |
|
26 #include "mplayersecondarydisplayapi.h" |
|
27 |
|
28 #include <mpxmedia.h> |
|
29 #include <mpxattribute.h> |
|
30 #include <mpxalbumarteditordialog.rsg> |
|
31 #include <mpxdrmmediautility.h> |
|
32 #include <mpxmediadrmdefs.h> |
|
33 #include <mpxlog.h> |
|
34 |
|
35 #include "mpxalbumarteditordialogimagethumbnailutil.h" |
|
36 |
|
37 // ============================ MEMBER FUNCTIONS =============================== |
|
38 |
|
39 // ---------------------------------------------------------------------------- |
|
40 // CMPXAlbumArtEditorDialogImageThumbnailUtil::NewL |
|
41 // Two-phased constructor. |
|
42 // ---------------------------------------------------------------------------- |
|
43 // |
|
44 CMPXAlbumArtEditorDialogImageThumbnailUtil* |
|
45 CMPXAlbumArtEditorDialogImageThumbnailUtil::NewL() |
|
46 { |
|
47 MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::NewL" ); |
|
48 CMPXAlbumArtEditorDialogImageThumbnailUtil* self = new ( ELeave ) |
|
49 CMPXAlbumArtEditorDialogImageThumbnailUtil(); |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL(); |
|
52 CleanupStack::Pop( self ); |
|
53 return self; |
|
54 } |
|
55 |
|
56 // ---------------------------------------------------------------------------- |
|
57 // CMPXAlbumArtEditorDialogImageThumbnailUtil::~CMPXAlbumArtEditorDialogImageThumbnailUtil |
|
58 // Destructor. |
|
59 // ---------------------------------------------------------------------------- |
|
60 // |
|
61 CMPXAlbumArtEditorDialogImageThumbnailUtil:: |
|
62 ~CMPXAlbumArtEditorDialogImageThumbnailUtil() |
|
63 { |
|
64 MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::~CMPXAlbumArtEditorDialogImageThumbnailUtil" ); |
|
65 } |
|
66 |
|
67 // ---------------------------------------------------------------------------- |
|
68 // CMPXAlbumArtEditorDialogImageThumbnailUtil::FetchThumbnailL |
|
69 // Fetch thumbnail from the device |
|
70 // ---------------------------------------------------------------------------- |
|
71 // |
|
72 TBool CMPXAlbumArtEditorDialogImageThumbnailUtil::FetchThumbnailL( |
|
73 CDesCArray& aFilesArray ) |
|
74 { |
|
75 MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::FetchThumbnailL" ); |
|
76 // fetch thumbnail from media gallery |
|
77 HBufC* title = StringLoader::LoadLC( R_MPX_CUI_ALBUM_ART_DLG_TITLE ); |
|
78 |
|
79 TBool res = MGFetch::RunL( aFilesArray, EImageFile, EFalse, |
|
80 KNullDesC, *title, this ); |
|
81 |
|
82 CleanupStack::PopAndDestroy( title ); |
|
83 return res; |
|
84 } |
|
85 |
|
86 // ---------------------------------------------------------------------------- |
|
87 // CMPXAlbumArtEditorDialogImageThumbnailUtil::CMPXAlbumArtEditorDialogImageThumbnailUtil |
|
88 // C++ default constructor can NOT contain any code, that |
|
89 // might leave. |
|
90 // ---------------------------------------------------------------------------- |
|
91 // |
|
92 CMPXAlbumArtEditorDialogImageThumbnailUtil:: |
|
93 CMPXAlbumArtEditorDialogImageThumbnailUtil() |
|
94 { |
|
95 } |
|
96 |
|
97 // ---------------------------------------------------------------------------- |
|
98 // CMPXAlbumArtEditorDialogImageThumbnailUtil::ConstructL |
|
99 // Symbian 2nd phase constructor can leave. |
|
100 // ---------------------------------------------------------------------------- |
|
101 // |
|
102 void CMPXAlbumArtEditorDialogImageThumbnailUtil::ConstructL() |
|
103 { |
|
104 MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::ConstructL" ); |
|
105 } |
|
106 |
|
107 // ---------------------------------------------------------------------------- |
|
108 // CMPXAlbumArtEditorDialogImageThumbnailUtil::VerifySelectionL |
|
109 // Verify thumbnail selection |
|
110 // ---------------------------------------------------------------------------- |
|
111 // |
|
112 TBool CMPXAlbumArtEditorDialogImageThumbnailUtil::VerifySelectionL( |
|
113 const MDesCArray* aSelectedFiles ) |
|
114 { |
|
115 MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::VerifySelectionL" ); |
|
116 TBool result = ETrue; |
|
117 |
|
118 if ( aSelectedFiles && aSelectedFiles->MdcaCount() > 0 ) |
|
119 { |
|
120 // DRM for phonebook thumbnail fetch |
|
121 TPtrC fileName = aSelectedFiles->MdcaPoint( 0 ); |
|
122 CMPXDrmMediaUtility* drmUtil = CMPXDrmMediaUtility::NewLC(); |
|
123 drmUtil->InitL( fileName ); |
|
124 |
|
125 const CMPXMedia* media = drmUtil->GetMediaL( EMPXMediaDrmProtected ); |
|
126 if ( media ) |
|
127 { |
|
128 if ( media->IsSupported( KMPXMediaDrmProtected ) ) |
|
129 { |
|
130 TBool isProtected( media->ValueTObjectL<TBool>( |
|
131 KMPXMediaDrmProtected ) ); |
|
132 if ( isProtected ) |
|
133 { |
|
134 // show user copyright note |
|
135 HBufC* prompt = StringLoader::LoadLC( R_MPX_QTN_MP_DRM_NOT_ALLOWED ); |
|
136 CAknInformationNote* dlg = new( ELeave ) CAknInformationNote( ETrue ); |
|
137 CleanupStack::PushL(dlg); |
|
138 dlg->PublishDialogL( EMPlayerNoteDrmNotAllowed, KMPlayerNoteCategory ); |
|
139 CleanupStack::Pop(dlg); |
|
140 dlg->ExecuteLD( *prompt ); |
|
141 CleanupStack::PopAndDestroy( prompt ); |
|
142 result = EFalse; |
|
143 } |
|
144 } |
|
145 } |
|
146 CleanupStack::PopAndDestroy( drmUtil ); |
|
147 } |
|
148 return result; |
|
149 } |
|
150 |
|
151 // End of File |