aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2013-07-18 12:13:54 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2013-07-18 12:13:54 +0200
commit30639ef6de19e64ac1f29ff61644aabd9861429c (patch)
tree55881ecb82b31d1b822f81c63641e24e6efc65b6 /src
parent19290ca39aa343f046bf98d0c87181a59a0802f2 (diff)
downloadcalcurse-30639ef6de19e64ac1f29ff61644aabd9861429c.tar.gz
calcurse-30639ef6de19e64ac1f29ff61644aabd9861429c.zip
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 <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r--src/ui-day.c10
1 files changed, 7 insertions, 3 deletions
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);