summaryrefslogtreecommitdiff
path: root/include/smartsearch_define.h
blob: c6bf078e7a2a674dfbf1b1082a50979146dee536 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
 * 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