624 // CProfileEngineImpl::UpdateActiveProfileSettingsL |
635 // CProfileEngineImpl::UpdateActiveProfileSettingsL |
625 // |
636 // |
626 // (other items were commented in a header). |
637 // (other items were commented in a header). |
627 // ----------------------------------------------------------------------------- |
638 // ----------------------------------------------------------------------------- |
628 // |
639 // |
629 void CProfileEngineImpl::UpdateActiveProfileSettingsL( MProfile& aProfile, |
640 void CProfileEngineImpl::UpdateActiveProfileSettingsL( MProfileExtended2& aProfile, |
630 TBool aSetId ) |
641 TBool aSetId ) |
631 { |
642 { |
632 const MProfileTones& profileTones = aProfile.ProfileTones(); |
643 const MProfileTones& profileTones = aProfile.ProfileTones(); |
|
644 const MProfileExtraTones2& profileExtraTones = aProfile.ProfileExtraTones2(); |
633 const MProfileName& profileName = aProfile.ProfileName(); |
645 const MProfileName& profileName = aProfile.ProfileName(); |
634 const TProfileToneSettings& settings = profileTones.ToneSettings(); |
646 const TProfileToneSettings& settings = profileTones.ToneSettings(); |
|
647 // const MProfileVibraSettings &vibraSettings = aProfile.ProfileVibraSettings(); |
635 |
648 |
636 // These cannot fail because this method is called only in between |
649 // These cannot fail because this method is called only in between |
637 // StartTransaction() and CommitTransaction() calls (except vibra) |
650 // StartTransaction() and CommitTransaction() calls (except vibra) |
638 iCenRep->Set( KProEngActiveRingingType, settings.iRingingType ); |
651 iCenRep->Set( KProEngActiveRingingType, settings.iRingingType ); |
639 iCenRep->Set( KProEngActiveRingingVolume, settings.iRingingVolume ); |
652 |
|
653 //Removed. only master volue used |
|
654 // iCenRep->Set( KProEngActiveRingingVolume, settings.iRingingVolume ); |
640 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 |
641 if ( !PowerSaveMode() ) |
674 if ( !PowerSaveMode() ) |
642 { |
675 { |
643 User::LeaveIfError( iVibraCenRep->Set( |
676 User::LeaveIfError( iVibraCenRep->Set( |
644 KVibraCtrlProfileVibraEnabled, settings.iVibratingAlert ) ); |
677 KVibraCtrlProfileVibraEnabled, /*vibraSettings.AlertVibra() != 0 &&*/ MasterVibraL() ) ); |
645 |
678 |
646 #ifdef RD_TACTILE_FEEDBACK |
679 #ifdef RD_TACTILE_FEEDBACK |
647 const MProfileExtraSettings& extraSettings = aProfile.ProfileExtraSettings(); |
680 const MProfileExtraSettings& extraSettings = aProfile.ProfileExtraSettings(); |
648 const MProfileFeedbackSettings& feedbackSettings = |
681 const MProfileFeedbackSettings& feedbackSettings = |
649 extraSettings.ProfileFeedbackSettings(); |
682 extraSettings.ProfileFeedbackSettings(); |
936 { |
970 { |
937 return CProfileEngineImpl::NewL(); |
971 return CProfileEngineImpl::NewL(); |
938 } |
972 } |
939 |
973 |
940 // ----------------------------------------------------------------------------- |
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 // ----------------------------------------------------------------------------- |
941 // CreateProfileEngineL create profiles engine and return public interface |
986 // CreateProfileEngineL create profiles engine and return public interface |
942 // of the profiles engine. |
987 // of the profiles engine. |
943 // Returns: Profiles Engine public interface |
988 // Returns: Profiles Engine public interface |
944 // ----------------------------------------------------------------------------- |
989 // ----------------------------------------------------------------------------- |
945 // |
990 // |
957 EXPORT_C MProfileEngineExtended* CreateProfileEngineExtendedL( RFs* aFs ) |
1002 EXPORT_C MProfileEngineExtended* CreateProfileEngineExtendedL( RFs* aFs ) |
958 { |
1003 { |
959 return CProfileEngineImpl::NewL( aFs ); |
1004 return CProfileEngineImpl::NewL( aFs ); |
960 } |
1005 } |
961 |
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 } |
962 |
1017 |
963 // ----------------------------------------------------------------------------- |
1018 // ----------------------------------------------------------------------------- |
964 // CProfileEngineImpl::PowerSaveMode |
1019 // CProfileEngineImpl::PowerSaveMode |
965 // |
1020 // |
966 // ----------------------------------------------------------------------------- |
1021 // ----------------------------------------------------------------------------- |
1011 |
1066 |
1012 return EFalse; |
1067 return EFalse; |
1013 } |
1068 } |
1014 |
1069 |
1015 |
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 |
1016 // End of File |
1246 // End of File |