On Mon, May 20, 2013 at 8:17 AM, Dave Hylands <[email protected]> wrote:
>> And I also think we should enable applications to let users choose
>> where a given picture should be shown, while by default selecting the
>> one the user had picked through settings. I think the only thing we
>> need to enable this is to have a boolean DeviceStorage.default
>> property.
>
> There is nothing to stop an app from prompting the user where to store a 
> file. There are 3 ways that an app could choose to store a file:
>
> 1 - Using the composite storage area, you could do:
> storage.addNamed('/storageName/filename', blob);
> and blob will be storerd on the real storage area with the name give by 
> storageName.
>
> 2 - Using the composite storage area, you could do:
> storage.addNamed('filename', blob);
> and blob will be stored on the real storage area indicated by the user (in 
> the settings app) as the default place to store new files.
>
> 3 - Using a real storage area (obtainable via getDeviceStorages), you could 
> do:
> storage.addNamed('filename', blob);
> and blob will be stored on that storage area.

Yup. Understood.

But what you can't do, as far as I can tell, is to create a UI which
lets the user choose which location to store a file. While also
selecting by default the storage area that the user has chosen as the
default.

What you can do, is to list all available store areas, and then in
addition to that have an option which says "default" without showing
the user any indication of where the file will be stored if "default"
is chosen.

I would think that in a good UI you'd want to just list the available
storage areas, without a separate "default" option. And by default
select the area which the user has previously indicated should be the
default. That way the user can see where the file will be stored if no
action is taken, and he/she can take action to store the file
elsewhere if desired.

I guess you could accomplish that with the current API by writing a
dummy-file to the composite storage and see where that file will get
saved. But that seems pretty hacky and could result in security
dialogs being displayed to the user.

I think a better solution would be to simply add a .default property
to DeviceStorage which is set to true for the default area, and false
for all other ones.

/ Jonas
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to