Hi all

Is it possible to steer where a QML application stores its OfflineStorage Database?

I have a family of applications that share a common OfflineStorage Database. This works well on Harmattan, and on the early Sailfish Alphas without me having had to do anything special at all.

In the early Sailfish Alphas OfflineStorage DBs were stored in a common location, and thus could be easily shared.
/home/nemo/.local/share/data/QML/OfflineStorage/Databases

Now on the real Jolla, I find that the standard DB storage location has changed, and DBs are now put in a subdirectory of the application's installation folder. e.g.

/home/nemo/.local/share/landed25_QT5/QML/OfflineStorage
/home/nemo/.local/share/CreateDBQt5/QML/OfflineStorage

This means without some magic, Sailfish apps can no longer share DBs.

In C++ there is a property offlineStoragePath, and a setter method setOfflineStoragePath().

http://qt-project.org/doc/qt-5/qqmlengine.html#offlineStoragePath-prop

I might be able to use this to change the location of the DB, e.g to one of the Qt StandardLocations:

http://qt-project.org/doc/qt-5.0/qtcore/qstandardpaths.html#StandardLocation-enum

But setOfflineStoragePath() appears not to be directly available to QML.

http://stackoverflow.com/questions/14209585/how-to-set-custom-offline-storage-path-from-javascript-in-qtquick

So I guess I could call setOfflineStoragePath in each apps' main cpp file.

Or maybe I could even write a declarative plugin to expose setOfflineStoragepath to QML, but that is probably overkill as it would instantiate QQmlEngine - just t o set a path.

Or is there a better way? Are there any Harbour entry considerations to an app creating / accessing a DB somewhere other than in its own folder?

Thanks

Chris

_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to