Open threepistons opened 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
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.
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
.