aboutsummaryrefslogtreecommitdiffstats
path: root/src/day.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/day.c')
-rw-r--r--src/day.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/day.c b/src/day.c
index 2a1e1a8..5bf84c4 100644
--- a/src/day.c
+++ b/src/day.c
@@ -581,9 +581,27 @@ void day_write_stdout(time_t date, const char *fmt_apt, const char *fmt_rapt,
/* Display an item inside a popup window. */
void day_popup_item(struct day_item *day)
{
+ const char *note_heading = _("Note:");
+ size_t note_size = 3500;
+
if (day->type == EVNT || day->type == RECUR_EVNT) {
- item_in_popup(NULL, NULL, day_item_get_mesg(day),
- _("Event:"));
+ if (day_item_get_note(day)) {
+ char note[note_size];
+ char *notepath, *msg;
+ FILE *fp;
+
+ asprintf(&notepath, "%s%s", path_notes, day_item_get_note(day));
+ fp = fopen(notepath, "r");
+ note_read_contents(note, note_size, fp);
+ fclose(fp);
+ mem_free(notepath);
+
+ asprintf(&msg, "%s\n\n%s\n%s", day_item_get_mesg(day), note_heading, note);
+ item_in_popup(NULL, NULL, msg, _("Event:"));
+ mem_free(msg);
+ } else {
+ item_in_popup(NULL, NULL, day_item_get_mesg(day), _("Event:"));
+ }
} else if (day->type == APPT || day->type == RECUR_APPT) {
char a_st[100], a_end[100];
@@ -593,8 +611,24 @@ void day_popup_item(struct day_item *day)
apt_tmp.start = day->start;
apt_tmp.dur = day_item_get_duration(day);
apoint_sec2str(&apt_tmp, ui_day_sel_date(), a_st, a_end);
- item_in_popup(a_st, a_end, day_item_get_mesg(day),
- _("Appointment:"));
+
+ if (day_item_get_note(day)) {
+ char note[note_size];
+ char *notepath, *msg;
+ FILE *fp;
+
+ asprintf(&notepath, "%s%s", path_notes, day_item_get_note(day));
+ fp = fopen(notepath, "r");
+ note_read_contents(note, note_size, fp);
+ fclose(fp);
+ mem_free(notepath);
+
+ asprintf(&msg, "%s\n\n%s\n%s", day_item_get_mesg(day), note_heading, note);
+ item_in_popup(a_st, a_end, msg, _("Appointment:"));
+ mem_free(msg);
+ } else {
+ item_in_popup(a_st, a_end, day_item_get_mesg(day), _("Appointment:"));
+ }
} else {
EXIT(_("unknown item type"));
/* NOTREACHED */