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>
This commit is contained in:
parent
19290ca39a
commit
30639ef6de
10
src/ui-day.c
10
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. */
|
/* 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;
|
long newtime;
|
||||||
unsigned hr, mn;
|
unsigned hr, mn;
|
||||||
@ -121,6 +121,10 @@ static void update_start_time(long *start, long *dur)
|
|||||||
do {
|
do {
|
||||||
if (!day_edit_time(*start, &hr, &mn))
|
if (!day_edit_time(*start, &hr, &mn))
|
||||||
break;
|
break;
|
||||||
|
if (!update_dur) {
|
||||||
|
*start = update_time_in_date(*start, hr, mn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
newtime = update_time_in_date(*start, hr, mn);
|
newtime = update_time_in_date(*start, hr, mn);
|
||||||
if (newtime < *start + *dur) {
|
if (newtime < *start + *dur) {
|
||||||
*dur -= (newtime - *start);
|
*dur -= (newtime - *start);
|
||||||
@ -333,7 +337,7 @@ void ui_day_item_edit(void)
|
|||||||
(_("Edit: "), choice_recur_appt, 4)) {
|
(_("Edit: "), choice_recur_appt, 4)) {
|
||||||
case 1:
|
case 1:
|
||||||
need_check_notify = 1;
|
need_check_notify = 1;
|
||||||
update_start_time(&ra->start, &ra->dur);
|
update_start_time(&ra->start, &ra->dur, 1);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
update_duration(&ra->start, &ra->dur);
|
update_duration(&ra->start, &ra->dur);
|
||||||
@ -363,7 +367,7 @@ void ui_day_item_edit(void)
|
|||||||
(_("Edit: "), choice_appt, 3)) {
|
(_("Edit: "), choice_appt, 3)) {
|
||||||
case 1:
|
case 1:
|
||||||
need_check_notify = 1;
|
need_check_notify = 1;
|
||||||
update_start_time(&a->start, &a->dur);
|
update_start_time(&a->start, &a->dur, 1);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
update_duration(&a->start, &a->dur);
|
update_duration(&a->start, &a->dur);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user