Update date picker value when the input element is changed
authorKwangYong Choi <ky0.choi@samsung.com>
Thu, 13 Jun 2013 13:40:20 +0000 (22:40 +0900)
committerKwangYong Choi <ky0.choi@samsung.com>
Fri, 14 Jun 2013 02:46:01 +0000 (11:46 +0900)
[Title] Update date picker value when the input element is changed.
[Issue#] N_SE-40638
[Problem] The input element value is different from the picker value.
[Cause] The input element is changed while the picker is shown.
[Solution] Update the picker value whenever picker show request is called.

Change-Id: I38ba93d9419e5de4bb70727417f12f174e7bbed9

Source/WebKit2/UIProcess/API/efl/tizen/InputPicker.cpp

index 7a592f5..87b29d8 100755 (executable)
@@ -530,11 +530,6 @@ void InputPicker::ewk_date_popup(const char* inputValue)
     Evas_Object* parent = elm_object_parent_widget_get(m_ewkView);
     Evas_Object* win = parent;
 
-    if (m_pickerLayout)
-        return;
-
-    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
-
     if (inputValue && strlen(inputValue)) {
         char tmpinputValue[30] = {0,};
 
@@ -551,6 +546,14 @@ void InputPicker::ewk_date_popup(const char* inputValue)
         currentTime->tm_mon = currentTime->tm_mon - 1;
     }
 
+    if (m_pickerLayout) {
+        // Just update the value.
+        elm_datetime_value_set(m_pickerLayout->datePicker, currentTime);
+        return;
+    }
+
+    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
+
     while (parent) {
         const char* type = elm_object_widget_type_get(parent);
         if (type) {
@@ -698,11 +701,6 @@ void InputPicker::ewk_week_popup(const char* inputValue)
     Evas_Object* parent = elm_object_parent_widget_get(m_ewkView);
     Evas_Object* win = parent;
 
-    if (m_pickerLayout)
-        return;
-
-    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
-
     if (inputValue && strlen(inputValue)) {
         char tmpinputValue[30] = {0,};
 
@@ -738,6 +736,14 @@ void InputPicker::ewk_week_popup(const char* inputValue)
         currentTime->tm_mday = days;
     }
 
+    if (m_pickerLayout) {
+        // Just update the value.
+        elm_datetime_value_set(m_pickerLayout->datePicker, currentTime);
+        return;
+    }
+
+    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
+
     while (parent) {
         const char* type = elm_object_widget_type_get(parent);
         if (type) {
@@ -792,11 +798,6 @@ void InputPicker::ewk_time_popup(const char* inputValue)
     Evas_Object* parent = elm_object_parent_widget_get(m_ewkView);
     Evas_Object* win = parent;
 
-    if (m_pickerLayout)
-        return;
-
-    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
-
     if (inputValue && strlen(inputValue)) {
         char tmpinputValue[30] = {0,};
 
@@ -808,6 +809,14 @@ void InputPicker::ewk_time_popup(const char* inputValue)
         currentTime->tm_min = atoi(dateStr.min);
     }
 
+    if (m_pickerLayout) {
+        // Just update the value.
+        elm_datetime_value_set(m_pickerLayout->timePicker, currentTime);
+        return;
+    }
+
+    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
+
     while (parent) {
         const char* type = elm_object_widget_type_get(parent);
         if (type) {
@@ -860,11 +869,6 @@ void InputPicker::ewk_month_popup(const char* inputValue)
     Evas_Object* parent = elm_object_parent_widget_get(m_ewkView);
     Evas_Object* win = parent;
 
-    if (m_pickerLayout)
-        return;
-
-    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
-
     if (inputValue && strlen(inputValue)) {
         char tmpInputValue[30] = {0,};
 
@@ -879,6 +883,14 @@ void InputPicker::ewk_month_popup(const char* inputValue)
         currentTime->tm_mon = currentTime->tm_mon - 1;
     }
 
+    if (m_pickerLayout) {
+        // Just update the value.
+        elm_datetime_value_set(m_pickerLayout->datePicker, currentTime);
+        return;
+    }
+
+    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
+
     while (parent) {
         const char* type = elm_object_widget_type_get(parent);
         if (type) {
@@ -933,13 +945,6 @@ void InputPicker::ewk_datetime_popup(const char* inputValue, bool local)
     Evas_Object* parent = elm_object_parent_widget_get(m_ewkView);
     Evas_Object* win = parent;
 
-    if (m_pickerLayout)
-        return;
-
-    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
-
-    m_pickerLayout->datetimeLocal = local;
-
     if (inputValue && strlen(inputValue)) {
         char tmpInputValue[30] = {0, };
 
@@ -949,7 +954,7 @@ void InputPicker::ewk_datetime_popup(const char* inputValue, bool local)
         strcpy(dateStr.day, strtok(0, "T"));
         strcpy(dateStr.hour, strtok(0, ":"));
 
-        if (m_pickerLayout->datetimeLocal)
+        if (local)
             strcpy(dateStr.min, strtok(0, "Z"));
         else
             strcpy(dateStr.min, strtok(0, ":"));
@@ -964,6 +969,19 @@ void InputPicker::ewk_datetime_popup(const char* inputValue, bool local)
         currentTime->tm_mon = currentTime->tm_mon - 1;
     }
 
+    if (m_pickerLayout) {
+        // Just update the value.
+        m_pickerLayout->datetimeLocal = local;
+
+        elm_datetime_value_set(m_pickerLayout->datePicker, currentTime);
+        elm_datetime_value_set(m_pickerLayout->timePicker, currentTime);
+        return;
+    }
+
+    m_pickerLayout = new Input_Picker_Layout(m_ewkView);
+
+    m_pickerLayout->datetimeLocal = local;
+
     while (parent) {
         const char* type = elm_object_widget_type_get(parent);
         if (type) {