diff options
author | Kim Kibum <kb0929.kim@samsung.com> | 2012-06-08 14:54:14 +0900 |
---|---|---|
committer | Kim Kibum <kb0929.kim@samsung.com> | 2012-06-08 14:54:14 +0900 |
commit | bf8879b3c9c9a58111b20ea76263a5845a2f56fb (patch) | |
tree | a5ef3437c6d260a0fcdce447cec29a5270905fd3 /include | |
parent | 636878b6968ffd73d0fee4722d992ecb47e9f3a4 (diff) | |
download | smartsearch-bf8879b3c9c9a58111b20ea76263a5845a2f56fb.tar.gz smartsearch-bf8879b3c9c9a58111b20ea76263a5845a2f56fb.tar.bz2 smartsearch-bf8879b3c9c9a58111b20ea76263a5845a2f56fb.zip |
apply FSL(Flora Software License)
Diffstat (limited to 'include')
-rwxr-xr-x | include/common_util.h | 30 | ||||
-rwxr-xr-x | include/ps_app_interface.h | 37 | ||||
-rwxr-xr-x | include/ps_debug_util.h | 183 | ||||
-rwxr-xr-x | include/ps_makeupviews.h | 34 | ||||
-rwxr-xr-x | include/ps_searcher.h | 59 | ||||
-rwxr-xr-x | include/search_bar.h | 34 | ||||
-rwxr-xr-x | include/smartsearch.h | 119 | ||||
-rwxr-xr-x | include/smartsearch_define.h | 140 |
8 files changed, 636 insertions, 0 deletions
diff --git a/include/common_util.h b/include/common_util.h new file mode 100755 index 0000000..6ccea16 --- /dev/null +++ b/include/common_util.h @@ -0,0 +1,30 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + +#define CHECK_VALIDATE_UTF8 0 + +int search_util_date_time_format_init(void *data); +void search_util_date_time_format_deinit(); +void search_util_date_time_format_get_val(const struct tm *tm, + char *format_val); +void search_sql_make_keyword_bind_value(char *src, char *dest, int type); +void search_get_date_string(char *date_string); +const char *search_markup_keyword(const char *string, char *searchword, + bool *result); +char *search_get_main_window_name(void); diff --git a/include/ps_app_interface.h b/include/ps_app_interface.h new file mode 100755 index 0000000..2a1e044 --- /dev/null +++ b/include/ps_app_interface.h @@ -0,0 +1,37 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + +#ifndef __DEF_PS_APP_INTERFACE_H__ +#define __DEF_PS_APP_INTERFACE_H__ + +void search_launch_contact_view(void *data, void *record_info); +void search_launch_msg_view(void *data, void *record_info); +void search_launch_msg_view(void *data, void *record_info); +void search_launch_email_view(void *data, void *record_info); +void search_launch_image_view(void *data, void *record_info); +void search_launch_video_view(void *data, void *record_info); +void search_launch_music_view(void *data, void *record_info); +void search_launch_document_view(void *data, void *record_info); +void search_launch_calendar_view(void *data, void *record_info); +void search_launch_memo_view(void *data, void *record_info); +void search_launch_menu_view(void *data, void *record_info); +void search_launch_popup_error(int error_type, void *data); +#endif diff --git a/include/ps_debug_util.h b/include/ps_debug_util.h new file mode 100755 index 0000000..eb6b800 --- /dev/null +++ b/include/ps_debug_util.h @@ -0,0 +1,183 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + +#ifndef __DEF_PS_DEBUG_UTIL_H__ +#define __DEF_PS_DEBUG_UTIL_H__ + +#ifdef __ENABLE_DEBUG_UTIL + +#include <assert.h> + +#ifdef __ENABLE_PLATFORM_DEBUG + +#include <dlog.h> + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "SEARCH" + +#define SEARCH_FUNC_START \ + do {\ + LOGD("[%s() START ----->]\n", __FUNCTION__);\ + }while(0) + +#define SEARCH_FUNC_END \ + do {\ + LOGD("[%s() <----- END]\n", __FUNCTION__);\ + }while(0) + +#define SEARCH_FUNC_LINE \ + do {\ + LOGD("[%s() \t%s:%d]\n", __FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + }while(0) + +#define SEARCH_DEBUG_LOG(fmt, arg...) \ + do {\ + LOGD("\x1b[32m[SEARCH][D][" fmt "]\x1b[0m\n", ##arg);\ + }while(0) + +#define SEARCH_DEBUG_WARNING(fmt, arg...) \ + do {\ + LOGW("\x1b[33m[SEARCH][W][" fmt "]\x1b[0m\n", ##arg);\ + }while(0) + +#define SEARCH_DEBUG_ERROR(fmt, arg...) \ + do {\ + LOGE("\x1b[31m[SEARCH][E][" fmt "]\x1b[0m\n", ##arg);\ + }while(0) + +#define SEARCH_ASSERT_IF(cond) \ + do {\ + if(cond) {\ + LOGE("\x1b[31m[%s() \t%s:%d][ASSERT]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + assert(0);\ + }\ + }while(0) + +#define SEARCH_RETV_IF(cond,ret) \ + do {\ + if(cond) {\ + LOGW("\x1b[33m[%s() \t%s:%d][RET_IF]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + return ret;\ + }\ + }while(0) + +#define SEARCH_RET_IF(cond) \ + do {\ + if(cond) {\ + LOGW("\x1b[33m[%s() \t%s:%d][RET_IF]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + return;\ + }\ + }while(0) + +#define SEARCH_RET_IF_STR_INVALID(str,ret) \ + do {\ + if((str == NULL) || strlen(str) == 0) {\ + LOGW("\x1b[33m[%s() \t%s:%d][RET_STR_IF]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + return ret;\ + }\ + }while(0) + +#else + +#include <stdio.h> + +#define SEARCH_FUNC_START \ + do {\ + fprintf(stderr, "[SEARCH][%s() START ----->]\n", __FUNCTION__);\ + }while(0) + +#define SEARCH_FUNC_END \ + do {\ + fprintf("[SEARCH][%s() <----- END]\n", __FUNCTION__);\ + }while(0) + +#define SEARCH_FUNC_LINE \ + do {\ + fprintf("[SEARCH][%s() \t%s:%d]\n", __FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + }while(0) + +#define SEARCH_DEBUG_LOG(fmt, arg...) \ + do {\ + fprintf(stderr, "[SEARCH][D][" fmt "\n", ##arg);\ + }while(0) + +#define SEARCH_DEBUG_WARNING(fmt, arg...) \ + do {\ + fprintf(stderr, "[SEARCH][W][" fmt "\n", ##arg);\ + }while(0) + +#define SEARCH_DEBUG_ERROR(fmt, arg...) \ + do {\ + fprintf(stderr, "[SEARCH][E][" fmt "\n", ##arg);\ + }while(0) + +#define SEARCH_ASSERT_IF(cond) \ + do {\ + if(cond) {\ + fprintf(stderr, "[%s() \t%s:%d][ASSERT]",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + assert(0);\ + }\ + }while(0) + +#define SEARCH_RETV_IF(cond,ret) \ + do {\ + if(cond) {\ + fprintf(stderr, "[%s() \t%s:%d][RET_IF]",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + return ret;\ + }\ + }while(0) + +#define SEARCH_RET_IF(cond) \ + do {\ + if(cond) {\ + fprintf(stderr, "[%s() \t%s:%d][RET_IF]",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + return;\ + }\ + }while(0) + +#define SEARCH_RET_IF_STR_INVALID(str,ret) \ + do {\ + if((str == NULL) || strlen(str) == 0) {\ + fprintf("\x1b[33m[%s() \t%s:%d][RET_STR_IF]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\ + return ret;\ + }\ + }while(0) + +#endif + +#else + +#define SEARCH_FUNC_START +#define SEARCH_FUNC_END +#define SEARCH_FUNC_LINE +#define SEARCH_DEBUG_LOG(fmt, arg...) +#define SEARCH_DEBUG_WARNING(fmt, arg...) +#define SEARCH_DEBUG_ERROR(fmt, arg...) +#define SEARCH_ASSERT_IF(cond) +#define SEARCH_RETV_IF(cond,ret) +#define SEARCH_RET_IF(cond) +#define SEARCH_RET_IF_STR_INVALID(str,ret) + +#endif // __ENABLE_DEBUG_UTIL + +#endif // __DEF_PS_DEBUG_UTIL_H__ diff --git a/include/ps_makeupviews.h b/include/ps_makeupviews.h new file mode 100755 index 0000000..ae8d64f --- /dev/null +++ b/include/ps_makeupviews.h @@ -0,0 +1,34 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + +#ifndef __DEF_PS_MAKEUPVIEWS_H__ +#define __DEF_PS_MAKEUPVIEWS_H__ + +void search_result_gl_init(void *data); +void search_result_gl_deinit(void *data); +void search_gl_phone_result_sel(void *data, Evas_Object * obj, void *event_info); +void search_gl_result_more_item_append_cb(void *data, Evas_Object * obj, void *event_info); +Eina_Bool search_set_result_list(void *data); +void search_layout_set_search_list(void* data); +void search_layout_set_search_no_result(void* data); +int search_layout_get_content_list_set_status(void* data); + +#endif // __DEF_PS_MAKEUPVIEWS_H__ diff --git a/include/ps_searcher.h b/include/ps_searcher.h new file mode 100755 index 0000000..f190739 --- /dev/null +++ b/include/ps_searcher.h @@ -0,0 +1,59 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + +#ifndef __SEARCHSERVER_HEADER_H__ +#define __SEARCHSERVER_HEADER_H__ + +int search_sql_stmt_init(sqlite3_stmt * sql_stmt); + +int search_sql_stmt_finalize(sqlite3_stmt * stmt); + +int search_sql_prepare_stmt(sqlite3 *db_handle, const char *query, + sqlite3_stmt ** stmt_out); + +int search_sql_contact_search_result_by_api(int type, int offset, int limit, + void *data); + +int search_sql_msg_search_result_by_api(int type, int offset, int limit, + void *data); + +int search_sql_email_search_result_by_api(int type, int offset, int limit, + void *data); + +int search_sql_calendar_search_result_by_api(int type, int offset, int limit, + void *data); + +int search_sql_memo_search_result_by_api(int type, int offset, int limit, + void *data); + +int search_sql_image_search_result_by_api(int type, int offset, int limit, + void *data); + +int search_sql_video_search_result_by_api(int type, int offset, int limit, + void *data); + +int search_sql_music_search_result_by_api(int type, int offset, int limit, + void *data); + +int search_sql_menu_search_result_by_api(int type, int offset, int limit, + char *keyword, void *data); + +#endif // __SEARCHSERVER_HEADER_H__ diff --git a/include/search_bar.h b/include/search_bar.h new file mode 100755 index 0000000..035e9f5 --- /dev/null +++ b/include/search_bar.h @@ -0,0 +1,34 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + +#ifndef __DEF_SEARCH_BAR_H__ +#define __DEF_SEARCH_BAR_H__ + +#include <Elementary.h> + +void search_searchbar_cb(void *data, Evas_Object * obj, void *event_info); + +void search_searchbar_entry_changed_cb(void *data, Evas_Object * obj, + void *event_info); + +Evas_Object *search_searchbar_category_icon_add(int cate_type, int press_type, Evas_Object *parent); + +#endif /* __DEF_SEARCH_BAR_H__ */ diff --git a/include/smartsearch.h b/include/smartsearch.h new file mode 100755 index 0000000..1edd84e --- /dev/null +++ b/include/smartsearch.h @@ -0,0 +1,119 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + +#ifndef __DEF_SMARTSEARCH_H__ +#define __DEF_SMARTSEARCH_H__ + +#include <glib.h> +#include <time.h> +#include <Elementary.h> +#include <Ecore_X.h> +#include <appcore-efl.h> +#include <Ecore_IMF.h> +#include <vconf.h> +#include <aul.h> +#include <ui-gadget.h> +#include <malloc.h> +extern "C" { +} +#include <sqlite3.h> +#include <media-svc.h> +#include <MapiControl.h> +#include <MapiStorage.h> +#include <MapiMessage.h> +#include <MsgStorageTypes.h> + +#include "smartsearch_define.h" +#include "ps_debug_util.h" +#include "search_bar.h" +#include "ps_makeupviews.h" +#include "ps_app_interface.h" +#include "common_util.h" +#include "util-func.h" + +#define _EDJ(x) elm_layout_edje_get(x) + +struct search_more_result{ + int next_point; + int offset; + int loop_cnt; + int result_cnt; +}; + +struct search_item_sel { + unsigned char type; + char path[MAX_LENGTH_PER_PATH]; + char main_id[MAX_LENGTH_PER_ID]; + char main_buf[MAX_LENGTH_PER_LINE]; + char sub_buf[MAX_LENGTH_PER_LINE]; +}; + +struct appdata { + Evas_Object *win_main; + Evas_Object *layout_main; + Evas_Object *navi_bar; + + double scale_factor; + + Evas_Object *search_entry; + Evas_Object *search_bar; + Evas_Object *search_cancel_btn; + Evas_Object *search_gl; + Evas_Object *noresult_view; + Evas_Object *sb_layout; + Evas_Object *back_btn; + + Evas_Object *ctxpopup; + Evas_Object *cate_ctxpopup; + + Evas_Object *cate_btn; + Ecore_Idler *idler_search; + Ecore_Idler *idler_create_ui; + + int touch_x; + int touch_y; + + Elm_Genlist_Item_Class *itc_pslist_1line; + Elm_Genlist_Item_Class *itc_pslist_2line; + Elm_Genlist_Item_Class *itc_grouptitle; + Elm_Genlist_Item_Class *itc_listmore; + + search_more_result cate_info[SEARCH_TYPE_PHONE_MAX]; + + char *search_word; + char *not_markup_search_word; + + int back_btn_type; + + Evas_Object *effect_layout; + ui_gadget *detail_ug; + + Elm_Object_Item *gl_result_group_item[PHONE_CATEGORY_LIST_CNT]; + + sqlite3 *search_db_hd; + sqlite3_stmt *search_db_sql_stmt[SEARCH_STMT_MAX]; + + /* Handle List */ + MSG_HANDLE_T msg_handle; + MediaSvcHandle *media_handle; +}; + +#endif diff --git a/include/smartsearch_define.h b/include/smartsearch_define.h new file mode 100755 index 0000000..2cf2609 --- /dev/null +++ b/include/smartsearch_define.h @@ -0,0 +1,140 @@ +/* + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + +#ifndef __DEF_SMARTSEARCH_DEFINE_H__ +#define __DEF_SMARTSEARCH_DEFINE_H__ + + +enum { + SEARCH_TYPE_PHONE_CONTACTS = 0, + SEARCH_TYPE_PHONE_MSG, + SEARCH_TYPE_PHONE_EMAIL, + SEARCH_TYPE_PHONE_IMAGES, + SEARCH_TYPE_PHONE_MUSIC, + SEARCH_TYPE_PHONE_VIDEO, + SEARCH_TYPE_PHONE_CALENDAR, + SEARCH_TYPE_PHONE_MEMO, + SEARCH_TYPE_PHONE_MENU, + SEARCH_TYPE_PHONE_MAX +}; + +enum { + SEARCH_TYPE_PHONE = 0, +}; + +enum { + LAUNCH_ERROR_FILE_NOT_FOUND = 1, + LAUNCH_ERROR_AUL_LAUNCH, + LAUNCH_ERROR_APPSVC, + LAUNCH_ERROR_MAX +}; + +enum { + BACK_BTN_TYPE_LOWER, + BACK_BTN_TYPE_CLOSE +}; + +enum { + SEARCH_CATE_BTN_IMG_TYPE_UNPRESSED, + SEARCH_CATE_BTN_IMG_TYPE_PRESSED, + SEARCH_CATE_BTN_IMG_TYPE_MAX +}; + +enum { + SEARCH_RET_SEARCH_FAIL = -1, + SEARCH_RET_SEARCH_NONE, + SEARCH_RET_SEARCH_SUCCESS +}; + +enum { + SEARCH_RET_FAIL = -1, + SEARCH_RET_SUCCESS +}; + +enum { + SEARCH_STMT_GET_HISTORY_ALL = 0, + SEARCH_STMT_GET_HISTORY_WITH_KEYWORD, + SEARCH_STMT_INSERT_KEYWORD, + SEARCH_STMT_MAX +}; + +enum { + SEARCH_SQL_BIND_TYPE_SIMPLEX = 0, + SEARCH_SQL_BIND_TYPE_DUPLEX +}; + +//============================================================================================================================== + +#define SEARCH_PACKAGE "smartsearch" +#define SEARCH_ICON_PATH RESDIR"/icons/" +#define SEARCH_EDJ EDJDIR"/smartsearch.edj" + +#define DEF_BUF_LEN (512) +#define MAX_LENGTH_PER_LINE (512) +#define MAX_LENGTH_PER_PATH (512) +#define MAX_LENGTH_PER_ID (10) +#define MAX_SEARCH_WORD_SIZE (128) + +#define SMARTSEARCH_KEY_KEYWORD "db/smartsearch/keyword" + +#define PHONE_CATEGORY_LIST_CNT (SEARCH_TYPE_PHONE_MAX) +#define DB_QUERY_LEN (512) + +#define NO_RESULT_BODY_LEN 7 + +#define SEARCH_CATEGORY_LIST_MORE_CNT (20) + +#define DB_ESCAPE_CHAR "|" + + +//============================================================================================================================== + + +#define SEARCH_FREE(ptr) \ + do { \ + if(ptr != NULL) \ + { \ + free(ptr); \ + ptr = NULL; \ + } \ + }while(0); + +#define SEARCH_MALLOC(ptr, size, type) \ + do { \ + if(size > 0) { \ + ptr = (type *)malloc(size); \ + if(ptr == NULL) \ + assert(0); \ + } else { \ + assert(0); \ + } \ + } while(0); + +/* Gives comparison result of two strings and returns -1 if any of two is NULL */ +#define SEARCH_STRCMP(str1, str2) ((str1 && str2) ? strcmp(str1, str2) : -1) + +/* Returns string length of src and 0 if it is NULL */ +#define SEARCH_STRLEN(src) ((src != NULL)? strlen(src): 0) + +#define SEARCH_SCALABLED_SIZE(size, _scale_factor) (int)((size) * (_scale_factor)) + +#endif + |