summaryrefslogtreecommitdiffstats
path: root/src/day.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/day.c')
-rw-r--r--src/day.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/day.c b/src/day.c
index 087d8b7..2488c59 100644
--- a/src/day.c
+++ b/src/day.c
@@ -595,60 +595,55 @@ unsigned day_chk_busy_slices(struct date day, int slicesno, int *slices)
}
/* Cut an item so it can be pasted somewhere else later. */
-int day_cut_item(long date, int item_number)
+struct day_item *day_cut_item(long date, int item_number)
{
- const int DELETE_WHOLE = 1;
- struct day_item *p;
+ struct day_item *p = day_get_item(item_number);
- p = day_get_item(item_number);
switch (p->type) {
case EVNT:
event_delete(p->item.ev, ERASE_CUT);
break;
case RECUR_EVNT:
- recur_event_erase(p->item.rev, date, DELETE_WHOLE, ERASE_CUT);
+ recur_event_erase(p->item.rev, date, 1, ERASE_CUT);
break;
case APPT:
apoint_delete(p->item.apt, ERASE_CUT);
break;
case RECUR_APPT:
- recur_apoint_erase(p->item.rapt, date, DELETE_WHOLE, ERASE_CUT);
+ recur_apoint_erase(p->item.rapt, date, 1, ERASE_CUT);
break;
default:
EXIT(_("unknwon type"));
/* NOTREACHED */
}
- return p->type;
+ return p;
}
/* Paste a previously cut item. */
-int day_paste_item(long date, int cut_item_type)
+int day_paste_item(struct day_item *p, long date)
{
- int pasted_item_type;
-
- pasted_item_type = cut_item_type;
- switch (cut_item_type) {
+ switch (p->type) {
case 0:
return 0;
case EVNT:
- event_paste_item();
+ event_paste_item(p->item.ev, date);
break;
case RECUR_EVNT:
- recur_event_paste_item();
+ recur_event_paste_item(p->item.rev, date);
break;
case APPT:
- apoint_paste_item();
+ apoint_paste_item(p->item.apt, date);
break;
case RECUR_APPT:
- recur_apoint_paste_item();
+ recur_apoint_paste_item(p->item.rapt, date);
break;
default:
EXIT(_("unknwon type"));
/* NOTREACHED */
}
- return pasted_item_type;
+ return p->type;
}
/* Returns a structure containing the selected item. */