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 "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 CFLDDRMImplementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // CLASS HEADER |
|
21 #include "CFLDDRMImplementation.h" |
|
22 |
|
23 // INTERNAL INCLUDES |
|
24 #include "CFLDRingingTonePlayer.h" |
|
25 #include "CFLDFileListModel.h" |
|
26 |
|
27 // EXTERNAL INCLUDES |
|
28 #include <aknnotewrappers.h> |
|
29 #include <StringLoader.h> |
|
30 #include <filelist.rsg> |
|
31 #include <MProfilesLocalFeatures.h> |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CFLDDRMImplementation::CFLDDRMImplementation |
|
37 // C++ default constructor can NOT contain any code, that might leave. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CFLDDRMImplementation::CFLDDRMImplementation( CFLDFileListModel* aModel ) |
|
41 : iModel( aModel ), |
|
42 iAutomatedType( CDRMHelper::EAutomatedTypeRingingTone ) |
|
43 { |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CFLDDRMImplementation::NewL |
|
48 // Two-phased constructor. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 CFLDDRMImplementation* CFLDDRMImplementation::NewL( CFLDFileListModel* aModel ) |
|
52 { |
|
53 CFLDDRMImplementation* self = new( ELeave ) CFLDDRMImplementation( aModel ); |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop( self ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CFLDDRMImplementation::ShowErrorNoteL |
|
62 // (other items were commented in a header). |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 void CFLDDRMImplementation::ShowErrorNoteL( TInt aResourceId ) const |
|
66 { |
|
67 HBufC* errorText = StringLoader::LoadLC( aResourceId ); |
|
68 CAknInformationNote* note = new( ELeave ) CAknInformationNote( EFalse ); |
|
69 |
|
70 note->ExecuteLD( *errorText ); |
|
71 |
|
72 // errorText |
|
73 CleanupStack::PopAndDestroy( errorText ); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CFLDDRMImplementation::IsFileValidUnprotectedL |
|
78 // (other items were commented in a header). |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 TBool CFLDDRMImplementation::IsFileValidUnprotectedL( |
|
82 const TDesC& aFileName, TIntention aIntention ) const |
|
83 { |
|
84 TBuf<KMaxDataTypeLength> tempDataType( DataTypeL( aFileName ).Des() ); |
|
85 |
|
86 if( iProfilesFeatures->IsBlockedType( tempDataType ) ) |
|
87 { |
|
88 if( aIntention == ESelect ) |
|
89 { |
|
90 ShowErrorNoteL( R_FLD_QTN_TEXT_NOT_ALLOWED ); |
|
91 } |
|
92 return EFalse; |
|
93 } |
|
94 |
|
95 // Operator requirement. Check if DRM is required with tones. |
|
96 if( aIntention == EPlay ) |
|
97 { |
|
98 if( iProfilesFeatures->IsBlockedDemoPlayType( tempDataType ) ) |
|
99 { |
|
100 return EFalse; |
|
101 } |
|
102 } |
|
103 else |
|
104 { |
|
105 if( iProfilesFeatures->IsBlockedUnprotectedType( tempDataType ) ) |
|
106 { |
|
107 ShowErrorNoteL( R_FLD_QTN_PROFILES_INFO_TONE_NO_DRM ); |
|
108 return EFalse; |
|
109 } |
|
110 } |
|
111 |
|
112 return ETrue; |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CFLDDRMImplementation::DataTypeL |
|
117 // (other items were commented in a header). |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 TDataType CFLDDRMImplementation::DataTypeL( |
|
121 const TDesC& aFileName ) const |
|
122 { |
|
123 RApaLsSession apaLsSession; |
|
124 User::LeaveIfError( apaLsSession.Connect() ); |
|
125 CleanupClosePushL( apaLsSession ); |
|
126 |
|
127 TUid dummyUid = { 0 }; // instantiate as zero |
|
128 TDataType dataType( dummyUid ); |
|
129 User::LeaveIfError( |
|
130 apaLsSession.AppForDocument( aFileName, dummyUid, dataType ) ); |
|
131 |
|
132 CleanupStack::PopAndDestroy(); // apaLsSession.Close() |
|
133 return dataType; |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CFLDDRMImplementation::MediaFileType |
|
138 // (other items were commented in a header). |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 TInt32 CFLDDRMImplementation::MediaFileType( const TDesC& aFileName ) const |
|
142 { |
|
143 return iModel->MediaFileType( aFileName ); |
|
144 } |
|
145 |
|
146 // End of File |
|