Flora license update
[apps/home/smartsearch.git] / include / smartsearch_define.h
1 /*
2  * Copyright 2012-2013 Samsung Electronics Co., Ltd/
3  *
4  * Licensed under the Flora License, Version 1.1 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18
19 #ifndef __DEF_SMARTSEARCH_DEFINE_H__
20 #define __DEF_SMARTSEARCH_DEFINE_H__
21
22
23 enum {
24         SEARCH_OBJ_PHONE_CONTENTS = 0,
25         SEARCH_OBJ_APPLICATION,
26         SEARCH_OBJ_TYPE_MAX
27 };
28
29 enum {
30         SEARCH_CONT_PHONE_MIN = 0,
31         SEARCH_CONT_PHONE_CONTACTS = SEARCH_CONT_PHONE_MIN,
32         SEARCH_CONT_PHONE_MSG,
33         SEARCH_CONT_PHONE_EMAIL,
34         SEARCH_CONT_PHONE_IMAGES,
35         SEARCH_CONT_PHONE_MUSIC,
36         SEARCH_CONT_PHONE_VIDEO,
37         SEARCH_CONT_PHONE_CALENDAR,
38         SEARCH_CONT_PHONE_MEMO,
39         SEARCH_CONT_PHONE_MENU,
40         SEARCH_CONT_PHONE_BROWSER,
41         SEARCH_CONT_PHONE_MAX = SEARCH_CONT_PHONE_BROWSER,
42         SEARCH_CONT_MAX
43 };
44
45 enum {
46         SEARCH_CATE_PHONE = 0,
47         SEARCH_CATE_MAX
48 };
49
50 enum {
51         SEARCH_GENLIST_GROUP = 0,
52         SEARCH_GENLIST_ITEM,
53         SEARCH_GENLIST_MORE
54 };
55
56 enum {
57         LAUNCH_ERROR_FILE_NOT_FOUND = 1,
58         LAUNCH_ERROR_AUL_LAUNCH,
59         LAUNCH_ERROR_APPSVC,
60         LAUNCH_ERROR_MAX
61 };
62
63 enum {
64         BACK_BTN_TYPE_LOWER,
65         BACK_BTN_TYPE_CLOSE
66 };
67
68 enum {
69         SEARCH_RET_SEARCH_FAIL = -1,
70         SEARCH_RET_SEARCH_NONE,
71         SEARCH_RET_SEARCH_SUCCESS
72 };
73
74 enum {
75         SEARCH_RET_FAIL = -1,
76         SEARCH_RET_SUCCESS
77 };
78
79 enum {
80         SEARCH_STMT_GET_CATEGORY_LIST_ALL = 0,
81         SEARCH_STMT_INSERT_OBJECT_INFO,
82         SEARCH_STMT_UPDATE_OBJECT_INFO,
83         SEARCH_STMT_MAX
84 };
85
86 enum {
87         SEARCH_SQL_BIND_TYPE_SIMPLEX = 0,
88         SEARCH_SQL_BIND_TYPE_DUPLEX
89 };
90
91 enum {
92         SEARCH_PIPE_CMD_CLEAR_GENLIST = 0,
93         SEARCH_PIPE_CMD_ADD_GENLIST_PHONE,
94         SEARCH_PIPE_CMD_SET_LAYOUT,
95 };
96
97 enum {
98         SEARCH_STR_TYPE_APP_STRING = 0,
99         SEARCH_STR_TYPE_SYSTEM_STRING,
100 };
101
102 enum {
103         SEARCH_DATE_TYPE_YYMMDD = 0,
104         SEARCH_DATE_TYPE_YYMM,
105 };
106
107 //==============================================================================================================================
108
109 #define SEARCH_PACKAGE "smartsearch"
110 #define SEARCH_ICON_PATH  RESDIR"/icons/"
111 #define SEARCH_EDJ EDJDIR"/smartsearch.edj"
112 #define SEARCH_SEARCHBAR_GROUP_NORMAL "smartsearch/search_result"
113 #define SEARCH_DB_PATH DBDIR"/.search.db"
114
115 #define SEARCH_FAVORITE_ICON    SEARCH_ICON_PATH"B10_icon_list_favorite.png"
116 #define SEARCH_SDCARD_ICON              SEARCH_ICON_PATH"B10_icon_list_memorycard.png"
117
118 #define SEARCH_THUMBNAIL_SIZE 72
119 #define SEARCH_ICON_SIZE 64
120
121 #define SEARCH_CATEGORY_BTN_ICON_SIZE_WIDTH 44
122 #define SEARCH_CATEGORY_BTN_ICON_SIZE_HEIGHT 44
123
124 #define SEARCH_CATEGORY_POPUPBTN_ICON_SIZE_WIDTH 48
125 #define SEARCH_CATEGORY_POPUPBTN_ICON_SIZE_HEIGHT 48
126
127 #define DEF_BUF_LEN            (512)
128 #define MAX_LENGTH_PER_LINE    (512)
129 #define MAX_LENGTH_PER_PATH    (512)
130 #define MAX_LENGTH_PER_ID      (10)
131 #define MAX_SEARCH_WORD_SIZE   (128)
132 #define DB_QUERY_LEN                    (512)
133
134 #define SEARCH_MAX_UCHAR_SIZE 64
135 #define SEARCH_MAX_CHAR_SIZE 128
136
137 #define SMARTSEARCH_KEY_KEYWORD         "file/private/org.tizen.smartsearch/keyword"
138
139 #define PHONE_CATEGORY_LIST_CNT         (SEARCH_CONT_PHONE_MAX)
140
141
142 #define NO_RESULT_BODY_LEN      7
143
144 #define SEARCH_CATEGORY_LIST_MORE_CNT   (100)
145
146 #define DB_ESCAPE_CHAR          "|"
147
148 #define SEARCH_DB_SQL_GET_CATEGORY_LIST_ALL "SELECT item_name, item_string, item_visible, item_order, item_contents_type, item_object_type, " \
149                                                                         "def_pkg_name FROM search_category  ORDER by item_order asc;"
150 #define SEARCH_DB_SQL_INSERT_OBJECT_IFNO "REPLACE INTO search_category" \
151                                                                                 "(item_name, item_string, item_visible, item_order, item_contents_type, item_object_type, def_pkg_name) " \
152                                                                                 "VALUES(?,?,?,?,?,?,?);"
153
154 #define SEARCH_DB_SQL_UPDATE_OBJECT_INFO "UPDATE search_category SET " \
155                                                                         "item_name = ?, item_string = ?, item_visible = ?, item_order = ?, item_contents_type = ?, item_object_type = ?, " \
156                                                                         "def_pkg_name = ? WHERE item_contents_type = ?;"
157
158
159 //==============================================================================================================================
160
161 #define PART_IMAGE                                      "image"
162 #define SIGNAL_SEARCH_CUSTOM_IMAGE_CLICKED                              "signal.search.image.clicked"
163 #define SIGNAL_SEARCH_CUSTOM_IMAGE_UNCLICKED                    "signal.search.image.unclicked"
164
165 //==============================================================================================================================
166 #define SEARCH_FREE(ptr)        \
167         do { \
168                 if(ptr != NULL) \
169                 {       \
170                         free(ptr);      \
171                         ptr = NULL;     \
172                 }       \
173         }while(0);
174
175 #define SEARCH_MALLOC(ptr, size, type) \
176         do { \
177                 if(size > 0) { \
178                         ptr = (type *)malloc(size); \
179                         if(ptr == NULL) \
180                                 assert(0); \
181                 } else { \
182                         assert(0); \
183                 } \
184         } while(0);
185
186 #define SEARCH_EVAS_OBJECT_FREE(ptr)    \
187         do { \
188                 if(ptr != NULL) \
189                 {       \
190                         evas_object_del(ptr);   \
191                         ptr = NULL;     \
192                 }       \
193         }while(0);
194
195 /* Gives comparison result of two strings and returns -1 if any of two is NULL */
196 #define SEARCH_STRCMP(str1, str2)       ((str1 && str2) ? strcmp(str1, str2) : -1)
197
198 /* Returns string length of src and 0 if it is NULL */
199 #define SEARCH_STRLEN(src)      ((src != NULL)? strlen(src): 0)
200
201 #define SEARCH_SCALABLED_SIZE(size, _scale_factor)      (int)((size) * (_scale_factor))
202
203 #endif
204