[TSAM-11164][TSAM-11167] Screen reader read wrong when tap to widget 33/103733/1
authorGeunsun, Lee <gs86.lee@samsung.com>
Fri, 9 Dec 2016 08:40:53 +0000 (17:40 +0900)
committerGeunsun, Lee <gs86.lee@samsung.com>
Fri, 9 Dec 2016 08:40:53 +0000 (17:40 +0900)
Change-Id: I145e04e190d8bffd7f3fe270269314f7f890ee5b

inc/cluster_data.h
src/add_widget_viewer/add_widget_viewer.c
src/cluster_data.c
src/cluster_db.c
src/cluster_page.c
src/widget_viewer.c

index 4bc0573..29eb506 100755 (executable)
@@ -27,6 +27,7 @@ typedef struct {
        int pos_y;
        int pos_x;
        char *pkg_name;
+       char *widget_label;
        char *content_info;
        widget_size_type_e type;
        double period;
@@ -41,7 +42,7 @@ Eina_List *cluster_data_get_widget_list(void);
 int cluster_data_get_page_count();
 void cluster_data_set_page_count(int count);
 
-void cluster_data_insert_widget(const char* pkg_name, const char* content_info, int type);
+void cluster_data_insert_widget(const char* pkg_name, const char *label, const char* content_info, int type);
 void cluster_data_insert(widget_data_t *item);
 void cluster_data_delete(widget_data_t *item);
 void cluster_data_update(widget_data_t *item);
index 4354e82..8f6da96 100755 (executable)
@@ -704,12 +704,15 @@ static void __add_widget_viewer_preview_clicked_cb(void *data, Evas_Object *obj,
 
        int type = *size;
        free(size);
+
        char *widget_id = strdup(widget->widget_id);
+       char *widget_label = strdup(widget->label);
 
        cluster_view_set_state(VIEW_STATE_NORMAL);
 
-       cluster_data_insert_widget(widget_id, NULL, type);
+       cluster_data_insert_widget(widget_id, widget_label, NULL, type);
        free(widget_id);
+       free(widget_label);
 }
 
 static void __add_widget_get_size_by_type(int type, int *w, int *h)
index 09eadaf..1c80116 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 #include <app_preference.h>
+#include <system_settings.h>
 
 #include "cluster_data.h"
 #include "cluster_db.h"
@@ -63,7 +64,7 @@ void cluster_data_set_page_count(int count)
        }
 }
 
-void cluster_data_insert_widget(const char* pkg_name, const char* content_info, int type)
+void cluster_data_insert_widget(const char* pkg_name, const char *label, const char* content_info, int type)
 {
        widget_data_t *new_item = (widget_data_t *)malloc(sizeof(widget_data_t));
        memset(new_item, 0, sizeof(widget_data_t));
@@ -72,6 +73,7 @@ void cluster_data_insert_widget(const char* pkg_name, const char* content_info,
        new_item->pos_y = INIT_VALUE;
        new_item->pos_x = INIT_VALUE;
        new_item->pkg_name = strdup(pkg_name);
+       new_item->widget_label = strdup(label);
        new_item->content_info = content_info == NULL ? NULL : strdup(content_info);
        new_item->type = type;
        new_item->period = 0.0;
@@ -113,12 +115,30 @@ static void __cluster_data_insert_default_data(void)
         * org.tizen.music-player.widget
         * org.tizen.contacts-widget
        */
+       char *lang = NULL;
+       int ret = SYSTEM_SETTINGS_ERROR_NONE;
        widget_data_t *new_item = (widget_data_t *)malloc(sizeof(widget_data_t));
        memset(new_item, 0, sizeof(widget_data_t));
        new_item->page_idx = 0;
        new_item->pos_y = 0;
        new_item->pos_x = 0;
        new_item->pkg_name = strdup("org.tizen.calendar.widget");
+
+       ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang);
+       if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
+               LOGE("SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE : fail");
+               lang = NULL;
+       }
+       eina_str_tolower(&lang);
+
+       Eina_Strbuf *lang_buf = eina_strbuf_new();
+       eina_strbuf_append_printf(lang_buf, "%s", lang);
+       eina_strbuf_replace_all(lang_buf, "_", "-");
+
+       new_item->widget_label = widget_service_get_name(new_item->pkg_name, eina_strbuf_string_get(lang_buf));
+       if (!new_item->widget_label || strlen(new_item->widget_label) == 0)
+               new_item->widget_label = strdup("calendar");
+
        new_item->content_info = NULL;
        new_item->type = WIDGET_SIZE_TYPE_4x4;
        new_item->period = 0.0;
