~vthompson/ubuntu-reddit-app/ubuntu-reddit-app

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
import Ubuntu.Components 0.1
import "storage.js" as Storage

Switch {
    property string name: ""

    anchors.top: parent.top
    anchors.bottom: parent.bottom

    onCheckedChanged: Storage.setSetting(name, "" + checked)

    function loadValue () {
        checked = (Storage.getSetting(name) == "true") ? true : false
    }
}