From 25aca40143901f8226098f8e6ad4918a351c5331 Mon Sep 17 00:00:00 2001 From: Vyn Date: Wed, 9 Oct 2024 20:08:23 +0200 Subject: [PATCH] Allow deletion of unscheduled tasks --- external/mirai-core/src/BaseSource.cpp | 9 +++++++++ ui/MainView.slint | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/external/mirai-core/src/BaseSource.cpp b/external/mirai-core/src/BaseSource.cpp index 6feae25..d6f82b2 100644 --- a/external/mirai-core/src/BaseSource.cpp +++ b/external/mirai-core/src/BaseSource.cpp @@ -105,6 +105,15 @@ void BaseSource::deleteTask(const TaskItem &taskToDelete) } } } + unscheduledTasks_.erase( + std::remove_if( + unscheduledTasks_.begin(), unscheduledTasks_.end(), + [&](const std::unique_ptr &task) { + return task->id() == taskToDelete.id(); + } + ), + unscheduledTasks_.end() + ); } Event *BaseSource::getEventById(int eventId) diff --git a/ui/MainView.slint b/ui/MainView.slint index 40c8ef8..8d5313f 100644 --- a/ui/MainView.slint +++ b/ui/MainView.slint @@ -66,7 +66,7 @@ export component MainView inherits Rectangle { border-width: newTaskTitleInput.text != "" ? 4px : 0px; border-radius: newTaskTitleInput.text != "" ? 8px : 0px; animate border-color, border-width { - duration: 500ms; + duration: 250ms; } VerticalLayout { in-out property task-or-event: 1; @@ -81,7 +81,7 @@ export component MainView inherits Rectangle { opacity: newTaskTitleInput.text != "" ? 1 : 0; clip: true; animate max-height, opacity { - duration: 500ms; + duration: 250ms; } HorizontalLayout { @@ -124,7 +124,7 @@ export component MainView inherits Rectangle { } } newTaskTitleInput := VTextInput { - placeholder: "Add task"; + placeholder: "Add new Task / Event"; accepted => { if (task-or-event == 1) { Backend.createTask({