mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-04 10:43:19 +00:00
first commit
This commit is contained in:
commit
3e7d8b4b70
43 changed files with 2681 additions and 0 deletions
55
src/qml/forms/TaskForm.qml
Normal file
55
src/qml/forms/TaskForm.qml
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Mirai. Copyright (C) 2024 Vyn
|
||||
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
|
||||
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
*/
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Mirai
|
||||
|
||||
ColumnLayout {
|
||||
id: form
|
||||
property var taskToEdit
|
||||
property int taskToEditIndex
|
||||
spacing: 6
|
||||
signal confirmed
|
||||
|
||||
onTaskToEditChanged: {
|
||||
newTodoContent.text = taskToEdit?.text ?? ""
|
||||
newTodoDate.text = taskToEdit?.date ?? ""
|
||||
}
|
||||
|
||||
AppText {
|
||||
text: "New task"
|
||||
}
|
||||
|
||||
AppLineEdit {
|
||||
id: newTodoContent
|
||||
Layout.fillWidth: true
|
||||
placeholderText: "Enter your new task..."
|
||||
text: taskToEdit?.text ?? ""
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
if (newTodoContent.text == "") {
|
||||
return
|
||||
}
|
||||
if (taskToEdit && taskToEditIndex !== undefined) {
|
||||
backend.updateTodo(taskToEditIndex, taskToEdit.state, newTodoContent.text, newTodoDate.text)
|
||||
} else {
|
||||
backend.addTodo(newTodoContent.text, newTodoDate.text)
|
||||
}
|
||||
form.confirmed()
|
||||
}
|
||||
}
|
||||
|
||||
DateField {
|
||||
id: newTodoDate
|
||||
text: taskToEdit?.date ?? ""
|
||||
textFieldComponent.placeholderText: "No date"
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue