Commit 406dc730 authored by Dimitris Kardarakos's avatar Dimitris Kardarakos

Provide a way to display sink enabled calendars

parent b30d2add
......@@ -19,7 +19,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.2
import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.4 as Kirigami
import QtQuick.Controls 2.4 as Controls2
import org.kde.phone.calindori 0.1 as Calindori
import "Utils.js" as Utils
......@@ -267,92 +267,35 @@ Kirigami.ApplicationWindow {
}
}
Kube.CheckedEntities {
id: calendarFilterCollector
}
Component {
id: accountSwitcher
Kirigami.Page {
Kube.ListView {
Kirigami.CardsListView {
id: listView
anchors.fill: parent
Layout.fillWidth: true
Layout.maximumHeight: Math.min(contentHeight, parent.height - Kube.Units.gridUnit)
Layout.preferredHeight: contentHeight
spacing: Kube.Units.smallSpacing
model: Kube.CheckableEntityModel {
model: Kube.EntityModel {
id: calendarModel
type: "calendar"
roles: ["name", "color", "enabled"]
roles: ["name", "color"]
sortRole: "name"
filter: {} //root.editMode ? {} : {enabled: true}
accountId: ""
checkedEntities: calendarFilterCollector
}
delegate: Kube.ListDelegate {
id: delegate
width: listView.availableWidth
height: Kube.Units.gridUnit
hoverEnabled: true
background: Item {}
RowLayout {
anchors.fill: parent
spacing: Kube.Units.smallSpacing
Kube.CheckBox {
id: checkBox
opacity: 0.9
visible: root.editMode
checked: model.checked || model.enabled
onCheckedChanged: {
model.checked = checked
model.enabled = checked
}
filter: {"enabled": true}
indicator: Rectangle {
width: Kube.Units.gridUnit * 0.8
height: Kube.Units.gridUnit * 0.8
color: model.color
Rectangle {
id: highlight
anchors.fill: parent
visible: checkBox.hovered || checkBox.visualFocus
color: Kube.Colors.highlightColor
opacity: 0.4
}
Kube.Icon {
anchors.centerIn: parent
height: Kube.Units.gridUnit
width: Kube.Units.gridUnit
visible: checkBox.checked
iconName: Kube.Icons.checkbox_inverted
}
}
}
Kube.Label {
id: label
Layout.fillWidth: true
text: model.name
color: Kube.Colors.highlightedTextColor
elide: Text.ElideLeft
clip: true
}
Rectangle {
visible: !root.editMode
width: Kube.Units.gridUnit * 0.8
height: Kube.Units.gridUnit * 0.8
radius: width / 2
color: model.color
onInitialItemsLoaded: {
if (currentIndex >= 0) {
root.selected(calendarModel.data(currentIndex).object)
}
}
}
delegate: Kirigami.Card {
contentItem: Controls2.Label {
wrapMode: Text.WordWrap
text: model.name
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment