TizenRefApp-6227 Add "Allowed calls" options into 25/73325/3 submit/tizen/20160608.081031
authorOleksander Kostenko <o.kostenko@samsung.com>
Tue, 7 Jun 2016 13:10:00 +0000 (16:10 +0300)
committerOleksander Kostenko <o.kostenko@samsung.com>
Wed, 8 Jun 2016 07:02:24 +0000 (10:02 +0300)
Change-Id: I033500eba4319b007de4727b896ce6ab207b6ddb
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
inc/allowed-calls.h [new file with mode: 0644]
project_def.prop
res/edje/reject_calls_popup.edc [new file with mode: 0644]
src/CMakeLists.txt
src/allowed-calls.c [new file with mode: 0644]
src/common-efl.c
src/do-not-disturb-efl.c

diff --git a/inc/allowed-calls.h b/inc/allowed-calls.h
new file mode 100644 (file)
index 0000000..a72f38a
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2009 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#ifndef __ALLOWED_CALLS_H__
+#define __ALLOWED_CALLS_H__
+
+#include <Evas.h>
+
+#include <Elementary.h>
+#include "log.h"
+#include "common-efl.h"
+
+void gl_allowed_calls_selected();
+
+#endif //__ALLOWED_CALLS_H__
index 0db53fe0391990b4cb62cdd75eafbb4b9cf82336..e82619dc9999699edcc82367f08712051eac1333 100644 (file)
@@ -9,7 +9,7 @@ type = app
 profile = mobile-3.0
 
 # C Sources
-USER_SRCS = src/common-efl.c src/do-not-disturb-efl.c src/notification-setting-info.c src/excepted-apps-efl.c src/main.c src/pkgmgr-setting-info.c src/set-schedule-info.c 
+USER_SRCS = src/common-efl.c src/do-not-disturb-efl.c src/notification-setting-info.c src/excepted-apps-efl.c src/main.c src/allowed-calls.c src/pkgmgr-setting-info.c src/set-schedule-info.c 
 USER_SRCS_ABS = 
 
 # EDC Sources
@@ -60,7 +60,7 @@ USER_EDCS_FONT_DIRS_ABS =
 # EDC Flags
 USER_EXT_EDC_KEYS = EDC0 
 
-USER_EXT_EDC0_EDCS = res/edje/repeat_weekly_item.edc res/edje/setting_notification.edc res/edje/time_button_layout.edc 
+USER_EXT_EDC0_EDCS = res/edje/repeat_weekly_item.edc res/edje/setting_notification.edc res/edje/reject_calls_popup.edc res/edje/time_button_layout.edc 
 USER_EXT_EDC0_EDCS_IMAGE_DIRS = edje/images 
 USER_EXT_EDC0_EDCS_IMAGE_DIRS_ABS = 
 USER_EXT_EDC0_EDCS_SOUND_DIRS = edje/sounds 
