From 5bca507f4f7bf4ccb2188c98fc8a320f428cacb2 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 17 Jan 2013 13:47:56 +0100 Subject: First part move/remove,create problem. --- src/taskmanager.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/taskmanager.cc') 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; -- cgit v1.2.3