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 deliver report |
|
64 * @param report bool true or false |
|
65 */ |
|
66 void MsgSettingEngine::setDeliveryReport(bool report) |
|
67 { |
|
68 #ifdef _DEBUG_TRACES_ |
|
69 qDebug() << "MsgSettingEngine::setDeliveryReport" << report; |
|
70 #endif |
|
71 |
|
72 |
|
73 dptr_smsSettings->setDeliveryReport(report); |
|
74 dptr_mmsSettings->setDeliveryReport(report); |
|
75 |
|
76 #ifdef _DEBUG_TRACES_ |
|
77 qDebug() << "Exit MsgSettingEngine::setDeliveryReport"; |
|
78 #endif |
|
79 |
|
80 } |
|
81 |
|
82 /** |
|
83 * set the character encoding |
|
84 * @param encoding specifying encoding type |
|
85 */ |
|
86 void MsgSettingEngine::setCharacterEncoding(MsgSettingEngine::CharacterEncoding encoding) |
|
87 { |
|
88 #ifdef _DEBUG_TRACES_ |
|
89 qDebug() << "MsgSettingEngine::setCharacterEncoding: " << encoding; |
|
90 #endif |
|
91 |
|
92 |
|
93 TBool flag = EFalse; |
|
94 |
|
95 if (encoding == MsgSettingEngine::FullSupport) |
|
96 { |
|
97 flag = ETrue; |
|
98 } |
|
99 dptr_smsSettings->setCharacterEncoding(flag); |
|
100 dptr_mmsSettings->setCharacterEncoding(flag); |
|
101 |
|
102 #ifdef _DEBUG_TRACES_ |
|
103 qDebug() << "MsgSettingEngine::setCharacterEncoding"; |
|
104 #endif |
|
105 |
|
106 } |
|
107 |
|
108 /** |
|
109 * returns settings delivery report status |
|
110 * and character encoding |
|
111 * @param report for getting status report |
|
112 * @param encoding for char encoding |
|
113 */ |
|
114 void MsgSettingEngine::settingsDeliverReportAndCharEncoding( bool& report, |
|
115 MsgSettingEngine::CharacterEncoding& encoding ) |
|
116 { |
|
117 #ifdef _DEBUG_TRACES_ |
|
118 qDebug() << "Enter MsgSettingEngine::settingsDeliverReportAndCharEncoding"; |
|
119 #endif |
|
120 |
|
121 |
|
122 TBool encodingStatus1; |
|
123 TBool encodingStatus2; |
|
124 TBool report1; |
|
125 TBool report2; |
|
126 |
|
127 dptr_smsSettings->settingsDeliverReportAndCharEncoding(report1, |
|
128 encodingStatus1); |
|
129 |
|
130 dptr_mmsSettings->settingsDeliverReportAndCharEncoding(report2, |
|
131 encodingStatus2); |
|
132 |
|
133 report = report1 && report2; |
|
134 |
|
135 encoding = MsgSettingEngine::ReducedSupport; |
|
136 if (encodingStatus1 && encodingStatus2) |
|
137 { |
|
138 encoding = MsgSettingEngine::FullSupport; |
|
139 } |
|
140 |
|
141 #ifdef _DEBUG_TRACES_ |
|
142 qDebug() << "Exit settingsDeliverReportAndCharEncoding: " << report << " " |
|
143 << encoding; |
|
144 #endif |
|
145 |
|
146 } |
|
147 |
|
148 /** |
|
149 * for advanced settings |
|
150 * set the creation mode |
|
151 * @mode for creation mode |
|
152 */ |
|
153 void MsgSettingEngine::setMMSCreationmode(MsgSettingEngine::MmsCreationMode mode) |
|
154 { |
|
155 #ifdef _DEBUG_TRACES_ |
|
156 qDebug() << "MsgSettingEngine::setMMSCreationmode " << mode; |
|
157 #endif |
|
158 |
|
159 |
|
160 dptr_mmsSettings->setMMSCreationmode(mode); |
|
161 |
|
162 #ifdef _DEBUG_TRACES_ |
|
163 qDebug() << "Exit setMMSCreationmode"; |
|
164 #endif |
|
165 |
|
166 } |
|
167 |
|
168 /** |
|
169 * set the mms retrieval mode |
|
170 * @param retrieval specifying mode |
|
171 */ |
|
172 void MsgSettingEngine::setMMSRetrieval(MsgSettingEngine::MmsRetrieval retrieval) |
|
173 { |
|
174 #ifdef _DEBUG_TRACES_ |
|
175 qDebug() << "MsgSettingEngine::setMMSRetrieval " << retrieval; |
|
176 #endif |
|
177 |
|
178 |
|
179 dptr_mmsSettings->setMMSRetrieval(retrieval); |
|
180 |
|
181 #ifdef _DEBUG_TRACES_ |
|
182 qDebug() << "Exit setMMSRetrieval"; |
|
183 #endif |
|
184 |
|
185 } |
|
186 |
|
187 /** |
|
188 * set the anonymous message |
|
189 * @param status true or false |
|
190 */ |
|
191 void MsgSettingEngine::setAnonymousMessages(bool status) |
|
192 { |
|
193 #ifdef _DEBUG_TRACES_ |
|
194 qDebug() << "MsgSettingEngine::setAnonymousMessages " << status; |
|
195 #endif |
|
196 |
|
197 |
|
198 dptr_mmsSettings->setAnonymousMessages(status); |
|
199 |
|
200 #ifdef _DEBUG_TRACES_ |
|
201 qDebug() << "Exit setAnonymousMessages"; |
|
202 #endif |
|
203 |
|
204 } |
|
205 |
|
206 /** |
|
207 * set for receiving MMS Adverts |
|
208 * @param status for true or false |
|
209 */ |
|
210 void MsgSettingEngine::setReceiveMMSAdverts(bool status) |
|
211 { |
|
212 #ifdef _DEBUG_TRACES_ |
|
213 qDebug() << "MsgSettingEngine::setReceiveMMSAdverts " << status; |
|
214 #endif |
|
215 |
|
216 |
|
217 dptr_mmsSettings->setReceiveMMSAdverts(status); |
|
218 |
|
219 #ifdef _DEBUG_TRACES_ |
|
220 qDebug() << "Exit setReceiveMMSAdverts"; |
|
221 #endif |
|
222 |
|
223 } |
|
224 |
|
225 /** |
|
226 * for view 2 mms advance settings\ |
|
227 * get all the fields of mms advance setting |
|
228 * @param mode return for MMsCreation mode |
|
229 * @param retrieval return for mms retrieval |
|
230 * @param anonymous return status true or false |
|
231 * @param mmsadverts return status true or false |
|
232 */ |
|
233 void MsgSettingEngine::advanceMmsSettings(MsgSettingEngine::MmsCreationMode& mode, |
|
234 MsgSettingEngine::MmsRetrieval& retrieval, |
|
235 bool& anonymousStatus, |
|
236 bool& mmsAdvertsStatus) |
|
237 { |
|
238 #ifdef _DEBUG_TRACES_ |
|
239 qDebug() << "MsgSettingEngine::setReceiveMMSAdverts"; |
|
240 #endif |
|
241 |
|
242 |
|
243 TBool anonymous_Status; |
|
244 TBool mmsAdverts_Status; |
|
245 dptr_mmsSettings->advanceMmsSettings(mode, |
|
246 retrieval, |
|
247 anonymous_Status, |
|
248 mmsAdverts_Status); |
|
249 |
|
250 anonymousStatus = (bool) anonymous_Status; |
|
251 mmsAdvertsStatus = (bool) mmsAdverts_Status; |
|
252 |
|
253 #ifdef _DEBUG_TRACES_ |
|
254 qDebug() << "Exit setReceiveMMSAdverts " << mode << " " << retrieval << " " |
|
255 << anonymousStatus << " " << mmsAdvertsStatus; |
|
256 #endif |
|
257 |
|
258 } |
|
259 |
|
260 /** |
|
261 * get all the MMs access points |
|
262 * @param returns all the access point names |
|
263 * @attention to be displayed as per the index o to total count |
|
264 */ |
|
265 void MsgSettingEngine::allMMsAcessPoints(QStringList& nameList, |
|
266 int& defaultIndex) |
|
267 { |
|
268 #ifdef _DEBUG_TRACES_ |
|
269 qDebug() << "MsgSettingEngine::allMMsAcessPoints"; |
|
270 #endif |
|
271 |
|
272 |
|
273 RPointerArray<HBufC> accessPoints; |
|
274 //= new(ELeave)RPointerArray<HBufC>(); |
|
275 |
|
276 dptr_mmsSettings->getAllAccessPoints(accessPoints, defaultIndex); |
|
277 |
|
278 for (int i = 0; i < accessPoints.Count(); i++) |
|
279 { |
|
280 HBufC* name = static_cast<HBufC *> (accessPoints[i]); |
|
281 QString qName = S60QConversions::s60DescToQString(name->Des()); |
|
282 nameList.append(qName); |
|
283 #ifdef _DEBUG_TRACES_ |
|
284 qDebug() << "\n " << qName; |
|
285 #endif |
|
286 |
|
287 } |
|
288 accessPoints.ResetAndDestroy(); |
|
289 |
|
290 #ifdef _DEBUG_TRACES_ |
|
291 qDebug() << "Exit allMMsAcessPoints count = " << nameList.count() |
|
292 << " Default:" << defaultIndex; |
|
293 #endif |
|
294 |
|
295 } |
|
296 |
|
297 /** |
|
298 * set the default access point |
|
299 * @param index specifying the index |
|
300 */ |
|
301 void MsgSettingEngine::setMMSAccesspoint(int index) |
|
302 { |
|
303 #ifdef _DEBUG_TRACES_ |
|
304 qDebug() << "MsgSettingEngine::setMMSAccesspoint " << index; |
|
305 #endif |
|
306 |
|
307 |
|
308 dptr_mmsSettings->setMMSAccesspoint(index); |
|
309 |
|
310 #ifdef _DEBUG_TRACES_ |
|
311 qDebug() << "Exit setMMSAccesspoint "; |
|
312 #endif |
|
313 |
|
314 } |
|
315 |
|
316 /** |
|
317 * get the list of all SMS Message Centres |
|
318 * @param list of all names QString |
|
319 */ |
|
320 void MsgSettingEngine::allSMSMessageCenter(QStringList& nameList, |
|
321 int& defaultIndex) |
|
322 { |
|
323 |
|
324 #ifdef _DEBUG_TRACES_ |
|
325 qDebug() << "MsgSettingEngine::allSMSMessageCenter"; |
|
326 #endif |
|
327 |
|
328 |
|
329 RPointerArray<HBufC> accessPoints; |
|
330 |
|
331 dptr_smsSettings->getAllSMSMessageCenter(accessPoints, defaultIndex); |
|
332 |
|
333 for (int i = 0; i < accessPoints.Count(); i++) |
|
334 { |
|
335 HBufC* name = accessPoints[i]; |
|
336 QString qName = S60QConversions::s60DescToQString(name->Des()); |
|
337 nameList.append(qName); |
|
338 #ifdef _DEBUG_TRACES_ |
|
339 qDebug() << "\n qName"; |
|
340 #endif |
|
341 |
|
342 } |
|
343 accessPoints.ResetAndDestroy(); |
|
344 |
|
345 #ifdef _DEBUG_TRACES_ |
|
346 qDebug() << "Exit allSMSMessageCenter count = " << nameList.count() |
|
347 << " Default:" << defaultIndex; |
|
348 #endif |
|
349 |
|
350 } |
|
351 |
|
352 /** |
|
353 * set the default SMS message centre |
|
354 * @param index specifying default index |
|
355 */ |
|
356 void MsgSettingEngine::setSMSMessageCenter(int index) |
|
357 { |
|
358 #ifdef _DEBUG_TRACES_ |
|
359 qDebug() << "MsgSettingEngine::setSMSMessageCenter " << index; |
|
360 #endif |
|
361 |
|
362 |
|
363 dptr_smsSettings->setSMSMessageCenter(index); |
|
364 |
|
365 #ifdef _DEBUG_TRACES_ |
|
366 qDebug() << "Exit setSMSMessageCenter "; |
|
367 #endif |
|
368 |
|
369 } |
|
370 |
|
371 /** |
|
372 * for editing the SMS messafe Centre |
|
373 * @param name specifying center name |
|
374 * @param number specifying center number |
|
375 * @param index specying index of message list |
|
376 */ |
|
377 void MsgSettingEngine::editSmsMessageCenter(QString& centreName, |
|
378 QString& centreNumber, int index) |
|
379 { |
|
380 #ifdef _DEBUG_TRACES_ |
|
381 qDebug() << "MsgSettingEngine::editSmsMessageCenter " << index << " " |
|
382 << centreName << " " << centreNumber; |
|
383 #endif |
|
384 |
|
385 HBufC* d_addr = S60QConversions::qStringToS60Desc(centreNumber); |
|
386 HBufC* d_name = S60QConversions::qStringToS60Desc(centreName); |
|
387 |
|
388 dptr_smsSettings->editSMSServiceCentre(d_addr, d_name, index); |
|
389 delete d_addr; |
|
390 delete d_name; |
|
391 |
|
392 #ifdef _DEBUG_TRACES_ |
|
393 qDebug() << "Exit editSmsMessageCenter "; |
|
394 #endif |
|
395 |
|
396 } |
|
397 |
|
398 /** |
|
399 * for add new sms message centre |
|
400 * @param name specifying center name |
|
401 * @param number specifying center number |
|
402 */ |
|
403 void MsgSettingEngine::addSmsMessageCenter(QString& centreName, |
|
404 QString& centreNumber) |
|
405 { |
|
406 #ifdef _DEBUG_TRACES_ |
|
407 qDebug() << "MsgSettingEngine::addSmsMessageCenter " << centreName << " " |
|
408 << centreNumber; |
|
409 #endif |
|
410 |
|
411 |
|
412 HBufC* d_addr = S60QConversions::qStringToS60Desc(centreNumber); |
|
413 HBufC* d_name = S60QConversions::qStringToS60Desc(centreName); |
|
414 |
|
415 dptr_smsSettings->addSmsMessageCenter(d_addr, d_name); |
|
416 delete d_addr; |
|
417 delete d_name; |
|
418 |
|
419 #ifdef _DEBUG_TRACES_ |
|
420 qDebug() << "Exit addSmsMessageCenter "; |
|
421 #endif |
|
422 |
|
423 } |
|
424 |
|
425 /** |
|
426 * get the sms message centre namd and number |
|
427 * @index for which center needs |
|
428 * @param return name specifying center name |
|
429 * @param return number specifying center number |
|
430 */ |
|
431 void MsgSettingEngine::smsCenterNameAndNumber(int index, QString& centreName, |
|
432 QString& centreNumber) |
|
433 { |
|
434 #ifdef _DEBUG_TRACES_ |
|
435 qDebug() << "MsgSettingEngine::smsCenterNameAndNumber " << index; |
|
436 #endif |
|
437 |
|
438 |
|
439 HBufC* d_addr; |
|
440 HBufC* d_name; |
|
441 |
|
442 dptr_smsSettings->smsCenterNameAndNumber(index, &d_addr, &d_name); |
|
443 |
|
444 centreNumber = S60QConversions::s60DescToQString(d_addr->Des()); |
|
445 centreName = S60QConversions::s60DescToQString(d_name->Des()); |
|
446 |
|
447 #ifdef _DEBUG_TRACES_ |
|
448 qDebug() << "Exit smsCenterNameAndNumber " << centreNumber << " " |
|
449 << centreName; |
|
450 #endif |
|
451 |
|
452 } |
|
453 |
|
454 /** |
|
455 * set the Sms Email gateway |
|
456 * @param gateway string |
|
457 */ |
|
458 void MsgSettingEngine::setEmailGateway(QString& gateway) |
|
459 { |
|
460 #ifdef _DEBUG_TRACES_ |
|
461 qDebug() << "MsgSettingEngine::setEmailGateway " << gateway; |
|
462 #endif |
|
463 |
|
464 |
|
465 HBufC* d_gateway = S60QConversions::qStringToS60Desc(gateway); |
|
466 |
|
467 dptr_smsSettings->setEmailGateway(d_gateway); |
|
468 delete d_gateway; |
|
469 |
|
470 #ifdef _DEBUG_TRACES_ |
|
471 qDebug() << "Exit setEmailGateway "; |
|
472 #endif |
|
473 |
|
474 } |
|
475 |
|
476 /** |
|
477 * set the sms Email Service centre number |
|
478 * @param centre number |
|
479 */ |
|
480 void MsgSettingEngine::setEmailSeriveCenterNumber(QString& centerNumber) |
|
481 { |
|
482 #ifdef _DEBUG_TRACES_ |
|
483 qDebug() << "MsgSettingEngine::setEmailSeriveCenterNumber " << centerNumber; |
|
484 |
|
485 #endif |
|
486 |
|
487 HBufC* d_number = S60QConversions::qStringToS60Desc(centerNumber); |
|
488 |
|
489 dptr_smsSettings->setEmailSeriveCenterNumber(d_number); |
|
490 delete d_number; |
|
491 |
|
492 #ifdef _DEBUG_TRACES_ |
|
493 qDebug() << "Exit setEmailSeriveCenterNumber "; |
|
494 #endif |
|
495 |
|
496 } |
|
497 |
|
498 /** |
|
499 * get the sms email gateway and |
|
500 * service centre number |
|
501 * @param gateway return email gateway |
|
502 * @param centreNumber return service number |
|
503 */ |
|
504 void MsgSettingEngine::emailEmailGatewayAndServiceCenterNumber(QString& gateway, |
|
505 QString& serviceNumber) |
|
506 { |
|
507 #ifdef _DEBUG_TRACES_ |
|
508 qDebug() << "MsgSettingEngine::emailEmailGatewayAndServiceCenterNumber"; |
|
509 #endif |
|
510 |
|
511 |
|
512 HBufC* d_gateway; |
|
513 HBufC* d_number; |
|
514 |
|
515 dptr_smsSettings->emailEmailGatewayAndServiceCenterNumber(&d_gateway, |
|
516 &d_number); |
|
517 |
|
518 gateway = S60QConversions::s60DescToQString(d_gateway->Des()); |
|
519 serviceNumber = S60QConversions::s60DescToQString(d_number->Des()); |
|
520 |
|
521 delete d_gateway; |
|
522 delete d_number; |
|
523 |
|
524 #ifdef _DEBUG_TRACES_ |
|
525 qDebug() << "Exit smsCenterNameAndNumber " << gateway << " " |
|
526 << serviceNumber; |
|
527 #endif |
|
528 |
|
529 } |
|
530 //eof |
|
531 |
|