void VSCPanel::UpdateTaskList() { /* Remove old task */ VTaskItemWidgetList::iterator it1 = m_pTaskWidget.begin(); for(; it1!=m_pTaskWidget.end(); ++it1) { ui.TaskLayout->removeWidget((*it1).second); delete (*it1).second; } m_pTaskWidget.clear(); /* Update the task list */ VTaskMgr::GetTaskList(m_pTaskList); VTaskItemList::iterator it = m_pTaskList.begin(); for(; it!=m_pTaskList.end(); ++it) { VSCPanelTaskItem *pItem = new VSCPanelTaskItem((*it).second, this); ui.TaskLayout->addWidget(pItem); m_pTaskWidget[(*it).second->GetId()] = pItem; connect(pItem, SIGNAL(TaskDeleted()), this, SLOT(UpdateTaskList())); } }
void VSCPanelTaskItem::DeleteTask() { VTaskMgr::DeleteTask(m_pTask); emit TaskDeleted(); }