Personal noctalia plugins collection

Task dialog: separate due date and time like event form

+20 -3
+20 -3
weekly-calendar/Panel.qml
··· 264 264 TextField { 265 265 id: createTaskDueDate 266 266 Layout.fillWidth: true 267 - placeholderText: "YYYY-MM-DD HH:MM" 267 + placeholderText: "YYYY-MM-DD" 268 + color: Color.mOnSurface 269 + background: Rectangle { color: Color.mSurfaceVariant; radius: Style.radiusS } 270 + } 271 + 272 + // Reuse existing label to avoid new translation key 273 + NText { text: pluginApi.tr("panel.start_time"); color: Color.mOnSurfaceVariant; font.pointSize: Style.fontSizeS } 274 + TextField { 275 + id: createTaskDueTime 276 + Layout.fillWidth: true 277 + placeholderText: "HH:MM" 268 278 color: Color.mOnSurface 269 279 background: Rectangle { color: Color.mSurfaceVariant; radius: Style.radiusS } 270 280 } ··· 351 361 var tlUid = tl?.uid || "" 352 362 var dueTs = 0 353 363 if (createTaskDueDate.text.trim() !== "") { 354 - var d = new Date(createTaskDueDate.text.trim()) 364 + var dateParts = createTaskDueDate.text.split("-") 365 + var timeParts = createTaskDueTime.text.split(":") 366 + var h = createTaskDueTime.text.trim() === "" ? 0 : parseInt(timeParts[0]) 367 + var m = createTaskDueTime.text.trim() === "" ? 0 : parseInt(timeParts[1] || "0") 368 + var d = new Date(parseInt(dateParts[0]), parseInt(dateParts[1]) - 1, parseInt(dateParts[2]), h, m, 0) 355 369 if (!isNaN(d.getTime())) dueTs = Math.floor(d.getTime() / 1000) 356 370 } 357 371 mainInstance?.createTodo(tlUid, createTaskSummary.text.trim(), ··· 438 452 icon: "clipboard-check"; tooltipText: pluginApi.tr("panel.add_task") 439 453 onClicked: { 440 454 createTaskSummary.text = "" 441 - createTaskDueDate.text = "" 455 + var now = new Date() 456 + var startH = now.getHours() + 1 457 + createTaskDueDate.text = now.getFullYear() + "-" + String(now.getMonth()+1).padStart(2,'0') + "-" + String(now.getDate()).padStart(2,'0') 458 + createTaskDueTime.text = String(startH).padStart(2,'0') + ":00" 442 459 createTaskDescription.text = "" 443 460 createTaskDialogColumn.selectedPriority = 0 444 461 showCreateTaskDialog = true