/* * 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_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, }; //============================================================================================================================== #define SEARCH_PACKAGE "smartsearch" #define SEARCH_ICON_PATH RESDIR"/icons/" #define SEARCH_EDJ EDJDIR"/smartsearch.edj" #define SEARCH_DB_PATH "/opt/apps/org.tizen.smartsearch/data/.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 96 #define SEARCH_ICON_SIZE 64 #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 "file/private/org.tizen.smartsearch/keyword" #define PHONE_CATEGORY_LIST_CNT (SEARCH_CONT_PHONE_MAX) #define DB_QUERY_LEN (512) #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 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