|
1 /* |
|
2 * Copyright (c) 2008 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: 'Set Assigntone' component for retrieving ringtone. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <evtmgmteditorui.rsg> |
|
19 #include <StringLoader.h> |
|
20 #include <CFLDFileListContainer.h> // Audio File List |
|
21 #include <DRMHelper.h> // DRM |
|
22 #include <eikenv.h> |
|
23 #include <aknlistquerydialog.h> |
|
24 #include <pathinfo.h> |
|
25 #include <driveinfo.h> |
|
26 #include <f32file.h> |
|
27 #include <NewFileServiceClient.h> // Voice Recorder |
|
28 #include <AiwGenericParam.h> |
|
29 #include <AknIconArray.h> // Icon Array |
|
30 #include <evteditor.mbg> |
|
31 #include <avkon.mbg> |
|
32 #include <AknsUtils.h> |
|
33 #include <AknsSkinInstance.h> |
|
34 #include <data_caging_path_literals.hrh> |
|
35 #include <gulicon.h> // Gul Icon |
|
36 #include <eikapp.h> |
|
37 #include <eikappui.h> |
|
38 #include <CalendarDomainCRKeys.h> |
|
39 #include <centralrepository.h> |
|
40 #include <AknUtils.h> |
|
41 #include <collate.h> |
|
42 |
|
43 #include "evtmgmteditorui.hrh" |
|
44 #include "evtmgmtuiringtonecomponent.h" |
|
45 #include "evtdebug.h" |
|
46 #include "evteditorconsts.h" |
|
47 |
|
48 const TInt KSetToneGranularity = 2; |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CEvtEditor ::NewL() |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CEvtMgmtUiRingtoneComponent* CEvtMgmtUiRingtoneComponent::NewL(const TPtrC aPrevRingtone) |
|
55 { |
|
56 CEvtMgmtUiRingtoneComponent * self = CEvtMgmtUiRingtoneComponent::NewLC(aPrevRingtone); |
|
57 CleanupStack::Pop(self); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CEvtEditor ::NewLC() |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CEvtMgmtUiRingtoneComponent* CEvtMgmtUiRingtoneComponent::NewLC(const TPtrC aPrevRingtone) |
|
66 { |
|
67 CEvtMgmtUiRingtoneComponent * self = new (ELeave) CEvtMgmtUiRingtoneComponent(); |
|
68 CleanupStack::PushL(self); |
|
69 self->ConstructL( aPrevRingtone ); |
|
70 return self; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CEvtMgmtUiDescComponent ::~CEvtMgmtUiDescComponent() |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CEvtMgmtUiRingtoneComponent::~CEvtMgmtUiRingtoneComponent() |
|
78 { |
|
79 delete iRingtone; |
|
80 iRingtone = NULL; |
|
81 |
|
82 if( iRecorderClient ) |
|
83 { |
|
84 delete iRecorderClient; |
|
85 iRecorderClient = NULL; |
|
86 } |
|
87 |
|
88 if( iSelectRingtoneDlg ) |
|
89 { |
|
90 delete iSelectRingtoneDlg; |
|
91 iSelectRingtoneDlg = NULL; |
|
92 } |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CEvtMgmtUiRingtoneComponent ::ConstructL() |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void CEvtMgmtUiRingtoneComponent ::ConstructL( const TPtrC aPrevRingtone ) |
|
100 { |
|
101 iRingtone = aPrevRingtone.AllocL(); |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CEvtMgmtUiRingtoneComponent ::CEvtMgmtUiRingtoneComponent() |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 CEvtMgmtUiRingtoneComponent::CEvtMgmtUiRingtoneComponent() |
|
109 { |
|
110 } |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CEvtMgmtUiRingtoneComponent::Ringtone() |
|
114 // It is used to retrieve the selected ringtone's absolute path. |
|
115 // @ret absolute path of the selected ringtone |
|
116 // ----------------------------------------------------------------------------- |
|
117 TPtrC CEvtMgmtUiRingtoneComponent::Ringtone() const |
|
118 { |
|
119 // if ringtone, returns ringtone else empty string |
|
120 if( iRingtone ) |
|
121 return *iRingtone; |
|
122 else |
|
123 return KNullDesC(); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CEvtMgmtUiRingtoneComponent::DefaultRingtoneL() |
|
128 // It is used to retrieve the path of the Default Tone. |
|
129 // @ret absolute path of the default ringtone |
|
130 // ----------------------------------------------------------------------------- |
|
131 TPtrC CEvtMgmtUiRingtoneComponent::DefaultRingtoneL() |
|
132 { |
|
133 TFileName toneFileName; |
|
134 CRepository* centralRepository = CRepository::NewLC(KCRUidCalendar); |
|
135 User::LeaveIfError(centralRepository->Get(KCalendarSoundFile, toneFileName)); |
|
136 CleanupStack::PopAndDestroy(centralRepository); |
|
137 if( iRingtone ) |
|
138 { |
|
139 delete iRingtone; |
|
140 iRingtone = NULL; |
|
141 } |
|
142 iRingtone = toneFileName.AllocL(); |
|
143 |
|
144 // if ringtone, returns ringtone else empty string |
|
145 if( iRingtone ) |
|
146 return *iRingtone; |
|
147 else |
|
148 return KNullDesC(); |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // CEvtMgmtUiRingtoneComponent::DisplayAudioPopupDlgL() |
|
153 // It is used to display 'Set tone' popup dialog and to retrieve ringtone. |
|
154 // @ret error if there is any error |
|
155 // KErrNone if it is successful |
|
156 // ----------------------------------------------------------------------------- |
|
157 TInt CEvtMgmtUiRingtoneComponent::DisplayAudioTonePopupDlgL() |
|
158 { |
|
159 TInt response = KErrNone; |
|
160 |
|
161 //display 'set tone' popup dialog |
|
162 TInt index = DisplayPopupDlgL(); |
|
163 |
|
164 switch(index) |
|
165 { |
|
166 case EEvtMgmtUiAssignedToneTone: // if 'select from exising' is selected |
|
167 { |
|
168 response = DisplayRingtoneSelectionDlgL(); |
|
169 break; |
|
170 } |
|
171 case EvtMgmtUiAssignedToneRecordNew: //if 'record new' is selected |
|
172 { |
|
173 response = RecordNewToneL(); |
|
174 break; |
|
175 } |
|
176 default: |
|
177 { |
|
178 response = KErrCancel; |
|
179 Debug(_L("DisplayAudioTonePopupDlgL panic")); |
|
180 break; |
|
181 } |
|
182 } |
|
183 return response; |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CEvtMgmtUiRingtoneComponent::DisplayRingtoneSelectionDlgL() |
|
188 // t is used display system's 'select tone' dialog. |
|
189 // @ret error while displaying 'select tone' dialog and |
|
190 // retrieving ringtone from it. |
|
191 // KErrNone if it is successful |
|
192 // ----------------------------------------------------------------------------- |
|
193 TInt CEvtMgmtUiRingtoneComponent::DisplayRingtoneSelectionDlgL() |
|
194 { |
|
195 TInt response = KErrNone; |
|
196 |
|
197 // Create instance of FileList using new FileList API |
|
198 if(!iSelectRingtoneDlg) |
|
199 iSelectRingtoneDlg = CFLDFileListContainer::NewL(); |
|
200 |
|
201 iSelectRingtoneDlg->SetAutomatedType( CDRMHelper::EAutomatedTypeRingingTone ); |
|
202 |
|
203 // Do not show videos, use new FileList API |
|
204 iSelectRingtoneDlg->AddExclusiveMediaTypeL( ECLFMediaTypeVideo ); |
|
205 |
|
206 HBufC* strOff = StringLoader::LoadLC( R_EVTUI_RINGTONESELECT_OFF ); |
|
207 |
|
208 iSelectRingtoneDlg->InsertEndNullItemL( *strOff ); |
|
209 TFileName ringtone( *iRingtone ); |
|
210 |
|
211 //launch selection dialog |
|
212 if( iSelectRingtoneDlg->LaunchL( ringtone ) ) //if ringtone is selected |
|
213 { |
|
214 delete iRingtone; |
|
215 iRingtone = NULL; |
|
216 iRingtone = ringtone.AllocL(); |
|
217 } |
|
218 else // if dialog is cancelled |
|
219 response = KErrCancel; |
|
220 |
|
221 CleanupStack::PopAndDestroy(1 ); // strOff |
|
222 delete iSelectRingtoneDlg; |
|
223 iSelectRingtoneDlg = NULL; |
|
224 |
|
225 //return error code |
|
226 return response; |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // CEvtMgmtUiRingtoneComponent::DisplayPopupDlgL() |
|
231 // It is used to display generic popup dialog. |
|
232 // @ret index of item selected if OK is pressed |
|
233 // KErrCancel if Cancel is pressed |
|
234 // ----------------------------------------------------------------------------- |
|
235 TInt CEvtMgmtUiRingtoneComponent::DisplayPopupDlgL() |
|
236 { |
|
237 TInt index = 0; |
|
238 const TInt KToneIconIndex = 0; |
|
239 const TInt KRecordNewIconIndex = 1; |
|
240 const TInt KIconTextLength = 1; |
|
241 const TInt KAssignToneGranularity =2; |
|
242 _LIT(KTab, "\t"); |
|
243 HBufC* dummy = NULL; |
|
244 |
|
245 //title text |
|
246 HBufC* title = StringLoader::LoadLC( R_EVTUI_CREATENEW_FORM_ASSIGNTONEPOPUP_TITLE ); |
|
247 |
|
248 //Tone |
|
249 dummy = StringLoader::LoadLC(R_EVTUI_CREATENEW_FORM_ASSIGNTONEPOPUPOPTIONS_TONE); |
|
250 HBufC* tone = HBufC::NewL( KIconTextLength + KTab().Length() + |
|
251 dummy->Length() + KTab().Length( )+ KTab().Length() ); |
|
252 TPtr ptrDummy = tone->Des(); |
|
253 ptrDummy.Num(KToneIconIndex); |
|
254 ptrDummy.Append(KTab); |
|
255 ptrDummy.Append(*dummy); |
|
256 ptrDummy.Append(KTab); |
|
257 ptrDummy.Append(KTab); |
|
258 CleanupStack::PopAndDestroy(dummy); |
|
259 CleanupStack::PushL(tone); |
|
260 |
|
261 // Record new |
|
262 dummy = StringLoader::LoadLC(R_EVTUI_CREATENEW_FORM_ASSIGNTONEPOPUPOPTIONS_RECORDNEW); |
|
263 HBufC* recordNew = HBufC::NewL( KIconTextLength + KTab().Length() + |
|
264 dummy->Length() + KTab().Length( )+ KTab().Length() ); |
|
265 ptrDummy.Set( recordNew->Des() ); |
|
266 ptrDummy.Num(KRecordNewIconIndex); |
|
267 ptrDummy.Append(KTab); |
|
268 ptrDummy.Append(*dummy); |
|
269 ptrDummy.Append(KTab); |
|
270 ptrDummy.Append(KTab); |
|
271 CleanupStack::PopAndDestroy(dummy); |
|
272 CleanupStack::PushL(recordNew); |
|
273 |
|
274 //array |
|
275 CDesCArrayFlat* array = new(ELeave)CDesCArrayFlat( KAssignToneGranularity ); |
|
276 CleanupStack::PushL(array); |
|
277 array->AppendL(*tone); |
|
278 array->AppendL(*recordNew); |
|
279 |
|
280 //launch dialog |
|
281 CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &index ); |
|
282 dlg->PrepareLC( R_EVTMGMTUI_LIST_QUERY ); |
|
283 UpdateIconsL( *dlg ); |
|
284 dlg->SetItemTextArray( array ); |
|
285 dlg->SetOwnershipType( ELbmOwnsItemArray ); |
|
286 dlg->QueryHeading()->SetTextL( *title ); |
|
287 if ( !dlg->RunLD() ) // if dialog is cancelled |
|
288 index = KErrCancel; |
|
289 |
|
290 CleanupStack::Pop(array); //ownership was transferred to dialog |
|
291 |
|
292 CleanupStack::PopAndDestroy( 3 ); //recordNew, tone, title |
|
293 return index; |
|
294 } |
|
295 |
|
296 // ----------------------------------------------------------------------------- |
|
297 // CEvtMgmtUiRingtoneComponent::RecordNewToneL() |
|
298 // It is used to record new ringtone. |
|
299 // @ret KErrNone if recording is succesful. |
|
300 // error code if it is failed. |
|
301 // ----------------------------------------------------------------------------- |
|
302 TInt CEvtMgmtUiRingtoneComponent::RecordNewToneL() |
|
303 { |
|
304 TInt err = KErrNone; |
|
305 |
|
306 TFileName fileName; |
|
307 err = FileNameForRecordingL( fileName ); |
|
308 if(err!=KErrNone) |
|
309 { |
|
310 Debug( _L("Error while generating filename for recording =%d"), err ); |
|
311 return err; |
|
312 } |
|
313 |
|
314 Debug( _L("Recording filename = ") ); |
|
315 Debug( fileName ); |
|
316 |
|
317 RFs fs; |
|
318 User::LeaveIfError( fs.Connect() ); |
|
319 CleanupClosePushL(fs); |
|
320 fs.ShareProtected(); // The file server session must be in this mode |
|
321 |
|
322 |
|
323 // Record Audio Clip |
|
324 if(!iRecorderClient) |
|
325 iRecorderClient = NewFileServiceFactory::NewClientL(); |
|
326 |
|
327 //create empty audio file |
|
328 RFile file; |
|
329 file.Replace( fs, fileName, EFileShareAny|EFileWrite ); |
|
330 CleanupClosePushL(file); |
|
331 |
|
332 |
|
333 // launch recorder application to record tone. |
|
334 TBool response = EFalse; |
|
335 CAiwGenericParamList* params = CAiwGenericParamList::NewLC(); |
|
336 TAiwVariant variant; |
|
337 variant.Set( _L("file" ) ); |
|
338 TAiwGenericParam param( EGenericParamURL, variant ); |
|
339 params->AppendL( param ); |
|
340 TRAP(err, response = iRecorderClient->NewFileL( file, params, ENewFileServiceAudio ) ); |
|
341 Debug( _L( "Error while recording =%d, response =%d" ), err, response ); |
|
342 CleanupStack::PopAndDestroy( 2 ); // params, file |
|
343 delete iRecorderClient; |
|
344 iRecorderClient = NULL; |
|
345 //if recording is successful, set ringtone. |
|
346 if( response && err == KErrNone) |
|
347 { |
|
348 delete iRingtone; |
|
349 iRingtone = NULL; |
|
350 iRingtone = fileName.AllocL(); |
|
351 } |
|
352 |
|
353 //if recording is cancelled, set err to KErrCancel |
|
354 if( !response ) |
|
355 err = KErrCancel; |
|
356 |
|
357 //if there is error in recording or recording is cancelled, delete the file. |
|
358 if( err!=KErrNone ) |
|
359 fs.Delete( fileName ); |
|
360 |
|
361 CleanupStack::PopAndDestroy(); //fs |
|
362 |
|
363 return err; |
|
364 } |
|
365 |
|
366 // ----------------------------------------------------------------------------- |
|
367 // CEvtMgmtUiRingtoneComponent::RecordNewToneL() |
|
368 // It is used to generate filename for recording new file. |
|
369 // @param[out] aFileName - it will contain generated file-name |
|
370 // @ret KErrNone if recording is succesful. |
|
371 // error code if it is failed. |
|
372 // ----------------------------------------------------------------------------- |
|
373 TInt CEvtMgmtUiRingtoneComponent:: FileNameForRecordingL( TDes& aFileName ) |
|
374 { |
|
375 PathInfo::GetFullPath(aFileName, EDriveC, PathInfo::ESoundsPath ); |
|
376 |
|
377 HBufC* recStr = StringLoader::LoadLC( R_LOCEV_LIST_VOREC_CLIP_NAME ); |
|
378 |
|
379 //Open sound directory |
|
380 RDir directory; |
|
381 TInt err = directory.Open(CEikonEnv::Static()->FsSession(), aFileName, KEntryAttNormal); |
|
382 if( err!=KErrNone ) |
|
383 { |
|
384 return err; |
|
385 } |
|
386 CleanupClosePushL(directory); |
|
387 |
|
388 //Retrieve files from directory |
|
389 TEntryArray fileList; |
|
390 err = directory.Read(fileList); |
|
391 |
|
392 TInt maxValue = 0; |
|
393 |
|
394 if ( err == KErrNone || err == KErrEof ) |
|
395 { |
|
396 err = KErrNone; |
|
397 //Check folder's files and find last recent audio file |
|
398 for (TInt i = 0; i < fileList.Count(); ++i) |
|
399 { |
|
400 TEntry fileEntry = fileList[i]; |
|
401 |
|
402 TCollationMethod cm = *Mem::CollationMethodByIndex( 0 ); // default collation method |
|
403 cm.iFlags |= TCollationMethod::EIgnoreNone; |
|
404 |
|
405 //Check that file is valid audiofile |
|
406 if (!fileEntry.IsReadOnly() && |
|
407 !fileEntry.IsHidden() && |
|
408 !fileEntry.IsSystem() && |
|
409 !fileEntry.IsDir() && |
|
410 TDesC::EIsPrefix == fileEntry.iName.HasPrefixC(*recStr, 0, &cm) && |
|
411 fileEntry.iName.Find(*recStr) != KErrNotFound) |
|
412 { |
|
413 //Find out running number |
|
414 TParse parser; |
|
415 parser.Set( fileEntry.iName, NULL, NULL ); |
|
416 TFileName fileName = parser.Name(); |
|
417 fileName.Delete(0,recStr->Length()); |
|
418 fileName.Trim(); |
|
419 |
|
420 //Convert digits from any digit format to european digit format. |
|
421 AknTextUtils::ConvertDigitsTo( fileName, EDigitTypeWestern ); |
|
422 |
|
423 TInt multiplier = 1; |
|
424 TInt count = 0; |
|
425 for (TInt i = fileName.Length() - 1; i != -1; --i) |
|
426 { |
|
427 TChar numberchar = fileName[i]; |
|
428 //Check if the character is digit |
|
429 if( numberchar.IsDigit() ) |
|
430 { |
|
431 TInt number = numberchar.GetNumericValue(); |
|
432 |
|
433 count += number * multiplier; |
|
434 multiplier = multiplier * 10; |
|
435 } |
|
436 else |
|
437 { |
|
438 break; |
|
439 } |
|
440 } |
|
441 |
|
442 //Save current number of audio files |
|
443 if (count > maxValue) |
|
444 { |
|
445 maxValue = count; |
|
446 } |
|
447 } |
|
448 } |
|
449 } |
|
450 |
|
451 //Create a text containing the count to localize |
|
452 TFileName num; |
|
453 num.Zero(); |
|
454 num.AppendNum(maxValue+1); |
|
455 |
|
456 //Converts between arabic-indic digits and european digits |
|
457 //based on existing language setting. |
|
458 AknTextUtils::LanguageSpecificNumberConversion( num ); |
|
459 |
|
460 //set recording filename |
|
461 aFileName.Append(*recStr); |
|
462 aFileName.Append(num); |
|
463 aFileName.Append(KRecorderFileEnd); |
|
464 |
|
465 CleanupStack::PopAndDestroy(2); // dir, recStr |
|
466 |
|
467 return err; |
|
468 } |
|
469 |
|
470 // ----------------------------------------------------------------------------- |
|
471 // CEvtMgmtUiRingtoneComponent::UpdateIconsL |
|
472 // It update icons |
|
473 // ----------------------------------------------------------------------------- |
|
474 void CEvtMgmtUiRingtoneComponent::UpdateIconsL( CAknListQueryDialog& aDialog ) |
|
475 { |
|
476 Debug(_L("start CEvtMgmtUiPlaceComponent::UpdateIconsL()")); |
|
477 |
|
478 CAknIconArray* icons = new( ELeave ) CAknIconArray( KSetToneGranularity ); |
|
479 CleanupStack::PushL( icons ); |
|
480 |
|
481 TFileName *iconFile = IconFileNameLC(); |
|
482 |
|
483 AddIconL( *icons, |
|
484 *iconFile, |
|
485 KAknsIIDQgnPropFmgrFileSound, |
|
486 EMbmEvteditorQgn_prop_fmgr_file_sound, EMbmEvteditorQgn_prop_fmgr_file_sound_mask); |
|
487 |
|
488 AddIconL( *icons, |
|
489 *iconFile, |
|
490 KAknsIIDQgnPropFmgrFileVoicerec, |
|
491 EMbmEvteditorQgn_prop_fmgr_file_voicerec, EMbmEvteditorQgn_prop_fmgr_file_voicerec_mask); |
|
492 |
|
493 CleanupStack::PopAndDestroy(iconFile); |
|
494 |
|
495 //set new icons to array |
|
496 aDialog.SetIconArrayL( icons ); |
|
497 CleanupStack::Pop(icons); |
|
498 |
|
499 Debug(_L("end CEvtMgmtUiPlaceComponent::UpdateIconsL()")); |
|
500 |
|
501 } |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // CEvtMgmtUiRingtoneComponent::AddIconL |
|
505 // Append icon to icon array. CAknIconArray owns icons so it is |
|
506 // easier to it leave safely. |
|
507 // @param aIcons icon array |
|
508 // @param aIconFileWithPath icon file name with path |
|
509 // @param aSkinID skin id of the icon |
|
510 // @param aIconGraphicsIndex picture index |
|
511 // @param aIconGraphicsMaskIndex mask index |
|
512 // ----------------------------------------------------------------------------- |
|
513 void CEvtMgmtUiRingtoneComponent::AddIconL( CAknIconArray& aIcons, |
|
514 const TDesC& aIconFileWithPath, |
|
515 TAknsItemID aSkinID, |
|
516 TInt aIconGraphicsIndex, |
|
517 TInt aIconGraphicsMaskIndex ) |
|
518 { |
|
519 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
520 |
|
521 EVTUIDEBUG( "AknsUtils::SkinInstance" ); |
|
522 |
|
523 CFbsBitmap* bitmap = NULL; |
|
524 CFbsBitmap* bitmapMask = NULL; |
|
525 TRAPD( err, AknsUtils::CreateIconL( skin, |
|
526 aSkinID, |
|
527 bitmap, |
|
528 bitmapMask, |
|
529 aIconFileWithPath, |
|
530 aIconGraphicsIndex, |
|
531 aIconGraphicsMaskIndex ) ); |
|
532 |
|
533 |
|
534 EVTUIDEBUG1( "AknsUtils::CreateIconL - %d", err ); |
|
535 if(err != KErrNone) |
|
536 { |
|
537 TRAP( err, AknIconUtils::CreateIconL( bitmap, |
|
538 bitmapMask, |
|
539 aIconFileWithPath, |
|
540 aIconGraphicsIndex, |
|
541 aIconGraphicsMaskIndex ) ); |
|
542 EVTUIDEBUG1( "AknIconUtils::CreateIconL - %d", err ); |
|
543 } |
|
544 User::LeaveIfError( err ); |
|
545 |
|
546 CleanupStack::PushL( bitmap ); |
|
547 CleanupStack::PushL( bitmapMask ); |
|
548 |
|
549 CGulIcon* icon = CGulIcon::NewL( bitmap, bitmapMask ); |
|
550 |
|
551 // Remove the Bitmap and the Bitmap Icon from the Clean up stack since |
|
552 // the ownership is taken over by the icon |
|
553 CleanupStack::Pop( bitmapMask ); |
|
554 CleanupStack::Pop( bitmap ); |
|
555 |
|
556 CleanupStack::PushL( icon ); |
|
557 aIcons.AppendL( icon ); |
|
558 CleanupStack::Pop( icon ); // icon |
|
559 } |
|
560 |
|
561 // ----------------------------------------------------------------------------- |
|
562 // CEvtMgmtUiRingtoneComponent::IconFileNameLC |
|
563 // Gets Events Management UI icon file path and name. Ownership |
|
564 // is transferred, item is left in the cleanup stack. |
|
565 // @return TFileName* The full name of the Events UI icon file. |
|
566 // ----------------------------------------------------------------------------- |
|
567 TFileName* CEvtMgmtUiRingtoneComponent::IconFileNameLC() const |
|
568 { |
|
569 TFileName* fileName = new(ELeave) TFileName; |
|
570 CleanupStack::PushL( fileName ); |
|
571 |
|
572 TFileName* tmpName = new(ELeave) TFileName; |
|
573 CleanupStack::PushL( tmpName ); |
|
574 |
|
575 tmpName->Append( KDC_BITMAP_DIR ); |
|
576 tmpName->Append( KEvtMgmtUiIconFileName ); |
|
577 |
|
578 CEikAppUi *appUi = ( CEikAppUi *)( CEikonEnv::Static()->AppUi()); |
|
579 TFileName appDrive = appUi->Application()->AppFullName(); |
|
580 |
|
581 TParse parse; |
|
582 User::LeaveIfError( parse.Set( appDrive, NULL, NULL ) ); |
|
583 User::LeaveIfError( parse.Set( parse.Drive(), tmpName, NULL ) ); |
|
584 |
|
585 fileName->Copy(parse.FullName()); |
|
586 |
|
587 CleanupStack::PopAndDestroy( tmpName ); |
|
588 |
|
589 return fileName; |
|
590 } |
|
591 //end of file |