Fix date missing when editing task

This commit is contained in:
Vyn 2025-07-04 10:14:25 +02:00
parent 62d90f26d3
commit 048d835bd6
Signed by: vyn
GPG key ID: E1B2BE34E7A971E7
2 changed files with 6 additions and 0 deletions

View file

@ -125,6 +125,10 @@ void app_logic::setup_callbacks()
auto task = source->get_task_by_id(taskId); auto task = source->get_task_by_id(taskId);
assert(task); assert(task);
task->set_checked(!task->checked()); task->set_checked(!task->checked());
if (!task->has_due_date()) {
auto today = mirai::date(std::chrono::system_clock::now());
task->set_date(today);
}
_mirai_core->save(); _mirai_core->save();
update_views(); update_views();
}); });
@ -186,6 +190,7 @@ void app_logic::setup_callbacks()
const mirai::date &date = slint_date_to_mirai_date(newTaskData.date); const mirai::date &date = slint_date_to_mirai_date(newTaskData.date);
// const auto dayOpt = source->get_day_by_date(date); // const auto dayOpt = source->get_day_by_date(date);
task->set_title(std::string(newTaskData.title)); task->set_title(std::string(newTaskData.title));
task->set_date(slint_date_to_mirai_date(newTaskData.date));
_mirai_core->save(); _mirai_core->save();
update_views(); update_views();

View file

@ -113,6 +113,7 @@ export component MainView inherits Rectangle {
padding-bottom: 8px; padding-bottom: 8px;
TaskLine { TaskLine {
title: task.title; title: task.title;
date: day.due-date;
checked: task.checked; checked: task.checked;
allow-edit-date: true; allow-edit-date: true;
delete => { delete => {