diff options
Diffstat (limited to 'views/calendar/qml/WeekView.qml')
-rw-r--r-- | views/calendar/qml/WeekView.qml | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/views/calendar/qml/WeekView.qml b/views/calendar/qml/WeekView.qml index 08a15ccf..781aefa5 100644 --- a/views/calendar/qml/WeekView.qml +++ b/views/calendar/qml/WeekView.qml | |||
@@ -28,6 +28,25 @@ FocusScope { | |||
28 | 28 | ||
29 | property var dayWidth: (root.width - Kube.Units.gridUnit - Kube.Units.largeSpacing * 2) / 7 | 29 | property var dayWidth: (root.width - Kube.Units.gridUnit - Kube.Units.largeSpacing * 2) / 7 |
30 | property var hourHeight: Kube.Units.gridUnit * 2 | 30 | property var hourHeight: Kube.Units.gridUnit * 2 |
31 | property date currentDate | ||
32 | |||
33 | function getMonday(date) { | ||
34 | var year = date.getFullYear() | ||
35 | var month = date.getMonth() | ||
36 | //Jup, getDate returns the day of the month | ||
37 | var day = date.getDate() | ||
38 | |||
39 | while (true) { | ||
40 | if (date.getDay() === Locale.Monday) { | ||
41 | return date | ||
42 | } | ||
43 | day = day - 1 | ||
44 | date = new Date(year, month, day) | ||
45 | } | ||
46 | return date | ||
47 | } | ||
48 | |||
49 | property date startDate: getMonday(currentDate) | ||
31 | 50 | ||
32 | Item { | 51 | Item { |
33 | anchors { | 52 | anchors { |
@@ -167,7 +186,10 @@ FocusScope { | |||
167 | //END time labels | 186 | //END time labels |
168 | 187 | ||
169 | Repeater { | 188 | Repeater { |
170 | model: WeekEvents{} | 189 | model: WeekEvents { |
190 | start: root.startDate | ||
191 | length: 7 | ||
192 | } | ||
171 | delegate: Rectangle { | 193 | delegate: Rectangle { |
172 | id: day | 194 | id: day |
173 | 195 | ||
@@ -219,7 +241,7 @@ FocusScope { | |||
219 | rightMargin: Kube.Units.smallSpacing | 241 | rightMargin: Kube.Units.smallSpacing |
220 | } | 242 | } |
221 | width: root.dayWidth - Kube.Units.smallSpacing * 2 - Kube.Units.gridUnit * model.modelData.indention | 243 | width: root.dayWidth - Kube.Units.smallSpacing * 2 - Kube.Units.gridUnit * model.modelData.indention |
222 | height: root.hourHeight * model.modelData.duration | 244 | height: Math.max(root.hourHeight * 0.5, root.hourHeight * model.modelData.duration) |
223 | y: root.hourHeight * model.modelData.starts | 245 | y: root.hourHeight * model.modelData.starts |
224 | x: Kube.Units.gridUnit * model.modelData.indention | 246 | x: Kube.Units.gridUnit * model.modelData.indention |
225 | 247 | ||