diff options
-rw-r--r-- | src/taskmanager.cc | 21 | ||||
-rw-r--r-- | src/tasktree.cc | 3 | ||||
-rw-r--r-- | src/tasktree.h | 2 |
3 files changed, 17 insertions, 9 deletions
diff --git a/src/taskmanager.cc b/src/taskmanager.cc index 5f8e2d7..38d7893 100644 --- a/src/taskmanager.cc +++ b/src/taskmanager.cc @@ -112,15 +112,26 @@ TaskIdListPair TaskManager::moveTask(taskid_t id, taskid_t to) if(id == to) throw std::exception(); // Node and new parent are the same node. - task_t t = tree.data(id); + //task_t t = tree.data(id); // Make sure the new parent exists. This will throw an exception if it doesn't - task_t t_ = tree.data(to); + //task_t t_ = tree.data(to); - t.parentid = to; + // t.parentid = to; - TaskIdList tilremove = tree.remove(id); - TaskIdList tilcreate = tree.insertAsChild(to, id, t); + // TaskIdList tilremove = tree.remove(id); + TaskIdList tilremove; + tilremove.push_back(id); + TaskIdList ancestors = tree.ancestorList(id); + tilremove.insert(tilremove.end(), ancestors.begin(), ancestors.end()); + + // TaskIdList tilcreate = tree.insertAsChild(to, id, t); + TaskIdList tilcreate; + tilcreate.push_back(to); + ancestors = tree.ancestorList(to); + tilcreate.insert(tilcreate.end(), ancestors.begin(), ancestors.end()); + + tree.move(id, to); TaskIdListPair tilpair; tilpair.first = tilremove; diff --git a/src/tasktree.cc b/src/tasktree.cc index 5205abf..c463177 100644 --- a/src/tasktree.cc +++ b/src/tasktree.cc @@ -173,7 +173,6 @@ TaskIdList TaskTree::remove(taskid_t id) return affectedNodes; } -/* TaskIdList TaskTree::move(taskid_t id, taskid_t toid) throw (std::exception) { @@ -206,8 +205,6 @@ TaskIdList TaskTree::move(taskid_t id, taskid_t toid) return affectedNodes; } -*/ - TaskIdList TaskTree::updateData(taskid_t id, const std::string &name, const std::string &value) diff --git a/src/tasktree.h b/src/tasktree.h index 0fd2540..8efadeb 100644 --- a/src/tasktree.h +++ b/src/tasktree.h @@ -60,7 +60,7 @@ public: TaskIdList insertAsChild(taskid_t parentid, taskid_t id, task_t data) throw (std::exception); TaskIdList remove(taskid_t id) throw (std::exception); - // TaskIdList move(taskid_t id, taskid_t newParentId) throw (std::exception); + TaskIdList move(taskid_t id, taskid_t newParentId) throw (std::exception); TaskIdList updateData(taskid_t id, const std::string &name, const std::string &value) throw (std::exception); task_t data(taskid_t id) throw (std::exception); |