613 index = self.indexOfTopLevelItem(task) |
613 index = self.indexOfTopLevelItem(task) |
614 self.takeTopLevelItem(index) |
614 self.takeTopLevelItem(index) |
615 self.tasks.remove(task) |
615 self.tasks.remove(task) |
616 del task |
616 del task |
617 |
617 |
618 def clearFileTasks(self, filename): |
618 def clearFileTasks(self, filename, conditionally=False): |
619 """ |
619 """ |
620 Public slot to clear all tasks related to a file. |
620 Public slot to clear all tasks related to a file. |
621 |
621 |
622 @param filename name of the file (string) |
622 @param filename name of the file (string) |
623 """ |
623 @param conditionally flag indicating to clear the tasks of the file |
|
624 checking some conditions (boolean) |
|
625 """ |
|
626 if conditionally: |
|
627 if self.project and self.project.isProjectSource(filename): |
|
628 # project related tasks will not be cleared |
|
629 return |
|
630 if not Preferences.getTasks("ClearOnFileClose"): |
|
631 return |
624 for task in self.tasks[:]: |
632 for task in self.tasks[:]: |
625 if task.getFilename() == filename: |
633 if task.getFilename() == filename: |
626 if self.copyTask == task: |
634 if self.copyTask == task: |
627 self.copyTask = None |
635 self.copyTask = None |
628 index = self.indexOfTopLevelItem(task) |
636 index = self.indexOfTopLevelItem(task) |