R1tschY / harbour-sailfishconnect

KDE Connect for Sailfish OS
GNU General Public License v3.0
45 stars 16 forks source link

Configured to use wrong location for contacts in SailFish 4.5.0.21 #52

Open threepistons opened 1 year ago

threepistons commented 1 year ago

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 1 year ago

Seems to be hardcoded in https://github.com/R1tschY/harbour-sailfishconnect/blob/e586d06cb8daca506378cc81d060a80263452bae/pluginscommon/contactsmanager.cpp#L32

threepistons commented 1 year ago

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 1 year ago

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.

R1tschY commented 1 year ago

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.