Update changed code
[apps/home/smartsearch.git] / include / smartsearch_define.h
index 2cf2609..c6bf078 100755 (executable)
@@ -1,12 +1,12 @@
 /*
  * 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.
  */
 
 
-
-
-
-
 #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
+       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_TYPE_PHONE = 0,
+       SEARCH_GENLIST_GROUP = 0,
+       SEARCH_GENLIST_ITEM,
+       SEARCH_GENLIST_MORE
 };
 
 enum {
@@ -53,12 +65,6 @@ enum {
 };
 
 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
@@ -70,22 +76,40 @@ enum {
 };
 
 enum {
-       SEARCH_STMT_GET_HISTORY_ALL = 0,
-       SEARCH_STMT_GET_HISTORY_WITH_KEYWORD,
-       SEARCH_STMT_INSERT_KEYWORD,
+       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)
@@ -93,17 +117,27 @@ enum {
 #define MAX_LENGTH_PER_ID      (10)
 #define MAX_SEARCH_WORD_SIZE   (128)
 
-#define SMARTSEARCH_KEY_KEYWORD                "db/smartsearch/keyword"
+#define SMARTSEARCH_KEY_KEYWORD                "file/private/org.tizen.smartsearch/keyword"
 
-#define PHONE_CATEGORY_LIST_CNT         (SEARCH_TYPE_PHONE_MAX)
+#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   (20)
+#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 = ?;"
+
 
 //==============================================================================================================================
 
@@ -126,15 +160,15 @@ enum {
                } else { \
                        assert(0); \
                } \
-       } while(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)      
+#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)) 
+#define SEARCH_SCALABLED_SIZE(size, _scale_factor)     (int)((size) * (_scale_factor))
 
 #endif