×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Nov 2011
    Posts
    104

    How to import the contacts details from the phone memory and sim memory ?

    Hi all, I am trying to import the contacts from the phone and sim memory using QML.I had almost achieved it but i am in need of some help.

    This is my coding:
    main.qml:
    import QtQuick 1.0
    import com.nokia.symbian 1.0
    import QtMobility.contacts 1.1


    Page {
    id: mainPage


    Text {
    id: title
    x: 130
    y: 0
    width: 101
    height: 36
    text: "Contacts"
    font.family: "Times New Roman"
    anchors.horizontalCenterOffset: 1
    font.pointSize: 10
    anchors.horizontalCenter: parent.horizontalCenter
    anchors.top: parent.top
    anchors.topMargin: 0
    color: platformStyle.colorNormalLight

    }
    ListView {
    id: mainList
    anchors.left: parent.left
    anchors.leftMargin: 3
    anchors.right: parent.right
    anchors.rightMargin: 3
    anchors.top: title.bottom
    anchors.bottom: parent.bottom
    anchors.topMargin: 3
    cacheBuffer: 100
    clip: true
    highlightFollowsCurrentItem: true

    snapMode: ListView.SnapOneItem
    model: contactModel.contacts
    delegate: listDelegate


    ContactModel {
    id: contactModel
    manager: "symbiansim" // "symbian" for other contact manager
    autoUpdate :true
    sortOrders:
    SortOrder {
    detail: ContactDetail.Name
    field: Name.LastName
    direction: Qt.AscendingOrder
    }
    }

    Component {
    id: listDelegate

    ListItem {
    id: contactItem
    subItemIndicator: true

    ListItemText {
    id: nameItem
    mode: contactItem.mode
    role: "Title"
    text: displayLabel
    }

    }
    }

    ScrollDecorator {
    flickableItem: mainList
    }

    }
    }

    From my code i am able to get the contacts from the phone as well as sim memory in a list view and i am able to scroll the list too.

    But what is the problem is:when i select any one of the contacts from the list it doesnt display the details as name,mobile number,e-mail…..it remains as such when i select those items

    Can anyone help me with this?
    I also tried to do something like this:

    ListView {
    id: mainList
    anchors.fill: parent
    model: ContactModel {}
    delegate: Text {
    text: "Name: " + model.contact.name.firstName + " " + model.contact.name.lastName + " Number: " + model.contact.phoneNumber.number


    but i dont know how to add this or this one is right anyone help me out?

    Regards,
    Harish

  2. #2
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: How to import the contacts details from the phone memory and sim memory ?

    Hi,

    the later piece of code should work ideally, have you checked if proper CAP are mentioned in the .pro file

  3. #3
    Regular Contributor
    Join Date
    Nov 2011
    Posts
    104

    Re: How to import the contacts details from the phone memory and sim memory ?

    thank you for your reply kusumk i have added the necessary CAP in the .pro file.

    I have an idea to use the second code which i have asked you and finished it thanks a lot
    Last edited by mkhpad; 2012-02-23 at 12:50.

  4. #4
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: How to import the contacts details from the phone memory and sim memory ?

    Ok, good to hear that you got the required for your delegate part
    Last edited by kusumk; 2012-02-23 at 13:01. Reason: misunderstood the earlier comment

  5. #5
    Regular Contributor
    Join Date
    Nov 2011
    Posts
    104

    Re: How to import the contacts details from the phone memory and sim memory ?

    Hi kusumk one more clarfication from you.From my coding i was able to get the contacts from phone as well as sim memory but it display only the contacts number and not the name......

    Can you find any mistake in my coding :

    import com.nokia.symbian 1.0
    import QtQuick 1.0
    import QtMobility.contacts 1.1

    Rectangle {
    width: 360
    height: 640

    ListView {
    id: contactList
    anchors.fill: parent
    model: ContactModel{
    manager: "symbiansim"
    autoUpdate :true

    }

    delegate: Text {
    text: model.contact.name.firstName + " " + model.contact.name.lastName + " Number: " + model.contact.phoneNumber.number

    }
    }

    }


    The output displays as:

    Name: Number: 1234656
    ...
    ...
    ..

    This is the output i am getting without contact name but the number displays.Can you help me with this?
    Last edited by mkhpad; 2012-02-24 at 06:08.

  6. #6
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: How to import the contacts details from the phone memory and sim memory ?

    Seems ok to me, except that you using 1.0 versions in import statements. I didnt check the availability in those versions,
    Can you quickly check this link and compare with your code.

  7. #7
    Regular Contributor
    Join Date
    Nov 2011
    Posts
    104

    Re: How to import the contacts details from the phone memory and sim memory ?

    Hi Kusumk,
    I have tried that link too but in that i was getting the contacts name and not the numbers.....I am in no idea to solve this.

    I am using 1.1 version and not 1.0............?

  8. #8
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: How to import the contacts details from the phone memory and sim memory ?

    Hi,
    That is because in that link .. ListItemText is given for displayLabel alone and not for number..

    All the details of the contact are as per this link - http://doc.qt.nokia.com/qtmobility/q...actdetail.html (check the bottom of the link)
    I do not have the setup right now to test though

  9. #9
    Regular Contributor
    Join Date
    Nov 2011
    Posts
    104

    Re: How to import the contacts details from the phone memory and sim memory ?

    Thank you for your patience and reply kusumk

    Sorry if i had troubled a lot

    thank a lot anyway

  10. #10
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: How to import the contacts details from the phone memory and sim memory ?

    Hi mkhpad,

    Have you resolved your problem, here is some working code (tested in N8 with some phone contacts and no sim in it) for you -

    Code:
     
           ListView {
                id: list_view1
                width: parent.width
                height: 300
                anchors.left: parent.left
                anchors.leftMargin: 0
                anchors.top: parent.top
                anchors.topMargin: 0
    
                model: ContactModel {
                    id: cmodel
                    sortOrders:
                    SortOrder {
                         detail: ContactDetail.Name
                         field: Name.firstName
                         direction: Qt.AscendingOrder
                     }
                }
    
                delegate: Rectangle {
                    width: parent.width
                    height: 32
    
                    Text {
                        Component.onCompleted: console.log(model.contact.name.firstName)
                        id: t1
                        text: model.contact.name.firstName
                        font.italic: true
                        font.pixelSize: 15
                        verticalAlignment: Text.AlignVCenter
                        horizontalAlignment: Text.AlignHCenter
                        anchors.fill: parent
                    }
    
                    Text {
                        Component.onCompleted: console.log(model.contact.phoneNumber.number)
                        text: model.contact.phoneNumber.number
                        font.italic: true
                        font.pixelSize: 15
                        verticalAlignment: Text.AlignVCenter
                        horizontalAlignment: Text.AlignHCenter
                        anchors.fill: t1.right
                    }
                }
            }
    Hope this helps!

  11. #11
    Regular Contributor
    Join Date
    Nov 2011
    Posts
    104

    Re: How to import the contacts details from the phone memory and sim memory ?

    Hi Kusumk,
    Thank you for your reply....I got it worked with your code thanks a lot

Similar Threads

  1. Reading text file stored in phone memory/memory card
    By devdattac in forum Mobile Java General
    Replies: 6
    Last Post: 2008-09-19, 19:30
  2. Dita Direct transfer to Memory Card (not phone memory)-nokia 6270
    By sharmavijay78 in forum Series 40 & S60 Platform Feedback Archive
    Replies: 0
    Last Post: 2007-07-15, 10:12
  3. Replies: 0
    Last Post: 2007-05-28, 03:03
  4. Accessing Contacts from Phone Memory
    By dhanyap in forum Mobile Java General
    Replies: 2
    Last Post: 2007-04-04, 15:07
  5. nokia 3300 - move files from memory card to phone memory
    By ned_21 in forum Mobile Java General
    Replies: 0
    Last Post: 2003-12-30, 03:51

Posting Permissions

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