summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/messagehandler.cc5
-rw-r--r--src/taskmanager.cc14
-rw-r--r--src/taskmanager.h6
3 files changed, 9 insertions, 16 deletions
diff --git a/src/messagehandler.cc b/src/messagehandler.cc
index 0d2dd3c..16fe043 100644
--- a/src/messagehandler.cc
+++ b/src/messagehandler.cc
@@ -47,9 +47,8 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) {
case cmd::create:
{
INFO(messagehandler, "Handling create command\n");
- task_t t = task_manager.createTask();
try {
- m.nodes = task_manager.addTask(t, m.create.parentid);
+ m.nodes = task_manager.createTask(m.create.parentid);
outmsgs.push_back(m);
}
catch (std::exception& e) {
@@ -62,7 +61,7 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) {
{
INFO(messagehandler, "Handling remove command\n");
try {
- m.nodes = task_manager.deleteTask(m.remove.id);
+ m.nodes = task_manager.removeTask(m.remove.id);
outmsgs.push_back(m);
}
catch (std::exception& e) {
diff --git a/src/taskmanager.cc b/src/taskmanager.cc
index f49875a..2526341 100644
--- a/src/taskmanager.cc
+++ b/src/taskmanager.cc
@@ -72,14 +72,6 @@ taskid_t TaskManager::createId() {
return idCount++;
}
-task_t TaskManager::createTask() {
- task_t t;
-
- t.id = createId();
-
- return t;
-}
-
TaskIdList TaskManager::moveTask(taskid_t id, taskid_t to)
throw (std::exception) {
TaskIdList affectedTasks;
@@ -94,7 +86,7 @@ TaskIdList TaskManager::moveTask(taskid_t id, taskid_t to)
return affectedTasks;
}
-TaskIdList TaskManager::deleteTask(taskid_t id)
+TaskIdList TaskManager::removeTask(taskid_t id)
throw (std::exception) {
TaskIdList affectedTasks;
@@ -123,10 +115,12 @@ TaskIdList TaskManager::updateTask(taskid_t id, task_t t)
return affectedTasks;
}
-TaskIdList TaskManager::addTask(task_t t, taskid_t parentid)
+TaskIdList TaskManager::createTask(taskid_t parentid)
throw (std::exception) {
TaskIdList affectedTasks;
+ task_t t;
+ t.title = "";
taskid_t id = createId();
try {
diff --git a/src/taskmanager.h b/src/taskmanager.h
index d8fd751..c53c520 100644
--- a/src/taskmanager.h
+++ b/src/taskmanager.h
@@ -40,11 +40,10 @@ class TaskManager {
public:
TaskManager();
~TaskManager();
- task_t createTask();
- TaskIdList addTask(task_t t, taskid_t parentid) throw (std::exception);
+ TaskIdList createTask(taskid_t parentid) throw (std::exception);
TaskIdList updateTask(taskid_t id, task_t task) throw (std::exception);
- TaskIdList deleteTask(taskid_t id) throw (std::exception);
+ TaskIdList removeTask(taskid_t id) throw (std::exception);
TaskIdList moveTask(taskid_t id, taskid_t newParent) throw (std::exception);
TaskIdList subTasks(taskid_t) throw (std::exception);
@@ -57,6 +56,7 @@ private:
// TaskIdList ancestorList(taskid_t task);
taskid_t createId();
taskid_t idCount;
+ task_t nextTask();
};
extern TaskManager task_manager;