tangled
alpha
login
or
join now
dzming.li
/
noctalia-plugins
0
fork
atom
Personal noctalia plugins collection
0
fork
atom
overview
issues
pulls
pipelines
Task dialog: separate due date and time like event form
Dzming Li
2 weeks ago
16a03318
c0167bc6
+20
-3
1 changed file
expand all
collapse all
unified
split
weekly-calendar
Panel.qml
+20
-3
weekly-calendar/Panel.qml
···
264
264
TextField {
265
265
id: createTaskDueDate
266
266
Layout.fillWidth: true
267
267
-
placeholderText: "YYYY-MM-DD HH:MM"
267
267
+
placeholderText: "YYYY-MM-DD"
268
268
+
color: Color.mOnSurface
269
269
+
background: Rectangle { color: Color.mSurfaceVariant; radius: Style.radiusS }
270
270
+
}
271
271
+
272
272
+
// Reuse existing label to avoid new translation key
273
273
+
NText { text: pluginApi.tr("panel.start_time"); color: Color.mOnSurfaceVariant; font.pointSize: Style.fontSizeS }
274
274
+
TextField {
275
275
+
id: createTaskDueTime
276
276
+
Layout.fillWidth: true
277
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
354
-
var d = new Date(createTaskDueDate.text.trim())
364
364
+
var dateParts = createTaskDueDate.text.split("-")
365
365
+
var timeParts = createTaskDueTime.text.split(":")
366
366
+
var h = createTaskDueTime.text.trim() === "" ? 0 : parseInt(timeParts[0])
367
367
+
var m = createTaskDueTime.text.trim() === "" ? 0 : parseInt(timeParts[1] || "0")
368
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
441
-
createTaskDueDate.text = ""
455
455
+
var now = new Date()
456
456
+
var startH = now.getHours() + 1
457
457
+
createTaskDueDate.text = now.getFullYear() + "-" + String(now.getMonth()+1).padStart(2,'0') + "-" + String(now.getDate()).padStart(2,'0')
458
458
+
createTaskDueTime.text = String(startH).padStart(2,'0') + ":00"
442
459
createTaskDescription.text = ""
443
460
createTaskDialogColumn.selectedPriority = 0
444
461
showCreateTaskDialog = true