From 30639ef6de19e64ac1f29ff61644aabd9861429c Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 18 Jul 2013 12:13:54 +0200 Subject: update_start_time(): Allow for moving an item Add a parameter that specifies whether the duration should be updated when updating the start time of an item. Signed-off-by: Lukas Fleischer --- src/ui-day.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui-day.c b/src/ui-day.c index 0501642..c441398 100644 --- a/src/ui-day.c +++ b/src/ui-day.c @@ -109,7 +109,7 @@ static int day_edit_duration(int start, int dur, unsigned *new_duration) } /* Request the user to enter a new end time or duration. */ -static void update_start_time(long *start, long *dur) +static void update_start_time(long *start, long *dur, int update_dur) { long newtime; unsigned hr, mn; @@ -121,6 +121,10 @@ static void update_start_time(long *start, long *dur) do { if (!day_edit_time(*start, &hr, &mn)) break; + if (!update_dur) { + *start = update_time_in_date(*start, hr, mn); + return; + } newtime = update_time_in_date(*start, hr, mn); if (newtime < *start + *dur) { *dur -= (newtime - *start); @@ -333,7 +337,7 @@ void ui_day_item_edit(void) (_("Edit: "), choice_recur_appt, 4)) { case 1: need_check_notify = 1; - update_start_time(&ra->start, &ra->dur); + update_start_time(&ra->start, &ra->dur, 1); break; case 2: update_duration(&ra->start, &ra->dur); @@ -363,7 +367,7 @@ void ui_day_item_edit(void) (_("Edit: "), choice_appt, 3)) { case 1: need_check_notify = 1; - update_start_time(&a->start, &a->dur); + update_start_time(&a->start, &a->dur, 1); break; case 2: update_duration(&a->start, &a->dur); -- cgit v1.2.3-70-g09d2