Fix of license display in wrong language
authorTomasz Iwanek <t.iwanek@samsung.com>
Mon, 7 Jan 2013 07:21:46 +0000 (08:21 +0100)
committerGerrit Code Review <gerrit2@kim11>
Tue, 8 Jan 2013 13:50:09 +0000 (22:50 +0900)
[Issue#] JIRA(#TDIS-1567)
[Bug] Failing to display license text correctly
[Cause] N/A
[Solution] N/A
[Verification] check if application license in correctly displayed in settings -> manage applications -> more detail -> license information.
To do that, install co.wgt widget of w3c tests. Value of license shouldbe 'PASSED'.

Change-Id: Ied447e3905dad68cb5c6d66bb581b72a341580bf

webapp-detail/detailview.cpp

index d033d9d..90d43a6 100644 (file)
@@ -21,6 +21,7 @@
 #include <dpl/foreach.h>
 #include <dpl/assert.h>
 #include <dpl/utils/wrt_global_settings.h>
+#include <dpl/localization/w3c_file_localization.h>
 
 #include <ui-gadget-module.h>
 
@@ -39,17 +40,7 @@ const char* const WRT_LAUNCHER_WK_MODE_CHANGE_OPTION = "-w";
 
 void DetailView::getLocalizedInfo(void)
 {
-    DPL::OptionalString locale;
-
-    Assert(m_dao);
-
-    locale = m_dao->getDefaultlocale();
-    if (locale.IsNull()) {
-        DPL::String lang_tag(L"");
-        m_localizedInfo = m_dao->getLocalizedInfo(lang_tag);
-    } else {
-        m_localizedInfo = m_dao->getLocalizedInfo(*locale);
-    }
+    m_localizedInfo = W3CFileLocalization::getLocalizedInfo(m_appID);
 }
 
 void DetailView::addField(const char *title)
@@ -380,12 +371,28 @@ void DetailView::clearDataCallback(void *data,
 }
 
 void DetailView::viewlicenseCallback(void *data,
-       Evas_Object *obj,
-       void *event_info)
+                                     Evas_Object *obj,
+                                     void *event_info)
 {
-    //TODO : implementation here.
-    Evas_Object *popup = static_cast<Evas_Object *>(data);
-    evas_object_del(popup);
+    Evas_Object *popup;
+    Evas_Object *btn;
+    DetailData *detailData;
+
+    Elm_Object_Item *it;
+    it = static_cast<Elm_Object_Item *>(event_info);
+    Assert(it);
+    elm_genlist_item_selected_set(it, EINA_FALSE);
+    Assert(data);
+    detailData = static_cast<DetailData *>(data);
+
+    popup = elm_popup_add(detailData->m_detailView->m_naviframe);
+    evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+    elm_object_text_set(popup, detailData->m_subtitle.c_str());
+    btn = elm_button_add(popup);
+    elm_object_text_set(btn, "OK");
+    elm_object_part_content_set(popup, "button1", btn);
+    evas_object_smart_callback_add(btn, "clicked", closeCallback, popup);
+    evas_object_show(popup);
 }
 
 void DetailView::closeCallback(void *data,
@@ -864,8 +871,9 @@ void DetailView::addLicenseInfo(Evas_Object *gl, const char* title)
     Assert(gl);
     try {
     detailData = new DetailData(this,
-                              title,
-                              title);
+                                title,
+                                DPL::ToUTF8String(
+                                    *m_localizedInfo.license).c_str());
     itc.item_style = "dialogue/1text";
     itc.func.text_get =getTitle ;
     itc.func.content_get = NULL;
@@ -873,13 +881,12 @@ void DetailView::addLicenseInfo(Evas_Object *gl, const char* title)
     itc.func.del = NULL;
 
     it = elm_genlist_item_append(gl,
-                            &itc,
-                            static_cast<void *>(detailData),
-                            NULL,
-                            ELM_GENLIST_ITEM_NONE,
-                            NULL,
-                            NULL);
-    elm_object_item_disabled_set(it, EINA_TRUE);
+                                 &itc,
+                                 static_cast<void *>(detailData),
+                                 NULL,
+                                 ELM_GENLIST_ITEM_NONE,
+                                 viewlicenseCallback,
+                                 static_cast<void *>(detailData));
     } catch (const std::bad_alloc &) {
     }
 }
@@ -969,7 +976,7 @@ Evas_Object *DetailView::loadView(void)
         addAdvancedSetting(m_gl, U_("IDS_ST_HEADER_ADVANCED_SETTINGS"));
         pushToNaviFrame();
 
-    return win;
+        return win;
     } catch (const std::bad_alloc &) {
          return NULL;
     }