|
1 /* |
|
2 * Copyright (c) 2002-2010 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: Implementation of RVmbxNumber class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <vmnumber.h> |
|
22 #include <e32std.h> |
|
23 #include <avkon.hrh> |
|
24 #include <bautils.h> |
|
25 #include <eikenv.h> |
|
26 #include <commonphoneparser.h> |
|
27 #include <aknnotewrappers.h> |
|
28 #include <StringLoader.h> |
|
29 #include <data_caging_path_literals.hrh> |
|
30 #include <PhCltUtils.h> |
|
31 #include <vmbx.rsg> |
|
32 // includes for phonebook search |
|
33 #include <cphonecntfactory.h> |
|
34 #include <cphcntsingleitemfetch.h> |
|
35 #include <featmgr.h> |
|
36 #include <AknIconArray.h> |
|
37 #include <AknsUtils.h> |
|
38 |
|
39 #ifdef RD_STARTUP_CHANGE |
|
40 #include <startupdomainpskeys.h>//for KPSSimStatus |
|
41 #endif |
|
42 |
|
43 #include <AknQueryDialog.h> |
|
44 |
|
45 /***************************************************** |
|
46 * Series 60 Customer / ETel |
|
47 * Series 60 ETel API |
|
48 *****************************************************/ |
|
49 #include <mpbutil.h> |
|
50 #include <utf.h> //CnvUtfConverter |
|
51 #include "voicemailboxprivatecrkeys.h" |
|
52 #include "voicemailboxdomaincrkeys.h" |
|
53 #include <PSVariables.h> |
|
54 #include <e32property.h> |
|
55 #include "vmdialog.h" |
|
56 #include "vmlist.h" |
|
57 #include "vmblogger.h" |
|
58 #include <vm.mbg> |
|
59 #include "vmspshandler.h" |
|
60 #include "vmbshandler.h" |
|
61 |
|
62 // CONSTANTS |
|
63 const TInt KVmFlagOpened = 0x00000001; |
|
64 const TInt KVmFlagPhoneOpened = 0x00000002; |
|
65 const TInt KVmFlagSimReadSupport = 0x00000004; |
|
66 const TInt KVmFlagPhoneModuleLoaded = 0x00000008; |
|
67 const TInt KVmFlagNotifyRequested = 0x00000010; |
|
68 const TInt KVmFlagNotifyOnActiveLineOnly = 0x00000020; |
|
69 const TInt KVmFlagPhonebookBeingCached = 0x00000040; |
|
70 const TInt KVmFlagSimWriteSupport = 0x00000080; |
|
71 const TInt KVmFlagSimVmbxNumSupport = 0x00000100; |
|
72 // Flag of external API saving number to phone |
|
73 const TInt KForceSavedToPhoneMem = 0x00000400; |
|
74 |
|
75 //flag of CS defined number |
|
76 const TInt KVmFlagCSNumberDefined = 0x00000001; |
|
77 //flag of Vedio defined number |
|
78 const TInt KVmFlagVideoNumberDefined = 0x00000002; |
|
79 //flag of VoIP defined number |
|
80 const TInt KVmFlagVoIpNumberDefined = 0x00000004; |
|
81 // phone application uid |
|
82 const TInt KPhoneApplicationUid = 0x100058B3; |
|
83 |
|
84 _LIT (KVmbxResourceFileDrive, "Z:"); |
|
85 // The file directory is in literal KDC_RESOURCE_FILES_DIR |
|
86 // (in data data_caging_path_literals.hrh) |
|
87 _LIT (KVmbxResourceFileName, "Vmbx.rsc"); |
|
88 |
|
89 // Phonebook entry name |
|
90 _LIT( KVmbxPhoneBookEntryName, "Vmbx" ); // If changed, remember to update |
|
91 // the size of KVmbxPhoneBookEntryNameLength in VmNumber.h |
|
92 const TInt KVmbxPhonebookRetriesIfInUse = 20; |
|
93 const TInt KVmbxPhonebookRetryDelay = 100000; // 0.1s |
|
94 |
|
95 const TInt KVmbxPhonebookBufferSize = 150; // Estimated max size 128 |
|
96 |
|
97 _LIT( KVmbxOnePlus, "1" ); |
|
98 |
|
99 // Format of the IAP selection list query. |
|
100 _LIT( KQueryItemFormat, "%d\t%S" ); |
|
101 //for the mbm file |
|
102 _LIT( KVmMbmDrive, "Z:" ); |
|
103 _LIT( KVmLibMbmFile, "vm.mbm" ); |
|
104 |
|
105 const TInt KVmNumOverwrite = 1; |
|
106 |
|
107 const TInt KVmNamStoreMDNId = RMobileNamStore::EMobileDirectoryNumber; |
|
108 // MIN is not included in mmetel std params. Third extended param |
|
109 const TInt KVmNamStoreMINId = RMobileNamStore::ENumStandardNamParameters + 3; |
|
110 const TInt KVmPhNumMinLength = 3; |
|
111 const TInt KVmLbxItemsArraySize = 3; |
|
112 const TInt KVmOriginalNumLength = 256; |
|
113 const TInt KVmPhoneNumDigitsMinLength = 2; |
|
114 const TInt KVmPhoneNumDigitsMaxLength = 40; |
|
115 const TInt KVmbxOnlyDefinedOneNumber = 1; |
|
116 const TInt KMailBoxLimitForPrompt = 1; |
|
117 |
|
118 _LIT (KVmbxIllegalSimCharacter, "w"); |
|
119 _LIT (KTestNumber, "12345"); |
|
120 |
|
121 const TInt KVmExtFileSize = 20; |
|
122 const TInt KVmMaxStoreSize = 48; |
|
123 |
|
124 const TInt KDefaultServiceId = 0; // default ServerId |
|
125 const TInt KCSorVideoServiceId = 1; // CS or Video ServerId |
|
126 const TInt KDefaultDefinedNumberCount = 0; // default defined number count |
|
127 |
|
128 // When the define VM_USE_TSY is set, SIM phonebook will be used and |
|
129 // methods won't work if a compatible TSY/DOS environment is not present. |
|
130 |
|
131 /***************************************************** |
|
132 * Series 60 Customer / ETel |
|
133 * Series 60 ETel API |
|
134 *****************************************************/ |
|
135 // & |
|
136 /***************************************************** |
|
137 * Series 60 Customer / ETel |
|
138 * Series 60 ETel API |
|
139 *****************************************************/ |
|
140 |
|
141 #ifndef __WINS__ // SIM phonebook stalls in WINS |
|
142 #define VM_USE_TSY |
|
143 #endif |
|
144 // ================= MEMBER FUNCTIONS ========================================== |
|
145 |
|
146 |
|
147 |
|
148 // ============================ MEMBER FUNCTIONS =============================== |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // RVmbxNumber::RVmbxNumber |
|
152 // C++ default constructor can NOT contain any code, that |
|
153 // might leave. |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C RVmbxNumber::RVmbxNumber() : iNotifyCallBack( NULL ), |
|
157 iUserAlsObserver( NULL ), |
|
158 iPhoneBookInfoPckg( iPhoneBookInfo ), |
|
159 iPhoneVoicemailInfoPckg( iPhoneVoicemailInfo ), |
|
160 iRSatSession(), |
|
161 iRSatClient( *this ), |
|
162 iNotifyHandler( NULL ), |
|
163 iSession( NULL ), |
|
164 iResourceFileOffset( 0 ), |
|
165 iFlags( KForceSavedToPhoneMem ), |
|
166 iQuery( NULL ), |
|
167 iClosedPtr( NULL ), |
|
168 iCoeEnv( NULL ), |
|
169 iVmNumOpts( EVmNumOptsBlank ), |
|
170 iVmUiOpts( 0 ), |
|
171 iSynchronize( EFalse ), |
|
172 iType( EVmbxNone ), |
|
173 iVMSimQueryDialog( NULL ), |
|
174 iVideoQuery( NULL ), |
|
175 iTypeSelectionQuery( NULL ), |
|
176 iAlphaStringFound( EFalse ), |
|
177 iAlphaStringFromSIM( NULL ), |
|
178 iNumberFound( EFalse ), |
|
179 iUSimFirstRoundTest( ETrue ), |
|
180 iCntFetch( NULL ), |
|
181 iVmSpsHandler( NULL ), |
|
182 iVmBsHandler( NULL ), |
|
183 iFeatMgrInitialized( EFalse ), |
|
184 iSimCardFound( EFalse ) |
|
185 { |
|
186 VMBLOGSTRING( "VMBX: RVmbxNumber::RVmbxNumber =>" ); |
|
187 |
|
188 // Default sets to Phone memory, this can be changed in RVmbxNUmber::Open() |
|
189 iMemoryLocation = EVmbxPhoneMemory; |
|
190 |
|
191 //Create repository and notify handler. |
|
192 TRAPD( error, |
|
193 FeatureManager::InitializeLibL(); |
|
194 iFeatMgrInitialized = ETrue; |
|
195 VMBLOGSTRING( "VMBX: RVmbxNumber::RVmbxNumber: FeatureManager initialized" ); |
|
196 |
|
197 iSession = CRepository::NewL( KCRUidVoiceMailbox ); |
|
198 VMBLOGSTRING( "VMBX: RVmbxNumber::RVmbxNumber: CRepository created" ); |
|
199 |
|
200 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
201 { |
|
202 iVmSpsHandler = CVmSPSHandler::NewL(); |
|
203 VMBLOGSTRING( "VMBX: RVmbxNumber::RVmbxNumber: CVmSPSHandler created" ); |
|
204 } |
|
205 |
|
206 iVmBsHandler = CVmBSHandler::NewL(); |
|
207 VMBLOGSTRING( "VMBX: RVmbxNumber::RVmbxNumber: CVmBSHandler created" ); |
|
208 ); |
|
209 |
|
210 if ( error != KErrNone ) |
|
211 { |
|
212 VMBLOGSTRING2( "VMBX: RVmbxNumber::RVmbxNumber : \ |
|
213 Initialization error %I", error ); |
|
214 _LIT(KVmbxConstructorPanicType,"RVmbxNumber::RVmbxNumber"); |
|
215 User::Panic( KVmbxConstructorPanicType, error ); |
|
216 } |
|
217 |
|
218 VMBLOGSTRING( "VMBX: RVmbxNumber::RVmbxNumber <=" ); |
|
219 } |
|
220 |
|
221 // ----------------------------------------------------------------------------- |
|
222 // RVmbxNumber::~RVmbxNumber |
|
223 // Destructor |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 EXPORT_C RVmbxNumber::~RVmbxNumber() |
|
227 { |
|
228 VMBLOGSTRING( "VMBX: RVmbxNumber::~RVmbxNumber =>" ); |
|
229 |
|
230 if ( iNotifyHandler ) |
|
231 { |
|
232 iNotifyHandler->StopListening(); |
|
233 delete iNotifyHandler; |
|
234 } |
|
235 |
|
236 delete iSession; |
|
237 delete iAlphaStringFromSIM; |
|
238 |
|
239 delete iVmSpsHandler; |
|
240 delete iVmBsHandler; |
|
241 |
|
242 if ( iFeatMgrInitialized ) |
|
243 { |
|
244 FeatureManager::UnInitializeLib(); |
|
245 } |
|
246 |
|
247 VMBLOGSTRING( "VMBX: RVmbxNumber::~RVmbxNumber <=" ); |
|
248 } |
|
249 |
|
250 |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // RVmbxNumber::Open |
|
254 // Opens a new ETel connection |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 /***************************************************** |
|
258 * Series 60 Customer / ETel |
|
259 * Series 60 ETel API |
|
260 *****************************************************/ |
|
261 EXPORT_C TInt RVmbxNumber::Open() |
|
262 { |
|
263 VMBLOGSTRING( "VMBX: RVmbxNumber::Open =>" ); |
|
264 |
|
265 TInt ret( KErrGeneral ); |
|
266 // initialize the CenRep number in the bankup store |
|
267 ret = BackUpSimNumber( KEmptyVoiceMailNumber, KVmbxTmpNumberLinePrimary ); |
|
268 VMBLOGSTRING2( "RVmbxNumber::Open(): Clear KVmbxTmpNumberLinePrimary result = %d", |
|
269 ret ); |
|
270 ret = BackUpSimNumber( KEmptyVoiceMailNumber, KVmbxTmpNumberLineAuxiliary ); |
|
271 VMBLOGSTRING2( "RVmbxNumber::Open(): Clear KVmbxTmpNumberLineAuxiliary result = %d", |
|
272 ret ); |
|
273 VMBLOGSTRING( "RVmbxNumber::Open(): Clear Tmp numbers from CenRep" ); |
|
274 if ( iFlags & KVmFlagOpened ) |
|
275 { |
|
276 VMBLOGSTRING( "VMBX: RVmbxNumber::Open: Opened already" ); |
|
277 ret = KErrNone; |
|
278 } |
|
279 else |
|
280 { |
|
281 ret = ConnectETelServer(); |
|
282 if ( !ret ) |
|
283 { |
|
284 // try to load ETel TSY module |
|
285 ret = iTelServer.LoadPhoneModule( KMmTsyModuleName ); |
|
286 if ( !ret ) |
|
287 { |
|
288 iFlags |= KVmFlagPhoneModuleLoaded; |
|
289 |
|
290 RTelServer::TPhoneInfo info; |
|
291 ret = iTelServer.GetPhoneInfo( 0, info ); |
|
292 if ( !ret ) |
|
293 { |
|
294 ret = iPhone.Open( iTelServer, info.iName ); |
|
295 if ( !ret ) |
|
296 { |
|
297 iFlags |= KVmFlagPhoneOpened; |
|
298 } |
|
299 } |
|
300 } |
|
301 } |
|
302 |
|
303 if ( !ret ) |
|
304 { |
|
305 ret = Open( iPhone ); |
|
306 } |
|
307 else |
|
308 { |
|
309 Close(); |
|
310 } |
|
311 } |
|
312 VMBLOGSTRING( "VMBX: RVmbxNumber::Open <=" ); |
|
313 return ret; |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // RVmbxNumber::Open |
|
318 // Opens a new ETel connection, when there is existing ETel connection already |
|
319 // ----------------------------------------------------------------------------- |
|
320 // |
|
321 /***************************************************** |
|
322 * Series 60 Customer / ETel |
|
323 * Series 60 ETel API |
|
324 *****************************************************/ |
|
325 EXPORT_C TInt RVmbxNumber::Open( RMobilePhone& aPhone ) |
|
326 { |
|
327 VMBLOGSTRING( "VMBX: RVmbxNumber::Open =>" ); |
|
328 TInt result( KErrNone ); |
|
329 TInt alsline( EAlsLine1 ); |
|
330 |
|
331 if ( iFlags & KVmFlagOpened ) |
|
332 { |
|
333 VMBLOGSTRING( "VMBX: RVmbxNumber::Open: Opened already" ); |
|
334 return KErrNone; |
|
335 } |
|
336 iPhone = aPhone; |
|
337 |
|
338 result = iSession->Get( KVmUsesSimMemory, iMemoryLocation ); |
|
339 |
|
340 if ( KErrNone != result ) |
|
341 { |
|
342 if ( KErrNotFound == result ) |
|
343 { |
|
344 iMemoryLocation = EVmbxPhoneMemory; |
|
345 } |
|
346 else |
|
347 { |
|
348 Close(); |
|
349 VMBLOGSTRING( "VMBX: RVmbxNumber::Open: Memory location error" ); |
|
350 return result; |
|
351 } |
|
352 } |
|
353 |
|
354 VMBLOGSTRING2( "iMemoryLocation = %d", iMemoryLocation ); |
|
355 |
|
356 // Connect to system agent |
|
357 RProperty property; |
|
358 TInt psErr( KErrNone ); |
|
359 |
|
360 #ifdef RD_STARTUP_CHANGE |
|
361 psErr = property.Attach( KPSUidStartup, KPSSimStatus ); |
|
362 #else |
|
363 psErr = property.Attach( KUidSystemCategory, KPSUidSimCStatusValue ); |
|
364 #endif |
|
365 if ( KErrNone != psErr ) |
|
366 { |
|
367 VMBLOGSTRING( "VMBX: RVmbxNumber::Open: SIM status property error" ); |
|
368 return psErr; |
|
369 } |
|
370 |
|
371 result = iSsSettings.Open( NULL ); |
|
372 |
|
373 if ( KErrNone != result ) |
|
374 { |
|
375 Close(); |
|
376 VMBLOGSTRING( "VMBX: RVmbxNumber::Open: SS setting opening error" ); |
|
377 return result; |
|
378 } |
|
379 |
|
380 // ignore error |
|
381 iSsSettings.Register( ESSSettingsAls, *this ); |
|
382 |
|
383 // get the current ALS line |
|
384 if ( KErrNone != GetAlsLine( alsline ) ) |
|
385 { |
|
386 alsline = EAlsLine1; // if problems, assume primary line |
|
387 } |
|
388 |
|
389 #ifdef VM_USE_TSY |
|
390 |
|
391 TInt nValue; |
|
392 psErr = property.Get( nValue ); |
|
393 TBool simStatus = EFalse; |
|
394 |
|
395 // Sim aceess test on startup |
|
396 iStartUpTest = ETrue; |
|
397 #ifdef RD_STARTUP_CHANGE |
|
398 |
|
399 if ( ( FeatureManager::FeatureSupported( KFeatureIdSimCard ) ) |
|
400 && ( ESimNotPresent != nValue ) ) |
|
401 { |
|
402 simStatus = ETrue; |
|
403 } |
|
404 |
|
405 #else //RD_STARTUP_CHANGE |
|
406 |
|
407 if ( ( FeatureManager::FeatureSupported( KFeatureIdSimCard ) ) |
|
408 && ( EPSCSimRemoved != nValue ) ) |
|
409 { |
|
410 simStatus = ETrue; |
|
411 } |
|
412 #endif // RD_STARTUP_CHANGE |
|
413 |
|
414 VMBLOGSTRING2( "simStatus = %d", simStatus ); |
|
415 if ( simStatus )//Is simCard supproted and it is not removed |
|
416 { |
|
417 iSimCardFound = ETrue; |
|
418 |
|
419 // Get identifiers from MBI-file |
|
420 if ( EAlsLine1 == alsline ) |
|
421 { |
|
422 result = MailboxNumbersIdentifiers(); |
|
423 VMBLOGSTRING2( "Identifier result = %d", result ); |
|
424 if ( KErrPathNotFound == result ) |
|
425 { |
|
426 // try open vmbx-phonebook next |
|
427 iPhoneBookType = EVMBXPhoneBook; |
|
428 iMbdnPhonebookOk = EFalse; |
|
429 VMBLOGSTRING( "no mbdn file is found, use vmbx phonebook" ); |
|
430 } |
|
431 else |
|
432 { |
|
433 iPhoneBookType = EMBDNPhoneBook; |
|
434 iMbdnPhonebookOk = ETrue; |
|
435 // if mbdn file can be found, set the entry index to EAlsLine1 |
|
436 iPhoneVoicemailInfo.iVoice = EAlsLine1; |
|
437 |
|
438 // try to open mbdn-type phonebook |
|
439 result = iPhoneBook.Open( iPhone, KETelIccMbdnPhoneBook ); |
|
440 VMBLOGSTRING2( "Mbdn phonebook opening result = %I ", result ); |
|
441 if ( KErrNone == result ) |
|
442 { |
|
443 // Get phonebook info |
|
444 result = PhoneBookInfo(); |
|
445 VMBLOGSTRING2( "Mbdn phonebook opening again \ |
|
446 result = %I ", result ); |
|
447 } |
|
448 // close mbdn phonebook when error in opening or GetInfo |
|
449 // to test vmbx-phonebook |
|
450 if ( KErrNone != result ) |
|
451 { |
|
452 VMBLOGSTRING( "Close MBDN phonebook" ); |
|
453 iPhoneBook.Close(); |
|
454 iMbdnPhonebookOk = EFalse; |
|
455 // try open vmbx-phonebook next |
|
456 iPhoneBookType = EVMBXPhoneBook; |
|
457 } |
|
458 // close mbdn phonebook when no number found |
|
459 // to test vmbx-phonebook |
|
460 else if ( ( KErrNone == result ) && iNoNumberFound ) |
|
461 { |
|
462 VMBLOGSTRING( "mbdn close, number not found" ); |
|
463 iMbdnPhonebookOk = ETrue; |
|
464 iPhoneBook.Close(); |
|
465 // try open vmbx-phonebook next |
|
466 iPhoneBookType = EVMBXPhoneBook; |
|
467 } |
|
468 } |
|
469 } |
|
470 |
|
471 if ( EAlsLine2 == alsline || EVMBXPhoneBook == iPhoneBookType ) |
|
472 { |
|
473 // the mbdn number is not used when line2 is active |
|
474 // the number is only got from vmbx-phonebook |
|
475 iMbdnPhonebookOk = EFalse; |
|
476 // try to open vmbx-type phonebook |
|
477 result = iPhoneBook.Open( iPhone, KETelIccVoiceMailBox ); |
|
478 VMBLOGSTRING2( "Vmbx phonebook opening result = %I ", result ); |
|
479 if ( KErrNone == result ) |
|
480 { |
|
481 // check that this phonebook supports reading |
|
482 result = PhoneBookInfo(); |
|
483 VMBLOGSTRING( "VmbxPhoneBook opened" ); |
|
484 } |
|
485 } |
|
486 VMBLOGSTRING3( "VMBX: RVmbxNumber::Open: \ |
|
487 iMbdnPhonebookOk: %I, iNoNumberFound: %I", iMbdnPhonebookOk, iNoNumberFound ); |
|
488 // reopen mbdn-phonebook when vmbx-phonebook has no number |
|
489 if ( iMbdnPhonebookOk && iNoNumberFound ) |
|
490 { |
|
491 VMBLOGSTRING( "reopen mbdn" ); |
|
492 iPhoneBook.Close(); |
|
493 // try open vmbx-phonebook next |
|
494 iPhoneBookType = EMBDNPhoneBook; |
|
495 // try to open mbdn-type phonebook |
|
496 result = iPhoneBook.Open( iPhone, KETelIccMbdnPhoneBook ); |
|
497 VMBLOGSTRING2( "Mbdn phonebook opening result = %I ", result ); |
|
498 if ( KErrNone == result ) |
|
499 { |
|
500 // Get phonebook info |
|
501 result = PhoneBookInfo(); |
|
502 } |
|
503 // close phonebook when error in opening or GetInfo |
|
504 if ( KErrNone != result ) |
|
505 { |
|
506 VMBLOGSTRING( "Close MBDN phonebook" ); |
|
507 iPhoneBook.Close(); |
|
508 } |
|
509 } |
|
510 |
|
511 // set readonly state if aquired |
|
512 if ( IsReadOnlySIM() ) |
|
513 { |
|
514 iFlags &= ~KVmFlagSimWriteSupport; |
|
515 VMBLOGSTRING( "VMBX: RVmbxNumber::Open: ReadOnly set" ); |
|
516 } |
|
517 |
|
518 if ( KErrNone != result && KErrInUse != result ) |
|
519 { |
|
520 // Fatal error |
|
521 Close(); |
|
522 property.Close(); |
|
523 VMBLOGSTRING( "VMBX: RVmbxNumber::Open: Phonebook info error" ); |
|
524 |
|
525 return result; |
|
526 } |
|
527 |
|
528 // If no SIM support for vmbx numbers, we don't need |
|
529 //ETel for anything. -> close all ETel resources |
|
530 if ( !( iFlags & |
|
531 (KVmFlagPhonebookBeingCached | KVmFlagSimReadSupport ) ) ) |
|
532 { |
|
533 CloseETel(); |
|
534 } |
|
535 } |
|
536 // Sim access rights are tested only in start up |
|
537 iStartUpTest = EFalse; |
|
538 #endif // VM_USE_TSY |
|
539 |
|
540 property.Close(); |
|
541 |
|
542 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) |
|
543 { |
|
544 result = iSession->Get( KVmNumOpts,iVmNumOpts ); |
|
545 |
|
546 if ( KErrNone != result ) |
|
547 { |
|
548 if ( KErrNotFound == result ) |
|
549 { |
|
550 iVmNumOpts = EVmNumOptsBlank; |
|
551 } |
|
552 else |
|
553 { |
|
554 Close(); |
|
555 VMBLOGSTRING( "VMBX: RVmbxNumber::Open: NumOpt error" ); |
|
556 return result; |
|
557 } |
|
558 } |
|
559 } |
|
560 result = iSession->Get( KVmUIOpts, iVmUiOpts ); |
|
561 |
|
562 if ( KErrNone != result ) |
|
563 { |
|
564 if ( KErrNotFound == result ) |
|
565 { |
|
566 iVmUiOpts = 0; |
|
567 } |
|
568 else |
|
569 { |
|
570 Close(); |
|
571 VMBLOGSTRING( "VMBX: RVmbxNumber::Open: NumOpt error" ); |
|
572 return result; |
|
573 } |
|
574 } |
|
575 |
|
576 iCoeEnv = CEikonEnv::Static(); |
|
577 |
|
578 // load the resources for queries and notes |
|
579 if ( iCoeEnv ) |
|
580 { |
|
581 __ASSERT_DEBUG( iCoeEnv, |
|
582 User::Panic( KVmbxPanicCategory, EVmbxNoCoeEnv ) ); |
|
583 |
|
584 // load the resources for queries and notes |
|
585 TInt tmpStatus; |
|
586 TRAP( tmpStatus, LoadResourceL() ); |
|
587 result = tmpStatus; |
|
588 |
|
589 if ( result ) |
|
590 { |
|
591 Close(); |
|
592 } |
|
593 else |
|
594 { |
|
595 iFlags |= KVmFlagOpened; |
|
596 } |
|
597 } |
|
598 |
|
599 HandleNumberStores( alsline ); |
|
600 |
|
601 VMBLOGSTRING( "VMBX: RVmbxNumber::Open <=" ); |
|
602 return result; |
|
603 } |
|
604 |
|
605 // ----------------------------------------------------------------------------- |
|
606 // RVmbxNumber::ConnectETelServer |
|
607 // Connects to ETel server |
|
608 // ----------------------------------------------------------------------------- |
|
609 // |
|
610 /***************************************************** |
|
611 * Series 60 Customer / ETel |
|
612 * Series 60 ETel API |
|
613 *****************************************************/ |
|
614 TInt RVmbxNumber::ConnectETelServer() |
|
615 { |
|
616 VMBLOGSTRING( "VMBX: RVmbxNumber::ConnectETelServer =>" ); |
|
617 const TInt KRetryCount = 7; |
|
618 const TInt KRetryTimeout = 100000; |
|
619 TInt status( KErrNone ); |
|
620 |
|
621 for ( TInt i( 0 ); i < KRetryCount; i++ ) |
|
622 { |
|
623 status = iTelServer.Connect(); |
|
624 if ( !status ) |
|
625 { |
|
626 break; |
|
627 } |
|
628 User::After( KRetryTimeout ); |
|
629 } |
|
630 VMBLOGSTRING( "VMBX: RVmbxNumber::ConnectETelServer <=" ); |
|
631 return status; |
|
632 } |
|
633 |
|
634 // ----------------------------------------------------------------------------- |
|
635 // RVmbxNumber::GetVmbxNumber |
|
636 // Fetches the specified vmbx number |
|
637 // ----------------------------------------------------------------------------- |
|
638 // |
|
639 /***************************************************** |
|
640 * Series 60 Customer / ETel |
|
641 * Series 60 ETel API |
|
642 *****************************************************/ |
|
643 EXPORT_C TInt RVmbxNumber::GetVmbxNumber( TDes& aNumber, |
|
644 TVmbxNumberEntry aEntry ) |
|
645 { |
|
646 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmbxNumber =>" ); |
|
647 __ASSERT_DEBUG( iFlags & ( KVmFlagOpened ), |
|
648 User::Panic(KVmbxPanicCategory, EVmbxNotConnected) ); |
|
649 __ASSERT_DEBUG( aNumber.MaxLength() >= KVmbxMaxNumberLength, |
|
650 User::Panic(KVmbxPanicCategory, EVmbxDescriptorTooSmall) ); |
|
651 |
|
652 TInt lineNumber( aEntry ); |
|
653 |
|
654 if ( aEntry == EAlsActiveLineEntry ) |
|
655 { |
|
656 // get the current ALS line |
|
657 if ( GetAlsLine( lineNumber ) != KErrNone ) |
|
658 { |
|
659 lineNumber = EAlsLine1; // if problems, assume primary line |
|
660 } |
|
661 } |
|
662 TInt ret( KErrNotFound ); |
|
663 TBuf< KVmbxMaxNumberLength > number; |
|
664 TBuf< KVmbxMaxNumberLength > line2AlsNumber; |
|
665 |
|
666 //VMN callback# |
|
667 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) && |
|
668 ( iVmUiOpts & KVmNumOverwrite ) ) |
|
669 { |
|
670 ret = GetVmNumFromVMN( number ); |
|
671 if ( ret == KErrNone ) |
|
672 { |
|
673 aNumber.Copy( number ); |
|
674 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmbxNumber OK" ); |
|
675 return ret; |
|
676 } |
|
677 else if ( ret != KErrNotFound ) |
|
678 { |
|
679 VMBLOGSTRING2( "VMBX: RVmbxNumber:: \ |
|
680 GetVmbxNumber error = %I", ret ); |
|
681 return ret; |
|
682 } |
|
683 } |
|
684 |
|
685 TBool isFromSD = EFalse; |
|
686 TBool isFromSim = EFalse; |
|
687 |
|
688 // Get saved number |
|
689 switch ( iVmNumOpts ) |
|
690 { |
|
691 case EVmNumOptsBlank: |
|
692 { |
|
693 // On ALS1 read number from sim, if sim is active |
|
694 // On ALS2 always read number from sim when vmbx phone memory in use |
|
695 if ( IsSimMemory() && ( ( EAlsLine1 == lineNumber ) |
|
696 || ( EAlsLine2 == lineNumber ) ) ) |
|
697 { |
|
698 ret = GetVmNumFromSIM( number, lineNumber ); |
|
699 isFromSim = ETrue; |
|
700 // If there is no voice mailbox number available on SIM, |
|
701 // a note(qtn_...) should be shown, |
|
702 // when pressing '1' + 'send' key or long pressing '1' key |
|
703 // to try to call voice mailbox by phone application. |
|
704 if ( ( !UserEditNumber( lineNumber ) |
|
705 || !IsPhoneMemForcedEdit( lineNumber ) ) && |
|
706 ( ( KErrNotFound == ret ) || ( KErrNotSupported == ret ) ) |
|
707 && !AllowedToChangeTheNumber() ) |
|
708 { |
|
709 // get current active process |
|
710 RProcess curProcess; |
|
711 TInt curProcessId( curProcess.SecureId().iId ); |
|
712 VMBLOGSTRING2( "VMBX: RVmbxNumber:: Get cur process id: \ |
|
713 curProcessId = %I", curProcessId ); |
|
714 |
|
715 if ( KPhoneApplicationUid == curProcessId ) |
|
716 { |
|
717 TBool thisClosed( EFalse ); |
|
718 iClosedPtr = &thisClosed; |
|
719 |
|
720 // This check is done because phone client calls |
|
721 // GetVmbxNumber and then SelectTypeL, |
|
722 // which causes note qtn_... to be shown twice |
|
723 if ( IsNoNumberNoteAllowed() ) |
|
724 { |
|
725 // show the information note to user |
|
726 TRAP_IGNORE( |
|
727 ShowInformationNoteL( R_VOICE_NO_VMBX_NUMBER_NOTE ) ) |
|
728 } |
|
729 |
|
730 iClosedPtr = NULL; |
|
731 if ( thisClosed ) |
|
732 { |
|
733 //End Key Pressed |
|
734 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmbxNumber: \ |
|
735 End key pressed" ); |
|
736 return KErrCancel; |
|
737 } |
|
738 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmbxNumber \ |
|
739 No voice mailbox number available on SIM" ); |
|
740 } |
|
741 } |
|
742 if ( KErrNone == ret ) |
|
743 { |
|
744 ResetUserEditNumber( lineNumber ); |
|
745 } |
|
746 VMBLOGSTRING2( "GetVmNumFromSIM = %I", ret ); |
|
747 } |
|
748 else |
|
749 { |
|
750 ret = KErrNotFound; |
|
751 } |
|
752 break; |
|
753 } |
|
754 case EVmNumOptsDedicatedVMN: |
|
755 { |
|
756 ret = GetVmNumFromVMN( number ); |
|
757 break; |
|
758 } |
|
759 case EVmNumOptsMIN: |
|
760 case EVmNumOptsOnePlusMIN: |
|
761 { |
|
762 ret = GetVmNumFromNamStore( number, EVmbxMIN ); |
|
763 break; |
|
764 } |
|
765 case EVmNumOptsMDN: |
|
766 case EVmNumOptsOnePlusMDN: |
|
767 { |
|
768 ret = GetVmNumFromNamStore( number ); |
|
769 break; |
|
770 } |
|
771 case EVmNumOptsMDNCustom: |
|
772 case EVmNumOptsOnePlusMDNCustom: |
|
773 { |
|
774 ret = GetVmNumFromSD( number, lineNumber ); |
|
775 if ( ret != KErrNone ) |
|
776 { |
|
777 ret = GetVmNumFromNamStore( number ); |
|
778 } |
|
779 break; |
|
780 } |
|
781 case EVmNumOptsSharedData: |
|
782 { |
|
783 ret = GetVmNumFromSD( number, lineNumber ); |
|
784 isFromSD = ETrue; |
|
785 break; |
|
786 } |
|
787 default: |
|
788 // |
|
789 break; |
|
790 } |
|
791 |
|
792 // On ALS2, if number exists on SD, then use it |
|
793 // if ALS2 number found in SIM, but not in phone memory, |
|
794 // reset flag for automatic SIM number use. |
|
795 // Number found from SIM is saved to SD later |
|
796 |
|
797 if ( lineNumber == EAlsLine2 ) |
|
798 { |
|
799 TInt alsReturnValue = GetVmNumFromSD( line2AlsNumber, lineNumber ); |
|
800 if ( ( alsReturnValue == KErrNone ) && ( line2AlsNumber.Length() ) ) |
|
801 { |
|
802 VMBLOGSTRING( "GetVmbxNumber::ALS2 number found from CenRep" ); |
|
803 number.Copy( line2AlsNumber ); |
|
804 isFromSD = ETrue; |
|
805 } |
|
806 else |
|
807 { |
|
808 if ( ( KErrNone == ret ) && isFromSim ) |
|
809 { |
|
810 VMBLOGSTRING( "[VMBX] GetVmbxNumber::ALS 2 number found from SIM" ); |
|
811 ResetUserEditNumber( lineNumber ); |
|
812 } |
|
813 else |
|
814 { |
|
815 number.Zero(); |
|
816 } |
|
817 } |
|
818 } |
|
819 |
|
820 // No number retrieved so try to read SD for number |
|
821 // (Phone memory in use) |
|
822 if ( ret != KErrNone ) |
|
823 { |
|
824 switch( iVmNumOpts ) |
|
825 { |
|
826 case EVmNumOptsBlank: |
|
827 case EVmNumOptsDedicatedVMN: |
|
828 case EVmNumOptsMIN: |
|
829 case EVmNumOptsOnePlusMIN: |
|
830 case EVmNumOptsMDN: |
|
831 case EVmNumOptsOnePlusMDN: |
|
832 { |
|
833 if ( !IsSimMemory() ) |
|
834 { |
|
835 ret = GetVmNumFromSD( number, lineNumber ); |
|
836 VMBLOGSTRING2( "GetVmNumFromSD = %I", ret ); |
|
837 isFromSD = ETrue; |
|
838 } |
|
839 else |
|
840 { |
|
841 aNumber.Copy( number ); |
|
842 VMBLOGSTRING2( "number = %S", &number ); |
|
843 } |
|
844 break; |
|
845 } |
|
846 default: |
|
847 break; |
|
848 } |
|
849 } |
|
850 |
|
851 if ( ret == KErrNone ) |
|
852 { |
|
853 if ( number.Length() ) |
|
854 { |
|
855 VMBLOGSTRING( "Number length > 0" ); |
|
856 //Synchronize the number in storage with the retrieved number |
|
857 if ( iVmNumOpts != EVmNumOptsMDNCustom && |
|
858 iVmNumOpts != EVmNumOptsOnePlusMDNCustom && |
|
859 !isFromSD ) |
|
860 { |
|
861 iSynchronize = ETrue; |
|
862 |
|
863 if ( ( iFlags & KVmFlagSimWriteSupport ) || |
|
864 ( lineNumber == EAlsLine2 ) ) |
|
865 { |
|
866 TInt error( KErrNone ); |
|
867 // If number is not fetched from SIM and SIM memory active |
|
868 // on primary line, number saved to SIM. |
|
869 if ( UsesSimMemory() ) |
|
870 { |
|
871 if ( !isFromSim ) |
|
872 { |
|
873 error = SaveVmbxNumberToSim( number, aEntry ); |
|
874 VMBLOGSTRING2( "SaveVmbxNumberToSim = %I", error ); |
|
875 } |
|
876 } |
|
877 else |
|
878 { |
|
879 error = SaveVmbxNumberToPhone( number, aEntry ); |
|
880 VMBLOGSTRING2( "SaveVmbxNumberToPhone = %I", error ); |
|
881 } |
|
882 } |
|
883 else |
|
884 { |
|
885 iFlags &= (~KForceSavedToPhoneMem); |
|
886 SaveVmbxNumber( number, aEntry ); |
|
887 } |
|
888 } |
|
889 |
|
890 if ( iVmNumOpts == EVmNumOptsOnePlusMIN || |
|
891 iVmNumOpts == EVmNumOptsOnePlusMDN ) |
|
892 { |
|
893 if ( KVmbxMaxNumberLength < number.Length() + 1 ) |
|
894 { |
|
895 VMBLOGSTRING( "GetVmbxNumber::Number too long" ); |
|
896 return KErrTooBig; |
|
897 } |
|
898 // Add 1 plus |
|
899 number.Insert( 0, KVmbxOnePlus ); |
|
900 } |
|
901 |
|
902 aNumber.Copy( number ); |
|
903 } |
|
904 else |
|
905 { |
|
906 VMBLOGSTRING( "GetVmbxNumber::No number found." ); |
|
907 ret = KErrNotFound; |
|
908 } |
|
909 } |
|
910 |
|
911 VMBLOGSTRING2( "VMBX: RVmbxNumber::GetVmbxNumber error = %I", ret ); |
|
912 if ( ret != KErrNone ) |
|
913 { |
|
914 return KErrNotFound; |
|
915 } |
|
916 |
|
917 if ( IsEmergencyNumberL( aNumber ) ) |
|
918 { |
|
919 aNumber.Zero(); |
|
920 ret = KErrNotFound; |
|
921 } |
|
922 |
|
923 return ret; |
|
924 } |
|
925 |
|
926 // ----------------------------------------------------------------------------- |
|
927 // RVmbxNumber::QueryNumberL |
|
928 // Check wether the voice mailbox number can be changed |
|
929 // ----------------------------------------------------------------------------- |
|
930 // |
|
931 EXPORT_C TBool RVmbxNumber::QueryNumberL( TVmbxQueryType aQueryType, |
|
932 TDes& aNumber, |
|
933 TBool aShowQuery) |
|
934 { |
|
935 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: =>" ); |
|
936 __ASSERT_DEBUG( aNumber.MaxLength() >= KVmbxMaxNumberLength, |
|
937 User::Panic( KVmbxPanicCategory, EVmbxDescriptorTooSmall ) ); |
|
938 __ASSERT_DEBUG( aNumber.Length() <= KVmbxMaxNumberLength, |
|
939 User::Panic( KVmbxPanicCategory, EVmbxNumberTooLong ) ); |
|
940 |
|
941 VMBLOGSTRING2( "aQueryType = %d", aQueryType ); |
|
942 VMBLOGSTRING2( "iPhoneBookType = %d", iPhoneBookType ); |
|
943 |
|
944 TBool result( EFalse ); |
|
945 if ( EVmQueryProcess == iQueryingState ) |
|
946 { |
|
947 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: \ |
|
948 running forever case" ); |
|
949 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: <=" ); |
|
950 return result; |
|
951 } |
|
952 |
|
953 if ( !AllowedToChangeTheNumber() ) |
|
954 { |
|
955 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: \ |
|
956 Number not allowed to change" ); |
|
957 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: <=" ); |
|
958 User::Leave( KErrAccessDenied ); |
|
959 } |
|
960 |
|
961 // Vmbx type is set for FetchNumberFromPhonebookL |
|
962 iType = EVmbx; |
|
963 |
|
964 __ASSERT_DEBUG( aNumber.MaxLength() >= KVmbxMaxNumberLength, |
|
965 User::Panic( KVmbxPanicCategory, EVmbxDescriptorTooSmall ) ); |
|
966 __ASSERT_DEBUG( aNumber.Length() <= KVmbxMaxNumberLength, |
|
967 User::Panic( KVmbxPanicCategory, EVmbxNumberTooLong ) ); |
|
968 |
|
969 // Close() sets thisClosed to ETrue |
|
970 TBool thisClosed( EFalse ); |
|
971 |
|
972 TBuf<KVmbxMaxNumberLength> vmbxNumber; |
|
973 |
|
974 TInt alsline( EAlsLine1 ); |
|
975 // get the current ALS line |
|
976 if ( GetAlsLine( alsline ) != KErrNone ) |
|
977 { |
|
978 // if problems, assume primary line |
|
979 alsline = EAlsLine1; |
|
980 } |
|
981 VMBLOGSTRING2( "VMBX: RVmbxNumber::QueryNumberL: ALSline = %d", |
|
982 alsline ); |
|
983 |
|
984 if ( iFlags & KVmFlagSimReadSupport ) |
|
985 { |
|
986 VMBLOGSTRING( "RVmbxNumber::QueryNumberL: SIM Read support" ) |
|
987 TBool querySim( EFalse ); |
|
988 |
|
989 if ( alsline == EAlsLine1 ) |
|
990 { |
|
991 // Do sim query when not defined query |
|
992 // or 6f17 Sim memory not active and query wanted |
|
993 if ( ( aQueryType == EVmbxNotDefinedQuery ) || |
|
994 ( !IsSimMemory() && aShowQuery && |
|
995 ( iMemoryLocation == EVmbxPhoneMemory ) ) ) |
|
996 { |
|
997 VMBLOGSTRING( "RVmbxNumber::QueryNumberL: Query on line1" ); |
|
998 querySim = ETrue; |
|
999 } |
|
1000 } |
|
1001 else //EAlsLine2 |
|
1002 { |
|
1003 // Allways and only when vmbx phonebook in use |
|
1004 if ( iPhoneBookType == EVMBXPhoneBook ) |
|
1005 { |
|
1006 VMBLOGSTRING( "RVmbxNumber::QueryNumberL: Query on line2" ); |
|
1007 querySim = ETrue; |
|
1008 } |
|
1009 } |
|
1010 |
|
1011 if ( querySim ) |
|
1012 { |
|
1013 iClosedPtr = &thisClosed; |
|
1014 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: Q SIM number" ); |
|
1015 |
|
1016 TBool isSimNumber = QuerySimNumberL( vmbxNumber ); |
|
1017 |
|
1018 VMBLOGSTRING2( "VMBX: RVmbxNumber::QueryNumberL: SIM number %S", |
|
1019 &vmbxNumber ); |
|
1020 |
|
1021 iClosedPtr = NULL; |
|
1022 |
|
1023 if ( thisClosed ) |
|
1024 { |
|
1025 //End Key Pressed |
|
1026 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: \ |
|
1027 End key pressed" ); |
|
1028 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: <=" ); |
|
1029 return EFalse; |
|
1030 } |
|
1031 |
|
1032 if ( isSimNumber ) |
|
1033 { |
|
1034 // save to phone memory when ALS2 in use |
|
1035 // or read-only sim on ALS1 |
|
1036 if ( ( alsline == EAlsLine2 ) || |
|
1037 ( ( alsline == EAlsLine1 ) && |
|
1038 !( iFlags & KVmFlagSimWriteSupport ) ) ) |
|
1039 { |
|
1040 VMBLOGSTRING( "Save number To Phone" ); |
|
1041 SaveVmbxNumberToPhone( vmbxNumber, EAlsActiveLineEntry ); |
|
1042 // confirmation note is not needed if number is taken |
|
1043 // from SIM automatically |
|
1044 if ( UserEditNumber( alsline ) || |
|
1045 IsPhoneMemForcedEdit( alsline ) ) |
|
1046 { |
|
1047 ResetUserEditNumber( alsline ); |
|
1048 ShowConfirmationNoteL( R_SIM_NUMBER_NOTE ); |
|
1049 } |
|
1050 } |
|
1051 else |
|
1052 { |
|
1053 // confirmation note is not needed if number is taken |
|
1054 // from SIM automatically |
|
1055 if ( UserEditNumber( alsline ) || |
|
1056 IsPhoneMemForcedEdit( alsline ) ) |
|
1057 { |
|
1058 ShowConfirmationNoteL( R_SIM_NUMBER_NOTE ); |
|
1059 } |
|
1060 } |
|
1061 aNumber.Copy( vmbxNumber ); |
|
1062 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL Number from \ |
|
1063 Sim accepted" ); |
|
1064 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: <=" ); |
|
1065 return ETrue; |
|
1066 } |
|
1067 } |
|
1068 } |
|
1069 |
|
1070 TBuf<KVmOriginalNumLength> originalNumber; |
|
1071 originalNumber.Copy( aNumber ); |
|
1072 |
|
1073 iQueryingState = EVmQueryProcess; |
|
1074 //QueryNumberL dialog |
|
1075 FOREVER |
|
1076 { |
|
1077 vmbxNumber.Copy( aNumber ); |
|
1078 |
|
1079 // get the correct query prompt from resource file |
|
1080 HBufC* prompt = StringLoader::LoadLC( ( aQueryType == |
|
1081 EVmbxNotDefinedQuery |
|
1082 ? R_DEFINE_NUMBER_PROMPT |
|
1083 : R_CHANGE_NUMBER_PROMPT ), |
|
1084 iCoeEnv ); |
|
1085 |
|
1086 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL string loaded" ); |
|
1087 iClosedPtr = &thisClosed; |
|
1088 |
|
1089 // Convert output to accommodate the current locale |
|
1090 AknTextUtils::LanguageSpecificNumberConversion( vmbxNumber ); |
|
1091 |
|
1092 TInt ret; // return value of the query |
|
1093 |
|
1094 // ETrue to open the query again after closing single fetch dialog |
|
1095 TBool searchUsed; |
|
1096 |
|
1097 // enable search if number length is 0 |
|
1098 TBool searchEnabled( vmbxNumber.Length() ? EFalse : ETrue ); |
|
1099 |
|
1100 do |
|
1101 { |
|
1102 // show query with the correct prompt |
|
1103 iQuery = CVmTextQueryDialog::NewL( vmbxNumber, |
|
1104 *prompt, searchEnabled ); |
|
1105 |
|
1106 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL ExecuteLD" ); |
|
1107 ret = iQuery->ExecuteLD( R_VMBX_NUMBER_QUERY ); |
|
1108 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL ExecuteLD done" ); |
|
1109 |
|
1110 iQuery = NULL; |
|
1111 searchUsed = EFalse; |
|
1112 |
|
1113 if ( searchEnabled && ret && !vmbxNumber.Length() ) |
|
1114 { |
|
1115 searchUsed = ETrue; |
|
1116 // Show phonebook's single fetch dialog |
|
1117 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL Fetch from Pb" ); |
|
1118 TRAPD( error, FetchNumberFromPhonebook2L( vmbxNumber ) ); |
|
1119 VMBLOGSTRING2( "VMBX: RVmbxNumber::QueryNumberL Fetch from Pb done \ |
|
1120 error = %d", error ); |
|
1121 |
|
1122 // If application is killed via FSW, contact selection query |
|
1123 // returns KLeaveExit. This should propagate to "root" |
|
1124 // application where it reaches the active scheduler loop |
|
1125 // and thus allows proper application exit when the loop exits. |
|
1126 // Therefore propagate the error to caller and do not ignore it. |
|
1127 if ( KLeaveExit == error ) |
|
1128 { |
|
1129 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL KLeaveExit" ); |
|
1130 User::Leave( error ); |
|
1131 } |
|
1132 |
|
1133 // user has pressed End Key |
|
1134 if ( thisClosed ) |
|
1135 { |
|
1136 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: \ |
|
1137 End key pressed" ); |
|
1138 CleanupStack::PopAndDestroy( prompt ); |
|
1139 |
|
1140 iQueryingState = EVmQueryNormal; |
|
1141 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: <=" ); |
|
1142 return EFalse; |
|
1143 } |
|
1144 |
|
1145 if ( error ) // Back pressed in Contact UI |
|
1146 { |
|
1147 // Now the phone book fetch dialog was closed, |
|
1148 // get out of the loop |
|
1149 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL Fetch done" ); |
|
1150 ret = 0; |
|
1151 break; |
|
1152 } |
|
1153 } |
|
1154 } while ( searchUsed ); |
|
1155 |
|
1156 iClosedPtr = NULL; |
|
1157 |
|
1158 CleanupStack::PopAndDestroy( prompt ); |
|
1159 |
|
1160 if ( ret != KErrNone ) |
|
1161 { |
|
1162 if ( !vmbxNumber.Length() ) |
|
1163 { |
|
1164 iFlags &= (~KForceSavedToPhoneMem); |
|
1165 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL has number" ); |
|
1166 // Resets the flag that indicates that the user has edited VMBX number |
|
1167 ResetUserEditNumber( alsline ); |
|
1168 TInt status = |
|
1169 SaveVmbxNumber( vmbxNumber, EAlsActiveLineEntry ); |
|
1170 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL number save" ); |
|
1171 |
|
1172 if ( status == KErrNone ) |
|
1173 { |
|
1174 // If number does not exist, |
|
1175 // number from SIM is used if it's available |
|
1176 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL save ok" ); |
|
1177 if ( UseSimNumIfAvailable( vmbxNumber, alsline ) |
|
1178 && vmbxNumber.Length() ) |
|
1179 { |
|
1180 // If number is taken from SIM, |
|
1181 // show appropriate confirmation note |
|
1182 ShowConfirmationNoteL( R_SIM_NUMBER_NOTE ); |
|
1183 } |
|
1184 aNumber.Copy( vmbxNumber ); |
|
1185 if ( !vmbxNumber.Length() ) |
|
1186 { |
|
1187 // show "not defined" note |
|
1188 ShowConfirmationNoteL( R_NOTE_EMPTY_NUMBER ); |
|
1189 } |
|
1190 result = ETrue; |
|
1191 break; |
|
1192 } |
|
1193 else if ( status == KErrCancel ) |
|
1194 { |
|
1195 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL save \ |
|
1196 cancel" ); |
|
1197 |
|
1198 aNumber.Copy( vmbxNumber ); |
|
1199 continue; |
|
1200 } |
|
1201 else |
|
1202 { |
|
1203 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: \ |
|
1204 Number saving error" ); |
|
1205 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: <=" ); |
|
1206 User::LeaveIfError( status ); |
|
1207 } |
|
1208 } |
|
1209 else |
|
1210 { |
|
1211 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL no number" ); |
|
1212 SetUserEditNumber( alsline ); |
|
1213 } |
|
1214 |
|
1215 // Convert back to western digits |
|
1216 ConvertToWesternDigits( vmbxNumber ); |
|
1217 |
|
1218 // check the given number here (emergency numbers not allowed) |
|
1219 if ( IsValidPhoneNumber( vmbxNumber ) |
|
1220 && !IsEmergencyNumberL( vmbxNumber ) ) |
|
1221 { |
|
1222 iFlags &= ~KForceSavedToPhoneMem; |
|
1223 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: save num 2" ); |
|
1224 TInt status = SaveVmbxNumber( vmbxNumber, EAlsActiveLineEntry ); |
|
1225 |
|
1226 if ( status == KErrNone ) |
|
1227 { |
|
1228 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: save \ |
|
1229 num 2 ok" ); |
|
1230 aNumber.Copy( vmbxNumber ); |
|
1231 if ( UsesSimMemory() ) |
|
1232 { |
|
1233 ShowConfirmationNoteL( |
|
1234 R_SAVED_NOTE_SIM_MEMORY ); |
|
1235 } |
|
1236 else |
|
1237 { |
|
1238 ShowConfirmationNoteL( |
|
1239 R_SAVED_NOTE_PHONE_MEMORY ); |
|
1240 } |
|
1241 result = ETrue; |
|
1242 break; |
|
1243 } |
|
1244 else if ( status == KErrCancel ) |
|
1245 {// The query number dialog was cancelled, so continue |
|
1246 aNumber.Copy( vmbxNumber ); |
|
1247 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: save \ |
|
1248 num 2 cancel" ); |
|
1249 continue; |
|
1250 } |
|
1251 else if ( status == KErrArgument ) |
|
1252 { |
|
1253 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: save \ |
|
1254 num 2 err arg" ); |
|
1255 result = EFalse; |
|
1256 } |
|
1257 else |
|
1258 { |
|
1259 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: \ |
|
1260 Invalid number" ); |
|
1261 result = EFalse; |
|
1262 } |
|
1263 } |
|
1264 |
|
1265 if ( !result ) |
|
1266 { |
|
1267 // show "invalid number" note and wait |
|
1268 // for a short timeout |
|
1269 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: invalid \ |
|
1270 number show note" ); |
|
1271 |
|
1272 prompt = StringLoader::LoadLC( R_INVALID_NUMBER_NOTE, |
|
1273 iCoeEnv ); |
|
1274 |
|
1275 iClosedPtr = &thisClosed; |
|
1276 |
|
1277 CAknInformationNote* note = |
|
1278 new( ELeave ) CAknInformationNote( ETrue ); |
|
1279 note->ExecuteLD( *prompt ); |
|
1280 |
|
1281 iClosedPtr = NULL; |
|
1282 |
|
1283 CleanupStack::PopAndDestroy( prompt ); |
|
1284 |
|
1285 if ( !thisClosed ) |
|
1286 { |
|
1287 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: invalid \ |
|
1288 number query again" ); |
|
1289 continue; // the number was invalid -> query again. |
|
1290 } |
|
1291 } |
|
1292 } |
|
1293 |
|
1294 // retrieve the original number in the query |
|
1295 // as user has cancelled the query... |
|
1296 aNumber.Copy( originalNumber ); |
|
1297 break; // user canceled the query |
|
1298 } |
|
1299 iQueryingState = EVmQueryNormal; |
|
1300 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryNumberL: <=" ); |
|
1301 return result; |
|
1302 } |
|
1303 |
|
1304 // ----------------------------------------------------------------------------- |
|
1305 // RVmbxNumber::QuerySimNumberL |
|
1306 // Routine to query and save SIM number from user |
|
1307 // ----------------------------------------------------------------------------- |
|
1308 // |
|
1309 TBool RVmbxNumber::QuerySimNumberL( TDes& aNumber, TVmbxNumberEntry aEntry ) |
|
1310 { |
|
1311 VMBLOGSTRING( "VMBX: RVmbxNumber::QuerySimNumberL: =>" ); |
|
1312 TInt lineNumber( aEntry ); |
|
1313 |
|
1314 if ( aEntry == EAlsActiveLineEntry ) |
|
1315 { |
|
1316 // get the current ALS line |
|
1317 if ( GetAlsLine( lineNumber ) != KErrNone ) |
|
1318 { |
|
1319 lineNumber = EAlsLine1; // if problems, assume primary line |
|
1320 } |
|
1321 } |
|
1322 TInt ret( KErrNotFound ); |
|
1323 |
|
1324 ret = GetVmNumFromSIM( aNumber, lineNumber ); |
|
1325 |
|
1326 if ( ret ) |
|
1327 { |
|
1328 return EFalse; |
|
1329 } |
|
1330 |
|
1331 VMBLOGSTRING2( "iMemoryLocation = %d", iMemoryLocation ); |
|
1332 |
|
1333 TBool doSimQuery( EFalse ); |
|
1334 if ( ( lineNumber == EAlsLine2 ) && ( iPhoneBookType == EVMBXPhoneBook ) ) |
|
1335 { |
|
1336 VMBLOGSTRING( "Sim query allowed on line2" ); |
|
1337 doSimQuery = ETrue; |
|
1338 } |
|
1339 else if ( ( iMemoryLocation == EVmbxPhoneMemory ) && |
|
1340 ( 0 != aNumber.Length() ) ) |
|
1341 { |
|
1342 VMBLOGSTRING( "Sim query allowed on line1" ); |
|
1343 doSimQuery = ETrue; |
|
1344 } |
|
1345 |
|
1346 if ( doSimQuery ) |
|
1347 { |
|
1348 TInt retVal = EVmbxSimNumNotAccepted; |
|
1349 // If number not defined, query is not needed as number |
|
1350 // found in SIM is used automatically |
|
1351 if ( VmbxNumDefInPhoneMemory( lineNumber ) ) |
|
1352 { |
|
1353 // If number found in SIM is the same as the number stored in phone memory, |
|
1354 // skip query |
|
1355 if ( !NumStoredInPhone( aNumber, lineNumber ) ) |
|
1356 { |
|
1357 HBufC* label = StringLoader::LoadLC( R_SAVED_SIM_NUMBER_INTO_USE, |
|
1358 aNumber ); |
|
1359 iVMSimQueryDialog = CVMSimQueryDilaog::NewL(); |
|
1360 iVMSimQueryDialog->SetVMSimPromptL( *label ); |
|
1361 CleanupStack::PopAndDestroy( label ); |
|
1362 //coverity static analysis tool generates a warning finding here |
|
1363 //ignore that |
|
1364 //coverity[deref_ptr_in_call] |
|
1365 retVal= iVMSimQueryDialog->ExecuteLD( |
|
1366 R_VMBX_TAKE_SIM_NUMBER_INTO_USE ); |
|
1367 //coverity static analysis tool generates a warning finding here |
|
1368 //ignore that |
|
1369 //coverity[check_after_deref] |
|
1370 if ( iVMSimQueryDialog == NULL ) |
|
1371 { |
|
1372 VMBLOGSTRING( "VMBX: RVmbxNumber::QuerySimNumberL: \ |
|
1373 No number inserted" ); |
|
1374 return EFalse; |
|
1375 } |
|
1376 iVMSimQueryDialog = NULL; |
|
1377 if ( retVal ) |
|
1378 { |
|
1379 SetUserEditNumber( lineNumber ); |
|
1380 } |
|
1381 } |
|
1382 } |
|
1383 else |
|
1384 { |
|
1385 // IF VMBX number not defined and number found in SIM, |
|
1386 // number from SIM is used |
|
1387 retVal = EVmbxSimNumAccepted; |
|
1388 ResetUserEditNumber( lineNumber ); |
|
1389 } |
|
1390 |
|
1391 // sim number accepted on line 1 |
|
1392 if ( retVal && ( lineNumber == EAlsLine1 ) ) |
|
1393 { |
|
1394 VMBLOGSTRING( "sim number accepted on line 1" ); |
|
1395 // No write support on sim, use phone memory |
|
1396 if ( !( iFlags & KVmFlagSimWriteSupport ) ) |
|
1397 { |
|
1398 iSession->Set( KVmUsesSimMemory, EVmbxPhoneMemory ); |
|
1399 iMemoryLocation = EVmbxPhoneMemory; |
|
1400 } |
|
1401 else |
|
1402 { |
|
1403 iSession->Set( KVmUsesSimMemory, EVmbxSimMemory ); |
|
1404 iMemoryLocation = EVmbxSimMemory; |
|
1405 } |
|
1406 VMBLOGSTRING( "return ETrue" ); |
|
1407 return ETrue; |
|
1408 } |
|
1409 // sim number accepted on line 2 |
|
1410 else if ( retVal && ( lineNumber == EAlsLine2 ) ) |
|
1411 { |
|
1412 VMBLOGSTRING( "Sim number accepted on line2" ); |
|
1413 return ETrue; |
|
1414 } |
|
1415 // user selection "No" |
|
1416 else |
|
1417 { |
|
1418 VMBLOGSTRING( "VMBX: RVmbxNumber::QuerySimNumberL: \ |
|
1419 No number inserted" ); |
|
1420 return EFalse; |
|
1421 } |
|
1422 } |
|
1423 VMBLOGSTRING( "VMBX: RVmbxNumber::QuerySimNumberL: <=" ); |
|
1424 return EFalse; |
|
1425 } |
|
1426 |
|
1427 // ----------------------------------------------------------------------------- |
|
1428 // RVmbxNumber::ConvertToWesternDigits |
|
1429 // Converts a phone number to western format |
|
1430 // ----------------------------------------------------------------------------- |
|
1431 // |
|
1432 void RVmbxNumber::ConvertToWesternDigits( TDes& aDes ) const |
|
1433 { |
|
1434 VMBLOGSTRING( "VMBX: RVmbxNumber::ConvertToWesternDigits: =>" ); |
|
1435 AknTextUtils::ConvertDigitsTo( aDes, EDigitTypeWestern ); |
|
1436 VMBLOGSTRING( "VMBX: RVmbxNumber::ConvertToWesternDigits: <=" ); |
|
1437 } |
|
1438 |
|
1439 // ----------------------------------------------------------------------------- |
|
1440 // RVmbxNumber::SaveVmbxNumber |
|
1441 // Saves vmbx number to phone or sim memory |
|
1442 // ----------------------------------------------------------------------------- |
|
1443 // |
|
1444 /***************************************************** |
|
1445 * Series 60 Customer / ETel |
|
1446 * Series 60 ETel API |
|
1447 *****************************************************/ |
|
1448 EXPORT_C TInt RVmbxNumber::SaveVmbxNumber( const TDesC& aNumber, |
|
1449 TVmbxNumberEntry aEntry ) |
|
1450 { |
|
1451 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumber: =>" ); |
|
1452 TInt status( KErrNone ); |
|
1453 TInt alsline( EAlsLine1 ); |
|
1454 // get the current ALS line |
|
1455 if ( GetAlsLine( alsline ) != KErrNone ) |
|
1456 { |
|
1457 alsline = EAlsLine1; // if problems, assume primary line |
|
1458 } |
|
1459 |
|
1460 if ( EAlsLine1 == alsline) |
|
1461 { |
|
1462 // Ask place to save if sim available for saving |
|
1463 if ( iFlags & KVmFlagSimWriteSupport ) |
|
1464 { |
|
1465 TInt index( 0 ); |
|
1466 TInt ret( 0 ); |
|
1467 |
|
1468 CAknListQueryDialog* dlg( NULL ); |
|
1469 TRAP_IGNORE( dlg = new( ELeave ) CAknListQueryDialog( &index ) ); |
|
1470 |
|
1471 if ( dlg ) |
|
1472 { |
|
1473 TRAP_IGNORE( ret = dlg->ExecuteLD( R_VMBX_MEMORY_LIST_QUERY ) ); |
|
1474 dlg = NULL; |
|
1475 } |
|
1476 |
|
1477 if ( ret ) |
|
1478 { |
|
1479 // user selected to save number to Sim |
|
1480 if ( EVmbxSimMemory == index ) |
|
1481 { |
|
1482 iMemoryLocation = EVmbxSimMemory; |
|
1483 iSession->Set( KVmUsesSimMemory, EVmbxSimMemory ); |
|
1484 |
|
1485 status = SaveVmbxNumberToSim( aNumber, aEntry ); |
|
1486 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumber: \ |
|
1487 Number saved to Sim" ); |
|
1488 } |
|
1489 // user selected to save number to Phone memory |
|
1490 else if ( EVmbxPhoneMemory == index ) |
|
1491 { |
|
1492 iMemoryLocation = EVmbxPhoneMemory; |
|
1493 iSession->Set( KVmUsesSimMemory, EVmbxPhoneMemory ); |
|
1494 if ( iFlags & KForceSavedToPhoneMem ) |
|
1495 { |
|
1496 SetPhoneMemForcedEdit( alsline ); |
|
1497 } |
|
1498 |
|
1499 status = SaveVmbxNumberToPhone( aNumber, aEntry ); |
|
1500 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumber: \ |
|
1501 Number saved to phone memory" ); |
|
1502 } |
|
1503 } |
|
1504 else// The user has selected Cancel.. so no changes, return KErrCancel |
|
1505 { |
|
1506 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumber: canceled" ); |
|
1507 status = KErrCancel; |
|
1508 } |
|
1509 } |
|
1510 // Line1 in use and no sim available, so use Phone memory |
|
1511 else |
|
1512 { |
|
1513 // Sim write not support and external clients invoke the function |
|
1514 // set phone memory forced edit |
|
1515 if ( iFlags & KForceSavedToPhoneMem ) |
|
1516 { |
|
1517 SetPhoneMemForcedEdit( alsline ); |
|
1518 } |
|
1519 iMemoryLocation = EVmbxPhoneMemory; |
|
1520 iSession->Set( KVmUsesSimMemory, EVmbxPhoneMemory ); |
|
1521 status = SaveVmbxNumberToPhone( aNumber, EAlsActiveLineEntry ); |
|
1522 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumber: \ |
|
1523 Number saved to phone memory" ); |
|
1524 } |
|
1525 } |
|
1526 // EAlsLine2 |
|
1527 else |
|
1528 { |
|
1529 // Sim write not support and external clients invoke the function |
|
1530 // set phone memory forced edit |
|
1531 if ( ( iFlags & KForceSavedToPhoneMem ) && |
|
1532 ! ( iFlags & KVmFlagSimWriteSupport ) ) |
|
1533 { |
|
1534 SetPhoneMemForcedEdit( alsline ); |
|
1535 } |
|
1536 status = SaveVmbxNumberToPhone( aNumber, EAlsActiveLineEntry ); |
|
1537 } |
|
1538 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumber: <=" ); |
|
1539 return status; |
|
1540 } |
|
1541 |
|
1542 |
|
1543 // ----------------------------------------------------------------------------- |
|
1544 // RVmbxNumber::SaveVmbxNumberToSim |
|
1545 // Saves vmbx number to sim memory |
|
1546 // ----------------------------------------------------------------------------- |
|
1547 // |
|
1548 /***************************************************** |
|
1549 * Series 60 Customer / ETel |
|
1550 * Series 60 ETel API |
|
1551 *****************************************************/ |
|
1552 TInt RVmbxNumber::SaveVmbxNumberToSim( const TDesC& aNumber, |
|
1553 TVmbxNumberEntry aEntry ) |
|
1554 { |
|
1555 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumberToSim: =>" ); |
|
1556 |
|
1557 // AllowedToChangeTheNumber() check not done in this method |
|
1558 // in order to always allow saving. |
|
1559 TInt alsline( EAlsLine1 ); |
|
1560 // get the current ALS line |
|
1561 if ( GetAlsLine( alsline ) != KErrNone ) |
|
1562 { |
|
1563 alsline = EAlsLine1; // if problems, assume primary line |
|
1564 } |
|
1565 // ALS line2 not supported when saving to SIM |
|
1566 if ( alsline == EAlsLine2 ) |
|
1567 { |
|
1568 VMBLOGSTRING( "Sim usage for ALS Line2 not supported, \ |
|
1569 return KErrArgument " ); |
|
1570 return KErrArgument; |
|
1571 } |
|
1572 |
|
1573 // number containing "w"-character not allowed to save to sim |
|
1574 if ( aNumber.Find( KVmbxIllegalSimCharacter ) != KErrNotFound ) |
|
1575 { |
|
1576 VMBLOGSTRING( "w-char not allowed, return KErrArgument " ); |
|
1577 return KErrArgument; |
|
1578 } |
|
1579 |
|
1580 __ASSERT_DEBUG( iFlags & KVmFlagOpened, |
|
1581 User::Panic( KVmbxPanicCategory, EVmbxNotConnected ) ); |
|
1582 __ASSERT_DEBUG( aNumber.Length() <= KVmbxMaxNumberLength, |
|
1583 User::Panic( KVmbxPanicCategory, EVmbxNumberTooLong ) ); |
|
1584 |
|
1585 TInt lineNumber( aEntry ); |
|
1586 TInt error( KErrNone ); |
|
1587 |
|
1588 if ( aEntry == EAlsActiveLineEntry ) |
|
1589 { |
|
1590 // get the active ALS line |
|
1591 lineNumber = alsline; |
|
1592 } |
|
1593 |
|
1594 #ifdef VM_USE_TSY |
|
1595 // Update maxLength info |
|
1596 // First read number from sim. |
|
1597 // Then get info of the max size. |
|
1598 // Finally determine actual max size using retrieved info. |
|
1599 // Note! GetInfo reads data from cache, which is updated when write |
|
1600 // attempt is done. So if Ext-files are taken into use by some |
|
1601 // other application while Vmbx is opened, then correct info |
|
1602 // cannot fetch by GetInfo. (This appears when trying to save |
|
1603 // long number twice and first one fails and second is saved |
|
1604 // successfully.) |
|
1605 TBuf<KVmbxMaxNumberLength> numberOnSim; |
|
1606 // return value ignored here, because no meaning for size determination |
|
1607 GetVmNumFromSIM( numberOnSim, lineNumber ); |
|
1608 |
|
1609 TInt ret = DoPhonebookOperation( EVmbxPhonebookGetInfo ); |
|
1610 |
|
1611 if ( ret != KErrNone ) |
|
1612 { |
|
1613 VMBLOGSTRING2( "DoPhonebookOperation getinfo retval = %I", ret ); |
|
1614 return ret; |
|
1615 } |
|
1616 else |
|
1617 { |
|
1618 CalculateActualMaxLengthOnSim( numberOnSim.Length() ); |
|
1619 } |
|
1620 |
|
1621 // store in SIM phonebook |
|
1622 if ( iVmNumOpts == EVmNumOptsBlank ) |
|
1623 { |
|
1624 if ( aNumber.Length() <= iPhoneBookInfo.iMaxNumLength ) |
|
1625 { |
|
1626 VMBLOGSTRING( "SaveVmbxNumberToSim::Num length <= maxNumLength" ); |
|
1627 if ( iFlags & KVmFlagPhonebookBeingCached ) |
|
1628 { |
|
1629 error = DoPhonebookOperation( EVmbxPhonebookGetInfo ); |
|
1630 } |
|
1631 |
|
1632 if ( !error && ( iFlags & KVmFlagSimWriteSupport ) ) |
|
1633 { |
|
1634 TVmbxEntry entry; |
|
1635 entry.iIndex = lineNumber; |
|
1636 |
|
1637 if ( aNumber.Length() ) |
|
1638 { |
|
1639 entry.iTelNumber.Copy( aNumber ); |
|
1640 entry.iText.Copy( KVmbxPhoneBookEntryName ); |
|
1641 entry.iText.AppendNum( lineNumber ); |
|
1642 error = DoPhonebookOperation( EVmbxPhonebookWrite, |
|
1643 &entry ); |
|
1644 VMBLOGSTRING3( "VMBX: RVmbxNumber::SaveVmbxNumberToSim: \ |
|
1645 Write SIM entry %I, status: %I", lineNumber, error ); |
|
1646 } |
|
1647 else |
|
1648 { |
|
1649 error = DoPhonebookOperation( EVmbxPhonebookDelete, |
|
1650 &entry ); |
|
1651 VMBLOGSTRING3( "VMBX: RVmbxNumber::SaveVmbxNumberToSim: \ |
|
1652 Delete SIM entry %I, status: %I", lineNumber, error ); |
|
1653 } |
|
1654 } |
|
1655 } |
|
1656 else |
|
1657 { |
|
1658 error = KErrArgument; |
|
1659 } |
|
1660 } |
|
1661 else |
|
1662 { |
|
1663 error = KErrNotFound; |
|
1664 } |
|
1665 #else // <= VM_USE_TSY |
|
1666 error = KErrNotFound; |
|
1667 #endif // VM_USE_TSY |
|
1668 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumberToSim: <=" ); |
|
1669 return error; //to be removed |
|
1670 } |
|
1671 |
|
1672 // ----------------------------------------------------------------------------- |
|
1673 // RVmbxNumber::SaveVmbxNumberToPhone() |
|
1674 // Saves vmbx number to phone memory |
|
1675 // ----------------------------------------------------------------------------- |
|
1676 // |
|
1677 /***************************************************** |
|
1678 * Series 60 Customer / ETel |
|
1679 * Series 60 ETel API |
|
1680 *****************************************************/ |
|
1681 TInt RVmbxNumber::SaveVmbxNumberToPhone( const TDesC& aNumber, |
|
1682 TVmbxNumberEntry aEntry ) |
|
1683 { |
|
1684 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumberToPhone: =>" ); |
|
1685 |
|
1686 __ASSERT_DEBUG( iFlags & KVmFlagOpened, |
|
1687 User::Panic( KVmbxPanicCategory, EVmbxNotConnected ) ); |
|
1688 __ASSERT_DEBUG( aNumber.Length() <= KVmbxMaxNumberLength, |
|
1689 User::Panic( KVmbxPanicCategory, EVmbxNumberTooLong ) ); |
|
1690 |
|
1691 // AllowedToChangeTheNumber() check not done in this method |
|
1692 // in order to always allow saving. |
|
1693 TInt lineNumber( aEntry ); |
|
1694 TInt error( KErrNone ); |
|
1695 VMBLOGSTRING2( "VMBX: RVmbxNumber::SaveVmbxNumberToPhone \ |
|
1696 the number is from phone or SIM aNumber = %S", &aNumber ); |
|
1697 |
|
1698 if ( aEntry == EAlsActiveLineEntry ) |
|
1699 { |
|
1700 // get the current ALS line |
|
1701 if ( GetAlsLine( lineNumber ) != KErrNone ) |
|
1702 { |
|
1703 lineNumber = EAlsLine1; // if problems, assume primary line |
|
1704 } |
|
1705 } |
|
1706 |
|
1707 TUint32 keyword = lineNumber == |
|
1708 EAlsLine1Entry ? KVmbxNumberLinePrimary: KVmbxNumberLineAuxiliary; |
|
1709 error = iSession->Set( keyword, aNumber ); |
|
1710 |
|
1711 if ( !error ) |
|
1712 { |
|
1713 // Client will generate the event itself on request. |
|
1714 if ( iFlags & KVmFlagNotifyRequested ) |
|
1715 { |
|
1716 HandleNotifyString( keyword, aNumber ); |
|
1717 } |
|
1718 } |
|
1719 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxNumberToPhone: <=" ); |
|
1720 return error; |
|
1721 } |
|
1722 |
|
1723 // ----------------------------------------------------------------------------- |
|
1724 // RVmbxNumber::NotifyVmbxNumberChangeL |
|
1725 // Issues a notify request on a vmbx number change |
|
1726 // ----------------------------------------------------------------------------- |
|
1727 // |
|
1728 EXPORT_C void RVmbxNumber::NotifyVmbxNumberChangeL( |
|
1729 MVmbxNotifyHandler* aHandler, TBool aNotifyOnActiveLineOnly ) |
|
1730 { |
|
1731 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyVmbxNumberChangeL: =>" ); |
|
1732 __ASSERT_DEBUG( iFlags & ( KVmFlagOpened ), |
|
1733 User::Panic( KVmbxPanicCategory, EVmbxNotConnected ) ); |
|
1734 |
|
1735 iNotifyCallBack = aHandler; |
|
1736 SubscribeSATNotificationsL(); // subscribe SAT notifications |
|
1737 |
|
1738 // only issue a new notify request if there isn't one already |
|
1739 if ( !( iFlags & KVmFlagNotifyRequested ) ) |
|
1740 { |
|
1741 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, *iSession ); |
|
1742 iNotifyHandler->StartListeningL(); |
|
1743 |
|
1744 iFlags |= KVmFlagNotifyRequested; |
|
1745 } |
|
1746 |
|
1747 if ( aNotifyOnActiveLineOnly ) |
|
1748 { |
|
1749 iFlags |= KVmFlagNotifyOnActiveLineOnly; |
|
1750 } |
|
1751 else |
|
1752 { |
|
1753 iFlags &= ( ~KVmFlagNotifyOnActiveLineOnly ); |
|
1754 } |
|
1755 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyVmbxNumberChangeL: <=" ); |
|
1756 } |
|
1757 |
|
1758 // ----------------------------------------------------------------------------- |
|
1759 // RVmbxNumber::SubscribeSATNotificationsL |
|
1760 // Subscribe SAT notifications |
|
1761 // ----------------------------------------------------------------------------- |
|
1762 void RVmbxNumber::SubscribeSATNotificationsL() |
|
1763 { |
|
1764 if ( iPhoneBookType == EMBDNPhoneBook ) |
|
1765 { |
|
1766 iRSatSession.ConnectL(); |
|
1767 iRSatClient.OpenL( iRSatSession ); |
|
1768 iObservedFileList.Append( KMbdnEf ); |
|
1769 iObservedFileList.Append( KMbiEf ); |
|
1770 iRSatClient.NotifyFileChangeL( iObservedFileList ); |
|
1771 } |
|
1772 } |
|
1773 |
|
1774 // ----------------------------------------------------------------------------- |
|
1775 // RVmbxNumber::NotifyVmbxNumberChangeCancel |
|
1776 // Cancels a notify request on a vmbx number change. |
|
1777 // ----------------------------------------------------------------------------- |
|
1778 // |
|
1779 EXPORT_C void RVmbxNumber::NotifyVmbxNumberChangeCancel() |
|
1780 { |
|
1781 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyVmbxNumberChangeCancel: =>" ); |
|
1782 __ASSERT_DEBUG( iFlags & KVmFlagOpened, |
|
1783 User::Panic( KVmbxPanicCategory, EVmbxNotConnected ) ); |
|
1784 |
|
1785 iNotifyHandler->StopListening(); |
|
1786 |
|
1787 iFlags &= ( ~KVmFlagNotifyRequested ); |
|
1788 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyVmbxNumberChangeCancel: <=" ); |
|
1789 } |
|
1790 |
|
1791 // ----------------------------------------------------------------------------- |
|
1792 // RVmbxNumber::NotifyAlsLineChangeL |
|
1793 // Issues a notify request on active ALS line change |
|
1794 // ----------------------------------------------------------------------------- |
|
1795 // |
|
1796 EXPORT_C void RVmbxNumber::NotifyAlsLineChangeL( MVmbxAlsObserver* aObserver ) |
|
1797 { |
|
1798 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyAlsLineChangeL: =>" ); |
|
1799 __ASSERT_DEBUG( iFlags & KVmFlagOpened, |
|
1800 User::Panic( KVmbxPanicCategory, EVmbxNotConnected ) ); |
|
1801 iUserAlsObserver = aObserver; |
|
1802 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyAlsLineChangeL: <=" ); |
|
1803 } |
|
1804 |
|
1805 // ----------------------------------------------------------------------------- |
|
1806 // RVmbxNumber::NotifyAlsLineChangeCancel |
|
1807 // Cancels a notify request on ALS line change |
|
1808 // ----------------------------------------------------------------------------- |
|
1809 // |
|
1810 EXPORT_C void RVmbxNumber::NotifyAlsLineChangeCancel() |
|
1811 { |
|
1812 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyAlsLineChangeCancel: =>" ); |
|
1813 __ASSERT_DEBUG( iFlags & KVmFlagOpened, |
|
1814 User::Panic(KVmbxPanicCategory, EVmbxNotConnected) ); |
|
1815 iUserAlsObserver = NULL; |
|
1816 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyAlsLineChangeCancel: <=" ); |
|
1817 } |
|
1818 |
|
1819 // ----------------------------------------------------------------------------- |
|
1820 // RVmbxNumber::Close |
|
1821 // Closes the resources allocated in Open |
|
1822 // ----------------------------------------------------------------------------- |
|
1823 // |
|
1824 /***************************************************** |
|
1825 * Series 60 Customer / ETel |
|
1826 * Series 60 ETel API |
|
1827 *****************************************************/ |
|
1828 EXPORT_C void RVmbxNumber::Close() |
|
1829 { |
|
1830 VMBLOGSTRING( "VMBX: RVmbxNumber::Close: =>" ); |
|
1831 if ( iCntFetch ) |
|
1832 { |
|
1833 delete iCntFetch; |
|
1834 iCntFetch = NULL; |
|
1835 } |
|
1836 |
|
1837 iRSatClient.Cancel(); |
|
1838 iRSatClient.Close(); |
|
1839 iRSatSession.Close(); |
|
1840 if ( iClosedPtr ) |
|
1841 { |
|
1842 *iClosedPtr = ETrue; |
|
1843 iClosedPtr = NULL; |
|
1844 } |
|
1845 |
|
1846 if ( iVMSimQueryDialog ) |
|
1847 { |
|
1848 TRAP_IGNORE( iVMSimQueryDialog->VMSimDismissDialogL() ); |
|
1849 iVMSimQueryDialog = NULL; |
|
1850 } |
|
1851 |
|
1852 if ( iQuery ) |
|
1853 { |
|
1854 delete iQuery; |
|
1855 iQuery = NULL; |
|
1856 } |
|
1857 |
|
1858 if ( iVideoQuery ) |
|
1859 { |
|
1860 delete iVideoQuery; |
|
1861 iVideoQuery = NULL; |
|
1862 } |
|
1863 // Type selection query |
|
1864 if ( iTypeSelectionQuery ) |
|
1865 { |
|
1866 delete iTypeSelectionQuery; |
|
1867 iTypeSelectionQuery = NULL; |
|
1868 } |
|
1869 |
|
1870 iVmbxServiceSelection.Close(); |
|
1871 if ( iResourceFileOffset ) |
|
1872 { |
|
1873 iCoeEnv->DeleteResourceFile( iResourceFileOffset ); |
|
1874 iResourceFileOffset = 0; |
|
1875 } |
|
1876 |
|
1877 CloseETel(); |
|
1878 |
|
1879 iUserAlsObserver = NULL; |
|
1880 |
|
1881 // these automatically cancel all observations as well |
|
1882 |
|
1883 iSsSettings.Close(); |
|
1884 |
|
1885 iFlags = 0; |
|
1886 VMBLOGSTRING( "VMBX: RVmbxNumber::Close: <=" ); |
|
1887 } |
|
1888 |
|
1889 // ----------------------------------------------------------------------------- |
|
1890 // RVmbxNumber::LoadResourceL |
|
1891 // Loads the resources needed for queries and confirmation notes |
|
1892 // ----------------------------------------------------------------------------- |
|
1893 // |
|
1894 void RVmbxNumber::LoadResourceL() |
|
1895 { |
|
1896 VMBLOGSTRING( "VMBX: RVmbxNumber::LoadResourceL: =>" ); |
|
1897 TFileName fileName; |
|
1898 fileName += KVmbxResourceFileDrive; |
|
1899 fileName += KDC_RESOURCE_FILES_DIR; |
|
1900 fileName += KVmbxResourceFileName; |
|
1901 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); |
|
1902 iResourceFileOffset = iCoeEnv->AddResourceFileL( fileName ); |
|
1903 VMBLOGSTRING( "VMBX: RVmbxNumber::LoadResourceL: <=" ); |
|
1904 } |
|
1905 |
|
1906 // ----------------------------------------------------------------------------- |
|
1907 // RVmbxNumber::AllowedToChangeTheNumber |
|
1908 // Check wether the voice mailbox number can be changed |
|
1909 // ----------------------------------------------------------------------------- |
|
1910 // |
|
1911 EXPORT_C TBool RVmbxNumber::AllowedToChangeTheNumber() |
|
1912 { |
|
1913 VMBLOGSTRING( "VMBX: RVmbxNumber::AllowedToChangeTheNumber: =>" ); |
|
1914 TBool ret( ETrue ); |
|
1915 |
|
1916 if ( EUiNmbrChangeNotAllowed & iVmUiOpts ) |
|
1917 { |
|
1918 ret = EFalse; |
|
1919 } |
|
1920 VMBLOGSTRING2( "RVmbxNumber::AllowedToChangeTheNumber \ |
|
1921 iVmUiOpts = %M", iVmUiOpts ); |
|
1922 VMBLOGSTRING( "VMBX: RVmbxNumber::AllowedToChangeTheNumber: <=" ); |
|
1923 return ret; |
|
1924 } |
|
1925 |
|
1926 // ----------------------------------------------------------------------------- |
|
1927 // RVmbxNumber::HandleNotifyString |
|
1928 // To notify the client about changes for string value keys |
|
1929 // ----------------------------------------------------------------------------- |
|
1930 // |
|
1931 void RVmbxNumber::HandleNotifyString( TUint32 aKey, const TDesC16& aValue ) |
|
1932 { |
|
1933 VMBLOGSTRING( "VMBX: RVmbxNumber::HandleNotifyString: =>" ); |
|
1934 TInt alsline( EAlsLine1 ); |
|
1935 |
|
1936 // get the current ALS line |
|
1937 if ( GetAlsLine( alsline ) != KErrNone ) |
|
1938 { |
|
1939 alsline = EAlsLine1; // if problems, assume primary line |
|
1940 } |
|
1941 if ( iNotifyCallBack ) |
|
1942 { |
|
1943 TInt notifyLine( 0 ); |
|
1944 |
|
1945 if ( aKey == KVmbxNumberLinePrimary ) |
|
1946 { |
|
1947 notifyLine = EAlsLine1Entry; |
|
1948 } |
|
1949 else if ( aKey == KVmbxNumberLineAuxiliary ) |
|
1950 { |
|
1951 notifyLine = EAlsLine2Entry; |
|
1952 } |
|
1953 |
|
1954 if ( ( iFlags & KVmFlagNotifyOnActiveLineOnly ) && alsline != notifyLine ) |
|
1955 { |
|
1956 VMBLOGSTRING( "VMBX: RVmbxNumber::HandleNotifyString: \ |
|
1957 Line not notifyline" ); |
|
1958 return; |
|
1959 } |
|
1960 |
|
1961 if ( notifyLine == EAlsLine1Entry || notifyLine == EAlsLine2Entry ) |
|
1962 { |
|
1963 TRAPD( err, iNotifyCallBack->HandleNotifyL( notifyLine, aValue ) ); |
|
1964 if ( err != KErrNone ) |
|
1965 { |
|
1966 VMBLOGSTRING( "VMBX: RVmbxNumber::HandleNotifyString: \ |
|
1967 Notify handle error" ); |
|
1968 _LIT( KVmbxPanicType,"iNotifyCallBack->HandleNotifyL" ); |
|
1969 User::Panic( KVmbxPanicType, err ); |
|
1970 } |
|
1971 } |
|
1972 } |
|
1973 VMBLOGSTRING( "VMBX: RVmbxNumber::HandleNotifyString: <=" ); |
|
1974 } |
|
1975 |
|
1976 // ----------------------------------------------------------------------------- |
|
1977 // RVmbxNumber::HandleNotifyGeneric |
|
1978 // To notify the client about changes in keys when the whole repository |
|
1979 // is listened for. |
|
1980 // ----------------------------------------------------------------------------- |
|
1981 // |
|
1982 void RVmbxNumber::HandleNotifyGeneric( TUint32 aKey ) |
|
1983 { |
|
1984 VMBLOGSTRING( "VMBX: RVmbxNumber::HandleNotifyGeneric: =>" ); |
|
1985 if ( aKey == NCentralRepositoryConstants::KInvalidNotificationId ) |
|
1986 { |
|
1987 |
|
1988 // We have to check which keys have changed. |
|
1989 } |
|
1990 else |
|
1991 { |
|
1992 |
|
1993 //Check the key value of the particular key being changed and |
|
1994 //do further processing. |
|
1995 } |
|
1996 |
|
1997 if ( iQuery ) |
|
1998 { |
|
1999 // if the vmbx number is saved,notify to dismiss the query. |
|
2000 iQuery->DismissQueryDlg(); |
|
2001 } |
|
2002 if ( iVideoQuery ) |
|
2003 { |
|
2004 // if the video number is saved,notify to dismiss the query. |
|
2005 iVideoQuery->DismissQueryDlg(); |
|
2006 } |
|
2007 VMBLOGSTRING( "VMBX: RVmbxNumber::HandleNotifyGeneric: <=" ); |
|
2008 } |
|
2009 |
|
2010 |
|
2011 // ----------------------------------------------------------------------------- |
|
2012 // RVmbxNumber::PhoneSettingChanged |
|
2013 // To notify changes in SS settings in phone |
|
2014 // ----------------------------------------------------------------------------- |
|
2015 // |
|
2016 void RVmbxNumber::PhoneSettingChanged( TSSSettingsSetting aSetting, |
|
2017 TInt aNewValue ) |
|
2018 { |
|
2019 VMBLOGSTRING( "VMBX: RVmbxNumber::PhoneSettingChanged: =>" ); |
|
2020 TInt alsline( EAlsLine1 ); |
|
2021 if ( aSetting == ESSSettingsAls ) |
|
2022 { |
|
2023 alsline = ( aNewValue == |
|
2024 ESSSettingsAlsAlternate ? EAlsLine2Entry : EAlsLine1Entry ); |
|
2025 |
|
2026 if ( iUserAlsObserver ) |
|
2027 { |
|
2028 TRAP_IGNORE( iUserAlsObserver->HandleAlsChangeL( |
|
2029 ( TVmbxAlsLine ) alsline ) ); |
|
2030 } |
|
2031 } |
|
2032 VMBLOGSTRING( "VMBX: RVmbxNumber::PhoneSettingChanged: <=" ); |
|
2033 } |
|
2034 |
|
2035 // ----------------------------------------------------------------------------- |
|
2036 // RVmbxNumber::GetAlsLine |
|
2037 // Fetches ALS line from SS settings |
|
2038 // ----------------------------------------------------------------------------- |
|
2039 // |
|
2040 EXPORT_C TInt RVmbxNumber::GetAlsLine( TInt& aLineNumber ) const |
|
2041 { |
|
2042 VMBLOGSTRING( "VMBX: RVmbxNumber::GetAlsLine: =>" ); |
|
2043 aLineNumber = EAlsLine1; |
|
2044 |
|
2045 TInt alsline( ESSSettingsAlsPrimary ); |
|
2046 |
|
2047 TInt ret = CONST_CAST( RVmbxNumber*, this )->iSsSettings.Get( |
|
2048 ESSSettingsAls, alsline ); |
|
2049 |
|
2050 if ( alsline == ESSSettingsAlsAlternate ) |
|
2051 { |
|
2052 aLineNumber = EAlsLine2; |
|
2053 } |
|
2054 VMBLOGSTRING( "VMBX: RVmbxNumber::GetAlsLine: <=" ); |
|
2055 return ret; |
|
2056 } |
|
2057 |
|
2058 // ----------------------------------------------------------------------------- |
|
2059 // RVmbxNumber::ShowConfirmationNoteL |
|
2060 // Shows confirmation note to user |
|
2061 // ----------------------------------------------------------------------------- |
|
2062 // |
|
2063 void RVmbxNumber::ShowConfirmationNoteL( TInt aResourceId ) const |
|
2064 { |
|
2065 VMBLOGSTRING( "VMBX: RVmbxNumber::ShowConfirmationNoteL: =>" ); |
|
2066 HBufC* prompt = StringLoader::LoadLC( aResourceId, iCoeEnv ); |
|
2067 |
|
2068 CAknConfirmationNote* note = new( ELeave ) CAknConfirmationNote( ETrue ); |
|
2069 |
|
2070 note->ExecuteLD( *prompt ); |
|
2071 |
|
2072 CleanupStack::PopAndDestroy( prompt ); |
|
2073 VMBLOGSTRING( "VMBX: RVmbxNumber::ShowConfirmationNoteL: <=" ); |
|
2074 } |
|
2075 |
|
2076 // ----------------------------------------------------------------------------- |
|
2077 // RVmbxNumber::IsValidPhoneNumber |
|
2078 // Validates phone number |
|
2079 // ----------------------------------------------------------------------------- |
|
2080 // |
|
2081 TBool RVmbxNumber::IsValidPhoneNumber( const TDesC& aNumber ) const |
|
2082 { |
|
2083 VMBLOGSTRING( "VMBX: RVmbxNumber::IsValidPhoneNumber: =>" ); |
|
2084 TBool isValid( EFalse ); |
|
2085 |
|
2086 if ( aNumber.Length() >= KVmPhNumMinLength ) |
|
2087 { |
|
2088 TInt index( 0 ); |
|
2089 TInt digits( 0 ); |
|
2090 |
|
2091 // Skip the possible '*'s and '#'s in the beginning. |
|
2092 while ( index < aNumber.Length() && |
|
2093 ( aNumber[ index ] == '#' || aNumber[ index ] == '*' || |
|
2094 aNumber[ index ] == ' ') ) |
|
2095 { |
|
2096 index++; |
|
2097 } |
|
2098 |
|
2099 // Skip the possible '+'. |
|
2100 if ( index < aNumber.Length() && aNumber[ index ] == '+' ) |
|
2101 { |
|
2102 index++; |
|
2103 } |
|
2104 |
|
2105 // Count the digits. |
|
2106 // For this let's use another index so that the following |
|
2107 // operation will start from the beginning of the actual |
|
2108 // vmbx number |
|
2109 TInt loopindex = index; |
|
2110 |
|
2111 while ( loopindex < aNumber.Length() && |
|
2112 ( aNumber[ loopindex ] >= '0' && aNumber[ loopindex ] <= '9' |
|
2113 || aNumber[ loopindex ] == ' ') ) |
|
2114 { |
|
2115 if ( aNumber[ loopindex ] != ' ' ) |
|
2116 { |
|
2117 digits++; |
|
2118 } |
|
2119 loopindex++; |
|
2120 } |
|
2121 |
|
2122 // Check that there are only allowed characters in the remaining string. |
|
2123 while ( index < aNumber.Length() ) |
|
2124 { |
|
2125 TText t = aNumber[ index ]; |
|
2126 |
|
2127 if ( (t < '0' && t > '9') || t == ' ' ) |
|
2128 { |
|
2129 break; |
|
2130 } |
|
2131 index++; |
|
2132 } |
|
2133 |
|
2134 // If only legal characters were encountered, index is now same as |
|
2135 // the length of the string. |
|
2136 |
|
2137 // phone number part must have 2...41 digits |
|
2138 // '+' is only allowed as the first character in the string |
|
2139 if ( digits >= KVmPhoneNumDigitsMinLength && |
|
2140 digits <= KVmPhoneNumDigitsMaxLength && |
|
2141 index == aNumber.Length()) |
|
2142 { |
|
2143 isValid = ETrue; |
|
2144 } |
|
2145 } |
|
2146 VMBLOGSTRING( "VMBX: RVmbxNumber::IsValidPhoneNumber: <=" ); |
|
2147 return isValid; |
|
2148 } |
|
2149 |
|
2150 // ----------------------------------------------------------------------------- |
|
2151 // RVmbxNumber::IsEmergencyNumberL |
|
2152 // Checks if a number is an emergency number. |
|
2153 // ----------------------------------------------------------------------------- |
|
2154 // |
|
2155 TBool RVmbxNumber::IsEmergencyNumberL( const TDesC& aNumber ) |
|
2156 { |
|
2157 VMBLOGSTRING( "VMBX: RVmbxNumber::IsEmergencyNumberL: =>" ); |
|
2158 TBool isEmergency = EFalse; |
|
2159 |
|
2160 // Emergency Call API does not strip invalid characters like Call UI does, so it is done manually here. |
|
2161 TPhCltTelephoneNumber number( aNumber.Left( KPhCltTelephoneNumberLength ) ); |
|
2162 PhCltUtils::RemoveInvalidChars( number ); |
|
2163 |
|
2164 CPhCltEmergencyCall* emergencyCall = CPhCltEmergencyCall::NewL( this ); |
|
2165 |
|
2166 TInt result = emergencyCall->IsEmergencyPhoneNumber( number, isEmergency ); |
|
2167 delete emergencyCall; |
|
2168 if ( result != KErrNone ) |
|
2169 { |
|
2170 return EFalse; |
|
2171 } |
|
2172 VMBLOGSTRING( "VMBX: RVmbxNumber::IsEmergencyNumberL: <=" ); |
|
2173 return isEmergency; |
|
2174 } |
|
2175 |
|
2176 // --------------------------------------------------------- |
|
2177 // RVmbxNumber::HandleEmergencyDialL() |
|
2178 // --------------------------------------------------------- |
|
2179 // |
|
2180 void RVmbxNumber::HandleEmergencyDialL( const TInt /*aStatus*/ ) |
|
2181 { |
|
2182 // No action |
|
2183 } |
|
2184 |
|
2185 |
|
2186 // ----------------------------------------------------------------------------- |
|
2187 // RVmbxNumber::PhoneBookInfo |
|
2188 // Fetches information about the SIM phonebook for vmbx numbers |
|
2189 // ----------------------------------------------------------------------------- |
|
2190 // |
|
2191 /***************************************************** |
|
2192 * Series 60 Customer / ETel |
|
2193 * Series 60 ETel API |
|
2194 *****************************************************/ |
|
2195 TInt RVmbxNumber::PhoneBookInfo() |
|
2196 { |
|
2197 VMBLOGSTRING( "VMBX: RVmbxNumber::PhoneBookInfo: =>" ); |
|
2198 TRequestStatus status( KErrNone ); |
|
2199 TInt alsline( EAlsLine1 ); |
|
2200 |
|
2201 // get the current ALS line |
|
2202 if ( GetAlsLine( alsline ) != KErrNone ) |
|
2203 { |
|
2204 alsline = EAlsLine1; // if problems, assume primary line |
|
2205 } |
|
2206 |
|
2207 // This may return KErrInUse if phonebook is being cached |
|
2208 iPhoneBook.GetInfo( status, iPhoneBookInfoPckg ); |
|
2209 User::WaitForRequest( status ); // Wait for asynchronous call to finish |
|
2210 |
|
2211 VMBLOGSTRING2( "VMBX: RVmbxNumber::PhoneBookInfo: \ |
|
2212 SIM Phonebook info read, status: %I", status.Int() ); |
|
2213 VMBLOGSTRING2( "VMBX: RVmbxNumber::PhoneBookInfo: \ |
|
2214 SIM Phonebook write access = %I", |
|
2215 iPhoneBookInfo.iCaps & RMobilePhoneBookStore::KCapsWriteAccess ? 1 : 0); |
|
2216 iFlags &= ~KVmFlagPhonebookBeingCached; |
|
2217 iFlags &= ~KVmFlagSimVmbxNumSupport; |
|
2218 |
|
2219 VMBLOGSTRING2( "MaxNum length from sim: %I", iPhoneBookInfo.iMaxNumLength ); |
|
2220 if ( status == KErrInUse || status == KErrNotReady ) |
|
2221 { |
|
2222 iFlags |= KVmFlagPhonebookBeingCached; |
|
2223 VMBLOGSTRING( "Phonebook Being Cached" ); |
|
2224 } |
|
2225 else if ( status == KErrNone ) |
|
2226 { |
|
2227 //If read access, only then write access possible |
|
2228 if ( iPhoneBookInfo.iCaps & RMobilePhoneBookStore::KCapsReadAccess ) |
|
2229 { |
|
2230 VMBLOGSTRING( "ReadAccess ok" ); |
|
2231 iFlags |= KVmFlagSimReadSupport; |
|
2232 |
|
2233 if ( iPhoneBookInfo.iCaps & RMobilePhoneBookStore::KCapsWriteAccess ) |
|
2234 { |
|
2235 VMBLOGSTRING( "WriteAccess ok" ); |
|
2236 iFlags |= KVmFlagSimWriteSupport; |
|
2237 iFlags |= KVmFlagSimVmbxNumSupport; |
|
2238 } |
|
2239 // Sim access rights are tested only in start up |
|
2240 if ( iStartUpTest ) |
|
2241 { |
|
2242 TestAndSetSimAccessFlags(); |
|
2243 } |
|
2244 } |
|
2245 //As there is no sim support set the memory to phone memory |
|
2246 else |
|
2247 { |
|
2248 // No write capability and line1 in use |
|
2249 if ( ( iMemoryLocation != EVmbxPhoneMemory ) && |
|
2250 ( alsline == EAlsLine1 ) ) |
|
2251 { |
|
2252 iMemoryLocation = EVmbxPhoneMemory; |
|
2253 iSession->Set( KVmUsesSimMemory, EVmbxPhoneMemory ); |
|
2254 } |
|
2255 iFlags &= ~KVmFlagSimReadSupport; |
|
2256 } |
|
2257 } |
|
2258 // no caps fetched |
|
2259 else |
|
2260 { |
|
2261 if ( ( iMemoryLocation != EVmbxPhoneMemory ) && |
|
2262 ( alsline == EAlsLine1 ) ) |
|
2263 {//as there is no sim support set the memory to phone memory |
|
2264 iMemoryLocation = EVmbxPhoneMemory; |
|
2265 iSession->Set( KVmUsesSimMemory, EVmbxPhoneMemory ); |
|
2266 } |
|
2267 iFlags &= ~KVmFlagSimReadSupport; |
|
2268 VMBLOGSTRING( "USim not supported" ); |
|
2269 status = KErrNone; |
|
2270 } |
|
2271 VMBLOGSTRING( "VMBX: RVmbxNumber::PhoneBookInfo: <=" ); |
|
2272 return status.Int(); |
|
2273 } |
|
2274 |
|
2275 // ----------------------------------------------------------------------------- |
|
2276 // RVmbxNumber::IsReadOnlySIM |
|
2277 // Checks if writing to sim is prohibited |
|
2278 // ----------------------------------------------------------------------------- |
|
2279 // |
|
2280 TBool RVmbxNumber::IsReadOnlySIM() |
|
2281 { |
|
2282 VMBLOGSTRING( "VMBX: RVmbxNumber::IsReadOnlySIM. =>" ); |
|
2283 |
|
2284 TBool readOnlySIM = EFalse; |
|
2285 iSession->Get( KReadOnlySim, readOnlySIM ); |
|
2286 VMBLOGSTRING2( "VMBX: RVmbxNumber::IsReadOnlySIM: \ |
|
2287 read only flag = %I", readOnlySIM ); |
|
2288 return readOnlySIM; |
|
2289 } |
|
2290 |
|
2291 // ----------------------------------------------------------------------------- |
|
2292 // RVmbxNumber::DoPhonebookOperation |
|
2293 // Does a vmbx phonebook operation |
|
2294 // ----------------------------------------------------------------------------- |
|
2295 // |
|
2296 TInt RVmbxNumber::DoPhonebookOperation( TVmbxPhonebookOperation aOperation, |
|
2297 TVmbxEntry* aEntry ) |
|
2298 { |
|
2299 VMBLOGSTRING( "VMBX: RVmbxNumber::DoPhonebookOperation: =>" ); |
|
2300 TInt result( KErrNone ); |
|
2301 TInt retryCounter( KVmbxPhonebookRetriesIfInUse ); |
|
2302 |
|
2303 FOREVER |
|
2304 { |
|
2305 retryCounter--; |
|
2306 |
|
2307 switch ( aOperation ) |
|
2308 { |
|
2309 case EVmbxPhonebookGetInfo: |
|
2310 { |
|
2311 result = PhoneBookInfo(); |
|
2312 break; |
|
2313 } |
|
2314 case EVmbxPhonebookRead: |
|
2315 { |
|
2316 TRAPD( readErr, PhonebookReadL( *aEntry ) ); |
|
2317 if ( readErr != KErrNone && readErr != KErrNotFound ) |
|
2318 { |
|
2319 result = KErrNotSupported; |
|
2320 } |
|
2321 break; |
|
2322 } |
|
2323 case EVmbxPhonebookWrite: |
|
2324 { |
|
2325 result = PhonebookWrite( *aEntry ); |
|
2326 break; |
|
2327 } |
|
2328 case EVmbxPhonebookDelete: |
|
2329 { |
|
2330 result = PhonebookDelete( *aEntry ); |
|
2331 break; |
|
2332 } |
|
2333 default: |
|
2334 { |
|
2335 __ASSERT_DEBUG( 0, User::Panic( KVmbxPanicCategory, |
|
2336 EVmbxUnhandledOperation) ); |
|
2337 break; |
|
2338 } |
|
2339 } |
|
2340 |
|
2341 if ( result != KErrInUse || retryCounter <= 0 ) |
|
2342 { |
|
2343 break; |
|
2344 } |
|
2345 |
|
2346 iFlags |= KVmFlagPhonebookBeingCached; |
|
2347 User::After( KVmbxPhonebookRetryDelay ); |
|
2348 } |
|
2349 // set readonly state if aquired |
|
2350 if ( IsReadOnlySIM() ) |
|
2351 { |
|
2352 iFlags &= ~KVmFlagSimWriteSupport; |
|
2353 VMBLOGSTRING( "VMBX: RVmbxNumber::DoPhonebookOperation: ReadOnly set" ); |
|
2354 } |
|
2355 |
|
2356 VMBLOGSTRING( "VMBX: RVmbxNumber::DoPhonebookOperation: <=" ); |
|
2357 return result; |
|
2358 } |
|
2359 |
|
2360 // ----------------------------------------------------------------------------- |
|
2361 // RVmbxNumber::PhonebookReadL |
|
2362 // Reads an entry from the ICC-based phonebook |
|
2363 // ----------------------------------------------------------------------------- |
|
2364 // |
|
2365 /***************************************************** |
|
2366 * Series 60 Customer / ETel |
|
2367 * Series 60 ETel API |
|
2368 *****************************************************/ |
|
2369 void RVmbxNumber::PhonebookReadL( TVmbxEntry& aEntry ) |
|
2370 { |
|
2371 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookReadL: =>" ); |
|
2372 TRequestStatus status( KErrNone ); |
|
2373 TInt numEntries( 1 ); |
|
2374 TBuf8<KVmbxPhonebookBufferSize> pbData; |
|
2375 pbData.FillZ(); |
|
2376 pbData.Zero(); |
|
2377 TInt result( KErrNone ); |
|
2378 |
|
2379 // Reset variables |
|
2380 iNumberFound = EFalse; |
|
2381 if ( iAlphaStringFound ) |
|
2382 { |
|
2383 delete iAlphaStringFromSIM; |
|
2384 iAlphaStringFromSIM = NULL; |
|
2385 } |
|
2386 iAlphaStringFound = EFalse; |
|
2387 |
|
2388 TInt lineNumber( EAlsLine1 ); |
|
2389 if ( KErrNone != GetAlsLine( lineNumber ) ) |
|
2390 { |
|
2391 lineNumber = EAlsLine1; |
|
2392 } |
|
2393 |
|
2394 if ( ( iPhoneBookType == EMBDNPhoneBook ) && ( EAlsLine1 == lineNumber ) ) |
|
2395 { |
|
2396 VMBLOGSTRING( "start MBDN PhoneBook read" ); |
|
2397 VMBLOGSTRING2( "VMBX: RVmbxNumber::PhonebookReadL: \ |
|
2398 iPhoneVoicemailInfo.iVoice = %I", iPhoneVoicemailInfo.iVoice ); |
|
2399 iPhoneBook.Read( status, iPhoneVoicemailInfo.iVoice, |
|
2400 numEntries, pbData ); |
|
2401 } |
|
2402 else |
|
2403 { |
|
2404 // Record#1 in sim is for line1 number and Record#2 in sim is for |
|
2405 // line2 number so line is used to fetch |
|
2406 VMBLOGSTRING( "start VMBX PhoneBook read" ); |
|
2407 iPhoneBook.Read( status, aEntry.iIndex, numEntries, pbData ); |
|
2408 } |
|
2409 |
|
2410 User::WaitForRequest( status ); // Wait for asynchronous call to finish |
|
2411 VMBLOGSTRING2( "PhoneBook read status = %I", status.Int() ); |
|
2412 |
|
2413 if ( status == KErrNone || status == KErrNotFound ) |
|
2414 { |
|
2415 if ( pbData.Length() ) |
|
2416 { |
|
2417 // -> Search Tags "ETagPBNumber" and "ETagPBText" |
|
2418 // and read (decode) them |
|
2419 TUint8 tagValue(0); |
|
2420 CPhoneBookBuffer::TPhBkTagType dataType( |
|
2421 CPhoneBookBuffer::EPhBkTypeNoData ); |
|
2422 |
|
2423 CPhoneBookBuffer* pbkBuffer = NULL; |
|
2424 TRAPD( err, pbkBuffer = new(ELeave) CPhoneBookBuffer() ); |
|
2425 if ( err != KErrNone ) |
|
2426 { |
|
2427 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookReadL: \ |
|
2428 Phonebook creation error" ); |
|
2429 User::Leave( err ); |
|
2430 } |
|
2431 |
|
2432 pbkBuffer->Set( &pbData ); |
|
2433 pbkBuffer->StartRead(); |
|
2434 |
|
2435 // Read first "new-entry-tag" |
|
2436 result = pbkBuffer->GetTagAndType( tagValue, dataType ); |
|
2437 |
|
2438 if ( result != KErrNone || tagValue != RMobilePhoneBookStore::ETagPBNewEntry) |
|
2439 { |
|
2440 delete pbkBuffer; |
|
2441 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookReadL: \ |
|
2442 Unknown error" ); |
|
2443 User::Leave( KErrUnknown ); // Something wrong in TLV |
|
2444 } |
|
2445 |
|
2446 // search number and text fields from TLV entry |
|
2447 result = pbkBuffer->GetTagAndType( tagValue, dataType ); |
|
2448 |
|
2449 while ( result == KErrNone && pbkBuffer->RemainingReadLength() > 0 ) |
|
2450 { |
|
2451 VMBLOGSTRING2("VMBX: RVmbxNumber::PhonebookReadL(): tagValue: %d", tagValue ) |
|
2452 VMBLOGSTRING2("VMBX: RVmbxNumber::PhonebookReadL(): dataType: %d", dataType ) |
|
2453 |
|
2454 // Check for text field |
|
2455 if ( tagValue == RMobilePhoneBookStore::ETagPBText ) |
|
2456 { |
|
2457 // Alpha string field found from TLV entry, |
|
2458 // assuming 16bit data |
|
2459 TPtrC16 alphaPtrC; |
|
2460 result = pbkBuffer->GetValue( alphaPtrC ); |
|
2461 if ( result == KErrNone ) |
|
2462 { |
|
2463 iAlphaStringFromSIM = alphaPtrC.AllocL(); |
|
2464 iAlphaStringFound = ETrue; |
|
2465 VMBLOGSTRING2("VMBX: RVmbxNumber::PhonebookReadL(): iAlphaStringFromSIM: %S", iAlphaStringFromSIM ) |
|
2466 } |
|
2467 } |
|
2468 // Check for number field |
|
2469 else if ( tagValue == RMobilePhoneBookStore::ETagPBNumber ) |
|
2470 { |
|
2471 // Number field found from TLV entry, assuming 16bit data |
|
2472 TPtrC16 numberPtrC; |
|
2473 result = pbkBuffer->GetValue( numberPtrC ); |
|
2474 iNumberFound = ETrue; |
|
2475 VMBLOGSTRING("VMBX: RVmbxNumber::PhonebookReadL(): ETagPBNumber found."); |
|
2476 |
|
2477 if ( result == KErrNone ) |
|
2478 { |
|
2479 // Error code is returned if number not fit to |
|
2480 // local buffer. |
|
2481 if ( numberPtrC.Length() > aEntry.iTelNumber.MaxLength() ) |
|
2482 { |
|
2483 delete pbkBuffer; |
|
2484 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookReadL: \ |
|
2485 Overflow error" ); |
|
2486 User::Leave( KErrOverflow ); |
|
2487 } |
|
2488 else |
|
2489 { |
|
2490 // copy number to local buffer |
|
2491 aEntry.iTelNumber.Copy( numberPtrC ); |
|
2492 VMBLOGSTRING2("VMBX: RVmbxNumber::PhonebookReadL(): ETagPBNumber found. Number: %S", &aEntry.iTelNumber ); |
|
2493 } |
|
2494 } |
|
2495 } |
|
2496 else |
|
2497 { |
|
2498 // skip field |
|
2499 pbkBuffer->SkipValue( dataType ); |
|
2500 } |
|
2501 // Read next field type |
|
2502 result = pbkBuffer->GetTagAndType( tagValue, dataType ); |
|
2503 } |
|
2504 |
|
2505 // Number and Alpha fields not found from TLV entry |
|
2506 if ( !iAlphaStringFound && !iNumberFound ) |
|
2507 { |
|
2508 delete pbkBuffer; |
|
2509 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookReadL: \ |
|
2510 Not found error" ); |
|
2511 User::Leave( KErrNotFound ); |
|
2512 } |
|
2513 delete pbkBuffer; |
|
2514 } |
|
2515 else |
|
2516 { |
|
2517 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookReadL: Not found error" ); |
|
2518 iNumberFromSim.FillZ(); |
|
2519 iNumberFromSim.Zero(); |
|
2520 User::Leave( KErrNotFound ); |
|
2521 } |
|
2522 } |
|
2523 else |
|
2524 { |
|
2525 // sim read-only and number fetched by GetPhonebookInfo |
|
2526 // so return number |
|
2527 if ( iNumberFromSim.Length() && !( iFlags & KVmFlagSimWriteSupport ) ) |
|
2528 { |
|
2529 aEntry.iTelNumber.Copy( iNumberFromSim ); |
|
2530 iMemoryLocation = EVmbxPhoneMemory; |
|
2531 iSession->Set( KVmUsesSimMemory, EVmbxPhoneMemory ); |
|
2532 VMBLOGSTRING2( "Number value = %S", &iNumberFromSim ); |
|
2533 VMBLOGSTRING2( "iMemoryLocation = %d", iMemoryLocation ); |
|
2534 VMBLOGSTRING( "Startuptest ongoing, read only sim, number fetched" ); |
|
2535 } |
|
2536 else |
|
2537 { |
|
2538 User::Leave( status.Int() ); |
|
2539 } |
|
2540 } |
|
2541 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookReadL: <=" ); |
|
2542 } |
|
2543 |
|
2544 // ----------------------------------------------------------------------------- |
|
2545 // RVmbxNumber::PhonebookWrite |
|
2546 // Writes an entry into ICC-based phonebook |
|
2547 // ----------------------------------------------------------------------------- |
|
2548 // |
|
2549 /***************************************************** |
|
2550 * Series 60 Customer / ETel |
|
2551 * Series 60 ETel API |
|
2552 *****************************************************/ |
|
2553 TInt RVmbxNumber::PhonebookWrite( TVmbxEntry& aEntry ) |
|
2554 { |
|
2555 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookWrite: =>" ); |
|
2556 TRequestStatus status( KErrNone ); |
|
2557 TBuf8<KVmbxPhonebookBufferSize> pbData; |
|
2558 pbData.FillZ(); |
|
2559 |
|
2560 CPhoneBookBuffer* pbkBuffer = NULL; |
|
2561 TRAPD( err, pbkBuffer = new(ELeave) CPhoneBookBuffer() ); |
|
2562 if (err != KErrNone) |
|
2563 { |
|
2564 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookWrite: \ |
|
2565 Phonebook creation error" ); |
|
2566 return err; |
|
2567 } |
|
2568 |
|
2569 pbkBuffer->Set( &pbData ); |
|
2570 |
|
2571 // New entry |
|
2572 status = pbkBuffer->AddNewEntryTag(); |
|
2573 |
|
2574 // Add index |
|
2575 // Type of index is TUint16 in Multimode ETel and TInt in old ETel. |
|
2576 status = pbkBuffer->PutTagAndValue( RMobilePhoneBookStore::ETagPBAdnIndex, |
|
2577 (TUint16)aEntry.iIndex ); |
|
2578 |
|
2579 // Add name if it existed on SIM card |
|
2580 // Type of ETagPBText is TDes16 |
|
2581 if ( iAlphaStringFound ) |
|
2582 { |
|
2583 status = pbkBuffer->PutTagAndValue( RMobilePhoneBookStore::ETagPBText, |
|
2584 *iAlphaStringFromSIM ); |
|
2585 } |
|
2586 |
|
2587 // Add number |
|
2588 // Type of ETagPBNumber is TDes16 |
|
2589 status = pbkBuffer->PutTagAndValue( RMobilePhoneBookStore::ETagPBNumber, |
|
2590 aEntry.iTelNumber ); |
|
2591 if ( iPhoneBookType == EMBDNPhoneBook ) |
|
2592 { |
|
2593 TInt index = iPhoneVoicemailInfo.iVoice; |
|
2594 VMBLOGSTRING2( "VMBX: RVmbxNumber::PhonebookWrite: \ |
|
2595 iPhoneVoicemailInfo.iVoice index = %I", index ); |
|
2596 iPhoneBook.Write( status, pbData, index ); |
|
2597 VMBLOGSTRING( "Mbdn writing" ); |
|
2598 } |
|
2599 else |
|
2600 { |
|
2601 iPhoneBook.Write( status, pbData, aEntry.iIndex ); |
|
2602 VMBLOGSTRING( "6f17 writing" ); |
|
2603 } |
|
2604 User::WaitForRequest( status ); // Wait for asynchronous call to finish |
|
2605 VMBLOGSTRING2( "PhonebookWrite: status=%I", status.Int() ); |
|
2606 |
|
2607 delete pbkBuffer; |
|
2608 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookWrite: <=" ); |
|
2609 return status.Int(); |
|
2610 } |
|
2611 |
|
2612 // ----------------------------------------------------------------------------- |
|
2613 // RVmbxNumber::PhonebookDelete |
|
2614 // Removes an entry from ICC-based phonebook |
|
2615 // ----------------------------------------------------------------------------- |
|
2616 // |
|
2617 /***************************************************** |
|
2618 * Series 60 Customer / ETel |
|
2619 * Series 60 ETel API |
|
2620 *****************************************************/ |
|
2621 TInt RVmbxNumber::PhonebookDelete( TVmbxEntry& aEntry ) |
|
2622 { |
|
2623 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookDelete: =>" ); |
|
2624 TInt lineNumber( EAlsLine1 ); |
|
2625 if ( KErrNone != GetAlsLine( lineNumber ) ) |
|
2626 { |
|
2627 lineNumber = EAlsLine1; |
|
2628 } |
|
2629 |
|
2630 TRequestStatus status( KErrNone ); |
|
2631 if ( ( iPhoneBookType == EMBDNPhoneBook ) && ( EAlsLine1 == lineNumber ) ) |
|
2632 { |
|
2633 TInt index = iPhoneVoicemailInfo.iVoice; |
|
2634 iPhoneBook.Delete( status, index ); |
|
2635 } |
|
2636 else |
|
2637 { |
|
2638 iPhoneBook.Delete( status, aEntry.iIndex ); |
|
2639 } |
|
2640 User::WaitForRequest( status ); // Wait for asynchronous call to finish |
|
2641 VMBLOGSTRING( "VMBX: RVmbxNumber::PhonebookDelete: <=" ); |
|
2642 return status.Int(); |
|
2643 } |
|
2644 |
|
2645 |
|
2646 // ----------------------------------------------------------------------------- |
|
2647 // RVmbxNumber::FetchNumberFromPhonebook2L |
|
2648 // Create and show Phonebook's Single Fetch Dialog |
|
2649 // ----------------------------------------------------------------------------- |
|
2650 // |
|
2651 void RVmbxNumber::FetchNumberFromPhonebook2L( TDes& aPhoneNumber ) |
|
2652 { |
|
2653 VMBLOGSTRING( "VMBX: RVmbxNumber::FetchNumberFromPhonebook2L: =>" ); |
|
2654 |
|
2655 CPhCntFactory* contactFactory = CreateCntFactoryL(); |
|
2656 CleanupStack::PushL( contactFactory ); |
|
2657 iCntFetch = NULL; |
|
2658 iCntFetch = contactFactory->CreateSingleItemFetchL(); |
|
2659 CPhCntSelection* contactSelect = NULL; |
|
2660 |
|
2661 TRAPD( error, contactSelect = iCntFetch->SelectPhoneNumberLD() ); |
|
2662 // Task swapper close activated |
|
2663 if ( error != KErrNone ) |
|
2664 { |
|
2665 contactSelect = NULL; |
|
2666 iCntFetch = NULL; |
|
2667 User::Leave( error ); //close application |
|
2668 } |
|
2669 |
|
2670 // This check is needed because contactselect is NULL in case of user |
|
2671 // presses back in contact fetch dialog. It will NOT leave. |
|
2672 if ( contactSelect ) |
|
2673 { |
|
2674 if ( contactSelect->Number().Length() ) |
|
2675 { |
|
2676 aPhoneNumber = contactSelect->Number().Left( KVmbxMaxNumberLength ); |
|
2677 } |
|
2678 delete contactSelect; |
|
2679 contactSelect = NULL; |
|
2680 } |
|
2681 |
|
2682 iCntFetch = NULL; |
|
2683 CleanupStack::PopAndDestroy( contactFactory ); |
|
2684 |
|
2685 //for removing special chars from number fetched from phone book |
|
2686 TText ch = 0; |
|
2687 TInt len = aPhoneNumber.Length(); |
|
2688 for ( TInt cnt = 0; cnt < len; cnt++ ) |
|
2689 { |
|
2690 ch = aPhoneNumber[cnt]; |
|
2691 switch ( ch ) |
|
2692 { |
|
2693 case '(': |
|
2694 case ')': |
|
2695 case '-': |
|
2696 case ' ': |
|
2697 { |
|
2698 aPhoneNumber.Delete( cnt, 1 ); |
|
2699 cnt--; |
|
2700 len = aPhoneNumber.Length(); |
|
2701 break; |
|
2702 } |
|
2703 default: |
|
2704 break; |
|
2705 } |
|
2706 } |
|
2707 |
|
2708 |
|
2709 VMBLOGSTRING( "VMBX: RVmbxNumber::FetchNumberFromPhonebook2L: <=" ); |
|
2710 } |
|
2711 |
|
2712 // ----------------------------------------------------------------------------- |
|
2713 // RVmbxNumber::GetVmNumFromSIM |
|
2714 // Retrieves voice mailbox number from SIM/R-UIM |
|
2715 // ----------------------------------------------------------------------------- |
|
2716 // |
|
2717 #ifdef VM_USE_TSY |
|
2718 TInt RVmbxNumber::GetVmNumFromSIM( TDes& aNumber, TInt aLineNumber ) |
|
2719 #else |
|
2720 TInt RVmbxNumber::GetVmNumFromSIM( TDes& /*aNumber*/, TInt /*aLineNumber*/ ) |
|
2721 #endif |
|
2722 { |
|
2723 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmNumFromSIM: =>" ); |
|
2724 TInt ret( KErrNotFound ); |
|
2725 |
|
2726 #ifdef VM_USE_TSY |
|
2727 |
|
2728 if ( iFlags & KVmFlagPhonebookBeingCached ) |
|
2729 { |
|
2730 ret = DoPhonebookOperation( EVmbxPhonebookGetInfo ); |
|
2731 |
|
2732 if ( ret != KErrNone ) |
|
2733 { |
|
2734 VMBLOGSTRING2( "DoPhonebookOperation getinfo retval = %I", ret ); |
|
2735 return ret; |
|
2736 } |
|
2737 } |
|
2738 |
|
2739 // Now we have SIM support information updated |
|
2740 if ( iFlags & KVmFlagSimReadSupport ) |
|
2741 { |
|
2742 TVmbxEntry entry; |
|
2743 entry.iIndex = aLineNumber; // 1 or 2 |
|
2744 ret = DoPhonebookOperation( EVmbxPhonebookRead, &entry ); |
|
2745 VMBLOGSTRING3( "VMBX: RVmbxNumber::GetVmNumFromSIM: \ |
|
2746 Read SIM entry %I, status: %I", aLineNumber, ret ); |
|
2747 |
|
2748 if ( ret == KErrNone ) |
|
2749 { |
|
2750 if ( !entry.iTelNumber.Length() ) |
|
2751 { |
|
2752 ret = KErrNotFound; |
|
2753 } |
|
2754 else |
|
2755 { |
|
2756 aNumber.Copy( entry.iTelNumber ); |
|
2757 } |
|
2758 } |
|
2759 } |
|
2760 else |
|
2761 { |
|
2762 ret = KErrNotSupported; |
|
2763 } |
|
2764 |
|
2765 if ( IsEmergencyNumberL( aNumber ) ) |
|
2766 { |
|
2767 aNumber.Zero(); |
|
2768 ret = KErrNotFound; |
|
2769 } |
|
2770 |
|
2771 VMBLOGSTRING2( "Number = %S", &aNumber ); |
|
2772 #endif // VM_USE_TSY |
|
2773 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmNumFromSIM: <=" ); |
|
2774 return ret; |
|
2775 } |
|
2776 |
|
2777 // ----------------------------------------------------------------------------- |
|
2778 // RVmbxNumber::GetVmNumFromVMN |
|
2779 // Retrieves voice mailbox number from VMN summary info |
|
2780 // ----------------------------------------------------------------------------- |
|
2781 // |
|
2782 TInt RVmbxNumber::GetVmNumFromVMN( TDes& aNumber ) |
|
2783 { |
|
2784 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmNumFromVMN: =>" ); |
|
2785 TBuf<KVmbxMaxNumberLength> number; |
|
2786 TInt ret( KErrNotFound ); |
|
2787 TInt value = 0; |
|
2788 |
|
2789 ret = iSession->Get( KVmSummaryInfoIsSet, value ); |
|
2790 |
|
2791 if ( !ret && value == 1 ) |
|
2792 { |
|
2793 ret = iSession->Get( KVmCallbackNumber, number ); |
|
2794 if ( !ret ) |
|
2795 { |
|
2796 if ( number.Length() ) |
|
2797 { |
|
2798 aNumber.Copy( number ); |
|
2799 } |
|
2800 else |
|
2801 { |
|
2802 ret = KErrNotFound; |
|
2803 } |
|
2804 } |
|
2805 } |
|
2806 |
|
2807 if ( IsEmergencyNumberL( aNumber ) ) |
|
2808 { |
|
2809 aNumber.Zero(); |
|
2810 ret = KErrNotFound; |
|
2811 } |
|
2812 |
|
2813 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmNumFromVMN: <=" ); |
|
2814 return ret; |
|
2815 } |
|
2816 |
|
2817 // ----------------------------------------------------------------------------- |
|
2818 // RVmbxNumber::GetVmNumFromNamStore |
|
2819 // Retrieves voice mailbox number from NAM |
|
2820 // ----------------------------------------------------------------------------- |
|
2821 // |
|
2822 TInt RVmbxNumber::GetVmNumFromNamStore( TDes& aNumber, TInt aNumType ) |
|
2823 { |
|
2824 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmNumFromNamStore: =>" ); |
|
2825 TRequestStatus ret( KErrNotFound ); |
|
2826 RMobileNamStore namStore; |
|
2827 |
|
2828 ret = namStore.Open( iPhone ); |
|
2829 if ( ret != KErrNone ) |
|
2830 { |
|
2831 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmNumFromNamStore: \ |
|
2832 NameStore error %I, ret.Int()" ); |
|
2833 return ret.Int(); |
|
2834 } |
|
2835 |
|
2836 RMobileNamStore::TMobileNamStoreInfoV1 namInfo; |
|
2837 RMobileNamStore::TMobileNamStoreInfoV1Pckg namInfoPckg( namInfo ); |
|
2838 |
|
2839 namStore.GetInfo( ret, namInfoPckg ); |
|
2840 User::WaitForRequest( ret ); |
|
2841 if ( ret == KErrNone ) |
|
2842 { |
|
2843 RMobileNamStore::TMobileNamEntryV1 namEntry; |
|
2844 RMobileNamStore::TMobileNamEntryV1Pckg namEntryPckg( namEntry ); |
|
2845 |
|
2846 namEntry.iNamId = namInfo.iActiveNam; |
|
2847 |
|
2848 switch ( aNumType ) |
|
2849 { |
|
2850 case EVmbxMDN: |
|
2851 { |
|
2852 namEntry.iParamIdentifier = KVmNamStoreMDNId; |
|
2853 break; |
|
2854 } |
|
2855 case EVmbxMIN: |
|
2856 { |
|
2857 namEntry.iParamIdentifier = KVmNamStoreMINId; |
|
2858 break; |
|
2859 } |
|
2860 default: |
|
2861 break; |
|
2862 } |
|
2863 |
|
2864 namStore.Read( ret, namEntryPckg ); |
|
2865 User::WaitForRequest( ret ); |
|
2866 if ( ret == KErrNone ) |
|
2867 { |
|
2868 ret = CnvUtfConverter::ConvertToUnicodeFromUtf8( |
|
2869 aNumber, // Unicode |
|
2870 namEntry.iData ); // Utf8 |
|
2871 } |
|
2872 } |
|
2873 |
|
2874 if ( IsEmergencyNumberL( aNumber ) ) |
|
2875 { |
|
2876 aNumber.Zero(); |
|
2877 ret = KErrNotFound; |
|
2878 } |
|
2879 |
|
2880 namStore.Close(); |
|
2881 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmNumFromNamStore: <=" ); |
|
2882 return ret.Int(); |
|
2883 } |
|
2884 |
|
2885 // ----------------------------------------------------------------------------- |
|
2886 // RVmbxNumber::GetVmNumFromSD |
|
2887 // Retrieves voice mailbox number from Shared Data |
|
2888 // ----------------------------------------------------------------------------- |
|
2889 // |
|
2890 TInt RVmbxNumber::GetVmNumFromSD( TDes& aNumber, TInt aLineNumber ) |
|
2891 { |
|
2892 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmNumFromSD: =>" ); |
|
2893 TBuf< KVmbxMaxNumberLength > number; |
|
2894 TInt ret( KErrNotFound ); |
|
2895 |
|
2896 TUint32 keyword = aLineNumber == |
|
2897 EAlsLine1Entry?KVmbxNumberLinePrimary: KVmbxNumberLineAuxiliary; |
|
2898 ret = iSession->Get( keyword, number ); |
|
2899 |
|
2900 if ( !ret ) |
|
2901 { |
|
2902 if ( number.Length() ) |
|
2903 { |
|
2904 aNumber.Copy( number ); |
|
2905 } |
|
2906 else |
|
2907 { |
|
2908 ret = KErrNotFound; |
|
2909 } |
|
2910 } |
|
2911 if ( IsEmergencyNumberL( aNumber ) ) |
|
2912 { |
|
2913 aNumber.Zero(); |
|
2914 ret = KErrNotFound; |
|
2915 } |
|
2916 |
|
2917 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmNumFromSD: <=" ); |
|
2918 return ret; |
|
2919 } |
|
2920 |
|
2921 // ----------------------------------------------------------------------------- |
|
2922 // RVmbxNumber::CloseETel |
|
2923 // Closes all ETel resources |
|
2924 // ----------------------------------------------------------------------------- |
|
2925 // |
|
2926 void RVmbxNumber::CloseETel() |
|
2927 { |
|
2928 VMBLOGSTRING( "VMBX: RVmbxNumber::CloseETel: =>" ); |
|
2929 iPhoneBook.Close(); |
|
2930 |
|
2931 if ( iFlags & KVmFlagPhoneOpened ) |
|
2932 { |
|
2933 iPhone.Close(); |
|
2934 } |
|
2935 |
|
2936 if ( iFlags & KVmFlagPhoneModuleLoaded ) |
|
2937 { |
|
2938 iTelServer.UnloadPhoneModule( KMmTsyModuleName ); |
|
2939 } |
|
2940 iTelServer.Close(); |
|
2941 |
|
2942 // Clear corresponding flags |
|
2943 iFlags &= ~KVmFlagSimReadSupport; |
|
2944 iFlags &= ~KVmFlagSimWriteSupport; |
|
2945 iFlags &= ~KVmFlagPhoneModuleLoaded; |
|
2946 iFlags &= ~KVmFlagPhoneOpened; |
|
2947 iFlags &= ~KVmFlagPhonebookBeingCached; |
|
2948 VMBLOGSTRING( "VMBX: RVmbxNumber::CloseETel: <=" ); |
|
2949 } |
|
2950 |
|
2951 // ----------------------------------------------------------------------------- |
|
2952 // RVmbxNumber::AppendStrToArrayL |
|
2953 // Appends string from resourse to descriptor array |
|
2954 // ----------------------------------------------------------------------------- |
|
2955 // |
|
2956 void RVmbxNumber::AppendStrToArrayL( TInt aResourceId, CDesCArray& aArray ) |
|
2957 { |
|
2958 VMBLOGSTRING( "VMBX: RVmbxNumber::AppendStrToArrayL: =>" ); |
|
2959 HBufC* tmp = StringLoader::LoadLC( aResourceId, iCoeEnv ); |
|
2960 aArray.AppendL( *tmp ); |
|
2961 CleanupStack::PopAndDestroy( tmp ); |
|
2962 VMBLOGSTRING( "VMBX: RVmbxNumber::AppendStrToArrayL: <=" ); |
|
2963 } |
|
2964 |
|
2965 // ----------------------------------------------------------------------------- |
|
2966 // RVmbxNumber::SetHeaderFromResourceL |
|
2967 // Set query dialog header text from resource string |
|
2968 // ----------------------------------------------------------------------------- |
|
2969 // |
|
2970 void RVmbxNumber::SetHeaderFromResourceL( TInt aResourceId, |
|
2971 CAknQueryDialog& aDlg ) |
|
2972 { |
|
2973 VMBLOGSTRING( "VMBX: RVmbxNumber::SetHeaderFromResourceL: =>" ); |
|
2974 HBufC* headingText = StringLoader::LoadLC( aResourceId, iCoeEnv ); |
|
2975 aDlg.SetHeaderTextL( *headingText ); |
|
2976 CleanupStack::PopAndDestroy( headingText ); |
|
2977 VMBLOGSTRING( "VMBX: RVmbxNumber::SetHeaderFromResourceL: <=" ); |
|
2978 } |
|
2979 |
|
2980 // ----------------------------------------------------------------------------- |
|
2981 // RVmbxNumber::QueryAddressL |
|
2982 // Fetches Voip address (returns ETrue when success) |
|
2983 // ----------------------------------------------------------------------------- |
|
2984 // |
|
2985 EXPORT_C TBool RVmbxNumber::QueryAddressL( TVmbxQueryType /*aQueryType*/, |
|
2986 TDes& /*aNumber*/ ) |
|
2987 { |
|
2988 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryAddressL: =>" ); |
|
2989 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryAddressL: METHOD NOT SUPPORTED ANYMORE" ); |
|
2990 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryAddressL: <=" ); |
|
2991 return EFalse; |
|
2992 } |
|
2993 |
|
2994 // ----------------------------------------------------------------------------- |
|
2995 // RVmbxNumber::SelectTypeL |
|
2996 // Select which type of Vmbx |
|
2997 // ----------------------------------------------------------------------------- |
|
2998 // |
|
2999 EXPORT_C TInt RVmbxNumber::SelectTypeL( TBool aTitle ) |
|
3000 { |
|
3001 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: =>" ); |
|
3002 if ( !AllowedToChangeTheNumber() && EVmbxDefine == aTitle ) |
|
3003 { |
|
3004 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: \ |
|
3005 Not Allow to define voice mail number" ); |
|
3006 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: <=" ); |
|
3007 return EVmbxNone; |
|
3008 } |
|
3009 |
|
3010 if ( VideoSupported() ) |
|
3011 { |
|
3012 TInt index( 0 ); |
|
3013 |
|
3014 RArray<TInt> vmbxTypeArray; |
|
3015 CleanupClosePushL( vmbxTypeArray ); |
|
3016 |
|
3017 iTypeSelectionQuery = CVmListQueryDialog::NewL( &index ); |
|
3018 iTypeSelectionQuery->PrepareLC( R_MAILBOX_LISTQUERY ); |
|
3019 |
|
3020 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: Not only Voice" ); |
|
3021 |
|
3022 // Select which type voice mailbox number to call, CS or Video |
|
3023 if ( EVmbxCall == aTitle ) |
|
3024 { |
|
3025 // Set prompt |
|
3026 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: aTitle = call" ); |
|
3027 |
|
3028 SetHeaderFromResourceL( R_CALLTO_LBX_PROMPT, *iTypeSelectionQuery ); |
|
3029 |
|
3030 // Fill items to array |
|
3031 CDesCArrayFlat* lbxItems = |
|
3032 new (ELeave) CDesCArrayFlat( KVmLbxItemsArraySize ); |
|
3033 CleanupStack::PushL( lbxItems ); |
|
3034 |
|
3035 TBuf<KVmbxMaxNumberLength> vmbxNumber; |
|
3036 |
|
3037 // Check CS number |
|
3038 if ( KErrNone == GetVmbxNumber( vmbxNumber ) ) |
|
3039 { |
|
3040 AppendStrToArrayL( R_CALLTO_LBX_CS_MAILBOX_ITEM, *lbxItems ); |
|
3041 User::LeaveIfError( vmbxTypeArray.Append( EVmbx ) ); |
|
3042 iType = EVmbx; |
|
3043 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: EVmbx" ); |
|
3044 } |
|
3045 // Check Video number |
|
3046 if ( VideoSupported() && |
|
3047 KErrNone == GetVideoMbxNumber( vmbxNumber ) ) |
|
3048 { |
|
3049 AppendStrToArrayL( R_CALLTO_LBX_VIDEO_MAILBOX_ITEM, |
|
3050 *lbxItems ); |
|
3051 User::LeaveIfError( vmbxTypeArray.Append( EVmbxVideo ) ); |
|
3052 iType = EVmbxVideo; |
|
3053 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: EVmbxVideo" ); |
|
3054 } |
|
3055 |
|
3056 iTypeSelectionQuery->SetItemTextArray( lbxItems ); |
|
3057 // vest ownership to lbx |
|
3058 iTypeSelectionQuery->SetOwnershipType( ELbmOwnsItemArray ); |
|
3059 CleanupStack::Pop( lbxItems ); |
|
3060 } |
|
3061 // Select which type of VMBX number to define, CS or Video |
|
3062 else |
|
3063 { |
|
3064 // Set prompt |
|
3065 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: aTitle = define" ); |
|
3066 |
|
3067 SetHeaderFromResourceL( R_DEFINE_VIDEO_OR_VOICE_LBX_PROMPT, |
|
3068 *iTypeSelectionQuery ); |
|
3069 |
|
3070 // Fill items to array |
|
3071 CDesCArrayFlat* lbxItems = |
|
3072 new (ELeave) CDesCArrayFlat( KVmLbxItemsArraySize ); |
|
3073 CleanupStack::PushL( lbxItems ); |
|
3074 |
|
3075 AppendStrToArrayL( R_DEFINE_LBX_CS_MAILBOX_ITEM, *lbxItems ); |
|
3076 User::LeaveIfError( vmbxTypeArray.Append( EVmbx ) ); |
|
3077 |
|
3078 if ( VideoSupported() ) |
|
3079 { |
|
3080 AppendStrToArrayL( R_DEFINE_LBX_VIDEO_MAILBOX_ITEM, |
|
3081 *lbxItems ); |
|
3082 User::LeaveIfError( vmbxTypeArray.Append( EVmbxVideo ) ); |
|
3083 } |
|
3084 |
|
3085 iTypeSelectionQuery->SetItemTextArray( lbxItems ); |
|
3086 // vest ownership to lbx |
|
3087 iTypeSelectionQuery->SetOwnershipType( ELbmOwnsItemArray ); |
|
3088 CleanupStack::Pop( lbxItems ); |
|
3089 } |
|
3090 |
|
3091 VMBLOGSTRING2( "VMBX: RVmbxNumber::SelectTypeL array count %d", |
|
3092 vmbxTypeArray.Count()); |
|
3093 |
|
3094 if ( ( EVmbxCall == aTitle ) && |
|
3095 ( KVmbxOnlyDefinedOneNumber == vmbxTypeArray.Count() ) ) |
|
3096 { |
|
3097 // call directly |
|
3098 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: Only one" ); |
|
3099 CleanupStack::PopAndDestroy( iTypeSelectionQuery ); |
|
3100 } |
|
3101 else |
|
3102 { |
|
3103 if ( iTypeSelectionQuery->RunLD() ) |
|
3104 { |
|
3105 iType = vmbxTypeArray[ index ]; |
|
3106 } |
|
3107 else |
|
3108 { |
|
3109 iType = EVmbxNone; |
|
3110 } |
|
3111 } |
|
3112 |
|
3113 iTypeSelectionQuery = NULL; |
|
3114 //close and destroy vmbxTypeArray |
|
3115 CleanupStack::PopAndDestroy( &vmbxTypeArray ); |
|
3116 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: <=" ); |
|
3117 return iType; |
|
3118 } |
|
3119 // Only supported CS |
|
3120 else |
|
3121 { |
|
3122 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: <=" ); |
|
3123 return EVmbx; |
|
3124 } |
|
3125 } |
|
3126 |
|
3127 |
|
3128 // ----------------------------------------------------------------------------- |
|
3129 // RVmbxNumber::SaveVmbxAddressL |
|
3130 // Save voice mailbox address to RCSC |
|
3131 // ----------------------------------------------------------------------------- |
|
3132 // |
|
3133 EXPORT_C TInt RVmbxNumber::SaveVmbxAddressL( TDes& /*aAddress*/ ) |
|
3134 { |
|
3135 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVmbxAddressL(TDes& aAddress): Method deprecated" ); |
|
3136 return KErrNotSupported; |
|
3137 } |
|
3138 |
|
3139 |
|
3140 // ---------------------------------------------------------------------------- |
|
3141 // RVmbxNumber::IsVoIPProfilesFound |
|
3142 // Check if VoIP profiles is found. |
|
3143 // ---------------------------------------------------------------------------- |
|
3144 // |
|
3145 EXPORT_C TBool RVmbxNumber::IsVoIPProfilesFound() |
|
3146 { |
|
3147 VMBLOGSTRING( "VMBX: RVmbxNumber::IsVoIPProfilesFound" ); |
|
3148 |
|
3149 return iVmSpsHandler->IsVoIPProfilesFound(); |
|
3150 } |
|
3151 |
|
3152 |
|
3153 EXPORT_C TBool RVmbxNumber::IsIpVoiceMailboxServices() |
|
3154 { |
|
3155 VMBLOGSTRING( "VMBX: RVmbxNumber::IsIpVoiceMailboxServices: =>" ); |
|
3156 |
|
3157 TBool ret( EFalse ); |
|
3158 |
|
3159 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
3160 { |
|
3161 RArray<TUint> profileIds; |
|
3162 |
|
3163 GetServiceIds( profileIds ); |
|
3164 |
|
3165 TInt count = profileIds.Count(); |
|
3166 |
|
3167 profileIds.Close(); |
|
3168 |
|
3169 if ( count > 0 ) |
|
3170 { |
|
3171 ret = ETrue; |
|
3172 } |
|
3173 else |
|
3174 { |
|
3175 ret = EFalse; |
|
3176 } |
|
3177 } |
|
3178 |
|
3179 VMBLOGSTRING( "VMBX: RVmbxNumber::IsIpVoiceMailboxServices: <=" ); |
|
3180 return ret; |
|
3181 } |
|
3182 |
|
3183 // ---------------------------------------------------------------------------- |
|
3184 // RVmbxNumber::IsSimMemory |
|
3185 // Returns if the memory location for vmbx is sim memory |
|
3186 // ---------------------------------------------------------------------------- |
|
3187 // |
|
3188 EXPORT_C TBool RVmbxNumber::IsSimMemory() |
|
3189 { |
|
3190 VMBLOGSTRING( "VMBX: RVmbxNumber::IsSimMemory: =>" ); |
|
3191 TBool ret( EFalse ); |
|
3192 TInt alsLine( EAlsLine1 ); |
|
3193 // get the current ALS line |
|
3194 if ( GetAlsLine( alsLine ) != KErrNone ) |
|
3195 { |
|
3196 alsLine = EAlsLine1; // if problems, assume primary line |
|
3197 } |
|
3198 if ( iSimCardFound ) |
|
3199 { |
|
3200 // if number automatically fetched from read only SIM |
|
3201 // or ALS2 is active |
|
3202 if ( ( !( iFlags & KVmFlagSimWriteSupport ) ) || EAlsLine2 == alsLine ) |
|
3203 { |
|
3204 ret = ( !UserEditNumber( alsLine ) && |
|
3205 !IsPhoneMemForcedEdit( alsLine ) ); |
|
3206 } |
|
3207 // if number stored in writable SIM |
|
3208 else |
|
3209 { |
|
3210 ret = UsesSimMemory(); |
|
3211 } |
|
3212 } |
|
3213 VMBLOGSTRING( "VMBX: RVmbxNumber::IsSimMemory: <=" ); |
|
3214 VMBLOGSTRING3( "VMBX: RVmbxNumber::IsSimMemory: sim memory is used \ |
|
3215 iSimCardFound: %I, ret: %I", iSimCardFound, ret ); |
|
3216 return ret; |
|
3217 } |
|
3218 |
|
3219 // ----------------------------------------------------------------------------- |
|
3220 // RVmbxNumber::GetVideoMbxNumber |
|
3221 // Fetches the specified video mailbox number |
|
3222 // ----------------------------------------------------------------------------- |
|
3223 // |
|
3224 EXPORT_C TInt RVmbxNumber::GetVideoMbxNumber( TDes& aNumber, |
|
3225 TVmbxNumberEntry aEntry ) |
|
3226 { |
|
3227 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVideoMbxNumber: =>" ); |
|
3228 TInt ret = VideoSupported(); |
|
3229 |
|
3230 if ( ret ) |
|
3231 { |
|
3232 TInt lineNumber( aEntry ); |
|
3233 TBuf< KVmbxMaxNumberLength > number; |
|
3234 if ( EAlsActiveLineEntry == aEntry ) |
|
3235 { |
|
3236 // get the current ALS line |
|
3237 if ( KErrNone != GetAlsLine( lineNumber ) ) |
|
3238 { |
|
3239 lineNumber = EAlsLine1; // if problems, assume primary line |
|
3240 } |
|
3241 } |
|
3242 |
|
3243 TUint32 keyword = lineNumber == |
|
3244 EAlsLine1Entry ? KVideoMbxNumberLinePrimary : KVideoMbxNumberLineAuxiliary; |
|
3245 ret = iSession->Get( keyword, number ); |
|
3246 |
|
3247 if ( KErrNone == ret ) |
|
3248 { |
|
3249 if ( number.Length() ) |
|
3250 { |
|
3251 aNumber.Copy( number ); |
|
3252 } |
|
3253 else |
|
3254 { |
|
3255 ret = KErrNotFound; |
|
3256 } |
|
3257 } |
|
3258 |
|
3259 if ( IsEmergencyNumberL( aNumber ) ) |
|
3260 { |
|
3261 aNumber.Zero(); |
|
3262 ret = KErrNotFound; |
|
3263 } |
|
3264 } |
|
3265 else |
|
3266 { |
|
3267 ret = KErrNotFound; |
|
3268 } |
|
3269 VMBLOGSTRING2( "VMBX: RVmbxNumber::GetVideoMbxNumber:<=\ |
|
3270 Video supported = %d", ret ); |
|
3271 return ret; |
|
3272 } |
|
3273 |
|
3274 // ----------------------------------------------------------------------------- |
|
3275 // RVmbxNumber::QueryVideoMbxNumberL |
|
3276 // Queries a video mailbox number |
|
3277 // ----------------------------------------------------------------------------- |
|
3278 // |
|
3279 EXPORT_C TBool RVmbxNumber::QueryVideoMbxNumberL( TVmbxQueryType aQueryType, |
|
3280 TDes& aNumber ) |
|
3281 { |
|
3282 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryVideoMbxNumberL: =>" ); |
|
3283 TBool result( EFalse ); |
|
3284 |
|
3285 __ASSERT_DEBUG( aNumber.MaxLength() >= KVmbxMaxNumberLength, |
|
3286 User::Panic(KVmbxPanicCategory, EVmbxDescriptorTooSmall) ); |
|
3287 __ASSERT_DEBUG( aNumber.Length() <= KVmbxMaxNumberLength, |
|
3288 User::Panic(KVmbxPanicCategory, EVmbxNumberTooLong) ); |
|
3289 |
|
3290 if ( !AllowedToChangeTheNumber() ) |
|
3291 { |
|
3292 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryVideoMbxNumberL: \ |
|
3293 Video number not allowed to change" ); |
|
3294 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryVideoMbxNumberL: <=" ); |
|
3295 User::Leave( KErrAccessDenied ); |
|
3296 } |
|
3297 |
|
3298 TBuf< KVmbxMaxNumberLength > number; |
|
3299 TBool thisClosed( EFalse ); |
|
3300 // Close() sets thisClosed to ETrue |
|
3301 |
|
3302 FOREVER |
|
3303 { |
|
3304 number.Copy( aNumber ); |
|
3305 |
|
3306 // get the correct query prompt from resource file |
|
3307 HBufC* prompt = StringLoader::LoadLC( |
|
3308 ( aQueryType == EVmbxNotDefinedQuery ? |
|
3309 R_VIDEO_DEFINE_NUMBER_PROMPT : |
|
3310 R_VIDEO_CHANGE_NUMBER_PROMPT), |
|
3311 iCoeEnv ); |
|
3312 |
|
3313 iClosedPtr = &thisClosed; |
|
3314 |
|
3315 // Convert output to accommodate the current locale |
|
3316 AknTextUtils::LanguageSpecificNumberConversion( number ); |
|
3317 |
|
3318 TInt ret; // return value of the query |
|
3319 TBool searchUsed; // ETrue to open the query again after |
|
3320 //closing single fetch dialog |
|
3321 |
|
3322 // enable search if number length is 0 |
|
3323 TBool searchEnabled( number.Length() ? EFalse : ETrue ); |
|
3324 |
|
3325 do |
|
3326 { |
|
3327 // show query with the correct prompt |
|
3328 iVideoQuery = CVmTextQueryDialog::NewL( number, |
|
3329 *prompt, searchEnabled ); |
|
3330 |
|
3331 ret = iVideoQuery->ExecuteLD( R_VMBX_NUMBER_QUERY ); |
|
3332 |
|
3333 iVideoQuery = NULL; |
|
3334 searchUsed = EFalse; |
|
3335 |
|
3336 if ( searchEnabled && ret && !number.Length() ) |
|
3337 { |
|
3338 searchUsed = ETrue; |
|
3339 // Show phonebook's single fetch dialog |
|
3340 TRAPD( error, FetchNumberFromPhonebook2L( number ) ); |
|
3341 |
|
3342 // user has pressed End Key |
|
3343 if ( thisClosed ) |
|
3344 { |
|
3345 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryVideoMbxNumberL: \ |
|
3346 End key pressed" ); |
|
3347 CleanupStack::PopAndDestroy( prompt ); |
|
3348 return EFalse; |
|
3349 } |
|
3350 |
|
3351 if ( error ) // Back pressed in Contact UI |
|
3352 { |
|
3353 // Now the phone book fetch dialog |
|
3354 // was closed, get out of the loop |
|
3355 ret = EFalse; |
|
3356 break; |
|
3357 } |
|
3358 } |
|
3359 } while( searchUsed ); |
|
3360 |
|
3361 iClosedPtr = NULL; |
|
3362 |
|
3363 CleanupStack::PopAndDestroy( prompt ); |
|
3364 |
|
3365 if ( ret ) |
|
3366 { |
|
3367 if ( !number.Length() ) |
|
3368 { |
|
3369 User::LeaveIfError( SaveVideoMbxNumber( number, |
|
3370 EAlsActiveLineEntry ) ); |
|
3371 aNumber.Copy( number ); |
|
3372 |
|
3373 // show "not defined" note |
|
3374 ShowConfirmationNoteL( R_VIDEO_NOTE_EMPTY_NUMBER ); |
|
3375 result = ETrue; |
|
3376 break; |
|
3377 } |
|
3378 |
|
3379 // Convert back to western digits |
|
3380 ConvertToWesternDigits( number ); |
|
3381 |
|
3382 // check the given number here (emergency numbers not allowed) |
|
3383 if ( IsValidPhoneNumber( number ) && !IsEmergencyNumberL( number ) ) |
|
3384 { |
|
3385 TInt status = SaveVideoMbxNumber( number, EAlsActiveLineEntry ); |
|
3386 |
|
3387 if ( status == KErrNone ) |
|
3388 { |
|
3389 aNumber.Copy( number ); |
|
3390 ShowConfirmationNoteL( R_VIDEO_SAVED_NOTE ); |
|
3391 result = ETrue; |
|
3392 break; |
|
3393 } |
|
3394 } |
|
3395 |
|
3396 if ( !result ) |
|
3397 { |
|
3398 // show "invalid number" note and wait for a short timeout |
|
3399 prompt = StringLoader::LoadLC( R_INVALID_NUMBER_NOTE, iCoeEnv ); |
|
3400 |
|
3401 iClosedPtr = &thisClosed; |
|
3402 |
|
3403 CAknInformationNote* note = |
|
3404 new( ELeave ) CAknInformationNote( ETrue ); |
|
3405 note->ExecuteLD( *prompt ); |
|
3406 |
|
3407 iClosedPtr = NULL; |
|
3408 |
|
3409 CleanupStack::PopAndDestroy( prompt ); |
|
3410 |
|
3411 if ( !thisClosed ) |
|
3412 { |
|
3413 continue; // the number was invalid -> query again. |
|
3414 } |
|
3415 } |
|
3416 } |
|
3417 break; // user canceled the query |
|
3418 } |
|
3419 VMBLOGSTRING( "VMBX: RVmbxNumber::QueryVideoMbxNumberL: <=" ); |
|
3420 return result; |
|
3421 } |
|
3422 |
|
3423 // ----------------------------------------------------------------------------- |
|
3424 // RVmbxNumber::SaveVideoMbxNumber |
|
3425 // Saves the vmbx number. (in phone file system) |
|
3426 // ----------------------------------------------------------------------------- |
|
3427 // |
|
3428 EXPORT_C TInt RVmbxNumber::SaveVideoMbxNumber( const TDesC& aNumber, |
|
3429 TVmbxNumberEntry aEntry ) |
|
3430 { |
|
3431 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVideoMbxNumber: =>" ); |
|
3432 TInt error( KErrNone ); |
|
3433 __ASSERT_DEBUG( iFlags & KVmFlagOpened, |
|
3434 User::Panic(KVmbxPanicCategory, EVmbxNotConnected) ); |
|
3435 __ASSERT_DEBUG( aNumber.Length() <= KVmbxMaxNumberLength, |
|
3436 User::Panic(KVmbxPanicCategory, EVmbxNumberTooLong) ); |
|
3437 |
|
3438 TInt lineNumber( aEntry ); |
|
3439 if ( aEntry == EAlsActiveLineEntry ) |
|
3440 { |
|
3441 // get the current ALS line |
|
3442 if ( GetAlsLine( lineNumber ) != KErrNone ) |
|
3443 { |
|
3444 lineNumber = EAlsLine1; // if problems, assume primary line |
|
3445 } |
|
3446 } |
|
3447 TUint32 keyword = lineNumber == |
|
3448 EAlsLine1Entry ? KVideoMbxNumberLinePrimary: KVideoMbxNumberLineAuxiliary; |
|
3449 |
|
3450 error = iSession->Set( keyword, aNumber ); |
|
3451 if ( !error ) |
|
3452 { |
|
3453 // Client will generate the event itself on request. |
|
3454 if ( iFlags & KVmFlagNotifyRequested ) |
|
3455 { |
|
3456 HandleNotifyString( keyword, aNumber ); |
|
3457 } |
|
3458 } |
|
3459 VMBLOGSTRING( "VMBX: RVmbxNumber::SaveVideoMbxNumber: <=" ); |
|
3460 return error; |
|
3461 } |
|
3462 |
|
3463 // ----------------------------------------------------------------------------- |
|
3464 // RVmbxNumber::IsUsimSupport |
|
3465 // ----------------------------------------------------------------------------- |
|
3466 |
|
3467 // ----------------------------------------------------------------------------- |
|
3468 // Series 60 Customer / MSatRefreshOserver |
|
3469 // Series 60 MSatRefreshObserver API |
|
3470 // ----------------------------------------------------------------------------- |
|
3471 TBool RVmbxNumber::AllowRefresh( |
|
3472 TSatRefreshType aType, const TSatRefreshFiles& aFiles ) |
|
3473 { |
|
3474 VMBLOGSTRING( "VMBX: RVmbxNumber::AllowRefresh: =>" ); |
|
3475 TBool allowRefresh( ETrue ); |
|
3476 if ( aType == EFileChangeNotification ) |
|
3477 { |
|
3478 const TInt elFile1( aFiles.Locate( KMbdnEf ) ); |
|
3479 const TInt elFile2( aFiles.Locate( KMbiEf) ); |
|
3480 |
|
3481 if ( ( KErrNotFound == elFile1) && |
|
3482 ( KErrNotFound == elFile2 ) ) |
|
3483 { |
|
3484 allowRefresh = EFalse; |
|
3485 } |
|
3486 |
|
3487 } |
|
3488 else |
|
3489 { |
|
3490 allowRefresh = EFalse; |
|
3491 } |
|
3492 VMBLOGSTRING( "VMBX: RVmbxNumber::AllowRefresh: <=" ); |
|
3493 return allowRefresh; |
|
3494 } |
|
3495 |
|
3496 // ----------------------------------------------------------------------------- |
|
3497 // Series 60 Customer / MSatRefreshOserver |
|
3498 // Series 60 MSatRefreshObserver API |
|
3499 // ----------------------------------------------------------------------------- |
|
3500 void RVmbxNumber::Refresh( TSatRefreshType aType, |
|
3501 const TSatRefreshFiles& aFiles ) |
|
3502 { |
|
3503 VMBLOGSTRING( "VMBX: RVmbxNumber::Refresh: =>" ); |
|
3504 if ( aType == EFileChangeNotification ) |
|
3505 { |
|
3506 const TInt elFile1( aFiles.Locate( KMbdnEf ) ); |
|
3507 const TInt elFile2( aFiles.Locate( KMbiEf ) ); |
|
3508 |
|
3509 if ( ( KErrNotFound != elFile1) || ( KErrNotFound != elFile2 ) ) |
|
3510 { |
|
3511 //do phone book getInfo |
|
3512 TInt error( KErrNone ); |
|
3513 error = DoPhonebookOperation( EVmbxPhonebookGetInfo ); |
|
3514 if ( !error ) |
|
3515 { |
|
3516 TVmbxEntry entry; |
|
3517 entry.iIndex = 1; |
|
3518 TInt ret = DoPhonebookOperation( EVmbxPhonebookRead, &entry ); |
|
3519 |
|
3520 // Notify SAT Server that refresh initiated file read is done |
|
3521 iRSatClient.RefreshEFRead( EFalse ); |
|
3522 |
|
3523 if ( ( iNotifyCallBack ) && ( entry.iTelNumber.Length() > 0 ) |
|
3524 && ( iMemoryLocation == EVmbxSimMemory ) ) |
|
3525 { |
|
3526 TInt notifyLine( 0 ); |
|
3527 TRAPD( err, iNotifyCallBack->HandleNotifyL( notifyLine, |
|
3528 entry.iTelNumber ) ); |
|
3529 if ( err ) |
|
3530 { |
|
3531 _LIT(KVmbxPanicType,"iNotifyCallBack->HandleNotifyL"); |
|
3532 User::Panic( KVmbxPanicType, err ); |
|
3533 } |
|
3534 } |
|
3535 } |
|
3536 } |
|
3537 } |
|
3538 VMBLOGSTRING( "VMBX: RVmbxNumber::Refresh: <=" ); |
|
3539 } |
|
3540 |
|
3541 // ----------------------------------------------------------------------------- |
|
3542 // RVmbxNumber::MailboxNumbersIdentifiers |
|
3543 // Gets identifiers of the records in sim from MBI-file in sim |
|
3544 // ----------------------------------------------------------------------------- |
|
3545 // |
|
3546 TInt RVmbxNumber::MailboxNumbersIdentifiers() |
|
3547 { |
|
3548 VMBLOGSTRING( "VMBX: RVmbxNumber::MailboxNumbersIdentifiers: =>" ); |
|
3549 TRequestStatus status; |
|
3550 |
|
3551 // Get identifiers |
|
3552 iPhone.GetMailboxNumbers( status, iPhoneVoicemailInfoPckg ); |
|
3553 |
|
3554 // Wait for asynchronous call to finish |
|
3555 User::WaitForRequest( status ); |
|
3556 VMBLOGSTRING2( "Identifier read status = %I", status.Int() ); |
|
3557 VMBLOGSTRING2( "iVoice value: %d", iPhoneVoicemailInfo.iVoice ); |
|
3558 VMBLOGSTRING( "VMBX: RVmbxNumber::MailboxNumbersIdentifiers: <=" ); |
|
3559 return status.Int(); |
|
3560 } |
|
3561 |
|
3562 // ----------------------------------------------------------------------------- |
|
3563 // RVmbxNumber::MailboxNumbersIdentifiers |
|
3564 // Gets identifiers of the records in sim from MBI-file in sim |
|
3565 // ----------------------------------------------------------------------------- |
|
3566 // |
|
3567 void RVmbxNumber::TestAndSetSimAccessFlags() |
|
3568 { |
|
3569 VMBLOGSTRING( "VMBX: RVmbxNumber::TestAndSetSimAccessFlags: =>" ); |
|
3570 // Caps are not valid for read-only Sim, so check if writing |
|
3571 // to sim fails. |
|
3572 // Assume that a number exist |
|
3573 iNoNumberFound = EFalse; |
|
3574 TBool isTestNumberUsed = EFalse; |
|
3575 // read sim data first |
|
3576 TVmbxEntry entry; |
|
3577 entry.iIndex = EAlsLine1; |
|
3578 |
|
3579 TInt readError = DoPhonebookOperation( EVmbxPhonebookRead, &entry ); |
|
3580 |
|
3581 // KErrNotFound is returned when number length is zero, then |
|
3582 // testnumber is used to test write support |
|
3583 if ( readError == KErrNone || readError == KErrNotFound ) |
|
3584 { |
|
3585 // save number for later use |
|
3586 if ( entry.iTelNumber.Length() ) |
|
3587 { |
|
3588 iNumberFromSim.Copy( entry.iTelNumber ); |
|
3589 } |
|
3590 // number not found, test with testnumber |
|
3591 else if ( entry.iTelNumber.Length() == 0 ) |
|
3592 { |
|
3593 // no number found |
|
3594 iNoNumberFound = ETrue; |
|
3595 VMBLOGSTRING( "Use test number for testing write support" ); |
|
3596 entry.iTelNumber.Copy( KTestNumber ) ; |
|
3597 isTestNumberUsed = ETrue; |
|
3598 } |
|
3599 |
|
3600 VMBLOGSTRING( "Try writing" ); |
|
3601 |
|
3602 TInt writeError = DoPhonebookOperation( EVmbxPhonebookWrite, &entry ); |
|
3603 VMBLOGSTRING2( "Write: %I", writeError ); |
|
3604 |
|
3605 // write error, set write flag to not supported |
|
3606 // and phone memory in use |
|
3607 if ( writeError ) |
|
3608 { |
|
3609 VMBLOGSTRING( "WriteAccess not ok" ); |
|
3610 iFlags &= ~KVmFlagSimWriteSupport; |
|
3611 } |
|
3612 // tested with and sim has write access so delete test number from sim |
|
3613 else if ( isTestNumberUsed && writeError == KErrNone ) |
|
3614 { |
|
3615 VMBLOGSTRING( "Remove test number from sim" ); |
|
3616 DoPhonebookOperation( EVmbxPhonebookDelete, &entry ); |
|
3617 } |
|
3618 } |
|
3619 // read error, set read and write flag to not supported |
|
3620 // and phone memory in use |
|
3621 else |
|
3622 { |
|
3623 VMBLOGSTRING( "ReadAccess not ok" ); |
|
3624 iFlags &= ~KVmFlagSimReadSupport; |
|
3625 |
|
3626 VMBLOGSTRING( "WriteAccess not ok" ); |
|
3627 iFlags &= ~KVmFlagSimWriteSupport; |
|
3628 // The first USim phonebook type is tested, |
|
3629 // keep memorylocation unchanged |
|
3630 if ( iUSimFirstRoundTest ) |
|
3631 { |
|
3632 VMBLOGSTRING2( "iMemoryLocation = %d", iMemoryLocation ); |
|
3633 iUSimFirstRoundTest = EFalse; |
|
3634 } |
|
3635 else |
|
3636 { |
|
3637 iMemoryLocation = EVmbxPhoneMemory; |
|
3638 iSession->Set( KVmUsesSimMemory, EVmbxPhoneMemory ); |
|
3639 VMBLOGSTRING2( "iMemoryLocation = %d", iMemoryLocation ); |
|
3640 } |
|
3641 } |
|
3642 |
|
3643 VMBLOGSTRING( "VMBX: RVmbxNumber::TestAndSetSimAccessFlags: <=" ); |
|
3644 } |
|
3645 |
|
3646 // ----------------------------------------------------------------------------- |
|
3647 // RVmbxNumber::MailboxNumbersIdentifiers |
|
3648 // Gets identifiers of the records in sim from MBI-file in sim |
|
3649 // ----------------------------------------------------------------------------- |
|
3650 // |
|
3651 void RVmbxNumber::CalculateActualMaxLengthOnSim( TInt aSimNumberLength ) |
|
3652 { |
|
3653 VMBLOGSTRING( "VMBX: RVmbxNumber::CalculateActualMaxLength: =>" ); |
|
3654 VMBLOGSTRING2("iPhoneBookInfo.iMaxNumLength = %I", iPhoneBookInfo.iMaxNumLength ); |
|
3655 VMBLOGSTRING2("aSimNumberLength = %I", aSimNumberLength ); |
|
3656 |
|
3657 // If max length is less than 20 or -1 returned, then |
|
3658 // max length must be detemined from number length that is |
|
3659 // saved on sim. |
|
3660 if ( iPhoneBookInfo.iMaxNumLength == KVmExtFileSize || |
|
3661 iPhoneBookInfo.iMaxNumLength == -1 ) |
|
3662 { |
|
3663 // number on sim is less than 21 |
|
3664 if ( aSimNumberLength <= KVmExtFileSize ) |
|
3665 { |
|
3666 iPhoneBookInfo.iMaxNumLength = KVmExtFileSize; |
|
3667 } |
|
3668 // number on sim is more than 20 but less than 40 |
|
3669 else if ( KVmExtFileSize < aSimNumberLength && |
|
3670 aSimNumberLength <= KVmPhoneNumDigitsMaxLength ) |
|
3671 { |
|
3672 iPhoneBookInfo.iMaxNumLength = KVmPhoneNumDigitsMaxLength; |
|
3673 } |
|
3674 // number on sim is more than 40 |
|
3675 else |
|
3676 { |
|
3677 iPhoneBookInfo.iMaxNumLength = KVmMaxStoreSize; |
|
3678 } |
|
3679 } |
|
3680 // If max length is 40, and number length on sim is more |
|
3681 // than 20 but less than 41, then 48 is available on sim. |
|
3682 else if ( iPhoneBookInfo.iMaxNumLength == KVmPhoneNumDigitsMaxLength && |
|
3683 KVmExtFileSize < aSimNumberLength && |
|
3684 aSimNumberLength <= KVmPhoneNumDigitsMaxLength ) |
|
3685 { |
|
3686 iPhoneBookInfo.iMaxNumLength = KVmMaxStoreSize; |
|
3687 } |
|
3688 VMBLOGSTRING2("iPhoneBookInfo.iMaxNumLength = %I", iPhoneBookInfo.iMaxNumLength ); |
|
3689 |
|
3690 VMBLOGSTRING( "VMBX: RVmbxNumber::CalculateActualMaxLength: <=" ); |
|
3691 } |
|
3692 |
|
3693 // ----------------------------------------------------------------------------- |
|
3694 // RVmbxNumber::VideoSupported |
|
3695 // Returns video support state |
|
3696 // ----------------------------------------------------------------------------- |
|
3697 // |
|
3698 TBool RVmbxNumber::VideoSupported() |
|
3699 { |
|
3700 VMBLOGSTRING( "VMBX: RVmbxNumber::VideoSupported: =>" ); |
|
3701 |
|
3702 TBool supported( EFalse ); |
|
3703 |
|
3704 if ( FeatureManager::FeatureSupported( KFeatureIdCsVideoTelephony ) ) |
|
3705 { |
|
3706 TInt result = iSession->Get( KVideoMbxSupport, supported ); |
|
3707 if ( result != KErrNone ) |
|
3708 { |
|
3709 supported = EFalse; |
|
3710 } |
|
3711 } |
|
3712 |
|
3713 VMBLOGSTRING2("VMBX: RVmbxNumber::VideoSupported: supported = %d", supported ); |
|
3714 return supported; |
|
3715 } |
|
3716 |
|
3717 // ----------------------------------------------------------------------------- |
|
3718 // RVmbxNumber::GetVmbxAddressL |
|
3719 // Retrieves voice mailbox address from RCSC |
|
3720 // ----------------------------------------------------------------------------- |
|
3721 // |
|
3722 EXPORT_C TInt RVmbxNumber::GetVmbxAddressL( TDes& /*aAddress*/ ) |
|
3723 { |
|
3724 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmbxAddressL(TDes& aAddress): Method deprecated" ); |
|
3725 VMBLOGSTRING( "Use GetVmbxAddressL(TDes& aAddress, TUint aServiceId) instead" ); |
|
3726 |
|
3727 return KErrNotSupported; |
|
3728 } |
|
3729 |
|
3730 // ----------------------------------------------------------------------------- |
|
3731 // RVmbxNumber::GetVmbxAddress |
|
3732 // Retrieves voice mailbox address from SPS |
|
3733 // ----------------------------------------------------------------------------- |
|
3734 // |
|
3735 EXPORT_C TInt RVmbxNumber::GetVmbxAddress( TDes& aAddress, TUint aServiceId ) |
|
3736 { |
|
3737 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmbxAddress: =>" ); |
|
3738 TInt ret( KErrNotSupported ); |
|
3739 |
|
3740 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
3741 { |
|
3742 TVmbxServiceInfo serviceInfo; |
|
3743 serviceInfo.iServiceId = aServiceId; |
|
3744 ret = GetServiceInfo( serviceInfo ); |
|
3745 VMBLOGSTRING2( "VMBX: RVmbxNumber::GetVmbxAddress: error: %d", ret ); |
|
3746 if ( KErrNone == ret ) |
|
3747 { |
|
3748 if ( serviceInfo.iAddress.Length() > aAddress.MaxLength() ) |
|
3749 { |
|
3750 ret = KErrOverflow; |
|
3751 } |
|
3752 else |
|
3753 { |
|
3754 aAddress.Copy( serviceInfo.iAddress ); |
|
3755 } |
|
3756 } |
|
3757 VMBLOGSTRING2( "VMBX: RVmbxNumber::GetVmbxAddress: error: %d", ret ); |
|
3758 } |
|
3759 |
|
3760 VMBLOGSTRING( "VMBX: RVmbxNumber::GetVmbxAddress: <=" ); |
|
3761 return ret; |
|
3762 } |
|
3763 |
|
3764 // ----------------------------------------------------------------------------- |
|
3765 // RVmbxNumber::SelectTypeL |
|
3766 // |
|
3767 // ----------------------------------------------------------------------------- |
|
3768 // |
|
3769 EXPORT_C TInt RVmbxNumber::SelectTypeL( TBool aTitle, TUint& aServiceId ) |
|
3770 { |
|
3771 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: =>" ); |
|
3772 |
|
3773 if ( !AllowedToChangeTheNumber() && EVmbxDefine == aTitle ) |
|
3774 { |
|
3775 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: \ |
|
3776 Not Allow to define voice mail number" ); |
|
3777 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: <=" ); |
|
3778 return EVmbxNone; |
|
3779 } |
|
3780 |
|
3781 if ( EVmbxCall != aTitle ) |
|
3782 { |
|
3783 User::Leave( KErrNotSupported ); |
|
3784 } |
|
3785 // the sum of defined numbers |
|
3786 TInt definedNumber( 0 ); |
|
3787 TInt definedFlag( 0 ); |
|
3788 CheckDefinedNumberCountL(definedNumber, definedFlag, aServiceId ); |
|
3789 |
|
3790 // Pop up selection dialog only if there are more than 2 defined numbers |
|
3791 if ( KMailBoxLimitForPrompt < definedNumber ) |
|
3792 { |
|
3793 TInt index( 0 ); |
|
3794 // Clear the old service information |
|
3795 iVmbxServiceSelection.Reset(); |
|
3796 |
|
3797 // Create selection list query and show it. |
|
3798 iTypeSelectionQuery = new (ELeave) CAknListQueryDialog( &index ); |
|
3799 iTypeSelectionQuery->PrepareLC( R_VOIP_REL2_2_CALL_TO ); |
|
3800 |
|
3801 // Create descriptor array for connection networks, connection networks |
|
3802 // icons and load connection network images to memory.. |
|
3803 CDesCArrayFlat* lbxItems = |
|
3804 new (ELeave) CDesCArrayFlat( KVmLbxItemsArraySize ); |
|
3805 CleanupStack::PushL( lbxItems ); |
|
3806 CArrayPtr<CGulIcon>* icons = |
|
3807 new (ELeave) CAknIconArray( KVmLbxItemsArraySize ); |
|
3808 CleanupStack::PushL( icons ); |
|
3809 |
|
3810 ConstructDefaultIconsL( icons ); |
|
3811 |
|
3812 // Create final list box item data. |
|
3813 TBuf<512> queryItem( KNullDesC ); |
|
3814 if( definedFlag & KVmFlagCSNumberDefined ) |
|
3815 { |
|
3816 HBufC* csName = StringLoader::LoadLC( R_CALLTO_LBX_CS_MAILBOX_ITEM, |
|
3817 iCoeEnv ); |
|
3818 queryItem.Format( KQueryItemFormat, 0, csName ); |
|
3819 CleanupStack::PopAndDestroy( csName ); |
|
3820 |
|
3821 // Append text to the item array. |
|
3822 lbxItems->AppendL( queryItem ); |
|
3823 // CS's hardcoded service value is 1 |
|
3824 User::LeaveIfError( iVmbxServiceSelection.Append( |
|
3825 TVmbxServiceSelection( EVmbx, 1 ) ) ); |
|
3826 } |
|
3827 |
|
3828 if( definedFlag & KVmFlagVideoNumberDefined ) |
|
3829 { |
|
3830 HBufC* videoName = |
|
3831 StringLoader::LoadLC( R_CALLTO_LBX_VIDEO_MAILBOX_ITEM, |
|
3832 iCoeEnv ); |
|
3833 // Create final list box item data. |
|
3834 queryItem.Format( KQueryItemFormat, 1, videoName ); |
|
3835 CleanupStack::PopAndDestroy( videoName ); |
|
3836 |
|
3837 // Append text to the item array. |
|
3838 lbxItems->AppendL( queryItem ); |
|
3839 // Video's hardcoded service value is 1 |
|
3840 User::LeaveIfError( iVmbxServiceSelection.Append( |
|
3841 TVmbxServiceSelection( EVmbxVideo, 1 ) ) ); |
|
3842 } |
|
3843 if( definedFlag & KVmFlagVoIpNumberDefined ) |
|
3844 { |
|
3845 // Get all Service Ids |
|
3846 RArray<TUint> profileIds; |
|
3847 CleanupClosePushL( profileIds ); |
|
3848 GetServiceIds( profileIds ); |
|
3849 |
|
3850 for ( TInt i( 0 ); i < profileIds.Count(); i++ ) |
|
3851 { |
|
3852 TVmbxServiceInfo serviceInfo; |
|
3853 serviceInfo.iServiceId = profileIds[ i ]; |
|
3854 GetServiceInfo( serviceInfo ); |
|
3855 |
|
3856 HBufC* voipName = HBufC::NewLC( serviceInfo.iName.Length() ); |
|
3857 voipName->Des().Copy( serviceInfo.iName ); |
|
3858 |
|
3859 TInt iconId( KErrNotFound ); |
|
3860 TRAPD( error, AddBrandIconL( icons, profileIds[ i ], iconId ) ); |
|
3861 |
|
3862 // If branded icon is not available, use hardcoded value 2 which is |
|
3863 // default VoIP icons value |
|
3864 if ( KErrNone != error || KErrNotFound == iconId ) |
|
3865 { |
|
3866 iconId = 2; |
|
3867 } |
|
3868 |
|
3869 // Create final list box item data. |
|
3870 queryItem.Format( KQueryItemFormat, iconId, voipName ); |
|
3871 CleanupStack::PopAndDestroy( voipName ); |
|
3872 |
|
3873 //Append text to the item array. |
|
3874 lbxItems->AppendL( queryItem ); |
|
3875 User::LeaveIfError( iVmbxServiceSelection.Append( |
|
3876 TVmbxServiceSelection( EVmbxIP, serviceInfo.iServiceId ) ) ); |
|
3877 } |
|
3878 |
|
3879 CleanupStack::PopAndDestroy( &profileIds ); |
|
3880 } |
|
3881 |
|
3882 iTypeSelectionQuery->SetIconArrayL( icons ); |
|
3883 iTypeSelectionQuery->SetItemTextArray( lbxItems ); |
|
3884 iTypeSelectionQuery->SetOwnershipType( ELbmOwnsItemArray ); |
|
3885 |
|
3886 CleanupStack::Pop( icons ); |
|
3887 CleanupStack::Pop( lbxItems ); |
|
3888 |
|
3889 if ( iTypeSelectionQuery->RunLD() ) |
|
3890 { |
|
3891 TVmbxServiceSelection serviceType = iVmbxServiceSelection[ index ]; |
|
3892 iType = serviceType.iServiceType; |
|
3893 aServiceId = serviceType.iServiceId; |
|
3894 VMBLOGSTRING2( "VMBX: RVmbxNumber::VoIP vmbx with service id %d selected", aServiceId ); |
|
3895 } |
|
3896 else |
|
3897 { |
|
3898 iType = EVmbxNone; |
|
3899 aServiceId = 0; |
|
3900 } |
|
3901 iTypeSelectionQuery = NULL; |
|
3902 } |
|
3903 |
|
3904 VMBLOGSTRING( "VMBX: RVmbxNumber::SelectTypeL: <=" ); |
|
3905 return iType; |
|
3906 } |
|
3907 // ----------------------------------------------------------------------------- |
|
3908 // RVmbxNumber::CheckDefinedNumberCountL |
|
3909 // |
|
3910 // ----------------------------------------------------------------------------- |
|
3911 // |
|
3912 TInt RVmbxNumber::CheckDefinedNumberCountL( TInt& aDefinedNumber, |
|
3913 TInt& aDefinedFlag, TUint& aServiceId ) |
|
3914 { |
|
3915 VMBLOGSTRING( "VMBX: RVmbxNumber::CheckDefinedNumberCountL: =>" ); |
|
3916 iType = EVmbxNone; |
|
3917 aServiceId = KDefaultServiceId; |
|
3918 // the sum of defined numbers |
|
3919 TInt definedNumber( KDefaultDefinedNumberCount ); |
|
3920 TInt definedServiceTypes( 0 ); |
|
3921 TInt definedFlag( 0 ); |
|
3922 |
|
3923 TBuf<KVmbxMaxNumberLength> tmpNumber(KNullDesC); |
|
3924 |
|
3925 // First check what mailboxes are defined. |
|
3926 // Skip querying if only one mailbox with number/address defined. |
|
3927 // 1. Get voice number |
|
3928 if ( KErrNone == GetVmbxNumber( tmpNumber ) ) |
|
3929 { |
|
3930 VMBLOGSTRING( "VMBX: RVmbxNumber::CheckDefinedNumberCountL: CS vmbx number defined"); |
|
3931 definedNumber++; |
|
3932 definedServiceTypes++; |
|
3933 iType = EVmbx; |
|
3934 aServiceId = KCSorVideoServiceId; |
|
3935 definedFlag |= KVmFlagCSNumberDefined; |
|
3936 } |
|
3937 |
|
3938 // 2. Get video number |
|
3939 if ( VideoSupported() && KErrNone == GetVideoMbxNumber( tmpNumber ) ) |
|
3940 { |
|
3941 VMBLOGSTRING( "VMBX: RVmbxNumber::CheckDefinedNumberCountL: Video mbx number defined"); |
|
3942 definedNumber++; |
|
3943 definedServiceTypes++; |
|
3944 if( KMailBoxLimitForPrompt == definedNumber) |
|
3945 { |
|
3946 iType = EVmbxVideo; |
|
3947 } |
|
3948 aServiceId = KCSorVideoServiceId; |
|
3949 definedFlag |= KVmFlagVideoNumberDefined; |
|
3950 } |
|
3951 |
|
3952 // 3. Get count of all Service Ids of VoIP |
|
3953 RArray<TUint> profileIds; |
|
3954 CleanupClosePushL( profileIds ); |
|
3955 |
|
3956 if ( KErrNone == GetServiceIds( profileIds ) ) |
|
3957 { |
|
3958 TInt idCount( profileIds.Count() ); |
|
3959 VMBLOGSTRING2( "VMBX: RVmbxNumber::CheckDefinedNumberCountL: %d IP vmbx services defined", idCount ); |
|
3960 |
|
3961 if ( idCount ) |
|
3962 { |
|
3963 definedNumber += idCount; |
|
3964 definedServiceTypes++; |
|
3965 // If only VoIP and only one service support Vmbx, |
|
3966 // then use it directly without prompting. |
|
3967 if ( KMailBoxLimitForPrompt == definedNumber ) |
|
3968 { |
|
3969 iType = EVmbxIP; |
|
3970 aServiceId = profileIds[ 0 ]; |
|
3971 } |
|
3972 definedFlag |= KVmFlagVoIpNumberDefined; |
|
3973 } |
|
3974 } |
|
3975 |
|
3976 CleanupStack::PopAndDestroy( &profileIds ); |
|
3977 aDefinedNumber = definedNumber; |
|
3978 aDefinedFlag = definedFlag; |
|
3979 VMBLOGSTRING2( "VMBX: RVmbxNumber::CheckDefinedNumberCountL: definedNumber = %d", |
|
3980 definedNumber ); |
|
3981 VMBLOGSTRING( "VMBX: RVmbxNumber::CheckDefinedNumberCountL: <=" ); |
|
3982 |
|
3983 if ( 1 < definedServiceTypes ) |
|
3984 { |
|
3985 iType = EVmbxNone; |
|
3986 } |
|
3987 return iType; |
|
3988 } |
|
3989 |
|
3990 // ---------------------------------------------------------------------------- |
|
3991 // RVmbxNumber::GetServiceIds |
|
3992 // |
|
3993 // ---------------------------------------------------------------------------- |
|
3994 // |
|
3995 EXPORT_C TInt RVmbxNumber::GetServiceIds( RArray<TUint>& aProfileIds ) |
|
3996 { |
|
3997 VMBLOGSTRING( "VMBX: RVmbxNumber::GetServiceIds: =>" ); |
|
3998 TInt ret( KErrNotFound ); |
|
3999 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
4000 { |
|
4001 TRAP( ret, iVmSpsHandler->GetServiceIdsL( aProfileIds ) ); |
|
4002 } |
|
4003 VMBLOGSTRING( "VMBX: RVmbxNumber::GetServiceIds: <=" ); |
|
4004 return ret; |
|
4005 } |
|
4006 |
|
4007 // ---------------------------------------------------------------------------- |
|
4008 // RVmbxNumber::GetServiceInfo |
|
4009 // |
|
4010 // ---------------------------------------------------------------------------- |
|
4011 // |
|
4012 EXPORT_C TInt RVmbxNumber::GetServiceInfo( TVmbxServiceInfo& aServiceInfo ) |
|
4013 { |
|
4014 VMBLOGSTRING( "VMBX: RVmbxNumber::GetServiceInfo: =>" ); |
|
4015 TInt ret( KErrNotFound ); |
|
4016 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
4017 { |
|
4018 ret = iVmSpsHandler->GetServiceInfo( aServiceInfo ); |
|
4019 } |
|
4020 VMBLOGSTRING( "VMBX: RVmbxNumber::GetServiceInfo: <=" ); |
|
4021 return ret; |
|
4022 } |
|
4023 |
|
4024 // ---------------------------------------------------------------------------- |
|
4025 // RVmbxNumber::NotifyServiceChange |
|
4026 // |
|
4027 // ---------------------------------------------------------------------------- |
|
4028 // |
|
4029 EXPORT_C void RVmbxNumber::NotifyServiceChange( |
|
4030 MServiceNotifyHandler* aHandler ) |
|
4031 { |
|
4032 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyServiceChange: =>" ); |
|
4033 |
|
4034 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
4035 { |
|
4036 iVmSpsHandler->NotifyServiceChange( aHandler ); |
|
4037 } |
|
4038 |
|
4039 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyServiceChange: <=" ); |
|
4040 } |
|
4041 |
|
4042 // ---------------------------------------------------------------------------- |
|
4043 // RVmbxNumber::NotifyServiceChangeCancel |
|
4044 // |
|
4045 // ---------------------------------------------------------------------------- |
|
4046 // |
|
4047 EXPORT_C void RVmbxNumber::NotifyServiceChangeCancel() |
|
4048 { |
|
4049 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyServiceChangeCancel: =>" ); |
|
4050 |
|
4051 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
4052 { |
|
4053 iVmSpsHandler->NotifyServiceChangeCancel(); |
|
4054 } |
|
4055 |
|
4056 VMBLOGSTRING( "VMBX: RVmbxNumber::NotifyServiceChangeCancel: <=" ); |
|
4057 } |
|
4058 |
|
4059 // ---------------------------------------------------------------------------- |
|
4060 // RVmbxNumber::BrandIdL |
|
4061 // |
|
4062 // ---------------------------------------------------------------------------- |
|
4063 // |
|
4064 EXPORT_C void RVmbxNumber::BrandIdL( TInt aServiceId, TDes8& aBrandId ) |
|
4065 { |
|
4066 VMBLOGSTRING( "VMBX: RVmbxNumber::BrandIdL: =>" ); |
|
4067 |
|
4068 if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) ) |
|
4069 { |
|
4070 iVmSpsHandler->BrandIdL( aServiceId, aBrandId ); |
|
4071 } |
|
4072 |
|
4073 VMBLOGSTRING( "VMBX: RVmbxNumber::BrandIdL: <=" ); |
|
4074 } |
|
4075 |
|
4076 // ---------------------------------------------------------------------------- |
|
4077 // RVmbxNumber::GetBrandedIconL |
|
4078 // |
|
4079 // ---------------------------------------------------------------------------- |
|
4080 // |
|
4081 EXPORT_C void RVmbxNumber::GetBrandedIconL( |
|
4082 const TDesC8& aBrandingId, |
|
4083 CFbsBitmap*& aBrandedBitmap, |
|
4084 CFbsBitmap*& aBrandedBitmapMask ) |
|
4085 { |
|
4086 VMBLOGSTRING( "VMBX: RVmbxNumber::GetBrandedIconL: =>" ); |
|
4087 |
|
4088 iVmBsHandler->GetBrandedIconL( |
|
4089 aBrandingId, aBrandedBitmap, aBrandedBitmapMask ); |
|
4090 |
|
4091 VMBLOGSTRING( "VMBX: RVmbxNumber::GetBrandedIconL: <=" ); |
|
4092 } |
|
4093 |
|
4094 // ---------------------------------------------------------------------------- |
|
4095 // RVmbxNumber::ConstructDefaultIconsL |
|
4096 // |
|
4097 // ---------------------------------------------------------------------------- |
|
4098 // |
|
4099 EXPORT_C void RVmbxNumber::ConstructDefaultIconsL( |
|
4100 CArrayPtr<CGulIcon>* aIcons ) |
|
4101 { |
|
4102 VMBLOGSTRING( "VMBX: RVmbxNumber::ConstructDefaultIconsL: =>" ); |
|
4103 |
|
4104 CFbsBitmap* bitmap; |
|
4105 CFbsBitmap* mask; |
|
4106 |
|
4107 //Get the mbm file path |
|
4108 TFileName mbmfile( KVmMbmDrive ); |
|
4109 mbmfile.Append( KDC_APP_BITMAP_DIR ); |
|
4110 mbmfile.Append( KVmLibMbmFile ); |
|
4111 |
|
4112 //default CS icon |
|
4113 AknIconUtils::CreateIconL( bitmap, mask, mbmfile, |
|
4114 EMbmVmQgn_prop_nrtyp_mobile, |
|
4115 EMbmVmQgn_prop_nrtyp_mobile_mask ); |
|
4116 |
|
4117 aIcons->AppendL( CGulIcon::NewL( bitmap, mask ) ); |
|
4118 |
|
4119 //default Video icon |
|
4120 AknIconUtils::CreateIconL( bitmap, mask, mbmfile, |
|
4121 EMbmVmQgn_prop_nrtyp_video, |
|
4122 EMbmVmQgn_prop_nrtyp_video_mask ); |
|
4123 |
|
4124 aIcons->AppendL( CGulIcon::NewL( bitmap, mask ) ); |
|
4125 |
|
4126 //default VoIP icon |
|
4127 AknIconUtils::CreateIconL( bitmap, mask, mbmfile, |
|
4128 EMbmVmQgn_prop_nrtyp_voip, |
|
4129 EMbmVmQgn_prop_nrtyp_voip_mask ); |
|
4130 |
|
4131 aIcons->AppendL( CGulIcon::NewL( bitmap, mask ) ); |
|
4132 |
|
4133 VMBLOGSTRING( "VMBX: RVmbxNumber::ConstructDefaultIconsL: <=" ); |
|
4134 } |
|
4135 // ----------------------------------------------------------------------------- |
|
4136 // RVmbxNumber::AddBrandIconL |
|
4137 // |
|
4138 // ----------------------------------------------------------------------------- |
|
4139 // |
|
4140 void RVmbxNumber::AddBrandIconL( |
|
4141 CArrayPtr<CGulIcon>* aIcons, |
|
4142 TUint aServiceId, |
|
4143 TInt& aIconId ) |
|
4144 { |
|
4145 // Set branding icon to context pane if available. |
|
4146 TBuf8<KVmSettingsUiBrandingIdLength> brandId( KNullDesC8 ); |
|
4147 |
|
4148 BrandIdL( aServiceId, brandId ); |
|
4149 |
|
4150 CFbsBitmap* brandedBitmap = NULL; |
|
4151 CFbsBitmap* brandedBitmapMask = NULL; |
|
4152 |
|
4153 // Get branded bitmap |
|
4154 TRAPD( err, GetBrandedIconL( brandId, brandedBitmap, brandedBitmapMask ) ); |
|
4155 |
|
4156 if ( KErrNone == err ) |
|
4157 { |
|
4158 // The count of list icons(before adding branding icon to the list) |
|
4159 // must be the branded icon list id |
|
4160 aIconId = aIcons->Count(); |
|
4161 // Create new icon and add it to the icon list |
|
4162 aIcons->AppendL( CGulIcon::NewL( brandedBitmap, brandedBitmapMask ) ); |
|
4163 } |
|
4164 else |
|
4165 { |
|
4166 delete brandedBitmap; |
|
4167 delete brandedBitmapMask; |
|
4168 } |
|
4169 } |
|
4170 |
|
4171 |
|
4172 // ----------------------------------------------------------------------------- |
|
4173 // RVmbxNumber::VmbxNumDefInPhoneMemory |
|
4174 // Checks is VMBX number defined in phone memory |
|
4175 // ----------------------------------------------------------------------------- |
|
4176 // |
|
4177 TBool RVmbxNumber::VmbxNumDefInPhoneMemory( TInt aLineNumber ) |
|
4178 { |
|
4179 VMBLOGSTRING( "VMBX: RVmbxNumber::VmbxNumDefInPhoneMemory: =>" ); |
|
4180 TBool numDefined( EFalse ); |
|
4181 TBuf< KVmbxMaxNumberLength > number; |
|
4182 TUint32 lineNumber = aLineNumber == |
|
4183 EAlsLine1 ? KVmbxNumberLinePrimary: KVmbxNumberLineAuxiliary; |
|
4184 |
|
4185 if ( KErrNone == iSession->Get( lineNumber, number ) ) |
|
4186 { |
|
4187 if ( aLineNumber == EAlsLine1 ) |
|
4188 { |
|
4189 if ( iMemoryLocation == EVmbxPhoneMemory && |
|
4190 number.Length() ) |
|
4191 { |
|
4192 numDefined = ETrue; |
|
4193 } |
|
4194 } |
|
4195 else if ( aLineNumber == EAlsLine2 && number.Length() ) |
|
4196 { |
|
4197 numDefined = ETrue; |
|
4198 } |
|
4199 } |
|
4200 |
|
4201 VMBLOGSTRING2("VMBX: RVmbxNumber::VmbxNumDefInPhoneMemory: numDefined = %d", |
|
4202 numDefined ); |
|
4203 return numDefined; |
|
4204 } |
|
4205 |
|
4206 // ----------------------------------------------------------------------------- |
|
4207 // RVmbxNumber::NumStoredInPhone |
|
4208 // Checks is the given number stored in phone memory |
|
4209 // ----------------------------------------------------------------------------- |
|
4210 // |
|
4211 TBool RVmbxNumber::NumStoredInPhone( const TDesC& aNumber, TInt aLineNumber ) |
|
4212 { |
|
4213 VMBLOGSTRING( "VMBX: RVmbxNumber::NumStoredInPhone: =>" ); |
|
4214 TBool numStoredInPhone( EFalse ); |
|
4215 TBuf< KVmbxMaxNumberLength > number; |
|
4216 TUint32 lineNumber = aLineNumber == |
|
4217 EAlsLine1 ? KVmbxNumberLinePrimary : KVmbxNumberLineAuxiliary; |
|
4218 |
|
4219 if ( KErrNone == iSession->Get( lineNumber, number ) ) |
|
4220 { |
|
4221 if ( !( number.Compare( aNumber ) ) ) |
|
4222 { |
|
4223 numStoredInPhone = ETrue; |
|
4224 } |
|
4225 } |
|
4226 |
|
4227 VMBLOGSTRING2( "VMBX: RVmbxNumber::NumStoredInPhone: numStoredInPhone = %d", |
|
4228 numStoredInPhone ); |
|
4229 return numStoredInPhone; |
|
4230 } |
|
4231 |
|
4232 // ----------------------------------------------------------------------------- |
|
4233 // RVmbxNumber::BackUpSimNumber |
|
4234 // Saves VMBX number to the backup store |
|
4235 // ----------------------------------------------------------------------------- |
|
4236 // |
|
4237 TInt RVmbxNumber::BackUpSimNumber( const TDesC& aNumber, TInt aLineNumber ) |
|
4238 { |
|
4239 VMBLOGSTRING( "VMBX: RVmbxNumber::BackUpSimNumber: =>" ); |
|
4240 TUint32 lineNumber = aLineNumber == EAlsLine1 ? |
|
4241 KVmbxTmpNumberLinePrimary : KVmbxTmpNumberLineAuxiliary; |
|
4242 |
|
4243 VMBLOGSTRING( "VMBX: RVmbxNumber::BackUpSimNumber: <=" ); |
|
4244 return ( iSession->Set( lineNumber, aNumber )); |
|
4245 } |
|
4246 |
|
4247 // ----------------------------------------------------------------------------- |
|
4248 // RVmbxNumber::FetchSimNumberBackUp |
|
4249 // Fetches VMBX number from backup store |
|
4250 // ----------------------------------------------------------------------------- |
|
4251 // |
|
4252 TInt RVmbxNumber::FetchSimNumberBackUp( TDes& aNumber, TInt aLineNumber ) |
|
4253 { |
|
4254 VMBLOGSTRING( "VMBX: RVmbxNumber::FetchSimNumberBackUp: =>" ); |
|
4255 TUint32 lineNumber = aLineNumber == EAlsLine1 ? |
|
4256 KVmbxTmpNumberLinePrimary : KVmbxTmpNumberLineAuxiliary; |
|
4257 |
|
4258 VMBLOGSTRING( "VMBX: RVmbxNumber::FetchSimNumberBackUp: <=" ); |
|
4259 return ( iSession->Get( lineNumber, aNumber )); |
|
4260 } |
|
4261 |
|
4262 // ----------------------------------------------------------------------------- |
|
4263 // RVmbxNumber::ClearVMBXNumberFromPhone |
|
4264 // Clear VMBX number is from SIM from the phone memory |
|
4265 // ----------------------------------------------------------------------------- |
|
4266 // |
|
4267 TInt RVmbxNumber::ClearVMBXNumberFromPhone( TInt aLineNumber ) |
|
4268 { |
|
4269 VMBLOGSTRING( "VMBX: RVmbxNumber::ClearVMBXNumberFromPhone: =>" ); |
|
4270 |
|
4271 TInt error( KErrNone ); |
|
4272 |
|
4273 if ( aLineNumber == EAlsLine1 ) |
|
4274 { |
|
4275 error = SaveVmbxNumberToPhone( KEmptyVoiceMailNumber, EAlsLine1Entry ); |
|
4276 if ( KErrNone == error && |
|
4277 ( KErrNone == iSession->Set( KVmUsesSimMemory, EVmbxSimMemory ) ) ) |
|
4278 { |
|
4279 iMemoryLocation = EVmbxSimMemory; |
|
4280 VMBLOGSTRING( |
|
4281 "VMBX: RVmbxNumber::ClearVMBXNumberFromPhone: Line 1" ); |
|
4282 } |
|
4283 } |
|
4284 else if ( aLineNumber == EAlsLine2 ) |
|
4285 { |
|
4286 error = SaveVmbxNumberToPhone( KEmptyVoiceMailNumber, EAlsLine2Entry ); |
|
4287 if ( KErrNone == error ) |
|
4288 { |
|
4289 VMBLOGSTRING( |
|
4290 "VMBX: RVmbxNumber::ClearVMBXNumberFromPhone: Line 2"); |
|
4291 } |
|
4292 } |
|
4293 else |
|
4294 { |
|
4295 error = KErrArgument; |
|
4296 } |
|
4297 VMBLOGSTRING( "VMBX: RVmbxNumber::ClearVMBXNumberFromPhone: <=" ); |
|
4298 return error; |
|
4299 } |
|
4300 |
|
4301 // ----------------------------------------------------------------------------- |
|
4302 // RVmbxNumber::UserEditNumber |
|
4303 // Indicates if user has edited VMBX number |
|
4304 // ----------------------------------------------------------------------------- |
|
4305 // |
|
4306 TBool RVmbxNumber::UserEditNumber( TInt aLineNumber ) |
|
4307 { |
|
4308 VMBLOGSTRING( "VMBX: RVmbxNumber::UserEditNumber: =>" ); |
|
4309 TBool nbrEdited( EFalse ); |
|
4310 |
|
4311 TUint32 lineNumber = aLineNumber == EAlsLine1 ? |
|
4312 KUserEditedNumber : KUserEditedNumberAuxiliary; |
|
4313 |
|
4314 iSession->Get( lineNumber, nbrEdited ); |
|
4315 |
|
4316 VMBLOGSTRING2( "VMBX: RVmbxNumber::UserEditNumber: result = %d", |
|
4317 nbrEdited ); |
|
4318 return EVmbxUserEdit == nbrEdited; |
|
4319 } |
|
4320 |
|
4321 // ----------------------------------------------------------------------------- |
|
4322 // RVmbxNumber::SetUserEditNumber |
|
4323 // Sets the flag indicating that the user has edited VMBX number |
|
4324 // ----------------------------------------------------------------------------- |
|
4325 // |
|
4326 TInt RVmbxNumber::SetUserEditNumber( TInt aLineNumber ) |
|
4327 { |
|
4328 VMBLOGSTRING( "VMBX: RVmbxNumber::SetUserEditNumber: =>" ); |
|
4329 |
|
4330 TUint32 lineNumber = aLineNumber == EAlsLine1 ? |
|
4331 KUserEditedNumber : KUserEditedNumberAuxiliary; |
|
4332 |
|
4333 VMBLOGSTRING( "VMBX: RVmbxNumber::SetUserEditNumber: <=" ); |
|
4334 return ( iSession->Set( lineNumber, EVmbxUserEdit ) ); |
|
4335 } |
|
4336 |
|
4337 // ----------------------------------------------------------------------------- |
|
4338 // RVmbxNumber::ResetUserEditNumber |
|
4339 // Resets the flag that indicates that the user has edited VMBX number |
|
4340 // ----------------------------------------------------------------------------- |
|
4341 // |
|
4342 TInt RVmbxNumber::ResetUserEditNumber( TInt aLineNumber ) |
|
4343 { |
|
4344 VMBLOGSTRING( "VMBX: RVmbxNumber::ResetUserEditNumber: =>" ); |
|
4345 |
|
4346 TUint32 lineNumber = aLineNumber == EAlsLine1 ? |
|
4347 KUserEditedNumber : KUserEditedNumberAuxiliary; |
|
4348 |
|
4349 VMBLOGSTRING( "VMBX: RVmbxNumber::ResetUserEditNumber: <=" ); |
|
4350 return ( iSession->Set( lineNumber, EVmbxNotUserEdit ) ); |
|
4351 } |
|
4352 |
|
4353 // ----------------------------------------------------------------------------- |
|
4354 // RVmbxNumber::UseSimNumIfAvailable |
|
4355 // Fetches VMBX number stored in SIM if number is available |
|
4356 // ----------------------------------------------------------------------------- |
|
4357 // |
|
4358 TBool RVmbxNumber::UseSimNumIfAvailable( TDes& aNumber, TInt aLineNumber ) |
|
4359 { |
|
4360 TBuf< KVmbxMaxNumberLength > number; |
|
4361 TBool ret( EFalse ); |
|
4362 TInt error( KErrNone ); |
|
4363 TVmbxNumberEntry numberEntry = aLineNumber == EAlsLine1 ? |
|
4364 EAlsLine1Entry : EAlsLine2Entry; |
|
4365 |
|
4366 VMBLOGSTRING( "VMBX: RVmbxNumber::UseSimNumIfAvailable: =>" ); |
|
4367 |
|
4368 // If readonly SIM which supports VMBX number |
|
4369 // number is fetched from the backup store |
|
4370 if ( ( !( iFlags & KVmFlagSimWriteSupport ) && ( iFlags & KVmFlagSimVmbxNumSupport ) ) |
|
4371 && ( ( aLineNumber == EAlsLine1 && EVmbxPhoneMemory == iMemoryLocation ) || |
|
4372 aLineNumber == EAlsLine2 ) ) |
|
4373 { |
|
4374 error = FetchSimNumberBackUp( number, aLineNumber ); |
|
4375 VMBLOGSTRING2( "VMBX: RVmbxNumber:: UseSimNumIfAvailable: number = %S", |
|
4376 &number ); |
|
4377 if ( KErrNone == error ) |
|
4378 { |
|
4379 aNumber.Copy( number ); |
|
4380 SaveVmbxNumberToPhone( aNumber, numberEntry ); |
|
4381 VMBLOGSTRING( |
|
4382 "VMBX: RVmbxNumber::UseSimNumIfAvailable: number from backup store" ); |
|
4383 ret = ETrue; |
|
4384 } |
|
4385 } |
|
4386 // If writable SIM which supports VMBX number |
|
4387 // number is fetched from SIM |
|
4388 else if ( iFlags & KVmFlagSimWriteSupport && |
|
4389 ( ( aLineNumber == EAlsLine1 && EVmbxPhoneMemory == iMemoryLocation ) || |
|
4390 aLineNumber == EAlsLine2 ) ) |
|
4391 { |
|
4392 error = GetVmNumFromSIM( number, aLineNumber ); |
|
4393 if ( KErrNone == error ) |
|
4394 { |
|
4395 aNumber.Copy( number ); |
|
4396 if ( EAlsLine1 == aLineNumber ) |
|
4397 { |
|
4398 iMemoryLocation = EVmbxSimMemory; |
|
4399 iSession->Set( KVmUsesSimMemory, EVmbxSimMemory ); |
|
4400 } |
|
4401 VMBLOGSTRING( |
|
4402 "VMBX: RVmbxNumber::UseSimNumIfAvailable: number from SIM" ); |
|
4403 ret = ETrue; |
|
4404 } |
|
4405 } |
|
4406 VMBLOGSTRING( "VMBX: RVmbxNumber::UseSimNumIfAvailable: <=" ); |
|
4407 return ret; |
|
4408 } |
|
4409 |
|
4410 // ----------------------------------------------------------------------------- |
|
4411 // RVmbxNumber::HandleNumberStores |
|
4412 // Handles the updating of a number stores in phone memory |
|
4413 // ----------------------------------------------------------------------------- |
|
4414 // |
|
4415 TInt RVmbxNumber::HandleNumberStores( TInt aLineNumber ) |
|
4416 { |
|
4417 TInt error( KErrNone ); |
|
4418 TBuf< KVmbxMaxNumberLength > line2number; |
|
4419 |
|
4420 TInt inactiveLineNumber( EAlsLine2 ); |
|
4421 |
|
4422 VMBLOGSTRING( "VMBX: RVmbxNumber::HandleNumberStores: =>" ); |
|
4423 |
|
4424 // backup the number from the SIM card to the backup store. |
|
4425 if ( !( iFlags & KVmFlagSimWriteSupport ) ) |
|
4426 { |
|
4427 if ( aLineNumber == EAlsLine2 ) |
|
4428 { |
|
4429 error = GetVmNumFromSIM( line2number, EAlsLine2Entry ); |
|
4430 if ( KErrNone == error ) |
|
4431 { |
|
4432 error = BackUpSimNumber( line2number, aLineNumber ); |
|
4433 VMBLOGSTRING2( "VMBX: RVmbxNumber::HandleNumberStores: \ |
|
4434 Back up ALS 2 Sim number, error = %d", error ); |
|
4435 } |
|
4436 } |
|
4437 else |
|
4438 { |
|
4439 error = BackUpSimNumber( iNumberFromSim, aLineNumber ); |
|
4440 VMBLOGSTRING2( "VMBX: RVmbxNumber::HandleNumberStores: \ |
|
4441 Back up ALS 1 Sim number, error = %d", error ); |
|
4442 } |
|
4443 } |
|
4444 // If number found in SIM, old stored number is erased if |
|
4445 // it's not defined by the user or updated via external clients |
|
4446 if ( !UserEditNumber( aLineNumber ) && |
|
4447 !IsPhoneMemForcedEdit( aLineNumber ) ) |
|
4448 { |
|
4449 ClearVMBXNumberFromPhone( aLineNumber ); |
|
4450 // if the number was not edited in inactive line, |
|
4451 // and do clearing opreration. |
|
4452 // The old stored number from SIM is erased. |
|
4453 // otherwise, the edited number was |
|
4454 // defined as the inactive line number. |
|
4455 // the number should be kept |
|
4456 if ( !IsInactiveLineEdited( inactiveLineNumber ) ) |
|
4457 { |
|
4458 ClearVMBXNumberFromPhone( inactiveLineNumber ); |
|
4459 } |
|
4460 |
|
4461 VMBLOGSTRING( "[VMBX]: RVmbxNumber::HandleNumberStores: Clear old VMBX number" ); |
|
4462 } |
|
4463 |
|
4464 VMBLOGSTRING( "VMBX: RVmbxNumber::HandleNumberStores: <=" ); |
|
4465 return error; |
|
4466 } |
|
4467 |
|
4468 // ---------------------------------------------------------------------------- |
|
4469 // RVmbxNumber::UsesSimMemory |
|
4470 // Returns if the SIM memory is used on ALS 1 |
|
4471 // ---------------------------------------------------------------------------- |
|
4472 // |
|
4473 TBool RVmbxNumber::UsesSimMemory() |
|
4474 { |
|
4475 VMBLOGSTRING( "VMBX: RVmbxNumber::UsesSimMemory: =>" ); |
|
4476 TBool ret( EFalse ); |
|
4477 TInt alsline( EAlsLine1 ); |
|
4478 // get the current ALS line |
|
4479 if ( GetAlsLine( alsline ) != KErrNone ) |
|
4480 { |
|
4481 alsline = EAlsLine1; // if problems, assume primary line |
|
4482 } |
|
4483 |
|
4484 iSession->Get( KVmUsesSimMemory, iMemoryLocation ); |
|
4485 if ( ( iMemoryLocation == EVmbxSimMemory ) && ( alsline == EAlsLine1 ) ) |
|
4486 { |
|
4487 VMBLOGSTRING( "VMBX: RVmbxNumber::UsesSimMemory: SimMemory active" ); |
|
4488 ret = ETrue; |
|
4489 } |
|
4490 VMBLOGSTRING( "VMBX: RVmbxNumber::UsesSimMemory: <=" ); |
|
4491 return ret; |
|
4492 } |
|
4493 |
|
4494 // ---------------------------------------------------------------------------- |
|
4495 // RVmbxNumber::IsPhoneMemForcedEdit |
|
4496 // Returns if VMBX number stored in phone memory via external clients |
|
4497 // ---------------------------------------------------------------------------- |
|
4498 // |
|
4499 TBool RVmbxNumber::IsPhoneMemForcedEdit( const TInt aLineNumber ) |
|
4500 { |
|
4501 VMBLOGSTRING( "VMBX: RVmbxNumber:: IsPhoneMemForcedEdit: =>" ); |
|
4502 TInt nbrEdited( NULL ); |
|
4503 |
|
4504 TUint32 lineNumber = aLineNumber == EAlsLine1 ? |
|
4505 KUserEditedNumber : KUserEditedNumberAuxiliary; |
|
4506 |
|
4507 iSession->Get( lineNumber, nbrEdited ); |
|
4508 |
|
4509 VMBLOGSTRING2( "VMBX: RVmbxNumber:: IsPhoneMemForcedEdit: value = %d", |
|
4510 nbrEdited ); |
|
4511 return EvmbxPhoneMemForcedEdit == nbrEdited; |
|
4512 } |
|
4513 |
|
4514 // ----------------------------------------------------------------------------- |
|
4515 // RVmbxNumber::SetPhoneMemForcedEdit |
|
4516 // Sets the flag indicating that external clients have edited VMBX number |
|
4517 // ----------------------------------------------------------------------------- |
|
4518 // |
|
4519 TInt RVmbxNumber::SetPhoneMemForcedEdit( TInt aLineNumber ) |
|
4520 { |
|
4521 VMBLOGSTRING( "VMBX: RVmbxNumber::SetPhoneMemForcedEdit: =>" ); |
|
4522 |
|
4523 TUint32 lineNumber = aLineNumber == EAlsLine1 ? |
|
4524 KUserEditedNumber : KUserEditedNumberAuxiliary; |
|
4525 |
|
4526 VMBLOGSTRING( "VMBX: RVmbxNumber::SetPhoneMemForcedEdit: <=" ); |
|
4527 return iSession->Set( lineNumber, EvmbxPhoneMemForcedEdit ); |
|
4528 } |
|
4529 |
|
4530 // ----------------------------------------------------------------------------- |
|
4531 // RVmbxNumber::ShowInformationNoteL |
|
4532 // Shows information note to user |
|
4533 // ----------------------------------------------------------------------------- |
|
4534 // |
|
4535 void RVmbxNumber::ShowInformationNoteL( const TInt aResourceId ) const |
|
4536 { |
|
4537 VMBLOGSTRING( "VMBX: RVmbxNumber::ShowInformationNoteL: =>" ); |
|
4538 HBufC* prompt = StringLoader::LoadLC( aResourceId, iCoeEnv ); |
|
4539 |
|
4540 CAknInformationNote* note = new ( ELeave ) CAknInformationNote ( ETrue ); |
|
4541 note->ExecuteLD( *prompt ); |
|
4542 |
|
4543 CleanupStack::PopAndDestroy( prompt ); |
|
4544 VMBLOGSTRING( "VMBX: RVmbxNumber::ShowInformationNoteL: <=" ); |
|
4545 } |
|
4546 |
|
4547 // ----------------------------------------------------------------------------- |
|
4548 // RVmbxNumber::IsNoNumberNoteAllowed |
|
4549 // check whether the note should be shown |
|
4550 // ----------------------------------------------------------------------------- |
|
4551 // |
|
4552 TBool RVmbxNumber::IsNoNumberNoteAllowed() |
|
4553 { |
|
4554 VMBLOGSTRING( "VMBX: RVmbxNumber::IsNoNumberNoteAllowed: =>" ); |
|
4555 TBool result( EFalse ); |
|
4556 |
|
4557 TInt videoRet( KErrNotFound ); |
|
4558 TBool isVideoSupport( VideoSupported() ); |
|
4559 TBool isVoipSupport( IsIpVoiceMailboxServices() ); |
|
4560 TBool psAddressFound( EFalse ); |
|
4561 |
|
4562 if ( isVideoSupport ) |
|
4563 { |
|
4564 HBufC* tmpNumber = HBufC::New( KVmbxMaxNumberLength ); |
|
4565 if ( tmpNumber ) |
|
4566 { |
|
4567 TPtr tmpPrt( tmpNumber->Des() ); |
|
4568 videoRet = GetVideoMbxNumber( tmpPrt ); |
|
4569 VMBLOGSTRING2( "VMBX: RVmbxNumber::IsNoNumberNoteAllowed \ |
|
4570 get videonum result=%d", videoRet ); |
|
4571 } |
|
4572 delete tmpNumber; |
|
4573 tmpNumber = NULL; |
|
4574 } |
|
4575 |
|
4576 if ( isVoipSupport ) |
|
4577 { |
|
4578 RArray<TUint> profileIds; |
|
4579 GetServiceIds( profileIds ); |
|
4580 |
|
4581 TVmbxServiceInfo serviceInfo; |
|
4582 serviceInfo.iAddress.Zero(); |
|
4583 for ( TInt i = 0; i < profileIds.Count() |
|
4584 && !psAddressFound; i++ ) |
|
4585 { |
|
4586 serviceInfo.iServiceId = profileIds[ i ]; |
|
4587 GetServiceInfo( serviceInfo ); |
|
4588 |
|
4589 VMBLOGSTRING2( "VMBX: RVmbxNumber::IsNoNumberNoteAllowed \ |
|
4590 PS address length=%d", serviceInfo.iAddress.Length() ); |
|
4591 if ( serviceInfo.iAddress.Length() ) |
|
4592 { |
|
4593 psAddressFound = ETrue; |
|
4594 } |
|
4595 } |
|
4596 |
|
4597 profileIds.Close(); |
|
4598 } |
|
4599 |
|
4600 // This check is done because phone client calls GetVmbxNumber |
|
4601 // and then SelectTypeL, which causes note qtn_... to be shown twice |
|
4602 // so the note can be shown in below several condition: |
|
4603 // the voice mailbox number is not defined, |
|
4604 // when video feature and |
|
4605 // voip feature are not supported. |
|
4606 // the video number is not defined, when video feature |
|
4607 // is supported but voip feature is not supported. |
|
4608 // the voip address is not defined, when voip feature |
|
4609 // is supported but video feature is not supported. |
|
4610 // both the video number and the voip address are not |
|
4611 // defined, when both video feature and |
|
4612 // voip feature are supported. |
|
4613 |
|
4614 if ( ( !isVideoSupport && !isVoipSupport ) |
|
4615 || ( ( isVideoSupport && KErrNotFound == videoRet ) |
|
4616 && !isVoipSupport ) |
|
4617 || ( ( isVoipSupport && !psAddressFound |
|
4618 && !isVideoSupport ) ) |
|
4619 || ( isVideoSupport && isVoipSupport |
|
4620 && KErrNotFound == videoRet && |
|
4621 !psAddressFound ) ) |
|
4622 { |
|
4623 result = ETrue; |
|
4624 } |
|
4625 |
|
4626 VMBLOGSTRING( "VMBX: RVmbxNumber::IsNoNumberNoteAllowed: <=" ); |
|
4627 return result; |
|
4628 } |
|
4629 |
|
4630 // ----------------------------------------------------------------------------- |
|
4631 // RVmbxNumber::IsInactiveLineEdited |
|
4632 // Check whether the number had been edited in inactive line |
|
4633 // ----------------------------------------------------------------------------- |
|
4634 // |
|
4635 TBool RVmbxNumber::IsInactiveLineEdited( TInt& aInactiveLineNumber ) |
|
4636 { |
|
4637 VMBLOGSTRING( "VMBX: RVmbxNumber::IsInactiveLineEdited: =>" ); |
|
4638 TBool result( EFalse ); |
|
4639 |
|
4640 TInt activeLineNumber( EAlsLine1 ); |
|
4641 TInt inactiveLineNumber( aInactiveLineNumber ); |
|
4642 |
|
4643 // get the current ALS line |
|
4644 if ( KErrNone != GetAlsLine( activeLineNumber ) ) |
|
4645 { |
|
4646 activeLineNumber = EAlsLine1; |
|
4647 } |
|
4648 else |
|
4649 { |
|
4650 // get the inactive line |
|
4651 if ( EAlsLine1 == activeLineNumber ) |
|
4652 { |
|
4653 inactiveLineNumber = EAlsLine2; |
|
4654 } |
|
4655 else |
|
4656 { |
|
4657 inactiveLineNumber = EAlsLine1; |
|
4658 } |
|
4659 // check whether the number had been edited in inactive line before |
|
4660 if ( UserEditNumber( inactiveLineNumber ) |
|
4661 || IsPhoneMemForcedEdit( inactiveLineNumber ) ) |
|
4662 { |
|
4663 result = ETrue; |
|
4664 } |
|
4665 } |
|
4666 // get the inactive line number, make it be the output argument |
|
4667 aInactiveLineNumber = inactiveLineNumber; |
|
4668 |
|
4669 VMBLOGSTRING2( "VMBX: RVmbxNumber::IsInactiveLineEdited: result = %d", |
|
4670 result ); |
|
4671 return result; |
|
4672 } |
|
4673 |
|
4674 // End of File |