54 #include <ProfileEngineDomainConstants.h> |
54 #include <ProfileEngineDomainConstants.h> |
55 #include <clock.rsg> |
55 #include <clock.rsg> |
56 #include <AknGlobalNote.h> |
56 #include <AknGlobalNote.h> |
57 #include <featdiscovery.h> |
57 #include <featdiscovery.h> |
58 #include <ProfileEngineDomainCRKeys.h> |
58 #include <ProfileEngineDomainCRKeys.h> |
|
59 #include <mediafilelist.h> |
59 |
60 |
60 // User Includes |
61 // User Includes |
61 #include "clkuiclksrvmodel.h" |
62 #include "clkuiclksrvmodel.h" |
62 #include "clkuialarmmodel.h" |
63 #include "clkuialarmmodel.h" |
63 #include "clkdatetimeviewcontainer.h" |
64 #include "clkdatetimeviewcontainer.h" |
2435 void CClkDateTimeView::HandleClockAlarmToneCmdL() |
2436 void CClkDateTimeView::HandleClockAlarmToneCmdL() |
2436 { |
2437 { |
2437 // Set the flag to indicate that the tone selection list is in use. |
2438 // Set the flag to indicate that the tone selection list is in use. |
2438 iExtension->SetAlarmToneListInUse( ETrue ); |
2439 iExtension->SetAlarmToneListInUse( ETrue ); |
2439 |
2440 |
2440 // Open the resource file. |
2441 CMediaFileList* list = CMediaFileList::NewL(); |
2441 RConeResourceLoader resourceLoader( *( CCoeEnv::Static() ) ); |
2442 CleanupStack::PushL( list ); |
2442 OpenFileListResourceLC( resourceLoader ); |
2443 |
2443 |
2444 TInt nullItem( KErrNotFound ); |
2444 // Launch filelist using your custom resource. |
2445 |
2445 CFLDFileListContainer* alarmToneList = CFLDFileListContainer::NewLC( R_FILELIST_MODEL_NOVIDEO ); |
2446 // default tone |
2446 |
2447 list->SetNullItemL( iDefaultToneTxt->Des(), iDefaultAlarmToneName, |
2447 // Populate the list with "Default" and "Off" strings. |
2448 CMediaFileList::EMediaFileTypeAudio, |
2448 alarmToneList->InsertNullItemL( iDefaultToneTxt->Des(), iDefaultAlarmToneName ); |
2449 CMediaFileList::ENullItemIconDefaultTone ); |
2449 alarmToneList->InsertEndNullItemL( iSoundOffTxt->Des(), iExtension->GetSilentToneStr()->Des() ); |
2450 |
2450 // Do not show videos. |
2451 // off |
2451 alarmToneList->AddExclusiveMediaTypeL( ECLFMediaTypeVideo ); |
2452 list->SetNullItemL( iSoundOffTxt->Des(), iExtension->GetSilentToneStr()->Des(), |
2452 alarmToneList->SetAutomatedType( CDRMHelper::EAutomatedTypeClockAlarm ); |
2453 CMediaFileList::EMediaFileTypeAudio, |
2453 // Do not show items over the file size limit, if configured. |
2454 CMediaFileList::ENullItemIconOff ); |
2454 if ( CFeatureDiscovery::IsFeatureSupportedL( |
2455 |
2455 KFeatureIdFfLimitedMessageAndAlarmToneSize ) ) |
2456 |
2456 { |
2457 list->SetAttrL( CMediaFileList::EAttrAutomatedType, CDRMHelper::EAutomatedTypeClockAlarm ); |
2457 // Max file size allowed (in KB). 0 == no limit. |
2458 list->SetAttrL( CMediaFileList::EAttrExcludeFolder, CMediaFileList::EMediaFileTypeVideo ); |
2458 TInt fileSizeLimit = 0; |
2459 |
2459 CRepository* profilesCenRep = CRepository::NewLC( KCRUidProfileEngine ); |
|
2460 |
|
2461 // Reading the repository should not fail, but if it does, the default |
|
2462 // value we have for the file size limit is acceptable. |
|
2463 profilesCenRep->Get( KProEngRingingToneMaxSize, fileSizeLimit ); // codescanner::crepository |
|
2464 CleanupStack::PopAndDestroy( profilesCenRep ); |
|
2465 |
|
2466 if ( fileSizeLimit > 0 ) |
|
2467 { |
|
2468 alarmToneList->SetMaxFileSize( fileSizeLimit * KKilo ); |
|
2469 } |
|
2470 } |
|
2471 // Launch the list. ETrue is returned if OK is pressed. EFalse otherwise. |
2460 // Launch the list. ETrue is returned if OK is pressed. EFalse otherwise. |
2472 if( alarmToneList->LaunchL( iAlarmToneName, *iToneListHeader ) ) |
2461 TBool ok( list->ShowMediaFileListL( &iAlarmToneName, &nullItem, NULL, NULL ) ); |
|
2462 |
|
2463 // Cleanup. |
|
2464 CleanupStack::PopAndDestroy( list ); |
|
2465 if( ok ) |
2473 { |
2466 { |
2474 // User has selected the tone and pressed OK. |
2467 // User has selected the tone and pressed OK. |
2475 // Holder for the old alarm tone. |
2468 // Holder for the old alarm tone. |
2476 TFileName oldAlarmTone; |
2469 TFileName oldAlarmTone; |
2477 |
2470 |
2487 UpdateListBoxL( EClkSettTone ); |
2480 UpdateListBoxL( EClkSettTone ); |
2488 |
2481 |
2489 // Cleanup. |
2482 // Cleanup. |
2490 CleanupStack::PopAndDestroy( cenRep ); |
2483 CleanupStack::PopAndDestroy( cenRep ); |
2491 } |
2484 } |
2492 // User pressed Cancel. |
2485 iExtension->SetAlarmToneListInUse( EFalse ); |
2493 iExtension->SetAlarmToneListInUse( EFalse ); |
|
2494 |
|
2495 // Cleanup. |
|
2496 CleanupStack::PopAndDestroy( alarmToneList ); |
|
2497 CleanupStack::PopAndDestroy( &resourceLoader ); |
|
2498 } |
2486 } |
2499 |
2487 |
2500 // --------------------------------------------------------- |
2488 // --------------------------------------------------------- |
2501 // CClkDateTimeView::HandleClockSnoozeTimeCmdL |
2489 // CClkDateTimeView::HandleClockSnoozeTimeCmdL |
2502 // rest of the details are commented in the header |
2490 // rest of the details are commented in the header |