fixed N_SE-13789
authorMyoungJune Park <mj2004.park@samsung.com>
Sat, 29 Dec 2012 12:18:26 +0000 (21:18 +0900)
committerMyoungJune Park <mj2004.park@samsung.com>
Sat, 29 Dec 2012 12:18:26 +0000 (21:18 +0900)
added maxlength check logic.

src/setting-plugin.c

index 928b62a..afaaf2d 100755 (executable)
@@ -960,17 +960,44 @@ static void* editbox_func(void *data, xmlNode *xmlObj)
        const char *title = (char*)xmlGetProp(xmlObj, "title");
        const char *key_str= (char*)xmlGetProp(xmlObj, "value");
 
-       //const char *minlength= (char*)xmlGetProp(xmlObj, "minlength");
-       //const char *maxlength= (char*)xmlGetProp(xmlObj, "maxlength");
+       const char *minlength= (char*)xmlGetProp(xmlObj, "minlength");
+       const char *maxlength= (char*)xmlGetProp(xmlObj, "maxlength");
 
-       // TODO: minlength
-       // TODO: maxlength
-       Setting_GenGroupItem_Data *list_item =
-           setting_create_Gendial_field_def(pd->scroller, &(itc_1icon),
-                                            __editbox_list_cb,
-                                            pd, SWALLOW_Type_LAYOUT_ENTRY,
-                                            NULL, NULL, 0, title, key_str,
-                                            __editbox_changed_cb);
+       int max_len = -1;
+       if (maxlength)
+       {
+               max_len = atoi(maxlength);
+               SETTING_TRACE(" >> MAXLENGTH FILTER IS AVAILABLE !!!! maxlength = %d", max_len);
+       }
+
+       Setting_GenGroupItem_Data *list_item = NULL;
+
+       if (max_len == -1)
+       {
+               // without maxlength filter
+               list_item = setting_create_Gendial_field_def(pd->scroller, &(itc_1icon),
+                                                                __editbox_list_cb,
+                                                        pd, SWALLOW_Type_LAYOUT_ENTRY,
+                                                        NULL, NULL, 0, title, key_str,
+                                                        __editbox_changed_cb);
+
+       } else {
+               // add max length filter
+               list_item = setting_create_Gendial_field_entry(
+                                                                       pd->scroller,
+                                                                       &(itc_1icon),
+                                                                       __editbox_list_cb,
+                                                                       pd,
+                                                                       SWALLOW_Type_LAYOUT_ENTRY,
+                                                                       NULL, NULL, 0, title, key_str, __editbox_changed_cb,
+                                                                       ELM_INPUT_PANEL_LAYOUT_NORMAL,
+                                                                       false,
+                                                                       false,
+                                                                       max_len,
+                                                                       0,
+                                                                       NULL, NULL);
+
+       }
        if (list_item) {
                list_item->userdata = xmlObj;
                list_item->stop_change_cb = __entry_unfocus_cb;