316 |
316 |
317 @param o flag indicating the project status |
317 @param o flag indicating the project status |
318 """ |
318 """ |
319 self.projectOpen = o |
319 self.projectOpen = o |
320 |
320 |
321 def addTask(self, summary, priority=1, filename="", lineno=0, |
321 def addTask(self, summary, priority=TaskPriority.NORMAL, filename="", |
322 completed=False, _time=0, isProjectTask=False, |
322 lineno=0, completed=False, _time=0, isProjectTask=False, |
323 taskType=TaskType.TODO, description="", uid="", |
323 taskType=TaskType.TODO, description="", uid="", |
324 parentTask=None): |
324 parentTask=None): |
325 """ |
325 """ |
326 Public slot to add a task. |
326 Public slot to add a task. |
327 |
327 |
328 @param summary summary text of the task |
328 @param summary summary text of the task |
329 @type str |
329 @type str |
330 @param priority priority of the task (0=high, 1=normal, 2=low) |
330 @param priority priority of the task |
331 @type int |
331 @type TaskPriority |
332 @param filename filename containing the task |
332 @param filename filename containing the task |
333 @type str |
333 @type str |
334 @param lineno line number containing the task |
334 @param lineno line number containing the task |
335 @type int |
335 @type int |
336 @param completed flag indicating completion status |
336 @param completed flag indicating completion status |
491 """ |
491 """ |
492 Private slot to handle the "Properties" context menu entry. |
492 Private slot to handle the "Properties" context menu entry. |
493 """ |
493 """ |
494 from .TaskPropertiesDialog import TaskPropertiesDialog |
494 from .TaskPropertiesDialog import TaskPropertiesDialog |
495 task = self.currentItem() |
495 task = self.currentItem() |
496 dlg = TaskPropertiesDialog(task, self, self.projectOpen) |
496 dlg = TaskPropertiesDialog(task, parent=self, |
497 ro = task.getFilename() != "" |
497 projectOpen=self.projectOpen) |
498 if ro: |
498 if ( |
499 dlg.setReadOnly() |
499 dlg.exec() == QDialog.DialogCode.Accepted and |
500 if dlg.exec() == QDialog.DialogCode.Accepted and not ro: |
500 dlg.isManualTaskMode() |
501 summary, priority, completed, isProjectTask, description = ( |
501 ): |
502 dlg.getData() |
502 (summary, priority, taskType, completed, isProjectTask, |
503 ) |
503 description) = dlg.getData() |
504 task.setSummary(summary) |
504 task.setSummary(summary) |
505 task.setPriority(priority) |
505 task.setPriority(priority) |
|
506 task.setTaskType(taskType) |
506 task.setCompleted(completed) |
507 task.setCompleted(completed) |
507 task.setProjectTask(isProjectTask) |
508 task.setProjectTask(isProjectTask) |
508 task.setDescription(description) |
509 task.setDescription(description) |
509 self.__projectTasksSaveTimer.changeOccurred() |
510 self.__projectTasksSaveTimer.changeOccurred() |
510 |
511 |
511 def __newTask(self): |
512 def __newTask(self): |
512 """ |
513 """ |
513 Private slot to handle the "New Task" context menu entry. |
514 Private slot to handle the "New Task" context menu entry. |
514 """ |
515 """ |
515 from .TaskPropertiesDialog import TaskPropertiesDialog |
516 from .TaskPropertiesDialog import TaskPropertiesDialog |
516 dlg = TaskPropertiesDialog(None, self, self.projectOpen) |
517 dlg = TaskPropertiesDialog(None, parent=self, |
|
518 projectOpen=self.projectOpen) |
517 if dlg.exec() == QDialog.DialogCode.Accepted: |
519 if dlg.exec() == QDialog.DialogCode.Accepted: |
518 summary, priority, completed, isProjectTask, description = ( |
520 (summary, priority, taskType, completed, isProjectTask, |
519 dlg.getData() |
521 description) = dlg.getData() |
520 ) |
|
521 self.addTask(summary, priority, completed=completed, |
522 self.addTask(summary, priority, completed=completed, |
522 isProjectTask=isProjectTask, description=description) |
523 isProjectTask=isProjectTask, taskType=taskType, |
|
524 description=description) |
523 |
525 |
524 def __newSubTask(self): |
526 def __newSubTask(self): |
525 """ |
527 """ |
526 Private slot to handle the "New Sub-Task" context menu entry. |
528 Private slot to handle the "New Sub-Task" context menu entry. |
527 """ |
529 """ |
528 parentTask = self.currentItem() |
530 parentTask = self.currentItem() |
529 projectTask = parentTask.isProjectTask() |
531 projectTask = parentTask.isProjectTask() |
530 |
532 |
531 from .TaskPropertiesDialog import TaskPropertiesDialog |
533 from .TaskPropertiesDialog import TaskPropertiesDialog |
532 dlg = TaskPropertiesDialog(None, self, self.projectOpen) |
534 dlg = TaskPropertiesDialog(None, parent=self, |
|
535 projectOpen=self.projectOpen) |
533 dlg.setSubTaskMode(projectTask) |
536 dlg.setSubTaskMode(projectTask) |
534 if dlg.exec() == QDialog.DialogCode.Accepted: |
537 if dlg.exec() == QDialog.DialogCode.Accepted: |
535 summary, priority, completed, isProjectTask, description = ( |
538 (summary, priority, taskType, completed, isProjectTask, |
536 dlg.getData() |
539 description) = dlg.getData() |
537 ) |
|
538 self.addTask(summary, priority, completed=completed, |
540 self.addTask(summary, priority, completed=completed, |
539 isProjectTask=isProjectTask, description=description, |
541 isProjectTask=isProjectTask, taskType=taskType, |
540 parentTask=parentTask) |
542 description=description, parentTask=parentTask) |
541 |
543 |
542 def __markCompleted(self): |
544 def __markCompleted(self): |
543 """ |
545 """ |
544 Private slot to handle the "Mark Completed" context menu entry. |
546 Private slot to handle the "Mark Completed" context menu entry. |
545 """ |
547 """ |