|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description:This class provides API m/w for msg settings plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "qstringlist.h" |
|
19 #include "debugtraces.h" |
|
20 |
|
21 |
|
22 #include "msgsettingengine.h" |
|
23 #include "smssettingsprivate.h" |
|
24 #include "mmssettingprivate.h" |
|
25 #include "s60qconversions.h" |
|
26 |
|
27 //Constructor |
|
28 MsgSettingEngine::MsgSettingEngine() |
|
29 { |
|
30 #ifdef _DEBUG_TRACES_ |
|
31 qDebug() << "Enter MsgSettingEngine::MsgSettingEngine"; |
|
32 #endif |
|
33 |
|
34 |
|
35 dptr_smsSettings = SmsSettingsPrivate::NewL(); |
|
36 dptr_mmsSettings = MmsSettingsPrivate::NewL(); |
|
37 |
|
38 #ifdef _DEBUG_TRACES_ |
|
39 qDebug() << "Exit MsgSettingEngine::MsgSettingEngine"; |
|
40 #endif |
|
41 |
|
42 } |
|
43 |
|
44 //Destructor |
|
45 MsgSettingEngine::~MsgSettingEngine() |
|
46 { |
|
47 #ifdef _DEBUG_TRACES_ |
|
48 qDebug() << "Enter MsgSettingEngine::~MsgSettingEngine"; |
|
49 #endif |
|
50 |
|
51 |
|
52 delete dptr_smsSettings; |
|
53 delete dptr_mmsSettings; |
|
54 |
|
55 #ifdef _DEBUG_TRACES_ |
|
56 qDebug() << "Exit MsgSettingEngine::~MsgSettingEngine"; |
|
57 #endif |
|
58 |
|
59 } |
|
60 |
|
61 /** |
|
62 * for basic message settings |
|
63 * set the service messages status |
|
64 * @param serviceMessages bool true or false |
|
65 */ |
|
66 void MsgSettingEngine::setReceiveSerivceMessages(bool serviceMessages) |
|
67 { |
|
68 dptr_smsSettings->setReceiveSerivceMessages(serviceMessages); |
|
69 |
|
70 } |
|
71 |
|
72 /** |
|
73 * set the character encoding |
|
74 * @param encoding specifying encoding type |
|
75 */ |
|
76 void MsgSettingEngine::setCharacterEncoding(MsgSettingEngine::CharacterEncoding encoding) |
|
77 { |
|
78 #ifdef _DEBUG_TRACES_ |
|
79 qDebug() << "MsgSettingEngine::setCharacterEncoding: " << encoding; |
|
80 #endif |
|
81 |
|
82 |
|
83 TBool flag = EFalse; |
|
84 |
|
85 if (encoding == MsgSettingEngine::FullSupport) |
|
86 { |
|
87 flag = ETrue; |
|
88 } |
|
89 dptr_smsSettings->setCharacterEncoding(flag); |
|
90 |
|
91 #ifdef _DEBUG_TRACES_ |
|
92 qDebug() << "MsgSettingEngine::setCharacterEncoding"; |
|
93 #endif |
|
94 |
|
95 } |
|
96 |
|
97 /** |
|
98 * returns settings delivery report status |
|
99 * and character encoding |
|
100 * @param receiveServiceMessages for getting receive service messages |
|
101 * @param encoding for char encoding |
|
102 */ |
|
103 void MsgSettingEngine::settingsServiceMessagesAndCharEncoding( |
|
104 bool& receiveServiceMessages, |
|
105 MsgSettingEngine::CharacterEncoding& encoding ) |
|
106 { |
|
107 QDEBUG_WRITE("settingsServiceMessagesAndCharEncoding"); |
|
108 |
|
109 TBool encoding1; |
|
110 TBool receiveServiceMessages1; |
|
111 |
|
112 dptr_smsSettings->settingsServiceMessagesAndCharEncoding( |
|
113 receiveServiceMessages1, |
|
114 encoding1); |
|
115 |
|
116 if (encoding1) |
|
117 { |
|
118 encoding = MsgSettingEngine::FullSupport; |
|
119 } |
|
120 else |
|
121 encoding = MsgSettingEngine::ReducedSupport; |
|
122 |
|
123 //TODO remove hardcoding later |
|
124 //receiveServiceMessages = (bool)receiveServiceMessages1; |
|
125 receiveServiceMessages = true; |
|
126 |
|
127 return; |
|
128 } |
|
129 |
|
130 /** |
|
131 * set the mms retrieval mode |
|
132 * @param retrieval specifying mode |
|
133 */ |
|
134 void MsgSettingEngine::setMMSRetrieval(MsgSettingEngine::MmsRetrieval retrieval) |
|
135 { |
|
136 #ifdef _DEBUG_TRACES_ |
|
137 qDebug() << "MsgSettingEngine::setMMSRetrieval " << retrieval; |
|
138 #endif |
|
139 |
|
140 |
|
141 dptr_mmsSettings->setMMSRetrieval(retrieval); |
|
142 |
|
143 #ifdef _DEBUG_TRACES_ |
|
144 qDebug() << "Exit setMMSRetrieval"; |
|
145 #endif |
|
146 |
|
147 } |
|
148 |
|
149 /** |
|
150 * set the anonymous message |
|
151 * @param status true or false |
|
152 */ |
|
153 void MsgSettingEngine::setAnonymousMessages(bool status) |
|
154 { |
|
155 #ifdef _DEBUG_TRACES_ |
|
156 qDebug() << "MsgSettingEngine::setAnonymousMessages " << status; |
|
157 #endif |
|
158 |
|
159 |
|
160 dptr_mmsSettings->setAnonymousMessages(status); |
|
161 |
|
162 #ifdef _DEBUG_TRACES_ |
|
163 qDebug() << "Exit setAnonymousMessages"; |
|
164 #endif |
|
165 |
|
166 } |
|
167 |
|
168 /** |
|
169 * set for receiving MMS Adverts |
|
170 * @param status for true or false |
|
171 */ |
|
172 void MsgSettingEngine::setReceiveMMSAdverts(bool status) |
|
173 { |
|
174 #ifdef _DEBUG_TRACES_ |
|
175 qDebug() << "MsgSettingEngine::setReceiveMMSAdverts " << status; |
|
176 #endif |
|
177 |
|
178 |
|
179 dptr_mmsSettings->setReceiveMMSAdverts(status); |
|
180 |
|
181 #ifdef _DEBUG_TRACES_ |
|
182 qDebug() << "Exit setReceiveMMSAdverts"; |
|
183 #endif |
|
184 |
|
185 } |
|
186 |
|
187 /** |
|
188 * for view 2 mms advance settings\ |
|
189 * get all the fields of mms advance setting |
|
190 * @param retrieval return for mms retrieval |
|
191 * @param anonymous return status true or false |
|
192 * @param mmsadverts return status true or false |
|
193 */ |
|
194 void MsgSettingEngine::advanceMmsSettings(MsgSettingEngine::MmsRetrieval& retrieval, |
|
195 bool& anonymousStatus, |
|
196 bool& mmsAdvertsStatus) |
|
197 { |
|
198 #ifdef _DEBUG_TRACES_ |
|
199 qDebug() << "MsgSettingEngine::setReceiveMMSAdverts"; |
|
200 #endif |
|
201 |
|
202 |
|
203 TBool anonymous_Status; |
|
204 TBool mmsAdverts_Status; |
|
205 dptr_mmsSettings->advanceMmsSettings(retrieval, |
|
206 anonymous_Status, |
|
207 mmsAdverts_Status); |
|
208 |
|
209 anonymousStatus = (bool) anonymous_Status; |
|
210 mmsAdvertsStatus = (bool) mmsAdverts_Status; |
|
211 |
|
212 #ifdef _DEBUG_TRACES_ |
|
213 qDebug() << "Exit setReceiveMMSAdverts " << retrieval << " " |
|
214 << anonymousStatus << " " << mmsAdvertsStatus; |
|
215 #endif |
|
216 |
|
217 } |
|
218 |
|
219 /** |
|
220 * get all the MMs access points |
|
221 * @param returns all the access point names |
|
222 * @attention to be displayed as per the index o to total count |
|
223 */ |
|
224 void MsgSettingEngine::allMMsAcessPoints(QStringList& nameList, |
|
225 int& defaultIndex) |
|
226 { |
|
227 #ifdef _DEBUG_TRACES_ |
|
228 qDebug() << "MsgSettingEngine::allMMsAcessPoints"; |
|
229 #endif |
|
230 |
|
231 |
|
232 RPointerArray<HBufC> accessPoints; |
|
233 //= new(ELeave)RPointerArray<HBufC>(); |
|
234 |
|
235 dptr_mmsSettings->getAllAccessPoints(accessPoints, defaultIndex); |
|
236 |
|
237 for (int i = 0; i < accessPoints.Count(); i++) |
|
238 { |
|
239 HBufC* name = static_cast<HBufC *> (accessPoints[i]); |
|
240 QString qName = S60QConversions::s60DescToQString(name->Des()); |
|
241 nameList.append(qName); |
|
242 #ifdef _DEBUG_TRACES_ |
|
243 qDebug() << "\n " << qName; |
|
244 #endif |
|
245 |
|
246 } |
|
247 accessPoints.ResetAndDestroy(); |
|
248 |
|
249 #ifdef _DEBUG_TRACES_ |
|
250 qDebug() << "Exit allMMsAcessPoints count = " << nameList.count() |
|
251 << " Default:" << defaultIndex; |
|
252 #endif |
|
253 |
|
254 } |
|
255 |
|
256 /** |
|
257 * set the default access point |
|
258 * @param index specifying the index |
|
259 */ |
|
260 void MsgSettingEngine::setMMSAccesspoint(int index) |
|
261 { |
|
262 #ifdef _DEBUG_TRACES_ |
|
263 qDebug() << "MsgSettingEngine::setMMSAccesspoint " << index; |
|
264 #endif |
|
265 |
|
266 |
|
267 dptr_mmsSettings->setMMSAccesspoint(index); |
|
268 |
|
269 #ifdef _DEBUG_TRACES_ |
|
270 qDebug() << "Exit setMMSAccesspoint "; |
|
271 #endif |
|
272 |
|
273 } |
|
274 |
|
275 /** |
|
276 * get the list of all SMS Message Centres |
|
277 * @param list of all names QString |
|
278 */ |
|
279 void MsgSettingEngine::allSMSMessageCenter(QStringList& nameList, |
|
280 int& defaultIndex) |
|
281 { |
|
282 |
|
283 #ifdef _DEBUG_TRACES_ |
|
284 qDebug() << "MsgSettingEngine::allSMSMessageCenter"; |
|
285 #endif |
|
286 |
|
287 |
|
288 RPointerArray<HBufC> accessPoints; |
|
289 |
|
290 dptr_smsSettings->getAllSMSMessageCenter(accessPoints, defaultIndex); |
|
291 |
|
292 for (int i = 0; i < accessPoints.Count(); i++) |
|
293 { |
|
294 HBufC* name = accessPoints[i]; |
|
295 QString qName = S60QConversions::s60DescToQString(name->Des()); |
|
296 nameList.append(qName); |
|
297 #ifdef _DEBUG_TRACES_ |
|
298 qDebug() << "\n qName"; |
|
299 #endif |
|
300 |
|
301 } |
|
302 accessPoints.ResetAndDestroy(); |
|
303 |
|
304 #ifdef _DEBUG_TRACES_ |
|
305 qDebug() << "Exit allSMSMessageCenter count = " << nameList.count() |
|
306 << " Default:" << defaultIndex; |
|
307 #endif |
|
308 |
|
309 } |
|
310 |
|
311 /** |
|
312 * set the default SMS message centre |
|
313 * @param index specifying default index |
|
314 */ |
|
315 void MsgSettingEngine::setSMSMessageCenter(int index) |
|
316 { |
|
317 #ifdef _DEBUG_TRACES_ |
|
318 qDebug() << "MsgSettingEngine::setSMSMessageCenter " << index; |
|
319 #endif |
|
320 |
|
321 |
|
322 dptr_smsSettings->setSMSMessageCenter(index); |
|
323 |
|
324 #ifdef _DEBUG_TRACES_ |
|
325 qDebug() << "Exit setSMSMessageCenter "; |
|
326 #endif |
|
327 |
|
328 } |
|
329 |
|
330 /** |
|
331 * for editing the SMS messafe Centre |
|
332 * @param name specifying center name |
|
333 * @param number specifying center number |
|
334 * @param index specying index of message list |
|
335 */ |
|
336 void MsgSettingEngine::editSmsMessageCenter(QString& centreName, |
|
337 QString& centreNumber, int index) |
|
338 { |
|
339 #ifdef _DEBUG_TRACES_ |
|
340 qDebug() << "MsgSettingEngine::editSmsMessageCenter " << index << " " |
|
341 << centreName << " " << centreNumber; |
|
342 #endif |
|
343 |
|
344 HBufC* d_addr = S60QConversions::qStringToS60Desc(centreNumber); |
|
345 HBufC* d_name = S60QConversions::qStringToS60Desc(centreName); |
|
346 |
|
347 dptr_smsSettings->editSMSServiceCentre(d_addr, d_name, index); |
|
348 delete d_addr; |
|
349 delete d_name; |
|
350 |
|
351 #ifdef _DEBUG_TRACES_ |
|
352 qDebug() << "Exit editSmsMessageCenter "; |
|
353 #endif |
|
354 |
|
355 } |
|
356 |
|
357 /** |
|
358 * for add new sms message centre |
|
359 * @param name specifying center name |
|
360 * @param number specifying center number |
|
361 */ |
|
362 void MsgSettingEngine::addSmsMessageCenter(QString& centreName, |
|
363 QString& centreNumber) |
|
364 { |
|
365 #ifdef _DEBUG_TRACES_ |
|
366 qDebug() << "MsgSettingEngine::addSmsMessageCenter " << centreName << " " |
|
367 << centreNumber; |
|
368 #endif |
|
369 |
|
370 |
|
371 HBufC* d_addr = S60QConversions::qStringToS60Desc(centreNumber); |
|
372 HBufC* d_name = S60QConversions::qStringToS60Desc(centreName); |
|
373 |
|
374 dptr_smsSettings->addSmsMessageCenter(d_addr, d_name); |
|
375 delete d_addr; |
|
376 delete d_name; |
|
377 |
|
378 #ifdef _DEBUG_TRACES_ |
|
379 qDebug() << "Exit addSmsMessageCenter "; |
|
380 #endif |
|
381 |
|
382 } |
|
383 |
|
384 /** |
|
385 * for delete sms message centre |
|
386 * @refer to header file |
|
387 */ |
|
388 void MsgSettingEngine::deleteSmsMessageCenter(int deleteIndex) |
|
389 { |
|
390 dptr_smsSettings->deleteSmsMessageCenter(deleteIndex); |
|
391 } |
|
392 |
|
393 /** |
|
394 * get the sms message centre namd and number |
|
395 * @index for which center needs |
|
396 * @param return name specifying center name |
|
397 * @param return number specifying center number |
|
398 */ |
|
399 void MsgSettingEngine::smsCenterNameAndNumber(int index, QString& centreName, |
|
400 QString& centreNumber) |
|
401 { |
|
402 #ifdef _DEBUG_TRACES_ |
|
403 qDebug() << "MsgSettingEngine::smsCenterNameAndNumber " << index; |
|
404 #endif |
|
405 |
|
406 |
|
407 HBufC* d_addr; |
|
408 HBufC* d_name; |
|
409 |
|
410 dptr_smsSettings->smsCenterNameAndNumber(index, &d_addr, &d_name); |
|
411 |
|
412 centreNumber = S60QConversions::s60DescToQString(d_addr->Des()); |
|
413 centreName = S60QConversions::s60DescToQString(d_name->Des()); |
|
414 |
|
415 #ifdef _DEBUG_TRACES_ |
|
416 qDebug() << "Exit smsCenterNameAndNumber " << centreNumber << " " |
|
417 << centreName; |
|
418 #endif |
|
419 |
|
420 } |
|
421 |
|
422 //eof |
|
423 |