From 303248a7da2e671f69aa1a7308a1625492c3459b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 5 Jan 2017 11:05:40 +0100 Subject: Filter folders by account --- components/mail/contents/ui/main.qml | 2 ++ components/package/contents/ui/AccountSwitcher.qml | 17 ++++++++++++++++- components/package/contents/ui/FolderListView.qml | 5 ++++- 3 files changed, 22 insertions(+), 2 deletions(-) (limited to 'components') diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml index 5fe8581f..252cac5b 100644 --- a/components/mail/contents/ui/main.qml +++ b/components/mail/contents/ui/main.qml @@ -138,6 +138,7 @@ Controls2.ApplicationWindow { Layout.maximumWidth: app.width * 0.25 Layout.minimumWidth: Kirigami.Units.gridUnit * 5 focus: true + accountId: accountSwitcher.accountId } KubeComponents.MailListView { @@ -181,6 +182,7 @@ Controls2.ApplicationWindow { width: folderListView.width - 5 //to adjust for the toolbar spacing KubeComponents.AccountSwitcher { + id: accountSwitcher } } //END Folderlist section diff --git a/components/package/contents/ui/AccountSwitcher.qml b/components/package/contents/ui/AccountSwitcher.qml index e9e9b549..6c899c50 100644 --- a/components/package/contents/ui/AccountSwitcher.qml +++ b/components/package/contents/ui/AccountSwitcher.qml @@ -19,6 +19,7 @@ import QtQuick 2.4 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 as Controls2 +import QtQml 2.2 as QtQml import org.kde.kirigami 1.0 as Kirigami @@ -28,6 +29,8 @@ import org.kube.components 1.0 as KubeComponents Controls2.Button { id: accountSwitcher + property variant accountId + KubeFramework.FolderController { id: folderController } @@ -130,10 +133,22 @@ Controls2.Button { enabled: true supportsMouseEvents: true - contentItem: Item { + checked: listView.currentIndex == index + onClicked: { + listView.currentIndex = model.index + popup.close() + } + Item { height: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing * 1 width: listView.width + QtQml.Binding { + target: accountSwitcher + property: "accountId" + when: listView.currentIndex == index + value: model.accountId + } + RowLayout { anchors { verticalCenter: parent.verticalCenter diff --git a/components/package/contents/ui/FolderListView.qml b/components/package/contents/ui/FolderListView.qml index f90a0711..6646d88f 100644 --- a/components/package/contents/ui/FolderListView.qml +++ b/components/package/contents/ui/FolderListView.qml @@ -49,7 +49,10 @@ Rectangle { role: "name" } - model: KubeFramework.FolderListModel { id: folderListModel} //; accountId: wrapper.accountId } + model: KubeFramework.FolderListModel { + id: folderListModel + accountId: root.accountId + } onCurrentIndexChanged: { model.fetchMore(currentIndex) -- cgit v1.2.3