|
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 CProfileExtraTonesImpl. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CProfileExtraTonesImpl.h" |
|
22 #include "ProfilesVariant.hrh" |
|
23 #include <s32strm.h> |
|
24 #include <centralrepository.h> |
|
25 #include "ProfileEngUtils.h" |
|
26 #include "ProfileEnginePrivateCRKeys.h" |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CProfileExtraTonesImpl::ConstructL |
|
32 // Symbian 2nd phase constructor can leave. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 void CProfileExtraTonesImpl::ConstructL() |
|
36 { |
|
37 iIMMessageAlertTone = KNullDesC().AllocL(); |
|
38 iEmailAlertTone = KNullDesC().AllocL(); |
|
39 iVideoCallRingingTone = KNullDesC().AllocL(); |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CProfileExtraTonesImpl::ConstructL |
|
44 // Symbian 2nd phase constructor can leave. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 void CProfileExtraTonesImpl::ConstructL( |
|
48 const MProfileExtraTones& aProfileExtraTones ) |
|
49 { |
|
50 iIMMessageAlertTone = aProfileExtraTones.IMMessageAlertTone().AllocL(); |
|
51 iEmailAlertTone = aProfileExtraTones.EmailAlertTone().AllocL(); |
|
52 iVideoCallRingingTone = |
|
53 aProfileExtraTones.VideoCallRingingTone().AllocL(); |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CProfileExtraTonesImpl::NewL |
|
58 // Two-phased constructor. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CProfileExtraTonesImpl* CProfileExtraTonesImpl::NewL() |
|
62 { |
|
63 CProfileExtraTonesImpl* self = new( ELeave ) CProfileExtraTonesImpl; |
|
64 |
|
65 CleanupStack::PushL( self ); |
|
66 self->ConstructL(); |
|
67 CleanupStack::Pop(); |
|
68 |
|
69 return self; |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CProfileExtraTonesImpl::NewL |
|
74 // Two-phased constructor. |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 CProfileExtraTonesImpl* CProfileExtraTonesImpl::NewL( |
|
78 const MProfileExtraTones& aProfileExtraTones ) |
|
79 { |
|
80 CProfileExtraTonesImpl* self = new( ELeave ) CProfileExtraTonesImpl; |
|
81 |
|
82 CleanupStack::PushL( self ); |
|
83 self->ConstructL( aProfileExtraTones ); |
|
84 CleanupStack::Pop(); |
|
85 |
|
86 return self; |
|
87 } |
|
88 |
|
89 |
|
90 // Destructor |
|
91 CProfileExtraTonesImpl::~CProfileExtraTonesImpl() |
|
92 { |
|
93 delete iIMMessageAlertTone; |
|
94 delete iEmailAlertTone; |
|
95 delete iVideoCallRingingTone; |
|
96 } |
|
97 |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CProfileExtraTonesImpl::InternalizeL |
|
101 // |
|
102 // (other items were commented in a header). |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CProfileExtraTonesImpl::InternalizeL( CRepository& aCenRep, |
|
106 TInt aProfileId ) |
|
107 { |
|
108 delete iIMMessageAlertTone; |
|
109 iIMMessageAlertTone = NULL; |
|
110 |
|
111 TFileName toneFile; |
|
112 |
|
113 // IM Message alert tone |
|
114 User::LeaveIfError( |
|
115 aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngImTone, |
|
116 aProfileId ), toneFile ) ); |
|
117 iIMMessageAlertTone = toneFile.AllocL(); |
|
118 |
|
119 delete iEmailAlertTone; |
|
120 iEmailAlertTone = NULL; |
|
121 |
|
122 // E-mail alert tone |
|
123 User::LeaveIfError( |
|
124 aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngEmailTone, |
|
125 aProfileId ), toneFile ) ); |
|
126 iEmailAlertTone = toneFile.AllocL(); |
|
127 |
|
128 delete iVideoCallRingingTone; |
|
129 iVideoCallRingingTone = NULL; |
|
130 |
|
131 // Video call ringing tone |
|
132 User::LeaveIfError( |
|
133 aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngVideoCallTone, |
|
134 aProfileId ), toneFile ) ); |
|
135 iVideoCallRingingTone = toneFile.AllocL(); |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CProfileExtraTonesImpl::ExternalizeL |
|
140 // |
|
141 // (other items were commented in a header). |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 void CProfileExtraTonesImpl::ExternalizeL( CRepository& aCenRep, |
|
145 TInt aProfileId ) const |
|
146 { |
|
147 // IM Message Alert Tone |
|
148 User::LeaveIfError( |
|
149 aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngImTone, |
|
150 aProfileId ), *iIMMessageAlertTone ) ); |
|
151 |
|
152 // E-mail Alert Tone |
|
153 User::LeaveIfError( |
|
154 aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngEmailTone, |
|
155 aProfileId ), *iEmailAlertTone ) ); |
|
156 |
|
157 // Video call ringing tone |
|
158 User::LeaveIfError( |
|
159 aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngVideoCallTone, |
|
160 aProfileId ), *iVideoCallRingingTone ) ); |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // CProfileExtraTonesImpl::IMMessageAlertTone |
|
165 // |
|
166 // (other items were commented in a header). |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 const TDesC& CProfileExtraTonesImpl::IMMessageAlertTone() const |
|
170 { |
|
171 return *iIMMessageAlertTone; |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CProfileExtraTonesImpl::SetIMMessageAlertToneL |
|
176 // |
|
177 // (other items were commented in a header). |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 void CProfileExtraTonesImpl::SetIMMessageAlertToneL( |
|
181 const TDesC& aIMMessageAlertTone ) |
|
182 { |
|
183 HBufC* tmp = aIMMessageAlertTone.Left( KMaxFileName ).AllocL(); |
|
184 delete iIMMessageAlertTone; |
|
185 iIMMessageAlertTone = tmp; |
|
186 } |
|
187 |
|
188 // ----------------------------------------------------------------------------- |
|
189 // CProfileExtraTonesImpl::EmailAlertTone |
|
190 // |
|
191 // (other items were commented in a header). |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 const TDesC& CProfileExtraTonesImpl::EmailAlertTone() const |
|
195 { |
|
196 return *iEmailAlertTone; |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CProfileExtraTonesImpl::SetEmailAlertToneL |
|
201 // |
|
202 // (other items were commented in a header). |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 void CProfileExtraTonesImpl::SetEmailAlertToneL( |
|
206 const TDesC& aEmailAlertTone ) |
|
207 { |
|
208 HBufC* tmp = aEmailAlertTone.Left( KMaxFileName ).AllocL(); |
|
209 delete iEmailAlertTone; |
|
210 iEmailAlertTone = tmp; |
|
211 } |
|
212 |
|
213 // ----------------------------------------------------------------------------- |
|
214 // CProfileExtraTonesImpl::VideoCallRingingTone |
|
215 // |
|
216 // (other items were commented in a header). |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 const TDesC& CProfileExtraTonesImpl::VideoCallRingingTone() const |
|
220 { |
|
221 return *iVideoCallRingingTone; |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CProfileExtraTonesImpl::SetVideoCallRingingToneL |
|
226 // |
|
227 // (other items were commented in a header). |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 void CProfileExtraTonesImpl::SetVideoCallRingingToneL( |
|
231 const TDesC& aRingingTone ) |
|
232 { |
|
233 HBufC* tmp = aRingingTone.Left( KMaxFileName ).AllocL(); |
|
234 delete iVideoCallRingingTone; |
|
235 iVideoCallRingingTone = tmp; |
|
236 } |
|
237 |
|
238 // End of File |