void gl_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
- Elm_Object_Item *it = (Elm_Object_Item*)event_info;
- elm_genlist_item_selected_set(it, EINA_FALSE);
-
- void *item_data = elm_object_item_data_get(it);
- if(item_data && data && !strcmp(data, "app-notification-details"))
- {
- app_details_create_view(g_ug_data, (item_info_s*)item_data);
- return;
- }
+ Elm_Object_Item *it = (Elm_Object_Item*) event_info;
+ elm_genlist_item_selected_set(it, EINA_FALSE);
- Evas_Object *check = elm_object_item_part_content_get(it, "elm.swallow.end");
- if (!check) {
- check = elm_object_item_part_content_get(it, "elm.icon.right");
- }
+ if(data)
+ {
+ void *item_data = elm_object_item_data_get(it);
+ if(item_data && !strcmp(data, "app-notification-details"))
+ {
+ app_details_create_view(g_ug_data, (item_info_s*)item_data);
+ return;
+ }
- if (check) {
- elm_check_state_set(check, !elm_check_state_get(check));
- evas_object_smart_callback_call(check, "changed", NULL);
- }
+ if(!strcmp(data, "set-schedule-multiline"))
+ {
+ gl_set_schedule_selected(g_ug_data);
+ }
+
+ if(!strcmp(data, "allowed-calls"))
+ {
+ gl_allowed_calls_selected();
+ }
- if(data && !strcmp(data, "set-schedule-multiline")) {
- gl_set_schedule_selected(g_ug_data);
+ if(!strcmp(data, "start-time"))
+ {
+ create_start_time_popup();
+ }
+ if(!strcmp(data, "end-time"))
+ {
+ create_end_time_popup();
+ }
}
- if(data && !strcmp(data, "allowed-calls")) {
- gl_allowed_calls_selected();
- }
+ Evas_Object *check = elm_object_item_part_content_get(it, "elm.swallow.end");
+ if (!check)
+ {
+ check = elm_object_item_part_content_get(it, "elm.icon.right");
+ }
+
+ if (check)
+ {
+ elm_check_state_set(check, !elm_check_state_get(check));
+ evas_object_smart_callback_call(check, "changed", NULL);
+ }
}
void gl_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
datetime_s start_time_p, end_time_p;
-
static int default_dnd_schedule_weekday = 0;
static int new_dnd_schedule_weekday = 0;
-static int day = 0;
-
static void set_set_schedule(bool state);
static void enable_time_items(bool enable);
static Evas_Object *create_week_repeat_layout(Evas_Object* parent);
static void make_color_text(int dayCode, dnd_schedule_week_flag_e week_day, const char *text, char* outBuf);
static void save_dnd_weekday(int dayCode);
static bool same_time(struct tm* timeA, struct tm* timeB);
+static void create_popup(datetime_s *dt);
bool load_dnd_schedule_time(struct tm *start_time_out, struct tm *end_time_out)
{
{
char formattedDay[DAY_MAX_LENGTH] = { 0 };
if((dayCode & week_day) == 0)
- snprintf(formattedDay, DAY_MAX_LENGTH, GREY_TEXT_MAIN, text);
- else
snprintf(formattedDay, DAY_MAX_LENGTH, GREEN_TEXT_MAIN, text);
+ else
+ snprintf(formattedDay, DAY_MAX_LENGTH, GREY_TEXT_MAIN, text);
strncat(outBuf, formattedDay, DAY_MAX_LENGTH);
}
if(cc->change_color)
{
new_dnd_schedule_weekday ^= cc->week;
- snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, cc->text);
+ snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, cc->text);
elm_object_text_set(cc->label, buf);
}
else
{
new_dnd_schedule_weekday |= cc->week;
- snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, cc->text);
+ snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, cc->text);
elm_object_text_set(cc->label, buf);
}
evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- notification_system_setting_dnd_schedule_get_day(get_system_setting(), &day);
-
changecolor_s *cc = calloc(1, sizeof(changecolor_s));
cc->week = week;
cc->label = label;
if((default_dnd_schedule_weekday & week) == 0)
{
- snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, text);
+ snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, text);
cc->change_color = false;
}
else
{
- snprintf(buf, sizeof(buf), GREEN_TEXT_COLOR, text);
+ snprintf(buf, sizeof(buf), GREY_TEXT_COLOR, text);
cc->change_color = true;
}
elm_object_text_set(label, buf);
elm_datetime_value_get(dt->datetime, &dt->saved_time);
format = elm_datetime_format_get(dt->datetime);
- if(dt->saved_time.tm_hour == start_time_p.saved_time.tm_hour && dt->saved_time.tm_min == start_time_p.saved_time.tm_min)
+ if(dt->is_start_time)
notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
else
notification_system_setting_dnd_schedule_set_end_time(get_system_setting(), dt->saved_time.tm_hour, dt->saved_time.tm_min);
evas_object_smart_callback_add(set_btn, "clicked", popup_set_btn_clicked_cb, dt);
}
-static void launch_popup_cb(void *data , Evas_Object *obj , void *event_info)
+static void create_popup(datetime_s *dt)
{
- char *format;
- datetime_s *dt = data;
create_datetime_popup(dt);
Evas_Object *box = elm_box_add(dt->popup);
ug_data *ug_main = get_app_ui_data();
dt->datetime = elm_datetime_add(ug_main->naviframe);
- format = evas_object_data_get(obj, "format");
+ char *format = get_time_format() == time_format_12H ? TIME_12_FORMAT : TIME_24_FORMAT;
bool fmt12hours = !strcmp(format, TIME_12_FORMAT);
const char *fmt = fmt12hours ? TIME_12_LAYOUT : TIME_24_LAYOUT;
const char* timeMask = fmt12hours ? POPUP_TIME_12_FORMAT : POPUP_TIME_24_FORMAT;
evas_object_show(dt->popup);
}
+void create_start_time_popup()
+{
+ create_popup(&start_time_p);
+}
+
+void create_end_time_popup()
+{
+ create_popup(&end_time_p);
+}
+
+static void launch_popup_cb(void *data, Evas_Object *obj , void *event_info)
+{
+ datetime_s *dt = data;
+ create_popup(dt);
+}
+
static Evas_Object *create_time_button(Evas_Object *parent, const char *text, const char *format, datetime_s *dt)
{
Evas_Object *button = elm_button_add(parent);
+ evas_object_propagate_events_set(button, EINA_FALSE);
elm_object_text_set(button, text);
evas_object_show(button);
evas_object_data_set(button, "format", format);
if(is_start_time_item)
{
notification_system_setting_dnd_schedule_get_start_time(get_system_setting(), &dt.saved_time.tm_hour, &dt.saved_time.tm_min);
- if(dt.saved_time.tm_hour == 0 && dt.saved_time.tm_min == 0)
- {
- dt.saved_time.tm_hour = 22;
- notification_system_setting_dnd_schedule_set_start_time(get_system_setting(), dt.saved_time.tm_hour, dt.saved_time.tm_min);
- }
+ start_time_p = dt;
}
else
{
notification_system_setting_dnd_schedule_get_end_time(get_system_setting(), &dt.saved_time.tm_hour, &dt.saved_time.tm_min);
- if(dt.saved_time.tm_hour == 0 && dt.saved_time.tm_min == 0)
- {
- dt.saved_time.tm_hour = 8;
- notification_system_setting_dnd_schedule_set_end_time(get_system_setting(), dt.saved_time.tm_hour, dt.saved_time.tm_min);
- }
- }
-
- long int curr_end_time = (long int)mktime(&end_time_p.saved_time);
- long int curr_start_time = (long int)mktime(&start_time_p.saved_time);
- if(dt.is_start_time && curr_start_time == -1)
- start_time_p = dt;
- else if(!dt.is_start_time && curr_end_time == -1)
end_time_p = dt;
+ }
char *timeFormat = get_time_format() == time_format_12H ? TIME_12_FORMAT : TIME_24_FORMAT;
if(is_start_time_item)
elm_object_style_set(back_btn, "naviframe/back_btn/default");
evas_object_smart_callback_add(back_btn, "clicked", close_set_schedule_cb, ugd);
eext_object_event_callback_add(ugd->naviframe, EEXT_CALLBACK_BACK, close_set_schedule_cb, ugd);
+ load_dnd_schedule_day();
/* Push to naviframe */
ugd->list_sub = _create_set_schedule_disturb_gl(ugd);