Issues using PeopleModel (org.nemomobile.contacts)

Hi folks,

as using org.nemomobile.contacts is now permitted with SFOS 4.5, I wanted to include support for handling contacts back in Fernschreiber. However, for some strange reason, the PeopleModel seems to have some issues. When loading it in the app, the QtContacts backend reports the following warnings followed by some logs (the last two entries are my logs to check if the model was populated):

[W] unknown:0 - "Failed to attach key memory region for qtcontacts-sqlite-np: QSharedMemory::attach (shmget): doesn't exist"
[W] unknown:0 - "Failed to open contacts transient store"
[W] unknown:0 - "Unable to open synchronous engine database connection"
[W] unknown:0 - QSqlQuery::prepare: database not open
[W] unknown:0 - "Failed to prepare distinct display label group selection query:  \n SELECT DISTINCT DisplayLabelGroup FROM DisplayLabels ORDER BY DisplayLabelGroupSortOrder ASC"
[D] unknown:0 - Starting favorites query at 645 ms
[D] unknown:0 - Favorites queried in 860 ms
[D] unknown:0 - Starting metadata query at 1028 ms
[D] onPopulatedChanged:60 - People now populated? true
[D] onPopulatedChanged:61 - Contacts: 0

Despite these issues, the PeopleModel raises the populated signal with true, but without any contacts in the model.

My declaration:


PeopleModel {
    requiredProperty: PeopleModel.PhoneNumberRequired
    onPopulatedChanged: {
        console.log("People now populated? " + populated);
        console.log("Contacts: " + count)
    }
}

The .desktop file is updated with the ‘Contacts’ permission:

[X-Sailjail]
Permissions=Audio;Contacts;Documents;Downloads;Internet;Location;MediaIndexing;Microphone;Music;Pictures;PublicDir;RemovableMedia;UserDirs;Videos

The contacts permission is also visible in the app settings, so it’s most certainly correctly declared.

Any ideas/hints/documentation? I can derive a lot of things from the QML type declarations, but some help would be appreciated, especially what’s missing to get the contacts loaded properly…

2 Likes

Is your code by any chance available in e.g. github?

I have a feeling this is related to sailjail.

Just a speculation : what happens if you add Privileged permission ?

I guess this needs more than the X-Sailjail/Permissions. You will also need to run your app under the privileged group, which is achieved with the help of mapplauncherd through the configuration in /usr/share/mapplauncherd/privileges.d/*.privileges - see also Mapplauncherd privileges question.

Additionally, if you want to see the contacts when you run your app from the IDE, check this Launching projects from SDK in sandboxed mode.

Sure, coding is here: GitHub - Wunderfitz/harbour-fernschreiber: Fernschreiber is a Telegram client for Sailfish OS
Usage of the PeopleModel is here (without the onPopulatedChanged however): harbour-fernschreiber/ContactSync.qml at master · Wunderfitz/harbour-fernschreiber · GitHub
SailJail configuration: harbour-fernschreiber/harbour-fernschreiber.desktop at master · Wunderfitz/harbour-fernschreiber · GitHub

Is that a hard-coded special SailJail permission? Just asking as it’s not listed in the documentation or in the list of permissions in the repo on GitHub - sailfishos/sailjail-permissions

I know that mapplauncherd works - I implemented the solution already back in 2021, see GitHub - Wunderfitz/harbour-fernschreiber at nonHarbourExtras
But wouldn’t it be ridiculous to need to use that in addition to SailJail (and most certainly still be against the Harbour rules)?