summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:00:57 +0900
committerHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:00:57 +0900
commitcc411fe3142413dc1341ad4d074d9596cd8bf3ef (patch)
tree13492e8870c607304fe4e80abae5cf49efc10bf9 /include
parent636878b6968ffd73d0fee4722d992ecb47e9f3a4 (diff)
downloadsmartsearch-accepted/tizen_2.0/20130215.204608.tar.gz
smartsearch-accepted/tizen_2.0/20130215.204608.tar.bz2
smartsearch-accepted/tizen_2.0/20130215.204608.zip
Diffstat (limited to 'include')
-rwxr-xr-xinclude/common_util.h31
-rwxr-xr-xinclude/ps_app_interface.h38
-rwxr-xr-xinclude/ps_debug_util.h200
-rwxr-xr-xinclude/ps_makeupviews.h40
-rwxr-xr-xinclude/ps_searcher.h67
-rwxr-xr-xinclude/search_bar.h41
-rwxr-xr-xinclude/smartsearch.h172
-rwxr-xr-xinclude/smartsearch_define.h203
8 files changed, 792 insertions, 0 deletions
diff --git a/include/common_util.h b/include/common_util.h
new file mode 100755
index 0000000..4d9f5cc
--- /dev/null
+++ b/include/common_util.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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
+
+void search_util_date_time_format_init();
+void search_util_date_time_format_deinit();
+void search_region_format_cb(void *data);
+void search_util_date_time_format_get_val(time_t time,
+ char *format_val, int type);
+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..ecb55ad
--- /dev/null
+++ b/include/ps_app_interface.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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_browser_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..bf4f212
--- /dev/null
+++ b/include/ps_debug_util.h
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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_RETV_IF_WITH_ERRORV(cond,ret,errorv) \
+ do {\
+ if(cond) {\
+ LOGW("\x1b[33m[%s() \t%s:%d][RET_IF]\x1b[0m error value = %d",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__, errorv);\
+ 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_RETV_IF_WITH_ERRORV(cond,ret,errorv) \
+ do {\
+ if(cond) {\
+ fprintf(stderr, "[%s() \t%s:%d][RET_IF] error_value = %d",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__, errorv);\
+ 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_RETV_IF_WITH_ERRORV(cond,ret,errorv)
+#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..d64e0c6
--- /dev/null
+++ b/include/ps_makeupviews.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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);
+int search_app_connect(void *data);
+int search_app_disconnect(void *data);
+void search_set_result_list(void *data);
+void search_stop_search(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);
+Ecore_Thread* search_make_result_thread(void *data);
+struct search_genlist_item_info* search_add_genlist_item(int type,
+ struct search_content_object *obj, Elm_Genlist_Item_Class *itc_style, void *data,
+ Elm_Object_Item *parent);
+#endif // __DEF_PS_MAKEUPVIEWS_H__
diff --git a/include/ps_searcher.h b/include/ps_searcher.h
new file mode 100755
index 0000000..0749dad
--- /dev/null
+++ b/include/ps_searcher.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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 __SEARCHSEARCHER_HEADER_H__
+#define __SEARCHSEARCHER_HEADER_H__
+
+#include "smartsearch.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_bind_text(sqlite3 *db_handle, sqlite3_stmt *sql_stmt, int col, char *data);
+
+int search_sql_bind_int(sqlite3 *db_handle, sqlite3_stmt *sql_stmt, int col, int data);
+
+int search_sql_contact_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_msg_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_email_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_calendar_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_memo_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_image_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_video_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_music_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_menu_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_browser_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+
+void search_sql_update_result_object(struct search_content_object* result_obj, sqlite3* db_handle, sqlite3_stmt** db_sql);
+
+#endif // __SEARCHSERVER_HEADER_H__
diff --git a/include/search_bar.h b/include/search_bar.h
new file mode 100755
index 0000000..e9be2b9
--- /dev/null
+++ b/include/search_bar.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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_category_custom_layout_add(Evas_Object *parent);
+Evas_Object *search_category_image_add(char* imgpath, Evas_Object *parent, int width, int height, bool resize);
+Evas_Object *search_searchbar_category_icon_add(char *img, Evas_Object *parent, int width, int height, bool resize);
+void search_create_searchbar_layout(Evas_Object *parent, void *data);
+void search_delete_searchbar_layout(void *data);
+Evas_Object *search_create_layout(Evas_Object *parent, const char *file, const char *group);
+Evas_Object *search_create_category_button(Evas_Object *parent, void *data);
+Evas_Object *search_create_search_bar(Evas_Object *parent);
+Evas_Object *search_create_search_cancel_btn(Evas_Object *parent);
+Evas_Object *search_create_search_entry(Evas_Object *parent, void *data);
+#endif /* __DEF_SEARCH_BAR_H__ */
diff --git a/include/smartsearch.h b/include/smartsearch.h
new file mode 100755
index 0000000..0726a6f
--- /dev/null
+++ b/include/smartsearch.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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>
+#include <sqlite3.h>
+#include <msg_types.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 appdata *ad;
+};
+
+struct search_content_object {
+ int order;
+ Eina_Bool visible;
+ char *name;
+ int string_type;
+ int contents_type;
+ int category_type;
+ char *def_pkg_name;
+ char *obj_icon_path;
+ Elm_Object_Item *gl_result_grp;
+ struct search_more_result mr_info;
+};
+
+struct search_category_info {
+ char *btn_icon_path;
+ char *btn_icon_press_path;
+ char *popup_icon_path;
+ char *popup_press_icon_path;
+};
+
+struct search_genlist_item_info {
+ int type;
+ struct search_content_object *obj;
+ Elm_Genlist_Item_Class *itc_style;
+ void *data;
+ Elm_Object_Item *parent;
+};
+
+struct search_genlist_info {
+ struct search_genlist_item_info *group;
+ GList *itemlist;
+ struct search_genlist_item_info *more;
+};
+
+struct search_pipe_data {
+ int cmd;
+ struct search_genlist_info *result_list;
+ int search_ret;
+ struct search_content_object *obj;
+};
+
+struct search_item_sel {
+ int type;
+ char *launch_path;
+ char *launch_param;
+ char *text1;
+ char *text2;
+ char *icon1;
+ char *icon2;
+};
+
+struct search_item_more_sel {
+ struct search_content_object *obj;
+};
+
+struct appdata {
+ Evas_Object *win_main;
+ Evas_Object *bg;
+ Evas_Object *conformant;
+ Evas_Object *layout_main;
+ Evas_Object *navi_bar;
+ Elm_Object_Item *navi_it;
+
+ 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_create_ui;
+ Ecore_Timer *search_timer;
+
+ int touch_x;
+ int touch_y;
+
+ Elm_Genlist_Item_Class *itc_pslist_1line;
+ Elm_Genlist_Item_Class *itc_pslist_1line_1icon;
+ Elm_Genlist_Item_Class *itc_pslist_1line_1icon_browser_history;
+ Elm_Genlist_Item_Class *itc_pslist_1line_2icon;
+ Elm_Genlist_Item_Class *itc_pslist_2line_1icon;
+ Elm_Genlist_Item_Class *itc_pslist_2line_2icon;
+ Elm_Genlist_Item_Class *itc_pslist_2line_2icon_browser_bookmark;
+ Elm_Genlist_Item_Class *itc_grouptitle;
+ Elm_Genlist_Item_Class *itc_listmore;
+
+ Ecore_Pipe *pipe;
+ Ecore_Thread *search_thread;
+ Eina_Condition condition;
+ Eina_Lock mutex;
+
+ bool first_search;
+ char *search_word;
+ char *not_markup_search_word;
+
+ int back_btn_type;
+ int search_category;
+
+ ui_gadget_h detail_ug;
+
+ sqlite3 *search_db_hd;
+ sqlite3_stmt *search_db_sql[SEARCH_STMT_MAX];
+ struct search_content_object result_obj[SEARCH_CONT_MAX];
+ struct search_category_info category_info[SEARCH_CATE_MAX];
+
+ /* Handle List */
+ msg_handle_t msg_handle;
+};
+
+#endif
diff --git a/include/smartsearch_define.h b/include/smartsearch_define.h
new file mode 100755
index 0000000..0894c6f
--- /dev/null
+++ b/include/smartsearch_define.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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_OBJ_PHONE_CONTENTS = 0,
+ SEARCH_OBJ_APPLICATION,
+ SEARCH_OBJ_TYPE_MAX
+};
+
+enum {
+ SEARCH_CONT_PHONE_MIN = 0,
+ SEARCH_CONT_PHONE_CONTACTS = SEARCH_CONT_PHONE_MIN,
+ SEARCH_CONT_PHONE_MSG,
+ SEARCH_CONT_PHONE_EMAIL,
+ SEARCH_CONT_PHONE_IMAGES,
+ SEARCH_CONT_PHONE_MUSIC,
+ SEARCH_CONT_PHONE_VIDEO,
+ SEARCH_CONT_PHONE_CALENDAR,
+ SEARCH_CONT_PHONE_MEMO,
+ SEARCH_CONT_PHONE_MENU,
+ SEARCH_CONT_PHONE_BROWSER,
+ SEARCH_CONT_PHONE_MAX = SEARCH_CONT_PHONE_BROWSER,
+ SEARCH_CONT_MAX
+};
+
+enum {
+ SEARCH_CATE_PHONE = 0,
+ SEARCH_CATE_MAX
+};
+
+enum {
+ SEARCH_GENLIST_GROUP = 0,
+ SEARCH_GENLIST_ITEM,
+ SEARCH_GENLIST_MORE
+};
+
+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_RET_SEARCH_FAIL = -1,
+ SEARCH_RET_SEARCH_NONE,
+ SEARCH_RET_SEARCH_SUCCESS
+};
+
+enum {
+ SEARCH_RET_FAIL = -1,
+ SEARCH_RET_SUCCESS
+};
+
+enum {
+ SEARCH_STMT_GET_CATEGORY_LIST_ALL = 0,
+ SEARCH_STMT_INSERT_OBJECT_INFO,
+ SEARCH_STMT_UPDATE_OBJECT_INFO,
+ SEARCH_STMT_MAX
+};
+
+enum {
+ SEARCH_SQL_BIND_TYPE_SIMPLEX = 0,
+ SEARCH_SQL_BIND_TYPE_DUPLEX
+};
+
+enum {
+ SEARCH_PIPE_CMD_CLEAR_GENLIST = 0,
+ SEARCH_PIPE_CMD_ADD_GENLIST_PHONE,
+ SEARCH_PIPE_CMD_SET_LAYOUT,
+};
+
+enum {
+ SEARCH_STR_TYPE_APP_STRING = 0,
+ SEARCH_STR_TYPE_SYSTEM_STRING,
+};
+
+enum {
+ SEARCH_DATE_TYPE_YYMMDD = 0,
+ SEARCH_DATE_TYPE_YYMM,
+};
+
+//==============================================================================================================================
+
+#define SEARCH_PACKAGE "smartsearch"
+#define SEARCH_ICON_PATH RESDIR"/icons/"
+#define SEARCH_EDJ EDJDIR"/smartsearch.edj"
+#define SEARCH_SEARCHBAR_GROUP_NORMAL "smartsearch/search_result"
+#define SEARCH_DB_PATH DBDIR"/.search.db"
+
+#define SEARCH_FAVORITE_ICON SEARCH_ICON_PATH"B10_icon_list_favorite.png"
+#define SEARCH_SDCARD_ICON SEARCH_ICON_PATH"B10_icon_list_memorycard.png"
+
+#define SEARCH_THUMBNAIL_SIZE 72
+#define SEARCH_ICON_SIZE 64
+
+#define SEARCH_CATEGORY_BTN_ICON_SIZE_WIDTH 44
+#define SEARCH_CATEGORY_BTN_ICON_SIZE_HEIGHT 44
+
+#define SEARCH_CATEGORY_POPUPBTN_ICON_SIZE_WIDTH 48
+#define SEARCH_CATEGORY_POPUPBTN_ICON_SIZE_HEIGHT 48
+
+#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 DB_QUERY_LEN (512)
+
+#define SEARCH_MAX_UCHAR_SIZE 64
+#define SEARCH_MAX_CHAR_SIZE 128
+
+#define SMARTSEARCH_KEY_KEYWORD "file/private/org.tizen.smartsearch/keyword"
+
+#define PHONE_CATEGORY_LIST_CNT (SEARCH_CONT_PHONE_MAX)
+
+
+#define NO_RESULT_BODY_LEN 7
+
+#define SEARCH_CATEGORY_LIST_MORE_CNT (100)
+
+#define DB_ESCAPE_CHAR "|"
+
+#define SEARCH_DB_SQL_GET_CATEGORY_LIST_ALL "SELECT item_name, item_string, item_visible, item_order, item_contents_type, item_object_type, " \
+ "def_pkg_name FROM search_category ORDER by item_order asc;"
+#define SEARCH_DB_SQL_INSERT_OBJECT_IFNO "REPLACE INTO search_category" \
+ "(item_name, item_string, item_visible, item_order, item_contents_type, item_object_type, def_pkg_name) " \
+ "VALUES(?,?,?,?,?,?,?);"
+
+#define SEARCH_DB_SQL_UPDATE_OBJECT_INFO "UPDATE search_category SET " \
+ "item_name = ?, item_string = ?, item_visible = ?, item_order = ?, item_contents_type = ?, item_object_type = ?, " \
+ "def_pkg_name = ? WHERE item_contents_type = ?;"
+
+
+//==============================================================================================================================
+
+#define PART_IMAGE "image"
+#define SIGNAL_SEARCH_CUSTOM_IMAGE_CLICKED "signal.search.image.clicked"
+#define SIGNAL_SEARCH_CUSTOM_IMAGE_UNCLICKED "signal.search.image.unclicked"
+
+//==============================================================================================================================
+#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);
+
+#define SEARCH_EVAS_OBJECT_FREE(ptr) \
+ do { \
+ if(ptr != NULL) \
+ { \
+ evas_object_del(ptr); \
+ ptr = NULL; \
+ } \
+ }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
+