R1tschY/harbour-sailfishconnect

Configured to use wrong location for contacts in SailFish 4.5.0.21

threepistons opened this issue · 4 comments

  • Given: reasonably recent installation of Sailfish 4.5.0.21 on Xperia 10 III, latest SailfishConnect from OpenRepos via Storeman, and KDE Connect as shipped with Debian Bookworm (sorry, I can't find an "About" dialog with a version number in it).
  • When I: use Fingerterm on the Xperia to launch SailfishConnect.
  • I get: messages about the contact database not being opened, see logs below.
  • I expect: the contact database to be opened successfully.

The contact database is at /home/defaultuser/.local/share/system/Contacts/qtcontacts-sqlite but SailfishConnect expects it at /home/nemo/.local/share/system/Contacts/qtcontacts-sqlite/contacts.db.

[defaultuser@Xperia10III ~]$ harbour-sailfishconnect 
   ____     _ ______     __   _____                       __
  / __/__ _(_) / _(_)__ / /  / ___/__  ___  ___  ___ ____/ /_
 _\ \/ _ `/ / / _/ (_-</ _ \/ /__/ _ \/ _ \/ _ \/ -_) __/ __/
/___/\_,_/_/_/_//_/___/_//_/\___/\___/_//_/_//_/\__/\__/\__/
 --- Version 0.6.2
[D] unknown:0 - Using Wayland-EGL
library "libutils.so" not found
library "libcutils.so" not found
library "libhardware.so" not found
library "android.hardware.graphics.mapper@2.0.so" not found
library "android.hardware.graphics.mapper@2.1.so" not found
library "android.hardware.graphics.mapper@3.0.so" not found
library "android.hardware.graphics.mapper@4.0.so" not found
library "libc++.so" not found
library "libhidlbase.so" not found
library "libgralloctypes.so" not found
library "android.hardware.graphics.common@1.2.so" not found
library "libion.so" not found
library "libz.so" not found
library "libhidlmemory.so" not found
library "android.hidl.memory@1.0.so" not found
library "vendor.qti.qspmhal@1.0.so" not found
[W] unknown:0 - DelegateModel::cancel: index out range 0 0
[I] unknown:0 - Using 0 MB of album art cache
[C] unknown:0 - Cannot open contacts database "/home/nemo/.local/share/system/Contacts/qtcontacts-sqlite/contacts.db" : "out of memory Error opening database"
[W] unknown:0 - QSqlQuery::exec: database not open
[C] unknown:0 - Getting modified timestamps failed: " "
[W] unknown:0 - discarding unsupported packet "kdeconnect.clipboard.connect" for "nuc"
[W] unknown:0 - QSqlQuery::exec: database not open
[C] unknown:0 - Getting modified timestamps failed: " "
[W] unknown:0 - discarding unsupported packet "kdeconnect.clipboard.connect" for "nuc"
[W] unknown:0 - discarding unsupported packet "kdeconnect.sms.request_conversations" for "nuc"
[W] unknown:0 - discarding unsupported packet "kdeconnect.sms.request_conversations" for "nuc"
blizzz commented

Seems to be hardcoded in

"/home/nemo/.local/share/system/Contacts/qtcontacts-sqlite/contacts.db");

https://stackoverflow.com/a/26696759 gives an idea of how set a string to be the logged-in user's $HOME. I don't speak C++, but if we were in Puppet, I'd use string interpolation or concatenation to accommodate the new multiple-user Sailfish.

// Magic to get a string called homedir
// I'm not sure that the `const char` in the Stack Overflow will concatenate with a string
// so I'm disinclined to paste that example code here.

static QString QTCONTACTS_SQLITE_STORE = QStringLiteral(
    homedir + "/.local/share/system/Contacts/qtcontacts-sqlite/contacts.db");
// https://cplusplus.com/reference/string/string/operator+/ says that + is the correct operator
blizzz commented

https://stackoverflow.com/a/26696759 gives an idea of how set a string to be the logged-in user's $HOME. I don't speak C++, but if we were in Puppet, I'd use string interpolation or concatenation to accommodate the new multiple-user Sailfish.

// Magic to get a string called homedir
// I'm not sure that the `const char` in the Stack Overflow will concatenate with a string
// so I'm disinclined to paste that example code here.

static QString QTCONTACTS_SQLITE_STORE = QStringLiteral(
    homedir + "/.local/share/system/Contacts/qtcontacts-sqlite/contacts.db");
// https://cplusplus.com/reference/string/string/operator+/ says that + is the correct operator

IIRC there are some standard paths provided by Qt already, QStandardPaths::HomeLocation or maybe QStandardPaths::GenericDataLocation as a shortcut.

The contacts database is no longer used by Sailfish OS: https://forum.sailfishos.org/t/4-0-1-45-non-jailed-contacts-sqlite-database-no-longer-updated/4724
The whole contacts feature have to be rewritten.