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" |
|
30 #include <bautils.h> // BaflUtils |
22 #include <bautils.h> // BaflUtils |
31 #include <barsc.h> // RResoureFile |
23 #include <barsc.h> // RResoureFile |
32 #include <featmgr.h> |
24 #include <featmgr.h> |
33 #include <bldvariant.hrh> |
25 #include <bldvariant.hrh> |
34 #include <DRMCommon.h> |
26 #include <DRMCommon.h> |
35 #include <sysutil.h> |
27 #include <sysutil.h> |
36 |
28 |
37 #include <ProfileEng.rsg> |
29 #include <profileeng.rsg> |
38 #include <TProfileToneSettings.h> |
30 #include <TProfileToneSettings.h> |
39 #include <MProfileTones.h> |
31 #include <MProfileTones.h> |
|
32 #include "CProfilesNamesArrayImpl.h" |
|
33 #include "CProfileImpl.h" |
|
34 #include "CProfileNameImpl.h" |
|
35 #include "ProfileEngUtils.h" |
40 #include <MProfileSetName.h> |
36 #include <MProfileSetName.h> |
41 #include <ProfileEng.hrh> |
37 #include <ProfileEng.hrh> |
42 #include <ProfileEngineConstants.h> |
38 #include <ProfileEngineConstants.h> |
|
39 #include "ProfileEngPanic.h" |
43 #include <MProfileSetTones.h> |
40 #include <MProfileSetTones.h> |
44 #include <MProfileSetExtraTones.h> |
41 #include <MProfileSetExtraTones.h> |
45 #include <MProfileExtraSettings.h> |
42 #include "MProfileExtraSettings.h" |
46 #include <MProfileFeedbackSettings.h> |
43 #include "MProfileFeedbackSettings.h" |
47 #include <MProfilesLocalFeatures.h> |
44 #include <MProfilesLocalFeatures.h> |
48 #include <MProfileUtilitySingleton.h> |
45 #include <MProfileUtilitySingleton.h> |
49 #include <ProfilesVariant.hrh> // KProEngFeatureIdVTRingingTone |
46 #include "ProfilesVariant.hrh" // KProEngFeatureIdVTRingingTone |
|
47 #include "CProfileTiming.h" |
50 #include <centralrepository.h> |
48 #include <centralrepository.h> |
|
49 #include "ProfileEnginePrivateCRKeys.h" |
51 #include <ProfileEnginePrivatePSKeys.h> |
50 #include <ProfileEnginePrivatePSKeys.h> |
52 #include <hwrmvibrasdkcrkeys.h> |
51 #include <hwrmvibrasdkcrkeys.h> |
53 #include <data_caging_path_literals.hrh> |
52 #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> |
|
60 |
57 |
61 |
58 |
62 // ============================ MEMBER FUNCTIONS =============================== |
59 // ============================ MEMBER FUNCTIONS =============================== |
63 |
60 |
64 // ----------------------------------------------------------------------------- |
61 // ----------------------------------------------------------------------------- |
635 // CProfileEngineImpl::UpdateActiveProfileSettingsL |
623 // CProfileEngineImpl::UpdateActiveProfileSettingsL |
636 // |
624 // |
637 // (other items were commented in a header). |
625 // (other items were commented in a header). |
638 // ----------------------------------------------------------------------------- |
626 // ----------------------------------------------------------------------------- |
639 // |
627 // |
640 void CProfileEngineImpl::UpdateActiveProfileSettingsL( MProfileExtended2& aProfile, |
628 void CProfileEngineImpl::UpdateActiveProfileSettingsL( MProfile& aProfile, |
641 TBool aSetId ) |
629 TBool aSetId ) |
642 { |
630 { |
643 const MProfileTones& profileTones = aProfile.ProfileTones(); |
631 const MProfileTones& profileTones = aProfile.ProfileTones(); |
644 const MProfileExtraTones2& profileExtraTones = aProfile.ProfileExtraTones2(); |
|
645 const MProfileName& profileName = aProfile.ProfileName(); |
632 const MProfileName& profileName = aProfile.ProfileName(); |
646 const TProfileToneSettings& settings = profileTones.ToneSettings(); |
633 const TProfileToneSettings& settings = profileTones.ToneSettings(); |
647 // const MProfileVibraSettings &vibraSettings = aProfile.ProfileVibraSettings(); |
|
648 |
634 |
649 // These cannot fail because this method is called only in between |
635 // These cannot fail because this method is called only in between |
650 // StartTransaction() and CommitTransaction() calls (except vibra) |
636 // StartTransaction() and CommitTransaction() calls (except vibra) |
651 iCenRep->Set( KProEngActiveRingingType, settings.iRingingType ); |
637 iCenRep->Set( KProEngActiveRingingType, settings.iRingingType ); |
652 |
638 iCenRep->Set( KProEngActiveRingingVolume, settings.iRingingVolume ); |
653 //Removed. only master volue used |
|
654 // iCenRep->Set( KProEngActiveRingingVolume, settings.iRingingVolume ); |
|
655 iCenRep->Set( KProEngActiveMessageAlert, !( aProfile.IsSilent() ) ); |
639 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 |
|
674 if ( !PowerSaveMode() ) |
640 if ( !PowerSaveMode() ) |
675 { |
641 { |
676 User::LeaveIfError( iVibraCenRep->Set( |
642 User::LeaveIfError( iVibraCenRep->Set( |
677 KVibraCtrlProfileVibraEnabled, /*vibraSettings.AlertVibra() != 0 &&*/ MasterVibraL() ) ); |
643 KVibraCtrlProfileVibraEnabled, settings.iVibratingAlert ) ); |
678 |
644 |
679 #ifdef RD_TACTILE_FEEDBACK |
645 #ifdef RD_TACTILE_FEEDBACK |
680 const MProfileExtraSettings& extraSettings = aProfile.ProfileExtraSettings(); |
646 const MProfileExtraSettings& extraSettings = aProfile.ProfileExtraSettings(); |
681 const MProfileFeedbackSettings& feedbackSettings = |
647 const MProfileFeedbackSettings& feedbackSettings = |
682 extraSettings.ProfileFeedbackSettings(); |
648 extraSettings.ProfileFeedbackSettings(); |
970 { |
935 { |
971 return CProfileEngineImpl::NewL(); |
936 return CProfileEngineImpl::NewL(); |
972 } |
937 } |
973 |
938 |
974 // ----------------------------------------------------------------------------- |
939 // ----------------------------------------------------------------------------- |
|
940 // CreateProfileEngineL create profiles engine and return public interface |
|
941 // of the profiles engine. |
|
942 // Returns: Profiles Engine public interface |
|
943 // ----------------------------------------------------------------------------- |
|
944 // |
|
945 EXPORT_C MProfileEngine* CreateProfileEngineL( RFs* aFs ) |
|
946 { |
|
947 return CProfileEngineImpl::NewL( aFs ); |
|
948 } |
|
949 |
|
950 // ----------------------------------------------------------------------------- |
975 // CreateProfileEngineExtendedL create profiles engine and |
951 // CreateProfileEngineExtendedL create profiles engine and |
976 // return internal interface of the profiles engine |
952 // return internal interface of the profiles engine |
977 // Returns: Profiles Engine internal interface |
953 // Returns: Profiles Engine internal interface |
978 // ----------------------------------------------------------------------------- |
954 // ----------------------------------------------------------------------------- |
979 // |
955 // |
980 EXPORT_C MProfileEngineExtended2* CreateProfileEngineExtended2L() |
956 EXPORT_C MProfileEngineExtended* CreateProfileEngineExtendedL( RFs* aFs ) |
981 { |
|
982 return CProfileEngineImpl::NewL(); |
|
983 } |
|
984 |
|
985 // ----------------------------------------------------------------------------- |
|
986 // CreateProfileEngineL create profiles engine and return public interface |
|
987 // of the profiles engine. |
|
988 // Returns: Profiles Engine public interface |
|
989 // ----------------------------------------------------------------------------- |
|
990 // |
|
991 EXPORT_C MProfileEngine* CreateProfileEngineL( RFs* aFs ) |
|
992 { |
957 { |
993 return CProfileEngineImpl::NewL( aFs ); |
958 return CProfileEngineImpl::NewL( aFs ); |
994 } |
959 } |
995 |
960 |
996 // ----------------------------------------------------------------------------- |
|
997 // CreateProfileEngineExtendedL create profiles engine and |
|
998 // return internal interface of the profiles engine |
|
999 // Returns: Profiles Engine internal interface |
|
1000 // ----------------------------------------------------------------------------- |
|
1001 // |
|
1002 EXPORT_C MProfileEngineExtended* CreateProfileEngineExtendedL( RFs* aFs ) |
|
1003 { |
|
1004 return CProfileEngineImpl::NewL( aFs ); |
|
1005 } |
|
1006 |
|
1007 // ----------------------------------------------------------------------------- |
|
1008 // CreateProfileEngineExtendedL create profiles engine and |
|
1009 // return internal interface of the profiles engine |
|
1010 // Returns: Profiles Engine internal interface |
|
1011 // ----------------------------------------------------------------------------- |
|
1012 // |
|
1013 EXPORT_C MProfileEngineExtended2* CreateProfileEngineExtended2L( RFs* aFs ) |
|
1014 { |
|
1015 return CProfileEngineImpl::NewL( aFs ); |
|
1016 } |
|
1017 |
961 |
1018 // ----------------------------------------------------------------------------- |
962 // ----------------------------------------------------------------------------- |
1019 // CProfileEngineImpl::PowerSaveMode |
963 // CProfileEngineImpl::PowerSaveMode |
1020 // |
964 // |
1021 // ----------------------------------------------------------------------------- |
965 // ----------------------------------------------------------------------------- |
1066 |
1010 |
1067 return EFalse; |
1011 return EFalse; |
1068 } |
1012 } |
1069 |
1013 |
1070 |
1014 |
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 |
|
1250 // End of File |
1015 // End of File |