17 |
17 |
18 |
18 |
19 |
19 |
20 // INCLUDE FILES |
20 // INCLUDE FILES |
21 #include "CProfileEngineImpl.h" |
21 #include "CProfileEngineImpl.h" |
|
22 #include "CProfilesNamesArrayImpl.h" |
|
23 #include "CProfileImpl.h" |
|
24 #include "CProfileNameImpl.h" |
|
25 #include "ProfileEngUtils.h" |
|
26 #include "ProfileEngPanic.h" |
|
27 #include "CProfileTiming.h" |
|
28 #include "ProfileEnginePrivateCRKeys.h" |
|
29 #include "ProfilesDebug.h" |
22 #include <bautils.h> // BaflUtils |
30 #include <bautils.h> // BaflUtils |
23 #include <barsc.h> // RResoureFile |
31 #include <barsc.h> // RResoureFile |
24 #include <featmgr.h> |
32 #include <featmgr.h> |
25 #include <bldvariant.hrh> |
33 #include <bldvariant.hrh> |
26 #include <DRMCommon.h> |
34 #include <DRMCommon.h> |
27 #include <sysutil.h> |
35 #include <sysutil.h> |
28 |
36 |
29 #include <profileeng.rsg> |
37 #include <ProfileEng.rsg> |
30 #include <TProfileToneSettings.h> |
38 #include <TProfileToneSettings.h> |
31 #include <MProfileTones.h> |
39 #include <MProfileTones.h> |
32 #include "CProfilesNamesArrayImpl.h" |
|
33 #include "CProfileImpl.h" |
|
34 #include "CProfileNameImpl.h" |
|
35 #include "ProfileEngUtils.h" |
|
36 #include <MProfileSetName.h> |
40 #include <MProfileSetName.h> |
37 #include <ProfileEng.hrh> |
41 #include <ProfileEng.hrh> |
38 #include <ProfileEngineConstants.h> |
42 #include <ProfileEngineConstants.h> |
39 #include "ProfileEngPanic.h" |
|
40 #include <MProfileSetTones.h> |
43 #include <MProfileSetTones.h> |
41 #include <MProfileSetExtraTones.h> |
44 #include <MProfileSetExtraTones.h> |
42 #include "MProfileExtraSettings.h" |
45 #include <MProfileExtraSettings.h> |
43 #include "MProfileFeedbackSettings.h" |
46 #include <MProfileFeedbackSettings.h> |
44 #include <MProfilesLocalFeatures.h> |
47 #include <MProfilesLocalFeatures.h> |
45 #include <MProfileUtilitySingleton.h> |
48 #include <MProfileUtilitySingleton.h> |
46 #include "ProfilesVariant.hrh" // KProEngFeatureIdVTRingingTone |
49 #include <ProfilesVariant.hrh> // KProEngFeatureIdVTRingingTone |
47 #include "CProfileTiming.h" |
|
48 #include <centralrepository.h> |
50 #include <centralrepository.h> |
49 #include "ProfileEnginePrivateCRKeys.h" |
|
50 #include <ProfileEnginePrivatePSKeys.h> |
51 #include <ProfileEnginePrivatePSKeys.h> |
51 #include <hwrmvibrasdkcrkeys.h> |
52 #include <hwrmvibrasdkcrkeys.h> |
52 #include <data_caging_path_literals.hrh> |
53 #include <data_caging_path_literals.hrh> |
53 #include "ProfilesDebug.h" |
|
54 |
54 |
55 #include <psmsettings.h> |
55 #include <psmsettings.h> |
56 #include <psmsrvdomaincrkeys.h> |
56 #include <psmsrvdomaincrkeys.h> |
|
57 |
|
58 #include <MProfileExtraTones2.h> |
|
59 #include <MProfileVibraSettings.h> |
57 |
60 |
58 |
61 |
59 // ============================ MEMBER FUNCTIONS =============================== |
62 // ============================ MEMBER FUNCTIONS =============================== |
60 |
63 |
61 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
623 // CProfileEngineImpl::UpdateActiveProfileSettingsL |
635 // CProfileEngineImpl::UpdateActiveProfileSettingsL |
624 // |
636 // |
625 // (other items were commented in a header). |
637 // (other items were commented in a header). |
626 // ----------------------------------------------------------------------------- |
638 // ----------------------------------------------------------------------------- |
627 // |
639 // |
628 void CProfileEngineImpl::UpdateActiveProfileSettingsL( MProfile& aProfile, |
640 void CProfileEngineImpl::UpdateActiveProfileSettingsL( MProfileExtended2& aProfile, |
629 TBool aSetId ) |
641 TBool aSetId ) |
630 { |
642 { |
631 const MProfileTones& profileTones = aProfile.ProfileTones(); |
643 const MProfileTones& profileTones = aProfile.ProfileTones(); |
|
644 const MProfileExtraTones2& profileExtraTones = aProfile.ProfileExtraTones2(); |
632 const MProfileName& profileName = aProfile.ProfileName(); |
645 const MProfileName& profileName = aProfile.ProfileName(); |
633 const TProfileToneSettings& settings = profileTones.ToneSettings(); |
646 const TProfileToneSettings& settings = profileTones.ToneSettings(); |
|
647 // const MProfileVibraSettings &vibraSettings = aProfile.ProfileVibraSettings(); |
634 |
648 |
635 // These cannot fail because this method is called only in between |
649 // These cannot fail because this method is called only in between |
636 // StartTransaction() and CommitTransaction() calls (except vibra) |
650 // StartTransaction() and CommitTransaction() calls (except vibra) |
637 iCenRep->Set( KProEngActiveRingingType, settings.iRingingType ); |
651 iCenRep->Set( KProEngActiveRingingType, settings.iRingingType ); |
638 iCenRep->Set( KProEngActiveRingingVolume, settings.iRingingVolume ); |
652 |
|
653 //Removed. only master volue used |
|
654 // iCenRep->Set( KProEngActiveRingingVolume, settings.iRingingVolume ); |
639 iCenRep->Set( KProEngActiveMessageAlert, !( aProfile.IsSilent() ) ); |
655 iCenRep->Set( KProEngActiveMessageAlert, !( aProfile.IsSilent() ) ); |
|
656 |
|
657 //Since 10.1 |
|
658 iCenRep->Set( KProEngActiveRingTone,profileTones.RingingTone1() ); |
|
659 iCenRep->Set( KProEngActiveMessageTone,profileTones.MessageAlertTone() ); |
|
660 iCenRep->Set( KProEngActiveReminderTone,profileExtraTones.ReminderTone() ); |
|
661 iCenRep->Set( KProEngActiveClockAlarmTone,profileExtraTones.ClockAlarmTone() ); |
|
662 |
|
663 /* |
|
664 if ( MasterVibraL() ) |
|
665 { |
|
666 iCenRep->Set( KProEngActiveAlertVibra,vibraSettings.AlertVibra() ); |
|
667 } |
|
668 else |
|
669 { |
|
670 iCenRep->Set( KProEngActiveAlertVibra,0 ); |
|
671 } |
|
672 */ |
|
673 |
640 if ( !PowerSaveMode() ) |
674 if ( !PowerSaveMode() ) |
641 { |
675 { |
642 User::LeaveIfError( iVibraCenRep->Set( |
676 User::LeaveIfError( iVibraCenRep->Set( |
643 KVibraCtrlProfileVibraEnabled, settings.iVibratingAlert ) ); |
677 KVibraCtrlProfileVibraEnabled, /*vibraSettings.AlertVibra() != 0 &&*/ MasterVibraL() ) ); |
644 |
678 |
645 #ifdef RD_TACTILE_FEEDBACK |
679 #ifdef RD_TACTILE_FEEDBACK |
646 const MProfileExtraSettings& extraSettings = aProfile.ProfileExtraSettings(); |
680 const MProfileExtraSettings& extraSettings = aProfile.ProfileExtraSettings(); |
647 const MProfileFeedbackSettings& feedbackSettings = |
681 const MProfileFeedbackSettings& feedbackSettings = |
648 extraSettings.ProfileFeedbackSettings(); |
682 extraSettings.ProfileFeedbackSettings(); |
935 { |
970 { |
936 return CProfileEngineImpl::NewL(); |
971 return CProfileEngineImpl::NewL(); |
937 } |
972 } |
938 |
973 |
939 // ----------------------------------------------------------------------------- |
974 // ----------------------------------------------------------------------------- |
|
975 // CreateProfileEngineExtendedL create profiles engine and |
|
976 // return internal interface of the profiles engine |
|
977 // Returns: Profiles Engine internal interface |
|
978 // ----------------------------------------------------------------------------- |
|
979 // |
|
980 EXPORT_C MProfileEngineExtended2* CreateProfileEngineExtended2L() |
|
981 { |
|
982 return CProfileEngineImpl::NewL(); |
|
983 } |
|
984 |
|
985 // ----------------------------------------------------------------------------- |
940 // CreateProfileEngineL create profiles engine and return public interface |
986 // CreateProfileEngineL create profiles engine and return public interface |
941 // of the profiles engine. |
987 // of the profiles engine. |
942 // Returns: Profiles Engine public interface |
988 // Returns: Profiles Engine public interface |
943 // ----------------------------------------------------------------------------- |
989 // ----------------------------------------------------------------------------- |
944 // |
990 // |
1010 |
1066 |
1011 return EFalse; |
1067 return EFalse; |
1012 } |
1068 } |
1013 |
1069 |
1014 |
1070 |
|
1071 |
|
1072 // ----------------------------------------------------------------------------- |
|
1073 // CProfileEngineImpl::Profile2LC |
|
1074 // |
|
1075 // ----------------------------------------------------------------------------- |
|
1076 // |
|
1077 MProfileExtended2* CProfileEngineImpl::Profile2LC( TInt aId ) |
|
1078 { |
|
1079 CProfileImpl* profile = NULL; |
|
1080 |
|
1081 iMutex.Wait(); |
|
1082 TInt err( CheckProfileIdL( aId ) ); |
|
1083 |
|
1084 if( !err ) |
|
1085 { |
|
1086 TRAP( err, profile = GetProfileL( aId ) ); |
|
1087 } |
|
1088 iMutex.Signal(); |
|
1089 |
|
1090 User::LeaveIfError( err ); |
|
1091 |
|
1092 CleanupStack::PushL( profile ); |
|
1093 |
|
1094 if( iSideVolumeKeys ) |
|
1095 { |
|
1096 // Because SetTemp*VolumeL() functions update only Shared Data those |
|
1097 // values must be read from SD and set to the MProfile instance |
|
1098 // returned to the caller: |
|
1099 TInt activeId( User::LeaveIfError( ActiveProfileId() ) ); |
|
1100 if( activeId == aId ) |
|
1101 { |
|
1102 TProfileToneSettings& settings = |
|
1103 profile->ProfileSetTones().SetToneSettings(); |
|
1104 settings.iRingingVolume = TempRingingVolumeL(); |
|
1105 settings.iMediaVolume = TempMediaVolumeL(); |
|
1106 } |
|
1107 } |
|
1108 |
|
1109 if( !profile->IsProfileNameChanged() ) |
|
1110 { |
|
1111 if( IsDefaultProfile( aId ) ) |
|
1112 { |
|
1113 profile->SetLocalizedProfileNameL( *iProfileLocalisedNames ); |
|
1114 } |
|
1115 else |
|
1116 { |
|
1117 SetLocalizedNameForDynamicProfileL( *profile ); |
|
1118 } |
|
1119 } |
|
1120 |
|
1121 return profile; |
|
1122 } |
|
1123 |
|
1124 // ----------------------------------------------------------------------------- |
|
1125 // CProfileEngineImpl::Profile2L |
|
1126 // |
|
1127 // ----------------------------------------------------------------------------- |
|
1128 // |
|
1129 MProfileExtended2* CProfileEngineImpl::Profile2L( TInt aId ) |
|
1130 { |
|
1131 MProfileExtended2* profile = Profile2LC( aId ); |
|
1132 CleanupStack::Pop(); // profile |
|
1133 return profile; |
|
1134 } |
|
1135 |
|
1136 // ----------------------------------------------------------------------------- |
|
1137 // CProfileEngineImpl::CommitChange2L |
|
1138 // |
|
1139 // ----------------------------------------------------------------------------- |
|
1140 // |
|
1141 void CProfileEngineImpl::CommitChange2L( MProfileExtended2& aProfile ) |
|
1142 { |
|
1143 CommitChangeL (aProfile); |
|
1144 } |
|
1145 |
|
1146 |
|
1147 // ----------------------------------------------------------------------------- |
|
1148 // CProfileEngineImpl::MasterVolumeL |
|
1149 // |
|
1150 // ----------------------------------------------------------------------------- |
|
1151 // |
|
1152 TInt CProfileEngineImpl::MasterVolumeL() const |
|
1153 { |
|
1154 TInt masterVolume( 0 ); |
|
1155 User::LeaveIfError( iCenRep->Get( KProEngMasterVolume, masterVolume ) ); |
|
1156 return masterVolume; |
|
1157 } |
|
1158 |
|
1159 // ----------------------------------------------------------------------------- |
|
1160 // CProfileEngineImpl::SetMasterVolumeL |
|
1161 // |
|
1162 // ----------------------------------------------------------------------------- |
|
1163 // |
|
1164 void CProfileEngineImpl::SetMasterVolumeL( TInt aMasterVolume ) |
|
1165 { |
|
1166 User::LeaveIfError( iCenRep->Set( KProEngMasterVolume, aMasterVolume ) ); |
|
1167 User::LeaveIfError( iCenRep->Set( KProEngActiveRingingVolume, aMasterVolume ) ); |
|
1168 |
|
1169 //Send event through P&S |
|
1170 CreatePubSubKeysIfNeededL(); |
|
1171 PublishChangeL( KProEngActiveProfileModified ); |
|
1172 } |
|
1173 |
|
1174 // ----------------------------------------------------------------------------- |
|
1175 // CProfileEngineImpl::MasterVibraL |
|
1176 // |
|
1177 // ----------------------------------------------------------------------------- |
|
1178 // |
|
1179 TBool CProfileEngineImpl::MasterVibraL() const |
|
1180 { |
|
1181 TInt masterVibra( 0 ); |
|
1182 User::LeaveIfError( iCenRep->Get( KProEngMasterVibra, masterVibra ) ); |
|
1183 return ( masterVibra != 0 ); |
|
1184 } |
|
1185 |
|
1186 // ----------------------------------------------------------------------------- |
|
1187 // CProfileEngineImpl::SetMasterVibraL |
|
1188 // |
|
1189 // ----------------------------------------------------------------------------- |
|
1190 // |
|
1191 void CProfileEngineImpl::SetMasterVibraL( TBool aMasterVibra ) |
|
1192 { |
|
1193 User::LeaveIfError( iCenRep->Set( KProEngMasterVibra, aMasterVibra ? 1 : 0 ) ); |
|
1194 User::LeaveIfError ( iCenRep->Set( KProEngActiveAlertVibra, aMasterVibra ? 1 : 0 ) ); |
|
1195 |
|
1196 /* |
|
1197 MProfileExtended2* activeProfile = Profile2LC( ActiveProfileId() ); |
|
1198 const MProfileVibraSettings &vibraSettings = activeProfile->ProfileVibraSettings(); |
|
1199 if (activeProfile) |
|
1200 { |
|
1201 if (aMasterVibra) |
|
1202 { |
|
1203 iCenRep->Set( KProEngActiveAlertVibra,vibraSettings.AlertVibra() ); |
|
1204 } |
|
1205 else |
|
1206 { |
|
1207 iCenRep->Set( KProEngActiveAlertVibra, 0 ); |
|
1208 } |
|
1209 } |
|
1210 CleanupStack::PopAndDestroy(); // activeProfile |
|
1211 */ |
|
1212 |
|
1213 if ( !PowerSaveMode() ) |
|
1214 { |
|
1215 User::LeaveIfError( iVibraCenRep->Set( |
|
1216 KVibraCtrlProfileVibraEnabled, aMasterVibra ? 1 : 0) ); |
|
1217 } |
|
1218 |
|
1219 //Send event through P&S |
|
1220 CreatePubSubKeysIfNeededL(); |
|
1221 PublishChangeL( KProEngActiveProfileModified ); |
|
1222 } |
|
1223 |
|
1224 // ----------------------------------------------------------------------------- |
|
1225 // CProfileEngineImpl::SilenceModeL |
|
1226 // |
|
1227 // ----------------------------------------------------------------------------- |
|
1228 // |
|
1229 TBool CProfileEngineImpl::SilenceModeL() const |
|
1230 { |
|
1231 TInt silenceMode( 0 ); |
|
1232 User::LeaveIfError( iCenRep->Get( KProEngSilenceMode, silenceMode ) ); |
|
1233 return ( silenceMode != 0 ); |
|
1234 } |
|
1235 |
|
1236 // ----------------------------------------------------------------------------- |
|
1237 // CProfileEngineImpl::SetSilenceModeL |
|
1238 // |
|
1239 // ----------------------------------------------------------------------------- |
|
1240 // |
|
1241 void CProfileEngineImpl::SetSilenceModeL( TBool aSilenceMode ) |
|
1242 { |
|
1243 User::LeaveIfError( iCenRep->Set( KProEngSilenceMode, aSilenceMode ? 1 : 0 ) ); |
|
1244 |
|
1245 //Send event through P&S |
|
1246 CreatePubSubKeysIfNeededL(); |
|
1247 PublishChangeL( KProEngActiveProfileModified ); |
|
1248 } |
|
1249 |
1015 // End of File |
1250 // End of File |