setting-about: adjust to new gui 57/231857/3
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Fri, 24 Apr 2020 06:46:07 +0000 (08:46 +0200)
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Wed, 29 Apr 2020 12:19:21 +0000 (14:19 +0200)
* add enter-text popup control
* add info-popup control
* replace enter name page with popup
* remove unused code

Change-Id: If5b0247c89db4be97a05f6d0b2c741c7c9f3098e

resource/controls.edc [new file with mode: 0644]
resource/controls/popup.edc [new file with mode: 0644]
setting-about/src/setting-about-main.c
setting-common/CMakeLists.txt
setting-common/include/controls/common.h [new file with mode: 0644]
setting-common/include/controls/enter-text-popup.h [new file with mode: 0644]
setting-common/include/controls/info-popup.h [new file with mode: 0644]
setting-common/src/controls/common.c [new file with mode: 0644]
setting-common/src/controls/enter-text-popup.c [new file with mode: 0644]
setting-common/src/controls/info-popup.c [new file with mode: 0644]
src/CMakeLists.txt

diff --git a/resource/controls.edc b/resource/controls.edc
new file mode 100644 (file)
index 0000000..bb64725
--- /dev/null
@@ -0,0 +1,6 @@
+collections {
+       base_scale: 1.8;
+
+#include "controls/popup.edc"
+
+}
diff --git a/resource/controls/popup.edc b/resource/controls/popup.edc
new file mode 100644 (file)
index 0000000..447beae
--- /dev/null
@@ -0,0 +1,109 @@
+#define POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC 27
+#define POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC 15
+#define POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC 15
+#define POPUP_CONTENT_DEFAULT_PADDING_BOTTOM_MIN_INC 27
+#define POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC 32
+#define POPUP_TEXT_INPUTTEXT_VIEW_LAYOUT_BG_MIN_INC 480 159
+#define POPUP_TEXT_FONT_SIZE1 22
+#define POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC 38
+
+group { name: "popup_text_input_text";
+   styles {
+      style { name: "popup_input_style";
+         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE1" color=#000000 wrap=mixed text_class=tizen";
+         tag:  "br" "\n";
+         tag:  "tab" "\t";
+      }
+   }
+   parts {
+      part { name: "bg";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_TEXT_INPUTTEXT_VIEW_LAYOUT_BG_MIN_INC;
+         }
+      }
+      part { name: "pad_l_t";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            max: POPUP_CONTENT_DEFAULT_PADDING_LEFT_MIN_INC -1;
+            fixed: 1 1;
+            rel.to: "bg";
+            align: 0.0 0.0;
+         }
+      }
+      part { name: "pad_r_b";
+         type: SPACER;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC POPUP_CONTENT_DEFAULT_PADDING_TOP_MIN_INC;
+            max: POPUP_CONTENT_DEFAULT_PADDING_RIGHT_MIN_INC -1;
+            fixed: 1 1;
+            rel.to: "bg";
+            align: 1.0 1.0;
+         }
+      }
+      part { name: "elm.text.header";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC;
+            max: -1 POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC;
+            rel1 {
+               relative: 1.0 0.0;
+               to: "pad_l_t";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to_x: "pad_r_b";
+            }
+            text {
+               style: "popup_input_style";
+               min: 0 1;
+            }
+            align: 0.5 0.0;
+            color: 0 255 0 255;
+         }
+      }
+      part { name: "elm.swallow.content";
+         type: SWALLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            max: -1 POPUP_EDITFIELD_LAYOUT_MINMAX_HEIGHT_INC;
+            fixed: 0 1;
+            align: 0.0 0.0;
+            rel1{
+               relative: 0.0 1.0 ;
+               to: "elm.text.header";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to: "pad_r_b";
+            }
+         }
+      }
+      part { name: "elm.text.description";
+         type: TEXTBLOCK;
+         scale: 1;
+         description { state: "default" 0.0;
+            min: 0 POPUP_DESCRIPTION_DEFAULT_TEXT_FONT_SIZE_INC;
+            rel1 {
+               relative: 0.0 1.0;
+               to: "elm.swallow.content";
+            }
+            rel2 {
+               relative: 0.0 1.0;
+               to: "pad_r_b";
+            }
+            text {
+               style: "popup_input_style";
+               min: 0 1;
+            }
+            align: 0.5 1.0;
+         }
+      }
+   }
+}
index a267383e6286436a40191a7436a3fe957700e74d..95cd3fc46a698e12e850a38190549ed8848532f1 100755 (executable)
@@ -1,5 +1,4 @@
-/*
- * setting
+/* * setting
  *
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
  *
@@ -25,6 +24,8 @@
 
 #include "setting-about-main.h"
 #include "setting-about-status.h"
+#include "controls/enter-text-popup.h"
+#include "controls/info-popup.h"
 
 #define MAX_DEVICE_NAME_LEN            32
 
@@ -44,133 +45,6 @@ setting_view setting_view_about_main = {
                .cleanup = NULL
 };
 
-/**
- * @brief popup response callback fuc.
- *
- * @param data application context
- * @param obj Evas Object
- * @param event_info even type
- *
- * @return no return
- */
-static void __popup_rsp_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       SETTING_TRACE_BEGIN;
-       SettingAbout *ad = (SettingAbout *)data;
-       ret_if(!ad || !obj);
-
-       switch (btn_type(obj)) {
-       case POPUP_RESPONSE_OK: {
-               if (ad->popup) {
-                       ad->popup_showed_flag = FALSE;
-
-                       evas_object_del(ad->popup);
-                       ad->popup = NULL;
-               }
-               if (ad->item_dev_name && ad->item_dev_name->eo_check) {
-                       char *name_value = NULL;
-                       name_value = vconf_get_str(
-                                       VCONFKEY_SETAPPL_DEVICE_NAME_STR);
-                       if (NULL == name_value) {
-                               /*use the defaule name if get vconf failed*/
-                               name_value = (char *)g_strdup(
-                                               DEVICE_NAME_DEFAULT);
-                       }
-                       elm_object_focus_set(ad->item_dev_name->eo_check,
-                                       EINA_TRUE);
-                       /*for genlist update */
-                       elm_entry_entry_set(ad->item_dev_name->eo_check,
-                                       name_value);
-                       elm_entry_cursor_end_set(ad->item_dev_name->eo_check);
-                       G_FREE(ad->item_dev_name->sub_desc);/*release first */
-                       ad->item_dev_name->sub_desc = (char *)g_strdup(
-                                       name_value);
-                       FREE(name_value);
-                       SETTING_TRACE("ad->item_dev_name->sub_desc:%s",
-                                       ad->item_dev_name->sub_desc);
-                       Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)
-                                       elm_entry_imf_context_get(
-                                                       ad->item_dev_name->eo_check);
-                       if (imf_context)
-                               ecore_imf_context_input_panel_show(imf_context);
-
-               }
-               break;
-       }
-       default: {
-               break;
-       }
-       }
-
-}
-
-/**
- * @brief callback run for idler task to destroy an popup.
- *
- * @param data application context
- *
- * @return FALSE for call it once, TRUE for call once the CPU is in idler
- */
-static Eina_Bool __popup_remove_delay(void *data)
-{
-       SETTING_TRACE_BEGIN;
-       SettingAbout *ad = data;
-       if (ad->popup_space) {
-               evas_object_del(ad->popup_space);
-               ad->popup_space = NULL;
-               ad->popup_showed_flag = FALSE;
-       }
-       return FALSE;
-}
-
-/**
- * @brief callback for popup destory.
- *
- * @param data application context
- * @param e Evas handler
- * @param obj Evas object
- * @param event_info event type
- */
-static void __popup_del_cb(void *data, Evas *e, Evas_Object *obj,
-               void *event_info)
-
-{
-       SETTING_TRACE_BEGIN;
-       retm_if(data == NULL, "Data parameter is NULL");
-       SettingAbout *ad = (SettingAbout *)data;
-       ad->popup = NULL;
-       ad->popup_showed_flag = FALSE;
-}
-
-/**
- * @brief callback run for idler task to show an popup.
- *
- * @param data application context
- */
-static Eina_Bool __popup_show_delay(void *data)
-{
-       SETTING_TRACE_BEGIN;
-       retvm_if(data == NULL, FALSE, "Data parameter is NULL");
-       SettingAbout *ad = (SettingAbout *)data;
-
-       /* popup the message and display the original name if the input is
-        * empty*/
-       SETTING_TRACE("POP UP again");
-
-       if (NULL == ad->popup) {
-               ad->popup_showed_flag = true;
-               ad->popup = setting_create_popup(ad, ad->md.window,
-                               "IDS_ST_HEADER_ENTER_VALID_DEVICE_NAME_ABB",
-                               "IDS_ST_POP_YOU_MUST_ENTER_A_DEVICE_NAME",
-                               __popup_rsp_cb, 0, FALSE, FALSE,
-                               1, "IDS_ST_BUTTON_OK_ABB");
-               evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_DEL,
-                               __popup_del_cb, ad);
-       }
-
-       return FALSE;
-}
-
 /**
  * @brief callback run for idler task to destroy an popup.
  *
@@ -369,401 +243,6 @@ static int __stat_get_cpuinfo(char *szStr, int nSize)
        return 0;
 }
 
-/**
- * @brief button done response callback.
- *
- * @param data application data
- * @param obj the button evas object
- * @param event_info event type
- */
-static void __naviframe_btn_done_cb(void *data, Evas_Object *obj,
-               void *event_info)
-{
-       SETTING_TRACE_BEGIN;
-       setting_retm_if(data == NULL, "data is NULL");
-       SettingAbout *ad = (SettingAbout *)data;
-       const char *entry_str = NULL;
-       char *entry_str_utf8 = NULL;
-       char *name_value = NULL;
-
-       if (ad->item_dev_name && ad->item_dev_name->eo_check) {
-               entry_str = elm_entry_entry_get(ad->item_dev_name->eo_check);
-               if (entry_str)
-                       entry_str_utf8 = elm_entry_markup_to_utf8(entry_str);
-
-               name_value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
-
-               if (!ad->empty_flag
-                               && safeStrCmp(name_value, entry_str_utf8) != 0) {
-                       if (0 != vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
-                                       entry_str_utf8)) {
-                               SETTING_TRACE_ERROR("Set vconf[%s] failed",
-                                               VCONFKEY_SETAPPL_DEVICE_NAME_STR);
-                       }
-               }
-               if (EINA_TRUE == elm_object_focus_get(
-                                       ad->item_dev_name->eo_check)) {
-                       elm_object_focus_set(ad->item_dev_name->eo_check,
-                                       EINA_FALSE);
-               }
-               free(name_value);
-               free(entry_str_utf8);
-       }
-       elm_naviframe_item_pop(ad->md.naviframe);
-       SETTING_TRACE_END;
-}
-
-/**
- * @brief button cancel response callback.
- *
- * @param data application data
- * @param obj the button evas object
- * @param event_info event type
- */
-static void __naviframe_btn_cancel_cb(void *data, Evas_Object *obj,
-               void *event_info)
-{
-       SETTING_TRACE_BEGIN;
-       setting_retm_if(data == NULL, "data is NULL");
-       char *name = NULL;
-       char *pa_sub_desc = NULL;
-       SettingAbout *ad = (SettingAbout *)data;
-       if (ad->item_dev_name && ad->item_dev_name->eo_check) {
-               name = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
-               if (name)
-                       pa_sub_desc = elm_entry_utf8_to_markup(name);
-
-               if (pa_sub_desc) {
-                       elm_entry_entry_set(ad->item_dev_name->eo_check,
-                                       pa_sub_desc);
-                       G_FREE(ad->item_dev_name->sub_desc);/*release first */
-                       ad->item_dev_name->sub_desc = (char *)g_strdup(
-                                       pa_sub_desc);
-               }
-               free(name);
-               free(pa_sub_desc);
-
-               if (isSpaceStr(ad->item_dev_name->sub_desc))
-                       ad->empty_flag = TRUE;
-               else
-                       ad->empty_flag = FALSE;
-
-               SETTING_TRACE("ad->item_dev_name->sub_desc:%s",
-                               ad->item_dev_name->sub_desc);
-               if (EINA_TRUE
-                               == elm_object_focus_get(
-                                               ad->item_dev_name->eo_check)) {
-                       elm_object_focus_set(ad->item_dev_name->eo_check,
-                                       EINA_FALSE);
-               }
-       }
-       elm_naviframe_item_pop(ad->md.naviframe);
-       SETTING_TRACE_END;
-}
-static void __popup_cb(void *data, Evas_Object *obj,
-               void *event_info)
-{
-       SETTING_TRACE_BEGIN;
-       setting_retm_if(obj == NULL, "obj parameter is NULL");
-       setting_retm_if(data == NULL, "Data parameter is NULL");
-       SettingAbout *ad = (SettingAbout *)data;
-
-       switch (btn_type(obj)) {
-       case POPUP_RESPONSE_OK:
-               if (ad->popup_space) {
-                       ad->popup_showed_flag = FALSE;
-                       evas_object_del(ad->popup_space);
-                       ad->popup_space = NULL;
-               }
-               break;
-       default:
-               break;
-       }
-}
-
-/**
- * @brief device name entry input handing
- *     - get the current entry text
- *     - check if the current input text is reached to max length
- *       and show messge to user
- *
- * @param data application data
- * @param obj the entry evas object
- */
-static void __entry_changed_cb(void *data, Evas_Object *obj)
-{
-       retm_if(!data || !obj, "Data parameter is NULL");
-       /*return if entry is not focused too */
-
-       Setting_GenGroupItem_Data *list_item =
-                       (Setting_GenGroupItem_Data *)data;
-       SettingAbout *ad = list_item->userdata;
-       retm_if(ad == NULL, "Data parameter is NULL");
-
-       const char *entry_str = elm_entry_entry_get(obj);
-       int entry_len = safeStrLen(entry_str);
-       SETTING_TRACE("entry_str:[%s], lenght:%d", entry_str, entry_len);
-
-       SETTING_TRACE("maxLengthReachFlag:[%d], enterKeyPressFlag:%d",
-                       list_item->maxLengthReachFlag,
-                       list_item->enterKeyPressFlag);
-
-       /*fix PLM P131106-02776
-        after keyboard popup cut the entry text, the entry text don't reach
-        max length, so need to delete popup */
-       if (ad->popup_showed_flag && ad->popup_space
-                       && !list_item->maxLengthReachFlag) {
-               evas_object_del(ad->popup_space);
-               ad->popup_space = NULL;
-               ad->popup_showed_flag = FALSE;
-
-       }
-
-       list_item->maxLengthReachFlag = FALSE;
-       list_item->enterKeyPressFlag = FALSE;
-       list_item->spaceKeyPressFlag = FALSE;
-
-       /*for genlist update */
-       G_FREE(list_item->sub_desc);/*release first */
-       list_item->sub_desc = (char *)g_strdup(entry_str);
-
-       if (isSpaceStr(entry_str)) {
-               if (!ad->empty_flag)
-                       ad->empty_flag = TRUE;
-       } else {
-               if (ad->empty_flag)
-                       ad->empty_flag = FALSE;
-       }
-}
-
-/**
- * @brief device name entry changed callback.
- *
- * @param data application data
- * @param obj the entry evas object
- * @param event_info event type
- */
-static void __entry_device_name_changed_cb(void *data, Evas_Object *obj,
-               void *event_info)
-{
-       /*SETTING_TRACE_BEGIN; */
-       setting_retm_if(obj == NULL, "obj is NULL");
-       setting_retm_if(data == NULL, "data is NULL");
-       Setting_GenGroupItem_Data *list_item =
-                       (Setting_GenGroupItem_Data *)data;
-       SettingAbout *ad = list_item->userdata;
-       retm_if(ad == NULL, "Data parameter is NULL");
-
-       /* 1. entry is empty */
-       /* 2. entry is not empty */
-       if (list_item->item) {
-               if (elm_entry_is_empty(obj)) {
-                       elm_object_item_signal_emit(list_item->item,
-                                       "elm,state,eraser,hide", "");
-               } else {
-                       Eina_Bool device_focus_status = elm_object_focus_get(
-                                       ad->item_dev_name->eo_check);
-                       if (device_focus_status)
-                               elm_object_item_signal_emit(list_item->item,
-                                               "elm,state,eraser,show", "");
-               }
-               elm_object_item_signal_emit(list_item->item,
-                               "elm,state,guidetext,hide", "");
-       }
-
-       __entry_changed_cb(data, obj);
-       /*SETTING_TRACE_END; */
-}
-
-/**
- * @brief device name entry focus callback.
- *
- * @param data application data
- * @param obj the entry evas object
- * @param event_info event type
- *
- * Focused callback will show X marked button and hide guidetext.
- */
-static void __entry_focused(void *data, Evas_Object *obj, void *event_info)
-{
-       SETTING_TRACE_BEGIN;
-       retm_if(!data || !obj, "Data parameter is NULL");
-       Setting_GenGroupItem_Data *item_dev_name = data;
-
-       /* accessibiliy */
-       elm_entry_cursor_end_set(obj);
-       const char *txt = elm_entry_entry_get(obj);
-       if (!txt || 0 == strlen(txt))
-               txt = elm_object_part_text_get(obj, "elm.guide");
-
-       /* Say entry focused */
-       Eina_Stringshare *str = eina_stringshare_printf(
-                       "%s, Edit Field, Keyboard opened", txt);
-       elm_access_say((char *)str);
-       eina_stringshare_del(str);
-
-       SettingAbout *ad = item_dev_name->userdata;
-       retm_if(!ad, "ad parameter is NULL");
-       Ecore_IMF_Context *imf_context =
-                       (Ecore_IMF_Context *)elm_entry_imf_context_get(
-                                       item_dev_name->eo_check);
-       if (imf_context)
-               ecore_imf_context_input_panel_show(imf_context);
-}
-
-/**
- * @brief device name entry unfocus callback.
- *
- * @param data application data
- * @param obj the entry evas object
- * @param event_info event type
- */
-static void __entry_unfocus_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       SETTING_TRACE_BEGIN;
-       retm_if(!data || !obj, "Data parameter is NULL");
-
-       const char *entry_str = elm_entry_entry_get(obj);
-       char *entry_str_utf8 = NULL;
-       entry_str_utf8 = elm_entry_markup_to_utf8(entry_str);
-       SETTING_TRACE("To store \"%s\" into vconf[%s]", entry_str_utf8,
-                       VCONFKEY_SETAPPL_DEVICE_NAME_STR);
-
-       Setting_GenGroupItem_Data *item_dev_name = data;
-       SettingAbout *ad = item_dev_name->userdata;
-
-       if (isSpaceStr(entry_str)) {
-               if (!ad->empty_flag)
-                       ad->empty_flag = TRUE;
-       } else {
-               if (ad->empty_flag)
-                       ad->empty_flag = FALSE;
-       }
-
-       if (item_dev_name->enterKeyPressFlag == TRUE) {
-               char *name_value = vconf_get_str(
-                               VCONFKEY_SETAPPL_DEVICE_NAME_STR);
-               if (!ad->empty_flag
-                               && safeStrCmp(name_value, entry_str_utf8) != 0) {
-                       if (0 != vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
-                                       entry_str_utf8)) {
-                               SETTING_TRACE_ERROR("Set vconf[%s] failed",
-                                               VCONFKEY_SETAPPL_DEVICE_NAME_STR);
-                       }
-               }
-               if (EINA_TRUE
-                               == elm_object_focus_get(
-                                               ad->item_dev_name->eo_check)) {
-                       elm_object_focus_set(ad->item_dev_name->eo_check,
-                                       EINA_FALSE);
-               }
-               FREE(name_value);
-       }
-       setting_hide_input_pannel_cb(item_dev_name->eo_check);
-
-       FREE(entry_str_utf8);
-       elm_entry_select_none(obj);
-       SETTING_TRACE_END;
-}
-
-/**
- * @brief device name entry activated callback (on Done pressed on keyboard).
- *
- * @param data application data SettingAbout structure
- * @param obj the entry evas object
- * @param event_info event type
- */
-static void __entry_activated_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       SETTING_TRACE_BEGIN;
-       retm_if(!data || !obj, "Data parameter is NULL");
-
-       Setting_GenGroupItem_Data *item_dev_name = data;
-       SettingAbout *ad = item_dev_name->userdata;
-       __naviframe_btn_done_cb(ad, obj, event_info);
-}
-
-/**
- * @brief device name entry max length reached callback.
- *
- * @param data application data
- * @param obj the entry evas object
- * @param event_info event type
- */
-static void __entry_max_len_reached(void *data, Evas_Object *obj,
-               void *event_info)
-{
-       SETTING_TRACE_BEGIN;
-       retm_if(data == NULL, "Data parameter is NULL");
-       /*notify only when entry is being focused on. */
-       retm_if(!elm_object_focus_get(obj), "Entry is not focused");
-
-       Setting_GenGroupItem_Data *list_item =
-                       (Setting_GenGroupItem_Data *)data;
-       list_item->maxLengthReachFlag = true;
-
-       SettingAbout *ad = list_item->userdata;
-       if (list_item->maxLengthReachFlag
-                       && list_item->enterKeyPressFlag == FALSE) {
-
-               if (!ad->popup_showed_flag && NULL == ad->popup_space) {
-                       /*workaroud to fix popup blink issue. */
-                       ad->popup_showed_flag = TRUE;
-                       char strMax[BUF_SIZE] = { 0, };
-                       snprintf(strMax, BUF_SIZE,
-                                       _("IDS_ST_POP_THE_MAXIMUM_NUMBERS_OF_CHARACTERS_FOR_YOUR_DEVICE_NAME_HPD_HAS_BEEN_EXCEEDED"),
-                                       MAX_DEVICE_NAME_LEN);
-
-                       ad->popup_space = setting_create_popup(ad,
-                                       ad->md.window,
-                                       "IDS_ST_HEADER_ENTER_VALID_DEVICE_NAME_ABB",
-                                       strMax, __popup_cb,
-                                       0, FALSE, FALSE, 1,
-                                       "IDS_ST_BUTTON_OK_ABB");
-               }
-       }
-}
-
-/**
- * @brief device name entry input panel state event call back
- *     - input panel state event:ECORE_IMF_INPUT_PANEL_STATE_EVENT
- *
- * @param data application data
- * @param obj the entry evas object
- * @param event_info event type
- */
-static void __entry_input_panel_event_cb(void *data, Ecore_IMF_Context *ctx,
-               int value)
-{
-       SETTING_TRACE_BEGIN;
-       retm_if(data == NULL, "Data parameter is NULL");
-       retm_if(ctx == NULL, "obj parameter is NULL");
-       SettingAbout *ad = (SettingAbout *)data;
-
-       if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
-               SETTING_TRACE("value == ECORE_IMF_INPUT_PANEL_STATE_SHOW");
-       } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
-               SETTING_TRACE("value == ECORE_IMF_INPUT_PANEL_STATE_HIDE");
-
-               if (ad->item_dev_name) {
-                       if (ad->empty_flag) {
-                               ad->idler_add_popup = ecore_idler_add(
-                                               __popup_show_delay,
-                                               ad);
-                       }
-               }
-               /*if Setting is overlapped by other app,the entry will lost
-                * its focus, the input pannel will be hided and any popup
-                * should be removed to fix blinking issue.*/
-               if (ad->pause_flag) {
-                       ad->idler_remove_popup = ecore_idler_add(
-                                       __popup_remove_delay, ad);
-               }
-               elm_object_focus_set(ad->md.naviframe, EINA_FALSE);
-
-       }
-}
-
 /**
  * @brief About vconf changed callback
  *
@@ -847,188 +326,36 @@ static void __certificates_clicked(void *data)
        app_control_destroy(svc);
 }
 
-static Eina_Bool __child_view_back_cb(void *data, Elm_Object_Item *it)
+static void _device_name_accepted_popup_callback(void *user_data, Evas_Object *obj, void *event_info)
 {
-       SETTING_TRACE_BEGIN;
-       SettingAbout *ad = data;
-       retv_if(!ad, EINA_TRUE);
+       char strMax[BUF_SIZE] = { 0, };
+       SettingAbout *ad = user_data;
 
-       if (ad->empty_flag)
-               return EINA_FALSE;
+       const char *text = enter_text_popup_text_get(obj);
+       if (!text || strlen(text) == 0) {
+               Evas_Object *popup = info_popup_create(ad->md.window);
+               info_popup_title_set(popup, _("IDS_ST_HEADER_ENTER_VALID_DEVICE_NAME_ABB"));
+               info_popup_ok_text_set(popup, _("IDS_ST_BUTTON_OK_ABB"));
+               evas_object_show(popup);
+       } else if (strlen(text) > MAX_DEVICE_NAME_LEN) {
+               snprintf(strMax, BUF_SIZE,
+                               _("IDS_ST_POP_THE_MAXIMUM_NUMBERS_OF_CHARACTERS_FOR_YOUR_DEVICE_NAME_HPD_HAS_BEEN_EXCEEDED"),
+                               MAX_DEVICE_NAME_LEN);
 
-       if (ad->event_handler) {
-               ecore_event_handler_del(ad->event_handler);
-               ad->event_handler = NULL;
-       }
-       if (ad->name_update_idler) {
-               ecore_idler_del(ad->name_update_idler);
-               ad->name_update_idler = NULL;
-       }
-       return EINA_TRUE;
-}
-
-static Eina_Bool __name_view_key_down(void *data, int type, void *event)
-{
-       SETTING_TRACE_BEGIN;
-       Evas_Event_Key_Down *ev = event;
-
-       retv_if(!ev || !data, ECORE_CALLBACK_RENEW);
-
-       SettingAbout *ad = data;
-       if (!strcmp(ev->keyname, "XF86Back"))
-               __naviframe_btn_cancel_cb(ad, NULL, NULL);
-
-       return ECORE_CALLBACK_RENEW;
-}
-
-static Eina_Bool __name_focus_update_cb(void *data)
-{
-       SETTING_TRACE_BEGIN;
-       /* error check */
-       setting_retvm_if(data == NULL, ECORE_CALLBACK_RENEW,
-                       "Data parameter is NULL");
-       SettingAbout *ad = data;
-       if (ad->item_dev_name && ad->item_dev_name->eo_check) {
-               evas_object_show(ad->item_dev_name->eo_check);
-               elm_object_focus_set(ad->item_dev_name->eo_check, EINA_TRUE);
-
-               ad->name_update_idler = NULL;
-               return ECORE_CALLBACK_CANCEL;
+               Evas_Object *popup = info_popup_create(ad->md.window);
+               info_popup_title_set(popup, _("IDS_ST_HEADER_ENTER_VALID_DEVICE_NAME_ABB"));
+               info_popup_text_set(popup, strMax);
+               info_popup_ok_text_set(popup, _("IDS_ST_BUTTON_OK_ABB"));
+               evas_object_show(popup);
        } else {
-               return ECORE_CALLBACK_RENEW;
-       }
-}
-
-
-static Evas_Object *__add_entry_without_layout(
-               Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
-{
-       SETTING_TRACE_BEGIN;
-
-       /* resolve abnormal height issue */
-       elm_genlist_mode_set(parent, ELM_LIST_COMPRESS);
-       Evas_Object *entry = NULL;
-       item_data->eo_check = entry = elm_entry_add(parent);
-       if (item_data->isPasswordFlag)
-               elm_entry_password_set(entry, EINA_TRUE);
-       else if (item_data->isSinglelineFlag)
-               elm_entry_single_line_set(entry, EINA_TRUE);
-       else
-               elm_entry_single_line_set(entry, EINA_FALSE);
-
-       elm_entry_scrollable_set(entry, EINA_TRUE);
-
-       evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND,
-                       EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       if (item_data->focus_unallowed)
-               elm_object_focus_allow_set(entry, EINA_FALSE);
-
-       elm_entry_input_panel_layout_set(entry, item_data->input_type);
-       elm_entry_prediction_allow_set(entry, FALSE);
-       elm_entry_input_panel_return_key_type_set(entry,
-                       item_data->return_key_type);
-       if (item_data->disable_auto_cap) {
-               elm_entry_autocapital_type_set(entry,
-                               ELM_AUTOCAPITAL_TYPE_NONE);
-       }
-
-       if (item_data->isSinglelineFlag) {
-               elm_entry_single_line_set(entry, EINA_TRUE);
-               elm_object_signal_emit(entry, "elm,state,scroll,enabled", "");
-       }
-
-       if (item_data->limit_filter_data) {
-               elm_entry_markup_filter_append(entry,
-                               elm_entry_filter_limit_size,
-                               item_data->limit_filter_data);
-
-               if (item_data->maxlength_reached_cb) {
-                       evas_object_smart_callback_add(entry,
-                                       "maxlength,reached",
-                                       item_data->maxlength_reached_cb,
-                                       item_data);
-               }
-       }
-
-       if (item_data->stop_change_cb) {/*invoked when stop focusing on */
-               evas_object_smart_callback_add(entry, "unfocused",
-                               item_data->stop_change_cb, item_data);
-       }
-
-       if (item_data->digits_filter_data) {
-               elm_entry_markup_filter_append(entry,
-                               elm_entry_filter_accept_set,
-                               item_data->digits_filter_data);
-       }
-
-       if (item_data->sub_desc && safeStrLen(item_data->sub_desc) > 0) {
-               elm_entry_entry_set(entry, item_data->sub_desc);
-       } else {
-               if (item_data->guide_text) {
-                       /* Add guide text to elm_entry. */
-                       elm_object_part_text_set(entry, "elm.guide",
-                                       _(item_data->guide_text));
-               } else {
-                       elm_object_part_text_set(entry, "elm.guide",
-                                       _("IDS_ST_BODY_TAP_TO_INSERT"));
-               }
-       }
-
-       /* for Setting App, All the entrys's context popup shouldn't be able */
-       /* to insert images, text is the only one can be inserted. */
-       elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
-
-       if (item_data->chk_change_cb) {
-               evas_object_smart_callback_add(entry, "changed",
-                               item_data->chk_change_cb, item_data);
-               evas_object_smart_callback_add(entry, "preedit,changed",
-                               item_data->chk_change_cb, item_data);
-       }
-
-       /* callback for handling enter key */
-       if (item_data->activated_cb) {
-               evas_object_smart_callback_add(entry, "activated",
-                               item_data->activated_cb, item_data);
+               vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR, text);
+               evas_object_del(obj);
        }
-
-       if (item_data->focus_cb) {
-               evas_object_smart_callback_add(entry, "focused",
-                               item_data->focus_cb, item_data);
-       }
-
-       if (item_data->start_change_cb)
-               evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN,
-                               (Evas_Object_Event_Cb)(item_data->start_change_cb),
-                               item_data->userdata);
-
-       Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)
-                       elm_entry_imf_context_get(entry);
-       if (imf_context && item_data->x_callback_cb)
-               ecore_imf_context_input_panel_event_callback_add(imf_context,
-                               ECORE_IMF_INPUT_PANEL_STATE_EVENT,
-                               item_data->x_callback_cb, item_data->userdata);
-
-       if (item_data->input_panel_disable_flag)
-               elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
-
-       if (entry && item_data->entry_auto_focus) {
-               evas_object_show(entry);
-               elm_object_focus_set(entry, EINA_TRUE);
-       }
-
-       return entry;
 }
 
