2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*******************************************************************************
27 ** $XConsortium: reminders.c /main/7 1996/08/06 11:41:54 barstow $
29 ** RESTRICTED CONFIDENTIAL INFORMATION:
31 ** The information in this document is subject to special
32 ** restrictions in a confidential disclosure agreement between
33 ** HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
34 ** document outside HP, IBM, Sun, USL, SCO, or Univel without
35 ** Sun's specific written approval. This document and all copies
36 ** and derivative works thereof must be returned or destroyed at
39 ** Copyright 1993 Sun Microsystems, Inc. All rights reserved.
41 *******************************************************************************/
44 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
45 * (c) Copyright 1993, 1994 International Business Machines Corp. *
46 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
47 * (c) Copyright 1993, 1994 Novell, Inc. *
50 #include <EUSCompat.h>
55 #include <sys/param.h>
58 #include <Xm/LabelG.h>
59 #include <Xm/RowColumn.h>
61 #include <Xm/ToggleBG.h>
62 #include <Xm/ToggleB.h>
63 #include "reminders.h"
69 extern int _csa_duration_to_iso8601(int, char *);
70 extern int _csa_iso8601_to_duration(char *, int*);
72 /*******************************************************************************
74 ** Static functions local to reminders.c only
76 *******************************************************************************/
78 static Reminder_val_op
79 r_validate_advance(char *advance_string) {
81 char *c_p = advance_string;
83 Boolean scanned_sign = False;
85 /* crush out leading white space for the name
86 comparison/insert process */
88 while ((*c_p == ' ') || (*c_p == '\t'))
91 /* compress off trailing whitespace */
96 while ((end_ptr > c_p) &&
97 ((*(end_ptr - 1) == ' ') || (*(end_ptr - 1) == '\t')))
103 if (blank_buf(c_p)) {
104 return(ADVANCE_BLANK);
107 if (embedded_blank(c_p)) {
108 return(ADVANCE_CONTAINS_BLANK);
111 while (c_p && *c_p) {
112 if (isdigit(*c_p) || ((*c_p == '-') && (scanned_sign == False))) {
113 if ((*c_p == '-') && (scanned_sign == False))
117 return(ADVANCE_NONNUMERIC);
122 return(REMINDERS_OK);
125 static Reminder_val_op
126 r_get_bfpm_vals(Widget toggle, Widget text, Reminders_val *val,
127 Boolean convert_to_secs) {
129 Time_scope_menu_op scope;
130 Reminder_val_op status;
132 if (!XmToggleButtonGetState(toggle)) {
133 val->selected = False;
135 return(REMINDERS_OK);
138 val->selected = True;
139 cval = XmTextGetString(text);
141 if ((status = r_validate_advance(cval)) != REMINDERS_OK)
144 val->scope_val = atoi(cval);
150 val->scope_val = days_to_seconds(val->scope_val);
154 val->scope_val = hours_to_seconds(val->scope_val);
159 val->scope_val = minutes_to_seconds(val->scope_val);
163 return(REMINDERS_OK);
167 r_get_mailto_val(Reminders *r) {
170 c = XmTextGetString(r->mailto_text);
172 cm_strcpy(r->mailto_val, c);
174 cm_strcpy(r->mailto_val, cm_get_credentials());
184 Boolean compute_best_fit)
187 Calendar *c = calendar;
190 WidgetList option_items;
191 Time_scope_menu_op scope = val->scope;
195 if (!XtIsManaged(toggle))
199 XmNsubMenuId, &submenu,
202 XtVaGetValues(submenu,
203 XmNchildren, &option_items,
207 if (!val->selected) {
208 XmToggleButtonSetState(toggle, False, True);
209 XtVaSetValues(text, XmNvalue, "\0",
214 xmstr = XmStringCreateLocalized(
215 catgets( calendar->DT_catd, 1, 877, time_scope_str(scope) ) );
218 xmstr = XmStringCreateLocalized(
219 catgets( calendar->DT_catd, 1, 878, time_scope_str(scope) ) );
222 xmstr = XmStringCreateLocalized(
223 catgets( calendar->DT_catd, 1, 879, time_scope_str(scope) ) );
226 xmstr = XmStringCreateLocalized(time_scope_str(scope));
228 XtVaSetValues(XmOptionButtonGadget(menu), XmNlabelString, xmstr,
235 if (compute_best_fit) {
236 if (val->scope_val % daysec == 0) {
237 val->scope = TIME_DAYS;
238 sprintf(buf, "%d", seconds_to_days(val->scope_val));
239 } else if (val->scope_val % hrsec == 0) {
240 val->scope = TIME_HRS;
241 sprintf(buf, "%d", seconds_to_hours(val->scope_val));
243 val->scope = TIME_MINS;
244 sprintf(buf, "%d", seconds_to_minutes(val->scope_val));
247 sprintf(buf, "%d", val->scope_val);
251 xmstr = XmStringCreateLocalized(
252 catgets( calendar->DT_catd, 1, 877, time_scope_str(scope) ) );
255 xmstr = XmStringCreateLocalized(
256 catgets( calendar->DT_catd, 1, 878, time_scope_str(scope) ) );
259 xmstr = XmStringCreateLocalized(
260 catgets( calendar->DT_catd, 1, 879, time_scope_str(scope) ) );
263 xmstr = XmStringCreateLocalized(time_scope_str(scope));
265 XtVaSetValues(XmOptionButtonGadget(menu), XmNlabelString, xmstr,
269 XmToggleButtonSetState(toggle, True, True);
270 XtVaSetValues(text, XmNvalue, buf,
275 r_set_mailto_val(Reminders *r) {
276 XtVaSetValues(r->mailto_text, XmNvalue, r->mailto_val,
281 ** The function ensures the user data is set properly for the time scope
282 ** menus. This way, when the r_get_bfpm_vals function is called, it knows
283 ** how it should convert the value found in the text field.
286 r_scope_menu_proc(Widget item, XtPointer client_data, XtPointer cbs) {
287 Reminders_val *val = (Reminders_val *)client_data;
288 Time_scope_menu_op scope;
290 XtVaGetValues(item, XmNuserData, &val->scope,
295 ** Function sets the alarm text fields and menus sensitive/insensitive
296 ** depending on the state of the toggle button.
299 r_alarm_toggle_proc(Widget toggle_w, XtPointer client_data, XtPointer cbs) {
301 Boolean status = XmToggleButtonGetState(toggle_w);
302 Reminders *r = (Reminders *)client_data;
303 Widget text_w, menu_w;
308 if (toggle_w == r->beep_toggle) {
309 XtVaSetValues(r->beep_text, XmNsensitive, status,
311 XtVaSetValues(XmOptionButtonGadget(r->beep_menu),
312 XmNsensitive, status,
314 } else if (toggle_w == r->flash_toggle) {
315 XtVaSetValues(r->flash_text, XmNsensitive, status,
317 XtVaSetValues(XmOptionButtonGadget(r->flash_menu),
318 XmNsensitive, status,
320 } else if (toggle_w == r->popup_toggle) {
321 XtVaSetValues(r->popup_text, XmNsensitive, status,
323 XtVaSetValues(XmOptionButtonGadget(r->popup_menu),
324 XmNsensitive, status,
326 } else if (toggle_w == r->mail_toggle) {
327 XtVaSetValues(r->mail_text, XmNsensitive, status,
329 XtVaSetValues(XmOptionButtonGadget(r->mail_menu),
330 XmNsensitive, status,
332 XtVaSetValues(r->mailto_label, XmNsensitive, status,
334 XtVaSetValues(r->mailto_text, XmNsensitive, status,
339 /*******************************************************************************
341 ** External functions
343 *******************************************************************************/
345 build_reminders(Reminders *r, Calendar *c, Widget parent) {
347 Widget widest_toggle;
348 Dimension widest, highest;
350 Dimension _toText, _toOption;
357 ** Base form and label
359 r->bfpm_form_mgr = XtVaCreateWidget("bfpm_form_mgr",
360 xmFormWidgetClass, parent,
361 XmNautoUnmanage, False,
364 xmstr = XmStringCreateLocalized(
365 catgets(c->DT_catd, 1, 985, "Reminders"));
366 r->alarm_label = XtVaCreateWidget("Reminders",
367 xmLabelGadgetClass, r->bfpm_form_mgr,
368 XmNlabelString, xmstr,
369 XmNtopAttachment, XmATTACH_FORM,
371 XmNleftAttachment, XmATTACH_FORM,
376 /* Create the 4 toggle items to see which one is the longest */
378 xmstr = XmStringCreateLocalized(
379 catgets(c->DT_catd, 1, 986, "Beep"));
380 r->beep_toggle = XtVaCreateWidget("Beep",
381 xmToggleButtonGadgetClass, r->bfpm_form_mgr,
382 XmNlabelString, xmstr,
383 XmNnavigationType, XmTAB_GROUP,
388 xmstr = XmStringCreateLocalized(
389 catgets(c->DT_catd, 1, 987, "Flash"));
390 r->flash_toggle = XtVaCreateWidget("Flash",
391 xmToggleButtonGadgetClass, r->bfpm_form_mgr,
392 XmNlabelString, xmstr,
393 XmNnavigationType, XmTAB_GROUP,
398 xmstr = XmStringCreateLocalized(
399 catgets(c->DT_catd, 1, 988, "Popup"));
400 r->popup_toggle = XtVaCreateWidget("Popup",
401 xmToggleButtonGadgetClass, r->bfpm_form_mgr,
402 XmNlabelString, xmstr,
403 XmNnavigationType, XmTAB_GROUP,
408 xmstr = XmStringCreateLocalized(
409 catgets(c->DT_catd, 1, 989, "Mail"));
410 r->mail_toggle = XtVaCreateWidget("Mail",
411 xmToggleButtonGadgetClass, r->bfpm_form_mgr,
412 XmNlabelString, xmstr,
413 XmNnavigationType, XmTAB_GROUP,
418 xmstr = XmStringCreateLocalized(
419 catgets(c->DT_catd, 1, 990, "Mail To:" ) );
420 r->mailto_label = XtVaCreateManagedWidget("MailTo",
421 xmLabelGadgetClass, r->bfpm_form_mgr,
422 XmNlabelString, xmstr,
429 ** Beep toggle, text, and menu
431 XtAddCallback(r->beep_toggle, XmNvalueChangedCallback,
432 r_alarm_toggle_proc, r);
434 r->beep_text = XtVaCreateWidget("beep_text",
435 xmTextWidgetClass, r->bfpm_form_mgr,
436 XmNeditMode, XmSINGLE_LINE_EDIT,
438 XmNmaxLength, REMINDER_SCOPE_LEN - 1,
441 r->beep_menu = (Widget)create_time_scope_menu(r->bfpm_form_mgr,
442 NULL, r_scope_menu_proc, (XtPointer)&r->beep_val);
443 XtVaSetValues(r->beep_menu,
444 XmNnavigationType, XmTAB_GROUP,
448 ** Flash toggle, text, and menu
450 XtAddCallback(r->flash_toggle, XmNvalueChangedCallback,
451 r_alarm_toggle_proc, r);
453 r->flash_text = XtVaCreateWidget("flash_text",
454 xmTextWidgetClass, r->bfpm_form_mgr,
455 XmNeditMode, XmSINGLE_LINE_EDIT,
457 XmNmaxLength, REMINDER_SCOPE_LEN - 1,
460 r->flash_menu = (Widget)create_time_scope_menu(r->bfpm_form_mgr,
461 NULL, r_scope_menu_proc, (XtPointer)&r->flash_val);
462 XtVaSetValues(r->flash_menu,
463 XmNnavigationType, XmTAB_GROUP,
467 ** Popup toggle, text, and menu
469 XtAddCallback(r->popup_toggle, XmNvalueChangedCallback,
470 r_alarm_toggle_proc, r);
472 r->popup_text = XtVaCreateWidget("popup_text",
473 xmTextWidgetClass, r->bfpm_form_mgr,
474 XmNeditMode, XmSINGLE_LINE_EDIT,
476 XmNmaxLength, REMINDER_SCOPE_LEN - 1,
479 r->popup_menu = (Widget)create_time_scope_menu(r->bfpm_form_mgr,
480 NULL, r_scope_menu_proc, (XtPointer)&r->popup_val);
481 XtVaSetValues(r->popup_menu,
482 XmNnavigationType, XmTAB_GROUP,
486 ** Mail toggle, text, and menu
488 XtAddCallback(r->mail_toggle, XmNvalueChangedCallback,
489 r_alarm_toggle_proc, r);
491 r->mail_text = XtVaCreateWidget("mail_text",
492 xmTextWidgetClass, r->bfpm_form_mgr,
493 XmNeditMode, XmSINGLE_LINE_EDIT,
495 XmNmaxLength, REMINDER_SCOPE_LEN - 1,
498 r->mail_menu = (Widget)create_time_scope_menu(r->bfpm_form_mgr,
499 NULL, r_scope_menu_proc, (XtPointer)&r->mail_val);
500 XtVaSetValues(r->mail_menu,
501 XmNnavigationType, XmTAB_GROUP,
507 r->mailto_text = XtVaCreateWidget("mailto_text",
508 xmTextWidgetClass, r->bfpm_form_mgr,
509 XmNeditMode, XmSINGLE_LINE_EDIT,
511 XmNmaxLength, MAILTO_LEN - 1,
514 * Here, we do a layout.
517 _i18n_WidestWidget( 5, &prev, &widest, r->beep_toggle, r->flash_toggle,
518 r->popup_toggle, r->mail_toggle, r->mailto_label );
519 _toText = 5 + 10 + widest + 10;
521 _i18n_WidestWidget( 4, &prev, &widest, r->beep_text, r->flash_text,
522 r->popup_text, r->mail_text );
523 _toOption = _toText + widest + 5;
526 * r->beep_toggle,r->beep_text,r->beep_menu
528 prev = r->alarm_label;
529 _i18n_HighestWidgetAdjust( 3, &curr, &highest, r->beep_toggle,
530 r->beep_text, r->beep_menu );
532 XmNtopAttachment, XmATTACH_WIDGET,
536 XtVaSetValues( r->beep_toggle,
537 XmNleftAttachment, XmATTACH_FORM,
538 XmNleftOffset, 5 + 10,
540 XtVaSetValues( r->beep_text,
541 XmNleftAttachment, XmATTACH_FORM,
542 XmNleftOffset, _toText,
544 XtVaSetValues( r->beep_menu,
545 XmNleftAttachment, XmATTACH_FORM,
546 XmNleftOffset, _toOption,
551 * r->flash_toggle,r->flash_text,r->flash_menu
553 _i18n_HighestWidgetAdjust( 3, &curr, &highest, r->flash_toggle,
554 r->flash_text, r->flash_menu );
556 XmNtopAttachment, XmATTACH_WIDGET,
560 XtVaSetValues( r->flash_toggle,
561 XmNleftAttachment, XmATTACH_FORM,
562 XmNleftOffset, 5 + 10,
564 XtVaSetValues( r->flash_text,
565 XmNleftAttachment, XmATTACH_FORM,
566 XmNleftOffset, _toText,
568 XtVaSetValues( r->flash_menu,
569 XmNleftAttachment, XmATTACH_FORM,
570 XmNleftOffset, _toOption,
575 * r->popup_toggle,r->popup_text,r->popup_menu
577 _i18n_HighestWidgetAdjust( 3, &curr, &highest, r->popup_toggle,
578 r->popup_text, r->popup_menu );
580 XmNtopAttachment, XmATTACH_WIDGET,
584 XtVaSetValues( r->popup_toggle,
585 XmNleftAttachment, XmATTACH_FORM,
586 XmNleftOffset, 5 + 10,
588 XtVaSetValues( r->popup_text,
589 XmNleftAttachment, XmATTACH_FORM,
590 XmNleftOffset, _toText,
592 XtVaSetValues( r->popup_menu,
593 XmNleftAttachment, XmATTACH_FORM,
594 XmNleftOffset, _toOption,
599 * r->mail_toggle,r->mail_text,r->mail_menu
601 _i18n_HighestWidgetAdjust( 3, &curr, &highest, r->mail_toggle,
602 r->mail_text, r->mail_menu );
604 XmNtopAttachment, XmATTACH_WIDGET,
608 XtVaSetValues( r->mail_toggle,
609 XmNleftAttachment, XmATTACH_FORM,
610 XmNleftOffset, 5 + 10,
612 XtVaSetValues( r->mail_text,
613 XmNleftAttachment, XmATTACH_FORM,
614 XmNleftOffset, _toText,
616 XtVaSetValues( r->mail_menu,
617 XmNleftAttachment, XmATTACH_FORM,
618 XmNleftOffset, _toOption,
623 * r->mailto_label,r->mailto_text
625 _i18n_HighestWidgetAdjust( 2, &curr, &highest, r->mailto_label,
628 XmNtopAttachment, XmATTACH_WIDGET,
632 XtVaSetValues( r->mailto_label,
633 XmNleftAttachment, XmATTACH_FORM,
634 XmNleftOffset, 5 + 10,
636 XtVaSetValues( r->mailto_text,
637 XmNleftAttachment, XmATTACH_FORM,
638 XmNleftOffset, _toText,
642 extern Reminder_val_op
643 get_reminders_vals(Reminders *r, Boolean convert_to_secs) {
645 Reminder_val_op status;
647 if ((status = r_get_bfpm_vals(r->beep_toggle, r->beep_text, &r->beep_val,
648 convert_to_secs)) != REMINDERS_OK)
651 if ((status = r_get_bfpm_vals(r->flash_toggle, r->flash_text, &r->flash_val,
652 convert_to_secs)) != REMINDERS_OK)
655 if ((status = r_get_bfpm_vals(r->mail_toggle, r->mail_text, &r->mail_val,
656 convert_to_secs)) != REMINDERS_OK)
659 if ((status = r_get_bfpm_vals(r->popup_toggle, r->popup_text, &r->popup_val,
660 convert_to_secs)) != REMINDERS_OK)
665 return(REMINDERS_OK);
669 reminder_err_msg(Widget frame, char *name, Reminder_val_op op, Pixmap p)
671 Calendar *c = calendar;
672 char buf[MAXNAMELEN], buf2[MAXNAMELEN * 2];
678 sprintf(buf, "%s", catgets(c->DT_catd, 1, 775, "You must specify a reminder advance\nOperation was cancelled. Calendar"));
680 case ADVANCE_CONTAINS_BLANK:
681 sprintf(buf, "%s", catgets(c->DT_catd, 1, 776, "A reminder advance may not contain an embedded blank\nOperation was cancelled. Calendar"));
683 case ADVANCE_NONNUMERIC:
684 sprintf(buf, "%s", catgets(c->DT_catd, 1, 777, "Advance values must be a number with an optional sign\nOperation was cancelled. Calendar"));
692 sprintf(buf2, "%s %s", buf, name);
693 title = XtNewString(catgets(c->DT_catd, 1, 364,
694 "Calendar : Error - Editor"));
695 ident1 = XtNewString(catgets(c->DT_catd, 1, 95, "Continue"));
696 dialog_popup(frame, DIALOG_TITLE, title,
698 BUTTON_IDENT, 1, ident1,
699 BUTTON_HELP, ADVANCE_ERROR_HELP,
708 ** This function will consume form values and stuff them into an appointment.
711 reminders_form_to_appt(Reminders *r, Dtcm_appointment *appt, char *name) {
713 Reminder_val_op status;
714 Props_pu *pu = (Props_pu *)r->cal->properties_pu;
716 if (r->bfpm_form_mgr) {
717 if ((status = get_reminders_vals(r, True)) != REMINDERS_OK) {
718 reminder_err_msg(r->parent, name, status,
719 pu->xm_error_pixmap);
724 if (!r->beep_val.selected) {
725 free(appt->beep->value);
726 appt->beep->value = NULL;
728 appt->beep->value->item.reminder_value->lead_time = (char *) malloc(BUFSIZ);
729 _csa_duration_to_iso8601(r->beep_val.scope_val, appt->beep->value->item.reminder_value->lead_time);
730 appt->beep->value->item.reminder_value->reminder_data.data = NULL;
731 appt->beep->value->item.reminder_value->reminder_data.size = 0;
734 if (!r->flash_val.selected) {
735 free(appt->flash->value);
736 appt->flash->value = NULL;
738 appt->flash->value->item.reminder_value->lead_time = (char *) malloc(BUFSIZ);
739 _csa_duration_to_iso8601(r->flash_val.scope_val, appt->flash->value->item.reminder_value->lead_time);
740 appt->flash->value->item.reminder_value->reminder_data.data = NULL;
741 appt->flash->value->item.reminder_value->reminder_data.size = 0;
744 if (!r->popup_val.selected) {
745 free(appt->popup->value);
746 appt->popup->value = NULL;
748 appt->popup->value->item.reminder_value->lead_time = (char *) malloc(BUFSIZ);
749 _csa_duration_to_iso8601(r->popup_val.scope_val, appt->popup->value->item.reminder_value->lead_time);
750 appt->popup->value->item.reminder_value->reminder_data.data = NULL;
751 appt->popup->value->item.reminder_value->reminder_data.size = 0;
754 if (!r->mail_val.selected) {
755 free(appt->mail->value);
756 appt->mail->value = NULL;
758 appt->mail->value->item.reminder_value->lead_time = (char *) malloc(BUFSIZ);
759 _csa_duration_to_iso8601(r->mail_val.scope_val, appt->mail->value->item.reminder_value->lead_time);
760 appt->mail->value->item.reminder_value->reminder_data.data = (CSA_uint8 *) cm_strdup(r->mailto_val);
761 appt->mail->value->item.reminder_value->reminder_data.size = strlen(r->mailto_val);
768 ** This function will take appointment values and stuff them into a form.
771 reminders_appt_to_form(Reminders *r, CSA_entry_handle entry) {
773 CSA_return_code stat;
774 Dtcm_appointment *appt;
776 appt = allocate_appt_struct(appt_read,
777 r->cal->general->version,
778 CSA_ENTRY_ATTR_AUDIO_REMINDER_I,
779 CSA_ENTRY_ATTR_FLASHING_REMINDER_I,
780 CSA_ENTRY_ATTR_POPUP_REMINDER_I,
781 CSA_ENTRY_ATTR_MAIL_REMINDER_I,
783 stat = query_appt_struct(r->cal->cal_handle, entry, appt);
784 backend_err_msg(r->cal->frame, r->cal->view->current_calendar, stat,
785 ((Props_pu *)r->cal->properties_pu)->xm_error_pixmap);
786 if (stat != CSA_SUCCESS) {
787 free_appt_struct(&appt);
791 ret_val = reminders_attrs_to_form(r, appt);
792 free_appt_struct(&appt);
798 reminders_attrs_to_form(Reminders *r, Dtcm_appointment *appt) {
800 if (appt->beep && appt->beep->value) {
801 r->beep_val.selected = True;
802 _csa_iso8601_to_duration(appt->beep->value->item.reminder_value->lead_time, &r->beep_val.scope_val);
804 r->beep_val.selected = False;
805 r->beep_val.scope_val = -1;
808 if (appt->flash && appt->flash->value) {
809 r->flash_val.selected = True;
810 _csa_iso8601_to_duration(appt->flash->value->item.reminder_value->lead_time, &r->flash_val.scope_val);
812 r->flash_val.selected = False;
813 r->flash_val.scope_val = -1;
816 if (appt->popup && appt->popup->value) {
817 r->popup_val.selected = True;
818 _csa_iso8601_to_duration(appt->popup->value->item.reminder_value->lead_time, &r->popup_val.scope_val);;
820 r->popup_val.selected = False;
821 r->popup_val.scope_val = -1;
823 if (appt->mail && appt->mail->value) {
824 r->mail_val.selected = True;
825 _csa_iso8601_to_duration(appt->mail->value->item.reminder_value->lead_time, &r->mail_val.scope_val);
826 memset(r->mailto_val, 0, MAILTO_LEN);
827 strncpy(r->mailto_val, (char *) appt->mail->value->item.reminder_value->reminder_data.data, appt->mail->value->item.reminder_value->reminder_data.size);
829 r->mail_val.selected = False;
830 r->mail_val.scope_val = -1;
831 r->mailto_val[0] = '\0';
834 set_reminders_vals(r, True);
840 set_reminders_defaults(Reminders *r) {
841 Props *p = (Props *)r->cal->properties;
845 val->selected = convert_boolean_str(get_char_prop(p, CP_BEEPON));
846 val->scope = convert_time_scope_str(get_char_prop(p, CP_BEEPUNIT));
847 val->scope_val = get_int_prop(p, CP_BEEPADV);
850 val->selected = convert_boolean_str(get_char_prop(p, CP_FLASHON));
851 val->scope = convert_time_scope_str(get_char_prop(p, CP_FLASHUNIT));
852 val->scope_val = get_int_prop(p, CP_FLASHADV);
855 val->selected = convert_boolean_str(get_char_prop(p, CP_OPENON));
856 val->scope = convert_time_scope_str(get_char_prop(p, CP_OPENUNIT));
857 val->scope_val = get_int_prop(p, CP_OPENADV);
860 val->selected = convert_boolean_str(get_char_prop(p, CP_MAILON));
861 val->scope = convert_time_scope_str(get_char_prop(p, CP_MAILUNIT));
862 val->scope_val = get_int_prop(p, CP_MAILADV);
863 strcpy(r->mailto_val, get_char_prop(p, CP_MAILTO));
865 set_reminders_vals(r, False);
869 set_reminders_vals(Reminders *r, Boolean compute_best_fit) {
871 r_set_bfpm_vals(r->beep_toggle, r->beep_text, r->beep_menu,
872 &r->beep_val, compute_best_fit);
873 r_set_bfpm_vals(r->flash_toggle, r->flash_text, r->flash_menu,
874 &r->flash_val, compute_best_fit);
875 r_set_bfpm_vals(r->mail_toggle, r->mail_text, r->mail_menu,
876 &r->mail_val, compute_best_fit);
877 r_set_bfpm_vals(r->popup_toggle, r->popup_text, r->popup_menu,
878 &r->popup_val, compute_best_fit);
886 Time_scope_menu_op type)
890 return days_to_seconds(value);
892 return hours_to_seconds(value);
895 return minutes_to_seconds(value);
905 Props *p = (Props *)c->properties;
912 val->selected = convert_boolean_str(get_char_prop(p, CP_BEEPON));
913 val->scope = convert_time_scope_str(get_char_prop(p, CP_BEEPUNIT));
914 val->scope_val = convert_time_val(get_int_prop(p, CP_BEEPADV),
918 val->selected = convert_boolean_str(get_char_prop(p, CP_FLASHON));
919 val->scope = convert_time_scope_str(get_char_prop(p, CP_FLASHUNIT));
920 val->scope_val = convert_time_val(get_int_prop(p, CP_FLASHADV),
924 val->selected = convert_boolean_str(get_char_prop(p, CP_OPENON));
925 val->scope = convert_time_scope_str(get_char_prop(p, CP_OPENUNIT));
926 val->scope_val = convert_time_val(get_int_prop(p, CP_OPENADV),
930 val->selected = convert_boolean_str(get_char_prop(p, CP_MAILON));
931 val->scope = convert_time_scope_str(get_char_prop(p, CP_MAILUNIT));
932 val->scope_val = convert_time_val(get_int_prop(p, CP_MAILADV),
934 strcpy(r->mailto_val, get_char_prop(p, CP_MAILTO));