Junghyun Kim <jh1114.kim@samsung.com>\r
-Hakjoo Ko <hakjoo.ko@samsung.com>\r
-Hyungdeuk Kim <hd3.kim@samsung.com>\r
+Mijin Hwang <mjlois.hwang@samsung.com>\r
ui-gadget-1
utilX
x11
- contacts-service
- calendar
memo
icu-i18n
email-service
capi-appfw-app-manager
capi-web-favorites
capi-content-media-content
+ contacts-service2
+ calendar-service2
libxml-2.0
)
MESSAGE("add -DTARGET")
ENDIF("${ARCH}" STREQUAL "arm")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
--- /dev/null
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of SAMSUNG
+ * ELECTRONICS ("Confidential Information"). You agree and acknowledge that this
+ * software is owned by Samsung and you shall not disclose such Confidential
+ * Information and shall use it only in accordance with the terms of the license
+ * agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no
+ * representations or warranties about the suitability of the software, either
+ * express or implied, including but not limited to the implied warranties of
+ * merchantability, fitness for a particular purpose, or non-infringement.
+ * SAMSUNG shall not be liable for any damages suffered by licensee arising out
+ * of or releated to this software.
+ *
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////
+//
+// ctxpopup
+//
+///////////////////////////////////////////////////////////////////////////////////////
+
+#define CTXPOPUP_SHADOW_PADDING 10
+#define CTXPOPUP_FRAME_CORNER_SIZE 4 4
+#define CTXPOPUP_FONT_COLOR 0 0 0 255
+#define CTXPOPUP_CLICKED_FONT_COLOR 255 255 255 255
+#define CTXPOPUP_ITEM_DISABLED_COLOR 200 200 200 127
+#define CTXPOPUP_LIST_PADDING 10
+#define CTXPOPUP_LIST_SHADOW_PADDING 3
+
+#define CTXPOPUP_WIDTH_MIN_INC 386
+#define CTXPOPUP_CONTENT_PADDING 4
+#define CTXPOPUP_FRAME_CORNER_ARROW_PADDING 20
+#define CTXPOPUP_BG_COLOR_INC 0 0 0 0
+#define CTXPOPUP_BG_PRESS_COLOR_INC 42 137 194 255
+#define CTXPOPUP_SEPARATOR_PXLINE_SIZE_INC 1
+#define CTXPOPUP_SEPARATOR_PADDING_INC 20
+#define CTXPOPUP_SEPARATOR_COLOR_INC 45 45 45 255
+#define CTXPOPUP_SEPARATOR2_COLOR_INC 91 91 91 255
+#define CTXPOPUP_HORIZONTAL_SEPARATOR_1_COLOR_INC 45 45 45 255
+#define CTXPOPUP_HORIZONTAL_SEPARATOR_2_COLOR_INC 91 91 91 255
+#define CTXPOPUP_HORIZONTAL_SEPARATOR_MIN_SIZE_INC 1 74
+#define CTXPOPUP_HORIZONTAL_SEPARATOR_MAX_SIZE_INC 1 74
+#define CTXPOPUP_TP_BG_COLOR_INC 7 180 211 255
+#define CTXPOPUP_ITEM_TEXT_SIZE_INC 40
+#define CTXPOPUP_ITEM_MAIN_TEXT_SIZE_INC 32
+#define CTXPOPUP_ITEM_HEIGHT_INC 110
+#define CTXPOPUP_ITEM_HORIZONTAL_WIDTH_INC 128
+#define CTXPOPUP_ITEM_HORIZONTAL_HEIGHT_INC 96
+#define CTXPOPUP_ICON_WIDTH_INC 64
+#define CTXPOPUP_ICON_HEIGHT_INC 64
+#define CTXPOPUP_ICON_HORIZONTAL_WIDTH_INC 128
+#define CTXPOPUP_ICON_HORIZONTAL_HEIGHT_INC 96
+#define CTXPOPUP_ARROW_SIZE_INC 48 48
+#define CTXPOPUP_VERTICAL_ARROW_SIZE_INC 40 30
+#define CTXPOPUP_HORIZONTAL_ARROW_SIZE_INC 30 40
+#define CTXPOPUP_ITEM_TEXT_PADDING_INC 20
+#define CTXPOPUP_ITEM_ICON_PADDING_INC 16
+
+
+///////////////////////////////////////////////////////////////////////////////
+ group {
+ name: "elm/ctxpopup/icon_style_item/default";
+ parts {
+ part {
+ name: "event_blocker";
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "bg";
+ scale: 1;
+ mouse_events: 0;
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: CTXPOPUP_BG_COLOR_INC;
+ visible: 1;
+ min: CTXPOPUP_ITEM_HORIZONTAL_WIDTH_INC (CTXPOPUP_ITEM_HORIZONTAL_HEIGHT_INC-(CTXPOPUP_CONTENT_PADDING*2));
+ max: CTXPOPUP_ITEM_HORIZONTAL_WIDTH_INC (CTXPOPUP_ITEM_HORIZONTAL_HEIGHT_INC-(CTXPOPUP_CONTENT_PADDING*2));
+ }
+ description {
+ state: "clicked" 0.0;
+ color: CTXPOPUP_BG_PRESS_COLOR_INC;
+ visible: 1;
+ }
+ }
+ part {
+ name: "left_padding";
+ scale: 1;
+ description {
+ min: ((CTXPOPUP_ITEM_HORIZONTAL_WIDTH_INC-CTXPOPUP_ICON_HORIZONTAL_WIDTH_INC)/2) (CTXPOPUP_ITEM_HORIZONTAL_HEIGHT_INC-(CTXPOPUP_CONTENT_PADDING*2));
+ max: ((CTXPOPUP_ITEM_HORIZONTAL_WIDTH_INC-CTXPOPUP_ICON_HORIZONTAL_WIDTH_INC)/2) (CTXPOPUP_ITEM_HORIZONTAL_HEIGHT_INC-(CTXPOPUP_CONTENT_PADDING*2));
+ visible: 1;
+ align: 0 0;
+ color: 0 255 0 255;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "separator1";
+ mouse_events: 0;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: CTXPOPUP_SEPARATOR_COLOR_INC;
+ align: 0 0.5;
+ min: CTXPOPUP_HORIZONTAL_SEPARATOR_MIN_SIZE_INC;
+ max: CTXPOPUP_HORIZONTAL_SEPARATOR_MAX_SIZE_INC;
+ visible: 1;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "separator2";
+ mouse_events: 1;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: CTXPOPUP_SEPARATOR2_COLOR_INC;
+ rel1 { relative: 1.0 0.0; to_x: "separator1"; }
+ align: 0 0.5;
+ min: CTXPOPUP_HORIZONTAL_SEPARATOR_MIN_SIZE_INC;
+ max: CTXPOPUP_HORIZONTAL_SEPARATOR_MAX_SIZE_INC;
+ visible: 0;
+ }
+ description {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "elm.swallow.icon";
+ type: SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: CTXPOPUP_ICON_HORIZONTAL_WIDTH_INC CTXPOPUP_ICON_HORIZONTAL_HEIGHT_INC;
+ max: CTXPOPUP_ICON_HORIZONTAL_WIDTH_INC CTXPOPUP_ICON_HORIZONTAL_HEIGHT_INC;
+ align: 0.5 0.5;
+ aspect: 1.0 1.0;
+ rel1 { relative: 1 0; to_x: "left_padding"; }
+ rel2 { relative: 0 1; to_x: "right_padding"; }
+ }
+ }
+ part {
+ name: "right_padding";
+ scale: 1;
+ description {
+ min: ((CTXPOPUP_ITEM_HORIZONTAL_WIDTH_INC-CTXPOPUP_ICON_HORIZONTAL_WIDTH_INC)/2) (CTXPOPUP_ITEM_HORIZONTAL_HEIGHT_INC-(CTXPOPUP_CONTENT_PADDING*2));
+ max: ((CTXPOPUP_ITEM_HORIZONTAL_WIDTH_INC-CTXPOPUP_ICON_HORIZONTAL_WIDTH_INC)/2) (CTXPOPUP_ITEM_HORIZONTAL_HEIGHT_INC-(CTXPOPUP_CONTENT_PADDING*2));
+ visible: 1;
+ color: 0 0 255 255;
+ align: 1 1;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "over1";
+ mouse_events: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ part {
+ name: "over2";
+ mouse_events: 1;
+ repeat_events: 1;
+ description {
+ state: "default" 0.0;
+ }
+ }
+ part {
+ name: "disclip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ }
+ description {
+ state: "disabled" 0.0;
+ visible: 1;
+ color: CTXPOPUP_ITEM_DISABLED_COLOR;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "default";
+ signal: "elm,state,default";
+ source: "elm";
+ script {
+ set_state(PART:"separator1", "default", 0.0);
+ set_state(PART:"separator2", "default", 0.0);
+ }
+ }
+ program {
+ name: "separator";
+ signal: "elm,state,separator";
+ source: "elm";
+ script {
+ set_state(PART:"separator1", "visible", 0.0);
+ set_state(PART:"separator2", "visible", 0.0);
+ }
+ }
+ program {
+ name: "item_unclick";
+ signal: "mouse,clicked,1";
+ source: "over1";
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ action: STATE_SET "disabled" 0.0;
+ target: "disclip";
+ }
+ program {
+ name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "disclip";
+ }
+ program {
+ name: "item_click2";
+ signal: "mouse,down,1";
+ source: "over2";
+ script {
+ set_state(PART:"bg", "clicked", 0.0);
+ }
+ }
+ program {
+ name: "item_unclick2";
+ signal: "mouse,up,1";
+ source: "over2";
+ script {
+ set_state(PART:"bg", "default", 0.0);
+ }
+ }
+ }
+ }
+
--- /dev/null
+/*
+ * 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.
+ */
+
+group {
+ name: "smartsearch/custom_image_button";
+ parts {
+ part {
+ name: "bg";
+ mouse_events: 0;
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ rel1 { relative: 0.0 0.0;}
+ rel2 { relative: 1.0 1.0;}
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "image_rect";
+ mouse_events: 1;
+ type: RECT;
+ scale: 1;
+ description {
+ fixed: 0 0;
+ align: 0.0 0.0;
+ visible: 0;
+ state: "default" 0.0;
+ visible: 1;
+ rel1 { relative: 0.0 0.0;}
+ rel2 { relative: 1.0 1.0;}
+ color: 0 0 0 0;
+ }
+ }
+ part {
+ name: "image";
+ mouse_events: 1;
+ type: SWALLOW;
+ scale: 1;
+ description {
+ min: 48 48;
+ max: 48 48;
+ fixed: 1 1;
+ align: 0.5 0.5;
+ state: "default" 0.0;
+ visible: 1;
+ rel1 { relative: 0.0 0.0;}
+ rel2 { relative: 1.0 1.0;}
+ }
+ }
+ } //end parts
+
+ program {
+ name: "send.custom.image.clicked.signal";
+ signal: "mouse,down,1";
+ source: "image_rect";
+ action: SIGNAL_EMIT "signal.search.image.clicked" "image";
+ }
+
+ program {
+ name: "send.custom.image.unclicked.signal";
+ signal: "mouse,up,1";
+ source: "image_rect";
+ action: SIGNAL_EMIT "signal.search.image.unclicked" "image";
+ }
+} //end group
+
description {
state: "default" 0.0;
visible: 1;
- min: 16 0;
+ min: 26 0;
fixed: 1 0;
align: 0.0 0.5;
rel1 { relative: 0.0 0.0; to: "bg";}
description {
state: "default" 0.0;
min: 620 107;
- max: 620 107;
+ max: 99999 107;
align: 0.0 0.0;
rel1 { relative: 1.0 0.0;
to_x: "searchbar_area_category";
rel2 { relative: 1.0 1.0;
to_x: "bg";
to_y: "bg";}
- color: 255 255 255 255;
+ color: SEARCHBAR_BACKGROUND_COLOR_DEFAULT;
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#define SEARCHBAR_BACKGROUND_COLOR_DEFAULT 215 225 232 255
+#define SEARCHBAR_BACKGROUND_COLOR_DEFAULT 248 246 239 255
+#define SEARCHBAR_BACKGROUND_COLOR_BLACK 36 36 36 255
+#define SEARCHBAR_BACKGROUND_COLOR_BLUE 17 23 27 255
+#define SEARCHBAR_BACKGROUND_COLOR_WHITE 215 225 232 255
+#define SEARCHBAR_BACKGROUND_COLOR_NEW_THEME 248 246 239 255
collections {
#include "smartsearch-color.edc"
#include "groups/search_result.edc"
-#include "groups/ug_effect.edc"
+#include "groups/search_custom_ctxpopup_item.edc"
+#include "groups/search_custom_style.edc"
}
Source: smartsearch
Section: main
Priority: extra
-Maintainer: Junghyun Kim <jh1114.kim@samsung.com>, Myungho Ham <mh.ham@samsung.com>
-Uploaders: Junghyun Kim <jh1114.kim@samsung.com>, Myungho Ham <mh.ham@samsung.com>
+Maintainer: Junghyun Kim <jh1114.kim@samsung.com>, Mijin Hwang <mjlois.hwang@samsung.com>
+Uploaders: Junghyun Kim <jh1114.kim@samsung.com>, Mijin Hwang <mjlois.hwang@samsung.com>
Build-Depends: debhelper (>= 5),
libglib2.0-dev,
libappcore-efl-dev,
#define CHECK_VALIDATE_UTF8 0
-void search_util_date_time_format_init(void *data);
+void search_util_date_time_format_init();
void search_util_date_time_format_deinit();
-void search_util_date_time_format_get_val(const struct tm *tm,
- char *format_val);
+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,
}\
}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) {\
}\
}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) {\
#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)
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__ */
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;
Evas_Object *cate_ctxpopup;
Evas_Object *cate_btn;
- Ecore_Idler *idler_search;
Ecore_Idler *idler_create_ui;
Ecore_Timer *search_timer;
Eina_Condition condition;
Eina_Lock mutex;
+ bool first_search;
char *search_word;
char *not_markup_search_word;
int back_btn_type;
int search_category;
- Evas_Object *effect_layout;
ui_gadget_h detail_ug;
sqlite3 *search_db_hd;
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_THUMBNAIL_SIZE 72
#define SEARCH_ICON_SIZE 64
-#define SEARCH_CATEGORY_BTN_ICON_SIZE_WIDTH 38
-#define SEARCH_CATEGORY_BTN_ICON_SIZE_HEIGHT 38
+#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 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 DB_QUERY_LEN (512)
+
#define NO_RESULT_BODY_LEN 7
//==============================================================================================================================
+#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) \
} \
} 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)
Requires: elementary-bin
BuildRequires: pkgconfig(appcore-efl)
BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(calendar)
-BuildRequires: pkgconfig(contacts-service)
BuildRequires: pkgconfig(db-util)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(ecore)
BuildRequires: libug-contacts-devel
BuildRequires: pkgconfig(cert-svc)
BuildRequires: pkgconfig(cert-svc-vcore)
+BuildRequires: pkgconfig(contacts-service2)
+BuildRequires: pkgconfig(calendar-service2)
BuildRequires: cmake
BuildRequires: edje-tools
#include <unicode/ustring.h>
static UDateTimePatternGenerator *search_pattern_generator = NULL;
-static UDateFormat *search_formatter;
+static UDateFormat *search_formatter_yymmdd_12th;
+static UDateFormat *search_formatter_yymmdd_24th;
-void search_util_date_time_format_init(void *data)
+static UDateFormat *search_formatter_yymmdd;
+static UDateFormat *search_formatter_yymm;
+
+UDateFormat *__search_util_make_date_format(const char *skeleton)
{
SEARCH_FUNC_START;
- UErrorCode status = U_ZERO_ERROR;
- UChar customSkeleton[64] = { '\0' };
- char skeleton[128] = { 0, };
+ UDateFormat *formatter = NULL;
+ UChar customSkeleton[SEARCH_MAX_UCHAR_SIZE] = { '\0' };
int32_t bestPatternCapacity, bestPatternLength;
- UChar bestPattern[64] = { 0, };
- const char *locale;
+ UChar bestPattern[SEARCH_MAX_UCHAR_SIZE] = { 0, };
+ UErrorCode status = U_ZERO_ERROR;
+ const char *locale = NULL;
/* Pattern Generator */
if (search_pattern_generator) {
SEARCH_DEBUG_WARNING
("pattern_generator / udatpg_open fail : %s",
u_errorName(status));
- return;
+ return NULL;
+ }
+
+ SEARCH_DEBUG_LOG("skeleton : %s", skeleton);
+
+ u_uastrncpy(customSkeleton, skeleton, strlen(skeleton));
+
+ bestPatternCapacity =
+ (int32_t) (sizeof(bestPattern) / sizeof((bestPattern)[0]));
+ bestPatternLength =
+ udatpg_getBestPattern(search_pattern_generator, customSkeleton,
+ u_strlen(customSkeleton), bestPattern,
+ bestPatternCapacity, &status);
+
+ if (bestPatternLength == 0) {
+ SEARCH_DEBUG_WARNING("udatpg_getBestPattern fail");
+ return NULL;
+ }
+
+ formatter =
+ udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, NULL, -1, bestPattern,
+ -1, &status);
+
+ SEARCH_FUNC_END;
+
+ return formatter;
}
+
+void search_util_date_time_format_init()
+{
+ SEARCH_FUNC_START;
+
/* Date Time Format From Skeletons */
enum appcore_time_format timeformat;
int ret;
+ char *skeleton = NULL;
+
ret = appcore_get_timeformat(&timeformat);
if (ret == -1) {
- // add exception handling
+ SEARCH_DEBUG_WARNING("Fail to get time format!");
+ return;
}
+ SEARCH_MALLOC(skeleton, SEARCH_MAX_CHAR_SIZE, char);
+ snprintf(skeleton, SEARCH_MAX_CHAR_SIZE, "%s%s", UDAT_YEAR_MONTH_DAY, UDAT_HOUR_MINUTE);
+ search_formatter_yymmdd_12th = __search_util_make_date_format(skeleton);
+ snprintf(skeleton, SEARCH_MAX_CHAR_SIZE, "%s%s", UDAT_YEAR_MONTH_DAY, UDAT_HOUR24_MINUTE);
+ search_formatter_yymmdd_24th = __search_util_make_date_format(skeleton);
+ snprintf(skeleton, SEARCH_MAX_CHAR_SIZE, "%s", UDAT_YEAR_MONTH_DAY);
+ search_formatter_yymm = __search_util_make_date_format(skeleton);
+ SEARCH_FREE(skeleton);
+
if (timeformat == APPCORE_TIME_FORMAT_24) {
- snprintf(skeleton, 128, "%s%s", UDAT_YEAR_MONTH_DAY,
- UDAT_HOUR24_MINUTE);
+ search_formatter_yymmdd = search_formatter_yymmdd_24th;
} else if (timeformat == APPCORE_TIME_FORMAT_12) {
- snprintf(skeleton, 128, "%s%s", UDAT_YEAR_MONTH_DAY,
- UDAT_HOUR_MINUTE);
+ search_formatter_yymmdd = search_formatter_yymmdd_12th;
} else {
SEARCH_DEBUG_WARNING("appcore_get_timeformat unknown error");
return;
}
- u_uastrncpy(customSkeleton, skeleton, strlen(skeleton));
+ SEARCH_FUNC_END;
- bestPatternCapacity =
- (int32_t) (sizeof(bestPattern) / sizeof((bestPattern)[0]));
- bestPatternLength =
- udatpg_getBestPattern(search_pattern_generator, customSkeleton,
- u_strlen(customSkeleton), bestPattern,
- bestPatternCapacity, &status);
- if (bestPatternLength == 0) {
- SEARCH_DEBUG_WARNING("udatpg_getBestPattern fail");
return;
}
- search_formatter =
- udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, NULL, -1, bestPattern,
- -1, &status);
+void search_region_format_cb(void *data)
+{
+ SEARCH_FUNC_START;
- SEARCH_FUNC_END;
+ enum appcore_time_format timeformat;
+ int ret;
+
+ ret = appcore_get_timeformat(&timeformat);
+
+ if (ret == -1) {
+ SEARCH_DEBUG_WARNING("Fail to get time format!");
+ return;
+ }
+ if (timeformat == APPCORE_TIME_FORMAT_24) {
+ search_formatter_yymmdd = search_formatter_yymmdd_24th;
+ } else if (timeformat == APPCORE_TIME_FORMAT_12) {
+ search_formatter_yymmdd = search_formatter_yymmdd_12th;
+ } else {
+ SEARCH_DEBUG_WARNING("appcore_get_timeformat unknown error");
return;
}
+ SEARCH_FUNC_END;
+}
+
void search_util_date_time_format_deinit()
{
SEARCH_FUNC_START;
search_pattern_generator = NULL;
}
- if (search_formatter) {
- udat_close(search_formatter);
- search_formatter = NULL;
+ if (search_formatter_yymmdd_12th) {
+ udat_close(search_formatter_yymmdd_12th);
+ search_formatter_yymmdd_12th = NULL;
+ }
+
+ if (search_formatter_yymmdd_24th) {
+ udat_close(search_formatter_yymmdd_24th);
+ search_formatter_yymmdd_24th = NULL;
+ }
+
+ if (search_formatter_yymm) {
+ udat_close(search_formatter_yymm);
+ search_formatter_yymm = NULL;
}
SEARCH_FUNC_END;
return;
}
-void search_util_date_time_format_get_val(const struct tm *tm, char *format_val)
+void search_util_date_time_format_get_val(time_t time, char *format_val, int type)
{
SEARCH_FUNC_START;
UDate date;
- time_t time;
- UChar formatted[64] = { 0, };
+ UChar formatted[SEARCH_MAX_UCHAR_SIZE] = { 0, };
int32_t formattedCapacity, formattedLength;
UErrorCode status = U_ZERO_ERROR;
- char formattedString[128] = { 0, };
+ char formattedString[SEARCH_MAX_CHAR_SIZE] = { 0, };
- time = timelocal((struct tm *)tm);
date = (UDate) time *1000;
formattedCapacity =
(int32_t) (sizeof(formatted) / sizeof((formatted)[0]));
+
+ switch(type) {
+ case SEARCH_DATE_TYPE_YYMMDD:
+ if (search_formatter_yymmdd) {
+ formattedLength =
+ udat_format(search_formatter_yymmdd, date, formatted, formattedCapacity,
+ NULL, &status);
+ if (formattedLength == -1) {
+ SEARCH_DEBUG_WARNING("udat_format fail");
+ return;
+ }
+ }
+ break;
+ case SEARCH_DATE_TYPE_YYMM:
+ if (search_formatter_yymm) {
formattedLength =
- udat_format(search_formatter, date, formatted, formattedCapacity,
+ udat_format(search_formatter_yymm, date, formatted, formattedCapacity,
NULL, &status);
if (formattedLength == -1) {
SEARCH_DEBUG_WARNING("udat_format fail");
return;
}
+ }
+ break;
+ }
+
+
+ u_austrncpy(formattedString, formatted, SEARCH_MAX_CHAR_SIZE);
- u_austrncpy(formattedString, formatted, 128);
+ SEARCH_DEBUG_LOG("formattedString : %s", formattedString);
snprintf(format_val, MAX_LENGTH_PER_LINE, "%s", formattedString);
#include <app_manager.h>
#include <bundle.h>
-#define UG_NAME_LEN 50
-
-static void __search_layout_ug_destroy(void *data)
-{
- SEARCH_FUNC_START;
-
- struct appdata *ad = (struct appdata *)data;
-
- //D. Because the ug will be able to remove the base object, unset the content from the effect layout.
- elm_object_part_content_unset(ad->effect_layout,
- (char *)ug_get_layout(ad->detail_ug));
-
- evas_object_del(ad->effect_layout);
-
- ug_destroy(ad->detail_ug);
-
- ad->detail_ug = NULL;
- ad->effect_layout = NULL;
-
- SEARCH_FUNC_END;
-}
-
-static void __search_effect_layout_signal_hide_finished(void *data,
- Evas_Object * obj,
- const char *emission,
- const char *source)
-{
- SEARCH_FUNC_START;
-
- __search_layout_ug_destroy(data);
-
- SEARCH_FUNC_END;
-}
-
-static void __search_effect_layout_render_flush_post_cb(void *data, Evas * e,
- void *event_info)
-{
- SEARCH_FUNC_START;
-
- struct appdata *ad = (struct appdata *)data;
- if (!ad)
- return;
-
- //UG Show Effect
- edje_object_signal_emit(elm_layout_edje_get(ad->effect_layout),
- "elm,state,show", "");
-
- //B.Remove the EVAS_RENDER_FLUSH_POST callback again.
- evas_event_callback_del(e, EVAS_CALLBACK_RENDER_FLUSH_POST,
- __search_effect_layout_render_flush_post_cb);
-
- SEARCH_FUNC_END;
-}
-
static void __search_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode,
void *priv)
{
SEARCH_FUNC_START;
- Evas_Object *base = (Evas_Object *) ug_get_layout(ug);
+ Evas_Object *base = NULL; (Evas_Object *) ug_get_layout(ug);
+ Evas_Object *win = NULL;
- if (!base)
- return;
+ SEARCH_RET_IF(ug == NULL || priv == NULL);
-#ifdef ENABLE_UG_EFFECT
- if (!ad->effect_layout)
- return;
+ base = (Evas_Object *)ug_get_layout(ug);
+ win = (Evas_Object *)ug_get_window();
+
+ SEARCH_RET_IF(base == NULL);
+ SEARCH_RET_IF(win == NULL);
- elm_object_part_content_set(ad->effect_layout, "elm.swallow.content", base);
- //B. Add the callback event for the EVAS_RENDER_FLUSH_POST
- //B. This is one method to not skip the total effect time in creating the ug object.
- evas_event_callback_add(evas_object_evas_get(ad->effect_layout),
- EVAS_CALLBACK_RENDER_FLUSH_POST,
- __search_effect_layout_render_flush_post_cb,
- ad);
-#else
+ switch (mode) {
+ case UG_MODE_FULLVIEW:
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, base);
evas_object_show(base);
-#endif
+ break;
+ default:
+ break;
+ }
SEARCH_FUNC_END;
}
{
SEARCH_FUNC_START;
-#ifdef ENABLE_UG_EFFECT
- edje_object_signal_emit(elm_layout_edje_get(ad->effect_layout),
- "elm,state,hide", "");
-#else
- Evas_Object *base = (Evas_Object *) ug_get_layout(ug);
-
- evas_object_hide(base);
-#endif
-
- SEARCH_FUNC_END;
-}
-
-static void __search_create_effect_layout(Evas_Object * parent,
- struct appdata *ad)
-{
- SEARCH_FUNC_START;
-
- int ret;
-
- //Create the layout then apply the edj
- Evas_Object *ly = elm_layout_add(ad->win_main);
-
- if (!ly)
- return;
-
- evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- elm_win_resize_object_add(ad->win_main, ly);
-
- ret = elm_layout_file_set(ly, SEARCH_EDJ, "ug_effect");
-
- //Add a signal callback function which will be called after terminating hide effect.
- edje_object_signal_callback_add(elm_layout_edje_get(ly),
- "elm,action,hide,finished", "",
- __search_effect_layout_signal_hide_finished,
- ad);
+ struct appdata *ad = (struct appdata *)priv;
- //store the layout object to refer it at hide effect
- ad->effect_layout = ly;
+ SEARCH_RET_IF(ug == NULL);
+ SEARCH_RET_IF(ad == NULL);
- evas_object_show(ly);
+ ug_destroy(ug);
+ ad->detail_ug = NULL;
SEARCH_FUNC_END;
}
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- struct search_item_sel *cur_category_mem =
- (struct search_item_sel *)record_info;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
service_h service = NULL;
int ret = 0;
char buf[10] = { 0, };
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
if (!cur_category_mem || strlen(cur_category_mem->main_id) < 0 ) {
SEARCH_DEBUG_ERROR("Selected item does not have data!");
goto out_func;
} else {
if (ad->detail_ug) {
SEARCH_DEBUG_WARNING("\n prev ug is exist. destroy prev ug");
- __search_layout_ug_destroy(ad);
+ ug_destroy(ug);
+ ad->detail_ug = NULL;
}
ret = service_create(&service);
goto out_func;
}
-#ifdef ENABLE_UG_EFFECT
- __search_create_effect_layout(ad->win_main, ad);
-#endif
-
cbs.layout_cb = __search_ug_layout_cb;
cbs.result_cb = NULL;
cbs.destroy_cb = __search_ug_closed_cb;
}
out_func:
- if (err_popup_show == true)
+ if (err_popup_show == true) {
search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
- if (service != NULL)
+ if (service != NULL) {
service_destroy(service);
+ }
SEARCH_FUNC_END;
}
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- struct search_item_sel *cur_category_mem =
- (struct search_item_sel *)record_info;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
bundle *b;
int ret = 0;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
b = bundle_create();
if (!b) {
SEARCH_DEBUG_ERROR("search_launch_msg_view : bundle_create failed");
{
SEARCH_FUNC_START;
- bundle *b;
char *token_param = NULL;
char *saveptr1;
int i = 0;
bool err_popup_show = true;
struct appdata *ad = (struct appdata *)data;
- struct search_item_sel *cur_category_mem =
- (struct search_item_sel *)record_info;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
char temp_path[MAX_LENGTH_PER_PATH] = { 0, };
service_h service = NULL;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
ret = service_create(&service);
if (ret != SERVICE_ERROR_NONE) {
SEARCH_DEBUG_ERROR("Fail to create service handle!");
err_popup_show = false;
out_func:
- if (err_popup_show == true)
+ if (err_popup_show == true) {
search_launch_popup_error(LAUNCH_ERROR_APPSVC, ad);
+ }
if (service != NULL) {
ret = service_destroy(service);
- if (ret != SERVICE_ERROR_NONE)
+ if (ret != SERVICE_ERROR_NONE) {
SEARCH_DEBUG_ERROR("Fail to destroy service header : [%d]", ret);
}
+ }
SEARCH_FUNC_END;
}
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- struct search_item_sel *cur_category_mem =
- (struct search_item_sel *)record_info;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
int ret;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
if (access(cur_category_mem->path, F_OK) != 0) {
SEARCH_DEBUG_ERROR("image access error : %s",
cur_category_mem->path);
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- struct search_item_sel *cur_category_mem =
- (struct search_item_sel *)record_info;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
int ret;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
if (access(cur_category_mem->path, F_OK) != 0) {
SEARCH_DEBUG_ERROR("video access error : %s",
cur_category_mem->path);
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- struct search_item_sel *cur_category_mem =
- (struct search_item_sel *)record_info;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
int ret;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
if (access(cur_category_mem->path, F_OK) != 0) {
SEARCH_DEBUG_ERROR("music file access error : %s",
cur_category_mem->path);
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- struct search_item_sel *cur_category_mem =
- (struct search_item_sel *)record_info;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
ui_gadget_h ug = NULL;
struct ug_cbs cbs = { 0, };
int ret = 0;
bool err_popup_show = true;
service_h service = NULL;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
if (!cur_category_mem && strlen(cur_category_mem->main_id) < 0) {
SEARCH_DEBUG_ERROR("Selected item does not have data!");
goto out_func;
goto out_func;
}
-#ifdef ENABLE_UG_EFFECT
- __search_create_effect_layout(ad->win_main, ad);
-#endif
cbs.destroy_cb = __search_ug_closed_cb;
cbs.layout_cb = __search_ug_layout_cb;
cbs.result_cb = NULL;
}
out_func:
- if (err_popup_show == true)
+ if (err_popup_show == true) {
search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
- if (service != NULL)
+ if (service != NULL) {
service_destroy(service);
+ }
SEARCH_FUNC_END;
}
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- struct search_item_sel *cur_category_mem =
- (struct search_item_sel *)record_info;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
ui_gadget_h ug = NULL;
struct ug_cbs cbs = { 0, };
service_h service = NULL;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
if (!cur_category_mem && strlen(cur_category_mem->main_id) < 0) {
SEARCH_DEBUG_ERROR("Selected item does not have data!");
goto out_func;
} else {
if (ad->detail_ug) {
SEARCH_DEBUG_WARNING("prev ug is exist. destroy prev ug");
- __search_layout_ug_destroy(ad);
+ ug_destroy(ug);
+ ad->detail_ug = NULL;
}
ret = service_create(&service);
goto out_func;
}
-#ifdef ENABLE_UG_EFFECT
- __search_create_effect_layout(ad->win_main, ad);
-#endif
cbs.layout_cb = __search_ug_layout_cb;
cbs.result_cb = NULL;
cbs.destroy_cb = __search_ug_closed_cb;
}
out_func:
- if (err_popup_show == true)
+ if (err_popup_show == true) {
search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
- if (service != NULL)
+ if (service != NULL) {
service_destroy(service);
+ }
SEARCH_FUNC_END;
}
struct appdata *ad = (struct appdata *)data;
struct search_item_sel *cur_category_mem =
(struct search_item_sel *)record_info;
- char *pkg_name = cur_category_mem->path;
+ char *pkg_name = NULL;
bool is_running = false;
app_context_h app_h;
int ret;
service_h service = NULL;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
+ pkg_name = cur_category_mem->path;
+
if (pkg_name != NULL && strlen(pkg_name)) {
ret = app_manager_is_running(pkg_name, &is_running);
struct search_item_sel *cur_category_mem =
(struct search_item_sel *)record_info;
int ret;
+ service_h service;
- SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
- cur_category_mem->path);
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
+ SEARCH_DEBUG_LOG("cur_category_mem->path : %s", cur_category_mem->path);
- service_h service;
ret = service_create(&service);
if (ret == 0 && strlen(cur_category_mem->path) > 0 ) {
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
evas_object_del(ad->ctxpopup);
ad->ctxpopup = NULL;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+
if (error_type >= LAUNCH_ERROR_MAX) {
SEARCH_DEBUG_ERROR("wrong error_type : %d", error_type);
}
#include "smartsearch.h"
#include "ps_searcher.h"
#include "ps_app_interface.h"
-#include <contacts-svc.h>
-#include <calendar-svc-provider.h>
+#include <contacts.h>
+#include <calendar2.h>
#include <memo-db.h>
#include <media_content.h>
#include <msg_types.h>
struct search_content_object *obj = NULL;
struct search_genlist_item_info *item = NULL;
- struct search_genlist_info *result_info = pipe_data->result_list;
+ struct search_genlist_info *result_info = NULL;
- int cmd = pipe_data->cmd;
+ int cmd = 0;
SEARCH_DEBUG_LOG("Pipe Command : %d ret : %d", cmd, pipe_data->search_ret);
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(pipe_data == NULL);
+
+ result_info = pipe_data->result_list;
+ cmd = pipe_data->cmd;
+
switch (cmd) {
case SEARCH_PIPE_CMD_CLEAR_GENLIST:
elm_genlist_clear(ad->search_gl);
while (node != NULL) {
item = (struct search_genlist_item_info *)node->data;
- obj = item->obj;
if (item) {
+ obj = item->obj;
elm_genlist_item_append(ad->search_gl,
item->itc_style,
item->data,
int icon_size = 0;
struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+ SEARCH_RETV_IF(sel_mem_info == NULL, NULL);
if (!SEARCH_STRCMP(part, "elm.icon") || !SEARCH_STRCMP(part, "elm.icon.1")) {
if (strlen(sel_mem_info->icon1_path) > 0 ) {
icon = elm_icon_add(obj);
icon_size = (int)(SEARCH_THUMBNAIL_SIZE * elm_scale_get());
- elm_icon_prescale_set(icon, icon_size);
- elm_icon_file_set(icon, sel_mem_info->icon1_path, NULL);
+ elm_image_prescale_set(icon, icon_size);
+ elm_image_file_set(icon, sel_mem_info->icon1_path, NULL);
evas_object_size_hint_min_set(icon,
SEARCH_THUMBNAIL_SIZE * elm_scale_get(),
SEARCH_THUMBNAIL_SIZE * elm_scale_get());
if (strlen(sel_mem_info->icon2_path) > 0 ) {
icon = elm_icon_add(obj);
icon_size = (int)(SEARCH_ICON_SIZE * elm_scale_get());
- elm_icon_prescale_set(icon, icon_size);
- elm_icon_file_set(icon, sel_mem_info->icon2_path, NULL);
+ elm_image_prescale_set(icon, icon_size);
+ elm_image_file_set(icon, sel_mem_info->icon2_path, NULL);
evas_object_size_hint_min_set(icon,
SEARCH_ICON_SIZE * elm_scale_get(),
SEARCH_ICON_SIZE * elm_scale_get());
static char *__search_gl_label_get_search_item_type(void *data, Evas_Object * obj,
const char *part)
{
- if (data == NULL) {
- return g_strdup("");
- }
-
- char *buf;
+ char *buf = NULL;
struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+ SEARCH_RETV_IF(sel_mem_info == NULL, g_strdup(""));
if (!SEARCH_STRCMP(part, "elm.text") || !SEARCH_STRCMP(part, "elm.text.1")) {
buf = g_strdup(sel_mem_info->main_buf);
const char *part)
{
struct search_content_object *object = (struct search_content_object*)data;
- SEARCH_DEBUG_WARNING("%s %d", object->name, object->string_type);
+ SEARCH_RETV_IF(object == NULL, strdup(""));
+
if (object) {
if (object->string_type == SEARCH_STR_TYPE_APP_STRING)
return strdup(gettext(object->name));
static void __search_gl_del(void *data, Evas_Object * obj)
{
struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+ SEARCH_RET_IF(sel_mem_info == NULL);
SEARCH_FREE(sel_mem_info);
static void __search_gl_del_more_button(void *data, Evas_Object * obj)
{
struct search_item_more_sel *sel_mem_more = (struct search_item_more_sel *)data;
+ SEARCH_RET_IF(sel_mem_more == NULL);
SEARCH_FREE(sel_mem_more);
int ret = SEARCH_RET_SUCCESS;
int i = 0;
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_FAIL);
+
for (i = 0; i < SEARCH_CONT_MAX ; ++i) {
switch (ad->result_obj[i].contents_type) {
- case SEARCH_CONT_PHONE_CONTACTS:
- {
- if (ad->result_obj[i].visible == EINA_TRUE) {
- rc = contacts_svc_connect();
- if (rc != CTS_SUCCESS) {
- SEARCH_DEBUG_WARNING("contacts svc connect fail : %d",rc);
- }
- } else {
- rc = contacts_svc_disconnect();
- if (rc != CTS_SUCCESS) {
- SEARCH_DEBUG_WARNING("contacts svc disconnect fail : %d",rc);
- }
- }
- }
- break;
-
/* Contact-service should be conneted for display Message result.
Because We should display message with contact photo
if user have contact photo which have matched to tel-number of sender or receiver */
/* Connect Contact-service if contact category status is invisible */
if (ad->result_obj[SEARCH_CONT_PHONE_CONTACTS].visible == EINA_FALSE) {
- rc = contacts_svc_connect();
- if (rc != CTS_SUCCESS) {
+ rc = contacts_connect2();
+ if (rc != CONTACTS_ERROR_NONE) {
/* If we fail to connect contact-service, display message-app icon */
- SEARCH_DEBUG_WARNING("contacts svc connect fail : %d",rc);
+ SEARCH_DEBUG_WARNING("Fail to connect contact service : %d",rc);
}
}
} else {
/* Disconnect Contact-service if contact category status is invisible */
if (ad->result_obj[SEARCH_CONT_PHONE_CONTACTS].visible == EINA_FALSE) {
- rc = contacts_svc_disconnect();
- if (rc != CTS_SUCCESS)
- SEARCH_DEBUG_WARNING("contacts svc connect fail : %d",rc);
+ rc = contacts_disconnect2();
+ if (rc != CONTACTS_ERROR_NONE)
+ SEARCH_DEBUG_WARNING("Fail to disconnect contact service : %d",rc);
}
/* Disconnect Message-Service */
}
}
break;
- case SEARCH_CONT_PHONE_CALENDAR:
- {
- if (ad->result_obj[i].visible == EINA_TRUE) {
- rc = calendar_svc_connect();
- if (rc != CAL_SUCCESS) {
- SEARCH_DEBUG_WARNING
- ("calendar svc connect fail : %d",
- rc);
- }
- } else {
- rc = calendar_svc_close();
- if (rc != CAL_SUCCESS) {
- SEARCH_DEBUG_WARNING
- ("calendar svc disconnect fail : %d",
- rc);
- }
- }
- }
- break;
case SEARCH_CONT_PHONE_MEMO:
{
if (ad->result_obj[i].visible == EINA_TRUE) {
struct appdata *ad = (struct appdata *)data;
- int rc = 0, conn_ret = 0;
+ int conn_ret = 0;
int i = 0;
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_FAIL);
+
for (i = 0; i < SEARCH_CONT_MAX ; ++i) {
switch (ad->result_obj[i].contents_type) {
- case SEARCH_CONT_PHONE_CONTACTS:
- {
- rc = contacts_svc_disconnect();
- if (rc != CTS_SUCCESS) {
- SEARCH_DEBUG_WARNING
- ("contacts svc disconnect fail : %d",
- rc);
- }
- }
- break;
case SEARCH_CONT_PHONE_MSG:
{
if (ad->msg_handle != NULL ) {
SEARCH_DEBUG_WARNING("media_content_disconnect failed : %d\n", conn_ret);
}
break;
- case SEARCH_CONT_PHONE_CALENDAR:
- {
- rc = calendar_svc_close();
- if (rc != CAL_SUCCESS) {
- SEARCH_DEBUG_WARNING
- ("calendar svc disconnect fail : %d",
- rc);
- }
- }
- break;
case SEARCH_CONT_PHONE_MEMO:
{
memo_fini();
struct search_item_sel *cur_category_mem;
Elm_Object_Item *it = (Elm_Object_Item *) event_info;
- cur_category_mem =
- (struct search_item_sel *)elm_object_item_data_get(it);
- if (cur_category_mem == NULL) {
- return;
- }
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(it == NULL);
+
+ cur_category_mem = (struct search_item_sel *)elm_object_item_data_get(it);
+ SEARCH_RET_IF(cur_category_mem == NULL);
SEARCH_DEBUG_LOG("cur_category_mem->type : %d", cur_category_mem->type);
int func_ret = SEARCH_RET_SEARCH_NONE;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
obj->mr_info.offset = offset;
SEARCH_FUNC_START;
struct search_thread_data *thread_data = (struct search_thread_data*)data;
- struct appdata *ad = thread_data->ad;
+ struct appdata *ad = NULL;
struct search_content_object *obj = NULL;
struct search_genlist_info *result_info = NULL;
int i = SEARCH_CONT_PHONE_MIN;
int category_type = 0;
+ SEARCH_RET_IF(thread_data == NULL);
+ ad = thread_data->ad;
+ SEARCH_RET_IF(ad == NULL);
+
SEARCH_DEBUG_LOG("Thread ID : %p Keyword : %s", th, thread_data->keyword);
- thread_data->ad = ad;
thread_data->is_search_result = SEARCH_RET_SEARCH_NONE;
while (i <= SEARCH_CONT_PHONE_MAX) {
result_info);
if (ret == SEARCH_RET_SEARCH_SUCCESS) {
- SEARCH_DEBUG_LOG("Succes to Matched result : %s %d", obj->name, ret);
+ SEARCH_DEBUG_LOG("Matched result : %s %d", obj->name, ret);
thread_data->is_search_result = SEARCH_RET_SEARCH_SUCCESS;
ecore_thread_feedback(th, result_info);
} else {
SEARCH_FUNC_START;
struct search_thread_data *thread_data = (struct search_thread_data *)data;
- struct appdata *ad = thread_data->ad;
+ struct appdata *ad = NULL;
struct search_genlist_info *result_list = (struct search_genlist_info *)msg_data;
struct search_pipe_data *pdata = NULL;
+ SEARCH_RET_IF(thread_data == NULL);
+ SEARCH_RET_IF(result_list == NULL);
+ ad = thread_data->ad;
+ SEARCH_RET_IF(ad == NULL);
+
+ if (ecore_thread_check(th) == EINA_TRUE)
+ return;
+
pdata = (struct search_pipe_data *)calloc(1,sizeof(struct search_pipe_data));
pdata->cmd = SEARCH_PIPE_CMD_ADD_GENLIST_PHONE;
pdata->obj = NULL;
pdata->result_list = result_list;
pdata->search_ret = thread_data->is_search_result;
- if (ecore_thread_check(th) == EINA_TRUE)
- return;
-
ecore_pipe_write(ad->pipe, &pdata, sizeof(struct search_pipe_data));
SEARCH_FUNC_END;
SEARCH_FUNC_START;
struct search_thread_data *thread_data = (struct search_thread_data *)data;
- struct appdata *ad = thread_data->ad;
+ struct appdata *ad = NULL;
struct search_pipe_data *pdata = NULL;
+ SEARCH_RET_IF(thread_data == NULL);
+ ad = thread_data->ad;
+ SEARCH_RET_IF(ad == NULL);
+
pdata = (struct search_pipe_data *)calloc(1,sizeof(struct search_pipe_data));
pdata->cmd = SEARCH_PIPE_CMD_SET_LAYOUT;
pdata->search_ret = thread_data->is_search_result;
SEARCH_FUNC_START;
struct search_thread_data *thread_data = (struct search_thread_data *)data;
+ SEARCH_RET_IF(thread_data == NULL);
SEARCH_FREE(thread_data->keyword);
SEARCH_FREE(thread_data);
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ int category = ad->search_category;
+
+ SEARCH_RET_IF(ad == NULL);
if (ad->search_thread) {
ecore_thread_cancel(ad->search_thread);
{
SEARCH_FUNC_START;
- int ret = 0;
Ecore_Thread *th = NULL;
struct appdata *ad = (struct appdata *)data;
struct search_thread_data *thread_data = NULL;
- /* set keyword to vconf for save last search histroy */
- ret = vconf_set_str(SMARTSEARCH_KEY_KEYWORD, ad->not_markup_search_word);
-
- if (ret < 0)
- SEARCH_DEBUG_WARNING("Error : set keyword to vconf");
+ SEARCH_RETV_IF(ad == NULL, NULL);
/* Create Thread for Phone Search */
thread_data = (struct search_thread_data *)calloc(1, sizeof(struct search_thread_data));
if (ad->itc_pslist_1line == NULL) {
ad->itc_pslist_1line = elm_genlist_item_class_new();
- ad->itc_pslist_1line->item_style = "1text.2";
+ ad->itc_pslist_1line->item_style = "1text.tb";
ad->itc_pslist_1line->func.text_get = __search_gl_label_get_search_item_type;
ad->itc_pslist_1line->func.content_get = __search_gl_content_get_search_item_type;
ad->itc_pslist_1line->func.state_get = __search_gl_state_get;
if (ad->itc_listmore == NULL) {
ad->itc_listmore = elm_genlist_item_class_new();
- ad->itc_listmore->item_style = "1text.2";
+ ad->itc_listmore->item_style = "1text.tb";
ad->itc_listmore->func.text_get = __search_gl_label_get_more;
ad->itc_listmore->func.state_get = __search_gl_state_get;
ad->itc_listmore->func.del = __search_gl_del_more_button;
ad->search_gl = NULL;
- genlist = elm_genlist_add(ad->navi_bar);
+ genlist = elm_genlist_add(ad->conformant);
// To use multiline textblock/entry/editfield in genlist, set height_for_width mode
// then the item's height is calculated while the item's width fits to genlist width.
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
ecore_pipe_del(ad->pipe);
eina_condition_free(&ad->condition);
elm_genlist_item_class_free(ad->itc_pslist_1line_1icon);
if (ad->itc_pslist_1line_2icon != NULL)
- elm_genlist_item_class_free(ad->itc_pslist_2line_1icon);
+ elm_genlist_item_class_free(ad->itc_pslist_1line_2icon);
if (ad->itc_pslist_2line_1icon != NULL)
elm_genlist_item_class_free(ad->itc_pslist_2line_1icon);
{
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- int category = ad->search_category;
+
+ int category = 0;
int ret = SEARCH_RET_SEARCH_NONE;
bool is_input_keyword = false;
struct search_pipe_data *pipe_data = NULL;
char *text = NULL;
+ SEARCH_RET_IF(ad == NULL);
+
+ category = ad->search_category;
search_stop_search(ad);
text = elm_entry_markup_to_utf8(elm_object_text_get(ad->search_entry));
SEARCH_FREE(ad->search_word);
if((text) && (strlen(text) > 0)) {
+ if (ad->first_search == true) {
+ search_result_gl_init(ad);
+ search_util_date_time_format_init();
+ search_app_connect(ad);
+ ad->first_search = false;
+ }
+
ad->not_markup_search_word = strdup(elm_object_text_get(ad->search_entry));
ad->search_word = text;
is_input_keyword = true;
/* set keyword to vconf for save last search histroy */
ret = vconf_set_str(SMARTSEARCH_KEY_KEYWORD, "");
- if (ret < 0)
- SEARCH_DEBUG_WARNING("Error : set keyword to vconf");
+ if (ret < 0) {
+ SEARCH_DEBUG_WARNING("Error : set keyword to vconf");
+ }
}
/* If category is Phone, make a thread for search */
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
if (elm_object_part_content_get(ad->sb_layout,"list_noresult")) {
elm_object_part_content_unset(ad->sb_layout,"list_noresult");
}
}
- if (ad->search_gl)
- elm_genlist_item_show(elm_genlist_first_item_get(ad->search_gl), ELM_GENLIST_ITEM_SCROLLTO_TOP);
+ if (ad->search_gl) {
+ elm_genlist_item_show(elm_genlist_first_item_get(ad->search_gl), ELM_GENLIST_ITEM_SCROLLTO_TOP);
+ }
+
SEARCH_FUNC_END;
return;
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
if (elm_object_part_content_get(ad->sb_layout,"list")) {
elm_object_part_content_unset(ad->sb_layout, "list");
- if (ad->search_gl)
- evas_object_hide(ad->search_gl);
+ if (ad->search_gl) {
+ evas_object_hide(ad->search_gl);
+ }
elm_object_part_content_set(ad->sb_layout,"list_noresult", ad->noresult_view);
evas_object_show(ad->noresult_view);
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- int ret;
+ int ret = SEARCH_RET_FAIL;
+
+ SEARCH_RETV_IF(ad == NULL, ret);
if (elm_object_part_content_get(ad->sb_layout,"list")) {
ret = SEARCH_RET_SUCCESS;
#include <sqlite3.h>
-#include <contacts-svc.h>
-#include <calendar-svc-provider.h>
+#include <contacts.h>
+#include <calendar2.h>
#include <memo-db.h>
#include <email-api-mail.h>
return ret;
}
-static int __search_sql_contact_search_result_cb(CTSvalue * value,
- void *user_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)
{
SEARCH_FUNC_START;
- struct search_cb_data *scd = (struct search_cb_data*)user_data;
+ struct appdata *ad = (struct appdata *)data;
+ int ret = 0;
- struct appdata *ad = scd->ad;
- struct search_content_object* obj = scd->obj;
- struct search_genlist_info *result_info = scd->result_info;
- char *keyword = scd->keyword;
+ contacts_query_h query;
+ contacts_filter_h filter;
+ contacts_list_h list;
+
+ unsigned int count = 0;
+ int loop_cnt = 0;
+
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
+
+ ret = contacts_connect2();
+ SEARCH_RETV_IF_WITH_ERRORV(ret != CONTACTS_ERROR_NONE, SEARCH_RET_SEARCH_FAIL, ret);
+ contacts_query_create(_contacts_person_number._uri, &query);
+ contacts_filter_create(_contacts_person_number._uri, &filter);
+ contacts_filter_add_str(filter, _contacts_person_number.display_name,
+ CONTACTS_MATCH_CONTAINS, keyword);
+ contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
+ contacts_filter_add_str(filter, _contacts_person_number.number,
+ CONTACTS_MATCH_CONTAINS, keyword);
+ contacts_query_set_filter(query, filter);
+
+ ret = contacts_db_get_records_with_query(query, offset, limit, &list);
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+
+ SEARCH_RETV_IF_WITH_ERRORV(ret != CONTACTS_ERROR_NONE, SEARCH_RET_SEARCH_FAIL, ret);
+ contacts_list_get_count(list, &count);
+
+ if (count > 0) {
+ /* Set group title */
+ if (offset == 0) {
+ result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
+ obj, ad->itc_grouptitle, obj, NULL);
+ }
+
+ do {
struct search_item_sel *sel_mem_info = NULL;
- struct search_item_more_sel *sel_mem_more = NULL;
struct search_genlist_item_info *gen_item = NULL;
- const char* contact_img_path = NULL;
- const char *str_display = NULL;
- const char *num_display = NULL;
+ int contact_id = -1;
+ char *contact_img_path = NULL;
+ char *str_display = NULL;
+ char *num_display = NULL;
const char *text_1line = NULL;
const char *text_2line = NULL;
+ bool is_word_in_str = false;
- bool is_word_in_str;
+ loop_cnt++;
- if (obj->mr_info.next_point == 0) {
- //### Set group title
- result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
- obj,
- ad->itc_grouptitle,
- obj,
- NULL);
+ if (loop_cnt == limit) {
+ break;
}
- if (obj->mr_info.next_point <
- obj->mr_info.offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
- sel_mem_info =
- (struct search_item_sel *)calloc(1,
- sizeof(struct
- search_item_sel));
+ sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
sel_mem_info->type = obj->contents_type;
- contact_img_path = contacts_svc_value_get_str(value,
- CTS_LIST_PERSON_IMAGE_THUMBNAIL_PATH_STR);
+ contacts_record_h record;
+ contacts_list_get_current_record_p(list, &record);
+ contacts_record_get_str_p(record, _contacts_person.image_thumbnail_path, &contact_img_path);
if (contact_img_path != NULL) {
strncpy(sel_mem_info->icon1_path, contact_img_path,
strncpy(sel_mem_info->icon1_path, obj->obj_icon_path,
MAX_LENGTH_PER_PATH - 1);
- /************ START : set search result to sel_mem_info buf ************/
-
- /***********************************************************************/
-
- /* First, we should get contact name */
- str_display =
- contacts_svc_value_get_str(value,
- CTS_LIST_PERSON_DISPLAY_NAME_STR);
-
- SEARCH_DEBUG_LOG("display_name : %s", str_display);
-
- /* Second, we should get number */
- num_display =
- contacts_svc_value_get_str(value,
- CTS_LIST_PERSON_NUMBER_OR_EMAIL_STR);
- SEARCH_DEBUG_LOG("num or email : %s", num_display);
+ contacts_record_get_str_p(record, _contacts_person.display_name, &str_display);
+ contacts_record_get_str_p(record, _contacts_number.number, &num_display);
if (str_display != NULL) {
strncpy(sel_mem_info->main_buf,
MAX_LENGTH_PER_LINE - 1);
}
+ contacts_record_get_int(record, _contacts_person.id, &contact_id);
snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID - 1, "%d",
- contacts_svc_value_get_int(value,
- CTS_LIST_PERSON_ID_INT));
+ contact_id);
- SEARCH_DEBUG_LOG("Search CT_ID: %d", sel_mem_info->main_id);
- /***********************************************************************/
- /************ END : set search result to sel_mem_info buf **************/
gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM,
- obj,
- ad->itc_pslist_2line_1icon,
- sel_mem_info,
+ obj, ad->itc_pslist_2line_1icon, sel_mem_info,
obj->gl_result_grp);
result_info->itemlist = g_list_append(result_info->itemlist, (void*)gen_item);
- obj->mr_info.next_point++;
- } else if (obj->mr_info.next_point ==
- obj->mr_info.offset +
- SEARCH_CATEGORY_LIST_MORE_CNT) {
+ }while (contacts_list_next(list) == CONTACTS_ERROR_NONE);
+ } else {
+ SEARCH_DEBUG_WARNING("No matched contacts data", ret);
+ return SEARCH_RET_SEARCH_NONE;
+ }
+
+ contacts_list_destroy(list, true);
+
/* Set more title to genlist (under 'search all') */
+ if (loop_cnt == limit) {
+ struct search_item_more_sel *sel_mem_more = NULL;
+
+ obj->mr_info.next_point = offset + limit - 1;
+
sel_mem_more =
(struct search_item_more_sel *)calloc(1,
sizeof(struct
ad->itc_listmore,
sel_mem_more,
obj->gl_result_grp);
- } else {
- SEARCH_DEBUG_WARNING
- ("__search_sql_contact_search_result_cb wrong index : %d",
- obj->mr_info.next_point);
}
- SEARCH_FUNC_END;
-
- return CTS_SUCCESS;
-}
-
-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)
-{
- SEARCH_FUNC_START;
-
- struct appdata *ad = (struct appdata *)data;
- struct search_cb_data scd = {obj, ad, keyword, result_info};
-
- int ret = 0;
-
- /* Check whether search result is exist or not */
- ret =
- contacts_svc_smartsearch_excl(keyword, limit, offset,
- __search_sql_contact_search_result_cb,
- &scd);
- if (ret != CTS_SUCCESS) {
- SEARCH_DEBUG_WARNING("contacts svc search return error : %d",
- ret);
- return SEARCH_RET_SEARCH_FAIL;
- }
-
- if (obj->mr_info.next_point == 0) {
- SEARCH_DEBUG_WARNING("contacts svc search no result");
- return SEARCH_RET_SEARCH_NONE;
- }
+ ret = contacts_disconnect2();
SEARCH_FUNC_END;
{
SEARCH_FUNC_START;
- int ret;
struct appdata *ad = (struct appdata *)data;
-
- cal_struct *event = NULL;
- cal_iter *iter = NULL;
-
struct search_item_sel *sel_mem_info = NULL;
struct search_item_more_sel *sel_mem_more = NULL;
struct search_genlist_item_info *gen_item = NULL;
int loop_cnt = 0;
+ int count = -1;
+ int ret = 0;
+ int search_ret = SEARCH_RET_SEARCH_NONE;
- char *summary = NULL;
- bool is_word_in_str;
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
- int time_type = 0;
+ ret = calendar_connect();
+ SEARCH_RETV_IF_WITH_ERRORV(ret != CALENDAR_ERROR_NONE, SEARCH_RET_SEARCH_FAIL, ret);
- long long int start_time = 0;
- UErrorCode status = U_ZERO_ERROR;
- UCalendar *cal;
- int y = 0, m = 0, d = 0;
+ calendar_query_h query = NULL;
+ calendar_filter_h visibility_filter = NULL;
+ calendar_list_h list = NULL;
- ret = calendar_svc_smartsearch_excl(keyword, offset, limit, &iter);
+ calendar_error_e CALENDAR_ERROR_NONE;
+ calendar_query_create(_calendar_event._uri, &query);
- if (ret == CAL_SUCCESS) {
- ret = calendar_svc_iter_next(iter);
- if (ret != CAL_SUCCESS) {
- SEARCH_DEBUG_WARNING
- ("calendar svc search no result : %d", ret);
- return SEARCH_RET_SEARCH_NONE;
+ ret = calendar_filter_create(_calendar_event._uri, &visibility_filter);
+ if (ret != CALENDAR_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("calendar_filter_create : %d", ret);
+ goto out_func;
+ }
+
+ ret = calendar_filter_add_str(visibility_filter, _calendar_event.summary, CALENDAR_MATCH_CONTAINS, keyword);
+ if (ret != CALENDAR_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("calendar_filter_add_str : %d", ret);
+ goto out_func;
+ }
+
+ ret = calendar_filter_add_operator(visibility_filter, CALENDAR_FILTER_OPERATOR_AND);
+ if (ret != CALENDAR_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("calendar_filter_add_operator : %d", ret);
+ goto out_func;
+ }
+
+ ret = calendar_query_set_filter(query, visibility_filter);
+ if (ret != CALENDAR_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("calendar_query_set_filter : %d", ret);
+ goto out_func;
+ }
+
+ ret = calendar_db_get_records_with_query(query, offset, limit, &list);
+ if (ret != CALENDAR_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("calendar_db_get_records_with_query : %d", ret);
+ goto out_func;
}
+
+ calendar_list_get_count(list, &count);
+
+ if (count > 0) {
/* Set group title */
if (offset == 0) {
result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
obj,
NULL);
}
- /* Set search result to genlist */
+
do {
loop_cnt++;
if (loop_cnt == limit) {
break;
}
- /********** START : set search result to sel_mem_info buf ************/
- ret = calendar_svc_iter_get_info(iter, &event);
+ int main_id = -1;
+ char *summary = NULL;
+ bool is_word_in_str = false;
+ char format_val[MAX_LENGTH_PER_LINE] = {0,};
- if (ret == CAL_SUCCESS) {
- sel_mem_info =
- (struct search_item_sel *)calloc(1,
- sizeof
- (struct
- search_item_sel));
+ calendar_record_h record;
+ calendar_time_s cal;
+ calendar_list_get_current_record_p(list, &record);
+
+ sel_mem_info = (struct search_item_sel *)calloc(1,sizeof(struct search_item_sel));
sel_mem_info->type = obj->contents_type;
- if (obj->obj_icon_path)
+ /* Set Thumbnail Image */
+ if (obj->obj_icon_path) {
strncpy(sel_mem_info->icon1_path, obj->obj_icon_path,
MAX_LENGTH_PER_PATH - 1);
+ }
- summary =
- calendar_svc_struct_get_str(event,
- CAL_VALUE_TXT_SUMMARY);
-
+ /* Set text 1line - Summary */
+ calendar_record_get_str_p(record, _calendar_event.summary, &summary);
if ((summary) && (strlen(summary) > 0)) {
- strncpy(sel_mem_info->main_buf,
- search_markup_keyword(summary,
- keyword,
- &is_word_in_str),
- MAX_LENGTH_PER_LINE - 1);
+ strncpy(sel_mem_info->main_buf, search_markup_keyword(summary, keyword,
+ &is_word_in_str), MAX_LENGTH_PER_LINE - 1);
}
- snprintf(sel_mem_info->main_id,
- MAX_LENGTH_PER_ID - 1, "%d",
- calendar_svc_struct_get_int(event,
- CAL_VALUE_INT_INDEX));
-
- time_type = calendar_svc_struct_get_int(event, CALS_VALUE_INT_DTSTART_TYPE);
-
- if (time_type == CALS_TIME_LOCALTIME) {
- y = calendar_svc_struct_get_int(event, CALS_VALUE_INT_DTSTART_YEAR);
- m = calendar_svc_struct_get_int(event, CALS_VALUE_INT_DTSTART_MONTH);
- d = calendar_svc_struct_get_int(event, CALS_VALUE_INT_DTSTART_MDAY);
- } else if (time_type == CALS_TIME_UTIME) {
- start_time = calendar_svc_struct_get_lli(event,
- CALS_VALUE_LLI_DTEND_UTIME);
- UChar *_tzid;
- _tzid = (UChar *)malloc(sizeof(UChar) * (strlen("Europe/Berlin") + 1));
- if (_tzid) u_uastrcpy(_tzid, "Europe/Berlin");
-
- cal = ucal_open(_tzid, u_strlen(_tzid), "en_US", UCAL_TRADITIONAL, &status);
- ucal_setMillis(cal, (double)(start_time * 1000.0), &status);
- y = ucal_get(cal, UCAL_YEAR, &status);
- m = ucal_get(cal, UCAL_MONTH, &status);
- d = ucal_get(cal, UCAL_DATE, &status);
- ucal_close(cal);
+ /* Set text 2line - Date */
+ calendar_record_get_caltime(record, _calendar_event.start_time, &cal);
+
+ if (cal.type == CALENDAR_TIME_UTIME) {
+ search_util_date_time_format_get_val(cal.time.utime, format_val,
+ SEARCH_DATE_TYPE_YYMMDD);
+ snprintf(sel_mem_info->sub_buf, MAX_LENGTH_PER_LINE, "%s",
+ format_val);
+ } else {
+ search_util_date_time_format_get_val(cal.time.utime, format_val,
+ SEARCH_DATE_TYPE_YYMM);
+ snprintf(sel_mem_info->sub_buf, MAX_LENGTH_PER_LINE, "%s",
+ format_val);
}
- snprintf(sel_mem_info->sub_buf, MAX_LENGTH_PER_LINE, "%d.%d.%d", y,m,d);
- calendar_svc_struct_free(&event);
- summary = NULL;
+ /* Set id for launching caledar contents */
+ calendar_record_get_int (record, _calendar_event.id, &main_id);
+ snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID - 1, "%d", main_id);
- gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM,
- obj,
- ad->itc_pslist_2line_1icon,
- sel_mem_info,
+ gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM, obj,
+ ad->itc_pslist_2line_1icon, sel_mem_info,
obj->gl_result_grp);
result_info->itemlist = g_list_append(result_info->itemlist, (void*)gen_item);
+
+ } while (calendar_list_next(list) == CALENDAR_ERROR_NONE);
} else {
- SEARCH_DEBUG_WARNING
- ("calendar_svc_iter_get_info fail : %d",
- ret);
- break;
- }
+ SEARCH_DEBUG_WARNING("No Matched calendar data: %d", count);
- }
- while (calendar_svc_iter_next(iter) == CAL_SUCCESS);
- } else {
- SEARCH_DEBUG_WARNING("calendar_svc_search_list fail : %d", ret);
- return SEARCH_RET_SEARCH_FAIL;
+ search_ret = SEARCH_RET_SEARCH_NONE;
+ goto out_func;
}
/* Set more title to genlist (under 'search all') */
sel_mem_more,
obj->gl_result_grp);
}
+ search_ret = SEARCH_RET_SEARCH_SUCCESS;
+
+out_func:
+ ret = calendar_disconnect();
+
+ if (visibility_filter) {
+ calendar_filter_destroy(visibility_filter);
+ }
+
+ if (query) {
+ calendar_query_destroy(query);
+ }
SEARCH_FUNC_END;
- return SEARCH_RET_SEARCH_SUCCESS;
+ return search_ret;
}
static void __search_sql_memo_search_result_cb(memo_data_t * value,
SEARCH_FUNC_START;
struct search_cb_data *scd = (struct search_cb_data *)user_data;
- struct appdata *ad = scd->ad;
- struct search_content_object *obj = scd->obj;
- struct search_genlist_info *result_info = scd->result_info;
+ struct appdata *ad = NULL;
+ struct search_content_object *obj = NULL;
+ struct search_genlist_info *result_info = NULL;
struct search_genlist_item_info *gen_item = NULL;
struct search_item_sel *sel_mem_info = NULL;
struct search_item_more_sel *sel_mem_more = NULL;
char *keyword = scd->keyword;
+ bool is_word_in_str = false;
- bool is_word_in_str;
+ SEARCH_RET_IF(scd == NULL);
+ ad = scd->ad;
+ obj = scd->obj;
+ result_info = scd->result_info;
- if(!value) {
- SEARCH_DEBUG_WARNING("memo data value is null");
- return;
- }
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(value == NULL);
if (obj->mr_info.next_point == 0) {
/* Set group title */
}
snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID - 1, "%d", value->id);
- search_util_date_time_format_get_val(localtime
- (&value->modi_time),
- sel_mem_info->sub_buf);
+ search_util_date_time_format_get_val(value->modi_time,
+ sel_mem_info->sub_buf, SEARCH_DATE_TYPE_YYMM);
/********** END : set search result to sel_mem_info buf *************/
struct appdata *ad = (struct appdata *)data;
struct search_cb_data scd = {obj, ad, keyword, result_info};
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
+
memo_search_data(keyword,
limit, offset,
MEMO_SORT_TITLE_ASC,
struct search_genlist_item_info *gen_item = NULL;
struct search_item_sel *sel_mem_info = NULL;
struct search_item_more_sel *sel_mem_more = NULL;
- bool is_word_in_str;
+ bool is_word_in_str = false;
+
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
filter_list = (email_list_filter_t *)malloc(sizeof(email_list_filter_t) * filter_list_count);
memset(filter_list, 0 , sizeof(email_list_filter_t) * filter_list_count);
ret = email_get_mail_list_ex(filter_list, filter_list_count, sorting_rule_list, sorting_rule_list_count,
offset, limit, &mail_list, &mail_count);
+ SEARCH_FREE(filter_list);
+ SEARCH_FREE(sorting_rule_list);
if (ret != EMAIL_ERROR_NONE) {
SEARCH_DEBUG_WARNING("no email search result");
return SEARCH_RET_SEARCH_FAIL;
}
- if (mail_count == 0) {
- SEARCH_DEBUG_WARNING("no email search result");
+ if(mail_list == NULL) {
+ SEARCH_DEBUG_WARNING("mail_list is null");
return SEARCH_RET_SEARCH_NONE;
}
- if(mail_list == NULL) {
- SEARCH_DEBUG_WARNING("mail_list is null");
+ if (mail_count == 0) {
+ SEARCH_DEBUG_WARNING("no email search result");
+ SEARCH_FREE(mail_list);
return SEARCH_RET_SEARCH_NONE;
}
snprintf(sel_mem_info->path, MAX_LENGTH_PER_PATH - 1, "%d %d %d",
mail_list[i].account_id, mail_list[i].mail_id, mail_list[i].mailbox_id);
- SEARCH_DEBUG_LOG("subject : %s", mail_list[i].subject);
-
if((mail_list[i].subject) && (strlen(mail_list[i].subject) > 0)) {
strncpy(sel_mem_info->main_buf,
search_markup_keyword(mail_list[i].subject, ad->search_word, &is_word_in_str),
MAX_LENGTH_PER_LINE - 1);
}
- if(is_word_in_str == false && (mail_list[i].email_address_recipient)
- && (strlen(mail_list[i].email_address_recipient) > 0)) {
+ if(is_word_in_str == false && (strlen(mail_list[i].email_address_recipient) > 0)) {
strncpy(sel_mem_info->sub_buf,
search_markup_keyword(mail_list[i].email_address_recipient, ad->search_word, &is_word_in_str),
MAX_LENGTH_PER_LINE - 1);
obj->gl_result_grp);
}
- SEARCH_FREE(filter_list);
- SEARCH_FREE(sorting_rule_list);
-
SEARCH_FUNC_END;
return SEARCH_RET_SEARCH_SUCCESS;
}
bool is_word_in_str = false;
struct search_cb_data *scd = (struct search_cb_data*)user_data;
- struct appdata *ad = scd->ad;
- struct search_content_object *obj = scd->obj;
- struct search_genlist_info *result_info = scd->result_info;
- char *keyword = scd->keyword;
+ struct appdata *ad = NULL;
+ struct search_content_object *obj = NULL;
+ struct search_genlist_info *result_info = NULL;
+ char *keyword = NULL;
struct search_genlist_item_info *gen_item = NULL;
+ SEARCH_RETV_IF(scd == NULL, true);
+ ad = scd->ad;
+ obj = scd->obj;
+ result_info = scd->result_info;
+ keyword = scd->keyword;
+
+ SEARCH_RETV_IF(ad == NULL, true);
+
media_info_get_media_id(media, &media_id);
media_info_get_display_name(media, &media_name);
media_info_get_file_path(media, &media_path);
bool is_word_in_str = false;
struct search_cb_data *scd = (struct search_cb_data*)user_data;
- struct appdata *ad = scd->ad;
- struct search_content_object* obj = scd->obj;
- struct search_genlist_info *result_info = scd->result_info;
- char *keyword = scd->keyword;
+ struct appdata *ad = NULL;
+ struct search_content_object *obj = NULL;
+ struct search_genlist_info *result_info = NULL;
+ char *keyword = NULL;
struct search_genlist_item_info *gen_item = NULL;
+ SEARCH_RETV_IF(scd == NULL, true);
+ ad = scd->ad;
+ obj = scd->obj;
+ result_info = scd->result_info;
+ keyword = scd->keyword;
+
+ SEARCH_RETV_IF(ad == NULL, true);
+
media_info_get_media_id(media, &media_id);
media_info_get_file_path(media, &media_path);
media_info_get_storage_type(media, &storage_type);
audio_meta_get_artist(a_handle, &artist);
}
+ audio_meta_destroy(a_handle);
+
sel_mem_info = (struct search_item_sel *)calloc(1,
sizeof(struct search_item_sel));
struct search_item_more_sel *sel_mem_more = NULL;
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
+
media_info_get_media_count_from_db(filter, &result_cnt);
if (result_cnt != 0) {
ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icon);
- if (icon)
- strncpy(sel_mem_info->icon1_path, icon,
- MAX_LENGTH_PER_PATH - 1);
+ if (icon) {
+ strncpy(sel_mem_info->icon1_path, icon, MAX_LENGTH_PER_PATH - 1);
+ }
ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
if ((package) && (strlen(package) > 0)) {
ret = AIL_CB_RET_CANCEL;
} else {
SEARCH_DEBUG_WARNING
- ("__search_sql_memo_search_result_cb wrong index : %d",
+ ("__search_sql_menu_search_result_cb wrong index : %d",
obj->mr_info.next_point);
ret = AIL_CB_RET_CANCEL;
int cnt = 0;
int ret = 0;
- ail_filter_h filter;
+ ail_filter_h filter = NULL;
ail_error_e rc;
char *escape_added_keyword = NULL;
rc = ail_filter_new(&filter);
if (rc != AIL_ERROR_OK) {
SEARCH_DEBUG_WARNING("menu search - ail_filter_new error : %d", rc);
- return SEARCH_RET_SEARCH_FAIL;
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
}
rc = ail_filter_add_str(filter, AIL_PROP_NAME_STR, escape_added_keyword);
}
out_func:
+ if (filter) {
ail_filter_destroy(filter);
+ }
+
SEARCH_FREE(escape_added_keyword);
SEARCH_FUNC_END;
bool is_word_in_str_main = false;
bool is_word_in_str_sub = false;
- const char* match_str = NULL;
+ char* match_str_title = NULL;
+ char* match_str_addr = NULL;
struct search_cb_data_browser *scd = (struct search_cb_data_browser*)user_data;
struct appdata *ad = scd->ad;
if (info->next_point <
info->offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
- sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
- sel_mem_info->type = obj->contents_type;;
-
/********** START : set search result to sel_mem_info buf ************/
if (item != NULL && item->title) {
- match_str = search_markup_keyword(item->title, keyword, &is_word_in_str_main);
- strncpy(sel_mem_info->main_buf,
- match_str,
- MAX_LENGTH_PER_LINE - 1);
+ match_str_title = strdup(search_markup_keyword(item->title, keyword, &is_word_in_str_main));
}
if (item != NULL && item->address) {
- match_str = search_markup_keyword(item->address, keyword, &is_word_in_str_sub);
- strncpy(sel_mem_info->sub_buf,
- match_str,
- MAX_LENGTH_PER_LINE - 1);
- strncpy(sel_mem_info->path,
- item->address,
- MAX_LENGTH_PER_PATH - 1);
+ match_str_addr = strdup(search_markup_keyword(item->address, keyword, &is_word_in_str_sub));
}
if (is_word_in_str_main == true || is_word_in_str_sub == true) {
- if (obj->gl_result_grp == NULL ) {
+ if (obj->gl_result_grp == NULL && result_info->group == NULL) {
/* Set group title */
result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
obj,
NULL);
}
- if (obj->obj_icon_path)
+ sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
+ sel_mem_info->type = obj->contents_type;
+
+ if (match_str_title) {
+ strncpy(sel_mem_info->main_buf, match_str_title, MAX_LENGTH_PER_LINE - 1);
+ }
+
+ if (match_str_addr) {
+ strncpy(sel_mem_info->sub_buf, match_str_addr, MAX_LENGTH_PER_LINE - 1);
+ strncpy(sel_mem_info->path, item->address, MAX_LENGTH_PER_PATH - 1);
+ }
+
+ if (obj->obj_icon_path) {
strncpy(sel_mem_info->icon1_path, obj->obj_icon_path,
MAX_LENGTH_PER_PATH - 1);
+ }
strncpy(sel_mem_info->icon2_path,
SEARCH_FAVORITE_ICON,
scd->search_ret = true;
}
+ SEARCH_FREE(match_str_title);
+ SEARCH_FREE(match_str_addr);
+
/********** END : set search result to sel_mem_info buf *************/
info->next_point++;
info->loop_cnt++;
if (info->next_point <
info->offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
- sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
- sel_mem_info->type = obj->contents_type;;
-
/********** START : set search result to sel_mem_info buf ************/
if (item != NULL && item->address) {
- SEARCH_DEBUG_WARNING("BROWSER : %s %s", item->address, keyword);
match_str = search_markup_keyword(item->address, keyword, &is_word_in_str_main);
}
if (is_word_in_str_main != false ) {
- if (obj->gl_result_grp == NULL ) {
+ if (obj->gl_result_grp == NULL && result_info->group == NULL ) {
/* Set group title */
result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
obj,
NULL);
}
+ sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
+ sel_mem_info->type = obj->contents_type;
+
if (obj->obj_icon_path)
strncpy(sel_mem_info->icon1_path, obj->obj_icon_path,
MAX_LENGTH_PER_PATH - 1);
ret = SEARCH_RET_SEARCH_SUCCESS;
}
- return ret;
-
SEARCH_FUNC_END;
+
+ return ret;
}
int search_sql_msg_search_result_by_api(struct search_content_object *obj,
err = msg_search_message(ad->msg_handle, search_s, offset, limit, &msgList);
+ msg_release_struct(&search_s);
+
if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
SEARCH_DEBUG_WARNING("msg_search_message is failed : %d", err);
return SEARCH_RET_SEARCH_FAIL;
/********** START : set search result to sel_mem_info buf ************/
for (i = 0; i < loop_cnt; i++) {
- int ret = 0;
const char *text_1line = NULL;
const char *markup_keyword = NULL;
- const char *img_path = NULL;
+ char *img_path = NULL;
int msg_type = 0;
int contact_id = -1;
char str_name[MAX_DISPLAY_NAME_LEN] = {0,};
char msg_text[MAX_MSG_TEXT_LEN] = {0,};
- CTSstruct *contact = NULL;
-
sel_mem_info = (struct search_item_sel *)
calloc(1,sizeof(struct search_item_sel));
sel_mem_info->type = obj->contents_type;;
/* Set text_2line */
markup_keyword = search_markup_keyword(str_number, keyword, &is_word_in_str);
- if( 0 == j || true == is_word_in_str) {
+ if (j == 0 || is_word_in_str == true) {
if (strlen(str_name) > 0) {
strncpy(sel_mem_info->sub_buf, str_name, MAX_LENGTH_PER_LINE - 1);
+ }
} else {
strncpy(sel_mem_info->sub_buf, markup_keyword, MAX_LENGTH_PER_LINE - 1);
}
- /* Set Thumbnail Image */
- if (contact_id == -1) {
- strncpy(sel_mem_info->icon1_path, obj->obj_icon_path,
- MAX_LENGTH_PER_PATH - 1);
- }
- else {
- ret = contacts_svc_get_contact(contact_id, &contact);
+ /* Check Whether Thumbnail Image exist or not */
+ if (contact_id > -1) {
+ contacts_query_h query;
+ contacts_filter_h filter;
+ contacts_list_h list;
- if (ret == CTS_SUCCESS) {
- CTSvalue* value = NULL;
- ret = contacts_svc_struct_get_value(contact, CTS_CF_BASE_INFO_VALUE, &value);
+ unsigned int count = 0;
+ img_path = obj->obj_icon_path;
- if (ret == CTS_SUCCESS)
- img_path = contacts_svc_value_get_str(value, CTS_BASE_VAL_IMG_PATH_STR);
+ ret = contacts_connect2();
- if (img_path != NULL)
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to connect contact service!");
+ if (img_path != NULL) {
+ strncpy(sel_mem_info->icon1_path, img_path, MAX_LENGTH_PER_PATH - 1);
+ }
+ continue;
+ } else {
+ contacts_query_create(_contacts_person_number._uri, &query);
+ contacts_filter_create(_contacts_person_number._uri, &filter);
+ contacts_filter_add_int(filter, _contacts_person.id, CONTACTS_MATCH_EQUAL,
+ contact_id);
+ contacts_query_set_filter(query, filter);
+ contacts_db_get_records_with_query(query, 0, 0, &list);
+ contacts_list_get_count(list, &count);
+
+ if (count > 0) {
+ contacts_record_h record;
+ contacts_list_get_current_record_p(list, &record);
+ contacts_record_get_str_p(record, _contacts_person.image_thumbnail_path, &img_path);
+ }
+
+ if (img_path != NULL) {
strncpy(sel_mem_info->icon1_path , img_path,
MAX_LENGTH_PER_PATH -1 );
- else if (obj->obj_icon_path)
- strncpy(sel_mem_info->icon1_path, obj->obj_icon_path,
- MAX_LENGTH_PER_PATH - 1);
}
- else if (obj->obj_icon_path)
- strncpy(sel_mem_info->icon1_path, obj->obj_icon_path,
- MAX_LENGTH_PER_PATH - 1);
+ contacts_list_destroy(list, true);
+ ret = contacts_disconnect2();
+ }
+ } else {
+ if (obj->obj_icon_path) {
+ strncpy(sel_mem_info->icon1_path, obj->obj_icon_path, MAX_LENGTH_PER_PATH - 1);
}
}
{
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RETV_IF(ad == NULL, ECORE_CALLBACK_CANCEL);
search_set_result_list(ad);
ad->search_timer = NULL;
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- const char *text;
- text = elm_entry_markup_to_utf8(elm_object_text_get(ad->search_entry));
-
- SEARCH_DEBUG_LOG("text : %s", text);
+ SEARCH_RET_IF(ad == NULL);
if (elm_object_focus_get(ad->search_bar)) {
- if (elm_entry_is_empty(ad->search_entry))
+ if (elm_entry_is_empty(ad->search_entry)) {
elm_object_signal_emit(ad->search_bar, "elm,state,eraser,hide", "elm");
- else
+ }
+ else {
elm_object_signal_emit(ad->search_bar, "elm,state,eraser,show", "elm");
+ }
} else {
- if (elm_entry_is_empty(ad->search_entry))
+ if (elm_entry_is_empty(ad->search_entry)) {
elm_object_signal_emit(ad->search_bar, "elm,state,guidetext,show", "elm");
- else
+ }
+ else {
elm_object_signal_emit(ad->search_bar, "elm,state,guidetext,hide", "elm");
}
+ }
/* Make timer for check user's input */
search_stop_search(ad);
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
- if (!elm_entry_is_empty(ad->search_entry))
+ if (!elm_entry_is_empty(ad->search_entry)) {
elm_object_signal_emit(ad->search_bar, "elm,state,eraser,show", "elm");
+ }
elm_object_signal_emit(ad->search_bar, "elm,state,guidetext,hide", "elm");
elm_object_signal_emit(ad->search_bar, "cancel,in", "");
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
- if (elm_entry_is_empty(ad->search_entry))
+ if (elm_entry_is_empty(ad->search_entry)) {
elm_object_signal_emit(ad->search_bar, "elm,state,guidetext,show", "elm");
+ }
elm_object_signal_emit(ad->search_bar, "elm,state,eraser,hide", "elm");
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
elm_object_focus_set(ad->search_entry, EINA_TRUE);
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
elm_entry_entry_set(ad->search_entry, "");
struct appdata *ad = (struct appdata *)data;
Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *) event_info;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(ev == NULL);
+
+ SEARCH_DEBUG_LOG("ev->key : %s", ev->key);
+
if (SEARCH_STRCMP(ev->key, "Return") == 0) {
ecore_imf_context_input_panel_hide
((Ecore_IMF_Context *)elm_entry_imf_context_get
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ const char* text = NULL;
- const char* text;
+ SEARCH_RET_IF(ad == NULL);
elm_object_focus_set(ad->cate_btn, EINA_TRUE);
evas_object_hide(ad->search_cancel_btn);
if (text != NULL && strlen(text) > 0)
elm_entry_entry_set(ad->search_entry, NULL);
+ elm_object_signal_emit(ad->search_bar, "elm,state,eraser,hide", "elm");
+
search_set_result_list(ad);
malloc_trim(0);
SEARCH_FUNC_END;
}
-static void __search_searchbar_create(void *data)
+Evas_Object *__search_init_noresult_view(Evas_Object* parent)
+{
+ SEARCH_FUNC_START;
+
+ Evas_Object *noc = NULL;
+
+ noc = elm_layout_add(parent);
+ elm_layout_theme_set(noc, "layout", "nocontents", "search");
+ elm_object_part_text_set(noc, "elm.text", dgettext("sys_string", "IDS_COM_BODY_NO_SEARCH_RESULTS"));
+ elm_object_focus_allow_set(noc, EINA_TRUE);
+
+ SEARCH_FUNC_END;
+
+ return noc;
+}
+
+Evas_Object *search_category_custom_layout_add(Evas_Object *parent)
+{
+ SEARCH_FUNC_START;
+
+ Evas_Object *layout = NULL;
+ layout = elm_layout_add(parent);
+ elm_layout_file_set(layout, SEARCH_EDJ, "smartsearch/custom_image_button");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(layout, 0.5, 0.5);
+ evas_object_show(layout);
+
+ SEARCH_FUNC_END;
+ return layout;
+}
+
+Evas_Object *search_category_image_add(char* imgpath, Evas_Object *parent, int width, int height, bool resize)
+{
+ SEARCH_FUNC_START;
+
+ char buf[MAX_LENGTH_PER_PATH] = { 0, };
+ Evas_Object *image = NULL;
+
+ image = elm_image_add(parent);
+ elm_image_resizable_set(image,1,1);
+ snprintf(buf, sizeof(buf), SEARCH_ICON_PATH "%s", imgpath);
+ elm_image_file_set(image, buf, NULL);
+ evas_object_show(image);
+
+ SEARCH_FUNC_END;
+ return image;
+}
+
+Evas_Object *search_searchbar_category_icon_add(char* img, Evas_Object *parent, int width, int height, bool resize)
+{
+ SEARCH_FUNC_START;
+
+ char buf[MAX_LENGTH_PER_PATH] = { 0, };
+ Evas_Object* cate_icon = NULL;
+
+ if (img != NULL ) {
+ cate_icon = elm_icon_add(parent);
+
+ snprintf(buf, sizeof(buf), SEARCH_ICON_PATH "%s", img);
+
+ SEARCH_DEBUG_LOG("buf : %s", buf);
+
+ elm_image_file_set(cate_icon, buf, NULL);
+
+ evas_object_size_hint_aspect_set(cate_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+
+ if (resize != false) {
+ elm_image_resizable_set(cate_icon, EINA_TRUE, EINA_TRUE);
+ } else {
+ elm_image_resizable_set(cate_icon, EINA_FALSE, EINA_FALSE);
+ }
+
+ evas_object_size_hint_min_set(cate_icon, width * elm_scale_get(), height * elm_scale_get());
+ evas_object_size_hint_max_set(cate_icon, width * elm_scale_get(), height * elm_scale_get());
+ }
+
+ SEARCH_FUNC_END;
+
+ return cate_icon;
+}
+
+
+void search_delete_searchbar(void *data)
{
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
- if (!ad)
- return;
if (ad->search_bar) {
elm_object_signal_callback_del(
ad->search_cancel_btn = NULL;
}
- ad->search_bar = elm_layout_add(ad->navi_bar);
- elm_layout_theme_set(ad->search_bar , "layout", "searchbar", "cancel_button");
-
- ad->search_cancel_btn = elm_button_add(ad->search_bar);
- elm_object_part_content_set(ad->search_bar, "button_cancel", ad->search_cancel_btn);
- elm_object_style_set(ad->search_cancel_btn, "searchbar/default");
- elm_object_text_set(ad->search_cancel_btn, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
-
- ad->search_entry = elm_entry_add(ad->search_bar);
- elm_entry_scrollable_set(ad->search_entry, EINA_TRUE);
- elm_entry_single_line_set(ad->search_entry, EINA_TRUE);
- elm_object_part_content_set(ad->search_bar, "elm.swallow.content", ad->search_entry);
- elm_object_part_text_set(ad->search_bar, "elm.guidetext", dgettext("sys_string", "IDS_COM_BODY_SEARCH"));
- elm_entry_cnp_mode_set(ad->search_entry, ELM_CNP_MODE_PLAINTEXT);
-
- evas_object_size_hint_weight_set(ad->search_bar, EVAS_HINT_EXPAND, 0);
- evas_object_size_hint_align_set(ad->search_bar, EVAS_HINT_FILL, 0.0);
-
- elm_entry_input_panel_layout_set(ad->search_entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
- Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(ad->search_entry);
- ecore_imf_context_input_panel_event_callback_add(imf_context,
- ECORE_IMF_INPUT_PANEL_STATE_EVENT,
- __search_searchbar_state_event_cb,
- data);
-
- /* Set Searchbar Callback */
- elm_object_signal_callback_add(
- ad->search_bar,
- "elm,bg,clicked",
- "elm",
- __search_searchbar_bg_clicked_cb,
- ad);
- elm_object_signal_callback_add(
- ad->search_bar,
- "elm,eraser,clicked",
- "elm",
- __search_searchbar_eraser_clicked_cb,
- ad);
-
- /* Set Search-Entry Callback */
- evas_object_smart_callback_add(
- ad->search_entry,
- "changed",
- __search_searchbar_entry_changed_cb,
- ad);
- evas_object_smart_callback_add(
- ad->search_entry,
- "preedit,changed",
- __search_searchbar_entry_changed_cb,
- ad);
-
- evas_object_smart_callback_add(
- ad->search_entry,
- "focused",
- __search_searchbar_entry_focused_cb,
- ad);
- evas_object_smart_callback_add(
- ad->search_entry,
- "unfocused",
- __search_searchbar_entry_unfocused_cb,
- ad);
- evas_object_event_callback_add(
- ad->search_entry,
- EVAS_CALLBACK_KEY_DOWN,
- __search_searchbar_key_down_cb,
- ad);
+ if (ad->cate_btn) {
+ evas_object_del(ad->cate_btn);
+ ad->cate_btn = NULL;
+ }
- /* Set Searchbar Cancel Button Callback */
- evas_object_smart_callback_add(
- ad->search_cancel_btn,
- "clicked",
- __search_searchbar_cancel_clicked_cb,
- ad);
+ if (ad->sb_layout) {
+ elm_object_part_content_unset(ad->sb_layout, "list");
+ evas_object_del(ad->sb_layout);
+ }
- evas_object_show(ad->search_bar);
+ SEARCH_EVAS_OBJECT_FREE(ad->noresult_view);
+ SEARCH_EVAS_OBJECT_FREE(ad->search_gl);
SEARCH_FUNC_END;
}
-static Evas_Object *__search_init_noresult_view(void *data)
+void search_create_searchbar_layout(Evas_Object *parent, void *data)
{
SEARCH_FUNC_START;
+ Evas_Object *genlist = NULL;
struct appdata *ad = (struct appdata *)data;
- Evas_Object *noc;
-
- noc = elm_layout_add(ad->navi_bar);
- elm_layout_theme_set(noc, "layout", "nocontents", "search");
- elm_object_part_text_set(noc, "elm.text", dgettext("sys_string", "IDS_COM_BODY_NO_SEARCH_RESULTS"));
- elm_object_focus_allow_set(noc, EINA_TRUE);
- SEARCH_FUNC_END;
+ SEARCH_RET_IF(ad == NULL);
- return noc;
-}
+ ad->sb_layout = search_create_layout(parent,
+ SEARCH_EDJ,
+ SEARCH_SEARCHBAR_GROUP_NORMAL);
-Evas_Object *search_searchbar_category_icon_add(char* img, Evas_Object *parent, int width, int height, bool resize)
-{
- SEARCH_FUNC_START;
+ SEARCH_RET_IF(ad->sb_layout == NULL);
- char buf[MAX_LENGTH_PER_PATH] = { 0, };
- Evas_Object* cate_icon = NULL;
+ // Category button
+ ad->cate_btn = search_create_category_button(ad->sb_layout, ad);
- if( img != NULL ) {
- cate_icon = elm_icon_add(parent);
+ SEARCH_RET_IF(ad->cate_btn == NULL);
+ elm_object_part_content_set(ad->sb_layout,
+ "searchbar_area_category", ad->cate_btn);
+
+ // Search bar
+ ad->search_bar = search_create_search_bar(ad->sb_layout);
+ SEARCH_RET_IF(ad->search_bar == NULL);
+ elm_object_signal_callback_add(ad->search_bar, "elm,bg,clicked",
+ "elm", __search_searchbar_bg_clicked_cb, ad);
+ elm_object_signal_callback_add(ad->search_bar, "elm,eraser,clicked",
+ "elm", __search_searchbar_eraser_clicked_cb, ad);
+ elm_object_part_content_set(ad->sb_layout, "searchbar_area_entry",
+ ad->search_bar);
+
+ // Search entry
+ ad->search_entry = search_create_search_entry(ad->sb_layout, ad);
+ SEARCH_RET_IF(ad->search_entry == NULL);
+ elm_object_part_content_set(ad->search_bar,
+ "elm.swallow.content", ad->search_entry);
+ evas_object_smart_callback_add(ad->search_entry, "changed",
+ __search_searchbar_entry_changed_cb, ad);
+ evas_object_smart_callback_add(ad->search_entry, "preedit,changed",
+ __search_searchbar_entry_changed_cb, ad);
+ evas_object_smart_callback_add(ad->search_entry, "focused",
+ __search_searchbar_entry_focused_cb, ad);
+ evas_object_smart_callback_add(ad->search_entry, "unfocused",
+ __search_searchbar_entry_unfocused_cb, ad);
+ evas_object_event_callback_add(ad->search_entry, EVAS_CALLBACK_KEY_DOWN,
+ __search_searchbar_key_down_cb, ad);
+
+ // Search Cancel button
+ ad->search_cancel_btn = search_create_search_cancel_btn(ad->sb_layout);
+ SEARCH_RET_IF(ad->search_cancel_btn == NULL);
+ evas_object_smart_callback_add(ad->search_cancel_btn, "clicked",
+ __search_searchbar_cancel_clicked_cb,ad);
+ elm_object_part_content_set(ad->search_bar,
+ "button_cancel", ad->search_cancel_btn);
+
+ // Genlist
+ genlist = elm_genlist_add(ad->sb_layout);
+
+ // To use multiline textblock/entry/editfield in genlist, set height_for_width mode
+ // then the item's height is calculated while the item's width fits to genlist width.
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ elm_genlist_tree_effect_enabled_set(genlist, EINA_TRUE);
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ ad->search_gl = genlist;
+
+ // Result area
+ ad->noresult_view = __search_init_noresult_view(ad->sb_layout);
+
+ SEARCH_RET_IF(ad->noresult_view == NULL);
+ elm_object_part_content_set(ad->sb_layout, "list_noresult",
+ ad->noresult_view);
- snprintf(buf, sizeof(buf), SEARCH_ICON_PATH "%s", img);
- SEARCH_DEBUG_LOG("buf : %s", buf);
+ SEARCH_FUNC_END;
+}
- elm_icon_file_set(cate_icon, buf, NULL);
+Evas_Object *search_create_layout(Evas_Object *parent, const char *file, const char *group)
+{
+ SEARCH_FUNC_START;
+ Evas_Object *layout = NULL;
- evas_object_size_hint_aspect_set(cate_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ /* create layout */
+ layout = elm_layout_add(parent);
- if (resize != false) {
- elm_icon_resizable_set(cate_icon, EINA_TRUE, EINA_TRUE);
- } else {
- elm_icon_resizable_set(cate_icon, EINA_FALSE, EINA_FALSE);
- }
+ SEARCH_RETV_IF(layout == NULL, NULL);
- evas_object_size_hint_min_set(cate_icon, width * elm_scale_get(), height * elm_scale_get());
- evas_object_size_hint_max_set(cate_icon, width * elm_scale_get(), height * elm_scale_get());
- }
+ elm_layout_file_set(layout, file, group);
SEARCH_FUNC_END;
-
- return cate_icon;
+ return layout;
}
-void search_searchbar_cb(void *data, Evas_Object * obj, void *event_info)
+Evas_Object *search_create_category_button(Evas_Object *parent, void *data)
{
SEARCH_FUNC_START;
-
struct appdata *ad = (struct appdata *)data;
Evas_Object *cate_btn;
Evas_Object *cate_icon;
- int category = 0;
+
+ int err = 0;
char *imgpath = NULL;
+ int category = 0;
- /* create layout */
- ad->sb_layout = elm_layout_add(ad->navi_bar);
- elm_layout_file_set(ad->sb_layout,
- SEARCH_EDJ,
- "smartsearch/search_result");
+ /* set search category icon area */
- category = SEARCH_CATE_PHONE;
+ category = SEARCH_CATE_PHONE;
+ ad->search_category = category;
imgpath = ad->category_info[ad->search_category].btn_icon_path;
cate_icon = search_searchbar_category_icon_add(imgpath,
- ad->sb_layout,
+ parent,
SEARCH_CATEGORY_BTN_ICON_SIZE_WIDTH,
SEARCH_CATEGORY_BTN_ICON_SIZE_HEIGHT,
false);
- cate_btn = elm_button_add(ad->sb_layout);
- elm_object_content_set(ad->cate_btn, cate_icon);
- evas_object_show(cate_btn);
+ cate_btn = elm_button_add(parent);
+
+ SEARCH_RETV_IF(cate_btn == NULL, NULL);
+
+ elm_object_style_set(cate_btn, "circle/empty");
ad->cate_btn = cate_btn;
- elm_object_part_content_set(ad->sb_layout, "searchbar_area_category", cate_btn);
+ elm_object_content_set(ad->cate_btn, cate_icon);
+ evas_object_show(cate_btn);
- /* set search bar area */
+ SEARCH_FUNC_END;
+ return cate_btn;
+}
- __search_searchbar_create(ad);
+Evas_Object *search_create_search_bar(Evas_Object *parent)
+{
+ SEARCH_FUNC_START;
- elm_object_part_content_set(ad->sb_layout, "searchbar_area_entry", ad->search_bar);
+ Evas_Object *layout = NULL;
- /* set search result area */
+ layout = elm_layout_add(parent);
+ elm_layout_theme_set(layout, "layout", "searchbar", "cancel_button");
+ elm_object_part_text_set(layout, "elm.guidetext",
+ dgettext("sys_string", "IDS_COM_BODY_SEARCH"));
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_show(layout);
- ad->noresult_view = __search_init_noresult_view(ad);
+ SEARCH_FUNC_END;
+ return layout;
+}
- elm_object_part_content_set(ad->sb_layout,
- "list_noresult",
- ad->noresult_view);
+Evas_Object *search_create_search_cancel_btn(Evas_Object *parent)
+{
+ SEARCH_FUNC_START;
+ Evas_Object *cancel_btn = NULL;
- evas_object_size_hint_weight_set(
- ad->sb_layout,
- EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
+ cancel_btn = elm_button_add(parent);
+ elm_object_style_set(cancel_btn, "searchbar/default");
+ elm_object_text_set(cancel_btn, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
SEARCH_FUNC_END;
+ return cancel_btn;
}
+
+Evas_Object *search_create_search_entry(Evas_Object *parent, void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ Evas_Object *entry = NULL;
+
+ SEARCH_RETV_IF(ad == NULL, NULL);
+
+ entry = elm_entry_add(parent);
+
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ elm_entry_single_line_set(entry, EINA_TRUE);
+
+ elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
+ elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
+ Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry);
+ ecore_imf_context_input_panel_event_callback_add(imf_context,
+ ECORE_IMF_INPUT_PANEL_STATE_EVENT,
+ __search_searchbar_state_event_cb,
+ ad);
+ SEARCH_FUNC_END;
+ return entry;
+}
+
+
#include "ps_searcher.h"
#include <app.h>
-#include <ail.h>
+#include <app_manager.h>
struct search_content_object_default {
int order;
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ Ecore_Event_Mouse_Button *ev = NULL;
+ SEARCH_RETV_IF(ad == NULL, ECORE_CALLBACK_CANCEL);
+ SEARCH_RETV_IF(event == NULL, ECORE_CALLBACK_CANCEL);
+
+ ev = (Ecore_Event_Mouse_Button *) event;
+
+ SEARCH_RETV_IF(ev == NULL, ECORE_CALLBACK_CANCEL);
- Ecore_Event_Mouse_Button *ev = (Ecore_Event_Mouse_Button *) event;
ad->touch_x = ev->x;
ad->touch_y = ev->y;
return ECORE_CALLBACK_CANCEL;
SEARCH_FUNC_START;
Ecore_Event_Key *ev = (Ecore_Event_Key *) event;
+ SEARCH_RETV_IF(ev == NULL, EINA_FALSE);
if (!SEARCH_STRCMP(ev->keyname, KEY_END)) {
//end key concept is close.
return EINA_FALSE;
}
-static Evas_Object *__search_create_layout_main(Evas_Object * parent)
+static void __search_delete_layout_main(void *data)
{
SEARCH_FUNC_START;
+ SEARCH_RET_IF(data == NULL);
+
+ struct appdata *ad = (struct appdata *)data;
+
+ SEARCH_EVAS_OBJECT_FREE(ad->layout_main);
+ SEARCH_EVAS_OBJECT_FREE(ad->navi_bar);
+ SEARCH_EVAS_OBJECT_FREE(ad->back_btn);
- Evas_Object *layout;
- Evas_Object *bg;
+ search_delete_searchbar_layout(ad);
+ SEARCH_FUNC_END;
+}
+
+static Evas_Object *__search_create_bg(Evas_Object * parent) {
+ SEARCH_FUNC_START;
+
+ Evas_Object *bg = NULL;
+ SEARCH_RETV_IF(parent == NULL, NULL);
+
+ bg = elm_bg_add(parent);
+ SEARCH_RETV_IF(bg == NULL, NULL);
+
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(parent, bg);
+ evas_object_show(bg);
+
+ SEARCH_FUNC_END;
+ return bg;
+}
+
+static Evas_Object *__search_create_conformant(Evas_Object * parent) {
+ SEARCH_FUNC_START;
+
+ Evas_Object *conformant = NULL;
+ SEARCH_RETV_IF(parent == NULL, NULL);
+
+ conformant = elm_conformant_add(parent);
+
+ SEARCH_RETV_IF(conformant == NULL, NULL);
+
+ evas_object_size_hint_weight_set(conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(parent, conformant);
+ evas_object_show(conformant);
+
+ SEARCH_FUNC_END;
+
+ return conformant;
+}
+
+static Evas_Object *__search_create_layout_main(Evas_Object *parent, Evas_Object *bg)
+{
+ SEARCH_FUNC_START;
+ Evas_Object *layout = NULL;
SEARCH_RETV_IF(parent == NULL, NULL);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_win_resize_object_add(parent, layout);
-
- bg = elm_bg_add(parent);
- evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(parent, bg);
elm_object_part_content_set(layout, "elm.swallow.bg", bg);
- evas_object_show(bg);
-
edje_object_signal_emit(_EDJ(layout), "elm,state,show,indicator","elm");
edje_object_signal_emit(_EDJ(layout), "elm,state,show,content", "elm");
evas_object_show(layout);
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
- elm_win_lower(ad->win_main);
+ elm_win_lower(ad->win_main);
if(ad->back_btn_type == BACK_BTN_TYPE_CLOSE)
elm_exit();
SEARCH_FUNC_END;
}
-static void __search_add_back_btn(struct appdata *ad)
+static Evas_Object* __search_add_back_btn(struct appdata *ad)
{
SEARCH_FUNC_START;
+ SEARCH_RETV_IF(ad == NULL, NULL);
/* add back key */
- Evas_Object *btn = elm_button_add(ad->navi_bar);
+ Evas_Object *btn = elm_button_add(ad->conformant);
elm_object_style_set(btn, "naviframe/end_btn/default");
evas_object_smart_callback_add(btn, "clicked", __search_back_btn_clicked_cb, ad);
-#ifdef __ENABLE_TOP_BACK_BTN
- ad->navi_it = elm_naviframe_item_push(ad->navi_bar,
- dgettext("sys_string", "IDS_COM_BODY_SEARCH"),
- NULL, NULL, ad->sb_layout, NULL);
-
- elm_object_item_part_content_set(navi_it, "title_right_btn", btn);
- elm_object_item_signal_emit(navi_it, "elm,state,controlbar,close", "");
-#else
- ad->navi_it = elm_naviframe_item_push(ad->navi_bar,
- dgettext("sys_string", "IDS_COM_BODY_SEARCH"),
- btn, NULL, ad->sb_layout, NULL);
-#endif
-
- ad->back_btn = btn;
-
SEARCH_FUNC_END;
+
+ return btn;
}
static int __search_init_smartsearch(struct appdata *ad)
SEARCH_RETV_IF(ad == NULL, -1);
// Base Layout
- ad->layout_main = __search_create_layout_main(ad->win_main);
+ ad->bg = __search_create_bg(ad->win_main);
+ ad->conformant = __search_create_conformant(ad->win_main);
+ ad->layout_main = __search_create_layout_main(ad->conformant, ad->bg);
SEARCH_RETV_IF(ad->layout_main == NULL, -1);
+ elm_object_content_set(ad->conformant, ad->layout_main);
// Indicator
elm_win_indicator_mode_set(ad->win_main, ELM_WIN_INDICATOR_SHOW);
// Navigation Bar
ad->navi_bar = __search_create_navigation_layout(ad->layout_main);
+ // Backbutton
+ ad->back_btn = __search_add_back_btn(ad);
+
+ // Search bar layout
+ search_create_searchbar_layout(ad->conformant, ad);
+
+ ad->navi_it = elm_naviframe_item_push(ad->navi_bar,
+ dgettext("sys_string", "IDS_COM_BODY_SEARCH"),
+ ad->back_btn, NULL, ad->sb_layout, NULL);
+
ad->search_category = SEARCH_CATE_PHONE;
- search_searchbar_cb(ad, NULL, NULL);
- __search_add_back_btn(ad);
SEARCH_FUNC_END;
return 0;
SEARCH_FUNC_START;
int i = 0;
+ SEARCH_RET_IF(ad == NULL);
+
/* Initialize Category */
for( i = 0 ; i < SEARCH_CATE_MAX; ++i ) {
ad->category_info[i].btn_icon_path = strdup(def_category[i].btn_icon_path);
int rc = 0;
int ret = SEARCH_RET_SEARCH_NONE;
- ail_appinfo_h handle = NULL;
- ail_error_e ail_ret = AIL_ERROR_OK;
- char *str = NULL;
+ int ail_ret = 0;
sqlite3_stmt *sql_load = NULL;
sqlite3_stmt *sql_insert = NULL;
+ char *imgpath = NULL;
+
/* Load DB data */
sql_load = ad->search_db_sql[SEARCH_STMT_GET_CATEGORY_LIST_ALL];
ad->result_obj[i].name = strdup(def_obj[i].name);
ad->result_obj[i].string_type = def_obj[i].string_type;
ad->result_obj[i].def_pkg_name = strdup(def_obj[i].def_pkg_name);
+ ail_ret = app_manager_get_app_icon_path(def_obj[i].def_pkg_name, &imgpath);
- ail_ret = ail_package_get_appinfo(def_obj[i].def_pkg_name, &handle);
-
- if (ail_ret == AIL_ERROR_OK) {
- ret = ail_appinfo_get_str(handle, AIL_PROP_ICON_STR, &str);
-
- if (ail_ret == AIL_ERROR_OK)
- ad->result_obj[i].obj_icon_path = strdup(str);
+ if (ail_ret == APP_MANAGER_ERROR_NONE && imgpath) {
+ ad->result_obj[i].obj_icon_path = strdup(imgpath);
+ SEARCH_FREE(imgpath);
}
/* Insert DB */
strdup(def_pkg_name) : NULL;
if (def_pkg_name) {
- ail_ret = ail_package_get_appinfo(def_pkg_name, &handle);
-
- if (ail_ret == AIL_ERROR_OK) {
- ret = ail_appinfo_get_str(handle, AIL_PROP_ICON_STR, &str);
+ ail_ret = app_manager_get_app_icon_path(def_obj[i].def_pkg_name, &imgpath);
- if (ail_ret == AIL_ERROR_OK)
- ad->result_obj[i].obj_icon_path = strdup(str);
+ if (ail_ret == APP_MANAGER_ERROR_NONE && imgpath) {
+ ad->result_obj[i].obj_icon_path = strdup(imgpath);
+ SEARCH_FREE(imgpath);
}
}
SEARCH_FUNC_END;
}
-static Evas_Object *__search_create_win(const char *name)
+static Evas_Object *__search_create_win(const char *name, void *data)
{
SEARCH_FUNC_START;
+ struct appdata *ad = (struct appdata *)data;
Evas_Object *eo;
+ int w, h;
+
+ SEARCH_RETV_IF(ad == NULL, NULL);
eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ elm_win_conformant_set(eo, EINA_TRUE);
+
if (eo) {
elm_win_title_set(eo, name);
evas_object_smart_callback_add(eo, "delete,request",
- __search_win_delete_cb, NULL);
+ __search_win_delete_cb, ad);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(eo, w, h);
}
SEARCH_FUNC_END;
int rc = 0;
int ret = SEARCH_RET_FAIL;
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_FAIL);
+
rc = db_util_open(SEARCH_DB_PATH,
&(ad->search_db_hd),
0);
int i = 0, rc = 0;
+ SEARCH_RET_IF(ad == NULL);
+
for (i = SEARCH_STMT_GET_CATEGORY_LIST_ALL; i < SEARCH_STMT_MAX ; ++i ) {
if (ad->search_db_sql[i]) {
search_sql_stmt_finalize(ad->search_db_sql[i]);
SEARCH_FUNC_START;
struct appdata *ad = (struct appdata *)data;
+ SEARCH_RETV_IF(ad == NULL, ECORE_CALLBACK_CANCEL);
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
__search_keydown_event,
__search_init_db_connect(ad);
__search_init_result_object(ad);
- search_app_connect(ad);
UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
struct appdata *ad = (struct appdata *)data;
int i = 0;
+ SEARCH_RET_IF(ad == NULL);
+
/* Update Text for match to current language */
if (ad->navi_it)
elm_object_item_text_set(ad->navi_it,
struct appdata *ad = (struct appdata *)data;
- ad->win_main = __search_create_win(SEARCH_PACKAGE);
+ SEARCH_RETV_IF(ad == NULL, false);
+ ad->win_main = __search_create_win(SEARCH_PACKAGE, ad);
SEARCH_RETV_IF(ad->win_main == NULL, -1);
evas_object_show(ad->win_main);
__search_init_category_object(ad);
__search_init_smartsearch(ad);
- search_result_gl_init(ad);
- search_util_date_time_format_init(NULL);
+ ad->first_search = true;
ad->idler_create_ui = ecore_idler_add(__search_init_after_ui_create, ad);
+ evas_object_show(ad->win_main);
SEARCH_FUNC_END;
struct appdata *ad = (struct appdata *)data;
int i = 0;
+ SEARCH_RET_IF(ad == NULL);
+
if (ad->layout_main) {
evas_object_del(ad->layout_main);
ad->layout_main = NULL;
if(ad->idler_create_ui)
ecore_idler_del(ad->idler_create_ui);
- if(ad->idler_search)
- ecore_idler_del(ad->idler_search);
-
search_result_gl_deinit(ad);
search_app_disconnect(ad);
SEARCH_FUNC_END;
}
+static void __search_app_device_orientation_cb(app_device_orientation_e orientation, void *data)
+{
+ SEARCH_FUNC_START;
+ struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(ad->win_main == NULL);
+
+ if (orientation >= 0) {
+ elm_win_rotation_with_resize_set(ad->win_main, orientation);
+ }
+
+ SEARCH_FUNC_END;
+}
+
static void __search_app_lang_change(void *data)
{
SEARCH_FUNC_START;
event_callback.service = __search_app_service;
event_callback.low_memory = NULL;
event_callback.low_battery = NULL;
- event_callback.device_orientation = NULL;
+ event_callback.device_orientation = __search_app_device_orientation_cb;
event_callback.language_changed = __search_app_lang_change;
- event_callback.region_format_changed = search_util_date_time_format_init;
+ event_callback.region_format_changed = search_region_format_cb;
memset(&ad, 0x0, sizeof(struct appdata));