How to correctly insert contacts ?

asked 2017-11-30 12:24:59 +0300

MichautS gravatar image

updated 2017-11-30 16:32:28 +0300

Hi all.

I'm making a Qt application which allow to modify / create contacts from a computer. I managed to do this by directly inserting datas inside the privileged database in all tables (this one : /home/nemo/.local/share/privileged/Contacts/qtcontacts-sqlite/contacts.db). However doing this brought me two drawbacks :

  • It require to change the owner of the privileged folder to nemo
  • Even if the backend is well made only the first Name and the last Name is displayed on the contact graphic interface of the phone (every else informations such as phoneNumbers or nicknames are not displayed even if they exists in the database)

After some searching i found out every contacts requires a key inside the Guids tables, so... i'm stuck by doing this way, even after searches on this forum.

I found two alternate way :

  • Sending a signal on the Dbus to create a contact from the phone, but i don't know which method do this job and i didnt find the interface which handle contacts (org.nemomobile.contacts.sqlite is not found in the DBus inspector)

  • using the qcontactmanager / qcontact : but i don't know how to use it and how to import it (in fact i don't find documentation about it)

What's the best option ?

Thanks for answers or idea

EDIT : i think i explained badly my problem, i can create contacts but only a few informations are displayed on the contact screen.

Example :

Created on the phone created

Created from the Qt Application Qt

Both got phone numbers and emails on the database, however only the one created from the phone (as any user) display these informations

edit retag flag offensive close delete

Comments

@MichautS - maybe this might help you;

dbus service for contacts = com.jolla.contacts.ui;

/usr/share/dbus-1/services/

Full path for ContactsDBusService,qml;

/usr/share/jolla-messages/common/ContactsDBusService.qml

import org.nemomobile.dbus 2.0

DBusInterface {
    service: "com.jolla.contacts.ui"
    path: "/com/jolla/contacts/ui"
    iface: "com.jolla.contacts.ui"
}
Spam Hunter ( 2017-11-30 13:17:45 +0300 )edit