1import QtQuick 2.3 2import QtQuick.Controls 1.2 3import QtQuick.Layouts 1.1 4import Ubuntu.OnlineAccounts 0.1 as OA 5import org.kde.kaccounts 1.0 6 7ApplicationWindow 8{ 9 StackView { 10 id: stack 11 anchors.fill: parent 12 13 initialItem: ListView { 14 Layout.fillWidth: true 15 Layout.fillHeight: true 16 17 header: Label { 18 font.pointSize: 20 19 text: "Accounts" 20 } 21 footer: Button { 22 text: "Add new Account" 23 onClicked: stack.push(addProviderComponent) 24 } 25 26 model: OA.AccountServiceModel { 27 id: accountsModel 28 service: "global" 29 includeDisabled: true 30 } 31 32 delegate: Label { 33 text: displayName 34 } 35 } 36 } 37 38 Component { 39 id: addProviderComponent 40 ListView { 41 Layout.fillWidth: true 42 Layout.fillHeight: true 43 44 header: Label { 45 anchors.horizontalCenter: parent.horizontalCenter 46 font.pointSize: 20 47 text: "Available Accounts" 48 } 49 50 model: OA.ProviderModel {} 51 delegate: Button { 52 anchors.horizontalCenter: parent.horizontalCenter 53 text: displayName 54 55 Component { 56 id: jobComponent 57 CreateAccountJob {} 58 } 59 60 onClicked: { 61 var job = jobComponent.createObject(stack, { providerName: providerId}) 62 job.start() 63 } 64 } 65 } 66 } 67} 68