diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-08-19 11:21:29 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-08-19 11:21:29 +0200 |
commit | 6352986e31c77964a82714c18adbfb88833840b3 (patch) | |
tree | 9f7a86b19643886a6a4dc0bf8e4ad66a9451c421 | |
parent | df5b77a16aedbadf801a1d1eaab48f62af81fce3 (diff) | |
download | kube-6352986e31c77964a82714c18adbfb88833840b3.tar.gz kube-6352986e31c77964a82714c18adbfb88833840b3.zip |
ListView for calendars so we can deal with many calendars
-rw-r--r-- | views/calendar/main.qml | 84 | ||||
-rw-r--r-- | views/calendar/qml/View.qml | 112 |
2 files changed, 142 insertions, 54 deletions
diff --git a/views/calendar/main.qml b/views/calendar/main.qml index bf7179b7..11eff6c8 100644 --- a/views/calendar/main.qml +++ b/views/calendar/main.qml | |||
@@ -142,6 +142,90 @@ ApplicationWindow { | |||
142 | resource: "caldavresource", | 142 | resource: "caldavresource", |
143 | name: "Test Calendar2", | 143 | name: "Test Calendar2", |
144 | color: "#f67400" | 144 | color: "#f67400" |
145 | }, | ||
146 | { | ||
147 | id: "calendar3", | ||
148 | resource: "caldavresource", | ||
149 | name: "Test Calendar3 Loooooooooooooooooooooooooooooong Name", | ||
150 | color: "#f67400" | ||
151 | }, | ||
152 | { | ||
153 | id: "calendar4", | ||
154 | resource: "caldavresource", | ||
155 | name: "Test Calendar4", | ||
156 | color: "#f67400" | ||
157 | }, | ||
158 | { | ||
159 | id: "calendar5", | ||
160 | resource: "caldavresource", | ||
161 | name: "Test Calendar5", | ||
162 | color: "#f67400" | ||
163 | }, | ||
164 | { | ||
165 | id: "calendar6", | ||
166 | resource: "caldavresource", | ||
167 | name: "Test Calendar6", | ||
168 | color: "#f67400" | ||
169 | }, | ||
170 | { | ||
171 | id: "calendar7", | ||
172 | resource: "caldavresource", | ||
173 | name: "Test Calendar7", | ||
174 | color: "#f67400" | ||
175 | }, | ||
176 | { | ||
177 | id: "calendar8", | ||
178 | resource: "caldavresource", | ||
179 | name: "Test Calendar8", | ||
180 | color: "#f67400" | ||
181 | }, | ||
182 | { | ||
183 | id: "calendar9", | ||
184 | resource: "caldavresource", | ||
185 | name: "Test Calendar9", | ||
186 | color: "#f67400" | ||
187 | }, | ||
188 | { | ||
189 | id: "calendar10", | ||
190 | resource: "caldavresource", | ||
191 | name: "Test Calendar 10", | ||
192 | color: "#f67400" | ||
193 | }, | ||
194 | { | ||
195 | id: "calendar11", | ||
196 | resource: "caldavresource", | ||
197 | name: "Test Calendar11", | ||
198 | color: "#f67400" | ||
199 | }, | ||
200 | { | ||
201 | id: "calendar12", | ||
202 | resource: "caldavresource", | ||
203 | name: "Test Calendar12", | ||
204 | color: "#f67400" | ||
205 | }, | ||
206 | { | ||
207 | id: "calendar13", | ||
208 | resource: "caldavresource", | ||
209 | name: "Test Calendar13", | ||
210 | color: "#f67400" | ||
211 | }, | ||
212 | { | ||
213 | id: "calendar14", | ||
214 | resource: "caldavresource", | ||
215 | name: "Test Calendar14", | ||
216 | color: "#f67400" | ||
217 | }, | ||
218 | { | ||
219 | id: "calendar15", | ||
220 | resource: "caldavresource", | ||
221 | name: "Test Calendar15", | ||
222 | color: "#f67400" | ||
223 | }, | ||
224 | { | ||
225 | id: "calendar16", | ||
226 | resource: "caldavresource", | ||
227 | name: "Test Calendar16", | ||
228 | color: "#f67400" | ||
145 | }], | 229 | }], |
146 | } | 230 | } |
147 | TestStore.setup(initialState) | 231 | TestStore.setup(initialState) |
diff --git a/views/calendar/qml/View.qml b/views/calendar/qml/View.qml index 0ef87e65..3aa1398d 100644 --- a/views/calendar/qml/View.qml +++ b/views/calendar/qml/View.qml | |||
@@ -59,48 +59,52 @@ RowLayout { | |||
59 | } | 59 | } |
60 | 60 | ||
61 | Rectangle { | 61 | Rectangle { |
62 | anchors { | ||
63 | top: parent.top | ||
64 | bottom: parent.bottom | ||
65 | } | ||
62 | width: Kube.Units.gridUnit * 10 | 66 | width: Kube.Units.gridUnit * 10 |
63 | Layout.fillHeight: parent.height | ||
64 | color: Kube.Colors.darkBackgroundColor | 67 | color: Kube.Colors.darkBackgroundColor |
65 | 68 | ||
66 | Kube.PositiveButton { | 69 | Column { |
67 | id: newEventButton | 70 | id: topLayout |
68 | objectName: "newEventButton" | ||
69 | |||
70 | anchors { | 71 | anchors { |
71 | top: parent.top | 72 | top: parent.top |
72 | left: parent.left | 73 | left: parent.left |
73 | right: parent.right | 74 | right: parent.right |
74 | margins: Kube.Units.largeSpacing | 75 | margins: Kube.Units.largeSpacing |
75 | } | 76 | } |
76 | focus: true | 77 | Kube.PositiveButton { |
77 | text: qsTr("New Event") | 78 | id: newEventButton |
78 | onClicked: {} | 79 | objectName: "newEventButton" |
79 | } | ||
80 | 80 | ||
81 | Column { | 81 | anchors { |
82 | anchors { | 82 | left: parent.left |
83 | top: newEventButton.bottom | 83 | right: parent.right |
84 | left: newEventButton.left | 84 | } |
85 | topMargin: Kube.Units.largeSpacing | 85 | focus: true |
86 | text: qsTr("New Event") | ||
87 | onClicked: {} | ||
86 | } | 88 | } |
87 | |||
88 | width: parent.width | ||
89 | spacing: Kube.Units.smallSpacing | ||
90 | |||
91 | DateView { | 89 | DateView { |
90 | anchors { | ||
91 | left: parent.left | ||
92 | right: parent.right | ||
93 | } | ||
92 | date: root.currentDate | 94 | date: root.currentDate |
93 | } | 95 | } |
94 | |||
95 | } | 96 | } |
96 | 97 | ||
97 | ColumnLayout { | 98 | ColumnLayout { |
99 | //Grow from the button but don't go over topLayout | ||
98 | anchors { | 100 | anchors { |
99 | bottom: parent.bottom | 101 | bottom: parent.bottom |
100 | left: newEventButton.left | 102 | left: topLayout.left |
101 | right: parent.right | 103 | right: parent.right |
102 | bottomMargin: Kube.Units.largeSpacing | 104 | bottomMargin: Kube.Units.largeSpacing |
105 | rightMargin: Kube.Units.largeSpacing | ||
103 | } | 106 | } |
107 | height: Math.min(implicitHeight, parent.height - (topLayout.y + topLayout.height) - Kube.Units.largeSpacing) | ||
104 | 108 | ||
105 | spacing: Kube.Units.largeSpacing | 109 | spacing: Kube.Units.largeSpacing |
106 | 110 | ||
@@ -109,7 +113,6 @@ RowLayout { | |||
109 | anchors { | 113 | anchors { |
110 | left: parent.left | 114 | left: parent.left |
111 | right: parent.right | 115 | right: parent.right |
112 | rightMargin: Kube.Units.largeSpacing | ||
113 | } | 116 | } |
114 | selectedDate: root.selectedDate | 117 | selectedDate: root.selectedDate |
115 | onSelectedDateChanged: { | 118 | onSelectedDateChanged: { |
@@ -118,44 +121,45 @@ RowLayout { | |||
118 | } | 121 | } |
119 | } | 122 | } |
120 | 123 | ||
121 | Column { | 124 | Kube.ListView { |
125 | Layout.fillHeight: true | ||
126 | Layout.preferredHeight: contentHeight | ||
127 | Layout.minimumHeight: Kube.Units.gridUnit | ||
122 | anchors { | 128 | anchors { |
123 | left: parent.left | 129 | left: parent.left |
124 | right: parent.right | 130 | right: parent.right |
125 | } | 131 | } |
126 | spacing: Kube.Units.smallSpacing | 132 | spacing: Kube.Units.smallSpacing |
127 | Repeater { | 133 | model: Kube.CheckableEntityModel { |
128 | model: Kube.CheckableEntityModel { | 134 | id: calendarModel |
129 | id: calendarModel | 135 | type: "calendar" |
130 | type: "calendar" | 136 | roles: ["name", "color"] |
131 | roles: ["name", "color"] | 137 | } |
132 | } | 138 | delegate: Item { |
133 | delegate: Item { | 139 | width: parent.width |
134 | width: parent.width - Kube.Units.largeSpacing | 140 | height: Kube.Units.gridUnit |
135 | height: Kube.Units.gridUnit | 141 | RowLayout { |
136 | RowLayout { | 142 | anchors.fill: parent |
137 | anchors.fill: parent | 143 | spacing: Kube.Units.smallSpacing |
138 | spacing: Kube.Units.smallSpacing | 144 | Kube.CheckBox { |
139 | Kube.CheckBox { | 145 | opacity: 0.9 |
140 | opacity: 0.9 | 146 | checked: !model.checked |
141 | checked: !model.checked | 147 | onToggled: model.checked = !checked |
142 | onToggled: model.checked = !checked | 148 | } |
143 | } | 149 | Kube.Label { |
144 | Kube.Label { | 150 | Layout.fillWidth: true |
145 | Layout.fillWidth: true | 151 | text: model.name |
146 | text: model.name | 152 | color: Kube.Colors.highlightedTextColor |
147 | color: Kube.Colors.highlightedTextColor | 153 | elide: Text.ElideRight |
148 | elide: Text.ElideRight | 154 | clip: true |
149 | clip: true | 155 | } |
150 | } | 156 | Rectangle { |
151 | Rectangle { | 157 | anchors.verticalCenter: parent.verticalCenter |
152 | anchors.verticalCenter: parent.verticalCenter | 158 | width: Kube.Units.gridUnit |
153 | width: Kube.Units.gridUnit | 159 | height: width |
154 | height: width | 160 | radius: width / 2 |
155 | radius: width / 2 | 161 | color: model.color |
156 | color: model.color | 162 | opacity: 0.9 |
157 | opacity: 0.9 | ||
158 | } | ||
159 | } | 163 | } |
160 | } | 164 | } |
161 | } | 165 | } |