3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.1 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #include "edit-alarm.h"
20 #include "radio-group.h"
22 #include "gi-radio-timepicker.h"
23 #include "save-cancel.h"
27 Evas_Object *conformant;
28 Evas_Object *naviframe;
29 Evas_Object *ly; // self
31 cal_edit_alarm_changed_callback alarm_changed_callback;
32 void* alarm_changed_callback_data;
34 Evas_Object *sc; // scroller
35 Evas_Object *bx; // box
37 cal_radio_group_h radio_group;
39 Elm_Object_Item* on_a_day;
41 cal_save_cancel_h save_cancel;
43 Evas_Object *e_custom;
44 Evas_Object *b_custom;
47 Elm_Object_Item *pre_selected_it;
49 Cal_Reminder reminder;
53 cal_edit_alarm_type alarm_type;
54 } cal_edit_alarm_data;
56 struct __cal_edit_alarm_button {
58 const char *plural_label;
61 static struct __cal_edit_alarm_button cal_edit_alarm_button[] = {
63 { NULL, NULL, _HOUR, },
64 { NULL, NULL, _DAY, },
65 { NULL, NULL, _WEEK, },
68 static Elm_Entry_Filter_Limit_Size _limit_2char = {
71 static Elm_Entry_Filter_Accept_Set _digit_only = {
72 .accepted = "0123456789",
75 static Elm_Genlist_Item_Class itc_seperator, itc_1text_1icon, itc_custom;
79 cal_edit_alarm_data *p;
82 } cal_edit_alarm_item_data;
84 enum cal_edit_alarm_genlist_item_type{
98 static void __cal_edit_alarm_custom_ctx_selected_callback(void *data, Evas_Object *obj, void *ei);
100 static void __cal_edit_alarm_delete_layout(void *data, Evas *e, Evas_Object *obj, void *ei)
104 cal_edit_alarm_data *p = data;
106 cal_radio_group_destroy(p->radio_group);
108 cal_save_cancel_destroy(p->save_cancel);
111 evas_object_del(p->ctx);
117 static void __cal_edit_alarm_clicked_callback(void *data, Evas *e, Evas_Object *obj, void *ei)
119 cal_edit_alarm_data *p;
120 Evas_Event_Mouse_Up *ev = ei;
123 if (ev && ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
126 p = CAL_UTIL_GET_PRIV_DATA(obj);
128 cal_radio_group_select_radio(p->radio_group, val);
131 static void __cal_edit_alarm_set_custom(cal_edit_alarm_data *p)
133 elm_object_focus_set(p->e_custom, EINA_TRUE);
134 elm_entry_cursor_end_set(p->e_custom);
137 static inline void __cal_edit_alarm_set_button_label(cal_edit_alarm_data *p)
139 if (1 < p->reminder.alarm_value)
140 elm_object_text_set(p->b_custom, _(cal_edit_alarm_button[p->bt_idx].plural_label));
142 elm_object_text_set(p->b_custom, _(cal_edit_alarm_button[p->bt_idx].label));
145 static void __cal_edit_alarm_custom_popup_hide_callback(void *data, Evas_Object *obj, void *ei)
147 c_retm_if(!data, "data is null");
148 c_retm_if(!obj, "obj is null");
150 cal_edit_alarm_data* p = data;
152 evas_object_del(obj);
155 static void __cal_edit_create_ctx_popup(cal_edit_alarm_data* p)
157 c_retm_if(!p, "p is NULL.");
159 Evas_Object *ctx = p->ctx;
162 evas_object_del(ctx);
164 p->ctx = elm_ctxpopup_add(p->naviframe);
165 c_retm_if(!p->ctx, "elm_ctxpopup_add(p->ad->naviframe) returned null");
166 elm_object_focus_allow_set(p->ctx, EINA_FALSE);
169 evas_object_data_set(ctx, "priv", p);
171 evas_object_smart_callback_add(ctx, "dismissed", __cal_edit_alarm_custom_popup_hide_callback, p);
172 elm_ctxpopup_item_append(ctx, S_("IDS_COM_BODY_MINUTE_LC"), NULL, __cal_edit_alarm_custom_ctx_selected_callback, (const void *)0);
173 elm_ctxpopup_item_append(ctx, S_("IDS_COM_POP_HOUR_LC"), NULL, __cal_edit_alarm_custom_ctx_selected_callback, (const void *)1);
174 elm_ctxpopup_item_append(ctx, C_("IDS_COM_POP_DAY_LC"), NULL, __cal_edit_alarm_custom_ctx_selected_callback, (const void *)2);
175 elm_ctxpopup_item_append(ctx, C_("IDS_COM_POP_WEEK_LC"), NULL, __cal_edit_alarm_custom_ctx_selected_callback, (const void *)3);
178 static void __cal_edit_alarm_custom_button_callback(void *data, Evas_Object *obj, void *ei)
180 cal_edit_alarm_data* p = data;
181 c_retm_if(!p, "p is null");
183 __cal_edit_create_ctx_popup(p);
184 c_retm_if(!p->ctx, "p is NULL.");
185 Evas_Coord x, y, w, h;
186 evas_object_geometry_get(p->b_custom, &x, &y, &w, &h);
187 evas_object_move(p->ctx, x+w/2, y);
188 evas_object_show(p->ctx);
191 static void __cal_edit_alarm_custom_ctx_selected_callback(void *data, Evas_Object *obj, void *ei)
193 cal_edit_alarm_data* p = CAL_UTIL_GET_PRIV_DATA(obj);
194 c_retm_if(!p, "p is NULL.");
196 int index = (int)data;
198 __cal_edit_alarm_set_button_label(p);
200 __cal_edit_alarm_set_custom(p);
201 cal_radio_group_select_radio(p->radio_group, _GTYPE_CUSTOMIZE);
202 __cal_edit_alarm_custom_popup_hide_callback(p,p->ctx,ei);
205 static Evas_Object* __cal_edit_alarm_add_button(Evas_Object *parent, cal_edit_alarm_data *p)
209 bt = elm_button_add(parent);
213 elm_object_focus_allow_set(bt, EINA_FALSE);
214 evas_object_propagate_events_set(bt, EINA_FALSE);
215 evas_object_smart_callback_add(bt, "clicked", __cal_edit_alarm_custom_button_callback, p);
220 static char *__cal_edit_alarm_get_genlist_item_label(void *data, Evas_Object *obj, const char *part)
222 cal_edit_alarm_item_data *item_data = (cal_edit_alarm_item_data*)data;
223 int type = (int)item_data->type;
224 char buf[1024] = {0};
226 if (!CAL_STRCMP(part, "elm.text"))
228 Cal_Reminder reminder;
232 reminder.tick_unit = CALENDAR_ALARM_NONE;
233 reminder.alarm_value = 0;
234 cal_reminder_get_string(&reminder, buf, sizeof(buf));
242 reminder.tick_unit = CALENDAR_ALARM_TIME_UNIT_MINUTE;
243 reminder.alarm_value = item_data->data;
244 cal_reminder_get_string(&reminder, buf, sizeof(buf));
246 case _GTYPE_CUSTOMIZE:
248 case _GTYPE_ON_A_DAY:
258 static char *__cal_edit_alarm_get_genlist_item_custom_label(void *data, Evas_Object *obj, const char *part)
260 return strdup(C_("IDS_CLD_BODY_BEFORE_LC"));
263 static void __cal_edit_alarm_genlist_item_delete_callback(void *data, Evas_Object *obj)
266 cal_edit_alarm_item_data*item_data = (cal_edit_alarm_item_data*)data;
268 CAL_ASSERT(item_data->p);
273 static Eina_Bool __cal_edit_alarm_get_genlist_item_state(void *data, Evas_Object *obj, const char *part)
278 static Evas_Object* __cal_edit_alarm_add_radio(Evas_Object *dg, int val, cal_edit_alarm_data *p, cal_edit_alarm_item_data *item_data)
282 rd = elm_radio_add(dg);
283 c_retvm_if(!rd, NULL, "rd is NULL");
285 elm_object_part_content_set(rd, "content", rd);
286 cal_radio_group_set_radio_object(p->radio_group, val, rd);
288 evas_object_show(rd);
289 evas_object_data_set(rd, "priv", p);
290 evas_object_event_callback_add(rd, EVAS_CALLBACK_MOUSE_UP, __cal_edit_alarm_clicked_callback, (void *)val);
295 static void __cal_edit_alarm_entry_unfocused(void *data, Evas_Object *obj, void *event_info)
297 cal_edit_alarm_data *p = (cal_edit_alarm_data *)data;
300 snprintf(min, 7, "%d", p->reminder.alarm_value);
301 elm_entry_entry_set(p->e_custom, min);
304 static Evas_Object* __cal_edit_alarm_add_entry(Evas_Object *parent, cal_edit_alarm_data *p, cal_edit_alarm_item_data *item_data)
307 Ecore_IMF_Context *ic;
309 e = elm_entry_add(parent);
313 elm_object_style_set(e, "font_color_black");
314 elm_entry_single_line_set(e, EINA_TRUE);
315 elm_entry_markup_filter_append(e, elm_entry_filter_limit_size, &_limit_2char);
316 elm_entry_markup_filter_append(e, elm_entry_filter_accept_set, &_digit_only);
317 elm_entry_input_panel_layout_set(e, ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
318 elm_entry_context_menu_disabled_set(e, EINA_TRUE);
320 ic = elm_entry_imf_context_get(e);
324 evas_object_smart_callback_add(e, "unfocused", __cal_edit_alarm_entry_unfocused, p);
326 elm_entry_text_style_user_push(e, "DEFAULT='align=center'");
331 static void __cal_edit_alarm_entry_changed_callback(void *data, Evas_Object *obj, void *event_info)
333 cal_edit_alarm_item_data *item_data = (cal_edit_alarm_item_data *)data;
334 cal_edit_alarm_data *p = item_data->p;
335 const char *s = elm_entry_entry_get(p->e_custom);
336 p->reminder.alarm_value = atoi(s);
338 __cal_edit_alarm_set_button_label(p);
341 static void __cal_edit_alarm_customize_radio_changed_cb(unsigned int index, bool selected, void* data)
343 cal_edit_alarm_data *p = (cal_edit_alarm_data*)data;
345 elm_object_focus_set(p->e_custom, EINA_TRUE);
346 elm_entry_cursor_end_set(p->e_custom);
348 elm_object_focus_set(p->e_custom, EINA_FALSE);
352 static Evas_Object* __cal_edit_alarm_get_genlist_item_custom_icon(void *data, Evas_Object *obj, const char *part)
354 c_retvm_if(!data, NULL, "data is null");
355 c_retvm_if(!obj, NULL, "obj is null");
357 cal_edit_alarm_item_data *item_data = (cal_edit_alarm_item_data*)data;
358 cal_edit_alarm_data *p = item_data->p;
360 if (!CAL_STRCMP(part, "radio")) {
361 Evas_Object *rd = elm_radio_add(obj);
362 c_retv_if(!rd, NULL);
363 cal_radio_group_set_radio_object(p->radio_group, item_data->type, rd);
364 cal_radio_group_set_changed_callback(p->radio_group, item_data->type, __cal_edit_alarm_customize_radio_changed_cb, p);
366 } else if (!CAL_STRCMP(part, "button")) {
367 Evas_Object *bt = __cal_edit_alarm_add_button(obj, p);
368 c_retv_if(!bt, NULL);
369 elm_object_style_set(bt, "sweep");
370 elm_object_part_content_set(obj, "", bt);
372 __cal_edit_alarm_set_button_label(p);
374 } else if (!CAL_STRCMP(part, "input_sw")) {
375 Evas_Object *entry = __cal_edit_alarm_add_entry(obj, p, item_data);
376 c_retv_if(!entry, NULL);
377 evas_object_smart_callback_add(entry, "changed", __cal_edit_alarm_entry_changed_callback, item_data);
379 if (cal_radio_group_get_selected_radio(p->radio_group) == _GTYPE_CUSTOMIZE)
380 snprintf(buf, sizeof(buf), "%d", p->reminder.alarm_value);
382 snprintf(buf, sizeof(buf), "%d", 0);
383 elm_entry_entry_set(entry, buf);
387 c_retvm_if(1, NULL, "part %s unattended for", part);
392 static Evas_Object *__cal_edit_alarm_get_genlist_item_icon(void *data, Evas_Object *obj, const char *part)
394 c_retvm_if(!data, NULL, "data is null");
395 c_retvm_if(!obj, NULL, "obj is null");
397 Evas_Object *e_obj = NULL;
398 cal_edit_alarm_item_data *item_data = (cal_edit_alarm_item_data*)data;
399 cal_edit_alarm_data *p = item_data->p;
401 if (!CAL_STRCMP(part, "elm.icon")) {
402 e_obj = __cal_edit_alarm_add_radio(obj, item_data->type, p, item_data);
408 static void __cal_edit_alarm_genlist_item_select_callback(void *data, Evas_Object *obj, void *event_info)
412 cal_edit_alarm_item_data *item_data;
413 Elm_Object_Item *it = elm_genlist_selected_item_get(obj);
416 elm_genlist_item_selected_set(it, EINA_FALSE);
418 item_data = (cal_edit_alarm_item_data *)elm_object_item_data_get(it);
420 int type = item_data->type;
421 cal_edit_alarm_data *p = item_data->p;
432 case _GTYPE_CUSTOMIZE:
433 cal_radio_group_select_radio(p->radio_group, type);
442 static void __cal_edit_alarm_append_genlist_item_event(
443 Evas_Object *genlist, cal_edit_alarm_data *p, int type, int data)
445 cal_edit_alarm_item_data *item_data;
446 CAL_CALLOC(item_data, 1, cal_edit_alarm_item_data);
449 item_data->type = type;
450 item_data->data = data;
452 if(_GTYPE_SPEA == type) {
453 Elm_Object_Item *it = elm_genlist_item_append(genlist, &itc_seperator, (void*)item_data, NULL, ELM_GENLIST_ITEM_NONE, __cal_edit_alarm_genlist_item_select_callback, NULL);
454 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
456 if(_GTYPE_CUSTOMIZE == item_data->type)
457 elm_genlist_item_append(genlist, &itc_custom, (void*)item_data, NULL, ELM_GENLIST_ITEM_NONE, __cal_edit_alarm_genlist_item_select_callback, NULL);
459 elm_genlist_item_append(genlist, &itc_1text_1icon, (void*)item_data, NULL, ELM_GENLIST_ITEM_NONE, __cal_edit_alarm_genlist_item_select_callback, NULL);
463 static void __cal_edit_alarm_append_genlist_item_todo(Evas_Object *genlist, cal_edit_alarm_data *p, int type, int data)
465 cal_edit_alarm_item_data *item_data;
466 CAL_CALLOC(item_data, 1, cal_edit_alarm_item_data);
469 item_data->type = type;
470 item_data->data = data;
472 if(_GTYPE_SPEA == item_data->type) {
473 Elm_Object_Item *it = elm_genlist_item_append(genlist, &itc_seperator, (void*)item_data, NULL, ELM_GENLIST_ITEM_NONE, __cal_edit_alarm_genlist_item_select_callback, NULL);
474 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
476 if(p->alarm_type == ALARM_TYPE_TODO_CUSTOM_ONLY) {
477 if(_GTYPE_OFF == item_data->type)
478 elm_genlist_item_append(genlist, &itc_1text_1icon, (void*)item_data, NULL, ELM_GENLIST_ITEM_NONE, __cal_edit_alarm_genlist_item_select_callback, NULL);
483 if(_GTYPE_CUSTOMIZE == item_data->type)
484 elm_genlist_item_append(genlist, &itc_custom, (void*)item_data, NULL, ELM_GENLIST_ITEM_NONE, __cal_edit_alarm_genlist_item_select_callback, NULL);
485 else if(_GTYPE_5_MIN == item_data->type || _GTYPE_15_MIN == item_data->type || _GTYPE_1_HOUR == item_data->type)
488 elm_genlist_item_append(genlist, &itc_1text_1icon, (void*)item_data, NULL, ELM_GENLIST_ITEM_NONE, __cal_edit_alarm_genlist_item_select_callback, NULL);
493 static void __cal_edit_alarm_genlist_realized_callback(void *data, Evas_Object *obj, void *ei)
495 cal_edit_alarm_item_data *item_data = elm_object_item_data_get((Elm_Object_Item *)ei);
496 c_ret_if(!item_data);
498 if (item_data->type == _GTYPE_OFF) {
499 elm_object_item_signal_emit((Elm_Object_Item *)ei, "elm,state,top", "");
503 cal_edit_alarm_data *p = item_data->p;
505 if (p && p->alarm_type == ALARM_TYPE_EVENT) {
506 if (item_data->type == _GTYPE_CUSTOMIZE)
507 elm_object_item_signal_emit((Elm_Object_Item *)ei, "elm,state,bottom", "");
509 elm_object_item_signal_emit((Elm_Object_Item *)ei, "elm,state,center", "");
511 if (item_data->type == _GTYPE_ON_A_DAY)
512 elm_object_item_signal_emit((Elm_Object_Item *)ei, "elm,state,bottom", "");
514 elm_object_item_signal_emit((Elm_Object_Item *)ei, "elm,state,center", "");
518 static int __cal_edit_alarm_add_alarm_content(cal_edit_alarm_data *p)
522 p->sc = elm_genlist_add(p->ly);
525 evas_object_smart_callback_add(p->sc, "realized", __cal_edit_alarm_genlist_realized_callback, NULL);
527 itc_seperator.item_style = "dialogue/separator/21/with_line";
528 itc_seperator.func.text_get = NULL;
529 itc_seperator.func.state_get = __cal_edit_alarm_get_genlist_item_state;
530 itc_seperator.func.del = __cal_edit_alarm_genlist_item_delete_callback;
532 itc_1text_1icon.item_style = "dialogue/1text.1icon.2";
533 itc_1text_1icon.func.del = __cal_edit_alarm_genlist_item_delete_callback;
534 itc_1text_1icon.func.content_get = __cal_edit_alarm_get_genlist_item_icon;
535 itc_1text_1icon.func.text_get = __cal_edit_alarm_get_genlist_item_label;
537 itc_custom.item_style = "dialogue/3icon.1text.custom";
538 itc_custom.func.del = __cal_edit_alarm_genlist_item_delete_callback;
539 itc_custom.func.content_get = __cal_edit_alarm_get_genlist_item_custom_icon;
540 itc_custom.func.text_get = __cal_edit_alarm_get_genlist_item_custom_label;
542 if(p->alarm_type == ALARM_TYPE_EVENT) {
543 p->radio_group = cal_radio_group_create(_GTYPE_MAX - 1, p->sc);
544 __cal_edit_alarm_append_genlist_item_event(p->sc, p, _GTYPE_SPEA, 0);
545 __cal_edit_alarm_append_genlist_item_event(p->sc, p, _GTYPE_OFF, -1);
546 __cal_edit_alarm_append_genlist_item_event(p->sc, p, _GTYPE_ON_TIME, 0);
547 __cal_edit_alarm_append_genlist_item_event(p->sc, p, _GTYPE_5_MIN, 5);
548 __cal_edit_alarm_append_genlist_item_event(p->sc, p, _GTYPE_15_MIN, 15);
549 __cal_edit_alarm_append_genlist_item_event(p->sc, p, _GTYPE_1_HOUR, _HOUR);
550 __cal_edit_alarm_append_genlist_item_event(p->sc, p, _GTYPE_1_DAY, _DAY);
551 __cal_edit_alarm_append_genlist_item_event(p->sc, p, _GTYPE_1_WEEK, _WEEK);
552 __cal_edit_alarm_append_genlist_item_event(p->sc, p, _GTYPE_CUSTOMIZE, 0);
554 p->radio_group = cal_radio_group_create(_GTYPE_MAX, p->sc);
555 __cal_edit_alarm_append_genlist_item_todo(p->sc, p, _GTYPE_SPEA, 0);
556 __cal_edit_alarm_append_genlist_item_todo(p->sc, p, _GTYPE_OFF, -1);
557 __cal_edit_alarm_append_genlist_item_todo(p->sc, p, _GTYPE_ON_TIME, 0);
558 __cal_edit_alarm_append_genlist_item_todo(p->sc, p, _GTYPE_5_MIN, 5);
559 __cal_edit_alarm_append_genlist_item_todo(p->sc, p, _GTYPE_15_MIN, 15);
560 __cal_edit_alarm_append_genlist_item_todo(p->sc, p, _GTYPE_1_HOUR, _HOUR);
561 __cal_edit_alarm_append_genlist_item_todo(p->sc, p, _GTYPE_1_DAY, _DAY);
562 __cal_edit_alarm_append_genlist_item_todo(p->sc, p, _GTYPE_1_WEEK, _WEEK);
563 __cal_edit_alarm_append_genlist_item_todo(p->sc, p, _GTYPE_CUSTOMIZE, 0);
564 p->on_a_day = cal_genlist_item_radio_timepicker_add(p->sc, p->radio_group, _GTYPE_ON_A_DAY,
565 p->reminder.tick_unit == CALENDAR_ALARM_TIME_UNIT_SPECIFIC, &p->reminder.datetime, p);
568 elm_object_part_content_set(p->ly, "sw", p->sc);
573 static void __cal_edit_alarm_set_radio(cal_edit_alarm_data *p, const Cal_Reminder* reminder)
577 p->reminder = *reminder;
579 switch(reminder->tick_unit)
581 case CALENDAR_ALARM_NONE:
582 cal_radio_group_select_radio(p->radio_group, _GTYPE_OFF);
584 case CALENDAR_ALARM_TIME_UNIT_SPECIFIC:
585 cal_radio_group_select_radio(p->radio_group, _GTYPE_ON_A_DAY);
587 case CALENDAR_ALARM_TIME_UNIT_MINUTE:
594 switch(reminder->alarm_value)
597 cal_radio_group_select_radio(p->radio_group, _GTYPE_ON_TIME);
600 cal_radio_group_select_radio(p->radio_group, _GTYPE_5_MIN);
603 cal_radio_group_select_radio(p->radio_group, _GTYPE_15_MIN);
606 cal_radio_group_select_radio(p->radio_group, _GTYPE_1_HOUR);
609 cal_radio_group_select_radio(p->radio_group, _GTYPE_1_DAY);
612 cal_radio_group_select_radio(p->radio_group, _GTYPE_1_WEEK);
615 cal_radio_group_select_radio(p->radio_group, _GTYPE_CUSTOMIZE);
619 int min = reminder->alarm_value;
621 if ((min % _WEEK) == 0)
626 else if ((min % _DAY) == 0)
631 else if ((min % _HOUR) == 0)
639 p->reminder.alarm_value = min;
642 static void __cal_edit_alarm_save_button_callback(void *data, Evas_Object *obj, void *event_info)
646 cal_edit_alarm_data *p = data;
648 if (p->alarm_changed_callback) {
650 int selected = cal_radio_group_get_selected_radio(p->radio_group);
652 p->reminder.tick_unit = CALENDAR_ALARM_TIME_UNIT_MINUTE;
655 p->reminder.tick_unit = CALENDAR_ALARM_NONE;
658 p->reminder.alarm_value = 0;
661 p->reminder.alarm_value = 5;
664 p->reminder.alarm_value = 15;
667 p->reminder.alarm_value = _HOUR;
670 p->reminder.alarm_value = _DAY;
673 p->reminder.alarm_value = _WEEK;
675 case _GTYPE_ON_A_DAY:
676 p->reminder.tick_unit = CALENDAR_ALARM_TIME_UNIT_SPECIFIC;
677 cal_genlist_item_radio_timepicker_get_time(p->on_a_day, &p->reminder.datetime);
679 case _GTYPE_CUSTOMIZE:
680 p->reminder.alarm_value *= cal_edit_alarm_button[p->bt_idx].unit;
687 p->alarm_changed_callback(&p->reminder, p->alarm_changed_callback_data);
689 elm_naviframe_item_pop(p->naviframe);
692 static void __cal_edit_alarm_cancel_button_callback(void *data, Evas_Object *obj, void *event_info)
696 c_retm_if(!data, "data is null");
698 cal_edit_alarm_data *p = data;
700 Ecore_IMF_Context *imf_context = elm_entry_imf_context_get((Evas_Object *)p->e_custom);
701 c_retm_if(!imf_context, "elm_entry_imf_context_get returned null");
703 Ecore_IMF_Input_Panel_State state = ecore_imf_context_input_panel_state_get(imf_context);
705 if(state == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
706 ecore_imf_context_input_panel_hide(imf_context);
709 elm_naviframe_item_pop(p->naviframe);
713 Evas_Object *cal_edit_alarm_create_view(Evas_Object *window, Evas_Object *conformant, Evas_Object *naviframe,
714 const Cal_Reminder* reminder, cal_edit_alarm_type alarm_type, cal_edit_alarm_changed_callback alarm_changed_callback, void* callback_data)
716 c_retv_if(!window, NULL);
717 c_retv_if(!conformant, NULL);
718 c_retv_if(!naviframe, NULL);
720 cal_edit_alarm_data *p;
724 p = calloc(1, sizeof(cal_edit_alarm_data));
725 c_retvm_if(!p, NULL, "p is null");
728 p->conformant = conformant;
729 p->naviframe = naviframe;
730 p->alarm_changed_callback = alarm_changed_callback;
731 p->alarm_changed_callback_data = callback_data;
732 p->alarm_type = alarm_type;
734 ly = cal_util_add_layout(naviframe, "edit");
741 evas_object_data_set(ly, "priv", p);
743 Elm_Object_Item* navi_item = elm_naviframe_item_push(p->naviframe, C_("IDS_CLD_BODY_REMINDER"), NULL, NULL, ly, NULL);
744 c_retv_if(!navi_item, NULL);
746 p->save_cancel = cal_save_cancel_create(p->window, p->conformant, p->naviframe,
747 __cal_edit_alarm_save_button_callback,
748 __cal_edit_alarm_cancel_button_callback, p);
750 cal_edit_alarm_button[0].plural_label = C_("IDS_TMR_BODY_MINS_LC_ABB");
751 cal_edit_alarm_button[1].plural_label = C_("IDS_CHATON_BODY_HOURS_LC_ABB");
752 cal_edit_alarm_button[2].plural_label = C_("IDS_CHATON_BODY_DAYS_LC_ABB");
753 cal_edit_alarm_button[3].plural_label = C_("IDS_COM_POP_WEEKS_LC");
755 cal_edit_alarm_button[0].label = C_("IDS_TMR_OPT_MIN_LC_ABB");
756 cal_edit_alarm_button[1].label = C_("IDS_CLD_BODY_HOUR_LC_ABB");
757 cal_edit_alarm_button[2].label = C_("IDS_CLD_BODY_DAY_LC_ABB");
758 cal_edit_alarm_button[3].label = C_("IDS_CLD_BODY_WEEK_LC_ABB");
760 r = __cal_edit_alarm_add_alarm_content(p);
767 __cal_edit_alarm_set_radio(p, reminder);
769 evas_object_event_callback_add(ly, EVAS_CALLBACK_DEL, __cal_edit_alarm_delete_layout, p);