This morning I successfully migrated the LocalStorage part of my app LandedSettings from the Sailfish Alpha 1 (Qt4) style to the new Sailfish Alpha 2 (Qt5) style.
Below is a summary of the things I had to change:
1) LocalStorage is not installed by default on the Emulator: You must install via zypper
Connect via SSH to the Emulator:
Verify first if installed:
zypper se Storage
If not present, then
zypper in qt5-qtdeclarative-import-localstorageplugin
import QtQuick.LocalStorage 2.0
.import QtQuick.LocalStorage 2.0 as LS
In the Alpha 1 / Qt4 no import was required.
3) As a result of 2) above, all local storage function calls need to qualified by the namespace "LocalStorage".
For example I have a settingsDB.js java file, which contains the "getDatabase" method.
In my debugDB.js script I can import this file as follows
.import "settingsDB.js" as SDB
This gives me access to the functions within settingsDB.js (e.g. the getDatabase). These are accessed qualified by the alias. e.g
Note that in debugDB.js I do not need an explicit import of QtQuickLocalStorage. That seems to be inherited by importing settingsDB.js, which has such an import statement.
The old style Qt.include("settingsDB.js") is still available, but behaves slightly differently.