From cea2ea5c366ad621d8c5d9da9b2131ef1729ce61 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 11 May 2016 15:47:01 +0200 Subject: Select the last added account --- components/package/contents/ui/Settings.qml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'components/package') diff --git a/components/package/contents/ui/Settings.qml b/components/package/contents/ui/Settings.qml index ecea592c..a20078dc 100644 --- a/components/package/contents/ui/Settings.qml +++ b/components/package/contents/ui/Settings.qml @@ -82,26 +82,34 @@ Rectangle { currentIndex: -1 - delegate: Kirigami.AbstractListItem { + onCountChanged: { + listView.currentIndex = count - 1 + } + delegate: Kirigami.AbstractListItem { enabled: true supportsMouseEvents: true checked: listView.currentIndex == index + onCheckedChanged: { + if (checked) { + console.warn("Current index changed ", accountFactory.accountId); + accountDetails.source = accountFactory.uiPath + accountDetails.item.accountId = accountFactory.accountId + accountDetails.item.icon = accountFactory.icon + accountDetails.item.accountName = accountFactory.name + } + } + onClicked: { - console.warn("Loading module is ", accountFactory.accountId); - accountDetails.source = accountFactory.uiPath - accountDetails.item.accountId = accountFactory.accountId - accountDetails.item.icon = accountFactory.icon - accountDetails.item.accountName = accountFactory.name listView.currentIndex = model.index } contentItem: RowLayout { KubeFramework.AccountFactory { - id: accountFactory - accountId: model.accountId + id: accountFactory + accountId: model.accountId } Kirigami.Icon { -- cgit v1.2.3