42 #include <MProfileVibraSettings.h> |
43 #include <MProfileVibraSettings.h> |
43 #include <MProfileSetVibraSettings.h> |
44 #include <MProfileSetVibraSettings.h> |
44 #include <TProfileToneSettings.h> |
45 #include <TProfileToneSettings.h> |
45 #include <hwrmvibrasdkcrkeys.h> |
46 #include <hwrmvibrasdkcrkeys.h> |
46 #include <centralrepository.h> |
47 #include <centralrepository.h> |
47 |
48 #include <XQConversions> |
48 |
49 #include <profile.hrh> |
49 QString stringFromDescriptor(const TDesC& dsp) |
50 /* |
50 { |
51 * Constructor |
51 return QString::fromUtf16(dsp.Ptr(), dsp.Length()); |
52 */ |
52 } |
|
53 |
|
54 HBufC* descriptorFromString(const QString& str) |
|
55 { |
|
56 TPtrC ptr(reinterpret_cast<const TUint16*>(str.utf16())); |
|
57 return ptr.Alloc(); |
|
58 } |
|
59 |
|
60 CpProfileModelPrivate::CpProfileModelPrivate() |
53 CpProfileModelPrivate::CpProfileModelPrivate() |
61 : mEngine(0), |
54 : mEngine(0), |
62 mInitErrFlag(0), |
|
63 mOffLineCenRep(0), |
|
64 q_ptr(0) |
55 q_ptr(0) |
65 { |
56 { |
66 |
57 |
67 } |
58 } |
68 |
59 |
|
60 /* |
|
61 * Initialize the profile engine and available profile list for profile wrapper. |
|
62 */ |
69 void CpProfileModelPrivate::initialize(CpProfileModel *parent) |
63 void CpProfileModelPrivate::initialize(CpProfileModel *parent) |
70 { |
64 { |
71 q_ptr = parent; |
65 q_ptr = parent; |
72 CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), START."); |
66 CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), START."); |
73 TRAPD( err, |
67 TRAP_IGNORE( |
74 mEngine = CreateProfileEngineExtended2L(); |
68 mEngine = CreateProfileEngineExtended2L(); |
75 mOffLineCenRep = CRepository::NewL( KCRUidCommunicationSettings ); |
69 /* |
76 |
70 * Currently, engine part will return all previous version of profile |
77 /* |
71 * so some invalid profile will be added in the new list, to avoid this |
78 * Currently, engine part will return all previous version of profile |
72 * use hard code to get the right list of profile. |
79 * so some invalid profile will be added in the new list, to avoid this |
73 */ |
80 * use hard code to get the right list of profile. |
74 /*MProfilesNamesArray* nameList = mEngine->ProfilesNamesArrayLC(); |
81 */ |
75 int profileCount = nameList->MdcaCount(); |
82 /*MProfilesNamesArray* nameList = mEngine->ProfilesNamesArrayLC(); |
76 for (int i = 0; i<profileCount; i++) { |
83 int profileCount = nameList->MdcaCount(); |
77 MProfileName *profileName = nameList->ProfileName(i); |
84 for (int i = 0; i<profileCount; i++) { |
78 mProfileList.insert(profileName->Id(), mEngine->Profile2L(profileName->Id())); |
85 MProfileName *profileName = nameList->ProfileName(i); |
79 } |
86 mProfileList.insert(profileName->Id(), mEngine->Profile2L(profileName->Id())); |
80 CleanupStack::PopAndDestroy(*nameList);*/ |
87 } |
|
88 CleanupStack::PopAndDestroy(*nameList);*/ |
|
89 mProfileList.insert(0, mEngine->Profile2L(0)); // general id |
|
90 mProfileList.insert(2, mEngine->Profile2L(2)); |
|
91 ); |
81 ); |
92 |
82 mProfileList.append(static_cast<int>(EProfileWrapperGeneralId)); // general id |
93 // currently, reserve a error code for deal with low memory ... leave |
83 mProfileList.append(static_cast<int>(EProfileWrapperMeetingId)); // meeting id |
94 // as known, qt in symbian exception safety's development is ongoing. |
84 CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), END"); |
95 // we will follow the official way to deal with symbian leave or exception |
|
96 mInitErrFlag = err; |
|
97 CPFW_LOG("CpProfileModelPrivate::CpProfileModelPrivate(), END, err is." + QString(err) ); |
|
98 } |
85 } |
99 |
86 |
|
87 /* |
|
88 * Destructor |
|
89 */ |
100 CpProfileModelPrivate::~CpProfileModelPrivate() |
90 CpProfileModelPrivate::~CpProfileModelPrivate() |
101 { |
91 { |
102 if (mEngine!=0) { |
92 if (mEngine!=0) { |
103 mEngine->Release(); |
93 mEngine->Release(); |
104 } |
94 } |
105 foreach(MProfileExtended2* profile, mProfileList) |
95 mProfileList.clear(); |
106 { |
96 } |
107 if (profile!=0 ) { |
97 |
|
98 /* |
|
99 * Get profile name with its id |
|
100 */ |
|
101 QString CpProfileModelPrivate::profileName(int profileId) const |
|
102 { |
|
103 CPFW_LOG("CpProfileModelPrivate::profileName(), START."); |
|
104 // Return an empty string if id is not valid. |
|
105 if (!isValidProfile(profileId)) { |
|
106 return QString(); |
|
107 } |
|
108 QString profileName; |
|
109 QT_TRAP_THROWING( |
|
110 MProfile *profile = mEngine->Profile2L(profileId); |
|
111 const MProfileName &name = profile->ProfileName(); |
|
112 if (name.Name().Length() > 0) { |
|
113 profileName = XQConversions::s60DescToQString(name.Name()); |
|
114 } |
108 profile->Release(); |
115 profile->Release(); |
109 } |
116 ) |
110 } |
117 return profileName; |
111 mProfileList.clear(); |
118 |
112 delete mOffLineCenRep; |
119 } |
113 } |
120 |
114 |
121 /* |
115 /* |
122 * Set profile name with \a profileId. |
116 * Get the result of the initiation |
123 */ |
117 */ |
124 void CpProfileModelPrivate::setProfileName(int profileId, const QString &name) |
118 int CpProfileModelPrivate::initiationFlag() |
125 { |
119 { |
126 HBufC *des = XQConversions::qStringToS60Desc( name ); |
120 return mInitErrFlag; |
127 QT_TRAP_THROWING( |
121 } |
128 CleanupStack::PushL(des); |
122 |
129 MProfileExtended *profileExtend = mEngine->Profile2L(profileId); |
123 /* |
130 CleanupStack::PushL(profileExtend); |
124 * Get profile name with its id |
131 MProfileSetName &profileSetName = profileExtend->ProfileSetName(); |
125 */ |
132 profileSetName.SetNameL(*des); |
126 QString CpProfileModelPrivate::profileName(int profileId) const |
133 mEngine ->CommitChangeL(*profileExtend); |
127 { |
134 CleanupStack::Pop(2); // des, profileExtend |
128 CPFW_LOG("CpProfileModelPrivate::profileName(), START."); |
135 profileExtend->Release(); |
129 |
136 ) |
130 // MProfileName* name = 0; |
137 } |
131 // TRAPD( err, *name = mEngine->ProfileL(profileId)->ProfileName(); ); |
138 |
132 // |
139 /* |
133 // if ( !err && name){ |
140 * Get available profiles' name list. |
134 // CPFW_LOG("CpProfileModelPrivate::profileName(), have name, END."); |
141 */ |
135 // return stringFromDescriptor( name->Name() ); |
|
136 // } else { |
|
137 // CPFW_LOG("CpProfileModelPrivate::profileName(), no name, END."); |
|
138 // return ""; |
|
139 // } |
|
140 // should return qt localized profile name |
|
141 // engine return symbian localized name, that is a wrong way to got it |
|
142 // so hard code here, wait for engine's correcting. |
|
143 switch (profileId) { |
|
144 case EProfileWrapperGeneralId: |
|
145 return hbTrId("txt_cp_list_general"); |
|
146 case EProfileWrapperMeetingId: |
|
147 return hbTrId("txt_cp_list_meeting"); |
|
148 default: |
|
149 return QString(""); |
|
150 } |
|
151 } |
|
152 QStringList CpProfileModelPrivate::profileNames() const |
142 QStringList CpProfileModelPrivate::profileNames() const |
153 { |
143 { |
154 //hard code, until engine part support qt localized name |
144 CPFW_LOG("CpProfileModelPrivate::profileNames(), START."); |
155 QStringList nameList; |
145 QStringList nameList; |
156 nameList<<hbTrId("txt_cp_list_general") |
146 foreach(int profileId, mProfileList) { |
157 <<hbTrId("txt_cp_list_meeting"); |
147 QT_TRAP_THROWING( |
|
148 MProfile *profile = mEngine->Profile2L(profileId); |
|
149 const MProfileName &name = profile->ProfileName(); |
|
150 if (name.Name().Length() > 0) { |
|
151 nameList.append(XQConversions::s60DescToQString(name.Name())); |
|
152 } |
|
153 profile->Release(); |
|
154 ) |
|
155 } |
|
156 CPFW_LOG("CpProfileModelPrivate::profileNames(), END."); |
158 return nameList; |
157 return nameList; |
159 } |
158 } |
160 |
159 |
161 |
160 |
162 /* |
161 /* |
163 * Activate a profile with its id, return the operation code. |
162 * Activate a profile with its id, return the result. |
164 */ |
163 */ |
165 int CpProfileModelPrivate::activateProfile(int profileId) |
164 int CpProfileModelPrivate::activateProfile(int profileId) |
166 { |
165 { |
167 CPFW_LOG("CpProfileModelPrivate::activateProfile(), START."); |
166 CPFW_LOG("CpProfileModelPrivate::activateProfile(), START."); |
168 |
167 // currently, only two profile remains: general and meeting, |
|
168 // But profile engine also support the old profile like: |
|
169 // silence, out ... |
|
170 // so filter the invalid profile id first. |
|
171 if (!isValidProfile(profileId)) { |
|
172 return KErrNotFound; |
|
173 } |
169 TRAPD( err, |
174 TRAPD( err, |
170 mEngine->SetActiveProfileL( profileId ); |
175 mEngine->SetActiveProfileL( profileId ); |
171 //UpdateProfileSettingsL( profileId ); |
|
172 ); |
176 ); |
173 CPFW_LOG("CpProfileModelPrivate::activateProfile(), END."); |
177 CPFW_LOG("CpProfileModelPrivate::activateProfile(), END."); |
174 return err; |
178 return err; |
175 } |
179 } |
176 |
180 |
180 int CpProfileModelPrivate::activeProfileId() const |
184 int CpProfileModelPrivate::activeProfileId() const |
181 { |
185 { |
182 return mEngine->ActiveProfileId(); |
186 return mEngine->ActiveProfileId(); |
183 } |
187 } |
184 |
188 |
|
189 /* |
|
190 * Return all profile settings according to profile's id |
|
191 */ |
185 void CpProfileModelPrivate::profileSettings(int profileId, |
192 void CpProfileModelPrivate::profileSettings(int profileId, |
186 CpProfileSettings& profileSettings) |
193 CpProfileSettings& profileSettings) |
187 { |
194 { |
188 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
195 if (!isValidProfile(profileId)) { |
189 const MProfileTones &setTones = profileExtend->ProfileTones(); |
196 return; |
190 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
197 } |
191 const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); |
198 QT_TRAP_THROWING( |
192 const MProfileVibraSettings &vibraSettings = |
199 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
193 profileExtend->ProfileVibraSettings(); |
200 CleanupStack::PushL(profileExtend); |
194 const MProfileExtraSettings &extraSettings = |
201 |
195 profileExtend->ProfileExtraSettings(); |
202 const MProfileTones &setTones = profileExtend->ProfileTones(); |
196 const MProfileFeedbackSettings &feedbackSettings = |
203 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
197 extraSettings.ProfileFeedbackSettings(); |
204 const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); |
198 |
205 const MProfileVibraSettings &vibraSettings = |
199 profileSettings.mRingTone = stringFromDescriptor(setTones.RingingTone1()); |
206 profileExtend->ProfileVibraSettings(); |
200 profileSettings.mMessageTone = stringFromDescriptor(setTones.MessageAlertTone()); |
207 const MProfileExtraSettings &extraSettings = |
201 profileSettings.mEmailTone = stringFromDescriptor(extTones.EmailAlertTone()); |
208 profileExtend->ProfileExtraSettings(); |
202 profileSettings.mReminderTone = stringFromDescriptor(extTones.ReminderTone()); |
209 const MProfileFeedbackSettings &feedbackSettings = |
203 profileSettings.mNotificationTone = toneSettings.iWarningAndGameTones; |
210 extraSettings.ProfileFeedbackSettings(); |
204 // only use Keypad Volume as a base value for display in key & touch screen setting option |
211 |
205 profileSettings.mKeyTouchScreenTone = toneSettings.iKeypadVolume; |
212 profileSettings.mRingTone = XQConversions::s60DescToQString(setTones.RingingTone1()); |
|
213 profileSettings.mMessageTone = XQConversions::s60DescToQString(setTones.MessageAlertTone()); |
|
214 profileSettings.mEmailTone = XQConversions::s60DescToQString(extTones.EmailAlertTone()); |
|
215 profileSettings.mReminderTone = XQConversions::s60DescToQString(extTones.ReminderTone()); |
|
216 profileSettings.mNotificationTone = toneSettings.iWarningAndGameTones; |
|
217 |
|
218 // only use Keypad Volume as a base value for display in key & touch screen setting option |
|
219 profileSettings.mKeyTouchScreenTone = toneSettings.iKeypadVolume; |
|
220 profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback(); |
|
221 CleanupStack::Pop(); // profileExtend |
|
222 profileExtend->Release(); |
|
223 ); |
|
224 } |
|
225 /* |
|
226 * set profile settings |
|
227 */ |
|
228 void CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) |
|
229 { |
|
230 if (!isValidProfile(profileId)) { |
|
231 return; |
|
232 } |
206 |
233 |
207 profileSettings.mRingAlertVibra = vibraSettings.RingAlertVibra(); |
234 QT_TRAP_THROWING ( |
208 profileSettings.mMessageVibra = vibraSettings.MessageAlertVibra(); |
235 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
209 profileSettings.mEmailVibra = vibraSettings.EmailAlertVibra(); |
236 CleanupStack::PushL(profileExtend); |
210 profileSettings.mReminderAlertVibra = vibraSettings.ReminderAlarmVibra(); |
237 |
211 profileSettings.mNotificationVibra = vibraSettings.InformationVibra(); |
238 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
212 profileSettings.mKeyTouchScreenVibra = feedbackSettings.TactileFeedback(); |
239 TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
213 |
240 MProfileSetExtraTones2 &setExtTones = |
214 } |
241 profileExtend->ProfileSetExtraTones2(); |
215 /*! |
242 MProfileSetVibraSettings &setVibraSettings = |
216 set profile settings |
243 profileExtend->ProfileSetVibraSettings(); |
217 \param profileId identify the profile |
244 MProfileSetExtraSettings &extraSettings = |
218 \param profileSettings value of profile options |
245 profileExtend->ProfileSetExtraSettings(); |
219 */ |
246 MProfileSetFeedbackSettings &setFeedbackSettings = |
220 int CpProfileModelPrivate::setProfileSettings(int profileId, CpProfileSettings& profileSettings) |
247 extraSettings.ProfileSetFeedbackSettings(); |
221 { |
248 |
222 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
249 |
223 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
250 setTones.SetRingingTone1L(*XQConversions::qStringToS60Desc( |
224 TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
251 profileSettings.mRingTone)); |
225 MProfileSetExtraTones2 &setExtTones = |
252 setTones.SetMessageAlertToneL(*XQConversions::qStringToS60Desc( |
226 profileExtend->ProfileSetExtraTones2(); |
253 profileSettings.mMessageTone)); |
227 MProfileSetVibraSettings &setVibraSettings = |
254 setExtTones.SetEmailAlertToneL(*XQConversions::qStringToS60Desc( |
228 profileExtend->ProfileSetVibraSettings(); |
255 profileSettings.mEmailTone)); |
229 MProfileSetExtraSettings &extraSettings = |
256 setExtTones.SetReminderToneL(*XQConversions::qStringToS60Desc( |
230 profileExtend->ProfileSetExtraSettings(); |
257 profileSettings.mReminderTone)); |
231 MProfileSetFeedbackSettings &setFeedbackSettings = |
258 |
232 extraSettings.ProfileSetFeedbackSettings(); |
259 toneSettings.iWarningAndGameTones |
|
260 = profileSettings.mNotificationTone; |
|
261 // Change the keypad volume and touch screen tone together |
|
262 toneSettings.iKeypadVolume |
|
263 = static_cast<TProfileKeypadVolume> (profileSettings.mKeyTouchScreenTone); |
|
264 setFeedbackSettings.SetAudioFeedback( |
|
265 static_cast<TProfileAudioFeedback> (profileSettings.mKeyTouchScreenTone)); |
|
266 setFeedbackSettings.SetTactileFeedback( |
|
267 static_cast<TProfileTactileFeedback> (profileSettings.mKeyTouchScreenVibra)); |
|
268 |
|
269 mEngine->CommitChangeL(*profileExtend); |
|
270 CleanupStack::Pop(); // profileExtend |
|
271 ) |
|
272 } |
|
273 |
|
274 /* |
|
275 * Get the active profile's ring tone name |
|
276 */ |
|
277 QString CpProfileModelPrivate::ringTone() const |
|
278 { |
|
279 // return empty string when active profile id is invalid, |
|
280 // some old application still set the profile which is not available now, |
|
281 // this check can be removed when every application use a correct profile id |
|
282 |
|
283 QString ringTone; |
|
284 if (!isValidProfile(activeProfileId())) { |
|
285 return ringTone; |
|
286 } |
|
287 QT_TRAP_THROWING( |
|
288 MProfileExtended2 *profileExtend = mEngine->Profile2L(activeProfileId()); |
|
289 CleanupStack::PushL(profileExtend); |
|
290 const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
291 |
|
292 ringTone = XQConversions::s60DescToQString(setTones.RingingTone1()); |
|
293 CleanupStack::Pop(); // profileExtend |
|
294 profileExtend->Release(); |
|
295 ) |
233 |
296 |
234 TRAP_IGNORE( |
|
235 setTones.SetRingingTone1L(*descriptorFromString( |
|
236 profileSettings.mRingTone)); |
|
237 setTones.SetMessageAlertToneL(*descriptorFromString( |
|
238 profileSettings.mMessageTone)); |
|
239 setExtTones.SetEmailAlertToneL(*descriptorFromString( |
|
240 profileSettings.mEmailTone)); |
|
241 setExtTones.SetReminderToneL(*descriptorFromString( |
|
242 profileSettings.mReminderTone)); |
|
243 ) |
|
244 toneSettings.iWarningAndGameTones |
|
245 = profileSettings.mNotificationTone; |
|
246 // Change the keypad volume and touch screen tone together |
|
247 toneSettings.iKeypadVolume |
|
248 = static_cast<TProfileKeypadVolume> (profileSettings.mKeyTouchScreenTone); |
|
249 setFeedbackSettings.SetAudioFeedback( |
|
250 static_cast<TProfileAudioFeedback> (profileSettings.mKeyTouchScreenTone)); |
|
251 |
|
252 setVibraSettings.SetRingAlertVibra(profileSettings.mRingAlertVibra); |
|
253 setVibraSettings.SetMessageAlertVibra(profileSettings.mMessageVibra); |
|
254 setVibraSettings.SetEmailAlertVibra(profileSettings.mEmailVibra); |
|
255 setVibraSettings.SetReminderAlarmVibra( |
|
256 profileSettings.mReminderAlertVibra); |
|
257 setVibraSettings.SetInformationVibra( |
|
258 profileSettings.mNotificationVibra); |
|
259 setFeedbackSettings.SetTactileFeedback( |
|
260 static_cast<TProfileTactileFeedback> (profileSettings.mKeyTouchScreenVibra)); |
|
261 |
|
262 TRAPD(err, |
|
263 mEngine->CommitChangeL(*profileExtend); |
|
264 ) |
|
265 return err; |
|
266 } |
|
267 |
|
268 QString CpProfileModelPrivate::ringTone() const |
|
269 { |
|
270 MProfileExtended2 *profileExtend = mProfileList.value(EProfileWrapperGeneralId); |
|
271 QString ringTone = stringFromDescriptor( |
|
272 profileExtend->ProfileTones().RingingTone1()); |
|
273 return ringTone; |
297 return ringTone; |
274 } |
298 } |
275 |
299 |
|
300 /* |
|
301 * Set the ring tone for all profiles |
|
302 */ |
276 void CpProfileModelPrivate::setRingTone(const QString& filePath) |
303 void CpProfileModelPrivate::setRingTone(const QString& filePath) |
277 { |
304 { |
278 int ids[] = {EProfileWrapperGeneralId,EProfileWrapperMeetingId}; |
305 for (TInt i = 0; i < mProfileList.count(); ++i) { |
|
306 QT_TRAP_THROWING( |
|
307 MProfileExtended2 *profileExtend = mEngine->Profile2L(mProfileList.at(i)); |
|
308 CleanupStack::PushL(profileExtend); |
|
309 |
|
310 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
311 |
|
312 setTones.SetRingingTone1L( *XQConversions::qStringToS60Desc(filePath) ); |
|
313 mEngine ->CommitChangeL(*profileExtend); |
|
314 CleanupStack::Pop(); // profileExtend |
|
315 profileExtend->Release(); |
|
316 ) |
|
317 } |
|
318 } |
|
319 |
|
320 /* |
|
321 * Get the ringing volume value |
|
322 */ |
|
323 int CpProfileModelPrivate::masterVolume() const |
|
324 { |
|
325 int masterVolume = 0; |
|
326 QT_TRAP_THROWING(masterVolume = mEngine->MasterVolumeL();) |
|
327 return masterVolume; |
|
328 } |
|
329 |
|
330 /* |
|
331 * Set the ringing volume |
|
332 */ |
|
333 void CpProfileModelPrivate::setMasterVolume(int volume) |
|
334 { |
|
335 // the volume range 1-10 |
|
336 if (volume >= EProfileRingingVolumeLevel1 && volume <= EProfileRingingVolumeLevel10) { |
|
337 QT_TRAP_THROWING(mEngine->SetMasterVolumeL( volume );) |
|
338 } |
|
339 } |
|
340 /* |
|
341 * Get the master vibra's status |
|
342 */ |
|
343 bool CpProfileModelPrivate::masterVibra() const |
|
344 { |
|
345 bool masterVibra = false; |
|
346 QT_TRAP_THROWING(masterVibra = mEngine->MasterVibraL();) |
|
347 return masterVibra; |
|
348 } |
|
349 |
|
350 /* |
|
351 * Set master vibra's status |
|
352 */ |
|
353 void CpProfileModelPrivate::setMasterVibra(bool isVibra) |
|
354 { |
|
355 QT_TRAP_THROWING(mEngine->SetMasterVibraL( isVibra );) |
|
356 } |
|
357 |
|
358 /* |
|
359 * Get the status of silence mode. |
|
360 */ |
|
361 bool CpProfileModelPrivate::silenceMode() const |
|
362 { |
|
363 bool isSlience = false; |
|
364 QT_TRAP_THROWING(isSlience = mEngine->SilenceModeL();) |
|
365 return isSlience; |
|
366 } |
|
367 |
|
368 /* |
|
369 * Set the status of silence mode |
|
370 */ |
|
371 void CpProfileModelPrivate::setSilenceMode(bool isSilence) |
|
372 { |
|
373 QT_TRAP_THROWING(mEngine->SetSilenceModeL( isSilence );) |
|
374 } |
|
375 |
|
376 /* |
|
377 * Return the ring tone of a profile, if the profile id is invalid, always |
|
378 * return an empty string |
|
379 */ |
|
380 QString CpProfileModelPrivate::ringTone(int profileId) const |
|
381 { |
|
382 QString ringTone; |
|
383 if(!isValidProfile(profileId)) { |
|
384 return ringTone; |
|
385 } |
|
386 QT_TRAP_THROWING( |
|
387 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
388 CleanupStack::PushL(profileExtend); |
|
389 |
|
390 const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
391 |
|
392 ringTone = XQConversions::s60DescToQString(setTones.RingingTone1()); |
|
393 CleanupStack::Pop(); // profileExtend |
|
394 profileExtend->Release(); |
|
395 ) |
|
396 return ringTone; |
|
397 } |
|
398 |
|
399 /* |
|
400 * Set the ring tone for a profile, if the profile id is invalid, nothing happens |
|
401 */ |
|
402 void CpProfileModelPrivate::setRingTone(int profileId, const QString& filePath) |
|
403 { |
|
404 if(!isValidProfile(profileId)) { |
|
405 return; |
|
406 } |
|
407 QT_TRAP_THROWING( |
|
408 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
409 CleanupStack::PushL(profileExtend); |
|
410 |
|
411 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
412 |
|
413 setTones.SetRingingTone1L(*XQConversions::qStringToS60Desc(filePath)); |
|
414 mEngine->CommitChangeL(*profileExtend); |
|
415 CleanupStack::Pop(); // profileExtend |
|
416 profileExtend->Release(); |
|
417 ) |
|
418 } |
|
419 |
|
420 /* |
|
421 * Get the message tone of a profile, if the profile id is invalid, always return |
|
422 * an empty string |
|
423 */ |
|
424 QString CpProfileModelPrivate::messageTone(int profileId) const |
|
425 { |
|
426 QString messageTone; |
|
427 if(!isValidProfile(profileId)) { |
|
428 return messageTone; |
|
429 } |
|
430 QT_TRAP_THROWING( |
|
431 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
432 CleanupStack::PushL(profileExtend); |
|
433 |
|
434 const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
435 |
|
436 messageTone = XQConversions::s60DescToQString(setTones.MessageAlertTone()); |
|
437 CleanupStack::Pop(); // profileExtend |
|
438 profileExtend->Release(); |
|
439 ) |
279 |
440 |
280 for (TInt i = 0; i < sizeof(ids)/sizeof(ids[0]); ++i) { |
441 return messageTone; |
281 MProfileExtended2 *profileExtend = mProfileList.value(ids[i]); |
442 } |
282 |
443 |
|
444 /* |
|
445 * Set the message tone of a profile, if the profile id is invalid, nothing happens |
|
446 */ |
|
447 void CpProfileModelPrivate::setMessageTone(int profileId, const QString& filePath) |
|
448 { |
|
449 if(!isValidProfile(profileId)) { |
|
450 return; |
|
451 } |
|
452 QT_TRAP_THROWING( |
|
453 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
454 CleanupStack::PushL(profileExtend); |
|
455 MProfileSetTones &setTones = |
|
456 profileExtend->ProfileSetTones(); |
|
457 setTones.SetMessageAlertToneL(*XQConversions::qStringToS60Desc(filePath)); |
|
458 mEngine->CommitChangeL(*profileExtend); |
|
459 CleanupStack::Pop(); // profileExtend |
|
460 profileExtend->Release(); |
|
461 ) |
|
462 } |
|
463 |
|
464 /* |
|
465 * Get the email tone of a profile, if profile id is invalid, return an empty string |
|
466 */ |
|
467 QString CpProfileModelPrivate::emailTone(int profileId) const |
|
468 { |
|
469 QString emailTone; |
|
470 |
|
471 if(!isValidProfile(profileId)) { |
|
472 return emailTone; |
|
473 } |
|
474 QT_TRAP_THROWING( |
|
475 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
476 CleanupStack::PushL(profileExtend); |
|
477 const MProfileExtraTones2 &extTones = |
|
478 profileExtend->ProfileExtraTones2(); |
|
479 |
|
480 emailTone = XQConversions::s60DescToQString(extTones.EmailAlertTone()); |
|
481 CleanupStack::Pop(); // profileExtend |
|
482 profileExtend->Release(); |
|
483 ) |
|
484 return emailTone; |
|
485 } |
|
486 |
|
487 /* |
|
488 * Set the email tone for a profile, if the profile id is invalid, nothing happens |
|
489 */ |
|
490 void CpProfileModelPrivate::setEmailTone(int profileId, const QString& filePath) |
|
491 { |
|
492 if(!isValidProfile(profileId)) { |
|
493 return ; |
|
494 } |
|
495 QT_TRAP_THROWING( |
|
496 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
497 CleanupStack::PushL(profileExtend); |
|
498 MProfileSetExtraTones2 &setExtTones = |
|
499 profileExtend->ProfileSetExtraTones2(); |
|
500 setExtTones.SetEmailAlertToneL(*XQConversions::qStringToS60Desc(filePath)); |
|
501 mEngine->CommitChangeL(*profileExtend); |
|
502 CleanupStack::Pop(); // profileExtend |
|
503 profileExtend->Release(); |
|
504 ) |
|
505 } |
|
506 |
|
507 /* |
|
508 * Get a reminder tone for a profile, if the profile id is invalid, |
|
509 * always return an emtpy string |
|
510 */ |
|
511 QString CpProfileModelPrivate::reminderTone(int profileId) const |
|
512 { |
|
513 QString reminderTone; |
|
514 if(!isValidProfile(profileId)) { |
|
515 return reminderTone; |
|
516 } |
|
517 QT_TRAP_THROWING( |
|
518 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
519 CleanupStack::PushL(profileExtend); |
|
520 const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); |
|
521 |
|
522 reminderTone = XQConversions::s60DescToQString(extTones.ReminderTone()); |
|
523 CleanupStack::Pop(); // profileExtend |
|
524 profileExtend->Release(); |
|
525 ) |
|
526 return reminderTone; |
|
527 } |
|
528 |
|
529 /* |
|
530 * Set a reminder tone for a profile, if the profile id is invalid, |
|
531 * nothing happens |
|
532 */ |
|
533 void CpProfileModelPrivate::setReminderTone(int profileId, const QString& filePath) |
|
534 { |
|
535 if(!isValidProfile(profileId)) { |
|
536 return; |
|
537 } |
|
538 QT_TRAP_THROWING( |
|
539 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
540 CleanupStack::PushL(profileExtend); |
|
541 |
|
542 MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); |
|
543 setExtTones.SetReminderToneL( *XQConversions::qStringToS60Desc(filePath) ); |
|
544 mEngine->CommitChangeL(*profileExtend); |
|
545 CleanupStack::Pop(); // profileExtend |
|
546 profileExtend->Release(); |
|
547 ) |
|
548 } |
|
549 |
|
550 /* |
|
551 * Get the status of notification tone, if the profile id is invalid, |
|
552 * always return false |
|
553 */ |
|
554 bool CpProfileModelPrivate::notificationTone(int profileId) const |
|
555 { |
|
556 bool ret = false; |
|
557 if(!isValidProfile(profileId)) { |
|
558 return false; |
|
559 } |
|
560 QT_TRAP_THROWING( |
|
561 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
562 CleanupStack::PushL(profileExtend); |
|
563 |
|
564 const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
565 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
|
566 ret = toneSettings.iWarningAndGameTones; |
|
567 |
|
568 CleanupStack::Pop(); // profileExtend |
|
569 profileExtend->Release(); |
|
570 ) |
|
571 return ret; |
|
572 } |
|
573 |
|
574 /* |
|
575 * Set the status of notification tone, if the profile id is |
|
576 * invalid, nothing happens |
|
577 */ |
|
578 void CpProfileModelPrivate::setNotificationTone(int profileId, bool isActive) |
|
579 { |
|
580 if(!isValidProfile(profileId)) { |
|
581 return ; |
|
582 } |
|
583 QT_TRAP_THROWING( |
|
584 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
585 CleanupStack::PushL(profileExtend); |
283 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
586 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
284 TRAP_IGNORE( |
587 TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
285 setTones.SetRingingTone1L( *descriptorFromString(filePath) ); |
588 |
286 mEngine ->CommitChangeL(*profileExtend); |
589 toneSettings.iWarningAndGameTones = isActive; |
287 ) |
590 |
288 // ERROR SHOULD BE DEAL HERE OR RETURN A ERROR CODE |
591 mEngine->CommitChangeL(*profileExtend); |
289 } |
592 CleanupStack::Pop(); // profileExtend |
290 } |
593 profileExtend->Release(); |
291 |
594 ) |
292 int CpProfileModelPrivate::masterVolume() const |
595 } |
293 { |
596 /* |
294 int masterVolume = 0; |
597 * Get key & touch screen tone's value, if the profile id |
295 TRAP_IGNORE(masterVolume = mEngine->MasterVolumeL();) |
598 * is invalid, always return 0 |
296 return masterVolume; |
599 */ |
297 } |
600 int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const |
298 |
601 { |
299 void CpProfileModelPrivate::setMasterVolume(int volume) |
602 int level = 0; |
300 { |
603 if(!isValidProfile(profileId)) { |
301 TRAP_IGNORE(mEngine->SetMasterVolumeL( volume );) |
604 return level; |
302 } |
605 } |
303 |
|
304 bool CpProfileModelPrivate::masterVibra() const |
|
305 { |
|
306 bool masterVibra = false; |
|
307 TRAP_IGNORE(masterVibra = mEngine->MasterVibraL();) |
|
308 return masterVibra; |
|
309 } |
|
310 void CpProfileModelPrivate::setMasterVibra(bool isVibra) |
|
311 { |
|
312 TRAP_IGNORE(mEngine->SetMasterVibraL( isVibra );) |
|
313 } |
|
314 |
|
315 bool CpProfileModelPrivate::silenceMode() const |
|
316 { |
|
317 bool isSlience = false; |
|
318 TRAP_IGNORE(isSlience = mEngine->SilenceModeL();) |
|
319 return isSlience; |
|
320 } |
|
321 void CpProfileModelPrivate::setSilenceMode(bool isSilence) |
|
322 { |
|
323 TRAP_IGNORE(mEngine->SetSilenceModeL( isSilence );) |
|
324 } |
|
325 |
|
326 bool CpProfileModelPrivate::offLineMode() const |
|
327 { |
|
328 int offLineMode = 0; |
|
329 // What we should do if we can't set offline mode |
|
330 mOffLineCenRep->Get( KSettingsAirplaneMode, offLineMode ); |
|
331 |
606 |
332 return offLineMode; |
607 QT_TRAP_THROWING( |
333 } |
608 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
334 void CpProfileModelPrivate::setOffLineMode(bool isOffLine) |
609 CleanupStack::PushL(profileExtend); |
335 { |
610 |
336 mOffLineCenRep->Set(KSettingsAirplaneMode, isOffLine); |
611 const MProfileTones &setTones = profileExtend->ProfileTones(); |
337 } |
612 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
338 |
613 |
339 QString CpProfileModelPrivate::ringTone(int profileId) const |
614 // Return only keypad volume, but touch tone volume will be synchronized in |
340 { |
615 // SetKeyTouchScreenTone(), these two settings also have the same default value |
341 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
616 // in cenrep key |
342 const MProfileTones &setTones = profileExtend->ProfileTones(); |
617 level = toneSettings.iKeypadVolume; |
343 |
618 CleanupStack::Pop(); // profileExtend |
344 QString ringTone = stringFromDescriptor(setTones.RingingTone1()); |
619 profileExtend->Release(); |
345 return ringTone; |
620 ) |
346 } |
621 return level; |
347 |
622 } |
348 void CpProfileModelPrivate::setRingTone(int profileId, const QString& filePath) |
623 /* |
349 { |
624 * set key & touch screen tone, if the profile id |
350 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
625 * is invalid, nothing happens |
351 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
626 */ |
352 TRAP_IGNORE( |
627 void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level) |
353 setTones.SetRingingTone1L(*descriptorFromString(filePath)); |
628 { |
354 mEngine->CommitChangeL(*profileExtend); |
629 if(!isValidProfile(profileId)) { |
355 ) |
630 return ; |
356 } |
631 } |
357 |
632 QT_TRAP_THROWING( |
358 QString CpProfileModelPrivate::messageTone(int profileId) const |
633 |
359 { |
634 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
360 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
635 CleanupStack::PushL(profileExtend); |
|
636 MProfileSetTones &setTones = |
|
637 profileExtend->ProfileSetTones(); |
|
638 TProfileToneSettings &toneSettings = |
|
639 setTones.SetToneSettings(); |
|
640 |
|
641 MProfileSetExtraSettings &extraSettings = |
|
642 profileExtend->ProfileSetExtraSettings(); |
|
643 MProfileSetFeedbackSettings &setFeedbackSettings = |
|
644 extraSettings.ProfileSetFeedbackSettings(); |
|
645 |
|
646 // Update the key pad volume and touch tone volume together |
|
647 toneSettings.iKeypadVolume |
|
648 = static_cast<TProfileKeypadVolume> (level); |
|
649 |
|
650 setFeedbackSettings.SetAudioFeedback( |
|
651 static_cast<TProfileAudioFeedback> (level)); |
|
652 |
|
653 mEngine->CommitChangeL(*profileExtend); |
|
654 CleanupStack::Pop(); // profileExtend |
|
655 profileExtend->Release(); |
|
656 ) |
|
657 } |
|
658 |
|
659 /* |
|
660 * Get key touch screen vibra's value of a profile, return 0 if the |
|
661 * profile id is invalid |
|
662 */ |
|
663 int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const |
|
664 { |
|
665 int level = 0; |
|
666 if(!isValidProfile(profileId)) { |
|
667 return level; |
|
668 } |
|
669 QT_TRAP_THROWING( |
|
670 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
671 CleanupStack::PushL(profileExtend); |
|
672 const MProfileExtraSettings &extraSettings = |
|
673 profileExtend->ProfileExtraSettings(); |
|
674 const MProfileFeedbackSettings &feedbackSettings = |
|
675 extraSettings.ProfileFeedbackSettings(); |
|
676 level = feedbackSettings.TactileFeedback(); |
|
677 |
|
678 CleanupStack::Pop(); // profileExtend |
|
679 profileExtend->Release(); |
|
680 ) |
361 |
681 |
362 const MProfileTones &setTones = profileExtend->ProfileTones(); |
682 return level; |
363 |
683 } |
364 QString messageTone = stringFromDescriptor(setTones.MessageAlertTone()); |
684 |
365 |
685 /* |
366 return messageTone; |
686 * Set key & touch screen vibra for a profile, |
367 } |
687 * if the profile id is invalid, nothing happens |
368 |
688 */ |
369 void CpProfileModelPrivate::setMessageTone(int profileId, const QString& filePath) |
689 void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level) |
370 { |
690 { |
371 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
691 if(!isValidProfile(profileId)) { |
372 MProfileSetTones &setTones = |
692 return ; |
373 profileExtend->ProfileSetTones(); |
693 } |
374 TRAP_IGNORE( |
694 QT_TRAP_THROWING( |
375 setTones.SetMessageAlertToneL(*descriptorFromString(filePath)); |
695 MProfileExtended2 *profileExtend = mEngine->Profile2L(profileId); |
|
696 CleanupStack::PushL(profileExtend); |
|
697 |
|
698 MProfileSetExtraSettings &extraSettings = |
|
699 profileExtend->ProfileSetExtraSettings(); |
|
700 MProfileSetFeedbackSettings &setFeedbackSettings = |
|
701 extraSettings.ProfileSetFeedbackSettings(); |
|
702 setFeedbackSettings.SetTactileFeedback( |
|
703 static_cast<TProfileTactileFeedback> (level)); |
376 mEngine->CommitChangeL(*profileExtend); |
704 mEngine->CommitChangeL(*profileExtend); |
377 ) |
705 CleanupStack::Pop(); // profileExtend |
378 } |
706 profileExtend->Release(); |
379 |
|
380 QString CpProfileModelPrivate::emailTone(int profileId) const |
|
381 { |
|
382 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
383 const MProfileExtraTones2 &extTones = |
|
384 profileExtend->ProfileExtraTones2(); |
|
385 |
|
386 QString emailTone = stringFromDescriptor(extTones.EmailAlertTone()); |
|
387 return emailTone; |
|
388 } |
|
389 |
|
390 void CpProfileModelPrivate::setEmailTone(int profileId, const QString& filePath) |
|
391 { |
|
392 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
393 MProfileSetExtraTones2 &setExtTones = |
|
394 profileExtend->ProfileSetExtraTones2(); |
|
395 TRAP_IGNORE ( |
|
396 setExtTones.SetEmailAlertToneL(*descriptorFromString(filePath)); |
|
397 mEngine->CommitChangeL(*profileExtend); |
|
398 ) |
|
399 } |
|
400 |
|
401 QString CpProfileModelPrivate::reminderTone(int profileId) const |
|
402 { |
|
403 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
404 const MProfileExtraTones2 &extTones = profileExtend->ProfileExtraTones2(); |
|
405 |
|
406 QString reminderTone = stringFromDescriptor(extTones.ReminderTone()); |
|
407 return reminderTone; |
|
408 } |
|
409 |
|
410 void CpProfileModelPrivate::setReminderTone(int profileId, const QString& filePath) |
|
411 { |
|
412 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
413 MProfileSetExtraTones2 &setExtTones = profileExtend->ProfileSetExtraTones2(); |
|
414 |
|
415 TRAP_IGNORE( |
|
416 setExtTones.SetReminderToneL( *descriptorFromString(filePath) ); |
|
417 mEngine->CommitChangeL(*profileExtend); |
|
418 ) |
|
419 } |
|
420 |
|
421 bool CpProfileModelPrivate::notificationTone(int profileId) const |
|
422 { |
|
423 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
424 const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
425 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
|
426 |
|
427 bool notificationTone = toneSettings.iWarningAndGameTones; |
|
428 return notificationTone; |
|
429 } |
|
430 |
|
431 void CpProfileModelPrivate::setNotificationTone(int profileId, bool isActive) |
|
432 { |
|
433 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
434 MProfileSetTones &setTones = profileExtend->ProfileSetTones(); |
|
435 TProfileToneSettings &toneSettings = setTones.SetToneSettings(); |
|
436 |
|
437 toneSettings.iWarningAndGameTones = isActive; |
|
438 TRAP_IGNORE( |
|
439 mEngine->CommitChangeL(*profileExtend); |
|
440 ) |
|
441 } |
|
442 /*! |
|
443 return key & touch screen tone's value |
|
444 \sa setKeyTouchScreenTone |
|
445 */ |
|
446 int CpProfileModelPrivate::keyTouchScreenTone(int profileId) const |
|
447 { |
|
448 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
449 |
|
450 const MProfileTones &setTones = profileExtend->ProfileTones(); |
|
451 const TProfileToneSettings &toneSettings = setTones.ToneSettings(); |
|
452 |
|
453 int keyTouchScreenTone = toneSettings.iKeypadVolume; |
|
454 return keyTouchScreenTone; |
|
455 } |
|
456 /*! |
|
457 set key & touch screen tone |
|
458 \param profileId identify the profile |
|
459 \param level 0-5 |
|
460 \sa keyTouchScreenTone |
|
461 */ |
|
462 void CpProfileModelPrivate::setKeyTouchScreenTone(int profileId, int level) |
|
463 { |
|
464 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
465 MProfileSetTones &setTones = |
|
466 profileExtend->ProfileSetTones(); |
|
467 TProfileToneSettings &toneSettings = |
|
468 setTones.SetToneSettings(); |
|
469 |
|
470 MProfileSetExtraSettings &extraSettings = |
|
471 profileExtend->ProfileSetExtraSettings(); |
|
472 MProfileSetFeedbackSettings &setFeedbackSettings = |
|
473 extraSettings.ProfileSetFeedbackSettings(); |
|
474 |
|
475 toneSettings.iKeypadVolume |
|
476 = static_cast<TProfileKeypadVolume> (level); |
|
477 |
|
478 setFeedbackSettings.SetAudioFeedback( |
|
479 static_cast<TProfileAudioFeedback> (level)); |
|
480 TRAP_IGNORE ( |
|
481 mEngine->CommitChangeL(*profileExtend); |
|
482 ) |
|
483 } |
|
484 |
|
485 bool CpProfileModelPrivate::ringAlertVibra(int profileId) const |
|
486 { |
|
487 MProfileExtended2 *profileExtend = 0; |
|
488 TRAPD(err, |
|
489 profileExtend = mEngine->Profile2L(profileId); |
|
490 //CleanupReleasePushL(*profileExtend); |
|
491 ) |
|
492 if (err != KErrNone) { |
|
493 return false; |
|
494 } |
|
495 CleanupReleasePushL(*profileExtend); |
|
496 const MProfileVibraSettings &vibraSettings = |
|
497 profileExtend->ProfileVibraSettings(); |
|
498 |
|
499 |
|
500 bool ringAlertVibra = vibraSettings.RingAlertVibra(); |
|
501 CleanupStack::PopAndDestroy(profileExtend); |
|
502 return ringAlertVibra; |
|
503 |
|
504 } |
|
505 |
|
506 void CpProfileModelPrivate::setRingAlertVibra(int profileId, bool isActive) |
|
507 { |
|
508 MProfileExtended2 *profileExtend = 0; |
|
509 TRAPD( err, |
|
510 profileExtend = mEngine->Profile2L(profileId); |
|
511 //CleanupReleasePushL(*profileExtend); |
|
512 ) |
|
513 if (err==KErrNone) { |
|
514 CleanupReleasePushL(*profileExtend); |
|
515 MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); |
|
516 |
|
517 setVibraSettings.SetRingAlertVibra(isActive); |
|
518 |
|
519 TRAP_IGNORE( |
|
520 mEngine->CommitChangeL(*profileExtend); |
|
521 ) |
|
522 CleanupStack::PopAndDestroy(profileExtend); |
|
523 } |
|
524 } |
|
525 |
|
526 bool CpProfileModelPrivate::messageVibra(int profileId) const |
|
527 { |
|
528 MProfileExtended2 *profileExtend = 0; |
|
529 TRAPD(err, |
|
530 profileExtend = mEngine->Profile2L(profileId); |
|
531 //CleanupReleasePushL(*profileExtend); |
|
532 ) |
|
533 if (err != KErrNone) { |
|
534 return false; |
|
535 } |
|
536 CleanupReleasePushL(*profileExtend); |
|
537 const MProfileVibraSettings &vibraSettings = |
|
538 profileExtend->ProfileVibraSettings(); |
|
539 |
|
540 |
|
541 bool messageVibra = vibraSettings.MessageAlertVibra(); |
|
542 CleanupStack::PopAndDestroy(profileExtend); |
|
543 return messageVibra; |
|
544 |
|
545 } |
|
546 |
|
547 void CpProfileModelPrivate::setMessageVibra(int profileId, bool isActive) |
|
548 { |
|
549 MProfileExtended2 *profileExtend = 0; |
|
550 TRAPD( err, |
|
551 profileExtend = mEngine->Profile2L(profileId); |
|
552 //CleanupReleasePushL(*profileExtend); |
|
553 ) |
|
554 if (err==KErrNone) { |
|
555 CleanupReleasePushL(*profileExtend); |
|
556 MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); |
|
557 |
|
558 setVibraSettings.SetMessageAlertVibra(isActive); |
|
559 |
|
560 TRAP_IGNORE( |
|
561 mEngine->CommitChangeL(*profileExtend); |
|
562 ) |
|
563 CleanupStack::PopAndDestroy(profileExtend); |
|
564 } |
|
565 } |
|
566 |
|
567 bool CpProfileModelPrivate::emailVibra(int profileId) const |
|
568 { |
|
569 MProfileExtended2 *profileExtend = 0; |
|
570 TRAPD(err, |
|
571 profileExtend = mEngine->Profile2L(profileId); |
|
572 //CleanupReleasePushL(*profileExtend); |
|
573 ) |
|
574 if (err != KErrNone) { |
|
575 return false; |
|
576 } |
|
577 CleanupReleasePushL(*profileExtend); |
|
578 const MProfileVibraSettings &vibraSettings = |
|
579 profileExtend->ProfileVibraSettings(); |
|
580 |
|
581 |
|
582 bool emailVibra = vibraSettings.EmailAlertVibra(); |
|
583 |
|
584 CleanupStack::PopAndDestroy(profileExtend); |
|
585 return emailVibra; |
|
586 |
|
587 } |
|
588 |
|
589 void CpProfileModelPrivate::setEmailVibra(int profileId, bool isActive) |
|
590 { |
|
591 MProfileExtended2 *profileExtend = 0; |
|
592 TRAPD( err, |
|
593 profileExtend = mEngine->Profile2L(profileId); |
|
594 //CleanupReleasePushL(*profileExtend); |
|
595 ) |
|
596 if (err==KErrNone) { |
|
597 CleanupReleasePushL(*profileExtend); |
|
598 MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); |
|
599 |
|
600 setVibraSettings.SetEmailAlertVibra ( isActive ); |
|
601 |
|
602 TRAP_IGNORE( |
|
603 mEngine->CommitChangeL(*profileExtend); |
|
604 ) |
|
605 CleanupStack::PopAndDestroy(profileExtend); |
|
606 } |
|
607 } |
|
608 |
|
609 bool CpProfileModelPrivate::reminderVibra(int profileId) const |
|
610 { |
|
611 MProfileExtended2 *profileExtend = 0; |
|
612 TRAPD(err, |
|
613 profileExtend = mEngine->Profile2L(profileId); |
|
614 //CleanupReleasePushL(*profileExtend); |
|
615 ) |
|
616 if (err != KErrNone) { |
|
617 return false; |
|
618 } |
|
619 CleanupReleasePushL(*profileExtend); |
|
620 const MProfileVibraSettings &vibraSettings = |
|
621 profileExtend->ProfileVibraSettings(); |
|
622 |
|
623 |
|
624 bool reminderAlarmVibra = vibraSettings.ReminderAlarmVibra(); |
|
625 |
|
626 CleanupStack::PopAndDestroy(profileExtend); |
|
627 return reminderAlarmVibra; |
|
628 |
|
629 } |
|
630 |
|
631 void CpProfileModelPrivate::setReminderVibra(int profileId, bool isActive) |
|
632 { |
|
633 MProfileExtended2 *profileExtend = 0; |
|
634 TRAPD( err, |
|
635 profileExtend = mEngine->Profile2L(profileId); |
|
636 //CleanupReleasePushL(*profileExtend); |
|
637 ) |
|
638 if (err==KErrNone) { |
|
639 CleanupReleasePushL(*profileExtend); |
|
640 MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); |
|
641 |
|
642 setVibraSettings.SetReminderAlarmVibra ( isActive ); |
|
643 |
|
644 TRAP_IGNORE( |
|
645 mEngine->CommitChangeL(*profileExtend); |
|
646 ) |
|
647 CleanupStack::PopAndDestroy(profileExtend); |
|
648 } |
|
649 } |
|
650 |
|
651 bool CpProfileModelPrivate::notificationVibra(int profileId) const |
|
652 { |
|
653 MProfileExtended2 *profileExtend = 0; |
|
654 TRAPD(err, |
|
655 profileExtend = mEngine->Profile2L(profileId); |
|
656 //CleanupReleasePushL(*profileExtend); |
|
657 ) |
|
658 if (err != KErrNone) { |
|
659 return false; |
|
660 } |
|
661 CleanupReleasePushL(*profileExtend); |
|
662 const MProfileVibraSettings &vibraSettings = |
|
663 profileExtend->ProfileVibraSettings(); |
|
664 |
|
665 |
|
666 bool notificationVibra = vibraSettings.InformationVibra(); |
|
667 |
|
668 CleanupStack::PopAndDestroy(profileExtend); |
|
669 return notificationVibra; |
|
670 |
|
671 } |
|
672 |
|
673 void CpProfileModelPrivate::setNotificationVibra(int profileId, bool isActive) |
|
674 { |
|
675 MProfileExtended2 *profileExtend = 0; |
|
676 TRAPD( err, |
|
677 profileExtend = mEngine->Profile2L(profileId); |
|
678 //CleanupReleasePushL(*profileExtend); |
|
679 ) |
|
680 if (err==KErrNone) { |
|
681 CleanupReleasePushL(*profileExtend); |
|
682 MProfileSetVibraSettings &setVibraSettings = profileExtend->ProfileSetVibraSettings(); |
|
683 |
|
684 setVibraSettings.SetInformationVibra( isActive ); |
|
685 |
|
686 TRAP_IGNORE( |
|
687 mEngine->CommitChangeL(*profileExtend); |
|
688 ) |
|
689 CleanupStack::PopAndDestroy(profileExtend); |
|
690 } |
|
691 } |
|
692 |
|
693 int CpProfileModelPrivate::keyTouchScreenVibra(int profileId)const |
|
694 { |
|
695 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
696 |
|
697 const MProfileExtraSettings &extraSettings = |
|
698 profileExtend->ProfileExtraSettings(); |
|
699 const MProfileFeedbackSettings &feedbackSettings = |
|
700 extraSettings.ProfileFeedbackSettings(); |
|
701 |
|
702 int keyTouchScreenVibra = feedbackSettings.TactileFeedback(); |
|
703 return keyTouchScreenVibra; |
|
704 } |
|
705 |
|
706 void CpProfileModelPrivate::setKeyTouchScreenVibra(int profileId, int level) |
|
707 { |
|
708 MProfileExtended2 *profileExtend = mProfileList.value(profileId); |
|
709 MProfileSetExtraSettings &extraSettings = |
|
710 profileExtend->ProfileSetExtraSettings(); |
|
711 MProfileSetFeedbackSettings &setFeedbackSettings = |
|
712 extraSettings.ProfileSetFeedbackSettings(); |
|
713 setFeedbackSettings.SetTactileFeedback( |
|
714 static_cast<TProfileTactileFeedback> (level)); |
|
715 |
|
716 TRAP_IGNORE( |
|
717 mEngine->CommitChangeL(*profileExtend); |
|
718 ) |
707 ) |
719 } |
708 } |
720 |
709 |
|
710 /* |
|
711 * Judge the profile is valid or not |
|
712 */ |
|
713 |
|
714 bool CpProfileModelPrivate::isValidProfile(int profileId) const |
|
715 { |
|
716 return mProfileList.contains(profileId); |
|
717 } |
|
718 |
721 // End of file |
719 // End of file |
722 |
720 |
723 |
721 |