index 73246ec..995971b 100755 (executable)
@@ -32,6 +32,7 @@ enum {
        COL_POS_Y,
        COL_POS_X,
        COL_PKG_NAME,
+       COL_WIDGET_LABEL,
        COL_CONTENT_INFO,
        COL_TYPE,
        COL_PERIOD,
@@ -44,6 +45,7 @@ enum {
                y INTEGER default 0,\
                x INTEGER default 0,\
                pkgName TEXT,\
+               widgetLabel TEXT,\
                content TEXT,\
                type INTEGER default 0,\
                period REAL default 0.0,\
@@ -54,6 +56,7 @@ enum {
                y=%d,\
                x=%d,\
                pkgName='%s',\
+               widgetLabel='%s',\
                content='%s',\
                type=%d,\
                period=%lf,\
@@ -64,10 +67,11 @@ enum {
                y,\
                x,\
                pkgName,\
+               widgetLabel,\
                content,\
                type,\
                period,\
-               allow) VALUES(%d,%d, %d,'%s','%s',%d, '%lf',%d)"
+               allow) VALUES(%d, %d, %d, '%s', '%s', '%s', %d, '%lf', %d)"
 
 #define SELECT_ITEM "SELECT * FROM clusters;"
 
@@ -140,6 +144,8 @@ bool cluster_db_get_list(Eina_List **cluster_list)
                item->pos_x = sqlite3_column_int(stmt, COL_POS_X);
                str = (const char *) sqlite3_column_text(stmt, COL_PKG_NAME);
                item->pkg_name = (!str || !strlen(str)) ? NULL : strdup(str);
+               str = (const char *) sqlite3_column_text(stmt, COL_WIDGET_LABEL);
+               item->widget_label = (!str || !strlen(str)) ? NULL : strdup(str);
                str = (const char *) sqlite3_column_text(stmt, COL_CONTENT_INFO);
                item->content_info = (!str || !strlen(str) || strncmp(str, "(null)", strlen("(null)")) == 0 ) ? NULL : strdup(str);
                item->type = sqlite3_column_int(stmt, COL_TYPE);
@@ -163,6 +169,7 @@ bool cluster_db_update(widget_data_t *item)
                        item->pos_y,
                        item->pos_x,
                        item->pkg_name,
+                       item->widget_label,
                        item->content_info,
                        item->type,
                        item->period,
@@ -190,6 +197,7 @@ bool cluster_db_insert(widget_data_t *item)
                        item->pos_y,
                        item->pos_x,
                        item->pkg_name,
+                       item->widget_label,
                        item->content_info,
                        item->type,
                        item->period,
index 4c2c963..17f1072 100755 (executable)
@@ -207,7 +207,7 @@ void cluster_page_get_access_widget_list(cluster_page_t *page_t, Eina_List **lis
                info->is_access_obj = EINA_FALSE;
                info->target = item->widget_layout;
                info->parent = page_t->page_layout;
-               info->name = strdup(item->pkg_name);
+               info->name = strdup(item->widget_label);
                info->description = strdup(_("IDS_BR_BODY_DOUBLE_TAP_AND_HOLD_THEN_DRAG_TO_REORDER_TTS"));
                info->role = ELM_ATSPI_ROLE_UNKNOWN;
                info->clicked_cb = NULL;
index 1460057..de65195 100755 (executable)
@@ -52,7 +52,7 @@ void widget_viewer_add_widget(Evas_Object *parent, widget_data_t *widget_data, i
 {
        Evas_Object *widget_layout;
 
-       LOGD("pkg : %s , Content INfo : %s", widget_data->pkg_name, widget_data->content_info);
+       LOGD("pkg : %s , label: %s, Content INfo : %s", widget_data->pkg_name, widget_data->widget_label, widget_data->content_info);
        widget_layout = elm_layout_add(parent);
        elm_layout_file_set(widget_layout, util_get_res_file_path(EDJE_DIR"/widget.edj"), GROUP_WIDGET_LY);
        evas_object_size_hint_weight_set(widget_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);