diff --git a/res/edje/reject_calls_popup.edc b/res/edje/reject_calls_popup.edc
new file mode 100644 (file)
index 0000000..528a444
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+*
+*  Licensed under the Apache License, Version 2.0 (the "License");
+*  you may not use this file except in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+*
+*/
+#define POPUP_CHECK_VIEW_LAYOUT_MIN_INC 0 280
+#define POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 15
+#define POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC 15
+#define POPUP_CHECK_VIEW_LAYOUT_CONTENT_MIN_INC 0 162
+#define POPUP_CHECK_VIEW_LAYOUT_BOTTOM_MIN_INC 0 98
+#define POPUP_CHECK_VIEW_SWALLOW_END_MIN_INC 50 50
+collections {
+   base_scale: 2.6;
+   group { name: "popup_checkview_layout";
+      parts {
+         part { name: "bg";
+            scale: 1;
+            type: SPACER;
+            description { state: "default" 0.0;
+               min: POPUP_CHECK_VIEW_LAYOUT_MIN_INC;
+               fixed: 1 0;
+            }
+         }
+         part { name: "pad_l";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 0;
+               fixed: 1 0;
+               rel1.relative: 0.0 0.0;
+               rel2.relative: 0.0 1.0;
+               align: 0.0 0.0;
+            }
+         }
+         part { name: "pad_r";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               min: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC 0;
+               fixed: 1 0;
+               rel1.relative: 1.0 0.0;
+               rel2.relative: 1.0 1.0;
+               align: 1.0 0.0;
+            }
+         }
+         part { name: "elm.swallow.content";
+            type: SWALLOW;
+            scale: 1;
+            description { state: "default" 0.0;
+               fixed: 0 1;
+               min: POPUP_CHECK_VIEW_LAYOUT_CONTENT_MIN_INC;
+               align: 0.5 0.0;
+               rel2 {
+                  relative: 1.0 0.0;
+                  to: "pad_b";
+               }
+            }
+         }
+         part { name: "pad_b";
+            type: SPACER;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 0.0 1.0;
+               min: POPUP_CHECK_VIEW_LAYOUT_BOTTOM_MIN_INC;
+               fixed: 0 1;
+               rel1.relative: 0.0 1.0;
+            }
+         }
+         part { name: "elm.swallow.end";
+            type: SWALLOW;
+            scale: 1;
+            description { state: "default" 0.0;
+               align: 0.0 0.5;
+               min: POPUP_CHECK_VIEW_SWALLOW_END_MIN_INC;
+               fixed: 1 1;
+               rel1 {
+                  relative: 1.0 1.0;
+                  to_x: "pad_l";
+                  to_y: "pad_b";
+               }
+               rel2 {
+                  relative: 0.0 0.0;
+                  to_x: "pad_r";
+                  to_y: "pad_b";
+               }
+            }
+         }
+      }
+   }
+}
\ No newline at end of file
index 66e70a29e4f1e13476529d49595bae8bef203c98..8488f735f3ec4624535d1b81d5fd42389c1dfac0 100644 (file)
@@ -7,6 +7,7 @@ SET(LIBDIR "${PREFIX}/lib")
 SET(VERSION 0.1.0)
 
 SET(SRCS
+    allowed-calls.c
        common-efl.c
        do-not-disturb-efl.c
        excepted-apps-efl.c
diff --git a/src/allowed-calls.c b/src/allowed-calls.c
new file mode 100644 (file)
index 0000000..d327d1a
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2009 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "allowed-calls.h"
+
+extern ug_data g_ug_data;
+
+static char *items[4] = {
+    "IDS_QP_TAB4_ALL_M_RECEIVED_ALL",
+    "IDS_CST_OPT_CONTACTS_ONLY",
+    "IDS_ST_MBODY_FAVOURITE_CONTACTS_ONLY_ABB",
+    "IDS_QP_TAB4_NONE_M_BLOCEKD"
+};
+
+static void popup_hide_cb(void *data, Evas_Object *obj, void *event_info)
+{
+    evas_object_del(obj);
+}
+
+static char *gl_text_get_cb(void *data, Evas_Object *obj, const char *part)
+{
+    int index = (int)data;
+    return strdup(APP_STRING(items[index]));
+}
+
+static void popup_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+    NOTISET_TRACE_BEGIN;
+    Evas_Object *popup = data;
+    //TODO: need to be implemented after API appear
+    evas_object_del(popup);
+}
+
+static void create_reject_calls_popup(const char *title_text, const char *content)
+{
+    Evas_Object *popup;
+    Evas_Object *layout;
+    Evas_Object *btn;
+    Evas_Object *scroller;
+    Evas_Object *label;
+    Evas_Object *check;
+    Evas_Object *win = g_ug_data.win;
+
+    popup = elm_popup_add(win);
+    elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+    elm_object_part_text_set(popup, "title,text", APP_STRING(title_text));
+    evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+    eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, popup_hide_cb, NULL);
+    evas_object_smart_callback_add(popup, "dismissed", popup_hide_cb, NULL);
+    evas_object_smart_callback_add(popup, "block,clicked", popup_hide_cb, NULL);
+
+    /* layout */
+    layout = elm_layout_add(popup);
+    char *res_path = app_get_resource_path();
+    if(res_path)
+    {
+        char edj_path[PATH_MAX] = { 0, };
+        snprintf(edj_path, PATH_MAX, "%s%s", res_path, "edje/reject_calls_popup.edj");
+        elm_layout_file_set(layout, edj_path, "popup_checkview_layout");
+        free(res_path);
+    }
+    evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+    /* ok button */
+    btn = elm_button_add(popup);
+    elm_object_style_set(btn, "bottom");
+    elm_object_text_set(btn, APP_STRING("IDS_TPLATFORM_ACBUTTON_DONE_ABB"));
+    elm_object_part_content_set(popup, "button1", btn);
+    evas_object_smart_callback_add(btn, "clicked", popup_btn_clicked_cb, popup);
+
+    /* check */
+    check = elm_check_add(popup);
+    elm_object_text_set(check, APP_STRING("IDS_ST_OPT_DONT_SHOW_AGAIN_ABB"));
+    elm_object_part_content_set(layout, "elm.swallow.end", check);
+
+    /* scroller */
+    scroller = elm_scroller_add(layout);
+    elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE);
+    elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+    elm_object_part_content_set(layout, "elm.swallow.content", scroller);
+
+    /* label */
+    label = elm_label_add(scroller);
+    elm_object_style_set(label, "popup/default");
+    elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
+    elm_object_text_set(label, APP_STRING(content));
+    evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
+    evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+    evas_object_show(label);
+    elm_object_content_set(scroller, label);
+
+    elm_object_content_set(popup, layout);
+
+    evas_object_show(popup);
+}
+
+static void all_item_clicked()
+{
+    NOTISET_TRACE_BEGIN;
+    //TODO: need to be implemented after API appear
+}
+
+static void contacts_only_clicked()
+{
+    NOTISET_TRACE_BEGIN;
+    create_reject_calls_popup("IDS_ST_HEADER_REJECT_CALLS_ABB2",
+            "IDS_ST_BODY_INCOMING_CALLS_FROM_CONTACTS_YOU_HAVE_NOT_ALLOWED_WILL_BE_REJECTED_AUTOMATICALLY");
+    //TODO: need to be implemented after API appear
+}
+
+static void favorite_contacts_only_clicked()
+{
+    NOTISET_TRACE_BEGIN;
+    create_reject_calls_popup("IDS_ST_HEADER_REJECT_CALLS_ABB2",
+            "IDS_ST_BODY_INCOMING_CALLS_FROM_CONTACTS_YOU_HAVE_NOT_ALLOWED_WILL_BE_REJECTED_AUTOMATICALLY");
+    //TODO: need to be implemented after API appear
+}
+
+static void none_item_clicked()
+{
+    NOTISET_TRACE_BEGIN;
+    create_reject_calls_popup("IDS_ST_HEADER_REJECT_ALL_CALLS_ABB",
+            "IDS_ST_POP_ALL_INCOMING_CALLS_WILL_BE_REJECTED_AUTOMATICALLY");
+    //TODO: need to be implemented after API appear
+}
+
+static void gl_sel_cb(void *data, Evas_Object *obj, void *event_info)
+{
+    Evas_Object *popup = data;
+    int index = 0;
+    Elm_Object_Item *item = event_info;
+
+    index = (int)elm_object_item_data_get(item);
+    switch (index)
+    {
+        case 0:
+            all_item_clicked();
+            break;
+        case 1:
+            contacts_only_clicked();
+            break;
+        case 2:
+            favorite_contacts_only_clicked();
+            break;
+        case 3:
+            none_item_clicked();
+            break;
+    }
+    evas_object_del(popup);
+}
+
+static void create_allow_calls_from_popup()
+{
+    NOTISET_TRACE_BEGIN;
+    static Elm_Genlist_Item_Class itc;
+    Evas_Object *popup;
+    Evas_Object *box;
+    Evas_Object *genlist;
+    int i;
+    Evas_Object *win = g_ug_data.win;
+
+    popup = elm_popup_add(win);
+    elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM);
+    elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+    elm_object_part_text_set(popup, "title,text", APP_STRING("IDS_ST_HEADER_ALLOW_CALLS_FROM_ABB"));
+    evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    evas_object_size_hint_align_set(popup, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+    eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, popup_hide_cb, NULL);
+    evas_object_smart_callback_add(popup, "dismissed", popup_hide_cb, NULL);
+    evas_object_smart_callback_add(popup, "block,clicked", popup_hide_cb, NULL);
+
+    /* box */
+    box = elm_box_add(popup);
+    elm_box_homogeneous_set(box, EINA_FALSE);
+    evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+    evas_object_show(box);
+    elm_object_content_set(popup, box);
+
+    /* genlist */
+    genlist = elm_genlist_add(box);
+
+    itc.item_style = "1line";;
+    itc.func.text_get = gl_text_get_cb;
+    itc.func.content_get = NULL;
+    itc.func.state_get = NULL;
+    itc.func.del = NULL;
+
+    for (i = 0; i < 4; i++) {
+        elm_genlist_item_append(genlist, &itc, (void *)i, NULL, ELM_GENLIST_ITEM_NONE, gl_sel_cb, popup);
+    }
+
+    evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+    elm_genlist_mode_set(genlist, ELM_LIST_EXPAND);
+    evas_object_show(genlist);
+    elm_box_pack_end(box, genlist);
+
+    evas_object_show(popup);
+}
+
+void gl_allowed_calls_selected()
+{
+    create_allow_calls_from_popup();
+}
index 0c732e4456e0a88adc93cd7de9d58802cd7519eb..7509bd4039d53734a0c9a74073bdf0dd39c1dd4d 100755 (executable)
@@ -18,6 +18,7 @@
 #include "pkgmgr-setting-info.h"
 #include "common-efl.h"
 #include "set-scedule-info.h"