-static Evas_Object *__device_name_genlist_content_get(void *data,
-               Evas_Object *genlist, const char *part)
+static void _device_name_rejected_popup_callback(void *user_data, Evas_Object *obj, void *event_info)
 {
-       Evas_Object *entry = NULL;
-       retv_if(!data || !genlist, NULL);
-       if (!safeStrCmp(part, "elm.icon.entry"))
-               entry = __add_entry_without_layout(data, genlist);
-
-       return entry;
+       evas_object_del(obj);
 }
 
 /**
@@ -1037,122 +364,21 @@ static Evas_Object *__device_name_genlist_content_get(void *data,
 static void __creat_name_view(void *data)
 {
        SETTING_TRACE_BEGIN;
-       Evas_Object *list = NULL;
-       Evas_Object *btn = NULL;
-       Elm_Object_Item *navi_it = NULL;
-       Setting_GenGroupItem_Data *item_data = NULL;
-       SettingAbout *ad = data;
-       /* error check */
-       setting_retm_if(data == NULL, "Data parameter is NULL");
 
-       list = elm_genlist_add(ad->md.naviframe);
-       setting_retm_if(list == NULL,
-                       "Cannot set scroller object  as content of layout");
-       elm_genlist_clear(list);        /* first to clear list */
-
-       elm_genlist_mode_set(list, ELM_LIST_COMPRESS);
-       evas_object_smart_callback_add(list, "realized", __gl_realized_cb,
-                       NULL);
-       evas_object_smart_callback_add(list, "language,changed", __gl_language_changed_cb,
-                       NULL);
-       /* Device name */
-       char *name_value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
-       char *pa_sub_desc = elm_entry_utf8_to_markup(name_value);
-       FREE(name_value);
-
-       ad->empty_flag = FALSE;
-       if (NULL == pa_sub_desc || '\0' == pa_sub_desc[0])
-               ad->empty_flag = TRUE;
-
-       elm_theme_extension_add(NULL, EDJDIR"/gl-item-entry-main.edj");
-       setting_create_Gendial_itc(SETTING_GENLIST_ENTRY_STYLE,
-                       &(ad->itc_editfield));
-       ad->itc_editfield.func.content_get = __device_name_genlist_content_get;
-
-       /* add genlist item here for the device name */
-       item_data = setting_create_Gendial_field_editfield(
-                       list,
-                       &(ad->itc_editfield),
-                       NULL,
-                       ad,
-                       SWALLOW_Type_LAYOUT_EDITFIELD,
-                       "IDS_ST_BODY_NAME",
-                       pa_sub_desc,
-                       __entry_device_name_changed_cb,
-                       __entry_focused,
-                       __entry_unfocus_cb,
-                       __entry_activated_cb,
-                       __entry_max_len_reached,
-                       ELM_INPUT_PANEL_LAYOUT_NORMAL,
-                       false,
-                       false,
-                       MAX_DEVICE_NAME_LEN,
-                       0,
-                       NULL,
-                       NULL);
-
-       if (!item_data)
-               FREE(pa_sub_desc);
-
-       setting_retm_if(!item_data, "calloc failed");
-       item_data->swallow_type = SWALLOW_Type_LAYOUT_EDITFIELD;
-       item_data->isSinglelineFlag = TRUE;
-       item_data->x_callback_cb = __entry_input_panel_event_cb;
-       item_data->guide_text = (char *)g_strdup(EMPTY_LIMITATION_STR);
-       item_data->focus_unallowed = get_tethering_status();
-       item_data->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
-
-       item_data->limit_filter_data = calloc(1,
-                       sizeof(Elm_Entry_Filter_Limit_Size));
-       if (item_data->limit_filter_data) {
-               /*max byte len is 32 -> MAX_DEVICE_NAME_LEN */
-               item_data->limit_filter_data->max_byte_count =
-                               MAX_DEVICE_NAME_LEN;
-               item_data->window = ad->md.window;
-       } else {
-               SETTING_TRACE_ERROR("fail to calloc");
-       }
-
-       item_data->digits_filter_data = calloc(1,
-                       sizeof(Elm_Entry_Filter_Accept_Set));
-       if (item_data->digits_filter_data)
-               item_data->digits_filter_data->accepted = NULL;
-       else
-               SETTING_TRACE_ERROR("fail to calloc");
-
-       item_data->input_panel_disable_flag = EINA_FALSE;
-
-       ad->item_dev_name = item_data;
-
-       __BACK_POINTER_SET(ad->item_dev_name);
-       elm_genlist_item_select_mode_set(ad->item_dev_name->item,
-                       ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+       SettingAbout *ad = data;
 
-       FREE(pa_sub_desc);
+       Evas_Object *popup = enter_text_popup_create(ad->md.naviframe);
+       enter_text_popup_title_set(popup, "Rename device");
+       enter_text_popup_confirm_text_set(popup, "ADD");
+       enter_text_popup_reject_text_set(popup, "CANCEL");
+       enter_text_popup_description_set(popup, "Device names are displayed to distinguish each of the devices available via Bluetooth, Wi-Fi Direct, and other methods.");
+       enter_text_popup_header_set(popup, "Name");
+       enter_text_popup_guide_text_set(popup, "Device name");
+       evas_object_smart_callback_add(popup, "confirmed", _device_name_accepted_popup_callback, ad);
+       evas_object_smart_callback_add(popup, "rejected", _device_name_rejected_popup_callback, ad);
+       evas_object_show(popup);
 
-       navi_it = setting_push_to_naviframe_with_back_button(DEVICE_NAME,
-                       NULL, NULL, ad, list, ad->md.naviframe);
-       elm_naviframe_item_pop_cb_set(navi_it,
-                       __child_view_back_cb, ad);
-
-       /* Title Cancel Button */
-       btn = elm_button_add(ad->md.naviframe);
-       elm_object_style_set(btn, "naviframe/title_cancel");
-       evas_object_smart_callback_add(btn, "clicked",
-                       __naviframe_btn_cancel_cb, ad);
-       elm_object_item_part_content_set(navi_it, "title_left_btn", btn);
-
-       /* Title Done Button */
-       btn = elm_button_add(ad->md.naviframe);
-       elm_object_style_set(btn, "naviframe/title_done");
-       evas_object_smart_callback_add(btn, "clicked",
-                       __naviframe_btn_done_cb, ad);
-       elm_object_item_part_content_set(navi_it, "title_right_btn", btn);
-
-       ad->event_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
-                       __name_view_key_down, ad);
-       ad->name_update_idler = ecore_idler_add(
-                       __name_focus_update_cb, ad);
+       SETTING_TRACE_END;
 }
 
 /**
index 0933beb7e63251071cb7091eb2a4dd36a3611b19..f26e440e898b6ae716cd6d1de625e1ca808704f6 100755 (executable)
@@ -52,6 +52,9 @@ ADD_LIBRARY(${LIB_SETTING_COMMON} SHARED
        ./src/setting-common-init.c
        ./src/setting-common-view.c
        ./src/controls/confirm-popup.c
+       ./src/controls/enter-text-popup.c
+       ./src/controls/common.c
+       ./src/controls/info-popup.c
 )
 
 TARGET_LINK_LIBRARIES(${LIB_SETTING_COMMON} ${pkgs_common_data_LDFLAGS})
diff --git a/setting-common/include/controls/common.h b/setting-common/include/controls/common.h
new file mode 100644 (file)
index 0000000..fd59286
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 COMMON_H
+#define COMMON_H
+
+/**
+ * Gets absolute path do controls.edje file
+ */
+const char *controls_edje_path_get();
+
+#endif /* end of include guard: COMMON_H */
diff --git a/setting-common/include/controls/enter-text-popup.h b/setting-common/include/controls/enter-text-popup.h
new file mode 100644 (file)
index 0000000..9904bb5
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 ENTER_TEXT_POPUP_H
+#define ENTER_TEXT_POPUP_H
+
+#include <Elementary.h>
+
+/**
+ * @brief Creates new popup widget, allowing to enter single line text,
+ * confirm or reject.
+ *
+ * and two buttons: "confirm", "reject"
+ *
+ * --------------------------------
+ * |              Title           |
+ * |------------------------------|
+ * | Entry header                 |
+ * |------------------------------|
+ * |  (Entry Text + Guide text)   |
+ * |------------------------------|
+ * |                              |
+ * |          Description         |
+ * |                              |
+ * |-------------- ---------------|
+ * ||Reject button||Confirm button|
+ * --------------------------------
+ *
+ * Usage:
+ *
+ *   Evas_Object *cp = enter_text_popup_create(window);
+ *
+ *   enter_text_popup_title_set(cp, "Rename device");
+ *   enter_text_popup_header_set(cp, "Name");
+ *   enter_text_popup_guide_text_set(cp, "Device name");
+ *   enter_text_popup_confirm_text_set(cp, "Set");
+ *   enter_text_popup_reject_text_set(cp, "Cancel");
+ *
+ *   evas_object_smart_callback_add(cp, "confirmed", accepted_cb, NULL);
+ *   evas_object_smart_callback_add(cp, "rejected", rejected_cb, NULL);
+ *
+ *   char *new_name = enter_text_popup_text_get(cp);
+ *
+ *   evas_object_show(cp);
+ */
+Evas_Object *enter_text_popup_create(Evas_Object *parent);
+
+void enter_text_popup_title_set(Evas_Object *popup, const char *title);
+
+void enter_text_popup_header_set(Evas_Object *popup, const char *header);
+
+void enter_text_popup_guide_text_set(Evas_Object *popup, const char *guide);
+
+void enter_text_popup_confirm_text_set(Evas_Object *popup, const char *confirm_text);
+
+void enter_text_popup_reject_text_set(Evas_Object *popup, const char *reject_text);
+
+void enter_text_popup_text_set(Evas_Object *popup, const char *text);
+
+const char *enter_text_popup_text_get(Evas_Object *popup);
+
+void enter_text_popup_description_set(Evas_Object *popup, const char *description);
+
+#endif /* end of include guard: ENTER_TEXT_POPUP_H */
diff --git a/setting-common/include/controls/info-popup.h b/setting-common/include/controls/info-popup.h
new file mode 100644 (file)
index 0000000..733a85b
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 INFO_POPUP_H
+#define INFO_POPUP_H
+
+/**
+ * @brief Creates new info popup widget, with title, content text
+ * and button: "ok"
+ *
+ * --------------------------------
+ * |              Title           |
+ * |------------------------------|
+ * |                              |
+ * |              Text            |
+ * |                              |
+ * |-------------- ---------------|
+ * |         |    OK    |         |
+ * --------------------------------
+ *
+
+ * Usage:
+ *
+ *   Evas_Object *cp = info_popup_create(window);
+ *
+ *   info_popup_title_set(cp, "Info");
+ *   info_popup_text_set(cp, "This is description");
+ *
+ *   evas_object_show(cp);
+ */
+
+Evas_Object *info_popup_create(Evas_Object *parent);
+
+void info_popup_title_set(Evas_Object *popup, const char *title);
+
+void info_popup_text_set(Evas_Object *popup, const char *text);
+
+void info_popup_ok_text_set(Evas_Object *popup, const char *text);
+
+#endif /* end of include guard: INFO_POPUP_H */
diff --git a/setting-common/src/controls/common.c b/setting-common/src/controls/common.c
new file mode 100644 (file)
index 0000000..a85d925
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 "setting-common-general-func.h"
+
+EXPORT_PUBLIC
+const char *controls_edje_path_get()
+{
+       return setting_get_resource_path("edje/controls.edj");
+}
diff --git a/setting-common/src/controls/enter-text-popup.c b/setting-common/src/controls/enter-text-popup.c
new file mode 100644 (file)
index 0000000..3fc0854
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 "setting-common-general-func.h"
+#include "controls/enter-text-popup.h"
+#include "controls/common.h"
+
+static void _on_reject_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *popup = data;
+       evas_object_smart_callback_call(popup, "rejected", NULL);
+}
+
+static void _on_confirm_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *popup = data;
+       evas_object_smart_callback_call(popup, "confirmed", NULL);
+}
+
+static Evas_Object *enter_text_popup_entry_get(Evas_Object *popup)
+{
+       Evas_Object *layout = elm_object_content_get(popup);
+       if (!layout) return NULL;
+       return elm_object_part_content_get(layout, "elm.swallow.content");
+}
+
+static void _enter_text_entry_changed(void *event_info, Evas_Object *obj, void *user_data)
+{
+       if (elm_entry_is_empty(obj)) {
+               elm_object_item_signal_emit(obj, "elm,state,eraser,hide", "elm");
+       } else {
+               elm_object_item_signal_emit(obj, "elm,state,eraser,show", "elm");
+       }
+}
+
+EXPORT_PUBLIC
+Evas_Object *enter_text_popup_create(Evas_Object *parent)
+{
+       Evas_Object *popup = elm_popup_add(parent);
+
+       elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+       Evas_Object *layout = elm_layout_add(popup);
+       elm_layout_file_set(layout, controls_edje_path_get(), "popup_text_input_text");
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_content_set(popup, layout);
+       evas_object_show(layout);
+
+       Evas_Object *entry = elm_entry_add(layout);
+       elm_entry_single_line_set(entry, EINA_TRUE);
+       elm_entry_scrollable_set(entry, EINA_TRUE);
+       evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_smart_callback_add(entry, "changed", _enter_text_entry_changed, NULL);
+       elm_object_part_content_set(layout, "elm.swallow.content", entry);
+       evas_object_show(entry);
+
+       Evas_Object *btn = elm_button_add(popup);
+       elm_object_style_set(btn, "border");
+       evas_object_smart_callback_add(btn, "clicked", _on_reject_clicked, popup);
+       elm_object_part_content_set(popup, "button1", btn);
+
+       Evas_Object *btn2 = elm_button_add(popup);
+       elm_object_style_set(btn2, "popup");
+       evas_object_smart_callback_add(btn2, "clicked", _on_confirm_clicked, popup);
+       elm_object_part_content_set(popup, "button2", btn2);
+
+       return popup;
+}
+
+EXPORT_PUBLIC
+void enter_text_popup_title_set(Evas_Object *popup, const char *title)
+{
+       elm_object_part_text_set(popup, "title,text", title);
+}
+
+EXPORT_PUBLIC
+void enter_text_popup_header_set(Evas_Object *popup, const char *header)
+{
+       Evas_Object *layout = elm_object_content_get(popup);
+       if (!layout) return;
+       elm_object_part_text_set(layout, "elm.text.header", header);
+}
+
+EXPORT_PUBLIC
+void enter_text_popup_guide_text_set(Evas_Object *popup, const char *guide)
+{
+       Evas_Object *entry = enter_text_popup_entry_get(popup);
+       elm_object_part_text_set(entry, "elm.guide", guide);
+}
+
+EXPORT_PUBLIC
+void enter_text_popup_confirm_text_set(Evas_Object *popup, const char *confirm_text)
+{
+       Evas_Object *btn = elm_object_part_content_get(popup, "button2");
+       elm_object_text_set(btn, confirm_text);
+}
+
+EXPORT_PUBLIC
+void enter_text_popup_reject_text_set(Evas_Object *popup, const char *reject_text)
+{
+       Evas_Object *btn = elm_object_part_content_get(popup, "button1");
+       elm_object_text_set(btn, reject_text);
+}
+
+EXPORT_PUBLIC
+void enter_text_popup_text_set(Evas_Object *popup, const char *text)
+{
+       Evas_Object *entry = enter_text_popup_entry_get(popup);
+       elm_object_text_set(entry, text);
+}
+
+EXPORT_PUBLIC
+const char *enter_text_popup_text_get(Evas_Object *popup)
+{
+       Evas_Object *entry = enter_text_popup_entry_get(popup);
+       return elm_object_text_get(entry);
+}
+
+EXPORT_PUBLIC
+void enter_text_popup_description_set(Evas_Object *popup, const char *description)
+{
+       Evas_Object *layout = elm_object_content_get(popup);
+       if (!layout) return;
+       elm_object_part_text_set(layout, "elm.text.description", description);
+}
diff --git a/setting-common/src/controls/info-popup.c b/setting-common/src/controls/info-popup.c
new file mode 100644 (file)
index 0000000..54c32a1
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 "setting-common-general-func.h"
+#include "controls/enter-text-popup.h"
+
+static void _popup_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *popup = data;
+       evas_object_del(popup);
+}
+
+EXPORT_PUBLIC
+Evas_Object *info_popup_create(Evas_Object *parent)
+{
+       Evas_Object *popup = elm_popup_add(parent);
+
+       elm_popup_align_set(popup, 0.5, 1.0);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+       Evas_Object *btn = elm_button_add(popup);
+       elm_object_style_set(btn, "popup");
+       evas_object_smart_callback_add(btn, "clicked", _popup_clicked_cb, popup);
+       elm_object_part_content_set(popup, "button1", btn);
+
+       return popup;
+}
+
+EXPORT_PUBLIC
+void info_popup_title_set(Evas_Object *popup, const char *title)
+{
+       elm_object_part_text_set(popup, "title,text", title);
+}
+
+EXPORT_PUBLIC
+void info_popup_text_set(Evas_Object *popup, const char *text)
+{
+       elm_object_text_set(popup, text);
+}
+
+EXPORT_PUBLIC
+void info_popup_ok_text_set(Evas_Object *popup, const char *text)
+{
+       Evas_Object *btn = elm_object_part_content_get(popup, "button1");
+       elm_object_text_set(btn, text);
+}
+
index a10b62c740efcb35117ed62809605d7858c8a5ed..329cc34f1da657cb5b8d9d559b36d902b772cffc 100755 (executable)
@@ -128,6 +128,16 @@ ADD_CUSTOM_TARGET(main_layout.edj
 )
 ADD_DEPENDENCIES(${PROJECT_NAME} main_layout.edj)
 INSTALL(FILES ${CMAKE_BINARY_DIR}/main_layout.edj DESTINATION ${TZ_SYS_RO_APP}/${SETTING_PKG_NAME}/res/edje/)
+
+# make controls.edj
+ADD_CUSTOM_TARGET(controls.edj
+               COMMAND edje_cc -id ${CMAKE_SOURCE_DIR}/resource/images -id ${CMAKE_SOURCE_DIR}/resource/icons -sd ${CMAKE_SOURCE_DIR}/resource/sounds
+               ${CMAKE_SOURCE_DIR}/resource/controls.edc
+               ${CMAKE_BINARY_DIR}/controls.edj
+               DEPENDS ${CMAKE_SOURCE_DIR}/resource/controls.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} controls.edj)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/controls.edj DESTINATION ${TZ_SYS_RO_APP}/${SETTING_PKG_NAME}/res/edje/)
 #------------------------------------------------------------------------------------------
 
 # install desktop file & icon