def editNewTodo(self): """Sets the current todo to a newly created todo""" newTodo = QOrganizerTodo() newTodo.setPriority(QOrganizerItemPriority.HighPriority) newTodo.setStatus(QOrganizerTodoProgress.StatusNotStarted) currentDateTime = QDateTime(QDate.currentDate(), QTime.currentTime()) newTodo.setStartDateTime(currentDateTime) newTodo.setDueDateTime(currentDateTime.addSecs(60 * 60)) self._todo = newTodo self._todo.isNewTodo = True self.currentTodoChanged.emit()
def editNewTodo(self): """Sets the current todo to a newly created todo""" newTodo = QOrganizerTodo() newTodo.setPriority(QOrganizerItemPriority.HighPriority) newTodo.setStatus(QOrganizerTodoProgress.StatusNotStarted) currentDateTime = QDateTime(QDate.currentDate(), QTime.currentTime()) newTodo.setStartDateTime(currentDateTime) newTodo.setDueDateTime(currentDateTime.addSecs(60*60)) self._todo = newTodo self._todo.isNewTodo = True self.currentTodoChanged.emit()
def reload(self): self._todos = [] sortOrder = QOrganizerItemSortOrder() sortOrder.setDetailDefinitionName(QOrganizerTodoTime.DefinitionName, QOrganizerTodoTime.FieldDueDateTime) todoFilter = QOrganizerItemFilter() items = self.manager.items(todoFilter, [sortOrder]) todos = [] for item in items: if item.type() == QOrganizerItemType.TypeTodo: todo = QOrganizerTodo(item) display = todo.startDateTime().toString("yy/MM/dd hh:mm") +\ "-" + todo.dueDateTime().toString("yy/MM/dd hh:mm") +\ "\n" + todo.displayLabel() todos.append((display, todo)) self._todos = todos self.todosChanged.emit()