From e0b372c0ba5748e378919e55900220112575b583 Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Sun, 11 Mar 2012 11:39:35 +0100 Subject: Fixed drag and drop problem by stopping propagation of the event. + some non-finished updatign code. --- src/task_proto.cc | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/task_proto.cc') diff --git a/src/task_proto.cc b/src/task_proto.cc index 717ca3e..2312c9e 100644 --- a/src/task_proto.cc +++ b/src/task_proto.cc @@ -260,9 +260,33 @@ int callback_lws_task(struct libwebsocket_context * context, printf("Moving task: %s\n", buf_str.c_str()); break; } - case cmd::update: - printf("Update\n"); + case cmd::update: { + printf("Updating %d\n", m.update.id); + + bool id_found = false; + TaskList::iterator it; + + task_t updated_task; + for(it = tasklist.begin(); it != tasklist.end(); it++) { + task_t &t = *it; + if(t.id == m.update.id) { + id_found = true; + t.title = m.update.title; + t.desc = m.update.desc; + updated_task = t; + break; + } + } + + if(!id_found) { + printf("\t!!!Could not locate task with id %d\n", m.update.id); + } + + buf_str = msg_tostring(create_msg(cmd::update, updated_task)); + printf("Updating task: %s\n", buf_str.c_str()); + break; + } default: printf("Wrong command :(\n"); break; -- cgit v1.2.3