diff -r 6465d5bb863a -r 13e71d907dc3 profilesservices/ProfileEngine/EngSrc/CProfileEngineImpl.cpp --- a/profilesservices/ProfileEngine/EngSrc/CProfileEngineImpl.cpp Fri Jun 25 17:09:30 2010 +0800 +++ b/profilesservices/ProfileEngine/EngSrc/CProfileEngineImpl.cpp Thu Nov 04 13:38:47 2010 +0800 @@ -19,14 +19,6 @@ // INCLUDE FILES #include "CProfileEngineImpl.h" -#include "CProfilesNamesArrayImpl.h" -#include "CProfileImpl.h" -#include "CProfileNameImpl.h" -#include "ProfileEngUtils.h" -#include "ProfileEngPanic.h" -#include "CProfileTiming.h" -#include "ProfileEnginePrivateCRKeys.h" -#include "ProfilesDebug.h" #include // BaflUtils #include // RResoureFile #include @@ -34,30 +26,35 @@ #include #include -#include +#include #include #include +#include "CProfilesNamesArrayImpl.h" +#include "CProfileImpl.h" +#include "CProfileNameImpl.h" +#include "ProfileEngUtils.h" #include #include #include +#include "ProfileEngPanic.h" #include #include -#include -#include +#include "MProfileExtraSettings.h" +#include "MProfileFeedbackSettings.h" #include #include -#include // KProEngFeatureIdVTRingingTone +#include "ProfilesVariant.hrh" // KProEngFeatureIdVTRingingTone +#include "CProfileTiming.h" #include +#include "ProfileEnginePrivateCRKeys.h" #include #include #include +#include "ProfilesDebug.h" #include #include -#include -#include - // ============================ MEMBER FUNCTIONS =============================== @@ -240,8 +237,6 @@ MProfileExtended* CProfileEngineImpl::ProfileLC( TInt aId ) { - return Profile2LC( aId ); - /* CProfileImpl* profile = NULL; iMutex.Wait(); @@ -285,7 +280,6 @@ } return profile; - */ } // ----------------------------------------------------------------------------- @@ -297,12 +291,9 @@ MProfileExtended* CProfileEngineImpl::ProfileL( TInt aId ) { - return Profile2L( aId ); - /* MProfileExtended* profile = ProfileLC( aId ); CleanupStack::Pop(); // profile return profile; - */ } @@ -319,7 +310,6 @@ iMutex.Wait(); TInt err( CheckProfileIdL( aId ) ); - if( !err ) { TRAP( err, DoSetActiveProfileL( aId ) ); @@ -579,9 +569,7 @@ if( profileId == activeId ) { - MProfileExtended2 *activeProfile = Profile2LC(activeId); - UpdateActiveProfileSettingsL( *activeProfile ); - CleanupStack::PopAndDestroy(); // activeProfile + UpdateActiveProfileSettingsL( aProfile ); } // write settings to Cenrep: @@ -637,44 +625,22 @@ // (other items were commented in a header). // ----------------------------------------------------------------------------- // -void CProfileEngineImpl::UpdateActiveProfileSettingsL( MProfileExtended2& aProfile, +void CProfileEngineImpl::UpdateActiveProfileSettingsL( MProfile& aProfile, TBool aSetId ) { const MProfileTones& profileTones = aProfile.ProfileTones(); - const MProfileExtraTones2& profileExtraTones = aProfile.ProfileExtraTones2(); const MProfileName& profileName = aProfile.ProfileName(); const TProfileToneSettings& settings = profileTones.ToneSettings(); - // const MProfileVibraSettings &vibraSettings = aProfile.ProfileVibraSettings(); // These cannot fail because this method is called only in between // StartTransaction() and CommitTransaction() calls (except vibra) iCenRep->Set( KProEngActiveRingingType, settings.iRingingType ); - - //Removed. only master volue used - // iCenRep->Set( KProEngActiveRingingVolume, settings.iRingingVolume ); + iCenRep->Set( KProEngActiveRingingVolume, settings.iRingingVolume ); iCenRep->Set( KProEngActiveMessageAlert, !( aProfile.IsSilent() ) ); - - //Since 10.1 - iCenRep->Set( KProEngActiveRingTone,profileTones.RingingTone1() ); - iCenRep->Set( KProEngActiveMessageTone,profileTones.MessageAlertTone() ); - iCenRep->Set( KProEngActiveReminderTone,profileExtraTones.ReminderTone() ); - iCenRep->Set( KProEngActiveClockAlarmTone,profileExtraTones.ClockAlarmTone() ); - - /* - if ( MasterVibraL() ) - { - iCenRep->Set( KProEngActiveAlertVibra,vibraSettings.AlertVibra() ); - } - else - { - iCenRep->Set( KProEngActiveAlertVibra,0 ); - } - */ - if ( !PowerSaveMode() ) { User::LeaveIfError( iVibraCenRep->Set( - KVibraCtrlProfileVibraEnabled, /*vibraSettings.AlertVibra() != 0 &&*/ MasterVibraL() ) ); + KVibraCtrlProfileVibraEnabled, settings.iVibratingAlert ) ); #ifdef RD_TACTILE_FEEDBACK const MProfileExtraSettings& extraSettings = aProfile.ProfileExtraSettings(); @@ -753,8 +719,7 @@ CleanupStack::Pop(); // nameImpl } - // Since 10.1, No dynamic profiles in TB 10.1 - // ReadDynamicProfilesNamesL( aProfilesNames, *profileName ); + ReadDynamicProfilesNamesL( aProfilesNames, *profileName ); CleanupStack::PopAndDestroy(); // profileName } @@ -767,7 +732,7 @@ void CProfileEngineImpl::DoSetActiveProfileL( TInt aId, TTime* aTime ) { - MProfileExtended2* profile = Profile2LC( aId ); + MProfileExtended* profile = ProfileLC( aId ); User::LeaveIfError( iCenRep->StartTransaction( CRepository::EReadWriteTransaction ) ); @@ -972,17 +937,6 @@ } // ----------------------------------------------------------------------------- -// CreateProfileEngineExtendedL create profiles engine and -// return internal interface of the profiles engine -// Returns: Profiles Engine internal interface -// ----------------------------------------------------------------------------- -// -EXPORT_C MProfileEngineExtended2* CreateProfileEngineExtended2L() - { - return CProfileEngineImpl::NewL(); - } - -// ----------------------------------------------------------------------------- // CreateProfileEngineL create profiles engine and return public interface // of the profiles engine. // Returns: Profiles Engine public interface @@ -1004,16 +958,6 @@ return CProfileEngineImpl::NewL( aFs ); } -// ----------------------------------------------------------------------------- -// CreateProfileEngineExtendedL create profiles engine and -// return internal interface of the profiles engine -// Returns: Profiles Engine internal interface -// ----------------------------------------------------------------------------- -// -EXPORT_C MProfileEngineExtended2* CreateProfileEngineExtended2L( RFs* aFs ) - { - return CProfileEngineImpl::NewL( aFs ); - } // ----------------------------------------------------------------------------- // CProfileEngineImpl::PowerSaveMode @@ -1068,183 +1012,4 @@ } - -// ----------------------------------------------------------------------------- -// CProfileEngineImpl::Profile2LC -// -// ----------------------------------------------------------------------------- -// -MProfileExtended2* CProfileEngineImpl::Profile2LC( TInt aId ) - { - CProfileImpl* profile = NULL; - - iMutex.Wait(); - TInt err( CheckProfileIdL( aId ) ); - - if( !err ) - { - TRAP( err, profile = GetProfileL( aId ) ); - } - iMutex.Signal(); - - User::LeaveIfError( err ); - - CleanupStack::PushL( profile ); - - if( iSideVolumeKeys ) - { - // Because SetTemp*VolumeL() functions update only Shared Data those - // values must be read from SD and set to the MProfile instance - // returned to the caller: - TInt activeId( User::LeaveIfError( ActiveProfileId() ) ); - if( activeId == aId ) - { - TProfileToneSettings& settings = - profile->ProfileSetTones().SetToneSettings(); - settings.iRingingVolume = TempRingingVolumeL(); - settings.iMediaVolume = TempMediaVolumeL(); - } - } - - if( !profile->IsProfileNameChanged() ) - { - if( IsDefaultProfile( aId ) ) - { - profile->SetLocalizedProfileNameL( *iProfileLocalisedNames ); - } - else - { - SetLocalizedNameForDynamicProfileL( *profile ); - } - } - - return profile; - } - -// ----------------------------------------------------------------------------- -// CProfileEngineImpl::Profile2L -// -// ----------------------------------------------------------------------------- -// -MProfileExtended2* CProfileEngineImpl::Profile2L( TInt aId ) - { - MProfileExtended2* profile = Profile2LC( aId ); - CleanupStack::Pop(); // profile - return profile; - } - -// ----------------------------------------------------------------------------- -// CProfileEngineImpl::CommitChange2L -// -// ----------------------------------------------------------------------------- -// -void CProfileEngineImpl::CommitChange2L( MProfileExtended2& aProfile ) - { - CommitChangeL (aProfile); - } - - -// ----------------------------------------------------------------------------- -// CProfileEngineImpl::MasterVolumeL -// -// ----------------------------------------------------------------------------- -// -TInt CProfileEngineImpl::MasterVolumeL() const - { - TInt masterVolume( 0 ); - User::LeaveIfError( iCenRep->Get( KProEngMasterVolume, masterVolume ) ); - return masterVolume; - } - -// ----------------------------------------------------------------------------- -// CProfileEngineImpl::SetMasterVolumeL -// -// ----------------------------------------------------------------------------- -// -void CProfileEngineImpl::SetMasterVolumeL( TInt aMasterVolume ) - { - User::LeaveIfError( iCenRep->Set( KProEngMasterVolume, aMasterVolume ) ); - User::LeaveIfError( iCenRep->Set( KProEngActiveRingingVolume, aMasterVolume ) ); - - //Send event through P&S - CreatePubSubKeysIfNeededL(); - PublishChangeL( KProEngActiveProfileModified ); - } - -// ----------------------------------------------------------------------------- -// CProfileEngineImpl::MasterVibraL -// -// ----------------------------------------------------------------------------- -// -TBool CProfileEngineImpl::MasterVibraL() const - { - TInt masterVibra( 0 ); - User::LeaveIfError( iCenRep->Get( KProEngMasterVibra, masterVibra ) ); - return ( masterVibra != 0 ); - } - -// ----------------------------------------------------------------------------- -// CProfileEngineImpl::SetMasterVibraL -// -// ----------------------------------------------------------------------------- -// -void CProfileEngineImpl::SetMasterVibraL( TBool aMasterVibra ) - { - User::LeaveIfError( iCenRep->Set( KProEngMasterVibra, aMasterVibra ? 1 : 0 ) ); - User::LeaveIfError ( iCenRep->Set( KProEngActiveAlertVibra, aMasterVibra ? 1 : 0 ) ); - - /* - MProfileExtended2* activeProfile = Profile2LC( ActiveProfileId() ); - const MProfileVibraSettings &vibraSettings = activeProfile->ProfileVibraSettings(); - if (activeProfile) - { - if (aMasterVibra) - { - iCenRep->Set( KProEngActiveAlertVibra,vibraSettings.AlertVibra() ); - } - else - { - iCenRep->Set( KProEngActiveAlertVibra, 0 ); - } - } - CleanupStack::PopAndDestroy(); // activeProfile - */ - - if ( !PowerSaveMode() ) - { - User::LeaveIfError( iVibraCenRep->Set( - KVibraCtrlProfileVibraEnabled, aMasterVibra ? 1 : 0) ); - } - - //Send event through P&S - CreatePubSubKeysIfNeededL(); - PublishChangeL( KProEngActiveProfileModified ); - } - -// ----------------------------------------------------------------------------- -// CProfileEngineImpl::SilenceModeL -// -// ----------------------------------------------------------------------------- -// -TBool CProfileEngineImpl::SilenceModeL() const - { - TInt silenceMode( 0 ); - User::LeaveIfError( iCenRep->Get( KProEngSilenceMode, silenceMode ) ); - return ( silenceMode != 0 ); - } - -// ----------------------------------------------------------------------------- -// CProfileEngineImpl::SetSilenceModeL -// -// ----------------------------------------------------------------------------- -// -void CProfileEngineImpl::SetSilenceModeL( TBool aSilenceMode ) - { - User::LeaveIfError( iCenRep->Set( KProEngSilenceMode, aSilenceMode ? 1 : 0 ) ); - - //Send event through P&S - CreatePubSubKeysIfNeededL(); - PublishChangeL( KProEngActiveProfileModified ); - } - // End of File