← Back to team overview

ubuntu-phone team mailing list archive

Re: SDK Team status update - 05.08

 

On 06.08.2014 01:53, Alejandro J. Cura wrote:
> On Tue, Aug 5, 2014 at 8:02 PM, Alex Chiang <achiang@xxxxxxxxxxxxx> wrote:
>> On Tue, Aug 5, 2014 at 11:10 AM, Zoltán Balogh
>> <zoltan.balogh@xxxxxxxxxxxxx> wrote:
>>> Hi all,
>>>
>>> Exciting news from the SDK Lab!
>>>
>>> If you like it short just read this ->
>>>
>>> UI ToolKit:
>>> 1) We have a decision to go with the Qt.Labs Settings API,  the QML API will
>>> be released on the image and in the click chroots soon
>> Hopefully docs will be updated too. If you attempt to use this module
>> in an app today, it will attempt to store the app's config in:
>>
>> ~/.config/qt-labs.org/applicationName.conf
>>
>> (as observed on 14.10 desktop)
>>
>> Of course, this is not allowed on the phone due to AppArmor confinement.
>>
>> The documentation here:
>> http://qt-project.org/doc/qt-5/qsettings.html#platform-specific-notes
>>
>> makes it seem like we should be hitting case #2 for Unix:
>> $HOME/.config/MySoft.conf
>>
>> but that is not what I observe.
>>
>> Additionally, I can't seem to set my app's organization either, to try
>> and make it hit case #1:
>>
>> Qt.application.organization: "com.canonical.achiang"
>>
>> But then I see an error on the console:
>>
>> Non-existent attached object
>>
>> Finally, in general, it would be nice if the SDK provided some way for
>> Ubuntu apps to work better with AppArmor settings. As per:
>>
>> http://developer.ubuntu.com/publish/apps/security-policy-for-click-packages/
>>
>> ---
>> The application will have read/write access files in the standard XDG
>> base directories. Specifically:
>>
>> XDG_CACHE_HOME/<APP_PKGNAME>
>> XDG_CONFIG_HOME/<APP_PKGNAME>
>> XDG_DATA_HOME/<APP_PKGNAME>
>> XDG_RUNTIME_DIR/confined/<APP_PKGNAME>
>> ---
>>
>> However, reading environment variables from QML is prohibitively hard
>> (requires a C++ plugin). It would be better if the SDK provided
>> helpers for those specific variables so apps don't have to write a
>> plugin just to read those variables.
>>
> I find it weird that this would need to be done by manually reading
> env vars, and that Qt.Labs.Settings is not using
> QStandardPaths::ConfigLocation, which already takes XDG_* env vars
> into account.
> Perhaps it's a missing feature there?
>
> cheers,
I'm a very practical person. Just try this (example attached):

env APP_ID=uitk XDG_CONFIG_HOME=/tmp qmlscene settings.qml

Et voilá the settings go where you expect them.

For the same reason there's no issue with apparmor.

ciao,
    Christian
import QtQuick.Window 2.1
import Qt.labs.settings 1.0

Window {
    id: window

    width: 800
    height: 600

    Settings {
        property alias x: window.x
        property alias y: window.y
        property alias width: window.width
        property alias height: window.height
    }
}

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References