Commit a78d3084 authored by Dimitris Kardarakos's avatar Dimitris Kardarakos

Merge branch 'refresh' into 'master'

Simplify model update

See merge request dkardarakos/calindori!10
parents 026c972a f78cc40f
Pipeline #1234 passed with stage
in 4 minutes and 57 seconds
......@@ -44,6 +44,8 @@ Kirigami.ApplicationWindow {
*/
signal refreshNeeded;
onRefreshNeeded: todosView.refreshNeeded()
Component {
id: calendarDashboardComponent
......@@ -77,7 +79,7 @@ Kirigami.ApplicationWindow {
onTriggered: {
if(localCalendar.todosCount( calendarMonthView.selectedDate) > 0) {
root.pageStack.push(todosViewComponent, { todoDt: calendarMonthView.selectedDate });
root.pageStack.push(todosView, { todoDt: calendarMonthView.selectedDate });
}
else {
showPassiveNotification (i18n("There is no task for the day selected"));
......@@ -118,25 +120,14 @@ Kirigami.ApplicationWindow {
}
}
Component {
id: todosViewComponent
TodosView {
TodosView {
id: todosView
id: todosView
calendar: localCalendar
onEditTask: root.pageStack.push(todoPage, { startdt: modelData.dtstart, uid: modelData.uid, todoData: modelData })
onTaskDeleted: root.refreshNeeded()
Connections {
target: root
onRefreshNeeded: todosView.refreshNeeded()
}
}
calendar: localCalendar
onEditTask: root.pageStack.push(todoPage, { startdt: modelData.dtstart, uid: modelData.uid, todoData: modelData })
onTaskDeleted: root.refreshNeeded()
}
Component {
......
......@@ -33,31 +33,19 @@ Kirigami.Page {
signal taskDeleted
signal refreshNeeded
function reloadModel() {
cardsListview.model.reloadTasks();
}
function setModel() {
var todosModelObj = todosModelComponent.createObject(root, {"filterdt": root.todoDt, "memorycalendar": root.calendar.memorycalendar });
cardsListview.model = todosModelObj;
cardsListview.model.reloadTasks();
}
onTodoDtChanged: setModel()
onRefreshNeeded: reloadModel()
onRefreshNeeded: cardsListview.model.reloadTasks()
title: qsTr("Tasks")
Component {
id: todosModelComponent
Calindori.TodosModel {}
}
Kirigami.CardsListView {
id: cardsListview
anchors.fill: parent
model: Calindori.TodosModel {
filterdt: root.todoDt
memorycalendar: root.calendar.memorycalendar
}
delegate: Kirigami.Card {
banner.title: model.summary
banner.titleLevel: 3
......
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