+#include "allowed-calls.h"
 
 #define ICON_SIZE 82
 
@@ -113,8 +114,12 @@ void gl_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
        }
 
        if(data && !strcmp(data, "set-schedule-multiline")) {
-               gl_set_schedule_selected(&g_ug_data);
+           gl_set_schedule_selected(&g_ug_data);
     }
+
+       if(data && !strcmp(data, "allowed-calls")) {
+           gl_allowed_calls_selected();
+       }
 }
 
 void gl_contracted_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
@@ -374,6 +379,14 @@ static char *_gl_option_text_get_cb(void *data, Evas_Object *obj, const char *pa
            return strdup(APP_STRING("IDS_ST_BODY_START_TIME"));
        } else if(!strcmp(data, "end-time") && !strcmp("elm.text", part)) {
            return strdup(APP_STRING("IDS_ST_BODY_END_TIME"));
+       } else if(!strcmp(data, "allowed-calls")) {
+        if (!strcmp("elm.text.multiline", part)) {
+            snprintf(buf, sizeof(buf), "<font_size=30>%s</font_size>", APP_STRING("IDS_QP_TAB4_ALL_M_RECEIVED_ALL"));
+            return strdup(buf);
+        }
+           if (!strcmp("elm.text", part)) {
+            return strdup(APP_STRING("IDS_ST_MBODY_ALLOWED_CALLS_ABB"));
+        }
        }
 
        return NULL;
index c288b4ac607a9e6e7b0fcad916217827ca0aff8f..da0bd6ea1da5e5c32bf0f9d1ba96bc15a86fee26 100644 (file)
@@ -38,6 +38,7 @@ void do_not_disturb_append_item_in_list(Evas_Object* genlist)
 {
     append_gl_start_option(genlist, "multiline", "do-not-disturb");
     append_gl_start_option(genlist, "multiline", "set-schedule-multiline");
+    append_gl_start_option(genlist, "multiline", "allowed-calls");
     append_gl_full_item(genlist, do_not_disturb_allowed_apps_cont_cb, get_excepted_apps_list());
 }