×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Jun 2006
    Location
    China. Beijing
    Posts
    95

    How can I check the contact item with specified ID exist in current Contact Database?

    Hi all:
    I spcified a TContactItemId, and how can I check the item with the Id exists in the current contact database?

  2. #2
    Registered User
    Join Date
    Jun 2006
    Posts
    259

    Re: How can I check the contact item with specified ID exist in current Contact Database?

    Hi,

    Try with this function FindLC() in CContactDatabase.
    Also check CAknSearchField.

    Cheer's

  3. #3
    Super Contributor
    Join Date
    Jul 2004
    Location
    Romania
    Posts
    560

    Re: How can I check the contact item with specified ID exist in current Contact Database?

    Quote Originally Posted by marvik_34
    Hi,

    Try with this function FindLC() in CContactDatabase.
    Also check CAknSearchField.

    Cheer's
    FindLC uses TDesC so is useless if you want to searc based on TContactItemId. A better solution would be to use SortedItemsL() or to create a LocaView....but this is an ugly solution

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: How can I check the contact item with specified ID exist in current Contact Database?

    Did u try using:-

    CContactItem* CContactDatabase::ReadContactL(TContactItemId aContactId);

    It will give u what you are looking for.

    Cheers
    mayank

  5. #5
    Registered User
    Join Date
    Jun 2006
    Location
    China. Beijing
    Posts
    95

    Re: How can I check the contact item with specified ID exist in current Contact Database?

    Yeah, I took use of the leave code of OpenContactL to achieve that. thank you.

  6. #6
    Registered User
    Join Date
    Jul 2005
    Posts
    190

    Exclamation Re: How can I check the contact item with specified ID exist in current Contact Datab

    Quote Originally Posted by mayankkedia View Post
    Did u try using:-

    CContactItem* CContactDatabase::ReadContactL(TContactItemId aContactId);

    It will give u what you are looking for.

    Cheers
    mayank
    What if ReadContactL crash the application as if TContactItemId does not exist?

    Is there any simple solution to find that the contact with TContactItemId exist?

  7. #7
    Super Contributor
    Join Date
    Sep 2007
    Posts
    1,005

    Re: How can I check the contact item with specified ID exist in current Contact Datab

    看来只有遍历通讯录可以解决了

  8. #8
    Registered User
    Join Date
    Jul 2005
    Posts
    190

    Exclamation Re: How can I check the contact item with specified ID exist in current Contact Datab

    Quote Originally Posted by oracle3 View Post
    看来只有遍历通讯录可以解决了
    Only English PLEASE. I don't understand Chinese.

  9. #9
    Registered User
    Join Date
    Jul 2005
    Posts
    190

    Exclamation Re: How can I check the contact item with specified ID exist in current Contact Datab

    Quote Originally Posted by oracle3 View Post
    看来只有遍历通讯录可以解决了
    Only English PLEASE. I don't understand Chinese.

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,671

    Re: How can I check the contact item with specified ID exist in current Contact Datab

    Quote Originally Posted by say2paul View Post
    What if ReadContactL crash the application as if TContactItemId does not exist?
    Does it really "crash" (panics as we know), or does it simply leave? Try using TRAP/D.
    Let us say, you have
    Code:
    void CSomething::YourMethodL(TContactItemId aId)
    {
        CPbkContactItem *item=iSomething->ReadContactL(aId);
        CleanupStack::PushL(item);
        ... do things ...
        CleanupStack::PopAndDestroy(); // item
    }
    What happens if you modify it to
    Code:
    void CSomething::YourMethodL(TContactItemId aId)
    {
    TRAPD(err,
        CPbkContactItem *item=iSomething->ReadContactL(aId);
        CleanupStack::PushL(item);
        ... do things ...
        CleanupStack::PopAndDestroy(); // item
    );
    }
    ?

  11. #11
    Registered User
    Join Date
    Jul 2005
    Posts
    190

    Thumbs up Re: How can I check the contact item with specified ID exist in current Contact Datab

    Quote Originally Posted by wizard_hu_ View Post
    Does it really "crash" (panics as we know), or does it simply leave? Try using TRAP/D.
    Let us say, you have
    Code:
    void CSomething::YourMethodL(TContactItemId aId)
    {
        CPbkContactItem *item=iSomething->ReadContactL(aId);
        CleanupStack::PushL(item);
        ... do things ...
        CleanupStack::PopAndDestroy(); // item
    }
    What happens if you modify it to
    Code:
    void CSomething::YourMethodL(TContactItemId aId)
    {
    TRAPD(err,
        CPbkContactItem *item=iSomething->ReadContactL(aId);
        CleanupStack::PushL(item);
        ... do things ...
        CleanupStack::PopAndDestroy(); // item
    );
    }
    ?
    The problem was that I was using TRAPD with ReadContactLC() function. But It is not recommended to call a function with an LC suffix from inside a trap harness. Thats why I try it as following:

    TRAPD(err, Citem = iDatabase->ReadContactLC((*contacts)[i]); CleanupStack::Pop(Citem));

    The application started behaving very strange. The function in which I was using the above line was called again automatically.

    Then I used ReadContactL() instead of ReadContactLC() and it solved the problem.

    Thanks everyone for the contribution.

Similar Threads

  1. Replies: 4
    Last Post: 2006-10-12, 09:56
  2. contact number and contact names doesn't match.
    By ninidotnet in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-10-09, 09:25
  3. How to refurbish the current item of listbox
    By zhaotaobenny in forum Symbian
    Replies: 2
    Last Post: 2006-06-26, 12:00
  4. how can we check if a file does exist or not
    By li_haiming in forum Symbian
    Replies: 2
    Last Post: 2003-03-08, 05:09
  5. Get current item in a CAknForm
    By luismc in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-11-16, 15:20

Posting Permissions

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