Retrieving a list of strings is seen as listmodel that can't be saved back

Bug #1483614 reported by Didier Roche on 2015-08-11
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
U1DB Qt/ QML
Undecided
Unassigned
u1db-qt (Ubuntu)
Undecided
Unassigned

Bug Description

If you push a document that contains property being a list of strings, like:

{
  'attachements': ["/path/to/foo1.png", "/path/to/foo2.png"]
}

Retrieving it is making the attachements a ListModel through the QML type system (outside of u1db's scope thus). The ListModel contains ObjectModel and it's useful to attach that to Repeater/Grid.

However, when we try to store those data back (from the same object), the ListModel/ObjectModel aren't storable in u1db, so we end up with:
{
  'attachments: [null, null]
}

So getting the object don't enable to save it back, we have to manually typecast it and create some json objects from it, which is quite ugly and cumbersome: https://github.com/didrocks/splitthebill/commit/9d1e72131f7a2842bea08b4e144895ef0a06f4d2#diff-63dd6639b235200e552147bf0a9003b8R59.

Any idea if u1db-qt can typecast it back to something that can be stored, or anything to make the developer's life easier?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers