summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunghyun Kim <jh1114.kim@samsung.com>2013-01-31 06:02:46 (GMT)
committerJunghyun Kim <jh1114.kim@samsung.com>2013-01-31 06:02:46 (GMT)
commit8d092ab3fad67b540e945cec6f8245d78aa494d5 (patch)
tree59b949c873c3183ccfb35e2884b0d236d5438a11
parentf09a1c32ed60d545d118715a42763dfffda3f1e5 (diff)
parentab979095c43c8cf1522c0212f21ddf62dd096782 (diff)
downloadsmartsearch-8d092ab3fad67b540e945cec6f8245d78aa494d5.zip
smartsearch-8d092ab3fad67b540e945cec6f8245d78aa494d5.tar.gz
smartsearch-8d092ab3fad67b540e945cec6f8245d78aa494d5.tar.bz2
Merge branch 'master' into tizen_2.0
-rwxr-xr-xsrc/ps_makeupviews.cpp2
-rwxr-xr-xsrc/ps_searcher.cpp160
-rwxr-xr-xsrc/smartsearch.cpp2
3 files changed, 117 insertions, 47 deletions
diff --git a/src/ps_makeupviews.cpp b/src/ps_makeupviews.cpp
index 6d21aa8..b3888e9 100755
--- a/src/ps_makeupviews.cpp
+++ b/src/ps_makeupviews.cpp
@@ -95,7 +95,7 @@ ecore_exe_pipe_cb(void *data, void *buf, unsigned int size)
item->itc_style,
item->data,
NULL,
- ELM_GENLIST_ITEM_NONE,
+ ELM_GENLIST_ITEM_GROUP,
NULL,
NULL);
elm_genlist_item_select_mode_set(obj->gl_result_grp,
diff --git a/src/ps_searcher.cpp b/src/ps_searcher.cpp
index bdd8eb6..cfcb66f 100755
--- a/src/ps_searcher.cpp
+++ b/src/ps_searcher.cpp
@@ -173,28 +173,71 @@ int search_sql_contact_search_result_by_api(struct search_content_object *obj,
unsigned int count = 0;
int total_cnt = -1;
-
+ int curr_cnt = -1;
int loop_cnt = 0;
+ int search_ret = SEARCH_RET_SEARCH_NONE;
SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
ret = contacts_connect2();
- SEARCH_RETV_IF_WITH_ERRORV(ret != CONTACTS_ERROR_NONE, SEARCH_RET_SEARCH_FAIL, ret);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_connect2 : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_query_create(_contacts_person_number._uri, &query);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_query_create : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_filter_create(_contacts_person_number._uri, &filter);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_filter_create : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_filter_add_str(filter, _contacts_person_number.display_name, CONTACTS_MATCH_CONTAINS, keyword);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_filter_add_str : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_filter_add_operator : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_filter_add_str(filter, _contacts_person_number.number, CONTACTS_MATCH_CONTAINS, keyword);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_filter_add_str : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_query_set_filter(query, filter);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_query_set_filter : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_query_set_sort(query, _contacts_person_number.display_name, true);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_query_set_sort : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_db_get_count_with_query(query, &total_cnt);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_db_get_count_with_query : %d", ret);
+ goto out_func;
+ }
- contacts_query_create(_contacts_person_number._uri, &query);
- contacts_filter_create(_contacts_person_number._uri, &filter);
- contacts_filter_add_str(filter, _contacts_person_number.display_name,
- CONTACTS_MATCH_CONTAINS, keyword);
- contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
- contacts_filter_add_str(filter, _contacts_person_number.number,
- CONTACTS_MATCH_CONTAINS, keyword);
- contacts_query_set_filter(query, filter);
- contacts_query_set_sort(query, _contacts_person_number.display_name, true);
-
- contacts_db_get_count_with_query(query, &total_cnt);
ret = contacts_db_get_records_with_query(query, offset, limit, &list);
- contacts_filter_destroy(filter);
- contacts_query_destroy(query);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_db_get_records_with_query : %d", ret);
+ goto out_func;
+ }
SEARCH_RETV_IF_WITH_ERRORV(ret != CONTACTS_ERROR_NONE, SEARCH_RET_SEARCH_FAIL, ret);
contacts_list_get_count(list, &count);
@@ -210,16 +253,16 @@ int search_sql_contact_search_result_by_api(struct search_content_object *obj,
}
do {
- struct search_item_sel *sel_mem_info = NULL;
- struct search_genlist_item_info *gen_item = NULL;
+ struct search_item_sel *sel_mem_info = NULL;
+ struct search_genlist_item_info *gen_item = NULL;
Elm_Genlist_Item_Class *itc_style = NULL;
int contact_id = -1;
char *contact_img_path = NULL;
char *str_display = NULL;
char *num_display = NULL;
- const char *text_1line = NULL;
- const char *text_2line = NULL;
+ const char *text_1line = NULL;
+ const char *text_2line = NULL;
bool is_word_in_str = false;
char contact_id_str[MAX_LENGTH_PER_ID] = {0,};
@@ -230,28 +273,28 @@ int search_sql_contact_search_result_by_api(struct search_content_object *obj,
continue;
}
- sel_mem_info->type = obj->contents_type;
+ sel_mem_info->type = obj->contents_type;
contacts_record_h record;
contacts_list_get_current_record_p(list, &record);
contacts_record_get_str_p(record, _contacts_person.image_thumbnail_path, &contact_img_path);
- if (contact_img_path != NULL) {
+ if (contact_img_path != NULL) {
sel_mem_info->icon1 = strdup(contact_img_path);
}
else if (obj->obj_icon_path) {
sel_mem_info->icon1 = strdup(obj->obj_icon_path);
- }
+ }
contacts_record_get_str_p(record, _contacts_person.display_name, &str_display);
contacts_record_get_str_p(record, _contacts_number.number, &num_display);
- if (str_display != NULL) {
- text_1line = str_display;
- }
+ if (str_display != NULL) {
+ text_1line = str_display;
+ }
- if (num_display != NULL) {
- text_2line = num_display;
+ if (num_display != NULL) {
+ text_2line = num_display;
}
if (text_1line != NULL && text_2line != NULL) {
@@ -264,18 +307,18 @@ int search_sql_contact_search_result_by_api(struct search_content_object *obj,
}
else {
sel_mem_info->text2 = strdup(search_markup_keyword(num_display, keyword, &is_word_in_str));
- }
+ }
itc_style = ad->itc_pslist_1line_1icon;
- }
+ }
contacts_record_get_int(record, _contacts_person.id, &contact_id);
snprintf(contact_id_str, MAX_LENGTH_PER_ID - 1, "%d", contact_id);
sel_mem_info->launch_param= strdup(contact_id_str);
- gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM,
- obj, itc_style, sel_mem_info,
- obj->gl_result_grp);
- result_info->itemlist = g_list_append(result_info->itemlist, (void*)gen_item);
+ gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM,
+ obj, itc_style, sel_mem_info,
+ obj->gl_result_grp);
+ result_info->itemlist = g_list_append(result_info->itemlist, (void*)gen_item);
loop_cnt++;
@@ -285,13 +328,14 @@ int search_sql_contact_search_result_by_api(struct search_content_object *obj,
}while (contacts_list_next(list) == CONTACTS_ERROR_NONE);
} else {
SEARCH_DEBUG_WARNING("No matched contacts data", ret);
- return SEARCH_RET_SEARCH_NONE;
+ search_ret = SEARCH_RET_SEARCH_NONE;
+ goto out_func;
}
contacts_list_destroy(list, true);
- /* Set more title to genlist (under 'search all') */
- int curr_cnt = offset + loop_cnt;
+ /* Set more title to genlist (under 'search all') */
+ curr_cnt = offset + loop_cnt;
if (total_cnt > curr_cnt) {
struct search_item_more_sel *sel_mem_more = NULL;
@@ -311,11 +355,22 @@ int search_sql_contact_search_result_by_api(struct search_content_object *obj,
obj->gl_result_grp);
}
+ search_ret = SEARCH_RET_SEARCH_SUCCESS;
+
+out_func:
ret = contacts_disconnect2();
+ if (filter) {
+ contacts_filter_destroy(filter);
+ }
+
+ if (query) {
+ contacts_query_destroy(query);
+ }
+
SEARCH_FUNC_END;
- return SEARCH_RET_SEARCH_SUCCESS;
+ return search_ret;
}
int search_sql_calendar_search_result_by_api(struct search_content_object *obj,
@@ -344,7 +399,11 @@ int search_sql_calendar_search_result_by_api(struct search_content_object *obj,
calendar_filter_h visibility_filter = NULL;
calendar_list_h list = NULL;
- calendar_query_create(_calendar_event._uri, &query);
+ ret = calendar_query_create(_calendar_event._uri, &query);
+ if (ret != CALENDAR_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("calendar_query_create : %d", ret);
+ goto out_func;
+ }
ret = calendar_filter_create(_calendar_event._uri, &visibility_filter);
if (ret != CALENDAR_ERROR_NONE) {
@@ -884,7 +943,7 @@ static bool __search_sql_music_info_cb(media_info_h media, void *user_data)
char *album = NULL;
int ret = 0;
- audio_meta_h a_handle;
+ audio_meta_h a_handle = NULL;
media_content_storage_e storage_type = MEDIA_CONTENT_STORAGE_INTERNAL;
@@ -916,12 +975,25 @@ static bool __search_sql_music_info_cb(media_info_h media, void *user_data)
ret = media_info_get_audio(media, &a_handle);
- if(ret != 0) {
+ if(ret != MEDIA_CONTENT_ERROR_NONE) {
SEARCH_DEBUG_WARNING("Fail to get audio info!");
+ return true;
} else {
- audio_meta_get_title(a_handle, &title);
- audio_meta_get_album(a_handle, &album);
- audio_meta_get_artist(a_handle, &artist);
+ ret = audio_meta_get_title(a_handle, &title);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to get title info!");
+ }
+
+ ret = audio_meta_get_album(a_handle, &album);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to get album info!");
+ }
+
+ ret = audio_meta_get_artist(a_handle, &artist);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to get artist info!");
+ }
+
}
audio_meta_destroy(a_handle);
@@ -1823,7 +1895,6 @@ int search_sql_msg_search_result_by_api(struct search_content_object *obj,
{
SEARCH_FUNC_START;
- int loop_cnt = 0;
int ret = SEARCH_RET_SEARCH_FAIL;
struct search_item_sel *sel_mem_info = NULL;
@@ -1835,7 +1906,6 @@ int search_sql_msg_search_result_by_api(struct search_content_object *obj,
int i = 0;
int j = 0;
- bool is_more_btn = false;
bool is_word_in_title = false;
msg_error_t err = MSG_SUCCESS;
diff --git a/src/smartsearch.cpp b/src/smartsearch.cpp
index ef71695..ef7bf45 100755
--- a/src/smartsearch.cpp
+++ b/src/smartsearch.cpp
@@ -60,7 +60,7 @@ static struct search_content_object_default def_obj[SEARCH_CONT_MAX] = {
{ 5, EINA_TRUE, "IDS_COM_BODY_VIDEOS", SEARCH_STR_TYPE_SYSTEM_STRING,
SEARCH_CONT_PHONE_VIDEO, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.video-player"},
{ 6, EINA_TRUE, "IDS_COM_BODY_CALENDAR", SEARCH_STR_TYPE_SYSTEM_STRING,
- SEARCH_CONT_PHONE_CALENDAR, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.efl-calendar"},
+ SEARCH_CONT_PHONE_CALENDAR, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.calendar"},
{ 7, EINA_TRUE, "IDS_COM_BODY_MEMO", SEARCH_STR_TYPE_SYSTEM_STRING,
SEARCH_CONT_PHONE_MEMO, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.memo"},
{ 8, EINA_TRUE, "IDS_COM_BODY_APPLICATIONS", SEARCH_STR_TYPE_SYSTEM_STRING,