autofill: utilize app id and resource id to save and load 94/178894/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 14 May 2018 11:27:20 +0000 (20:27 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 14 May 2018 11:27:30 +0000 (20:27 +0900)
Change-Id: I2b83a1d8e3c4f38ab7e4e9df075e9556ebf2063f
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/autofill.cpp
src/include/autofill.h
src/ise.cpp

index 0d549fd..f07054e 100644 (file)
 
 using namespace std;
 
-static string get_autofill_alias(Ecore_IMF_Input_Hints input_hints)
+static string get_autofill_alias(const char *app_id, const char *res_id, Ecore_IMF_Input_Hints input_hints)
 {
     int autofill_hint = input_hints & ECORE_IMF_INPUT_HINT_AUTOFILL_MASK;
 
     char alias[1024] = { 0 };
-    snprintf(alias, sizeof(alias), "%d", autofill_hint);
+    snprintf(alias, sizeof(alias), "%s|%s|%d", app_id ? app_id : "", res_id ? res_id : "", autofill_hint);
 
     return string(alias);
 }
 
-Eina_Bool autofill_save_string(Ecore_IMF_Input_Hints input_hints, const char *text)
+Eina_Bool autofill_save_string(const char *app_id, const char *res_id, Ecore_IMF_Input_Hints input_hints, const char *text)
 {
     if ((input_hints & ECORE_IMF_INPUT_HINT_AUTOFILL_MASK) == 0)
         return EINA_FALSE;
@@ -42,7 +42,7 @@ Eina_Bool autofill_save_string(Ecore_IMF_Input_Hints input_hints, const char *te
 
     char *password = NULL;
     ckmc_raw_buffer_s ckmc_data;
-    string alias = get_autofill_alias(input_hints);
+    string alias = get_autofill_alias(app_id, res_id, input_hints);
     ckmc_policy_s ckmc_policy;
     ckmc_policy.password = password;
     ckmc_policy.extractable = true;
@@ -63,7 +63,7 @@ Eina_Bool autofill_save_string(Ecore_IMF_Input_Hints input_hints, const char *te
     }
 }
 
-char *autofill_get_string(Ecore_IMF_Input_Hints input_hints)
+char *autofill_get_string(const char *app_id, const char *res_id, Ecore_IMF_Input_Hints input_hints)
 {
     string alias;
     string autofill_string;
@@ -78,7 +78,7 @@ char *autofill_get_string(Ecore_IMF_Input_Hints input_hints)
     if (autofill_hint == 0)
         return NULL;
 
-    alias = get_autofill_alias(input_hints);
+    alias = get_autofill_alias(app_id, res_id, input_hints);
 
     switch (autofill_hint)
     {
index 374cb6e..bece891 100644 (file)
@@ -14,10 +14,12 @@ extern "C" {
  *
  * @privlevel internal
  *
+ * @param[in] app_id application ID
+ * @param[in] res_id resource ID
  * @param[in] input_hints input hint
  * @param[in] text autofill string
  */
-Eina_Bool autofill_save_string(Ecore_IMF_Input_Hints input_hints, const char *text);
+Eina_Bool autofill_save_string(const char *app_id, const char *res_id, Ecore_IMF_Input_Hints input_hints, const char *text);
 
 /**
  * @brief Get autofill string.
@@ -26,11 +28,13 @@ Eina_Bool autofill_save_string(Ecore_IMF_Input_Hints input_hints, const char *te
  *
  * @privlevel internal
  *
+ * @param[in] app_id application ID
+ * @param[in] res_id resource ID
  * @param[in] input_hints input hint
  *
  * @return a newly allocated autofill string. Free with free() when no longer needed.
  */
-char *autofill_get_string(Ecore_IMF_Input_Hints input_hints);
+char *autofill_get_string(const char *app_id, const char *res_id, Ecore_IMF_Input_Hints input_hints);
 
 #ifdef __cplusplus
 }
index cf29772..6a6d877 100644 (file)
@@ -153,7 +153,7 @@ class CandidateEventListener: public EventListener
                 case MultiEventDesc::CANDIDATE_ITEM_MOUSE_DOWN:
                     if (g_autofill_exist) {
                         if (multidesc.index == 0) {
-                            char *text = autofill_get_string((Ecore_IMF_Input_Hints)g_autofill_hint);
+                            char *text = autofill_get_string(g_app_id.c_str(), g_resource_id.c_str(), (Ecore_IMF_Input_Hints)g_autofill_hint);
                             if (text) {
                                 ise_send_string(text);
                                 free(text);
@@ -1293,7 +1293,7 @@ static void save_autofill_data()
     SECURE_LOGD("surrounding text : %s\n", text);
     if (!text) return;
 
-    autofill_save_string((Ecore_IMF_Input_Hints)g_autofill_hint, text);
+    autofill_save_string(g_app_id.c_str(), g_resource_id.c_str(), (Ecore_IMF_Input_Hints)g_autofill_hint, text);
 
     free(text);
 }
@@ -2440,7 +2440,7 @@ static void ime_app_exit_cb(void *user_data)
 static void show_autofill_data(Ecore_IMF_Input_Hints input_hints)
 {
     g_autofill_exist = false;
-    char *text = autofill_get_string(input_hints);
+    char *text = autofill_get_string(g_app_id.c_str(), g_resource_id.c_str(), input_hints);
 
     if (text) {
         g_autofill_string = string(text);