Warning, /network/kaccounts-integration/example/accounts.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.3
0002 import QtQuick.Controls 2.15
0003 import QtQuick.Layouts 1.1
0004 import Ubuntu.OnlineAccounts 0.1 as OA
0005 import org.kde.kaccounts 1.2
0006 
0007 ApplicationWindow
0008 {
0009     StackView {
0010         id: stack
0011         anchors.fill: parent
0012 
0013         initialItem: ListView {
0014             Layout.fillWidth: true
0015             Layout.fillHeight: true
0016 
0017             header: Label {
0018                 font.pointSize: 20
0019                 text: "Accounts"
0020             }
0021             footer:  Button {
0022                 text: "Add new Account"
0023                 onClicked: stack.push(addProviderComponent)
0024             }
0025 
0026             model: OA.AccountServiceModel {
0027                 id: accountsModel
0028                 service: "global"
0029                 includeDisabled: true
0030             }
0031 
0032             delegate: Label {
0033                 text: displayName
0034             }
0035         }
0036     }
0037 
0038     Component {
0039         id: addProviderComponent
0040         ListView {
0041             Layout.fillWidth: true
0042             Layout.fillHeight: true
0043 
0044             header: Label {
0045                 anchors.horizontalCenter: parent.horizontalCenter
0046                 font.pointSize: 20
0047                 text: "Available Accounts"
0048             }
0049 
0050             model: OA.ProviderModel {}
0051             delegate: Button {
0052                 anchors.horizontalCenter: parent.horizontalCenter
0053                 text: displayName
0054 
0055                 Component {
0056                     id: jobComponent
0057                     CreateAccountJob {}
0058                 }
0059 
0060                 onClicked: {
0061                     var job = jobComponent.createObject(stack, { providerName: providerId})
0062                     job.start()
0063                 }
0064             }
0065         }
0066     }
0067 }