×

Discussion Board

Results 1 to 2 of 2

Hybrid View

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    29

    Thumbs up Contacts fields order??

    Here is the sample code:

    I want to know how to know the order of
    the fields example KUidContactFieldPhoneNumber

    KUidContactFieldPhoneNumber: 08424561 08234322 0434567752 0911111111111

    which these numbers are
    - Mobilephone number
    - Phone number
    - Fax number and so on...

    Same is the address fields and some other fields how to know
    which orders they come? So I know this is the Home address
    this is the Work address this is the Private Address

    Or is there some place you can set the order how they come
    or some other way to get all the information in one contact
    not using internalize / externalize or export import vcards...
    functions..


    void CHelloWorldPlusAppUi::GetAllContacts() {
    file_.Write(_L8("GetAllContacts\n\n"));

    CContactDatabase* contactsDb = CContactDatabase::OpenL();
    CleanupStack::PushL(contactsDb);


    TInt numberOfContacts = contactsDb->CountL();
    pri8_.Format(_L8("NumberOfContacts: %d\n\n"), numberOfContacts);
    file_.Write(pri8_);

    TInt numberOfFieldsData = 0;


    TContactIter iter(*contactsDb);
    TContactItemId cardId;
    TInt field;
    while((cardId = iter.NextL()) != KNullContactId) {
    CContactItem* card = contactsDb->ReadContactL(cardId);
    CleanupStack::PushL(card);

    CContactItemFieldSet& fieldSet= card->CardFields();
    numberOfFieldsData = fieldSet.Count();

    pri8_.Format(_L8("NumberOfFields: %d\n\n"), numberOfFieldsData);
    file_.Write(pri8_);

    //KUidContactFieldAddress
    file_.Write(_L8("KUidContactFieldAddress: "));
    GetTextContactL(card, KUidContactFieldAddress);

    //KUidContactFieldPostOffice
    file_.Write(_L8("KUidContactFieldPostOffice: "));
    GetTextContactL(card, KUidContactFieldPostOffice);

    //KUidContactFieldExtendedAddress
    file_.Write(_L8("KUidContactFieldExtendedAddress: "));
    GetTextContactL(card, KUidContactFieldExtendedAddress);

    //KUidContactFieldLocality
    file_.Write(_L8("KUidContactFieldLocality: "));
    GetTextContactL(card, KUidContactFieldLocality);

    //KUidContactFieldRegion
    file_.Write(_L8("KUidContactFieldRegion: "));
    GetTextContactL(card, KUidContactFieldRegion);

    //KUidContactFieldPostcode
    file_.Write(_L8("KUidContactFieldPostcode: "));
    GetTextContactL(card, KUidContactFieldPostcode);

    //KUidContactFieldCountry
    file_.Write(_L8("KUidContactFieldCountry: "));
    GetTextContactL(card, KUidContactFieldCountry);

    //KUidContactFieldCompanyName
    file_.Write(_L8("KUidContactFieldCompanyName: "));
    GetTextContactL(card, KUidContactFieldCompanyName);

    //KUidContactFieldCompanyNamePronunciation
    //file_.Write(_L8("KUidContactFieldCompanyNamePronunciation: "));
    //GetTextContactL(card, KUidContactFieldCompanyNamePronunciation);

    //KUidContactFieldPhoneNumber
    file_.Write(_L8("KUidContactFieldPhoneNumber: "));
    GetTextContactL(card, KUidContactFieldPhoneNumber);

    //KUidContactFieldGivenName
    file_.Write(_L8("KUidContactFieldGivenName: "));
    GetTextContactL(card, KUidContactFieldGivenName);

    //KUidContactFieldFamilyName
    file_.Write(_L8("KUidContactFieldFamilyName: "));
    GetTextContactL(card, KUidContactFieldFamilyName);

    //KUidContactFieldGivenNamePronunciation
    //file_.Write(_L8("KUidContactFieldGivenNamePronunciation: "));
    //GetTextContactL(card, KUidContactFieldGivenNamePronunciation);

    //KUidContactFieldFamilyNamePronunciation
    //file_.Write(_L8("KUidContactFieldFamilyNamePronunciation: "));
    //GetTextContactL(card, KUidContactFieldFamilyNamePronunciation);

    //KUidContactFieldAdditionalName
    file_.Write(_L8("KUidContactFieldAdditionalName: "));
    GetTextContactL(card, KUidContactFieldAdditionalName);

    //KUidContactFieldSuffixName
    file_.Write(_L8("KUidContactFieldSuffixName: "));
    GetTextContactL(card, KUidContactFieldSuffixName);

    //KUidContactFieldPrefixName
    file_.Write(_L8("KUidContactFieldPrefixName: "));
    GetTextContactL(card, KUidContactFieldPrefixName);

    //KUidContactFieldHidden
    file_.Write(_L8("KUidContactFieldHidden: "));
    GetTextContactL(card, KUidContactFieldHidden);

    //KUidContactFieldDefinedText
    file_.Write(_L8("KUidContactFieldDefinedText: "));
    GetTextContactL(card, KUidContactFieldDefinedText);

    //KUidContactFieldEMail
    file_.Write(_L8("KUidContactFieldEMail: "));
    GetTextContactL(card, KUidContactFieldEMail);

    //KUidContactFieldMsg
    file_.Write(_L8("KUidContactFieldMsg: "));
    GetTextContactL(card, KUidContactFieldMsg);

    //KUidContactFieldSms
    file_.Write(_L8("KUidContactFieldSms: "));
    GetTextContactL(card, KUidContactFieldSms);

    //KUidContactFieldFax
    file_.Write(_L8("KUidContactFieldFax: "));
    GetTextContactL(card, KUidContactFieldFax);

    //KUidContactFieldNote
    file_.Write(_L8("KUidContactFieldNote: "));
    GetTextContactL(card, KUidContactFieldNote);

    //KUidContactStorageInline
    file_.Write(_L8("KUidContactStorageInline: "));
    GetTextContactL(card, KUidContactStorageInline);

    //KUidContactFieldBirthday
    file_.Write(_L8("KUidContactFieldBirthday: "));
    GetTextContactL(card, KUidContactFieldBirthday);

    //KUidContactFieldUrl
    file_.Write(_L8("KUidContactFieldUrl: "));
    GetTextContactL(card, KUidContactFieldUrl);

    //KUidContactFieldTemplateLabel
    file_.Write(_L8("KUidContactFieldTemplateLabel: "));
    GetTextContactL(card, KUidContactFieldTemplateLabel);

    //KUidContactFieldPicture
    file_.Write(_L8("KUidContactFieldPicture: "));
    GetTextContactL(card, KUidContactFieldPicture);


    //KUidContactFieldDTMF
    file_.Write(_L8("KUidContactFieldDTMF: "));
    GetTextContactL(card, KUidContactFieldDTMF);


    //KUidContactFieldRingTone
    file_.Write(_L8("KUidContactFieldRingTone: "));
    GetTextContactL(card, KUidContactFieldRingTone);


    //KUidContactFieldJobTitle
    file_.Write(_L8("KUidContactFieldJobTitle: "));
    GetTextContactL(card, KUidContactFieldJobTitle);


    //KUidContactFieldIMAddress
    file_.Write(_L8("KUidContactFieldIMAddress: "));
    GetTextContactL(card, KUidContactFieldIMAddress);


    //KUidContactFieldSecondName
    file_.Write(_L8("KUidContactFieldSecondName: "));
    GetTextContactL(card, KUidContactFieldSecondName);


    //KUidContactFieldSIPID
    //file_.Write(_L8("KUidContactFieldSIPID: "));
    //GetTextContactL(card, KUidContactFieldSIPID);

    /*
    * CContactICCEntry (Telephony specific) UIDs.
    */

    //KUidContactFieldSIPID
    file_.Write(_L8("KUidContactFieldICCSlot: "));
    GetTextContactL(card, KUidContactFieldICCSlot);


    //KUidContactFieldICCPhonebook
    file_.Write(_L8("KUidContactFieldICCPhonebook: "));
    GetTextContactL(card, KUidContactFieldICCPhonebook);


    //KUidContactFieldICCGroup
    file_.Write(_L8("KUidContactFieldICCGroup: "));
    GetTextContactL(card, KUidContactFieldICCGroup);


    //KUidContactFieldNone
    file_.Write(_L8("KUidContactFieldNone: "));
    GetTextContactL(card, KUidContactFieldNone);


    //KUidContactFieldMatchAll
    file_.Write(_L8("KUidContactFieldMatchAll: "));
    GetTextContactL(card, KUidContactFieldMatchAll);

    contactsDb->CloseContactL(card->Id());
    CleanupStack::PopAndDestroy(); // card
    file_.Write(_L8("\n\n"));
    }
    CleanupStack::PopAndDestroy(contactsDb);
    }

    void CHelloWorldPlusAppUi::GetTextContactL(CContactItem* aCard, TUid aUid) {
    TInt index = 0;
    index = aCard->CardFields().Find(aUid);
    while (index != KErrNotFound) {
    if (aCard->CardFields()[index].StorageType() == KStorageTypeText) {
    pri_.Copy(aCard->CardFields()[index].TextStorage()->Text());
    /*CContactItemFieldSet& fieldSet= aCard->CardFields();
    CContactItemField &itemField = fieldSet[index];
    CContactTextField* contactTextfield = itemField.TextStorage();
    pri_.Copy(contactTextfield->Text());
    */
    pri_.ZeroTerminate();
    pri8_.Copy(pri_);
    file_.Write(pri8_);
    file_.Write(_L8(" "));
    } else if (aCard->CardFields()[index].StorageType() == KStorageTypeStore) {
    file_.Write(_L8("KStorageTypeStore"));
    } else if (aCard->CardFields()[index].StorageType() == KStorageTypeContactItemId) {
    file_.Write(_L8("KStorageTypeContactItemId"));
    } else if (aCard->CardFields()[index].StorageType() == KStorageTypeDateTime) {
    file_.Write(_L8("KStorageTypeDateTime"));
    }
    index = aCard->CardFields().FindNext(aUid, index +1);
    }
    file_.Write(_L8("\n"));
    }

  2. #2
    Regular Contributor
    Join Date
    Nov 2006
    Location
    India
    Posts
    170

    Re: Contacts fields order??

    Hello,

    Try doing like this

    //Field type is Email
    case KUidContactFieldEMailValue:
    {
    if(rContentType.ContainsFieldType(KUidContactFieldVCardMapWORK))
    {
    m_pBusinessEmailArray->AppendL(rField.TextStorage()->Text());
    }
    else
    //if(rContentType.ContainsFieldType(KUidContactFieldVCardMapHOME))
    {
    if(rField.TextStorage()->Text().Length() != 0)
    {
    m_pPersonalEmailArray->AppendL(rField.TextStorage()->Text());

    }
    }
    break;
    }

    I used switch case on TFieldType . In above code you can differentiate whether given field is work email or home email. You can do the same with other.

    regards,
    bnvaikos

Similar Threads

  1. Porting Psion Data files S60 Nokia E61
    By kagege in forum News and Announcements
    Replies: 8
    Last Post: 2007-03-03, 17:25
  2. adding own fields to the contacts database
    By blizzz in forum Symbian
    Replies: 2
    Last Post: 2006-10-10, 11:21
  3. Adding fields to contacts
    By GuusDavidson in forum Symbian
    Replies: 0
    Last Post: 2004-10-27, 02:11
  4. Replies: 1
    Last Post: 2004-03-24, 08:40
  5. contact's fields filtering
    By tomutal in forum Symbian
    Replies: 0
    Last Post: 2003-09-01, 21:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •