Allow deletion of unscheduled tasks

This commit is contained in:
Vyn 2024-10-09 20:08:23 +02:00
parent 2aa039e5fc
commit 25aca40143
2 changed files with 12 additions and 3 deletions

View file

@ -105,6 +105,15 @@ void BaseSource::deleteTask(const TaskItem &taskToDelete)
} }
} }
} }
unscheduledTasks_.erase(
std::remove_if(
unscheduledTasks_.begin(), unscheduledTasks_.end(),
[&](const std::unique_ptr<TaskItem> &task) {
return task->id() == taskToDelete.id();
}
),
unscheduledTasks_.end()
);
} }
Event *BaseSource::getEventById(int eventId) Event *BaseSource::getEventById(int eventId)

View file

@ -66,7 +66,7 @@ export component MainView inherits Rectangle {
border-width: newTaskTitleInput.text != "" ? 4px : 0px; border-width: newTaskTitleInput.text != "" ? 4px : 0px;
border-radius: newTaskTitleInput.text != "" ? 8px : 0px; border-radius: newTaskTitleInput.text != "" ? 8px : 0px;
animate border-color, border-width { animate border-color, border-width {
duration: 500ms; duration: 250ms;
} }
VerticalLayout { VerticalLayout {
in-out property <int> task-or-event: 1; in-out property <int> task-or-event: 1;
@ -81,7 +81,7 @@ export component MainView inherits Rectangle {
opacity: newTaskTitleInput.text != "" ? 1 : 0; opacity: newTaskTitleInput.text != "" ? 1 : 0;
clip: true; clip: true;
animate max-height, opacity { animate max-height, opacity {
duration: 500ms; duration: 250ms;
} }
HorizontalLayout { HorizontalLayout {
@ -124,7 +124,7 @@ export component MainView inherits Rectangle {
} }
} }
newTaskTitleInput := VTextInput { newTaskTitleInput := VTextInput {
placeholder: "Add task"; placeholder: "Add new Task / Event";
accepted => { accepted => {
if (task-or-event == 1) { if (task-or-event == 1) {
Backend.createTask({ Backend.createTask({