equal
deleted
inserted
replaced
269 { |
269 { |
270 case ReadState: |
270 case ReadState: |
271 { |
271 { |
272 QList<QContact> contacts = decodeSimContactsL(m_buffer); |
272 QList<QContact> contacts = decodeSimContactsL(m_buffer); |
273 |
273 |
274 // set sync target |
274 // set sync target and set type as read only |
275 QList<QContact>::iterator i; |
275 QList<QContact>::iterator i; |
276 for (i = contacts.begin(); i != contacts.end(); ++i) { |
276 for (i = contacts.begin(); i != contacts.end(); ++i) { |
277 QContactSyncTarget syncTarget; |
277 QContactSyncTarget syncTarget; |
278 syncTarget.setSyncTarget(KSimSyncTarget); |
278 syncTarget.setSyncTarget(KSimSyncTarget); |
|
279 m_engine.setReadOnlyAccessConstraint(&syncTarget); |
279 i->saveDetail(&syncTarget); |
280 i->saveDetail(&syncTarget); |
|
281 QContactType contactType = i->detail(QContactType::DefinitionName); |
|
282 m_engine.setReadOnlyAccessConstraint(&contactType); |
|
283 i->saveDetail(&contactType); |
280 } |
284 } |
281 |
285 |
282 emit m_simStore.readComplete(contacts, QContactManager::NoError); |
286 emit m_simStore.readComplete(contacts, QContactManager::NoError); |
283 } |
287 } |
284 break; |
288 break; |
293 |
297 |
294 // set sync target |
298 // set sync target |
295 if(m_convertedContact.detail(QContactSyncTarget::DefinitionName).isEmpty()) { |
299 if(m_convertedContact.detail(QContactSyncTarget::DefinitionName).isEmpty()) { |
296 QContactSyncTarget syncTarget = m_convertedContact.detail(QContactSyncTarget::DefinitionName); |
300 QContactSyncTarget syncTarget = m_convertedContact.detail(QContactSyncTarget::DefinitionName); |
297 syncTarget.setSyncTarget(KSimSyncTarget); |
301 syncTarget.setSyncTarget(KSimSyncTarget); |
|
302 m_engine.setReadOnlyAccessConstraint(&syncTarget); |
298 m_convertedContact.saveDetail(&syncTarget); |
303 m_convertedContact.saveDetail(&syncTarget); |
299 } |
304 } |
|
305 |
|
306 // set type as read only |
|
307 QContactType contactType = m_convertedContact.detail(QContactType::DefinitionName); |
|
308 m_engine.setReadOnlyAccessConstraint(&contactType); |
|
309 m_convertedContact.saveDetail(&contactType); |
300 |
310 |
301 emit m_simStore.writeComplete(m_convertedContact, QContactManager::NoError); |
311 emit m_simStore.writeComplete(m_convertedContact, QContactManager::NoError); |
302 } |
312 } |
303 break; |
313 break; |
304 |
314 |
430 // Contact name otherwise |
440 // Contact name otherwise |
431 QContactName name; |
441 QContactName name; |
432 QString nameString = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length()); |
442 QString nameString = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length()); |
433 name.setCustomLabel(nameString); |
443 name.setCustomLabel(nameString); |
434 if (m_readOnlyAccess) |
444 if (m_readOnlyAccess) |
435 m_engine.setReadOnlyAccessConstraint(&name); |
445 m_engine.setReadOnlyAccessConstraint(&name); |
436 currentContact.saveDetail(&name); |
446 currentContact.saveDetail(&name); |
437 QContactManager::Error error(QContactManager::NoError); |
447 QContactManager::Error error(QContactManager::NoError); |
438 m_engine.setContactDisplayLabel(¤tContact, m_engine.synthesizedDisplayLabel(currentContact, &error)); |
448 m_engine.setContactDisplayLabel(¤tContact, m_engine.synthesizedDisplayLabel(currentContact, &error)); |
439 } |
449 } |
440 } |
450 } |
445 if (pbBuffer->GetValue(bufPtr) == KErrNone) { |
455 if (pbBuffer->GetValue(bufPtr) == KErrNone) { |
446 QContactNickname nickName; |
456 QContactNickname nickName; |
447 QString name = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length()); |
457 QString name = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length()); |
448 nickName.setNickname(name); |
458 nickName.setNickname(name); |
449 if (m_readOnlyAccess) |
459 if (m_readOnlyAccess) |
450 m_engine.setReadOnlyAccessConstraint(&nickName); |
460 m_engine.setReadOnlyAccessConstraint(&nickName); |
451 currentContact.saveDetail(&nickName); |
461 currentContact.saveDetail(&nickName); |
452 } |
462 } |
453 break; |
463 break; |
454 } |
464 } |
455 case RMobilePhoneBookStore::ETagPBNumber: |
465 case RMobilePhoneBookStore::ETagPBNumber: |
457 if (pbBuffer->GetValue(bufPtr) == KErrNone) { |
467 if (pbBuffer->GetValue(bufPtr) == KErrNone) { |
458 QContactPhoneNumber phoneNumber; |
468 QContactPhoneNumber phoneNumber; |
459 QString number = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length()); |
469 QString number = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length()); |
460 phoneNumber.setNumber(number); |
470 phoneNumber.setNumber(number); |
461 if (m_readOnlyAccess) |
471 if (m_readOnlyAccess) |
462 m_engine.setReadOnlyAccessConstraint(&phoneNumber); |
472 m_engine.setReadOnlyAccessConstraint(&phoneNumber); |
463 currentContact.saveDetail(&phoneNumber); |
473 currentContact.saveDetail(&phoneNumber); |
464 } |
474 } |
465 break; |
475 break; |
466 } |
476 } |
467 case RMobilePhoneBookStore::ETagPBAnrStart: |
477 case RMobilePhoneBookStore::ETagPBAnrStart: |
475 if (pbBuffer->GetValue(bufPtr) == KErrNone) { |
485 if (pbBuffer->GetValue(bufPtr) == KErrNone) { |
476 QContactEmailAddress email; |
486 QContactEmailAddress email; |
477 QString emailAddress = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length()); |
487 QString emailAddress = QString::fromUtf16(bufPtr.Ptr(), bufPtr.Length()); |
478 email.setEmailAddress(emailAddress); |
488 email.setEmailAddress(emailAddress); |
479 if (m_readOnlyAccess) |
489 if (m_readOnlyAccess) |
480 m_engine.setReadOnlyAccessConstraint(&email); |
490 m_engine.setReadOnlyAccessConstraint(&email); |
481 currentContact.saveDetail(&email); |
491 currentContact.saveDetail(&email); |
482 } |
492 } |
483 break; |
493 break; |
484 } |
494 } |
485 case RMobilePhoneBookStore::ETagPBNewEntry: |
495 case RMobilePhoneBookStore::ETagPBNewEntry: |
497 } //switch |
507 } //switch |
498 |
508 |
499 // save contact to the array of contact to be returned if the whole entry was extracted |
509 // save contact to the array of contact to be returned if the whole entry was extracted |
500 if ((tagValue == RMobilePhoneBookStore::ETagPBNewEntry && currentContact.localId() > 0) || |
510 if ((tagValue == RMobilePhoneBookStore::ETagPBNewEntry && currentContact.localId() > 0) || |
501 (pbBuffer->RemainingReadLength() == 0 && currentContact.localId() > 0)) { |
511 (pbBuffer->RemainingReadLength() == 0 && currentContact.localId() > 0)) { |
502 //QContactSyncTarget syncTarget; |
|
503 //syncTarget.setSyncTarget(KSimSyncTarget); |
|
504 //currentContact.saveDetail(&syncTarget); |
|
505 fetchedContacts.append(currentContact); |
512 fetchedContacts.append(currentContact); |
506 //clear current contact |
513 //clear current contact |
507 currentContact.clearDetails(); |
514 currentContact.clearDetails(); |
508 QScopedPointer<QContactId> contactId(new QContactId()); |
515 QScopedPointer<QContactId> contactId(new QContactId()); |
509 contactId->setLocalId(0); |
516 contactId->setLocalId(0); |