Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    20

    Question about CPbkContactEngine

    Here is my code:

    RPbkViewResourceFile phonebookResource( *(CEikonEnv::Static()) );
    if ( !phonebookResource.IsOpen())
    {
    phonebookResource.OpenL();
    }
    // Add searching array to parameters
    CPbkMultipleEntryFetchDlg::TParams params;
    if(!iPbkContactEngine)
    {
    iPbkContactEngine = CPbkContactEngine::NewL();
    CleanupStack::PushL(iPbkContactEngine);
    }
    params.iContactView = &iPbkContactEngine->AllContactsView();

    // Launch fetching dialog
    CPbkMultipleEntryFetchDlg* fetchDlg = CPbkMultipleEntryFetchDlg::NewL( params, *iPbkContactEngine );
    fetchDlg->SetMopParent(this);
    TInt okPressed = fetchDlg->ExecuteLD();
    CleanupStack::PushL( params.iMarkedEntries );
    TBuf<100> tempBuf;
    TBuf<100> bufArray;
    TBuf<100> iNumberGeneral;
    TBuf<100> iNumberMoblie;
    TBuf<100> iNumberHome;
    TBuf<100> iNumberVideo;
    TBuf<100> iNumberWork;

    if (iRPhone)
    {
    iRPhone->Reset();
    }
    else
    {
    iRPhone = new (ELeave) RArray<Phonestr>;
    }

    if ( okPressed )
    {
    // Get the first selected contacts id array
    Phonestr phoneStatus;
    const TContactItemId cid = ( *params.iMarkedEntries )[0];

    // Open the selected contact using Phonebook engine,
    CPbkContactItem* pbkItem = iPbkContactEngine->ReadContactLC( cid );


    TPbkContactItemField* fnameField = pbkItem->FindField(EPbkFieldIdFirstName);
    if (fnameField)
    {
    fnameField->GetTextL(tempBuf);
    }
    TPbkContactItemField* lnameField = pbkItem->FindField(EPbkFieldIdLastName);
    if (lnameField)
    {
    lnameField->GetTextL(bufArray);
    bufArray.Append(tempBuf);
    phoneStatus.iBNumber = EFalse;
    phoneStatus.iPhoneNumber.Zero();
    phoneStatus.iPhoneNumber.Copy(bufArray);
    iRPhone->Append(phoneStatus);
    }

    // get the General PhoneNumber
    TPbkContactItemField* phoneFieldGeneral = pbkItem->FindField(EPbkFieldIdPhoneNumberGeneral);
    if (phoneFieldGeneral)
    {
    phoneFieldGeneral->GetTextL(iNumberGeneral);
    phoneStatus.iBNumber = ETrue;
    phoneStatus.iPhoneNumber.Zero();
    phoneStatus.iPhoneNumber.Copy(iNumberGeneral);
    iRPhone->Append(phoneStatus);
    }

    // get the Mobile PhoneNumber
    TPbkContactItemField* phoneFieldMobile = pbkItem->FindField(EPbkFieldIdPhoneNumberMobile);
    if (phoneFieldMobile)
    {
    phoneFieldMobile->GetTextL(iNumberMoblie);
    phoneStatus.iBNumber = ETrue;
    phoneStatus.iPhoneNumber.Zero();
    phoneStatus.iPhoneNumber.Copy(iNumberMoblie);
    iRPhone->Append(phoneStatus);
    }
    //get the email address
    TPbkContactItemField *phoneFieldHome=pbkItem->FindField(EPbkFieldIdPhoneNumberHome);
    if (phoneFieldHome)
    {
    phoneFieldHome->GetTextL(iNumberHome);
    phoneStatus.iBNumber = ETrue;
    phoneStatus.iPhoneNumber.Zero();
    phoneStatus.iPhoneNumber.Copy(iNumberHome);
    iRPhone->Append(phoneStatus);
    }

    TPbkContactItemField *videoNumber=pbkItem->FindField(EPbkFieldIdPhoneNumberVideo);
    if (videoNumber)
    {
    videoNumber->GetTextL(iNumberVideo);
    phoneStatus.iBNumber = ETrue;
    phoneStatus.iPhoneNumber.Zero();
    phoneStatus.iPhoneNumber.Copy(iNumberVideo);
    iRPhone->Append(phoneStatus);
    }

    TPbkContactItemField *workNumber=pbkItem->FindField(EPbkFieldIdPhoneNumberWork);
    if (workNumber)
    {
    workNumber->GetTextL(iNumberWork);
    phoneStatus.iBNumber = ETrue;
    phoneStatus.iPhoneNumber.Zero();
    phoneStatus.iPhoneNumber.Copy(iNumberWork);
    iRPhone->Append(phoneStatus);
    }

    // add codes to get other fields you interested in
    //......

    CleanupStack::PopAndDestroy(pbkItem); // pbkItem, eMailAdd
    }
    //release the resource
    CleanupStack::PopAndDestroy(); // iMarkedEntriesiPbkContactEngine

    CleanupStack::PopAndDestroy(iPbkContactEngine);
    //CleanupStack::PopAndDestroy(dataBase);
    iPbkContactEngine = NULL;
    phonebookResource.Close(); // Close the phonebook view

    in my mmp file: i added ReadUserData and WriteUserData capabilities, and also i authenticate my application.
    i can run it on epoc but i can't run in mobilephone
    platform is s60 3rd

    this problem has confused me for 3 days, please help me

    thanks

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: about CPbkContactEngine

    if i am not wrong you forgot to write which problem you are facing...

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    20

    Re: about CPbkContactEngine

    when run CPbkContactEngine::NewL() the application exit with the information "application_name quit"
    but it didn't happen on epoc

    why

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: about CPbkContactEngine

    Try getting some Error Messages. With http://wiki.forum.nokia.com/index.ph...or_messages%3F

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

    Re: about CPbkContactEngine

    Quote Originally Posted by milandttp View Post
    when run CPbkContactEngine::NewL() the application exit with the information "application_name quit"
    but it didn't happen on epoc

    why
    How do you know that your application exists on CPbkContactEngine::NewL()?

  6. #6
    Registered User
    Join Date
    Aug 2007
    Posts
    20

    Re: about CPbkContactEngine

    Quote Originally Posted by pirosl View Post
    How do you know that your application exists on CPbkContactEngine::NewL()?
    i debug it like this:
    iEikonEnv->AlertWin(_L("display 1"));
    CPbkContactEngine::NewL()
    iEikonEnv->AlertWin(_L("display 2"));

    but just displayed "display 1" then application exit
    so i think my application exit on CPbkContactEngine::NewL()

  7. #7
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: about CPbkContactEngine

    Try Using CPbkContactEngine::Static()

  8. #8
    Registered User
    Join Date
    Aug 2007
    Posts
    20

    Re: about CPbkContactEngine

    Quote Originally Posted by skumar_rao View Post
    Try Using CPbkContactEngine::Static()
    had the same problem

  9. #9
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: about CPbkContactEngine

    are you using the CPbkContactEngine non-GUI application ?

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

    Re: about CPbkContactEngine

    Quote Originally Posted by milandttp View Post
    had the same problem
    Can you try the following thing and let us know the results?

    iEikonEnv->AlertWin(_L("display 1"));
    CPbkContactEngine* eng = CPbkContactEngine::Static();
    if(!eng) iEikonEnv->AlertWin(_L("display 3"));
    else iEikonEnv->AlertWin(_L("display 2"));

  11. #11
    Registered User
    Join Date
    Aug 2007
    Posts
    20

    Re: about CPbkContactEngine

    Quote Originally Posted by skumar_rao View Post
    are you using the CPbkContactEngine non-GUI application ?
    no, i used in a view

  12. #12
    Registered User
    Join Date
    Aug 2007
    Posts
    20

    Re: about CPbkContactEngine

    Quote Originally Posted by pirosl View Post
    Can you try the following thing and let us know the results?

    iEikonEnv->AlertWin(_L("display 1"));
    CPbkContactEngine* eng = CPbkContactEngine::Static();
    if(!eng) iEikonEnv->AlertWin(_L("display 3"));
    else iEikonEnv->AlertWin(_L("display 2"));
    CPbkContactEngine::Static(); return NULL
    so display "display 3"

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

    Re: about CPbkContactEngine

    Quote Originally Posted by milandttp View Post
    CPbkContactEngine::Static(); return NULL
    so display "display 3"
    On what phone do you test? (what s60 version?)

  14. #14
    Registered User
    Join Date
    Aug 2007
    Posts
    20

    Re: about CPbkContactEngine

    Quote Originally Posted by pirosl View Post
    On what phone do you test? (what s60 version?)
    on s60 2nd version it works well(i used N70 to test on 2nd version)

    but on s60 3rd version it runs error(i used Nokia 3250 to test on 3rd version, and on N95 and E65 there are the same problem)

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

    Re: about CPbkContactEngine

    Quote Originally Posted by milandttp View Post
    on s60 2nd version it works well(i used N70 to test on 2nd version)

    but on s60 3rd version it runs error(i used Nokia 3250 to test on 3rd version, and on N95 and E65 there are the same problem)
    As far as I know, on 3rd edition you need ReadDeviceData ReadUserData WriteDeviceData WriteUserData capabilities. Do you have them all or only ReadUserData and WriteUserData?

Similar Threads

  1. Kern Exec 0 with CPbkContactEngine
    By TPMaKom in forum Symbian
    Replies: 12
    Last Post: 2009-10-28, 16:04
  2. size of CPbkContactEngine object
    By ruchirvasavada in forum Symbian
    Replies: 9
    Last Post: 2008-03-14, 08:05
  3. CPbkContactEngine panic problem
    By joape382 in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2005-01-17, 12:43
  4. Can CPbkContactEngine be used in s60 v1.2 ?
    By cvz in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2003-07-12, 17:52
  5. CPbkContactEngine usage in s60 SDK
    By cvz in forum Symbian
    Replies: 0
    Last Post: 2003-07-12, 17:45

Posting Permissions

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