summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:00:57 +0900
committerHyungKyu Song <hk76.song@samsung.com>2013-02-16 00:00:57 +0900
commitcc411fe3142413dc1341ad4d074d9596cd8bf3ef (patch)
tree13492e8870c607304fe4e80abae5cf49efc10bf9
parent636878b6968ffd73d0fee4722d992ecb47e9f3a4 (diff)
downloadsmartsearch-tizen_2.0.tar.gz
smartsearch-tizen_2.0.tar.bz2
smartsearch-tizen_2.0.zip
-rwxr-xr-xAUTHORS2
-rwxr-xr-xCMakeLists.txt110
-rwxr-xr-xLICENSE.Flora75
-rwxr-xr-xNOTICE5
-rwxr-xr-xdata/groups/search_custom_ctxpopup_item.edc255
-rwxr-xr-xdata/groups/search_custom_style.edc81
-rwxr-xr-xdata/groups/search_result.edc176
-rw-r--r--data/images/B10_btn_icon_Phone.pngbin0 -> 3330 bytes
-rwxr-xr-xdata/images/B10_btn_icon_Phone_press.pngbin0 -> 3330 bytes
-rwxr-xr-xdata/images/B10_icon_list_favorite.pngbin0 -> 3631 bytes
-rwxr-xr-xdata/images/B10_icon_list_memorycard.pngbin0 -> 3393 bytes
-rwxr-xr-xdata/images/org.tizen.smartsearch.pngbin0 -> 15506 bytes
-rwxr-xr-xdata/org.tizen.smartsearch.xml67
-rwxr-xr-xdata/smartsearch-color.edc20
-rwxr-xr-xdata/smartsearch.edc25
-rwxr-xr-xdata/smartsearch.ini2
-rwxr-xr-xdebian/changelog17
-rwxr-xr-xdebian/compat1
-rwxr-xr-xdebian/control44
-rw-r--r--debian/copyright0
-rwxr-xr-xdebian/org.tizen.smartsearch.install.in4
-rwxr-xr-xdebian/org.tizen.smartsearch.postinst.in26
-rwxr-xr-xdebian/rules122
-rwxr-xr-xinclude/common_util.h31
-rwxr-xr-xinclude/ps_app_interface.h38
-rwxr-xr-xinclude/ps_debug_util.h200
-rwxr-xr-xinclude/ps_makeupviews.h40
-rwxr-xr-xinclude/ps_searcher.h67
-rwxr-xr-xinclude/search_bar.h41
-rwxr-xr-xinclude/smartsearch.h172
-rwxr-xr-xinclude/smartsearch_define.h203
-rwxr-xr-xorg.tizen.smartsearch.manifest30
-rwxr-xr-xpackaging/org.tizen.smartsearch.spec95
-rwxr-xr-xpo/CMakeLists.txt76
-rwxr-xr-xpo/POTFILES.in10
-rwxr-xr-xpo/ar.po15
-rwxr-xr-xpo/az.po15
-rwxr-xr-xpo/bg.po15
-rwxr-xr-xpo/ca.po15
-rwxr-xr-xpo/cs.po15
-rwxr-xr-xpo/da.po15
-rwxr-xr-xpo/de_DE.po15
-rwxr-xr-xpo/el_GR.po15
-rwxr-xr-xpo/en.po15
-rwxr-xr-xpo/en_PH.po15
-rwxr-xr-xpo/en_US.po15
-rwxr-xr-xpo/es_ES.po15
-rwxr-xr-xpo/es_MX.po15
-rwxr-xr-xpo/es_US.po15
-rwxr-xr-xpo/et.po15
-rwxr-xr-xpo/eu.po15
-rwxr-xr-xpo/fi.po15
-rwxr-xr-xpo/fr_CA.po15
-rwxr-xr-xpo/fr_FR.po15
-rwxr-xr-xpo/ga.po15
-rwxr-xr-xpo/gl.po15
-rwxr-xr-xpo/hi.po15
-rwxr-xr-xpo/hr.po15
-rwxr-xr-xpo/hu.po15
-rwxr-xr-xpo/hy.po15
-rwxr-xr-xpo/is.po15
-rwxr-xr-xpo/it_IT.po15
-rwxr-xr-xpo/ja_JP.po15
-rwxr-xr-xpo/ka.po15
-rwxr-xr-xpo/kk.po15
-rwxr-xr-xpo/ko_KR.po15
-rwxr-xr-xpo/lt.po15
-rwxr-xr-xpo/lv.po15
-rwxr-xr-xpo/mk.po15
-rwxr-xr-xpo/nb.po15
-rwxr-xr-xpo/nl_NL.po15
-rwxr-xr-xpo/pl.po15
-rwxr-xr-xpo/pt_BR.po15
-rwxr-xr-xpo/pt_PT.po15
-rwxr-xr-xpo/ro.po15
-rwxr-xr-xpo/ru_RU.po15
-rwxr-xr-xpo/sk.po15
-rwxr-xr-xpo/sl.po15
-rwxr-xr-xpo/sr.po15
-rwxr-xr-xpo/sv.po15
-rwxr-xr-xpo/tr_TR.po15
-rwxr-xr-xpo/uk.po15
-rwxr-xr-xpo/uz.po15
-rwxr-xr-xpo/zh_CN.po15
-rwxr-xr-xpo/zh_HK.po15
-rwxr-xr-xpo/zh_SG.po15
-rwxr-xr-xpo/zh_TW.po15
-rwxr-xr-xsrc/common_util.cpp432
-rwxr-xr-xsrc/ps_app_interface.cpp760
-rwxr-xr-xsrc/ps_makeupviews.cpp1244
-rwxr-xr-xsrc/ps_searcher.cpp2255
-rwxr-xr-xsrc/search_bar.cpp572
-rwxr-xr-xsrc/smartsearch.cpp816
93 files changed, 8894 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100755
index 0000000..c7aa2f2
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Junghyun Kim <jh1114.kim@samsung.com>
+Mijin Hwang <mjlois.hwang@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755
index 0000000..8bc1a0b
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,110 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(smartsearch CXX)
+
+SET(SMARTSEARCH_PKG_NAME org.tizen.smartsearch)
+SET(DATADIR "/opt/apps/${SMARTSEARCH_PKG_NAME}/data")
+
+SET(SRCS
+ src/search_bar.cpp
+ src/smartsearch.cpp
+ src/ps_searcher.cpp
+ src/ps_makeupviews.cpp
+ src/ps_app_interface.cpp
+ src/common_util.cpp
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include )
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+ appcore-efl
+ aul
+ db-util
+ dlog
+ elementary
+ ecore
+ ecore-imf
+ ecore-input
+ ecore-x
+ ui-gadget-1
+ utilX
+ x11
+ memo
+ icu-i18n
+ email-service
+ msg-service
+ libsoup-2.4
+ json-glib-1.0
+ glib-2.0
+ capi-appfw-application
+ capi-appfw-app-manager
+ capi-web-favorites
+ capi-content-media-content
+ contacts-service2
+ calendar-service2
+ libxml-2.0
+)
+
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -fpie -Wall")
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(BINDIR "${PREFIX}/bin")
+SET(RESDIR "${PREFIX}/res")
+SET(DATADIR "/opt/usr/apps/${SMARTSEARCH_PKG_NAME}/data")
+SET(DBDIR "${DATADIR}")
+SET(LOCALEDIR "${RESDIR}/locale")
+SET(ICONDIR "/usr/share/icons/default/small")
+SET(EDJDIR "${RESDIR}/edje")
+
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
+ADD_DEFINITIONS("-DDATADIR=\"${DATADIR}\"")
+ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
+ADD_DEFINITIONS("-DICONDIR=\"${ICONDIR}\"")
+ADD_DEFINITIONS("-DEDJDIR=\"${EDJDIR}\"")
+ADD_DEFINITIONS("-DDBDIR=\"${DATADIR}\"")
+ADD_DEFINITIONS("-DSEARCHPKG=\"${SMARTSEARCH_PKG_NAME}\"")
+
+ADD_DEFINITIONS("-D__ENABLE_DEBUG_UTIL")
+ADD_DEFINITIONS("-D__ENABLE_PLATFORM_DEBUG")
+#ADD_DEFINITIONS("-D__ENABLE_TOP_BACK_BTN")
+
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ 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})
+
+ADD_CUSTOM_TARGET(${PROJECT_NAME}.edj
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/data/images
+ ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.edc ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj
+ DEPENDS ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${PROJECT_NAME}.edj)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj DESTINATION res/edje)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION res/icons FILES_MATCHING PATTERN "*.png")
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION res/icons FILES_MATCHING PATTERN "*.jpg")
+
+# install desktop file & icon
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+#CONFIGURE_FILE(data/${SMARTSEARCH_PKG_NAME}.desktop.in ${SMARTSEARCH_PKG_NAME}.desktop)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${SMARTSEARCH_PKG_NAME}.xml DESTINATION /usr/share/packages/)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/${SMARTSEARCH_PKG_NAME}.png DESTINATION ${ICONDIR})
+
+#install application HOME directory
+INSTALL(DIRECTORY DESTINATION ${DATADIR})
+
+# i18n
+ADD_SUBDIRECTORY(po)
diff --git a/LICENSE.Flora b/LICENSE.Flora
new file mode 100755
index 0000000..cc8727b
--- /dev/null
+++ b/LICENSE.Flora
@@ -0,0 +1,75 @@
+Flora License
+
+Version 1.0, May, 2012
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies with the standards set forth in the Compatibility Definition Document and passes the Compatibility Test Suite as defined from time to time by the Tizen Technical Steering Group and certified by the Tizen Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work solely as incorporated into a Tizen Certified Platform, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work solely as incorporated into a Tizen Certified Platform to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof pursuant to the copyright license above, in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+ 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+ 2. You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+ 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+ 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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://floralicense.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.
diff --git a/NOTICE b/NOTICE
new file mode 100755
index 0000000..ffacf89
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,5 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Flora License, Version 1.
+Please, see the LICENSE file for Flora License terms and conditions.
+
+
diff --git a/data/groups/search_custom_ctxpopup_item.edc b/data/groups/search_custom_ctxpopup_item.edc
new file mode 100755
index 0000000..c9c0e3e
--- /dev/null
+++ b/data/groups/search_custom_ctxpopup_item.edc
@@ -0,0 +1,255 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+
+///////////////////////////////////////////////////////////////////////////////////////
+//
+// 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);
+ }
+ }
+ }
+ }
+
diff --git a/data/groups/search_custom_style.edc b/data/groups/search_custom_style.edc
new file mode 100755
index 0000000..e4a78dc
--- /dev/null
+++ b/data/groups/search_custom_style.edc
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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
+
diff --git a/data/groups/search_result.edc b/data/groups/search_result.edc
new file mode 100755
index 0000000..6f311a6
--- /dev/null
+++ b/data/groups/search_result.edc
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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/search_result";
+ 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: SEARCHBAR_BACKGROUND_COLOR_DEFAULT;
+ }
+ }
+ part {
+ name: "searchbar_area_category_pad_left";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: 26 0;
+ fixed: 1 0;
+ align: 0.0 0.5;
+ rel1 { relative: 0.0 0.0; to: "bg";}
+ rel2 { relative: 0.0 1.0; to: "bg";}
+ color: SEARCHBAR_BACKGROUND_COLOR_DEFAULT;
+ }
+ }
+
+ part {
+ name: "searchbar_area_category_top";
+ type: RECT;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: 74 16;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 { relative: 1.0 0.0; to: "searchbar_area_category_pad_left";}
+ rel2 { relative: 1.0 0.0; to: "searchbar_area_category_pad_left";}
+ color: SEARCHBAR_BACKGROUND_COLOR_DEFAULT;
+ }
+ }
+
+ part {
+ name: "searchbar_area_category_bottom";
+ type: RECT;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: 74 16;
+ fixed: 1 1;
+ align: 0.0 1.0;
+ rel1 { relative: 1.0 1.0; to: "searchbar_area_category_pad_left";}
+ rel2 { relative: 1.0 1.0; to: "searchbar_area_category_pad_left";}
+ color: SEARCHBAR_BACKGROUND_COLOR_DEFAULT;
+ }
+ }
+
+ part {
+ name: "searchbar_area_category";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: 74 74;
+ max: 74 74;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 { relative: 1.0 1.0;
+ to_x: "searchbar_area_category_pad_left";
+ to_y: "searchbar_area_category_top";}
+ rel2 { relative: 1.0 0.0;
+ to_x: "searchbar_area_category_pad_left";
+ to_y: "searchbar_area_category_bottom";}
+ }
+ }
+
+ part {
+ name: "searchbar_area_entry";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 620 107;
+ max: 99999 107;
+ align: 0.0 0.0;
+ rel1 { relative: 1.0 0.0;
+ to_x: "searchbar_area_category";
+ to_y: "bg";
+ }
+ rel2 { relative: 1.0 1.0;
+ to_x: "bg";
+ to_y: "bg";}
+ }
+ }
+
+ part {
+ name: "result_bg";
+ type: RECT;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: 0 0;
+ fixed: 0 1;
+ rel1 { relative: 0.0 1.0;
+ to_x: "bg";
+ to_y: "searchbar_area_entry";}
+ rel2 { relative: 1.0 1.0;
+ to_x: "bg";
+ to_y: "bg";}
+ color: SEARCHBAR_BACKGROUND_COLOR_DEFAULT;
+ }
+ }
+
+ part {
+ name: "list";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ //min: 720 1024;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; to: "result_bg"; }
+ rel2 { relative: 1.0 1.0; to: "result_bg"; }
+ }
+ }
+ part {
+ name: "list_noresult";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ //min: 720 1024;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; to: "result_bg"; }
+ rel2 { relative: 1.0 1.0; to: "result_bg"; }
+ }
+ }
+ } //end parts
+} //end group
+
diff --git a/data/images/B10_btn_icon_Phone.png b/data/images/B10_btn_icon_Phone.png
new file mode 100644
index 0000000..5e7b413
--- /dev/null
+++ b/data/images/B10_btn_icon_Phone.png
Binary files differ
diff --git a/data/images/B10_btn_icon_Phone_press.png b/data/images/B10_btn_icon_Phone_press.png
new file mode 100755
index 0000000..5e7b413
--- /dev/null
+++ b/data/images/B10_btn_icon_Phone_press.png
Binary files differ
diff --git a/data/images/B10_icon_list_favorite.png b/data/images/B10_icon_list_favorite.png
new file mode 100755
index 0000000..6626b5b
--- /dev/null
+++ b/data/images/B10_icon_list_favorite.png
Binary files differ
diff --git a/data/images/B10_icon_list_memorycard.png b/data/images/B10_icon_list_memorycard.png
new file mode 100755
index 0000000..836dfc1
--- /dev/null
+++ b/data/images/B10_icon_list_memorycard.png
Binary files differ
diff --git a/data/images/org.tizen.smartsearch.png b/data/images/org.tizen.smartsearch.png
new file mode 100755
index 0000000..6e164de
--- /dev/null
+++ b/data/images/org.tizen.smartsearch.png
Binary files differ
diff --git a/data/org.tizen.smartsearch.xml b/data/org.tizen.smartsearch.xml
new file mode 100755
index 0000000..ee8bb02
--- /dev/null
+++ b/data/org.tizen.smartsearch.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.smartsearch" version="0.3.16-1" install-location="internal-only">
+ <label>Search</label>
+ <author email="jh1114.kim@samsung.com" href="www.samsung.com">Junghyun Kim</author>
+ <description>Search Application</description>
+ <ui-application appid="org.tizen.smartsearch" exec="/usr/apps/org.tizen.smartsearch/bin/smartsearch" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <icon>org.tizen.smartsearch.png</icon>
+ <label>Search</label>
+ <label xml:lang="hy-am">Որոնել</label>
+ <label xml:lang="az-az">Axtarış</label>
+ <label xml:lang="eu-es">Bilatu</label>
+ <label xml:lang="bg-bg">Търси</label>
+ <label xml:lang="ca-es">Cercar</label>
+ <label xml:lang="zh-cn">搜索</label>
+ <label xml:lang="zh-hk">搜尋</label>
+ <label xml:lang="zh-tw">搜尋</label>
+ <label xml:lang="hr-hr">Traži</label>
+ <label xml:lang="cs-cz">Hledat</label>
+ <label xml:lang="da-dk">Søg</label>
+ <label xml:lang="nl-nl">Zoeken</label>
+ <label xml:lang="en-gb">Search</label>
+ <label xml:lang="en-us">Search</label>
+ <label xml:lang="et-ee">Otsi</label>
+ <label xml:lang="fi-fi">Etsi</label>
+ <label xml:lang="fr-fr">Rechercher</label>
+ <label xml:lang="gl-es">Buscar</label>
+ <label xml:lang="ka-ge">ძიება</label>
+ <label xml:lang="de-de">Suche</label>
+ <label xml:lang="el-gr">Αναζήτηση</label>
+ <label xml:lang="hu-hu">Keresés</label>
+ <label xml:lang="is-is">Leit</label>
+ <label xml:lang="ga-le">Cuardaigh</label>
+ <label xml:lang="it-it">Cerca</label>
+ <label xml:lang="ja-jp">検索</label>
+ <label xml:lang="kk-kz">Іздеу</label>
+ <label xml:lang="ko-kr">검색</label>
+ <label xml:lang="lv-lv">Meklēt</label>
+ <label xml:lang="lt-lt">Ieškoti</label>
+ <label xml:lang="mk-mk">Побарај</label>
+ <label xml:lang="nb-no">Søk</label>
+ <label xml:lang="pl-pl">Szukaj</label>
+ <label xml:lang="pt-pt">Поиск</label>
+ <label xml:lang="pt-br">Pesquisar</label>
+ <label xml:lang="ro-ro">Căutare</label>
+ <label xml:lang="ru-ru">Поиск</label>
+ <label xml:lang="sr-rs">Pretraži</label>
+ <label xml:lang="sk-sk">Hľadať</label>
+ <label xml:lang="sl-sl">Iskanje</label>
+ <label xml:lang="es-es">Buscar</label>
+ <label xml:lang="es-mx">Buscar</label>
+ <label xml:lang="sv-se">Sök</label>
+ <label xml:lang="tr-tr">Akıllı Arama</label>
+ <label xml:lang="uk-ua">Пошук</label>
+ <label xml:lang="uz-uz">Qidirish</label>
+ <label xml:lang="ar-ae">ﺐﺤﺛ</label>
+ <label xml:lang="zh-sg">搜寻</label>
+ <label xml:lang="hi-in">खोजें</label>
+ <label xml:lang="en-ph">Search</label>
+ <label xml:lang="fr-ca">Recherche</label>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/search"/>
+ </application-service>
+ </ui-application>
+</manifest>
+
+
+
diff --git a/data/smartsearch-color.edc b/data/smartsearch-color.edc
new file mode 100755
index 0000000..4deb85d
--- /dev/null
+++ b/data/smartsearch-color.edc
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+#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
diff --git a/data/smartsearch.edc b/data/smartsearch.edc
new file mode 100755
index 0000000..8d6a09f
--- /dev/null
+++ b/data/smartsearch.edc
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+
+
+
+
+collections {
+#include "smartsearch-color.edc"
+#include "groups/search_result.edc"
+#include "groups/search_custom_ctxpopup_item.edc"
+#include "groups/search_custom_style.edc"
+}
diff --git a/data/smartsearch.ini b/data/smartsearch.ini
new file mode 100755
index 0000000..5abbace
--- /dev/null
+++ b/data/smartsearch.ini
@@ -0,0 +1,2 @@
+[ProcessSetting]
+BG_SCHEDULE=true
diff --git a/debian/changelog b/debian/changelog
new file mode 100755
index 0000000..4f1eb61
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,17 @@
+smartsearch (0.3.16-1) unstable; urgency=low
+
+ * Apply changed feature
+ * Git: magnolia/apps/home/smartsearch
+ * Tag: smartsearch_0.3.16-1
+
+ -- Junghyun Kim <jh1114.kim@samsung.com> Sat, 11 Aug 2012 01:01:42 +0900
+
+smartsearch (0.3.15-1) unstable; urgency=low
+
+ * Fix keyword bug
+ * Fix tag string issue
+ * Update search icon
+ * Git: pkgs/s/smartsearch
+ * Tag: smartsearch_0.3.15-1
+
+ -- Junghyun Kim <jh1114.kim@samsung.com> Sat, 21 Apr 2012 15:54:43 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100755
index 0000000..7ed6ff8
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755
index 0000000..b1d0d3c
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,44 @@
+Source: smartsearch
+Section: main
+Priority: extra
+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,
+ libelm-dev,
+ libui-gadget-dev,
+ libaul-1-dev,
+ libslp-utilx-dev,
+ libx11-dev,
+ dlog-dev,
+ libslp-db-util-dev,
+ libecore-dev,
+ libug-contacts-dev,
+ libcontacts-service-dev,
+ libslp-calendar-dev,
+ libslp-memo-dev,
+ libicu-dev,
+ email-service-dev,
+ libail-0-dev,
+ libslp-msg-service-dev,
+ libsoup2.4-dev,
+ libjson-glib-dev,
+ libxml2-dev,
+ capi-appfw-application-dev,
+ capi-appfw-app-manager,
+ capi-web-favorites-dev,
+ capi-content-media-content-dev,
+Standards-Version: 0.1.0
+
+Package: org.tizen.smartsearch
+Section: main
+Architecture: any
+Depends: ${shlibs:Depends}, ${devel:Depends}, libappcore-efl-0, libelm-bin
+Description: Smartsearch Application
+
+Package: org.tizen.smartsearch-dbg
+Section: debug
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, org.tizen.smartsearch (= ${Source-Version})
+Description: debug package for smartsearch
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/debian/copyright
diff --git a/debian/org.tizen.smartsearch.install.in b/debian/org.tizen.smartsearch.install.in
new file mode 100755
index 0000000..d693a62
--- /dev/null
+++ b/debian/org.tizen.smartsearch.install.in
@@ -0,0 +1,4 @@
+@PREFIX@/bin/*
+@PREFIX@/res/*
+@PREFIX@/data
+/opt/share/applications/*
diff --git a/debian/org.tizen.smartsearch.postinst.in b/debian/org.tizen.smartsearch.postinst.in
new file mode 100755
index 0000000..61b094c
--- /dev/null
+++ b/debian/org.tizen.smartsearch.postinst.in
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+SEARCHPKG="org.tizen.smartsearch"
+
+# create db
+if [ ! -f /opt/apps/$SEARCHPKG/data/.search.db ]
+then
+ sqlite3 /opt/apps/$SEARCHPKG/data/.search.db 'PRAGMA journal_mode = PERSIST;
+ CREATE TABLE IF NOT EXISTS search_history (category int, keyword text not null, date TEXT, UNIQUE(category, keyword));'
+fi
+
+# owner & permission
+
+if [ ${USER} == "root" ]
+then
+ chown -R 5000:5000 /opt/apps/$SEARCHPKG/data
+ chown -R 5000:5000 /opt/apps/$SEARCHPKG/data/.search.db
+ chown -R 5000:5000 /opt/apps/$SEARCHPKG/data/.search.db-journal
+fi
+
+chmod 660 /opt/apps/$SEARCHPKG/data/.search.db
+chmod 660 /opt/apps/$SEARCHPKG/data/.search.db-journal
+
+#set default vconf key value
+vconftool set -t int db/smartsearch/category 0 -u 5000 -g 5000
+vconftool set -t string db/smartsearch/keyword '' -u 5000 -g 5000
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..ce445ce
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,122 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g -fpie
+CXXFLAGS ?= -Wall -g
+LDFLAGS ?=
+PREFIX ?= /opt/apps/org.tizen.smartsearch
+RESDIR ?= /opt/apps/org.tizen.smartsearch/res
+DATADIR ?= /opt/apps/org.tizen.smartsearch/data
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+ CXXFLAGS += -O0
+else
+ CFLAGS += -O2
+ CXXFLAGS += -O2
+endif
+
+CFLAGS += -Wall -fPIC
+CXXFLAGS += -fPIC
+LDFLAGS += -pie -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+ CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+
+ touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ #docbook-to-man debian/wavplayer.sgml > wavplayer.1
+
+ for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+ cat $$f > $${f%.in}; \
+ sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+ sed -i -e "s#@PREFIX@#$(RESDIR)#g" $${f%.in}; \
+ sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+ done
+
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) clean
+ rm -rf CMakeCache.txt
+ rm -rf CMakeFiles
+ rm -rf cmake_install.cmake
+ rm -rf Makefile
+ rm -rf install_manifest.txt
+
+ rm -rf po/CMakeCache.txt
+ rm -rf po/CMakeFiles
+ rm -rf po/cmake_install.cmake
+ rm -rf po/Makefile
+ rm -rf po/install_manifest.txt
+
+ rm -rf beat_winset_test.desktop
+ rm -rf org.tizen.smartsearch.desktop
+ rm -rf *.so
+ rm -rf *.edj
+
+ for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+ rm -f $${f%.in}; \
+ done
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/wavplayer.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_installexamples
+ dh_install --sourcedir=debian/tmp
+ dh_installman
+ dh_link
+ dh_compress
+ dh_fixperms
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/include/common_util.h b/include/common_util.h
new file mode 100755
index 0000000..4d9f5cc
--- /dev/null
+++ b/include/common_util.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+
+
+
+
+#define CHECK_VALIDATE_UTF8 0
+
+void search_util_date_time_format_init();
+void search_util_date_time_format_deinit();
+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,
+ bool *result);
+char *search_get_main_window_name(void);
diff --git a/include/ps_app_interface.h b/include/ps_app_interface.h
new file mode 100755
index 0000000..ecb55ad
--- /dev/null
+++ b/include/ps_app_interface.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2012-2013 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://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_PS_APP_INTERFACE_H__
+#define __DEF_PS_APP_INTERFACE_H__
+
+void search_launch_contact_view(void *data, void *record_info);
+void search_launch_msg_view(void *data, void *record_info);
+void search_launch_msg_view(void *data, void *record_info);
+void search_launch_email_view(void *data, void *record_info);
+void search_launch_image_view(void *data, void *record_info);
+void search_launch_video_view(void *data, void *record_info);
+void search_launch_music_view(void *data, void *record_info);
+void search_launch_document_view(void *data, void *record_info);
+void search_launch_calendar_view(void *data, void *record_info);
+void search_launch_memo_view(void *data, void *record_info);
+void search_launch_menu_view(void *data, void *record_info);
+void search_launch_browser_view(void *data, void *record_info);
+void search_launch_popup_error(int error_type, void *data);
+#endif
diff --git a/include/ps_debug_util.h b/include/ps_debug_util.h
new file mode 100755
index 0000000..bf4f212
--- /dev/null
+++ b/include/ps_debug_util.h
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2012-2013 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://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_PS_DEBUG_UTIL_H__
+#define __DEF_PS_DEBUG_UTIL_H__
+
+#ifdef __ENABLE_DEBUG_UTIL
+
+#include <assert.h>
+
+#ifdef __ENABLE_PLATFORM_DEBUG
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "SEARCH"
+
+#define SEARCH_FUNC_START \
+ do {\
+ LOGD("[%s() START ----->]\n", __FUNCTION__);\
+ }while(0)
+
+#define SEARCH_FUNC_END \
+ do {\
+ LOGD("[%s() <----- END]\n", __FUNCTION__);\
+ }while(0)
+
+#define SEARCH_FUNC_LINE \
+ do {\
+ LOGD("[%s() \t%s:%d]\n", __FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ }while(0)
+
+#define SEARCH_DEBUG_LOG(fmt, arg...) \
+ do {\
+ LOGD("\x1b[32m[SEARCH][D][" fmt "]\x1b[0m\n", ##arg);\
+ }while(0)
+
+#define SEARCH_DEBUG_WARNING(fmt, arg...) \
+ do {\
+ LOGW("\x1b[33m[SEARCH][W][" fmt "]\x1b[0m\n", ##arg);\
+ }while(0)
+
+#define SEARCH_DEBUG_ERROR(fmt, arg...) \
+ do {\
+ LOGE("\x1b[31m[SEARCH][E][" fmt "]\x1b[0m\n", ##arg);\
+ }while(0)
+
+#define SEARCH_ASSERT_IF(cond) \
+ do {\
+ if(cond) {\
+ LOGE("\x1b[31m[%s() \t%s:%d][ASSERT]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ assert(0);\
+ }\
+ }while(0)
+
+#define SEARCH_RETV_IF(cond,ret) \
+ do {\
+ if(cond) {\
+ LOGW("\x1b[33m[%s() \t%s:%d][RET_IF]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ return ret;\
+ }\
+ }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) {\
+ LOGW("\x1b[33m[%s() \t%s:%d][RET_IF]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ return;\
+ }\
+ }while(0)
+
+#define SEARCH_RET_IF_STR_INVALID(str,ret) \
+ do {\
+ if((str == NULL) || strlen(str) == 0) {\
+ LOGW("\x1b[33m[%s() \t%s:%d][RET_STR_IF]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ return ret;\
+ }\
+ }while(0)
+
+#else
+
+#include <stdio.h>
+
+#define SEARCH_FUNC_START \
+ do {\
+ fprintf(stderr, "[SEARCH][%s() START ----->]\n", __FUNCTION__);\
+ }while(0)
+
+#define SEARCH_FUNC_END \
+ do {\
+ fprintf("[SEARCH][%s() <----- END]\n", __FUNCTION__);\
+ }while(0)
+
+#define SEARCH_FUNC_LINE \
+ do {\
+ fprintf("[SEARCH][%s() \t%s:%d]\n", __FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ }while(0)
+
+#define SEARCH_DEBUG_LOG(fmt, arg...) \
+ do {\
+ fprintf(stderr, "[SEARCH][D][" fmt "\n", ##arg);\
+ }while(0)
+
+#define SEARCH_DEBUG_WARNING(fmt, arg...) \
+ do {\
+ fprintf(stderr, "[SEARCH][W][" fmt "\n", ##arg);\
+ }while(0)
+
+#define SEARCH_DEBUG_ERROR(fmt, arg...) \
+ do {\
+ fprintf(stderr, "[SEARCH][E][" fmt "\n", ##arg);\
+ }while(0)
+
+#define SEARCH_ASSERT_IF(cond) \
+ do {\
+ if(cond) {\
+ fprintf(stderr, "[%s() \t%s:%d][ASSERT]",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ assert(0);\
+ }\
+ }while(0)
+
+#define SEARCH_RETV_IF(cond,ret) \
+ do {\
+ if(cond) {\
+ fprintf(stderr, "[%s() \t%s:%d][RET_IF]",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ return ret;\
+ }\
+ }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) {\
+ fprintf(stderr, "[%s() \t%s:%d][RET_IF]",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ return;\
+ }\
+ }while(0)
+
+#define SEARCH_RET_IF_STR_INVALID(str,ret) \
+ do {\
+ if((str == NULL) || strlen(str) == 0) {\
+ fprintf("\x1b[33m[%s() \t%s:%d][RET_STR_IF]\x1b[0m",__FUNCTION__, strrchr(__FILE__, '/')+1, __LINE__);\
+ return ret;\
+ }\
+ }while(0)
+
+#endif
+
+#else
+
+#define SEARCH_FUNC_START
+#define SEARCH_FUNC_END
+#define SEARCH_FUNC_LINE
+#define SEARCH_DEBUG_LOG(fmt, arg...)
+#define SEARCH_DEBUG_WARNING(fmt, arg...)
+#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)
+
+#endif // __ENABLE_DEBUG_UTIL
+
+#endif // __DEF_PS_DEBUG_UTIL_H__
diff --git a/include/ps_makeupviews.h b/include/ps_makeupviews.h
new file mode 100755
index 0000000..d64e0c6
--- /dev/null
+++ b/include/ps_makeupviews.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2012-2013 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://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_PS_MAKEUPVIEWS_H__
+#define __DEF_PS_MAKEUPVIEWS_H__
+
+void search_result_gl_init(void *data);
+void search_result_gl_deinit(void *data);
+void search_gl_phone_result_sel(void *data, Evas_Object * obj, void *event_info);
+void search_gl_result_more_item_append_cb(void *data, Evas_Object * obj, void *event_info);
+int search_app_connect(void *data);
+int search_app_disconnect(void *data);
+void search_set_result_list(void *data);
+void search_stop_search(void *data);
+void search_layout_set_search_list(void* data);
+void search_layout_set_search_no_result(void* data);
+int search_layout_get_content_list_set_status(void* data);
+Ecore_Thread* search_make_result_thread(void *data);
+struct search_genlist_item_info* search_add_genlist_item(int type,
+ struct search_content_object *obj, Elm_Genlist_Item_Class *itc_style, void *data,
+ Elm_Object_Item *parent);
+#endif // __DEF_PS_MAKEUPVIEWS_H__
diff --git a/include/ps_searcher.h b/include/ps_searcher.h
new file mode 100755
index 0000000..0749dad
--- /dev/null
+++ b/include/ps_searcher.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012-2013 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://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __SEARCHSEARCHER_HEADER_H__
+#define __SEARCHSEARCHER_HEADER_H__
+
+#include "smartsearch.h"
+
+int search_sql_stmt_init(sqlite3_stmt * sql_stmt);
+
+int search_sql_stmt_finalize(sqlite3_stmt * stmt);
+
+int search_sql_prepare_stmt(sqlite3 *db_handle, const char *query,
+ sqlite3_stmt ** stmt_out);
+
+int search_sql_bind_text(sqlite3 *db_handle, sqlite3_stmt *sql_stmt, int col, char *data);
+
+int search_sql_bind_int(sqlite3 *db_handle, sqlite3_stmt *sql_stmt, int col, int 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);
+
+int search_sql_msg_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_email_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_calendar_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_memo_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_image_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_video_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_music_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_menu_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+int search_sql_browser_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit, char *keyword, void *data, struct search_genlist_info *result_info);
+
+
+void search_sql_update_result_object(struct search_content_object* result_obj, sqlite3* db_handle, sqlite3_stmt** db_sql);
+
+#endif // __SEARCHSERVER_HEADER_H__
diff --git a/include/search_bar.h b/include/search_bar.h
new file mode 100755
index 0000000..e9be2b9
--- /dev/null
+++ b/include/search_bar.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2012-2013 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://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_SEARCH_BAR_H__
+#define __DEF_SEARCH_BAR_H__
+
+#include <Elementary.h>
+
+void search_searchbar_cb(void *data, Evas_Object * obj, void *event_info);
+
+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__ */
diff --git a/include/smartsearch.h b/include/smartsearch.h
new file mode 100755
index 0000000..0726a6f
--- /dev/null
+++ b/include/smartsearch.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2012-2013 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://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_SMARTSEARCH_H__
+#define __DEF_SMARTSEARCH_H__
+
+#include <glib.h>
+#include <time.h>
+#include <Elementary.h>
+#include <Ecore_X.h>
+#include <appcore-efl.h>
+#include <Ecore_IMF.h>
+#include <vconf.h>
+#include <aul.h>
+#include <ui-gadget.h>
+#include <malloc.h>
+#include <sqlite3.h>
+#include <msg_types.h>
+
+#include "smartsearch_define.h"
+#include "ps_debug_util.h"
+#include "search_bar.h"
+#include "ps_makeupviews.h"
+#include "ps_app_interface.h"
+#include "common_util.h"
+#include "util-func.h"
+
+#define _EDJ(x) elm_layout_edje_get(x)
+
+struct search_more_result{
+ int next_point;
+ int offset;
+ int loop_cnt;
+ int result_cnt;
+ struct appdata *ad;
+};
+
+struct search_content_object {
+ int order;
+ Eina_Bool visible;
+ char *name;
+ int string_type;
+ int contents_type;
+ int category_type;
+ char *def_pkg_name;
+ char *obj_icon_path;
+ Elm_Object_Item *gl_result_grp;
+ struct search_more_result mr_info;
+};
+
+struct search_category_info {
+ char *btn_icon_path;
+ char *btn_icon_press_path;
+ char *popup_icon_path;
+ char *popup_press_icon_path;
+};
+
+struct search_genlist_item_info {
+ int type;
+ struct search_content_object *obj;
+ Elm_Genlist_Item_Class *itc_style;
+ void *data;
+ Elm_Object_Item *parent;
+};
+
+struct search_genlist_info {
+ struct search_genlist_item_info *group;
+ GList *itemlist;
+ struct search_genlist_item_info *more;
+};
+
+struct search_pipe_data {
+ int cmd;
+ struct search_genlist_info *result_list;
+ int search_ret;
+ struct search_content_object *obj;
+};
+
+struct search_item_sel {
+ int type;
+ char *launch_path;
+ char *launch_param;
+ char *text1;
+ char *text2;
+ char *icon1;
+ char *icon2;
+};
+
+struct search_item_more_sel {
+ struct search_content_object *obj;
+};
+
+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;
+
+ double scale_factor;
+
+ Evas_Object *search_entry;
+ Evas_Object *search_bar;
+ Evas_Object *search_cancel_btn;
+ Evas_Object *search_gl;
+ Evas_Object *noresult_view;
+ Evas_Object *sb_layout;
+ Evas_Object *back_btn;
+
+ Evas_Object *ctxpopup;
+ Evas_Object *cate_ctxpopup;
+
+ Evas_Object *cate_btn;
+ Ecore_Idler *idler_create_ui;
+ Ecore_Timer *search_timer;
+
+ int touch_x;
+ int touch_y;
+
+ Elm_Genlist_Item_Class *itc_pslist_1line;
+ Elm_Genlist_Item_Class *itc_pslist_1line_1icon;
+ Elm_Genlist_Item_Class *itc_pslist_1line_1icon_browser_history;
+ Elm_Genlist_Item_Class *itc_pslist_1line_2icon;
+ Elm_Genlist_Item_Class *itc_pslist_2line_1icon;
+ Elm_Genlist_Item_Class *itc_pslist_2line_2icon;
+ Elm_Genlist_Item_Class *itc_pslist_2line_2icon_browser_bookmark;
+ Elm_Genlist_Item_Class *itc_grouptitle;
+ Elm_Genlist_Item_Class *itc_listmore;
+
+ Ecore_Pipe *pipe;
+ Ecore_Thread *search_thread;
+ Eina_Condition condition;
+ Eina_Lock mutex;
+
+ bool first_search;
+ char *search_word;
+ char *not_markup_search_word;
+
+ int back_btn_type;
+ int search_category;
+
+ ui_gadget_h detail_ug;
+
+ sqlite3 *search_db_hd;
+ sqlite3_stmt *search_db_sql[SEARCH_STMT_MAX];
+ struct search_content_object result_obj[SEARCH_CONT_MAX];
+ struct search_category_info category_info[SEARCH_CATE_MAX];
+
+ /* Handle List */
+ msg_handle_t msg_handle;
+};
+
+#endif
diff --git a/include/smartsearch_define.h b/include/smartsearch_define.h
new file mode 100755
index 0000000..0894c6f
--- /dev/null
+++ b/include/smartsearch_define.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2012-2013 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://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __DEF_SMARTSEARCH_DEFINE_H__
+#define __DEF_SMARTSEARCH_DEFINE_H__
+
+
+enum {
+ SEARCH_OBJ_PHONE_CONTENTS = 0,
+ SEARCH_OBJ_APPLICATION,
+ SEARCH_OBJ_TYPE_MAX
+};
+
+enum {
+ SEARCH_CONT_PHONE_MIN = 0,
+ SEARCH_CONT_PHONE_CONTACTS = SEARCH_CONT_PHONE_MIN,
+ SEARCH_CONT_PHONE_MSG,
+ SEARCH_CONT_PHONE_EMAIL,
+ SEARCH_CONT_PHONE_IMAGES,
+ SEARCH_CONT_PHONE_MUSIC,
+ SEARCH_CONT_PHONE_VIDEO,
+ SEARCH_CONT_PHONE_CALENDAR,
+ SEARCH_CONT_PHONE_MEMO,
+ SEARCH_CONT_PHONE_MENU,
+ SEARCH_CONT_PHONE_BROWSER,
+ SEARCH_CONT_PHONE_MAX = SEARCH_CONT_PHONE_BROWSER,
+ SEARCH_CONT_MAX
+};
+
+enum {
+ SEARCH_CATE_PHONE = 0,
+ SEARCH_CATE_MAX
+};
+
+enum {
+ SEARCH_GENLIST_GROUP = 0,
+ SEARCH_GENLIST_ITEM,
+ SEARCH_GENLIST_MORE
+};
+
+enum {
+ LAUNCH_ERROR_FILE_NOT_FOUND = 1,
+ LAUNCH_ERROR_AUL_LAUNCH,
+ LAUNCH_ERROR_APPSVC,
+ LAUNCH_ERROR_MAX
+};
+
+enum {
+ BACK_BTN_TYPE_LOWER,
+ BACK_BTN_TYPE_CLOSE
+};
+
+enum {
+ SEARCH_RET_SEARCH_FAIL = -1,
+ SEARCH_RET_SEARCH_NONE,
+ SEARCH_RET_SEARCH_SUCCESS
+};
+
+enum {
+ SEARCH_RET_FAIL = -1,
+ SEARCH_RET_SUCCESS
+};
+
+enum {
+ SEARCH_STMT_GET_CATEGORY_LIST_ALL = 0,
+ SEARCH_STMT_INSERT_OBJECT_INFO,
+ SEARCH_STMT_UPDATE_OBJECT_INFO,
+ SEARCH_STMT_MAX
+};
+
+enum {
+ SEARCH_SQL_BIND_TYPE_SIMPLEX = 0,
+ SEARCH_SQL_BIND_TYPE_DUPLEX
+};
+
+enum {
+ SEARCH_PIPE_CMD_CLEAR_GENLIST = 0,
+ SEARCH_PIPE_CMD_ADD_GENLIST_PHONE,
+ SEARCH_PIPE_CMD_SET_LAYOUT,
+};
+
+enum {
+ SEARCH_STR_TYPE_APP_STRING = 0,
+ SEARCH_STR_TYPE_SYSTEM_STRING,
+};
+
+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_SDCARD_ICON SEARCH_ICON_PATH"B10_icon_list_memorycard.png"
+
+#define SEARCH_THUMBNAIL_SIZE 72
+#define SEARCH_ICON_SIZE 64
+
+#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 DEF_BUF_LEN (512)
+#define MAX_LENGTH_PER_LINE (512)
+#define MAX_LENGTH_PER_PATH (512)
+#define MAX_LENGTH_PER_ID (10)
+#define MAX_SEARCH_WORD_SIZE (128)
+#define 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 NO_RESULT_BODY_LEN 7
+
+#define SEARCH_CATEGORY_LIST_MORE_CNT (100)
+
+#define DB_ESCAPE_CHAR "|"
+
+#define SEARCH_DB_SQL_GET_CATEGORY_LIST_ALL "SELECT item_name, item_string, item_visible, item_order, item_contents_type, item_object_type, " \
+ "def_pkg_name FROM search_category ORDER by item_order asc;"
+#define SEARCH_DB_SQL_INSERT_OBJECT_IFNO "REPLACE INTO search_category" \
+ "(item_name, item_string, item_visible, item_order, item_contents_type, item_object_type, def_pkg_name) " \
+ "VALUES(?,?,?,?,?,?,?);"
+
+#define SEARCH_DB_SQL_UPDATE_OBJECT_INFO "UPDATE search_category SET " \
+ "item_name = ?, item_string = ?, item_visible = ?, item_order = ?, item_contents_type = ?, item_object_type = ?, " \
+ "def_pkg_name = ? WHERE item_contents_type = ?;"
+
+
+//==============================================================================================================================
+
+#define 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) \
+ { \
+ free(ptr); \
+ ptr = NULL; \
+ } \
+ }while(0);
+
+#define SEARCH_MALLOC(ptr, size, type) \
+ do { \
+ if(size > 0) { \
+ ptr = (type *)malloc(size); \
+ if(ptr == NULL) \
+ assert(0); \
+ } else { \
+ assert(0); \
+ } \
+ } while(0);
+
+#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)
+
+/* Returns string length of src and 0 if it is NULL */
+#define SEARCH_STRLEN(src) ((src != NULL)? strlen(src): 0)
+
+#define SEARCH_SCALABLED_SIZE(size, _scale_factor) (int)((size) * (_scale_factor))
+
+#endif
+
diff --git a/org.tizen.smartsearch.manifest b/org.tizen.smartsearch.manifest
new file mode 100755
index 0000000..511c917
--- /dev/null
+++ b/org.tizen.smartsearch.manifest
@@ -0,0 +1,30 @@
+<manifest>
+ <define>
+ <domain name="org.tizen.smartsearch"/>
+ <request>
+ <smack request="ail::db" type="rw"/>
+ <smack request="system::vconf" type="arwxt"/>
+ <smack request="system::homedir" type="arwxt"/>
+ <smack request="system::use_internet" type="r"/>
+ <smack request="xorg" type="w"/>
+ <smack request="isf" type="rw"/>
+ <smack request="contacts-service" type="rw"/>
+ <smack request="msg-service" type="w"/>
+ <smack request="media-data::db" type="rw"/>
+ <smack request="libslp-memo::db" type="rw"/>
+ <smack request="email-service::db" type="rw"/>
+ <smack request="contacts-service::db" type="rw"/>
+ <smack request="msg-service::db" type="rw"/>
+ <smack request="pkgmgr" type="r"/>
+ <smack request="efreet" type="rx"/>
+ <smack request="dbus" type="w"/>
+ <smack request="syspopup::db" type="rw"/>
+ </request>
+ </define>
+ <assign>
+ <filesystem path="/opt/share/icons/default/small/org.tizen.smartsearch.png" label="_"/>
+ </assign>
+ <request>
+ <domain name="org.tizen.smartsearch"/>
+ </request>
+</manifest>
diff --git a/packaging/org.tizen.smartsearch.spec b/packaging/org.tizen.smartsearch.spec
new file mode 100755
index 0000000..d50d758
--- /dev/null
+++ b/packaging/org.tizen.smartsearch.spec
@@ -0,0 +1,95 @@
+Name: org.tizen.smartsearch
+Summary: Smartsearch Application
+Version: 0.3.16
+Release: 1
+Group: main
+License: Flora Software License
+Source0: %{name}-%{version}.tar.gz
+Requires: elementary-bin libslp-memo
+BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(db-util)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(ecore-imf)
+BuildRequires: pkgconfig(ecore-input)
+BuildRequires: pkgconfig(ecore-x)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(email-service)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(icu-i18n)
+BuildRequires: pkgconfig(json-glib-1.0)
+BuildRequires: pkgconfig(libsoup-2.4)
+BuildRequires: pkgconfig(memo)
+BuildRequires: pkgconfig(msg-service)
+BuildRequires: pkgconfig(ui-gadget-1)
+BuildRequires: pkgconfig(utilX)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(capi-content-media-content)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(capi-web-favorites)
+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
+BuildRequires: gettext-devel
+
+Requires: libug-worldclock-efl libug-phone-efl
+
+%description
+Smartsearch Application.
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "/usr/apps/org.tizen.smartsearch"
+%define RESDIR "/usr/apps/org.tizen.smartsearch/res"
+%define DATADIR "/opt/usr/apps/org.tizen.smartsearch/data"
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{PREFIX}
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+
+touch %{buildroot}/opt/usr/apps/org.tizen.smartsearch/data/.search.db
+touch %{buildroot}/opt/usr/apps/org.tizen.smartsearch/data/.search.db-journal
+
+%post
+SEARCHPKG="org.tizen.smartsearch"
+
+# create db
+if [ ! -s /opt/usr/apps/$SEARCHPKG/data/.search.db ]
+then
+ sqlite3 /opt/usr/apps/org.tizen.smartsearch/data/.search.db 'PRAGMA journal_mode = PERSIST;
+ CREATE TABLE IF NOT EXISTS search_category (item_name text not null, item_string int, item_visible int, item_order int, item_contents_type int, item_object_type int, def_pkg_name text);'
+
+fi
+
+# owner & permission
+chown -R 5000:5000 /opt/usr/apps/$SEARCHPKG/data
+chown -R 5000:5000 /opt/usr/apps/$SEARCHPKG/data/.search.db
+chown -R 5000:5000 /opt/usr/apps/$SEARCHPKG/data/.search.db-journal
+
+chmod 660 /opt/usr/apps/$SEARCHPKG/data/.search.db
+chmod 660 /opt/usr/apps/$SEARCHPKG/data/.search.db-journal
+
+vconftool set -t int file/private/org.tizen.smartsearch/category 0 -u 5000 -g 5000 2> /dev/null
+vconftool set -t string file/private/org.tizen.smartsearch/keyword '' -u 5000 -g 5000 2> /dev/null
+
+%files
+%manifest org.tizen.smartsearch.manifest
+/usr/share/packages/*
+/usr/share/icons/default/small/*
+/usr/apps/org.tizen.smartsearch/bin/*
+/usr/apps/org.tizen.smartsearch/res/*
+%attr(-,inhouse,inhouse) /opt/usr/apps/org.tizen.smartsearch/data/
+%config(noreplace,missingok) /opt/usr/apps/org.tizen.smartsearch/data/.search.db
+%config(noreplace,missingok) /opt/usr/apps/org.tizen.smartsearch/data/.search.db-journal
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100755
index 0000000..d8183e0
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,76 @@
+# for i18n
+
+SET(POFILES
+ hy.po
+ az.po
+ eu.po
+ bg.po
+ ca.po
+ zh_CN.po
+ zh_HK.po
+ zh_TW.po
+ hr.po
+ cs.po
+ da.po
+ nl_NL.po
+ en.po
+ en_US.po
+ et.po
+ fi.po
+ fr_FR.po
+ gl.po
+ ka.po
+ de_DE.po
+ el_GR.po
+ hu.po
+ is.po
+ ga.po
+ it_IT.po
+ ja_JP.po
+ kk.po
+ ko_KR.po
+ lv.po
+ lt.po
+ mk.po
+ nb.po
+ pl.po
+ pt_PT.po
+ pt_BR.po
+ ro.po
+ ru_RU.po
+ sr.po
+ sk.po
+ sl.po
+ es_ES.po
+ es_MX.po
+ sv.po
+ tr_TR.po
+ uk.po
+ uz.po
+ ar.po
+ zh_SG.po
+ hi.po
+ en_PH.po
+ fr_CA.po
+)
+
+SET(MSGFMT "/usr/bin/msgfmt")
+
+FOREACH(pofile ${POFILES})
+ SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile})
+ MESSAGE("PO: ${pofile}")
+ GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE)
+ GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE)
+ SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${moFile}
+ COMMAND ${MSGFMT} -o ${moFile} ${absPofile}
+ DEPENDS ${absPofile}
+ )
+ INSTALL(FILES ${moFile}
+ DESTINATION ${LOCALEDIR}/${lang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+ SET(moFiles ${moFiles} ${moFile})
+ENDFOREACH(pofile)
+
+MESSAGE(".mo files: ${moFiles}")
+ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles})
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100755
index 0000000..3263667
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,10 @@
+# List of source files containing translatable strings.
+src/noresult_view.cpp
+src/ps_makeupviews.cpp
+src/ps_searchutil.cpp
+src/search_bar.cpp
+src/change_category.cpp
+src/ps_lucenesearcher.cpp
+src/ps_mfw.cpp
+src/ps_ui_gadget_interface.cpp
+src/smartsearch.cpp
diff --git a/po/ar.po b/po/ar.po
new file mode 100755
index 0000000..0a739da
--- /dev/null
+++ b/po/ar.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "جاري التحديث..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "يتعذر تشغيل التطبيق"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "البيانات المحددة غير موجودة"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "الهاتف"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "مزيد من النتائج"
+
diff --git a/po/az.po b/po/az.po
new file mode 100755
index 0000000..9b57d73
--- /dev/null
+++ b/po/az.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Yenilənir..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Proqramı başlatmaq mümkün deyil"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Seçilmiş məlumat mövcud deyil"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Daha çox nəticələr"
+
diff --git a/po/bg.po b/po/bg.po
new file mode 100755
index 0000000..d72530e
--- /dev/null
+++ b/po/bg.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Актуализиране..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Приложението не може да се стартира"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Избраните данни не съществуват"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Телефон"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Още резултати"
+
diff --git a/po/ca.po b/po/ca.po
new file mode 100755
index 0000000..9a447d4
--- /dev/null
+++ b/po/ca.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Actualitzant..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "No es pot iniciar l'aplicació"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Les dades seleccionades no existeixen"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telèfon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Més resultats"
+
diff --git a/po/cs.po b/po/cs.po
new file mode 100755
index 0000000..2c0fc1c
--- /dev/null
+++ b/po/cs.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Aktualizace..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Aplikaci se nepodařilo spustit"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Vybraná data neexistují"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Další výsledky"
+
diff --git a/po/da.po b/po/da.po
new file mode 100755
index 0000000..72a8f7f
--- /dev/null
+++ b/po/da.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Opdaterer ..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Kan ikke starte program"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Valgte data findes ikke"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Flere resultater"
+
diff --git a/po/de_DE.po b/po/de_DE.po
new file mode 100755
index 0000000..a502661
--- /dev/null
+++ b/po/de_DE.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Aktualisierung..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Anwendung kann nicht gestartet werden"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Ausgewählte Daten sind nicht vorhanden"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Mehr Ergebnisse"
+
diff --git a/po/el_GR.po b/po/el_GR.po
new file mode 100755
index 0000000..95ef07a
--- /dev/null
+++ b/po/el_GR.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Ενημέρωση..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Αδύνατη η εκκίνηση της εφαρμογής"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Τα επιλεγμένα δεδομένα δεν υπάρχουν"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Τηλέφωνο"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Περισσότερα αποτελέσματα"
+
diff --git a/po/en.po b/po/en.po
new file mode 100755
index 0000000..336e2dd
--- /dev/null
+++ b/po/en.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Updating..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Unable to launch application"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Selected data does not exist"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Phone"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "More results"
+
diff --git a/po/en_PH.po b/po/en_PH.po
new file mode 100755
index 0000000..336e2dd
--- /dev/null
+++ b/po/en_PH.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Updating..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Unable to launch application"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Selected data does not exist"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Phone"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "More results"
+
diff --git a/po/en_US.po b/po/en_US.po
new file mode 100755
index 0000000..336e2dd
--- /dev/null
+++ b/po/en_US.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Updating..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Unable to launch application"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Selected data does not exist"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Phone"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "More results"
+
diff --git a/po/es_ES.po b/po/es_ES.po
new file mode 100755
index 0000000..8b5a72d
--- /dev/null
+++ b/po/es_ES.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Actualizando..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "No se puede iniciar aplicación"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Los datos seleccionados no existen"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Teléfono"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Más resultados"
+
diff --git a/po/es_MX.po b/po/es_MX.po
new file mode 100755
index 0000000..8b5a72d
--- /dev/null
+++ b/po/es_MX.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Actualizando..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "No se puede iniciar aplicación"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Los datos seleccionados no existen"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Teléfono"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Más resultados"
+
diff --git a/po/es_US.po b/po/es_US.po
new file mode 100755
index 0000000..8b5a72d
--- /dev/null
+++ b/po/es_US.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Actualizando..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "No se puede iniciar aplicación"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Los datos seleccionados no existen"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Teléfono"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Más resultados"
+
diff --git a/po/et.po b/po/et.po
new file mode 100755
index 0000000..4e70a1e
--- /dev/null
+++ b/po/et.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Värskendamine..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Rakendust ei saa käivitada"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Valitud andmeid pole olemas"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Rohkem tulemusi"
+
diff --git a/po/eu.po b/po/eu.po
new file mode 100755
index 0000000..5646274
--- /dev/null
+++ b/po/eu.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Eguneratzen..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Ezin da aplikazioa abiarazi"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Aukeratutako datuak ez dira existitzen"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefonoa"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Emaitza gehiago"
+
diff --git a/po/fi.po b/po/fi.po
new file mode 100755
index 0000000..b5ef2a7
--- /dev/null
+++ b/po/fi.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Päivitetään..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Sovellusta ei voi käynnistää"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Valittuja tietoja ei ole olemassa"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Puhelin"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Lisää tuloksia"
+
diff --git a/po/fr_CA.po b/po/fr_CA.po
new file mode 100755
index 0000000..256cca7
--- /dev/null
+++ b/po/fr_CA.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Mise à jour..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Impossible de lancer l'application"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Les données sélectionnées n'existent pas"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Téléphone"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Autres résultats"
+
diff --git a/po/fr_FR.po b/po/fr_FR.po
new file mode 100755
index 0000000..e4f33da
--- /dev/null
+++ b/po/fr_FR.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Mise à jour..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Impossible de lancer l'application"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Les données sélectionnées n'existent pas"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Téléphone"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Plus de résultats"
+
diff --git a/po/ga.po b/po/ga.po
new file mode 100755
index 0000000..0f55ee7
--- /dev/null
+++ b/po/ga.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Ag nuashonrú..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Ní féidir feidhmchlár a lainseáil"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Níl na sonraí a roghnaíodh ann"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Fón"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Tuilleadh torthaí"
+
diff --git a/po/gl.po b/po/gl.po
new file mode 100755
index 0000000..2c58474
--- /dev/null
+++ b/po/gl.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Actualizando..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Non se pode iniciar a aplicación"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Os datos seleccionados non existen"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Teléfono"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Máis resultados"
+
diff --git a/po/hi.po b/po/hi.po
new file mode 100755
index 0000000..6ca2386
--- /dev/null
+++ b/po/hi.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "अपडेट हो रहा है..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "अनुप्रयोग लॉन्च करने में अक्षम"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "चयनित डेटा मौजूद नहीं है"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "फ़ोन"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "और परिणाम"
+
diff --git a/po/hr.po b/po/hr.po
new file mode 100755
index 0000000..4242ada
--- /dev/null
+++ b/po/hr.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Aktualiziranje..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Nemoguće pokrenuti aplikaciju"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Nema odabranih podataka"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Više rezultata"
+
diff --git a/po/hu.po b/po/hu.po
new file mode 100755
index 0000000..75a720a
--- /dev/null
+++ b/po/hu.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Frissítés..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Az alkalmazás nem indítható el"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "A kijelölt adatok nem léteznek"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "További eredmények"
+
diff --git a/po/hy.po b/po/hy.po
new file mode 100755
index 0000000..6f080a0
--- /dev/null
+++ b/po/hy.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Թարմացնում է..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Անհնար է գործարկել ծրագիրը"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Ընտրված տվյալները գոյություն չունեն"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Հեռախոս"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Այլ արդյունքներ"
+
diff --git a/po/is.po b/po/is.po
new file mode 100755
index 0000000..61ee235
--- /dev/null
+++ b/po/is.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Verið er að uppfæra..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Mistókst að ræsa forrit"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Völdu gögnin eru ekki til"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Í síma"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Fleiri niðurstöður"
+
diff --git a/po/it_IT.po b/po/it_IT.po
new file mode 100755
index 0000000..42251c6
--- /dev/null
+++ b/po/it_IT.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Aggiornamento..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Impossibile avviare applicazione"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "I dati selezionati non esistono"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefono"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Altri risultati"
+
diff --git a/po/ja_JP.po b/po/ja_JP.po
new file mode 100755
index 0000000..243b646
--- /dev/null
+++ b/po/ja_JP.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "更新中..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "アプリケーションを起動できません。"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "選択したデータは存在しません"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "電話"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "他の結果"
+
diff --git a/po/ka.po b/po/ka.po
new file mode 100755
index 0000000..effe055
--- /dev/null
+++ b/po/ka.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "განახლება..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "პროგრამის ჩართვა შეუძლებელია"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "არჩეული მონაცემები არ არსებობს"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "ტელეფონი"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "სხვა შედეგები"
+
diff --git a/po/kk.po b/po/kk.po
new file mode 100755
index 0000000..fe00135
--- /dev/null
+++ b/po/kk.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Жаңартуда..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Бағдарламаны ашу мүмкін емес"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Таңдалған деректер жоқ"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Телефон"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Қосымша нәтижелер"
+
diff --git a/po/ko_KR.po b/po/ko_KR.po
new file mode 100755
index 0000000..45109d8
--- /dev/null
+++ b/po/ko_KR.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "업데이트 중..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "애플리케이션을 실행할 수 없습니다"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "존재하지 않는 데이터입니다"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "휴대폰"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "결과 더보기"
+
diff --git a/po/lt.po b/po/lt.po
new file mode 100755
index 0000000..d0aa8df
--- /dev/null
+++ b/po/lt.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Atnaujinama..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Neįmanoma paleisti programos"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Pasirinktų duomenų nėra"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefonas"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Daugiau rezultatų"
+
diff --git a/po/lv.po b/po/lv.po
new file mode 100755
index 0000000..f8eda64
--- /dev/null
+++ b/po/lv.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Atjaunina..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Nevar palaist programmu"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Izvēlētie dati nepastāv"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Tālrunis"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Citi rezultāti"
+
diff --git a/po/mk.po b/po/mk.po
new file mode 100755
index 0000000..14be0d0
--- /dev/null
+++ b/po/mk.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Се ажурира..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Не може да се отвори апликацијата"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Избраните податоци не постојат"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Телефон"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Уште резултати"
+
diff --git a/po/nb.po b/po/nb.po
new file mode 100755
index 0000000..6174f4f
--- /dev/null
+++ b/po/nb.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Oppdaterer..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Kan ikke starte program"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Valgte data finnes ikke"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Flere resultater"
+
diff --git a/po/nl_NL.po b/po/nl_NL.po
new file mode 100755
index 0000000..eae97ea
--- /dev/null
+++ b/po/nl_NL.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Bijwerken..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Kan applicatie niet starten"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Geselecteerde gegevens bestaan niet"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefoon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Meer resultaten"
+
diff --git a/po/pl.po b/po/pl.po
new file mode 100755
index 0000000..103a9dc
--- /dev/null
+++ b/po/pl.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Aktualizacja..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Nie można uruchomić aplikacji"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Wybrane dane nie istnieją"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Więcej wyników"
+
diff --git a/po/pt_BR.po b/po/pt_BR.po
new file mode 100755
index 0000000..b73a946
--- /dev/null
+++ b/po/pt_BR.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Atualizando…"
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Impossível iniciar aplicação"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Os dados selecionados não existem"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefone"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Mais resultados"
+
diff --git a/po/pt_PT.po b/po/pt_PT.po
new file mode 100755
index 0000000..819ab0a
--- /dev/null
+++ b/po/pt_PT.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "A actualizar..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Impossível iniciar aplicação"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Os dados seleccionados não existem"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefone"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Mais resultados"
+
diff --git a/po/ro.po b/po/ro.po
new file mode 100755
index 0000000..55ae84c
--- /dev/null
+++ b/po/ro.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Actualizare..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Imposibil de lansat aplicaţia"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Datele selectate nu există"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Mai multe rezultate"
+
diff --git a/po/ru_RU.po b/po/ru_RU.po
new file mode 100755
index 0000000..6da5b3e
--- /dev/null
+++ b/po/ru_RU.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Обновление..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Не удается запустить приложение"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Выбранные данные не существуют"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Телефон"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Другие результаты"
+
diff --git a/po/sk.po b/po/sk.po
new file mode 100755
index 0000000..2655fc7
--- /dev/null
+++ b/po/sk.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Aktualizácia..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Aplikácia sa nedá spustiť"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Vybraté údaje neexistujú"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefón"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Ďalšie výsledky"
+
diff --git a/po/sl.po b/po/sl.po
new file mode 100755
index 0000000..58bb5b6
--- /dev/null
+++ b/po/sl.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Posodabljam..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Programa ni mogoče zagnati"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Izbrani podatki ne obstajajo"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Več rezultatov"
+
diff --git a/po/sr.po b/po/sr.po
new file mode 100755
index 0000000..dc8a2aa
--- /dev/null
+++ b/po/sr.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Ažuriranje..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Nemoguće pokrenuti aplikaciju"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Izabrani podaci ne postoje"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Još rezultata"
+
diff --git a/po/sv.po b/po/sv.po
new file mode 100755
index 0000000..76a6612
--- /dev/null
+++ b/po/sv.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Uppdaterar..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Det går inte att starta programmet"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Valda data finns inte"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Fler resultat"
+
diff --git a/po/tr_TR.po b/po/tr_TR.po
new file mode 100755
index 0000000..4140282
--- /dev/null
+++ b/po/tr_TR.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Güncelleniyor..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Uygulama başlatılamıyor"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Seçilen veriler mevcut değil"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Diğer sonuçlar"
+
diff --git a/po/uk.po b/po/uk.po
new file mode 100755
index 0000000..2aa75a8
--- /dev/null
+++ b/po/uk.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Оновлення..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Неможливо запустити програму"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Вибрані дані не існують"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Телефон"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Інші результати"
+
diff --git a/po/uz.po b/po/uz.po
new file mode 100755
index 0000000..32ed156
--- /dev/null
+++ b/po/uz.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "Yangilanmoqda..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "Ilovani ishga tushirib bo‘lmaydi"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "Ma’lumotlar mavjud emas"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "Telefon"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Boshqa natijalar"
+
diff --git a/po/zh_CN.po b/po/zh_CN.po
new file mode 100755
index 0000000..1088649
--- /dev/null
+++ b/po/zh_CN.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "正在更新"
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "无法启动应用程序"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "选择的数据不存在"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "手机"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "更多结果"
+
diff --git a/po/zh_HK.po b/po/zh_HK.po
new file mode 100755
index 0000000..f35f59b
--- /dev/null
+++ b/po/zh_HK.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "正在更新..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "無法啟動應用程式"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "已選資料不存在"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "手機"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "更多結果"
+
diff --git a/po/zh_SG.po b/po/zh_SG.po
new file mode 100755
index 0000000..670b9af
--- /dev/null
+++ b/po/zh_SG.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "更新中…"
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "无法启动应用程序"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "选择的数据不存在"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "手机"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "更多结果"
+
diff --git a/po/zh_TW.po b/po/zh_TW.po
new file mode 100755
index 0000000..b0b2308
--- /dev/null
+++ b/po/zh_TW.po
@@ -0,0 +1,15 @@
+msgid "IDS_SSEARCH_POP_UPDATING_ING"
+msgstr "正在更新..."
+
+msgid "IDS_SSEARCH_POP_UNABLE_TO_LAUNCH_APPLICATION"
+msgstr "無法執行應用程式"
+
+msgid "IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"
+msgstr "選定的數據不存在"
+
+msgid "IDS_SSEARCH_HEADER_PHONE_ABB"
+msgstr "電話"
+
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "更多結果"
+
diff --git a/src/common_util.cpp b/src/common_util.cpp
new file mode 100755
index 0000000..101b732
--- /dev/null
+++ b/src/common_util.cpp
@@ -0,0 +1,432 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+
+
+
+
+
+
+#include <smartsearch.h>
+#include <common_util.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#include <unicode/uloc.h>
+#include <unicode/udat.h>
+#include <unicode/udatpg.h>
+#include <unicode/ustring.h>
+
+static UDateTimePatternGenerator *search_pattern_generator = NULL;
+static UDateFormat *search_formatter_yymmdd_12th;
+static UDateFormat *search_formatter_yymmdd_24th;
+
+static UDateFormat *search_formatter_yymmdd;
+static UDateFormat *search_formatter_yymm;
+
+UDateFormat *__search_util_make_date_format(const char *skeleton)
+{
+ SEARCH_FUNC_START;
+
+ UDateFormat *formatter = NULL;
+ UChar customSkeleton[SEARCH_MAX_UCHAR_SIZE] = { '\0' };
+ int32_t bestPatternCapacity, bestPatternLength;
+ UChar bestPattern[SEARCH_MAX_UCHAR_SIZE] = { 0, };
+ UErrorCode status = U_ZERO_ERROR;
+ const char *locale = NULL;
+
+ /* Pattern Generator */
+ if (search_pattern_generator) {
+ udatpg_close(search_pattern_generator);
+ search_pattern_generator = NULL;
+ }
+
+ uloc_setDefault(getenv("LC_TIME"), &status);
+
+ locale = uloc_getDefault();
+
+ search_pattern_generator = udatpg_open(uloc_getDefault(), &status);
+
+ if (!search_pattern_generator) {
+ SEARCH_DEBUG_WARNING
+ ("pattern_generator / udatpg_open fail : %s",
+ u_errorName(status));
+ 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) {
+ 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) {
+ 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;
+
+ return;
+ }
+
+void search_region_format_cb(void *data)
+{
+ SEARCH_FUNC_START;
+
+ 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;
+
+ if (search_pattern_generator) {
+ udatpg_close(search_pattern_generator);
+ search_pattern_generator = 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(time_t time, char *format_val, int type)
+{
+ SEARCH_FUNC_START;
+
+ UDate date;
+ UChar formatted[SEARCH_MAX_UCHAR_SIZE] = { 0, };
+ int32_t formattedCapacity, formattedLength;
+ UErrorCode status = U_ZERO_ERROR;
+ char formattedString[SEARCH_MAX_CHAR_SIZE] = { 0, };
+
+ 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_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);
+
+ SEARCH_DEBUG_LOG("formattedString : %s", formattedString);
+
+ snprintf(format_val, MAX_LENGTH_PER_LINE, "%s", formattedString);
+
+ SEARCH_FUNC_END;
+}
+
+void search_sql_make_keyword_bind_value(char *src, char *dest, int type)
+{
+ char *tmp;
+
+ if(type == SEARCH_SQL_BIND_TYPE_DUPLEX) {
+ *dest = '%';
+ ++dest;
+ }
+
+ for (tmp = src; *tmp; ++tmp, ++dest) {
+ if ((*tmp == '%') || (*tmp == '_') || (*tmp == *DB_ESCAPE_CHAR)) {
+ *dest = *DB_ESCAPE_CHAR;
+ ++dest;
+ }
+
+ *dest = *tmp;
+ }
+
+ *dest = '%';
+}
+
+void search_get_date_string(char *date_string)
+{
+ struct tm *time_tm = NULL;
+
+ unsigned long seconds;
+ seconds = atol(date_string);
+
+ time_tm = gmtime((time_t *) & seconds);
+ sprintf(date_string, "%4d-%02d-%02d %02d:%02d:%02d", time_tm->tm_year
+ + 1900, time_tm->tm_mon + 1, time_tm->tm_mday, time_tm->tm_hour,
+ time_tm->tm_min, time_tm->tm_sec);
+}
+
+
+#if (!CHECK_VALIDATE_UTF8)
+const char *search_markup_keyword(const char *string, char *searchword,
+ bool *result)
+{
+ char pstr[DEF_BUF_LEN + 1] = {0,};
+ char result_str[DEF_BUF_LEN + 1] = {0,};
+ char start_str[DEF_BUF_LEN + 1] = {0,};
+ static char return_string[DEF_BUF_LEN + 1] = { 0, };
+ int word_len = 0;
+ int search_len = 0;
+ int i = 0;
+ bool found = false;
+
+ SEARCH_RET_IF_STR_INVALID(string, return_string);
+ SEARCH_RET_IF_STR_INVALID(searchword, return_string);
+
+ strncpy(pstr, string, DEF_BUF_LEN);
+
+ word_len = strlen(pstr);
+ search_len = strlen(searchword);
+
+ for (i = 0; i < word_len; i++) {
+ if (!strncasecmp(searchword, &pstr[i], search_len)) {
+ found = true;
+ break;
+ }
+ }
+
+ *result = found;
+
+ if (found) {
+ if (i == 0) {
+ strncpy(result_str, &pstr[i], search_len);
+ result_str[search_len] = '\0';
+ snprintf(return_string, 128,
+ "<match>%s</match>%s", &result_str[0],
+ &pstr[search_len]);
+ } else if (i > 0) {
+ strncpy(start_str, &pstr[0], i);
+ start_str[i + 1] = '\0';
+ strncpy(result_str, &pstr[i], search_len);
+ result_str[search_len] = '\0';
+ snprintf(return_string, 128,
+ "%s<match>%s</match>%s", &start_str[0],
+ &result_str[0], &pstr[i + search_len]);
+ }
+ } else {
+ snprintf(return_string, 128, "%s", pstr);
+ }
+
+ return return_string;
+}
+
+
+#else
+const char *search_markup_keyword(const char *string, char *searchword,
+ bool *result)
+{
+ char pstr[DEF_BUF_LEN + 1] = {0,};
+ static char return_string[DEF_BUF_LEN + 1] = { 0, };
+ int word_len = 0;
+ int search_len = 0;
+ int i = 0;
+ bool found = false;
+ gchar* markup_text_start;
+ gchar* markup_text_end;
+ gchar* markup_text;
+
+ SEARCH_RET_IF_STR_INVALID(string, return_string);
+ SEARCH_RET_IF_STR_INVALID(searchword, return_string);
+
+ if(g_utf8_validate(string,-1,NULL)) {
+
+ strncpy(pstr, string, DEF_BUF_LEN);
+
+ word_len = strlen(pstr);
+ search_len = strlen(searchword);
+
+ for (i = 0; i < word_len; i++) {
+ if (!strncasecmp(searchword, &pstr[i], search_len)) {
+ found = true;
+ break;
+ }
+ }
+
+ *result = found;
+ memset(return_string, 0x00, DEF_BUF_LEN);
+
+ if (found) {
+ if (i == 0) {
+ markup_text = g_markup_escape_text(&pstr[0], search_len);
+ markup_text_end = g_markup_escape_text(&pstr[search_len], word_len-search_len);
+ snprintf(return_string,
+ DEF_BUF_LEN,
+ "<match>%s</match>%s",
+ markup_text,
+ (char*)markup_text_end);
+ g_free(markup_text);
+ g_free(markup_text_end);
+ } else {
+ markup_text_start = g_markup_escape_text(&pstr[0], i);
+ markup_text = g_markup_escape_text(&pstr[i], search_len);
+ markup_text_end = g_markup_escape_text(&pstr[i+search_len], word_len-(i+search_len));
+ snprintf(return_string,
+ DEF_BUF_LEN,
+ "%s<match>%s</match>%s",
+ (char*)markup_text_start,
+ markup_text,
+ (char*)markup_text_end);
+ g_free(markup_text);
+ g_free(markup_text_start);
+ g_free(markup_text_end);
+ }
+ } else {
+ snprintf(return_string, 128, "%s", pstr);
+ }
+ }
+
+ return return_string;
+}
+#endif
+
+char *search_get_main_window_name()
+{
+ SEARCH_FUNC_START;
+
+ XTextProperty tp;
+ int count = 0, i, ret;
+ char **list = NULL;
+ char return_win_name[256] = { 0, };
+ int revert_to;
+ Window focus_win;
+ Display *dpy;
+ int screen = 0;
+
+ dpy = XOpenDisplay(0);
+ screen = DefaultScreen(dpy);
+
+ XGetInputFocus(dpy, &focus_win, &revert_to);
+
+ if (focus_win) {
+ XGetWMName(dpy, focus_win, &tp);
+ if (tp.nitems > 0) {
+ ret =
+ XmbTextPropertyToTextList(dpy, &tp, &list, &count);
+ if ((ret == Success || ret > 0) && list != NULL) {
+ for (i = 0; i < count; i++)
+ strncpy(return_win_name, list[i],
+ strlen(list[i]));
+ XFreeStringList(list);
+ }
+ }
+ } else {
+ return NULL;
+ }
+
+ SEARCH_FUNC_END;
+
+ return strdup(return_win_name);
+}
diff --git a/src/ps_app_interface.cpp b/src/ps_app_interface.cpp
new file mode 100755
index 0000000..dbecb51
--- /dev/null
+++ b/src/ps_app_interface.cpp
@@ -0,0 +1,760 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+
+
+
+
+
+
+#include "smartsearch.h"
+#include "ps_app_interface.h"
+#include "ps_searcher.h"
+#include <ui-gadget.h>
+#include <contacts-ug.h>
+#include <aul_service.h>
+#include <app.h>
+#include <app_manager.h>
+#include <bundle.h>
+
+static void __search_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode,
+ void *priv)
+{
+ SEARCH_FUNC_START;
+
+ Evas_Object *base = NULL; (Evas_Object *) ug_get_layout(ug);
+ Evas_Object *win = NULL;
+
+ SEARCH_RET_IF(ug == NULL || priv == NULL);
+
+ base = (Evas_Object *)ug_get_layout(ug);
+ win = (Evas_Object *)ug_get_window();
+
+ SEARCH_RET_IF(base == NULL);
+ SEARCH_RET_IF(win == NULL);
+
+ 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);
+ break;
+ default:
+ break;
+ }
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_ug_closed_cb(ui_gadget_h ug, void *priv)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)priv;
+
+ SEARCH_RET_IF(ug == NULL);
+ SEARCH_RET_IF(ad == NULL);
+
+ ug_destroy(ug);
+ ad->detail_ug = NULL;
+
+ elm_genlist_select_mode_set(ad->search_gl, ELM_OBJECT_SELECT_MODE_DEFAULT);
+
+ if (elm_object_scroll_freeze_get(ad->search_gl) > 0) {
+ elm_object_scroll_freeze_pop(ad->search_gl);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_contact_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
+
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
+ service_h service = NULL;
+ int ret = 0;
+ bool err_popup_show = true;
+
+ Ecore_X_Window win_id = -1;
+
+ win_id = elm_win_xwindow_get(ad->win_main);
+
+ ret = service_create(&service);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_create");
+ goto out_func;
+ }
+
+ ret = service_set_app_id(service, "contacts-details-efl");
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_set_app_id!");
+ goto out_func;
+ }
+
+ ret = service_set_window(service, win_id);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_set_window!");
+ goto out_func;
+ }
+
+ ret = service_add_extra_data(service, "type", "0");;
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_add_extra_data : type!");
+ goto out_func;
+ }
+
+ ret = service_add_extra_data(service, "person_id", cur_category_mem->launch_param);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_add_extra_data : person_id");
+ goto out_func;
+ }
+
+ ret = service_send_launch_request(service, NULL, NULL);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_send_launch_request");
+ goto out_func;
+ } else {
+ err_popup_show = false;
+ }
+
+out_func:
+ if (err_popup_show == true) {
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
+
+ if (service != NULL) {
+ service_destroy(service);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_msg_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ struct search_item_sel *cur_category_mem = (struct search_item_sel *)record_info;
+
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
+ service_h service = NULL;
+ int ret = 0;
+ bool err_popup_show = true;
+
+ ret = service_create(&service);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_create");
+ goto out_func;
+ }
+
+ ret = service_set_package(service, "org.tizen.message");
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_set_package!");
+ goto out_func;
+ }
+
+ ret = service_add_extra_data(service, "type", "msg_id");
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_set_extra_data : msg_id");
+ goto out_func;
+ }
+
+ ret = service_add_extra_data(service, "msgId", cur_category_mem->launch_param);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_set_extra_data : msgId parameter!");
+ goto out_func;
+ }
+
+ ret = service_send_launch_request(service, NULL, NULL);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("[Fail] service_send_launch_request");
+ goto out_func;
+ } else {
+ err_popup_show = false;
+ }
+
+out_func:
+ if (err_popup_show == true) {
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
+
+ if (service != NULL) {
+ service_destroy(service);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_email_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ char *token_param = NULL;
+ char *saveptr1;
+ int i = 0;
+ int ret = 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;
+
+ 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!");
+ goto out_func;
+ }
+
+ snprintf(temp_path, MAX_LENGTH_PER_PATH - 1, "%s", cur_category_mem->launch_path);
+ token_param = strtok_r(temp_path, " ", &saveptr1);
+
+ while (token_param != NULL) {
+ SEARCH_DEBUG_LOG("PARAMETER (%d) : %s", i, token_param);
+ if (i == 0) {
+ ret = service_add_extra_data(service, "ACCOUNT_ID", token_param);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to add extra data : ACCOUND_ID!");
+ goto out_func;
+ }
+ } else if (i == 1) {
+ ret = service_add_extra_data(service, "MAIL_ID", token_param);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to add extra data : MAIL_ID!");
+ goto out_func;
+ }
+ } else if (i == 2) {
+ ret = service_add_extra_data(service, "MAILBOX_ID", token_param);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to add extra data : MAILBOX_ID!");
+ goto out_func;
+ }
+ } else {
+ break;
+ }
+
+ i++;
+ token_param = strtok_r(NULL, " ", &saveptr1);
+ }
+
+ ret = service_add_extra_data(service, "RUN_TYPE", "7");
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to add extra data : RUN_TYPE!");
+ goto out_func;
+ }
+
+ ret = service_set_package(service, "org.tizen.email");
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to set package!");
+ goto out_func;
+ }
+
+ ret = service_send_launch_request(service, NULL, NULL);
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to send service!");
+ goto out_func;
+ }
+ err_popup_show = false;
+
+out_func:
+ 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) {
+ SEARCH_DEBUG_ERROR("Fail to destroy service header : [%d]", ret);
+ }
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_image_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ 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->launch_path, F_OK) != 0) {
+ SEARCH_DEBUG_ERROR("image access error : %s",
+ cur_category_mem->launch_path);
+ search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND,
+ ad);
+ } else {
+ SEARCH_DEBUG_LOG("cur_category_mem->launch_path : %s",
+ cur_category_mem->launch_path);
+
+ service_h service;
+ ret = service_create(&service);
+
+ if (ret == 0) {
+ service_set_operation(service, SERVICE_OPERATION_VIEW);
+ service_set_uri(service, cur_category_mem->launch_path);
+ ret = service_send_launch_request(service, NULL, NULL);
+
+ if (ret != 0) {
+ SEARCH_DEBUG_ERROR("image app service launching error(%d)", ret);
+ search_launch_popup_error(LAUNCH_ERROR_APPSVC,
+ ad);
+ }
+ service_destroy(service);
+ }
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_video_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ 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->launch_path, F_OK) != 0) {
+ SEARCH_DEBUG_ERROR("video access error : %s",
+ cur_category_mem->launch_path);
+ search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND, ad);
+ } else {
+ SEARCH_DEBUG_LOG("cur_category_mem->launch_path : %s",
+ cur_category_mem->launch_path);
+
+ service_h service;
+ ret = service_create(&service);
+
+ if (ret == 0) {
+ service_set_operation(service, SERVICE_OPERATION_VIEW);
+ service_set_uri(service, cur_category_mem->launch_path);
+ ret = service_send_launch_request(service, NULL, NULL);
+
+ if (ret != 0) {
+ SEARCH_DEBUG_ERROR("video app service launching error(%d)", ret);
+ search_launch_popup_error(LAUNCH_ERROR_APPSVC,
+ ad);
+ }
+ service_destroy(service);
+ }
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_music_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ 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->launch_path, F_OK) != 0) {
+ SEARCH_DEBUG_ERROR("music file access error : %s",
+ cur_category_mem->launch_path);
+ search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND, ad);
+ } else {
+ SEARCH_DEBUG_LOG("cur_category_mem->launch_path : %s",
+ cur_category_mem->launch_path);
+
+ service_h service;
+ ret = service_create(&service);
+
+ if (ret == 0) {
+ service_set_operation(service, SERVICE_OPERATION_VIEW);
+ service_set_uri(service, cur_category_mem->launch_path);
+ ret = service_send_launch_request(service, NULL, NULL);
+
+ if (ret != 0) {
+ SEARCH_DEBUG_ERROR("music app service launching error(%d)", ret);
+ search_launch_popup_error(LAUNCH_ERROR_APPSVC,
+ ad);
+ }
+ service_destroy(service);
+ }
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_calendar_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ 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 (strlen(cur_category_mem->launch_param) <= 0) {
+ SEARCH_DEBUG_ERROR("Selected item does not have data!");
+ goto out_func;
+ } else {
+ ret = service_create(&service);
+
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to create service handle!");
+ goto out_func;
+ }
+
+ ret = service_add_extra_data(service, "itemType", "event");
+
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 1!");
+ goto out_func;
+ }
+
+ ret = service_add_extra_data(service, "eventId", cur_category_mem->launch_param);
+
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 2!");
+ goto out_func;
+ }
+
+ cbs.destroy_cb = __search_ug_closed_cb;
+ cbs.layout_cb = __search_ug_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.priv = ad;
+
+ ug = ug_create(NULL, "calendar-detail-efl", UG_MODE_FULLVIEW, service, &cbs);
+
+ if (!ug) {
+ SEARCH_DEBUG_ERROR("... create_ug_calendar : failed !!!");
+ goto out_func;
+ }
+
+ ad->detail_ug = ug;
+ err_popup_show = false;
+ }
+
+out_func:
+ if (err_popup_show == true) {
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
+
+ if (service != NULL) {
+ service_destroy(service);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_memo_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ 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 (strlen(cur_category_mem->launch_param) <= 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");
+ ug_destroy(ug);
+ ad->detail_ug = NULL;
+ }
+
+ ret = service_create(&service);
+
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to create service handle!");
+ goto out_func;
+ }
+
+ ret = service_add_extra_data(service, "index", cur_category_mem->launch_param);
+
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 1!");
+ goto out_func;
+ }
+
+ cbs.layout_cb = __search_ug_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = __search_ug_closed_cb;
+ cbs.priv = ad;
+
+ ug = ug_create(NULL, "memo-efl", UG_MODE_FULLVIEW, service, &cbs);
+
+ if (!ug) {
+ SEARCH_DEBUG_ERROR("... create_ug_email : failed !!!");
+ goto out_func;
+ }
+
+ ad->detail_ug = ug;
+ err_popup_show = false;
+ }
+
+out_func:
+ if (err_popup_show == true) {
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
+
+ if (service != NULL) {
+ service_destroy(service);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_menu_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ struct search_item_sel *cur_category_mem =
+ (struct search_item_sel *)record_info;
+ char *pkg_name = NULL;
+ bool is_running = false;
+ app_context_h app_h;
+
+ bool err_popup_show = true;
+ int ret;
+ service_h service = NULL;
+
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
+ pkg_name = cur_category_mem->launch_path;
+
+ if (pkg_name != NULL && strlen(pkg_name)) {
+ ret = app_manager_is_running(pkg_name, &is_running);
+
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to get info : app_manager_is_running [%d]", ret);
+ goto out_func;
+ }
+
+ if (is_running == true) {
+ ret = app_manager_get_app_context(pkg_name, &app_h);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to get info : app_manager_get_app_context [%d]", ret);
+ goto out_func;
+ }
+
+ ret = app_manager_resume_app(app_h);
+
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to get info : app_manager_resume_app [%d]", ret);
+ goto out_func;
+ }
+ err_popup_show = false;
+ } else {
+ ret = service_create(&service);
+
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to create service header : [%d]", ret);
+ goto out_func;
+ }
+
+ ret = service_set_operation(service, SERVICE_OPERATION_DEFAULT);
+
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to set operation : [%d]", ret);
+ goto out_func;
+ }
+
+ ret = service_set_package(service, pkg_name);
+
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to set package : [%d]", ret);
+ goto out_func;
+ }
+
+ ret = service_send_launch_request(service, NULL, NULL);
+
+ if (ret != SERVICE_ERROR_NONE) {
+ SEARCH_DEBUG_ERROR("Fail to send launch request : [%d]", ret);
+ goto out_func;
+ }
+ err_popup_show = false;
+ }
+ } else {
+ SEARCH_DEBUG_ERROR("Pkg name is NULL!");
+ }
+
+out_func:
+ 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)
+ SEARCH_DEBUG_ERROR("Fail to destroy service header : [%d]", ret);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_browser_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ struct search_item_sel *cur_category_mem =
+ (struct search_item_sel *)record_info;
+ int ret;
+ service_h service;
+
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(cur_category_mem == NULL);
+
+ SEARCH_DEBUG_LOG("cur_category_mem->launch_path : %s", cur_category_mem->launch_path);
+
+ ret = service_create(&service);
+
+ if (ret == 0 && strlen(cur_category_mem->launch_path) > 0 ) {
+ service_set_operation(service, SERVICE_OPERATION_VIEW);
+ service_set_uri(service, cur_category_mem->launch_path);
+ ret = service_send_launch_request(service, NULL, NULL);
+
+ if (ret != 0) {
+ SEARCH_DEBUG_ERROR("browser app service launching error(%d)", ret);
+ search_launch_popup_error(LAUNCH_ERROR_APPSVC,
+ ad);
+ }
+ service_destroy(service);
+ }
+
+}
+
+static void __search_launch_popup_error_response_cb(void *data,
+ Evas_Object * obj,
+ void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+
+ evas_object_del(ad->ctxpopup);
+ ad->ctxpopup = NULL;
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_popup_error(int error_type, void *data)
+{
+ Evas_Object *popup;
+ Evas_Object *btn1;
+
+ 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);
+ }
+
+ if (ad->ctxpopup) {
+ evas_object_del(ad->ctxpopup);
+ ad->ctxpopup = NULL;
+ }
+
+ elm_genlist_select_mode_set(ad->search_gl, ELM_OBJECT_SELECT_MODE_DEFAULT);
+
+ if (elm_object_scroll_freeze_get(ad->search_gl) > 0) {
+ elm_object_scroll_freeze_pop(ad->search_gl);
+ }
+
+ popup = elm_popup_add(ad->win_main);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ switch(error_type) {
+ case LAUNCH_ERROR_FILE_NOT_FOUND:
+ elm_object_text_set(popup,
+ dgettext("sys_string",
+ "IDS_COM_POP_FILE_NOT_FOUND"));
+ break;
+ case LAUNCH_ERROR_AUL_LAUNCH:
+ /* This Message String enable to be another string in the future */
+ elm_object_text_set(popup,
+ gettext("IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"));
+ break;
+ case LAUNCH_ERROR_APPSVC:
+ elm_object_text_set(popup,
+ gettext("IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"));
+ break;
+ }
+
+ btn1 = elm_button_add(popup);
+ elm_object_style_set(btn1, "popup_button/default");
+
+ elm_object_text_set(btn1,
+ dgettext("sys_string","IDS_COM_POP_CLOSE"));
+ evas_object_smart_callback_add(btn1, "clicked",
+ __search_launch_popup_error_response_cb,
+ ad);
+
+ elm_object_part_content_set(popup, "button1", btn1);
+
+ elm_popup_timeout_set(popup, 3.0);
+
+ evas_object_smart_callback_add(popup, "timeout",
+ __search_launch_popup_error_response_cb,
+ ad);
+ evas_object_smart_callback_add(popup, "block,clicked",
+ __search_launch_popup_error_response_cb,
+ ad);
+ evas_object_show(popup);
+
+ ad->ctxpopup = popup;
+}
+
diff --git a/src/ps_makeupviews.cpp b/src/ps_makeupviews.cpp
new file mode 100755
index 0000000..b3888e9
--- /dev/null
+++ b/src/ps_makeupviews.cpp
@@ -0,0 +1,1244 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+
+
+#include "smartsearch.h"
+#include "ps_searcher.h"
+#include "ps_app_interface.h"
+#include <contacts.h>
+#include <calendar2.h>
+#include <memo-db.h>
+#include <media_content.h>
+#include <msg_types.h>
+#include <msg_storage.h>
+#include <msg.h>
+#include <favorites.h>
+
+struct search_thread_data {
+ struct appdata *ad;
+ char *keyword;
+ int is_search_result;
+};
+
+struct search_genlist_item_info* search_add_genlist_item(int type,
+ struct search_content_object *obj, Elm_Genlist_Item_Class *itc_style, void *data,
+ Elm_Object_Item *parent)
+{
+ struct search_genlist_item_info *item = (struct search_genlist_item_info *)
+ calloc(1,
+ sizeof(struct search_genlist_item_info));
+
+ if (item) {
+ item->type = type;
+ item->obj = obj;
+ item->itc_style = itc_style;
+ item->data = data;
+ item->parent = parent;
+ }
+
+ return item;
+}
+
+static void
+ecore_exe_pipe_cb(void *data, void *buf, unsigned int size)
+{
+ SEARCH_FUNC_START;
+
+
+ struct appdata *ad = (struct appdata *)data;
+ struct search_pipe_data *pipe_data = *((struct search_pipe_data**)buf);
+
+ struct search_content_object *obj = NULL;
+ struct search_genlist_item_info *item = NULL;
+ struct search_genlist_info *result_info = NULL;
+
+ int cmd = 0;
+
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(pipe_data == NULL);
+
+ result_info = pipe_data->result_list;
+ cmd = pipe_data->cmd;
+
+ SEARCH_DEBUG_LOG("Pipe Command : %d ret : %d", cmd, pipe_data->search_ret);
+
+ switch (cmd) {
+ case SEARCH_PIPE_CMD_CLEAR_GENLIST:
+ elm_genlist_clear(ad->search_gl);
+ break;
+ case SEARCH_PIPE_CMD_SET_LAYOUT:
+ if (pipe_data->search_ret == SEARCH_RET_SEARCH_SUCCESS)
+ search_layout_set_search_list(ad);
+ else
+ search_layout_set_search_no_result(ad);
+ break;
+ case SEARCH_PIPE_CMD_ADD_GENLIST_PHONE:
+ if (result_info) {
+ if (result_info->group) {
+ item = result_info->group;
+ obj = item->obj;
+
+ obj->gl_result_grp = elm_genlist_item_append(ad->search_gl,
+ item->itc_style,
+ item->data,
+ NULL,
+ ELM_GENLIST_ITEM_GROUP,
+ NULL,
+ NULL);
+ elm_genlist_item_select_mode_set(obj->gl_result_grp,
+ ELM_OBJECT_SELECT_MODE_NONE);
+ SEARCH_FREE(item);
+ }
+
+ if (result_info->itemlist) {
+ GList *node = g_list_first(result_info->itemlist);
+
+ while (node != NULL) {
+ item = (struct search_genlist_item_info *)node->data;
+ if (item) {
+ obj = item->obj;
+ elm_genlist_item_append(ad->search_gl,
+ item->itc_style,
+ item->data,
+ obj->gl_result_grp,
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_phone_result_sel,
+ ad);
+ SEARCH_FREE(item);
+ }
+ node = g_list_next(node);
+ }
+ g_list_free(result_info->itemlist);
+ result_info->itemlist = NULL;
+ }
+
+ if (result_info->more) {
+ item = result_info->more;
+ obj = item->obj;
+ elm_genlist_item_append(ad->search_gl,
+ item->itc_style,
+ item->data,
+ obj->gl_result_grp,
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_result_more_item_append_cb,
+ ad);
+ SEARCH_FREE(item);
+ }
+
+ SEARCH_FREE(result_info);
+ }
+ break;
+ }
+
+ SEARCH_FREE(pipe_data);
+ SEARCH_FUNC_END;
+}
+
+static Evas_Object *__search_gl_content_get_genlist_item_type(void *data, Evas_Object *obj, const char *part)
+ {
+ Evas_Object *icon = NULL;
+ int icon_size = 0;
+ char *icon1_path = NULL;
+ char *icon2_path = NULL;
+
+ struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+ double scale = elm_config_scale_get();
+
+ SEARCH_RETV_IF(sel_mem_info == NULL, NULL);
+
+ if (!SEARCH_STRCMP(part, "elm.icon") || !SEARCH_STRCMP(part, "elm.icon.1")) {
+ icon1_path = sel_mem_info->icon1;
+ if (icon1_path && strlen(icon1_path) > 0 ) {
+ icon = elm_icon_add(obj);
+ icon_size = (int)(SEARCH_THUMBNAIL_SIZE * scale);
+ elm_image_prescale_set(icon, icon_size);
+ elm_image_file_set(icon, icon1_path, NULL);
+ evas_object_size_hint_min_set(icon,
+ SEARCH_THUMBNAIL_SIZE * scale, SEARCH_THUMBNAIL_SIZE * scale);
+ evas_object_size_hint_max_set(icon,
+ SEARCH_THUMBNAIL_SIZE * scale, SEARCH_THUMBNAIL_SIZE * scale);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ }
+ } else if(!strcmp(part, "elm.icon.2")) {
+ icon2_path = sel_mem_info->icon2;
+
+ if (icon2_path && strlen(icon2_path) > 0 ) {
+ icon = elm_icon_add(obj);
+ icon_size = (int)(SEARCH_ICON_SIZE * scale);
+ elm_image_prescale_set(icon, icon_size);
+ elm_image_file_set(icon, icon2_path, NULL);
+ evas_object_size_hint_min_set(icon,
+ SEARCH_ICON_SIZE * scale, SEARCH_ICON_SIZE * scale);
+ evas_object_size_hint_max_set(icon,
+ SEARCH_ICON_SIZE * scale, SEARCH_ICON_SIZE * scale);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ }
+ }
+
+ return icon;
+}
+
+static Evas_Object *__search_gl_content_get_genlist_bookmark_item_type(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *icon = NULL;
+ int icon_size = 0;
+ int id = 0;
+ char *icon2_path = NULL;
+
+ struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+ SEARCH_RETV_IF(sel_mem_info == NULL, NULL);
+
+ double scale = elm_config_scale_get();
+
+ if (!SEARCH_STRCMP(part, "elm.icon") || !SEARCH_STRCMP(part, "elm.icon.1")) {
+ if (sel_mem_info->launch_param) {
+ id = atoi(sel_mem_info->launch_param);
+ favorites_bookmark_get_favicon(id, evas_object_evas_get(obj), &icon);
+ }
+
+ if (!icon && sel_mem_info->icon1) {
+ icon = elm_icon_add(obj);
+ icon_size = (int)(SEARCH_ICON_SIZE * scale);
+ elm_image_prescale_set(icon, icon_size);
+ elm_image_file_set(icon, sel_mem_info->icon1, NULL);
+ }
+
+ if (icon) {
+ evas_object_size_hint_min_set(icon,
+ SEARCH_THUMBNAIL_SIZE * scale, SEARCH_THUMBNAIL_SIZE * scale);
+ evas_object_size_hint_max_set(icon,
+ SEARCH_THUMBNAIL_SIZE * scale, SEARCH_THUMBNAIL_SIZE * scale);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ }
+ } else if(!strcmp(part, "elm.icon.2")) {
+ icon2_path = sel_mem_info->icon2;
+
+ if (icon2_path && strlen(icon2_path) > 0 ) {
+ icon = elm_icon_add(obj);
+ icon_size = (int)(SEARCH_ICON_SIZE * scale);
+ elm_image_prescale_set(icon, icon_size);
+ elm_image_file_set(icon, icon2_path, NULL);
+ evas_object_size_hint_min_set(icon,
+ SEARCH_ICON_SIZE * scale, SEARCH_ICON_SIZE * scale);
+ evas_object_size_hint_max_set(icon,
+ SEARCH_ICON_SIZE * scale, SEARCH_ICON_SIZE * scale);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ }
+ }
+ return icon;
+ }
+
+static Evas_Object *__search_gl_content_get_genlist_history_item_type(void *data, Evas_Object *obj, const char *part)
+{
+ Evas_Object *icon = NULL;
+ int icon_size = 0;
+ char *icon2_path = NULL;
+ int id = 0;
+
+ struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+ SEARCH_RETV_IF(sel_mem_info == NULL, NULL);
+
+ double scale = elm_config_scale_get();
+
+ if (!SEARCH_STRCMP(part, "elm.icon") || !SEARCH_STRCMP(part, "elm.icon.1")) {
+ if (sel_mem_info->launch_param) {
+ id = atoi(sel_mem_info->launch_param);
+ favorites_history_get_favicon(id, evas_object_evas_get(obj), &icon);
+ }
+
+ if (!icon && sel_mem_info->icon1) {
+ icon = elm_icon_add(obj);
+ icon_size = (int)(SEARCH_ICON_SIZE * scale);
+ elm_image_prescale_set(icon, icon_size);
+ elm_image_file_set(icon, sel_mem_info->icon1, NULL);
+ }
+
+ if (icon) {
+ evas_object_size_hint_min_set(icon,
+ SEARCH_THUMBNAIL_SIZE * scale, SEARCH_THUMBNAIL_SIZE * scale);
+ evas_object_size_hint_max_set(icon,
+ SEARCH_THUMBNAIL_SIZE * scale, SEARCH_THUMBNAIL_SIZE * scale);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ }
+ } else if(!strcmp(part, "elm.icon.2")) {
+ icon2_path = (char*)sel_mem_info->icon2;
+
+ if (icon2_path && strlen(icon2_path) > 0 ) {
+ icon = elm_icon_add(obj);
+ icon_size = (int)(SEARCH_ICON_SIZE * scale);
+ elm_image_prescale_set(icon, icon_size);
+ elm_image_file_set(icon, icon2_path, NULL);
+ evas_object_size_hint_min_set(icon,
+ SEARCH_ICON_SIZE * scale, SEARCH_ICON_SIZE * scale);
+ evas_object_size_hint_max_set(icon,
+ SEARCH_ICON_SIZE * scale, SEARCH_ICON_SIZE * scale);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ }
+ }
+
+ return icon;
+}
+
+static Eina_Bool __search_gl_state_get(void *data, Evas_Object * obj,
+ const char *part)
+{
+ return EINA_FALSE;
+}
+
+static char *__search_gl_label_get_genlist_item_type(void *data, Evas_Object * obj,
+ const char *part)
+{
+ 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->text1);
+ } else if (!SEARCH_STRCMP(part, "elm.text.sub") || !SEARCH_STRCMP(part, "elm.text.2")) {
+ buf = g_strdup(sel_mem_info->text2);
+ } else {
+ buf = NULL;
+ }
+
+ return buf;
+}
+
+static char *__search_gl_label_get_normal_type(void *data, Evas_Object * obj,
+ const char *part)
+{
+ char *title_string = (char*)data;
+ if(title_string)
+ return strdup(title_string);
+ else
+ return strdup("");
+}
+
+static char *__search_gl_label_get_group(void *data, Evas_Object * obj,
+ const char *part)
+{
+ struct search_content_object *object = (struct search_content_object*)data;
+ SEARCH_RETV_IF(object == NULL, strdup(""));
+
+ if (object->string_type == SEARCH_STR_TYPE_APP_STRING) {
+ return strdup(gettext(object->name));
+ } else {
+ return strdup(dgettext("sys_string", object->name));
+ }
+}
+
+static char *__search_gl_label_get_more(void *data, Evas_Object * obj,
+ const char *part)
+{
+ return strdup(gettext("IDS_SSEARCH_BODY_MORE_RESULTS"));
+}
+
+static void __search_gl_del_grouptitle(void *data, Evas_Object * obj)
+{
+ SEARCH_FUNC_START;
+
+ SEARCH_FUNC_END;
+ return;
+}
+
+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->icon1);
+ SEARCH_FREE(sel_mem_info->icon2);
+ SEARCH_FREE(sel_mem_info->text1);
+ SEARCH_FREE(sel_mem_info->text2);
+ SEARCH_FREE(sel_mem_info->launch_path);
+ SEARCH_FREE(sel_mem_info->launch_param);
+ SEARCH_FREE(sel_mem_info);
+
+ return;
+}
+
+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);
+
+ return;
+}
+
+int search_app_connect(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ int rc = 0, conn_ret = 0;
+ 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) {
+ /* 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 */
+ case SEARCH_CONT_PHONE_MSG:
+ {
+ msg_error_t err = MSG_SUCCESS;
+
+ if (ad->result_obj[i].visible == EINA_TRUE) {
+
+ /* Connect Contact-service if contact category status is invisible */
+ if (ad->result_obj[SEARCH_CONT_PHONE_CONTACTS].visible == EINA_FALSE) {
+ rc = contacts_connect2();
+ if (rc != CONTACTS_ERROR_NONE) {
+ /* If we fail to connect contact-service, display message-app icon */
+ SEARCH_DEBUG_WARNING("Fail to connect contact service : %d",rc);
+ }
+ }
+
+ /* Connect Message-Service */
+ err = msg_open_msg_handle(&ad->msg_handle);
+
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("msg_open_msg_handle error : %d", err);
+ ad->msg_handle = NULL;
+ }
+ } else {
+ /* Disconnect Contact-service if contact category status is invisible */
+ if (ad->result_obj[SEARCH_CONT_PHONE_CONTACTS].visible == EINA_FALSE) {
+ rc = contacts_disconnect2();
+ if (rc != CONTACTS_ERROR_NONE)
+ SEARCH_DEBUG_WARNING("Fail to disconnect contact service : %d",rc);
+ }
+
+ /* Disconnect Message-Service */
+ if (ad->msg_handle != NULL ) {
+ err = msg_close_msg_handle(&ad->msg_handle);
+
+ if (err != MSG_SUCCESS)
+ SEARCH_DEBUG_WARNING("msg_close_msg_handle error : %d", err);
+ ad->msg_handle = NULL;
+ }
+ }
+ }
+ break;
+ case SEARCH_CONT_PHONE_EMAIL:
+ break;
+ /* IMAGE, MUSIC, VIDEO use common handle */
+ case SEARCH_CONT_PHONE_IMAGES:
+ case SEARCH_CONT_PHONE_MUSIC:
+ case SEARCH_CONT_PHONE_VIDEO:
+ {
+ if (ad->result_obj[SEARCH_CONT_PHONE_IMAGES].visible == EINA_TRUE
+ || ad->result_obj[SEARCH_CONT_PHONE_MUSIC].visible == EINA_TRUE
+ || ad->result_obj[SEARCH_CONT_PHONE_VIDEO].visible == EINA_TRUE ) {
+ conn_ret = media_content_connect();
+
+ if (conn_ret != 0)
+ SEARCH_DEBUG_WARNING("media_content_connect failed : %d\n", conn_ret);
+ } else {
+ conn_ret = media_content_disconnect();
+
+ if(conn_ret < 0)
+ SEARCH_DEBUG_WARNING("media_content_disconnect failed : %d\n", conn_ret);
+ }
+ }
+ break;
+ case SEARCH_CONT_PHONE_MEMO:
+ {
+ if (ad->result_obj[i].visible == EINA_TRUE) {
+ rc = memo_init(NULL);
+ if (rc == -1) {
+ SEARCH_DEBUG_WARNING
+ ("memo svc connect fail : %d", rc);
+ }
+ } else
+ memo_fini();
+ }
+ break;
+ }
+ }
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+int search_app_disconnect(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ 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_MSG:
+ {
+ if (ad->msg_handle != NULL ) {
+ msg_error_t err = MSG_SUCCESS;
+ err = msg_close_msg_handle(&ad->msg_handle);
+
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("msg_close_msg_handle error : %d", err);
+ }
+
+ ad->msg_handle = NULL;
+ }
+ }
+ break;
+ case SEARCH_CONT_PHONE_EMAIL:
+ break;
+ case SEARCH_CONT_PHONE_IMAGES:
+ case SEARCH_CONT_PHONE_MUSIC:
+ case SEARCH_CONT_PHONE_VIDEO:
+ {
+ conn_ret = media_content_disconnect();
+ if(conn_ret != 0)
+ SEARCH_DEBUG_WARNING("media_content_disconnect failed : %d\n", conn_ret);
+ }
+ break;
+ case SEARCH_CONT_PHONE_MEMO:
+ {
+ memo_fini();
+ }
+ break;
+ }
+ }
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+void search_gl_phone_result_sel(void *data, Evas_Object * obj, void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ struct search_item_sel *cur_category_mem;
+ Elm_Object_Item *it = (Elm_Object_Item *) event_info;
+
+ 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);
+
+ elm_genlist_select_mode_set(obj, ELM_OBJECT_SELECT_MODE_NONE);
+ elm_object_scroll_freeze_push(obj);
+
+ switch (cur_category_mem->type) {
+ case SEARCH_CONT_PHONE_CONTACTS:
+ search_launch_contact_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_CONT_PHONE_MSG:
+ search_launch_msg_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_CONT_PHONE_EMAIL:
+ search_launch_email_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_CONT_PHONE_IMAGES:
+ search_launch_image_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_CONT_PHONE_VIDEO:
+ search_launch_video_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_CONT_PHONE_MUSIC:
+ search_launch_music_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_CONT_PHONE_CALENDAR:
+ search_launch_calendar_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_CONT_PHONE_MEMO:
+ search_launch_memo_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_CONT_PHONE_MENU:
+ search_launch_menu_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_CONT_PHONE_BROWSER:
+ search_launch_browser_view(ad, cur_category_mem);
+
+ default:
+ break;
+ }
+
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+
+ SEARCH_FUNC_END;
+}
+
+static int __search_gl_set_phone_search_result(struct search_content_object *obj,
+ int offset,
+ char *keyword,
+ void *data,
+ struct search_genlist_info *result_info)
+{
+ SEARCH_FUNC_START;
+
+ int sel_cnt = SEARCH_CATEGORY_LIST_MORE_CNT;
+ 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;
+
+ if (obj->mr_info.offset == 0) {
+ obj->mr_info.next_point = 0;
+ }
+
+ SEARCH_DEBUG_LOG("offset : %d, limit : %d keyword : %s", offset, sel_cnt, keyword);
+
+ if (obj->visible == EINA_TRUE ) {
+ switch (obj->contents_type) {
+ case SEARCH_CONT_PHONE_CONTACTS:
+ {
+ func_ret =
+ search_sql_contact_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ break;
+
+ case SEARCH_CONT_PHONE_MSG:
+ {
+ if (ad->msg_handle != NULL) {
+ func_ret =
+ search_sql_msg_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ }
+ break;
+
+ case SEARCH_CONT_PHONE_EMAIL:
+ {
+ func_ret =
+ search_sql_email_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ break;
+ case SEARCH_CONT_PHONE_IMAGES:
+ {
+ func_ret =
+ search_sql_image_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ break;
+ case SEARCH_CONT_PHONE_MUSIC:
+ {
+ func_ret =
+ search_sql_music_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ break;
+ case SEARCH_CONT_PHONE_VIDEO:
+ {
+ func_ret =
+ search_sql_video_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ break;
+ case SEARCH_CONT_PHONE_CALENDAR:
+ {
+ func_ret =
+ search_sql_calendar_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ break;
+ case SEARCH_CONT_PHONE_MEMO:
+ {
+ func_ret =
+ search_sql_memo_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ break;
+ case SEARCH_CONT_PHONE_MENU:
+ {
+ func_ret =
+ search_sql_menu_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ break;
+ case SEARCH_CONT_PHONE_BROWSER:
+ {
+ func_ret =
+ search_sql_browser_search_result_by_api(obj,
+ offset,
+ sel_cnt,
+ keyword,
+ ad,
+ result_info);
+ }
+ }
+ }
+
+ SEARCH_FUNC_END;
+ return func_ret;
+}
+
+static void __search_thread_heavy_cb(void *data, Ecore_Thread *th)
+{
+ SEARCH_FUNC_START;
+
+ struct search_thread_data *thread_data = (struct search_thread_data*)data;
+ struct appdata *ad = NULL;
+ struct search_content_object *obj = NULL;
+ struct search_genlist_info *result_info = NULL;
+
+ int ret = 0;
+
+ 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->is_search_result = SEARCH_RET_SEARCH_NONE;
+
+ while (i <= SEARCH_CONT_PHONE_MAX) {
+ int offset = 0;
+ obj = &ad->result_obj[i];
+ category_type = obj->category_type;
+
+ if (category_type == SEARCH_OBJ_PHONE_CONTENTS) {
+ if (ecore_thread_check(th) != EINA_TRUE) {
+ result_info = (struct search_genlist_info *)calloc(1, sizeof(struct search_genlist_info));
+ ret = __search_gl_set_phone_search_result(obj,
+ offset,
+ thread_data->keyword,
+ ad,
+ result_info);
+
+ if (ret == SEARCH_RET_SEARCH_SUCCESS) {
+ 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_FREE(result_info);
+ }
+ }
+ }
+ i++;
+ }
+ SEARCH_FUNC_END;
+}
+
+
+static void __search_thread_feedback_cb(void *data, Ecore_Thread *th, void *msg_data)
+{
+ SEARCH_FUNC_START;
+
+ struct search_thread_data *thread_data = (struct search_thread_data *)data;
+ 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;
+
+ ecore_pipe_write(ad->pipe, &pdata, sizeof(struct search_pipe_data));
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_thread_end_cb(void *data, Ecore_Thread *th)
+{
+ SEARCH_FUNC_START;
+
+ struct search_thread_data *thread_data = (struct search_thread_data *)data;
+ 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;
+
+ if (ecore_thread_check(th) == EINA_TRUE)
+ return;
+
+ ecore_pipe_write(ad->pipe, &pdata, sizeof(struct search_pipe_data));
+
+ SEARCH_FREE(thread_data->keyword);
+ SEARCH_FREE(thread_data);
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_thread_cancel_cb(void *data, Ecore_Thread *th)
+{
+ 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_END;
+}
+
+void search_stop_search(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ SEARCH_RET_IF(ad == NULL);
+
+ if (ad->search_thread) {
+ ecore_thread_cancel(ad->search_thread);
+ ad->search_thread = NULL;
+ }
+
+ if (ad->search_timer) {
+ ecore_timer_del(ad->search_timer);
+ ad->search_timer = NULL;
+ }
+
+ SEARCH_FUNC_END;
+}
+
+Ecore_Thread* search_make_result_thread(void *data)
+{
+ SEARCH_FUNC_START;
+
+ Ecore_Thread *th = NULL;
+ struct appdata *ad = (struct appdata *)data;
+ struct search_thread_data *thread_data = NULL;
+
+ SEARCH_RETV_IF(ad == NULL, NULL);
+
+ /* Create Thread for Phone Search */
+ thread_data = (struct search_thread_data *)calloc(1, sizeof(struct search_thread_data));
+ thread_data->ad = ad;
+ thread_data->is_search_result = SEARCH_RET_SEARCH_NONE;
+ thread_data->keyword = strdup(ad->search_word);
+
+ th = ecore_thread_feedback_run(__search_thread_heavy_cb,
+ __search_thread_feedback_cb,
+ __search_thread_end_cb,
+ __search_thread_cancel_cb,
+ thread_data,
+ EINA_TRUE);
+
+ SEARCH_FUNC_END;
+ return th;
+}
+
+
+void search_result_gl_init(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ ad->pipe = ecore_pipe_add(ecore_exe_pipe_cb, ad);
+ eina_lock_new(&ad->mutex);
+ eina_condition_new(&ad->condition, &ad->mutex);
+
+ Evas_Object *genlist;
+
+ if (ad->itc_pslist_1line == NULL) {
+ ad->itc_pslist_1line = elm_genlist_item_class_new();
+ ad->itc_pslist_1line->item_style = "1text.tb";
+ ad->itc_pslist_1line->func.text_get = __search_gl_label_get_genlist_item_type;
+ ad->itc_pslist_1line->func.content_get = __search_gl_content_get_genlist_item_type;
+ ad->itc_pslist_1line->func.state_get = __search_gl_state_get;
+ ad->itc_pslist_1line->func.del = __search_gl_del;
+ }
+
+ if (ad->itc_pslist_1line_1icon == NULL) {
+ ad->itc_pslist_1line_1icon = elm_genlist_item_class_new();
+ ad->itc_pslist_1line_1icon->item_style = "1text.1icon.2.tb";
+ ad->itc_pslist_1line_1icon->func.text_get = __search_gl_label_get_genlist_item_type;
+ ad->itc_pslist_1line_1icon->func.content_get = __search_gl_content_get_genlist_item_type;
+ ad->itc_pslist_1line_1icon->func.state_get = __search_gl_state_get;
+ ad->itc_pslist_1line_1icon->func.del = __search_gl_del;
+ }
+
+ if (ad->itc_pslist_1line_1icon_browser_history== NULL) {
+ ad->itc_pslist_1line_1icon_browser_history = elm_genlist_item_class_new();
+ ad->itc_pslist_1line_1icon_browser_history->item_style = "1text.1icon.2.tb";
+ ad->itc_pslist_1line_1icon_browser_history->func.text_get = __search_gl_label_get_genlist_item_type;
+ ad->itc_pslist_1line_1icon_browser_history->func.content_get = __search_gl_content_get_genlist_history_item_type;
+ ad->itc_pslist_1line_1icon_browser_history->func.state_get = __search_gl_state_get;
+ ad->itc_pslist_1line_1icon_browser_history->func.del = __search_gl_del;
+ }
+
+ if (ad->itc_pslist_1line_2icon == NULL) {
+ ad->itc_pslist_1line_2icon = elm_genlist_item_class_new();
+ ad->itc_pslist_1line_2icon->item_style = "1text.2icon.6.tb";
+ ad->itc_pslist_1line_2icon->func.text_get = __search_gl_label_get_genlist_item_type;
+ ad->itc_pslist_1line_2icon->func.content_get = __search_gl_content_get_genlist_item_type;
+ ad->itc_pslist_1line_2icon->func.state_get = __search_gl_state_get;
+ ad->itc_pslist_1line_2icon->func.del = __search_gl_del;
+ }
+
+ if (ad->itc_pslist_2line_1icon == NULL) {
+ ad->itc_pslist_2line_1icon = elm_genlist_item_class_new();
+ ad->itc_pslist_2line_1icon->item_style = "2text.1icon.4.tb";
+ ad->itc_pslist_2line_1icon->func.text_get = __search_gl_label_get_genlist_item_type;
+ ad->itc_pslist_2line_1icon->func.content_get = __search_gl_content_get_genlist_item_type;
+ ad->itc_pslist_2line_1icon->func.state_get = __search_gl_state_get;
+ ad->itc_pslist_2line_1icon->func.del = __search_gl_del;
+ }
+
+ if (ad->itc_pslist_2line_2icon == NULL) {
+ ad->itc_pslist_2line_2icon = elm_genlist_item_class_new();
+ ad->itc_pslist_2line_2icon->item_style = "2text.2icon.4.tb";
+ ad->itc_pslist_2line_2icon->func.text_get = __search_gl_label_get_genlist_item_type;
+ ad->itc_pslist_2line_2icon->func.content_get = __search_gl_content_get_genlist_item_type;
+ ad->itc_pslist_2line_2icon->func.state_get = __search_gl_state_get;
+ ad->itc_pslist_2line_2icon->func.del = __search_gl_del;
+ }
+
+ if (ad->itc_pslist_2line_2icon_browser_bookmark == NULL) {
+ ad->itc_pslist_2line_2icon_browser_bookmark = elm_genlist_item_class_new();
+ ad->itc_pslist_2line_2icon_browser_bookmark->item_style = "2text.2icon.4.tb";
+ ad->itc_pslist_2line_2icon_browser_bookmark->func.text_get = __search_gl_label_get_genlist_item_type;
+ ad->itc_pslist_2line_2icon_browser_bookmark->func.state_get = __search_gl_state_get;
+ ad->itc_pslist_2line_2icon_browser_bookmark->func.content_get = __search_gl_content_get_genlist_bookmark_item_type;
+ ad->itc_pslist_2line_2icon_browser_bookmark->func.del = __search_gl_del;
+ }
+
+
+ if (ad->itc_grouptitle == NULL) {
+ ad->itc_grouptitle = elm_genlist_item_class_new();
+ ad->itc_grouptitle->item_style = "groupindex";
+ ad->itc_grouptitle->func.text_get = __search_gl_label_get_group;
+ ad->itc_grouptitle->func.state_get = __search_gl_state_get;
+ ad->itc_grouptitle->func.del = __search_gl_del_grouptitle;
+ }
+
+ if (ad->itc_listmore == NULL) {
+ ad->itc_listmore = elm_genlist_item_class_new();
+ 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->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.
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ elm_genlist_tree_effect_enabled_set(genlist, EINA_TRUE);
+
+ ad->search_gl = genlist;
+
+ 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);
+ SEARCH_FUNC_END;
+}
+
+void search_result_gl_deinit(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+
+ ecore_pipe_del(ad->pipe);
+ eina_condition_free(&ad->condition);
+ eina_lock_free(&ad->mutex);
+
+ if (ad->itc_pslist_1line != NULL)
+ elm_genlist_item_class_free(ad->itc_pslist_1line);
+
+ if (ad->itc_pslist_1line_1icon != NULL)
+ elm_genlist_item_class_free(ad->itc_pslist_1line_1icon);
+
+ if (ad->itc_pslist_1line_1icon_browser_history != NULL)
+ elm_genlist_item_class_free(ad->itc_pslist_1line_1icon_browser_history);
+
+ if (ad->itc_pslist_1line_2icon != NULL)
+ 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);
+
+ if (ad->itc_pslist_2line_2icon != NULL)
+ elm_genlist_item_class_free(ad->itc_pslist_2line_2icon);
+
+ if (ad->itc_pslist_2line_2icon_browser_bookmark != NULL)
+ elm_genlist_item_class_free(ad->itc_pslist_2line_2icon_browser_bookmark);
+
+ if (ad->itc_grouptitle != NULL)
+ elm_genlist_item_class_free(ad->itc_grouptitle);
+
+ if (ad->itc_listmore != NULL)
+ elm_genlist_item_class_free(ad->itc_listmore);
+
+ SEARCH_FUNC_END;
+}
+
+
+void search_gl_result_more_item_append_cb(void *data, Evas_Object * obj,
+ void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ Elm_Object_Item *it = (Elm_Object_Item *) event_info;
+ struct search_pipe_data *pdata = NULL;
+ struct search_genlist_info *result_info = NULL;
+ struct search_item_more_sel *sel_more =
+ (search_item_more_sel *)elm_object_item_data_get(it);
+
+ struct search_content_object *content_obj = sel_more->obj;
+ int offset = content_obj->mr_info.next_point;
+ int ret = SEARCH_RET_SEARCH_NONE;
+
+ elm_object_item_del(it);
+
+ result_info = (struct search_genlist_info *)calloc(1, sizeof(struct search_genlist_info));
+ ret = __search_gl_set_phone_search_result(content_obj,
+ offset,
+ ad->search_word,
+ ad,
+ result_info);
+
+ 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_info;
+ pdata->search_ret = ret;
+ ecore_pipe_write(ad->pipe, &pdata, sizeof(struct search_pipe_data));
+
+ pdata = (struct search_pipe_data *)calloc(1,sizeof(struct search_pipe_data));
+ pdata->cmd = SEARCH_PIPE_CMD_SET_LAYOUT;
+ pdata->search_ret = ret;
+ ecore_pipe_write(ad->pipe, &pdata, sizeof(struct search_pipe_data));
+
+ SEARCH_FUNC_END;
+}
+
+void search_set_result_list(void *data)
+{
+ SEARCH_FUNC_START;
+ struct appdata *ad = (struct appdata *)data;
+
+ 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->not_markup_search_word);
+ 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, ad->not_markup_search_word);
+
+ if (ret < 0)
+ SEARCH_DEBUG_WARNING("Error : set keyword to vconf");
+ } else {
+ if (category == SEARCH_CATE_PHONE) {
+ pipe_data = (struct search_pipe_data *)calloc(1, sizeof(struct search_pipe_data));
+ pipe_data->cmd = SEARCH_PIPE_CMD_SET_LAYOUT;
+ pipe_data->search_ret = SEARCH_RET_SEARCH_NONE;
+ ecore_pipe_write(ad->pipe, &pipe_data, sizeof(struct search_pipe_data));
+ }
+ /* 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");
+ }
+
+ SEARCH_FREE(text);
+ }
+
+ /* If category is Phone, make a thread for search */
+ pipe_data = (struct search_pipe_data *)calloc(1, sizeof(struct search_pipe_data));
+ pipe_data->cmd = SEARCH_PIPE_CMD_CLEAR_GENLIST;
+ ecore_pipe_write(ad->pipe, &pipe_data, sizeof(struct search_pipe_data));
+
+ switch(category) {
+ case SEARCH_CATE_PHONE:
+ if (is_input_keyword) {
+ ad->search_thread = search_make_result_thread(ad);
+ }
+ break;
+ }
+ SEARCH_FUNC_END;
+}
+
+void search_layout_set_search_list(void* data)
+{
+ 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");
+ evas_object_hide(ad->noresult_view);
+
+ if (ad->search_gl) {
+ elm_object_part_content_set(ad->sb_layout, "list", ad->search_gl);
+ evas_object_show(ad->search_gl);
+ }
+ }
+
+ 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;
+}
+
+void search_layout_set_search_no_result(void* data)
+{
+ 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);
+ }
+
+ elm_object_part_content_set(ad->sb_layout,"list_noresult", ad->noresult_view);
+ evas_object_show(ad->noresult_view);
+ }
+
+ SEARCH_FUNC_END;
+
+ return;
+}
+
+int search_layout_get_content_list_set_status(void* data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ 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;
+ } else {
+ ret = SEARCH_RET_FAIL;
+ }
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+
diff --git a/src/ps_searcher.cpp b/src/ps_searcher.cpp
new file mode 100755
index 0000000..ed43f30
--- /dev/null
+++ b/src/ps_searcher.cpp
@@ -0,0 +1,2255 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+
+
+
+
+
+
+#include "smartsearch.h"
+
+#include <sqlite3.h>
+
+#include <contacts.h>
+#include <calendar2.h>
+#include <memo-db.h>
+
+#include <email-api-mail.h>
+
+#include <favorites.h>
+#include <media_content.h>
+
+#include <msg_storage.h>
+#include <msg_storage_types.h>
+#include <msg.h>
+
+#include <ail.h>
+#include <unicode/ucal.h>
+#include <unicode/ustring.h>
+#include <unicode/ustdio.h>
+#include <unicode/udat.h>
+
+char* g_keyword = NULL;
+
+struct search_cb_data {
+ struct search_content_object *obj;
+ struct appdata *ad;
+ char *keyword;
+ struct search_genlist_info *result_info;
+};
+
+struct search_cb_data_browser {
+ struct search_content_object *obj;
+ struct appdata *ad;
+ char *keyword;
+ struct search_genlist_info *result_info;
+ struct search_more_result *info;
+ bool search_ret;
+};
+
+struct media_cb_data {
+ bool is_sdcard;
+ char *dirname;
+};
+
+int search_sql_stmt_init(sqlite3_stmt * sql_stmt)
+{
+ SEARCH_FUNC_START;
+
+ int rc = 0;
+
+ rc = sqlite3_clear_bindings(sql_stmt);
+ if (rc != SQLITE_OK) {
+ SEARCH_DEBUG_ERROR("sqlite3_clear_bindings error");
+ return SEARCH_RET_FAIL;
+ }
+
+ rc = sqlite3_reset(sql_stmt);
+ if (rc != SQLITE_OK) {
+ SEARCH_DEBUG_ERROR("sqlite3_reset error");
+ return SEARCH_RET_FAIL;
+ }
+
+ SEARCH_FUNC_END;
+
+ return SEARCH_RET_SUCCESS;
+}
+
+int search_sql_stmt_finalize(sqlite3_stmt * stmt)
+{
+ SEARCH_FUNC_START;
+
+ int ret;
+
+ ret = sqlite3_finalize(stmt);
+ if (ret != SQLITE_OK) {
+ SEARCH_DEBUG_ERROR("sqlite3_finalize error : %d ", ret);
+ return -1;
+ }
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+int search_sql_prepare_stmt(sqlite3 *db_handle, const char *query,
+ sqlite3_stmt ** stmt_out)
+{
+ SEARCH_FUNC_START;
+
+ int rc = 0;
+ int ret = 0;
+
+ rc = sqlite3_prepare(db_handle, query, strlen(query), stmt_out, NULL);
+ if (rc != SQLITE_OK) {
+ SEARCH_DEBUG_ERROR("sql preapre error : %d / %s", rc, query);
+ ret = SEARCH_RET_FAIL;
+ } else {
+ ret = SEARCH_RET_SUCCESS;
+ }
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+int search_sql_bind_text(sqlite3* db_handle, sqlite3_stmt *sql_stmt, int col, char *data)
+{
+ int rc = 0;
+ int ret = SEARCH_RET_SEARCH_NONE;
+
+ rc = sqlite3_bind_text(sql_stmt, col, data, strlen(data), SQLITE_STATIC);
+ if (rc != SQLITE_OK) {
+ SEARCH_DEBUG_ERROR("SQL BIND TEXT ERROR : %s(%d) / %s\n",
+ sqlite3_errmsg(db_handle),
+ rc,
+ data);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ }
+
+ return ret;
+}
+
+int search_sql_bind_int(sqlite3* db_handle, sqlite3_stmt *sql_stmt, int col, int data)
+{
+ int rc = 0;
+ int ret = SEARCH_RET_SEARCH_NONE;
+
+ rc = sqlite3_bind_int(sql_stmt, col, data);
+ if (rc != SQLITE_OK) {
+ SEARCH_DEBUG_ERROR("SQL BIND INT ERROR : %s(%d) / %d\n",
+ sqlite3_errmsg(db_handle),
+ rc,
+ data);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ }
+ return ret;
+}
+
+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;
+ int ret = 0;
+
+ contacts_query_h query = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_list_h list = NULL;
+
+ unsigned int count = 0;
+ int total_cnt = -1;
+ int curr_cnt = -1;
+ int loop_cnt = 0;
+ int search_ret = SEARCH_RET_SEARCH_NONE;
+
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
+
+ ret = contacts_connect2();
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_connect2 : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_query_create(_contacts_person_number._uri, &query);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_query_create : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_filter_create(_contacts_person_number._uri, &filter);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_filter_create : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_filter_add_str(filter, _contacts_person_number.display_name, CONTACTS_MATCH_CONTAINS, keyword);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_filter_add_str : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_filter_add_operator : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_filter_add_str(filter, _contacts_person_number.number, CONTACTS_MATCH_CONTAINS, keyword);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_filter_add_str : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_query_set_filter(query, filter);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_query_set_filter : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_query_set_sort(query, _contacts_person_number.display_name, true);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_query_set_sort : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_db_get_count_with_query(query, &total_cnt);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_db_get_count_with_query : %d", ret);
+ goto out_func;
+ }
+
+ ret = contacts_db_get_records_with_query(query, offset, limit, &list);
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("contacts_db_get_records_with_query : %d", ret);
+ goto out_func;
+ }
+
+ SEARCH_RETV_IF_WITH_ERRORV(ret != CONTACTS_ERROR_NONE, SEARCH_RET_SEARCH_FAIL, ret);
+ contacts_list_get_count(list, &count);
+
+ SEARCH_DEBUG_LOG("CONTACT COUNT: %d", count);
+ SEARCH_DEBUG_LOG("TOTAL COUNT: %d", total_cnt);
+
+ 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_genlist_item_info *gen_item = NULL;
+ Elm_Genlist_Item_Class *itc_style = 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;
+ char contact_id_str[MAX_LENGTH_PER_ID] = {0,};
+
+ sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
+
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", loop_cnt);
+ continue;
+ }
+
+ sel_mem_info->type = obj->contents_type;
+
+ 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) {
+ sel_mem_info->icon1 = strdup(contact_img_path);
+ }
+ else if (obj->obj_icon_path) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+
+ 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) {
+ text_1line = str_display;
+ }
+
+ if (num_display != NULL) {
+ text_2line = num_display;
+ }
+
+ if (text_1line != NULL && text_2line != NULL) {
+ sel_mem_info->text1 = strdup(search_markup_keyword(str_display, keyword, &is_word_in_str));
+ sel_mem_info->text2 = strdup(search_markup_keyword(num_display, keyword, &is_word_in_str));
+ itc_style = ad->itc_pslist_2line_1icon;
+ } else {
+ if (text_1line) {
+ sel_mem_info->text1 = strdup(search_markup_keyword(str_display, keyword, &is_word_in_str));
+ }
+ else {
+ sel_mem_info->text2 = strdup(search_markup_keyword(num_display, keyword, &is_word_in_str));
+ }
+ itc_style = ad->itc_pslist_1line_1icon;
+ }
+
+ contacts_record_get_int(record, _contacts_person.id, &contact_id);
+ snprintf(contact_id_str, MAX_LENGTH_PER_ID - 1, "%d", contact_id);
+ sel_mem_info->launch_param= strdup(contact_id_str);
+
+ gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM,
+ obj, itc_style, sel_mem_info,
+ obj->gl_result_grp);
+ result_info->itemlist = g_list_append(result_info->itemlist, (void*)gen_item);
+
+ loop_cnt++;
+
+ if (loop_cnt == limit) {
+ break;
+ }
+ }while (contacts_list_next(list) == CONTACTS_ERROR_NONE);
+ } else {
+ SEARCH_DEBUG_WARNING("No matched contacts data", ret);
+ search_ret = SEARCH_RET_SEARCH_NONE;
+ goto out_func;
+ }
+
+ contacts_list_destroy(list, true);
+
+ /* Set more title to genlist (under 'search all') */
+ curr_cnt = offset + loop_cnt;
+
+ if (total_cnt > curr_cnt) {
+ struct search_item_more_sel *sel_mem_more = NULL;
+
+ obj->mr_info.next_point = offset + limit;
+
+ sel_mem_more =
+ (struct search_item_more_sel *)calloc(1,
+ sizeof(struct
+ search_item_more_sel));
+ sel_mem_more->obj = obj;
+
+ result_info->more = search_add_genlist_item(SEARCH_GENLIST_MORE,
+ obj,
+ ad->itc_listmore,
+ sel_mem_more,
+ obj->gl_result_grp);
+ }
+
+ search_ret = SEARCH_RET_SEARCH_SUCCESS;
+
+out_func:
+ ret = contacts_disconnect2();
+
+ if (filter) {
+ contacts_filter_destroy(filter);
+ }
+
+ if (query) {
+ contacts_query_destroy(query);
+ }
+
+ SEARCH_FUNC_END;
+
+ return search_ret;
+}
+
+int search_sql_calendar_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_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 total_cnt = -1;
+ int ret = 0;
+ int search_ret = SEARCH_RET_SEARCH_NONE;
+ int curr_cnt = 0;
+
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
+
+ ret = calendar_connect();
+ SEARCH_RETV_IF_WITH_ERRORV(ret != CALENDAR_ERROR_NONE, SEARCH_RET_SEARCH_FAIL, ret);
+
+ calendar_query_h query = NULL;
+ calendar_filter_h visibility_filter = NULL;
+ calendar_list_h list = NULL;
+
+ ret = calendar_query_create(_calendar_event._uri, &query);
+ if (ret != CALENDAR_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("calendar_query_create : %d", ret);
+ goto out_func;
+ }
+
+ 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_query_set_sort(query, _calendar_event.summary, true);
+ if (ret != CALENDAR_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("calendar_query_set_sort : %d", ret);
+ goto out_func;
+ }
+
+ ret = calendar_db_get_count_with_query(query, &total_cnt);
+ if (ret != CALENDAR_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("calendar_db_get_count_with_query : %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);
+
+ SEARCH_DEBUG_LOG("CALENDAR COUNT : %d", count);
+ SEARCH_DEBUG_LOG("TOTAL COUNT : %d", total_cnt);
+
+ 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 {
+ int main_id = -1;
+ char *summary = NULL;
+ bool is_word_in_str = false;
+ char format_val[MAX_LENGTH_PER_LINE] = {0,};
+ char calendar_id_str[MAX_LENGTH_PER_ID] = {0,};
+
+ 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));
+
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", loop_cnt);
+ continue;
+ }
+
+ sel_mem_info->type = obj->contents_type;
+
+ /* Set Thumbnail Image */
+ if (obj->obj_icon_path) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+
+ /* Set text 1line - Summary */
+ calendar_record_get_str_p(record, _calendar_event.summary, &summary);
+ if ((summary) && (strlen(summary) > 0)) {
+ sel_mem_info->text1 = strdup(search_markup_keyword(summary, keyword, &is_word_in_str));
+ }
+
+ /* 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);
+ } else {
+ search_util_date_time_format_get_val(cal.time.utime, format_val, SEARCH_DATE_TYPE_YYMM);
+ }
+ sel_mem_info->text2 = strdup(format_val);
+
+ /* Set id for launching caledar contents */
+ calendar_record_get_int (record, _calendar_event.id, &main_id);
+ snprintf(calendar_id_str, MAX_LENGTH_PER_ID - 1, "%d", main_id);
+ sel_mem_info->launch_param = strdup(calendar_id_str);
+
+ 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);
+
+ loop_cnt++;
+
+ if (loop_cnt == limit) {
+ break;
+ }
+ } while (calendar_list_next(list) == CALENDAR_ERROR_NONE);
+ } else {
+ SEARCH_DEBUG_WARNING("No Matched calendar data: %d", count);
+
+ search_ret = SEARCH_RET_SEARCH_NONE;
+ goto out_func;
+ }
+
+ curr_cnt = offset + loop_cnt;
+
+ /* Set more title to genlist (under 'search all') */
+ if (total_cnt > curr_cnt) {
+ obj->mr_info.next_point = offset + limit;
+
+ sel_mem_more =
+ (struct search_item_more_sel *)calloc(1,
+ sizeof(struct
+ search_item_more_sel));
+ sel_mem_more->obj = obj;
+
+ result_info->more = search_add_genlist_item(SEARCH_GENLIST_MORE,
+ obj,
+ ad->itc_listmore,
+ 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;
+}
+
+static void __search_sql_memo_search_result_cb(memo_data_t * value,
+ void *user_data)
+{
+ SEARCH_FUNC_START;
+
+ struct search_cb_data *scd = (struct search_cb_data *)user_data;
+ 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;
+ char memo_id_str[MAX_LENGTH_PER_ID] = {0,};
+ char format_val[MAX_LENGTH_PER_LINE] = {0,};
+
+ SEARCH_RET_IF(scd == NULL);
+ ad = scd->ad;
+ obj = scd->obj;
+ result_info = scd->result_info;
+
+ SEARCH_RET_IF(ad == NULL);
+ SEARCH_RET_IF(value == NULL);
+
+ 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 (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));
+
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", obj->mr_info.next_point);
+ return;
+ }
+
+ sel_mem_info->type = obj->contents_type;
+
+ /********** START : set search result to sel_mem_info buf ************/
+
+ if (obj->obj_icon_path) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+
+ /* First, We should check comment field. It means drawing memo
+ * If comment field is NULL, then we check content field */
+ if ((value->comment) && (strlen(value->comment) > 0)) {
+ sel_mem_info->text1 = strdup(search_markup_keyword(value->comment, keyword, &is_word_in_str));
+ } else if ((value->content) && (strlen(value->content) > 0)) {
+ sel_mem_info->text1 = strdup(search_markup_keyword(value->content, keyword, &is_word_in_str));
+ }
+
+ search_util_date_time_format_get_val(value->modi_time, format_val, SEARCH_DATE_TYPE_YYMM);
+ sel_mem_info->text2 = strdup(format_val);
+
+ snprintf(memo_id_str, MAX_LENGTH_PER_ID - 1, "%d", value->id);
+ sel_mem_info->launch_param = strdup(memo_id_str);
+
+ /********** 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->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) {
+ /* Set more title to genlist (under 'search all') */
+ sel_mem_more =
+ (struct search_item_more_sel *)calloc(1,
+ sizeof(struct
+ search_item_more_sel));
+ sel_mem_more->obj = obj;
+
+ result_info->more = search_add_genlist_item(SEARCH_GENLIST_MORE,
+ obj,
+ ad->itc_listmore,
+ sel_mem_more,
+ obj->gl_result_grp);
+ } else {
+ SEARCH_DEBUG_WARNING
+ ("__search_sql_memo_search_result_cb wrong index : %d",
+ obj->mr_info.next_point);
+ }
+
+ SEARCH_FUNC_END;
+
+ return;
+}
+
+int search_sql_memo_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};
+
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
+
+ memo_search_data(keyword,
+ limit, offset,
+ MEMO_SORT_TITLE_ASC,
+ __search_sql_memo_search_result_cb,
+ &scd);
+
+ if (obj->mr_info.next_point == 0) {
+ SEARCH_DEBUG_WARNING("no memo search result");
+ return SEARCH_RET_SEARCH_NONE;
+ }
+
+ SEARCH_FUNC_END;
+ return SEARCH_RET_SEARCH_SUCCESS;
+}
+
+int search_sql_email_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;
+
+ int ret = EMAIL_ERROR_NONE;
+ int i = 0;
+ email_mail_list_item_t *mail_list = NULL;
+ email_list_filter_t *filter_list = NULL;
+ email_list_sorting_rule_t *sorting_rule_list = NULL;
+
+ int filter_list_count = 5;
+ int sorting_rule_list_count = 1;
+ int mail_count = 0;
+ int total_mail_cnt = -1;
+ int unseen_mail_cnt = -1;
+
+ 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 = false;
+
+ SEARCH_RETV_IF(ad == NULL, SEARCH_RET_SEARCH_FAIL);
+
+ int search_ret = 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);
+
+ filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
+ filter_list[0].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
+ filter_list[0].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
+ filter_list[0].list_filter_item.rule.key_value.string_type_value = keyword;
+ filter_list[0].list_filter_item.rule.case_sensitivity = EMAIL_CASE_INSENSITIVE;
+
+ filter_list[1].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+ filter_list[1].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR;
+
+ filter_list[2].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
+ filter_list[2].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_TO;
+ filter_list[2].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
+ filter_list[2].list_filter_item.rule.key_value.string_type_value = keyword;
+ filter_list[2].list_filter_item.rule.case_sensitivity = EMAIL_CASE_INSENSITIVE;
+
+ filter_list[3].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+ filter_list[3].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR;
+
+ filter_list[4].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
+ filter_list[4].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_FROM;
+ filter_list[4].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
+ filter_list[4].list_filter_item.rule.key_value.string_type_value = keyword;
+ filter_list[4].list_filter_item.rule.case_sensitivity = EMAIL_CASE_INSENSITIVE;
+
+ sorting_rule_list = (email_list_sorting_rule_t *)malloc(sizeof(email_list_sorting_rule_t) * sorting_rule_list_count);
+ memset(sorting_rule_list, 0, sizeof(email_list_sorting_rule_t) * sorting_rule_list_count);
+
+ sorting_rule_list[0].target_attribute = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
+ sorting_rule_list[0].sort_order = EMAIL_SORT_ORDER_ASCEND;
+
+ ret = email_count_mail(filter_list, filter_list_count, &total_mail_cnt, &unseen_mail_cnt);
+ if (ret != EMAIL_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to call email_count_mail");
+ goto out_func;
+ }
+
+ ret = email_get_mail_list_ex(filter_list, filter_list_count, sorting_rule_list, sorting_rule_list_count,
+ offset, limit, &mail_list, &mail_count);
+
+
+
+ if (ret != EMAIL_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to call email_get_mail_list_ex");
+ goto out_func;
+ }
+
+ SEARCH_DEBUG_LOG("EMAIL TOTAL COUNT : %d UNSEEN : %d", total_mail_cnt, unseen_mail_cnt);
+ SEARCH_DEBUG_LOG("EMAIL COUNT : %d", mail_count);
+
+ if(mail_list == NULL) {
+ SEARCH_DEBUG_WARNING("mail_list is null");
+ search_ret = SEARCH_RET_SEARCH_NONE;
+ goto out_func;
+ }
+
+ if (mail_count == 0) {
+ SEARCH_DEBUG_WARNING("no email search result");
+ search_ret = SEARCH_RET_SEARCH_NONE;
+ goto out_func;
+ }
+
+ /* Set group title */
+ if (offset == 0) {
+ result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
+ obj,
+ ad->itc_grouptitle,
+ obj,
+ NULL);
+ }
+
+ /* Set search result to genlist */
+ for(i = 0 ; i < mail_count ; i++) {
+ char email_id_str[MAX_LENGTH_PER_ID] = {0,};
+ char email_path_str[MAX_LENGTH_PER_PATH] = {0,};
+
+ sel_mem_info = (struct search_item_sel*)calloc(1, sizeof(struct search_item_sel));
+
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", i);
+ continue;
+ }
+
+ sel_mem_info->type = obj->contents_type;
+
+ if (obj->obj_icon_path) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+
+ }
+
+ snprintf(email_id_str, MAX_LENGTH_PER_ID - 1, "%d", mail_list[i].mail_id);
+ sel_mem_info->launch_param = strdup(email_id_str);
+
+
+ snprintf(email_path_str, MAX_LENGTH_PER_PATH - 1, "%d %d %d",
+ mail_list[i].account_id, mail_list[i].mail_id, mail_list[i].mailbox_id);
+ sel_mem_info->launch_path = strdup(email_path_str);
+
+ if(strlen(mail_list[i].subject) > 0) {
+ sel_mem_info->text1 = strdup(search_markup_keyword(mail_list[i].subject, ad->search_word, &is_word_in_str));
+ }
+
+ if(strlen(mail_list[i].full_address_from) > 0) {
+ sel_mem_info->text2 = strdup(search_markup_keyword(mail_list[i].full_address_from, ad->search_word, &is_word_in_str));
+ }
+
+ if(is_word_in_str == false && (strlen(mail_list[i].email_address_recipient) > 0)) {
+ sel_mem_info->text2 = strdup(search_markup_keyword(mail_list[i].email_address_recipient, ad->search_word, &is_word_in_str));
+ }
+
+ 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);
+ }
+
+ /* Set more title to genlist (under 'search all') */
+ if (i < total_mail_cnt) {
+ obj->mr_info.next_point = offset + i;
+
+ sel_mem_more =
+ (struct search_item_more_sel *)calloc(1,
+ sizeof(struct search_item_more_sel));
+ sel_mem_more->obj = obj;
+
+ result_info->more = search_add_genlist_item(SEARCH_GENLIST_MORE,
+ obj,
+ ad->itc_listmore,
+ sel_mem_more,
+ obj->gl_result_grp);
+ }
+ search_ret = SEARCH_RET_SEARCH_SUCCESS;
+
+out_func:
+ SEARCH_FREE(filter_list);
+ SEARCH_FREE(sorting_rule_list);
+ SEARCH_FREE(mail_list);
+
+ SEARCH_FUNC_END;
+ return search_ret;
+}
+
+static bool __search_media_info_cb(media_info_h media, void *user_data)
+{
+ char *media_id = NULL;
+ char *media_name = NULL;
+ char *media_path = NULL;
+ char *media_thumbnail = NULL;
+
+ struct search_item_sel *sel_mem_info = NULL;
+ Elm_Genlist_Item_Class *itc_style = NULL;
+ bool is_word_in_str = false;
+
+ struct search_cb_data *scd = (struct search_cb_data*)user_data;
+ 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;
+ char media_id_str[MAX_LENGTH_PER_PATH] = {0,};
+
+ 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);
+ media_info_get_thumbnail_path(media, &media_thumbnail);
+
+ sel_mem_info = (struct search_item_sel*)calloc(1, sizeof(struct search_item_sel));
+
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", media_id);
+ return true;
+ }
+
+ sel_mem_info->type = obj->contents_type;
+
+ if ((media_thumbnail) && ecore_file_exists(media_thumbnail) == EINA_TRUE) {
+ sel_mem_info->icon1 = strdup(media_thumbnail);
+ } else if (obj->obj_icon_path) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+
+ if (media_name && strlen(media_name)) {
+ sel_mem_info->text1 = strdup(search_markup_keyword(media_name, keyword, &is_word_in_str));
+ }
+
+ if (media_id) {
+ snprintf(media_id_str, MAX_LENGTH_PER_ID, "%s", media_id);
+ sel_mem_info->launch_param = strdup(media_id_str);
+ }
+
+ if (media_path) {
+ sel_mem_info->launch_path = strdup(media_path);
+ }
+
+ itc_style = ad->itc_pslist_1line_1icon;
+
+ /* Add Info to genlist */
+ gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM,
+ obj,
+ itc_style,
+ sel_mem_info,
+ obj->gl_result_grp);
+ result_info->itemlist = g_list_append(result_info->itemlist, (void*)gen_item);
+
+ SEARCH_FREE(media_id);
+ SEARCH_FREE(media_name);
+ SEARCH_FREE(media_thumbnail);
+ SEARCH_FREE(media_path);
+
+ return true;
+ }
+
+static bool __search_sql_music_info_cb(media_info_h media, void *user_data)
+{
+ char *media_id = NULL;
+ char *media_path = NULL;
+ char *media_thumbnail = NULL;
+ char *title = NULL;
+ char *artist = NULL;
+ char *album = NULL;
+ int ret = 0;
+
+ audio_meta_h a_handle = NULL;
+
+ media_content_storage_e storage_type = MEDIA_CONTENT_STORAGE_INTERNAL;
+
+ struct search_item_sel *sel_mem_info = NULL;
+ Elm_Genlist_Item_Class *itc_style = NULL;
+ bool is_word_in_str = false;
+
+ struct search_cb_data *scd = (struct search_cb_data*)user_data;
+ 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;
+ char music_id_str[MAX_LENGTH_PER_PATH] = {0,};
+
+ 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);
+ media_info_get_thumbnail_path(media, &media_thumbnail);
+
+ ret = media_info_get_audio(media, &a_handle);
+
+ if(ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to get audio info!");
+ return true;
+ } else {
+ ret = audio_meta_get_title(a_handle, &title);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to get title info!");
+ }
+
+ ret = audio_meta_get_album(a_handle, &album);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to get album info!");
+ }
+
+ ret = audio_meta_get_artist(a_handle, &artist);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to get artist info!");
+ }
+
+ }
+
+ audio_meta_destroy(a_handle);
+
+ sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
+
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", media_id);
+ return true;
+ }
+
+ sel_mem_info->type = obj->contents_type;;
+
+ if ((media_thumbnail) && ecore_file_exists(media_thumbnail) == EINA_TRUE) {
+ sel_mem_info->icon1 = strdup(media_thumbnail);
+ } else if(obj->obj_icon_path) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+
+ if ((title) && (strlen(title) > 0)) {
+ sel_mem_info->text1 = strdup(search_markup_keyword(title, keyword, &is_word_in_str));
+ }
+
+ if (is_word_in_str) {
+ if ((artist) && (strlen(artist) > 0)) {
+ sel_mem_info->text2 = strdup(search_markup_keyword(artist, keyword, &is_word_in_str));
+ }
+ } else {
+ if ((artist) && (strlen(artist) > 0)) {
+ sel_mem_info->text2 = strdup(search_markup_keyword(artist, keyword, &is_word_in_str));
+ }
+
+ if (is_word_in_str == false && (album) && (strlen(album) > 0)) {
+ sel_mem_info->text2 = strdup(search_markup_keyword(album, keyword, &is_word_in_str));
+ }
+
+ if (is_word_in_str == false) {
+ SEARCH_DEBUG_LOG("search_result is 0. No match keyword in title,album,artist string");
+ }
+ }
+
+ if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) {
+ itc_style = ad->itc_pslist_2line_2icon;
+ sel_mem_info->icon2 = strdup(SEARCH_SDCARD_ICON);
+ }
+ else {
+ itc_style = ad->itc_pslist_2line_1icon;
+ }
+
+ if (media_id) {
+ snprintf(music_id_str, MAX_LENGTH_PER_ID - 1, "%s", media_id);
+ sel_mem_info->launch_param = strdup(music_id_str);
+ }
+
+ if (media_path) {
+ sel_mem_info->launch_path = strdup(media_path);
+ }
+
+ /* Add Information to genlist */
+ gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM, obj, itc_style, sel_mem_info,
+ obj->gl_result_grp);
+ result_info->itemlist = g_list_append(result_info->itemlist, (void*)gen_item);
+
+ SEARCH_FREE(media_id);
+ SEARCH_FREE(media_path);
+ SEARCH_FREE(media_thumbnail);
+ SEARCH_FREE(title);
+ SEARCH_FREE(artist);
+ SEARCH_FREE(album);
+
+ return true;
+ }
+
+static int __search_sql_media_search_result_by_api(struct search_content_object *obj,
+ int offset, int limit,
+ char *keyword,
+ filter_h filter,
+ media_info_cb func_cb,
+ void *data,
+ struct search_genlist_info *result_info,
+ int total_cnt)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ struct search_cb_data scd = {obj, ad, keyword, result_info};
+
+ int result_cnt = 0;
+ int ret = 0;
+ int func_ret = SEARCH_RET_SEARCH_SUCCESS;
+ int curr_cnt = 0;
+
+ 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) {
+ /* Set group title */
+ if (obj->mr_info.offset== 0) {
+ result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
+ obj,
+ ad->itc_grouptitle,
+ obj,
+ NULL);
+ }
+
+ ret = media_info_foreach_media_from_db(filter, func_cb, &scd);
+
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_info_foreach_media_from_db failed : %d\n", ret);
+ func_ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ curr_cnt = offset + result_cnt;
+
+ /* Set more title to genlist (under 'search all') */
+ if (total_cnt > curr_cnt) {
+ obj->mr_info.next_point = offset + result_cnt;
+
+ sel_mem_more =
+ (struct search_item_more_sel *)calloc(1,
+ sizeof(struct search_item_more_sel));
+ sel_mem_more->obj = obj;
+
+ result_info->more = search_add_genlist_item(SEARCH_GENLIST_MORE,
+ obj,
+ ad->itc_listmore,
+ sel_mem_more,
+ obj->gl_result_grp);
+ }
+ } else {
+ func_ret = SEARCH_RET_SEARCH_NONE;
+ }
+
+out_func:
+ SEARCH_FUNC_END;
+
+ return func_ret;
+}
+
+
+int search_sql_image_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;
+
+ int ret = SEARCH_RET_SEARCH_SUCCESS;
+ int len = 0;
+ int total_cnt = -1;
+
+ char *search_query = NULL;
+ char *escape_added_keyword = NULL;
+
+ const char *image_query = "(MEDIA_TYPE=0 and (MEDIA_DISPLAY_NAME like \"%%%s%%\" ESCAPE (\"%s\")))";
+
+ SEARCH_MALLOC(escape_added_keyword, strlen(keyword)*2+5, char);
+ memset(escape_added_keyword, 0x0, strlen(keyword)*2+5);
+ search_sql_make_keyword_bind_value(keyword, escape_added_keyword, SEARCH_SQL_BIND_TYPE_DUPLEX);
+
+ len = strlen(escape_added_keyword) + strlen(DB_ESCAPE_CHAR) + strlen(image_query) + 1;
+ search_query = (char*)calloc(1, len);
+
+ snprintf(search_query, len, image_query, escape_added_keyword, "%");
+
+ filter_h filter;
+
+ ret = media_filter_create(&filter);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_create failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ ret = media_filter_set_condition(filter, search_query, MEDIA_CONTENT_COLLATE_DEFAULT);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_condition failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_DISPLAY_NAME, MEDIA_CONTENT_COLLATE_DEFAULT);
+ if(ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_order failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+}
+
+ media_info_get_media_count_from_db(filter, &total_cnt);
+ SEARCH_DEBUG_LOG("Matched Image Total Cnt : %d", total_cnt);
+
+ ret = media_filter_set_offset(filter, offset, limit);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_offset failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+
+ ret = __search_sql_media_search_result_by_api(obj,
+ offset,
+ limit,
+ keyword,
+ filter,
+ __search_media_info_cb,
+ data,
+ result_info,
+ total_cnt);
+
+out_func:
+ SEARCH_FREE(search_query);
+ SEARCH_FREE(escape_added_keyword);
+ media_filter_destroy(filter);
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+int search_sql_video_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;
+
+ int ret = SEARCH_RET_SEARCH_SUCCESS;
+ int len = 0;
+ char *search_query = NULL;
+ char *escape_added_keyword = NULL;
+ int total_cnt = -1;
+
+ const char *video_query = "(MEDIA_TYPE=1 and (MEDIA_DISPLAY_NAME LIKE \"%%%s%%\" ESCAPE (\"%s\")))";
+
+ SEARCH_MALLOC(escape_added_keyword, strlen(keyword)*2+5, char);
+ memset(escape_added_keyword, 0x0, strlen(keyword)*2+5);
+ search_sql_make_keyword_bind_value(keyword, escape_added_keyword, SEARCH_SQL_BIND_TYPE_DUPLEX);
+
+ len = strlen(escape_added_keyword) + strlen(DB_ESCAPE_CHAR) + strlen(video_query) + 1;
+ search_query = (char*)calloc(1, len);
+
+ snprintf(search_query, len, video_query, escape_added_keyword, DB_ESCAPE_CHAR);
+
+ filter_h filter;
+
+ ret = media_filter_create(&filter);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_create failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ ret = media_filter_set_offset(filter, offset, limit);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_offset failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ ret = media_filter_set_condition(filter, search_query, MEDIA_CONTENT_COLLATE_DEFAULT);
+ if(ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_condition failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_DISPLAY_NAME, MEDIA_CONTENT_COLLATE_DEFAULT);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_order failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ media_info_get_media_count_from_db(filter, &total_cnt);
+ SEARCH_DEBUG_LOG("Matched Video Total cnt : %d", total_cnt);
+
+ ret = media_filter_set_offset(filter, offset, limit);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_offset failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ ret = __search_sql_media_search_result_by_api(obj,
+ offset,
+ limit,
+ keyword,
+ filter,
+ __search_media_info_cb,
+ data,
+ result_info,
+ total_cnt);
+
+out_func:
+
+ SEARCH_FREE(search_query);
+ SEARCH_FREE(escape_added_keyword);
+ media_filter_destroy(filter);
+
+ SEARCH_FUNC_END;
+
+ return ret;
+ }
+
+int search_sql_music_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;
+
+ int ret = SEARCH_RET_SEARCH_SUCCESS;
+ int len = 0;
+ char *search_query = NULL;
+ char *escape_added_keyword = NULL;
+ int total_cnt = -1;
+
+ const char *music_query = "(MEDIA_TYPE=3 and (MEDIA_TITLE LIKE \"%%%s%%\" or MEDIA_ALBUM LIKE \"%%%s%%\" or MEDIA_ARTIST LIKE \"%%%s%%\" ESCAPE (\"%s\")))";
+
+ SEARCH_MALLOC(escape_added_keyword, strlen(keyword)*2+5, char);
+ memset(escape_added_keyword, 0x0, strlen(keyword)*2+5);
+ search_sql_make_keyword_bind_value(keyword, escape_added_keyword, SEARCH_SQL_BIND_TYPE_DUPLEX);
+
+ len = strlen(escape_added_keyword) + strlen(DB_ESCAPE_CHAR) + strlen(music_query) + 1;
+ search_query = (char*)calloc(1, len);
+
+ snprintf(search_query, len, music_query, escape_added_keyword,
+ escape_added_keyword, escape_added_keyword, DB_ESCAPE_CHAR);
+
+ filter_h filter;
+
+ ret = media_filter_create(&filter);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_create failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+
+
+ ret = media_filter_set_condition(filter, search_query, MEDIA_CONTENT_COLLATE_DEFAULT);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_condition failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_ASC, MEDIA_TITLE, MEDIA_CONTENT_COLLATE_DEFAULT);
+ if(ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_order failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ media_info_get_media_count_from_db(filter, &total_cnt);
+ SEARCH_DEBUG_LOG("Matched Music Total cnt : %d", total_cnt);
+
+ ret = media_filter_set_offset(filter, offset, limit);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("media_filter_set_offset failed : %d\n", ret);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ ret = __search_sql_media_search_result_by_api(obj,
+ offset,
+ limit,
+ keyword,
+ filter,
+ __search_sql_music_info_cb,
+ data,
+ result_info,
+ total_cnt);
+
+out_func:
+
+ SEARCH_FREE(search_query);
+ SEARCH_FREE(escape_added_keyword);
+ media_filter_destroy(filter);
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+ail_cb_ret_e __search_sql_menu_search_result_cb(
+ const ail_appinfo_h appinfo,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct search_cb_data *scd = (struct search_cb_data*)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 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;
+ ail_cb_ret_e ret;
+
+ if (obj->mr_info.loop_cnt < obj->mr_info.next_point) {
+ obj->mr_info.loop_cnt++;
+ return AIL_CB_RET_CONTINUE;
+ }
+
+ 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));
+
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", obj->mr_info.loop_cnt);
+ return AIL_CB_RET_CONTINUE;
+ }
+
+ sel_mem_info->type = obj->contents_type;;
+
+ /********** START : set search result to sel_mem_info buf ************/
+
+ char *name = NULL;
+ char *package = NULL;
+ char *icon = NULL;
+
+ ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icon);
+
+ if (icon) {
+ sel_mem_info->icon1 = strdup(icon);
+ }
+
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
+ if ((package) && (strlen(package) > 0)) {
+
+ if(strcmp(package, "org.tizen.smartsearch") == 0) {
+ SEARCH_DEBUG_LOG("'smartsearch' does not appended");
+ obj->mr_info.loop_cnt++;
+ obj->mr_info.next_point++;
+ SEARCH_FREE(sel_mem_info);
+ return AIL_CB_RET_CONTINUE;
+ }
+
+ sel_mem_info->launch_path = strdup(package);
+ } else {
+ SEARCH_DEBUG_WARNING("package : null");
+ }
+
+ ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &name);
+ if ((name) && (strlen(name) > 0)) {
+ sel_mem_info->text1 = strdup(search_markup_keyword(name, keyword, &is_word_in_str));
+ } else {
+ SEARCH_DEBUG_WARNING("name : null");
+}
+
+ 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);
+ }
+
+ /********** END : set search result to sel_mem_info buf *************/
+
+ gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM,
+ obj,
+ ad->itc_pslist_1line_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++;
+ obj->mr_info.loop_cnt++;
+
+ ret = AIL_CB_RET_CONTINUE;
+
+ } else if (obj->mr_info.next_point ==
+ obj->mr_info.offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
+
+ /* Check that only "SMARTSEARCH" is left in more result */
+ if(obj->mr_info.next_point == obj->mr_info.result_cnt-1) {
+
+ char *package = NULL;
+
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
+ if ((package) && (strlen(package) > 0) && (strcmp(package, "org.tizen.smartsearch") == 0)) {
+ SEARCH_DEBUG_LOG("Only 'SMARTSEARCH' is left in more result");
+ return AIL_CB_RET_CANCEL;
+ }
+ }
+
+ /* Set more title to genlist (under 'search all') */
+ sel_mem_more = (struct search_item_more_sel *)calloc(1, sizeof(struct search_item_more_sel));
+ sel_mem_more->obj = obj;
+
+ result_info->more = search_add_genlist_item(SEARCH_GENLIST_MORE,
+ obj,
+ ad->itc_listmore,
+ sel_mem_more,
+ obj->gl_result_grp);
+
+ ret = AIL_CB_RET_CANCEL;
+ } else {
+ SEARCH_DEBUG_WARNING
+ ("__search_sql_menu_search_result_cb wrong index : %d",
+ obj->mr_info.next_point);
+
+ ret = AIL_CB_RET_CANCEL;
+ }
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+int search_sql_menu_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 cnt = 0;
+ int ret = 0;
+
+ ail_filter_h filter = NULL;
+ ail_error_e rc;
+
+ char *escape_added_keyword = NULL;
+ SEARCH_MALLOC(escape_added_keyword, strlen(keyword)*2+5, char);
+ memset(escape_added_keyword, 0x0, strlen(keyword)*2+5);
+ search_sql_make_keyword_bind_value(keyword, escape_added_keyword, SEARCH_SQL_BIND_TYPE_DUPLEX);
+
+ rc = ail_filter_new(&filter);
+ if (rc != AIL_ERROR_OK) {
+ SEARCH_DEBUG_WARNING("menu search - ail_filter_new error : %d", rc);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ rc = ail_filter_add_str(filter, AIL_PROP_NAME_STR, escape_added_keyword);
+ if (rc != AIL_ERROR_OK) {
+ SEARCH_DEBUG_WARNING("menu search - ail_filter_add_str error : %d", rc);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ rc = ail_filter_add_bool(filter, AIL_PROP_NODISPLAY_BOOL, false);
+ if (rc != AIL_ERROR_OK) {
+ SEARCH_DEBUG_WARNING("menu search - ail_filter_add_bool error : %d", rc);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ rc = ail_filter_count_appinfo(filter, &cnt);
+ if( rc != AIL_ERROR_OK) {
+ SEARCH_DEBUG_WARNING("menu search - ail_filter_count_appinfo error : %d", rc);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ SEARCH_DEBUG_LOG("ail search result : %d", cnt);
+ obj->mr_info.result_cnt = cnt;
+
+ if(cnt > 0) {
+ obj->mr_info.loop_cnt = 0;
+ rc = ail_filter_list_appinfo_foreach(filter, __search_sql_menu_search_result_cb, &scd);
+ if( rc != AIL_ERROR_OK) {
+ SEARCH_DEBUG_WARNING("menu search - ail_filter_list_appinfo_foreach error : %d", rc);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ if (obj->mr_info.next_point == 0) {
+ ret = SEARCH_RET_SEARCH_NONE;
+ } else {
+ ret = SEARCH_RET_SEARCH_SUCCESS;
+ }
+ } else {
+ ret = SEARCH_RET_SEARCH_NONE;
+ }
+
+out_func:
+ if (filter) {
+ ail_filter_destroy(filter);
+ }
+
+ SEARCH_FREE(escape_added_keyword);
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+bool __search_sql_browser_bookmark_result_cb(favorites_bookmark_entry_s *item, void *user_data)
+{
+ SEARCH_FUNC_START;
+ struct search_item_sel *sel_mem_info = NULL;
+
+ bool ret = false;
+ bool is_word_in_str_main = false;
+ bool is_word_in_str_sub = false;
+
+ 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;
+ struct search_content_object *obj = scd->obj;
+ struct search_genlist_info *result_info = scd->result_info;
+ char *keyword = scd->keyword;
+
+ struct search_genlist_item_info *gen_item = NULL;
+ struct search_more_result *info = scd->info;
+
+ if (info->loop_cnt < info->next_point) {
+ info->loop_cnt++;
+ return true;
+ }
+
+ if (info->next_point < info->offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
+ char bookmark_id_str[MAX_LENGTH_PER_PATH] = {0,};
+
+ /********** START : set search result to sel_mem_info buf ************/
+
+ if (item != NULL && item->title) {
+ match_str_title = strdup(search_markup_keyword(item->title, keyword, &is_word_in_str_main));
+ }
+
+ if (item != NULL && item->address) {
+ 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 && result_info->group == NULL) {
+ /* Set group title */
+ result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
+ obj,
+ ad->itc_grouptitle,
+ obj,
+ NULL);
+ }
+
+ sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
+
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", info->loop_cnt);
+ return true;
+ }
+
+ sel_mem_info->type = obj->contents_type;
+ snprintf(bookmark_id_str, MAX_LENGTH_PER_ID - 1, "%d", item->id);
+ sel_mem_info->launch_param = strdup(bookmark_id_str);
+
+ if (match_str_title) {
+ sel_mem_info->text1 = strdup(match_str_title);
+ }
+
+ if (match_str_addr) {
+ sel_mem_info->text2 = strdup(match_str_addr);
+ sel_mem_info->launch_path= strdup(item->address);
+ }
+
+ if (obj->obj_icon_path) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+
+ sel_mem_info->icon2 = strdup(SEARCH_FAVORITE_ICON);
+ gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM,
+ obj,
+ ad->itc_pslist_2line_2icon_browser_bookmark,
+ sel_mem_info,
+ obj->gl_result_grp);
+ result_info->itemlist = g_list_append(result_info->itemlist, (void*)gen_item);
+ 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++;
+
+ ret = true;
+ } else if (info->next_point ==
+ info->offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
+ info->offset = info->next_point;
+ ret = false;
+ } else {
+ SEARCH_DEBUG_WARNING
+ ("__search_sql_browser_bookmark_result_cb wrong index : %d",
+ info->next_point);
+
+ ret = false;
+ }
+ SEARCH_FUNC_END;
+ return ret;
+
+}
+
+bool __search_sql_browser_history_result_cb(favorites_history_entry_s *item, void *user_data)
+{
+ SEARCH_FUNC_START;
+ struct search_item_sel *sel_mem_info = NULL;
+
+ bool ret = false;
+ bool is_word_in_str_main = false;
+
+ const char* match_str = NULL;
+
+ struct search_cb_data_browser *scd = (struct search_cb_data_browser*)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 search_more_result *info = scd->info;
+ struct search_genlist_item_info *gen_item = NULL;
+
+ if (info->loop_cnt < info->next_point) {
+ info->loop_cnt++;
+ return true;
+ }
+
+ if (info->next_point < info->offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
+ char history_id_str[MAX_LENGTH_PER_PATH] = {0,};
+
+ /********** START : set search result to sel_mem_info buf ************/
+
+ if (item != NULL && item->address) {
+ 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 && result_info->group == NULL ) {
+ /* Set group title */
+ result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
+ obj,
+ ad->itc_grouptitle,
+ obj,
+ NULL);
+ }
+
+ sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
+
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", info->loop_cnt);
+ return true;
+ }
+
+ sel_mem_info->type = obj->contents_type;
+ snprintf(history_id_str, MAX_LENGTH_PER_ID - 1, "%d", item->id);
+ sel_mem_info->launch_param = strdup(history_id_str);
+
+ if (obj->obj_icon_path) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+
+ if (item->address) {
+ sel_mem_info->launch_path = strdup(item->address);
+ }
+
+ sel_mem_info->text1 = strdup(match_str);
+
+ gen_item = search_add_genlist_item(SEARCH_GENLIST_ITEM,
+ obj,
+ ad->itc_pslist_1line_1icon_browser_history,
+ sel_mem_info,
+ obj->gl_result_grp);
+ result_info->itemlist = g_list_append(result_info->itemlist, (void*)gen_item);
+ scd->search_ret = true;
+ }
+
+ info->next_point++;
+ info->loop_cnt++;
+
+ ret = true;
+
+ } else if (info->next_point ==
+ info->offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
+ info->offset = info->next_point;
+ ret = false;
+ } else {
+ SEARCH_DEBUG_WARNING
+ ("__search_sql_browser_history_result_cb wrong index : %d",
+ info->next_point);
+
+ ret = false;
+ }
+
+ SEARCH_FUNC_END;
+ return ret;
+}
+
+int search_sql_browser_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_browser scd_browser = {obj, ad, keyword, result_info, NULL, false};
+ struct search_cb_data_browser scd_history = {obj, ad, keyword, result_info, NULL, false};
+
+ static struct search_more_result browser_result[2];
+ struct search_item_more_sel *sel_mem_more = NULL;
+
+ int ret = 0;
+ int bookmark_cnt = 0, history_cnt = 0;
+ int bookmark_ret = 0, history_ret = 0;
+
+ if (offset == 0) {
+ /* offset 0 means first search result, so we initialize struct */
+ memset(browser_result, 0x0, sizeof(browser_result));
+
+ favorites_bookmark_get_count(&browser_result[0].result_cnt);
+ favorites_history_get_count(&browser_result[1].result_cnt);
+
+ bookmark_cnt = browser_result[0].result_cnt;
+ history_cnt = browser_result[1].result_cnt;
+ browser_result[0].ad = browser_result[1].ad = ad;
+ obj->gl_result_grp = NULL;
+
+ if ( bookmark_cnt <= 0 && history_cnt <= 0 )
+ return SEARCH_RET_SEARCH_NONE;
+ } else {
+ bookmark_cnt = browser_result[0].result_cnt;
+ history_cnt = browser_result[1].result_cnt;
+ browser_result[0].loop_cnt = 0;
+ browser_result[1].loop_cnt = 0;
+ }
+
+ if (offset >= bookmark_cnt + history_cnt) {
+ /* We need not to search */
+ return SEARCH_RET_SEARCH_NONE;
+ }
+
+ scd_browser.info = &browser_result[0];
+ scd_history.info = &browser_result[1];
+
+ /* offset check */
+ if (bookmark_cnt > browser_result[0].next_point )
+ bookmark_ret = favorites_bookmark_foreach(__search_sql_browser_bookmark_result_cb,
+ &scd_browser);
+ if (history_cnt > browser_result[1].next_point && g_list_length(result_info->itemlist) < SEARCH_CATEGORY_LIST_MORE_CNT)
+ history_ret = favorites_history_foreach(__search_sql_browser_history_result_cb,
+ &scd_history);
+
+ if (bookmark_ret == FAVORITES_ERROR_DB_FAILED
+ && history_ret == FAVORITES_ERROR_DB_FAILED ) {
+ ret = SEARCH_RET_SEARCH_FAIL;
+ }
+ else if (scd_browser.search_ret == false && scd_history.search_ret == false){
+ /* It means we can't get matched results */
+ ret = SEARCH_RET_SEARCH_NONE;
+ }
+ else {
+ /* Make More button */
+ if (browser_result[0].next_point < bookmark_cnt
+ || browser_result[1].next_point < history_cnt) {
+ sel_mem_more = (struct search_item_more_sel *)calloc(1, sizeof(struct search_item_more_sel));
+ sel_mem_more->obj = obj;
+
+ result_info->more = search_add_genlist_item(SEARCH_GENLIST_MORE,
+ obj,
+ ad->itc_listmore,
+ sel_mem_more,
+ obj->gl_result_grp);
+ }
+
+ /* return check */
+ obj->mr_info.next_point = browser_result[0].next_point
+ + browser_result[1].next_point;
+ ret = SEARCH_RET_SEARCH_SUCCESS;
+ }
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+int search_sql_msg_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;
+
+ int ret = SEARCH_RET_SEARCH_FAIL;
+
+ struct search_item_sel *sel_mem_info = NULL;
+ struct search_item_more_sel *sel_mem_more = NULL;
+ struct appdata *ad = (struct appdata *)data;
+ struct search_genlist_item_info *gen_item = NULL;
+
+ bool is_word_in_str;
+
+ int i = 0;
+ int j = 0;
+ bool is_word_in_title = false;
+
+ msg_error_t err = MSG_SUCCESS;
+
+ msg_struct_list_s total_msgList;
+ msg_struct_list_s msgList;
+ msg_struct_t search_s = NULL;
+ msg_struct_list_s *addr_list = NULL;
+
+ search_s = msg_create_struct(MSG_STRUCT_SEARCH_CONDITION);
+
+ err = msg_set_int_value(search_s, MSG_SEARCH_CONDITION_FOLDERID_INT, MSG_ALLBOX_ID);
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to make search struct : MSG_SEARCH_CONDITION_FOLDERID_INT");
+ goto out_func;
+ };
+
+ err = msg_set_int_value(search_s, MSG_SEARCH_CONDITION_MSGTYPE_INT, MSG_TYPE_INVALID);
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to make search struct : MSG_SEARCH_CONDITION_MSGTYPE_INT");
+ goto out_func;
+ }
+
+ err = msg_set_str_value(search_s, MSG_SEARCH_CONDITION_SEARCH_VALUE_STR, keyword, strlen(keyword));
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to make search struct : MSG_SEARCH_CONDITION_SEARCH_VALUE_STR");
+ goto out_func;
+ }
+
+ err = msg_search_message(ad->msg_handle, search_s, 0, 0, &total_msgList);
+ if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+ SEARCH_DEBUG_WARNING("msg_search_message is failed : %d", err);
+ goto out_func;
+ }
+
+ err = msg_search_message(ad->msg_handle, search_s, offset, limit, &msgList);
+
+ if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+ SEARCH_DEBUG_WARNING("msg_search_message is failed : %d", err);
+ goto out_func;
+ }
+
+ SEARCH_DEBUG_LOG("Matched Total Message : %d", total_msgList.nCount);
+ SEARCH_DEBUG_LOG("Message Count : %d", msgList.nCount);
+
+ if (msgList.nCount <= 0) {
+ SEARCH_DEBUG_WARNING("no msg search result");
+ ret = SEARCH_RET_SEARCH_NONE;
+ } else {
+
+ /* Set group title */
+ if (offset == 0) {
+ /* Set group title */
+ result_info->group = search_add_genlist_item(SEARCH_GENLIST_GROUP,
+ obj,
+ ad->itc_grouptitle,
+ obj,
+ NULL);
+ }
+
+ /********** START : set search result to sel_mem_info buf ************/
+
+ for (i = 0; i < msgList.nCount; i++) {
+ const char *text_1line = NULL;
+ const char *markup_keyword = NULL;
+ char *img_path = NULL;
+
+ int msg_type = 0;
+ int contact_id = -1;
+ int message_id = -1;
+
+ char subject[MAX_SUBJECT_LEN] = {0};
+ char str_number[MAX_ADDRESS_VAL_LEN] = {0,};
+ char str_name[MAX_DISPLAY_NAME_LEN] = {0,};
+ char msg_text[MAX_MSG_TEXT_LEN] = {0,};
+ char msg_id_str[MAX_LENGTH_PER_PATH] = {0,};
+
+ err = msg_get_int_value(msgList.msg_struct_info[i], MSG_MESSAGE_TYPE_INT, &msg_type);
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to make search struct : MSG_MESSAGE_TYPE_INT %d", err);
+ goto out_func;
+ }
+
+ SEARCH_DEBUG_LOG("mms : %d", msg_type);
+
+
+ sel_mem_info = (struct search_item_sel *)calloc(1,sizeof(struct search_item_sel));
+ if (!sel_mem_info) {
+ SEARCH_DEBUG_WARNING("[%d] Fail to make a genlist select info item!", i);
+ return true;
+ }
+
+ sel_mem_info->type = obj->contents_type;;
+
+ err = msg_get_int_value(msgList.msg_struct_info[i], MSG_MESSAGE_ID_INT, &message_id);
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to make search struct : MSG_MESSAGE_ID_INT %d", err);
+ goto out_func;
+ }
+
+ snprintf(msg_id_str, MAX_LENGTH_PER_ID - 1, "%d", message_id);
+ sel_mem_info->launch_param= strdup(msg_id_str);
+
+ /* Set 1st line string */
+ if (msg_type == MSG_TYPE_MMS || msg_type == MSG_TYPE_MMS_JAVA || msg_type == MSG_TYPE_MMS_NOTI) {
+ /* MMS case */
+ err = msg_get_str_value(msgList.msg_struct_info[i], MSG_MESSAGE_SUBJECT_STR,
+ subject, MAX_SUBJECT_LEN);
+
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to get sms context %d", err);
+ goto out_func;
+ }
+
+ text_1line = subject;
+ markup_keyword = search_markup_keyword(text_1line, keyword,&is_word_in_title);
+
+ if (!is_word_in_title) {
+ memset(msg_text, 0x00, sizeof(msg_text));
+ err = msg_get_str_value(msgList.msg_struct_info[i],
+ MSG_MESSAGE_MMS_TEXT_STR,
+ msg_text,
+ sizeof(msg_text));
+
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to get mms context %d", err);
+ goto out_func;
+ }
+
+ text_1line = msg_text;
+
+ markup_keyword = search_markup_keyword(text_1line,
+ keyword,
+ &is_word_in_title);
+ }
+
+ if ((text_1line) && (strlen(text_1line) > 0 )) {
+ sel_mem_info->text1 = strdup(markup_keyword);
+ } else {
+ sel_mem_info->text1 = strdup("Unknown");
+ }
+ } else if(msg_type == MSG_TYPE_SMS) {
+ /* SMS Case */
+ err = msg_get_str_value(msgList.msg_struct_info[i],
+ MSG_MESSAGE_SMS_DATA_STR,
+ msg_text,
+ sizeof(msg_text));
+
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to get sms context %d", err);
+ goto out_func;
+ }
+
+ text_1line = msg_text;
+
+ markup_keyword = search_markup_keyword(text_1line,
+ keyword,
+ &is_word_in_title);
+ SEARCH_DEBUG_LOG("1st string : %s", text_1line);
+
+ if ((text_1line) && (strlen(text_1line) > 0)) {
+ sel_mem_info->text1 = strdup(markup_keyword);
+ }
+ }
+
+ err = msg_get_list_handle(msgList.msg_struct_info[i],
+ MSG_MESSAGE_ADDR_LIST_STRUCT,
+ (void **)&addr_list);
+
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to get address list handle! %d", err);
+ goto out_func;
+ }
+
+ /* Set 2nd line string */
+ for ( j=0; j<addr_list->nCount; j++) {
+ memset(str_number, 0, sizeof(str_number));
+ memset(str_name, 0, sizeof(str_name));
+ contact_id = -1;
+ is_word_in_str = false;
+
+ /* First We set text_2line to first address data */
+ err = msg_get_str_value(addr_list->msg_struct_info[j],
+ MSG_ADDRESS_INFO_ADDRESS_VALUE_STR,
+ str_number,
+ MAX_ADDRESS_VAL_LEN);
+
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to get data! : MSG_ADDRESS_INFO_DISPLAYNAME_STR %d", err);
+ goto out_func;
+ }
+
+ err = msg_get_str_value(addr_list->msg_struct_info[j],
+ MSG_ADDRESS_INFO_DISPLAYNAME_STR,
+ str_name,
+ MAX_DISPLAY_NAME_LEN);
+
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to get data! : MSG_ADDRESS_INFO_ADDRESS_VALUE_STR %d", err);
+ goto out_func;
+ }
+
+ err = msg_get_int_value(addr_list->msg_struct_info[j],
+ MSG_ADDRESS_INFO_CONTACT_ID_INT,
+ &contact_id);
+
+ if (err != MSG_SUCCESS) {
+ SEARCH_DEBUG_WARNING("Fail to get data! : MSG_ADDRESS_INFO_CONTACT_ID_INT %d", err);
+ goto out_func;
+ }
+
+ /* Set text_2line */
+ markup_keyword = search_markup_keyword(str_number, keyword, &is_word_in_str);
+
+ if (strlen(str_name) > 0) {
+ sel_mem_info->text2 = strdup(str_name);
+ } else if(strlen(str_number) > 0) {
+ sel_mem_info->text2 = strdup(markup_keyword);
+ } else {
+ sel_mem_info->text2 = strdup("Unknown");
+ }
+
+ /* Check Whether Thumbnail Image exist or not */
+ if (contact_id > -1) {
+ contacts_query_h query = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_list_h list = NULL;
+
+ unsigned int count = 0;
+ ret = contacts_connect2();
+
+ if (ret != CONTACTS_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("Fail to connect contact service!");
+ if (obj->obj_icon_path != NULL) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+ 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) {
+ sel_mem_info->icon1 = strdup(img_path);
+ } else if (obj->obj_icon_path != NULL) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+ if (filter) {
+ contacts_filter_destroy(filter);
+ }
+
+ if (query) {
+ contacts_query_destroy(query);
+ }
+ if (list) {
+ contacts_list_destroy(list, true);
+ }
+
+ ret = contacts_disconnect2();
+ }
+ } else {
+ if (obj->obj_icon_path) {
+ sel_mem_info->icon1 = strdup(obj->obj_icon_path);
+ }
+ }
+
+ if ((is_word_in_title) || (is_word_in_str)) {
+ break;
+ }
+ }
+
+ 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);
+ }
+
+ msg_release_list_struct(&msgList);
+ msg_release_list_struct(&total_msgList);
+
+ /* Set more title to genlist (under 'search all') */
+ if (total_msgList.nCount > offset + i) {
+ obj->mr_info.next_point = offset + i;
+
+ sel_mem_more = (struct search_item_more_sel *)
+ calloc(1,sizeof(struct search_item_more_sel));
+ sel_mem_more->obj = obj;
+
+ result_info->more = search_add_genlist_item(SEARCH_GENLIST_MORE,
+ obj,
+ ad->itc_listmore,
+ sel_mem_more,
+ obj->gl_result_grp);
+ }
+
+ ret = SEARCH_RET_SEARCH_SUCCESS;
+ }
+
+out_func:
+ if (search_s != NULL) {
+ msg_release_struct(&search_s);
+ }
+ SEARCH_FUNC_END;
+ return ret;
+}
+
+void search_sql_update_result_object(struct search_content_object* result_obj, sqlite3* db_handle, sqlite3_stmt** db_sql)
+{
+ SEARCH_FUNC_START;
+
+ int rc = 0;
+
+ sqlite3_stmt *sql_stmt = db_sql[SEARCH_STMT_UPDATE_OBJECT_INFO];
+ SEARCH_RET_IF(sql_stmt==NULL);
+
+ search_sql_bind_text(db_handle, sql_stmt, 1, result_obj->name);
+ search_sql_bind_int(db_handle, sql_stmt, 2, result_obj->string_type);
+ search_sql_bind_int(db_handle, sql_stmt, 3, result_obj->visible);
+ search_sql_bind_int(db_handle, sql_stmt, 4, result_obj->order);
+ search_sql_bind_int(db_handle, sql_stmt, 5, result_obj->contents_type);
+ search_sql_bind_int(db_handle, sql_stmt, 6, result_obj->category_type);
+ search_sql_bind_text(db_handle, sql_stmt, 7, result_obj->def_pkg_name);
+ search_sql_bind_int(db_handle, sql_stmt, 8, result_obj->contents_type);
+
+ rc = sqlite3_step(sql_stmt);
+
+ if (rc == SQLITE_OK)
+ SEARCH_DEBUG_LOG("INSERT STEP SUCCESS");
+
+ search_sql_stmt_init(sql_stmt);
+
+ SEARCH_FUNC_END;
+
+}
diff --git a/src/search_bar.cpp b/src/search_bar.cpp
new file mode 100755
index 0000000..a56ed2a
--- /dev/null
+++ b/src/search_bar.cpp
@@ -0,0 +1,572 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+
+
+
+
+
+
+#include <string.h>
+#include "smartsearch.h"
+#include "Elementary.h"
+
+Eina_Bool __search_entry_timer_cb(void *data)
+{
+ 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_END;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void __search_searchbar_entry_changed_cb(void *data, Evas_Object * obj,
+ void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+
+ if (elm_object_focus_get(ad->search_bar)) {
+ if (elm_entry_is_empty(ad->search_entry)) {
+ elm_object_signal_emit(ad->search_bar, "elm,state,eraser,hide", "elm");
+ }
+ else {
+ elm_object_signal_emit(ad->search_bar, "elm,state,eraser,show", "elm");
+ }
+ } else {
+ if (elm_entry_is_empty(ad->search_entry)) {
+ elm_object_signal_emit(ad->search_bar, "elm,state,guidetext,show", "elm");
+ }
+ else {
+ elm_object_signal_emit(ad->search_bar, "elm,state,guidetext,hide", "elm");
+ }
+ }
+
+ /* Make timer for check user's input */
+ search_stop_search(ad);
+
+ ad->search_timer = ecore_timer_add(0.4, __search_entry_timer_cb, ad);
+
+ SEARCH_FUNC_END;
+ return;
+}
+
+
+static void __search_searchbar_entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+
+ 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_END;
+}
+
+static void __search_searchbar_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+
+ 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_END;
+}
+
+static void __search_searchbar_bg_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ 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_END;
+}
+
+static void __search_searchbar_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source) // When X marked button is clicked, empty entry's contents.
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+
+ elm_entry_entry_set(ad->search_entry, "");
+
+ Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(ad->search_entry);
+
+ if (imf_context) {
+ ecore_imf_context_input_panel_show(imf_context);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_searchbar_key_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ 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
+ (ad->search_entry));
+ }
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_searchbar_cancel_clicked_cb(void *data, Evas_Object * obj,
+ void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ const char* text = NULL;
+
+ SEARCH_RET_IF(ad == NULL);
+
+ elm_object_focus_set(ad->cate_btn, EINA_TRUE);
+ evas_object_hide(ad->search_cancel_btn);
+ elm_object_signal_emit(ad->search_bar, "cancel,out", "");
+ text = elm_entry_entry_get(ad->search_entry);
+
+ 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_gl_drag_scroll_start_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(ad->search_entry);
+
+ if (imf_context) {
+ ecore_imf_context_input_panel_hide(imf_context);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+
+static void
+__search_searchbar_state_event_cb(void *data, Ecore_IMF_Context *imf_context, int value)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ switch (value)
+ {
+ case ECORE_IMF_INPUT_PANEL_STATE_SHOW:
+ evas_object_smart_callback_add(
+ ad->search_gl,
+ "scroll,drag,start",
+ __search_searchbar_gl_drag_scroll_start_cb,
+ data);
+ break;
+ case ECORE_IMF_INPUT_PANEL_STATE_HIDE:
+ /* ISE state has changed to ISE_STATE_HIDE status */
+ evas_object_smart_callback_del(
+ ad->search_gl,
+ "scroll,drag,start",
+ __search_searchbar_gl_drag_scroll_start_cb);
+ break;
+ }
+
+ SEARCH_FUNC_END;
+}
+
+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;
+ double scale = elm_config_scale_get();
+
+ 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 * scale, height * scale);
+ evas_object_size_hint_max_set(cate_icon, width * scale, height * scale);
+ }
+
+ SEARCH_FUNC_END;
+
+ return cate_icon;
+}
+
+
+void search_delete_searchbar(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ if (ad->search_bar) {
+ elm_object_signal_callback_del(
+ ad->search_bar,
+ "elm,bg,clicked",
+ "elm",
+ __search_searchbar_bg_clicked_cb);
+ elm_object_signal_callback_del(
+ ad->search_bar,
+ "elm,eraser,clicked",
+ "elm",
+ __search_searchbar_eraser_clicked_cb);
+
+ evas_object_del(ad->search_bar);
+ ad->search_bar = NULL;
+ }
+
+ if (ad->search_entry) {
+ evas_object_smart_callback_del(
+ ad->search_entry,
+ "changed",
+ __search_searchbar_entry_changed_cb);
+ evas_object_smart_callback_del(
+ ad->search_entry,
+ "preedit,changed",
+ __search_searchbar_entry_changed_cb);
+ evas_object_smart_callback_del(
+ ad->search_entry,
+ "focused",
+ __search_searchbar_entry_focused_cb);
+ evas_object_smart_callback_del(
+ ad->search_entry,
+ "unfocused",
+ __search_searchbar_entry_unfocused_cb);
+
+ evas_object_del(ad->search_entry);
+ ad->search_entry = NULL;
+ }
+
+ if (ad->search_cancel_btn) {
+ evas_object_smart_callback_del(
+ ad->search_cancel_btn,
+ "clicked",
+ __search_searchbar_cancel_clicked_cb);
+ evas_object_del(ad->search_cancel_btn);
+ ad->search_cancel_btn = NULL;
+ }
+
+ if (ad->cate_btn) {
+ evas_object_del(ad->cate_btn);
+ ad->cate_btn = NULL;
+ }
+
+ if (ad->sb_layout) {
+ elm_object_part_content_unset(ad->sb_layout, "list");
+ evas_object_del(ad->sb_layout);
+ }
+
+ SEARCH_EVAS_OBJECT_FREE(ad->noresult_view);
+ SEARCH_EVAS_OBJECT_FREE(ad->search_gl);
+
+ SEARCH_FUNC_END;
+}
+
+void search_create_searchbar_layout(Evas_Object *parent, void *data)
+{
+ SEARCH_FUNC_START;
+
+ Evas_Object *genlist = NULL;
+ struct appdata *ad = (struct appdata *)data;
+
+ SEARCH_RET_IF(ad == NULL);
+
+ ad->sb_layout = search_create_layout(parent,
+ SEARCH_EDJ,
+ SEARCH_SEARCHBAR_GROUP_NORMAL);
+
+ SEARCH_RET_IF(ad->sb_layout == NULL);
+
+ // Category button
+ ad->cate_btn = search_create_category_button(ad->sb_layout, ad);
+
+ 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);
+
+
+ SEARCH_FUNC_END;
+}
+
+Evas_Object *search_create_layout(Evas_Object *parent, const char *file, const char *group)
+{
+ SEARCH_FUNC_START;
+ Evas_Object *layout = NULL;
+
+ /* create layout */
+ layout = elm_layout_add(parent);
+
+ SEARCH_RETV_IF(layout == NULL, NULL);
+
+ elm_layout_file_set(layout, file, group);
+
+ SEARCH_FUNC_END;
+ return layout;
+}
+
+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 err = 0;
+ char *imgpath = NULL;
+ int category = 0;
+
+ /* set search category icon area */
+
+ 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,
+ parent,
+ SEARCH_CATEGORY_BTN_ICON_SIZE_WIDTH,
+ SEARCH_CATEGORY_BTN_ICON_SIZE_HEIGHT,
+ false);
+
+ 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_content_set(ad->cate_btn, cate_icon);
+ evas_object_show(cate_btn);
+
+ SEARCH_FUNC_END;
+ return cate_btn;
+}
+
+Evas_Object *search_create_search_bar(Evas_Object *parent)
+{
+ SEARCH_FUNC_START;
+
+ Evas_Object *layout = NULL;
+
+ 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);
+
+ SEARCH_FUNC_END;
+ return layout;
+}
+
+Evas_Object *search_create_search_cancel_btn(Evas_Object *parent)
+{
+ SEARCH_FUNC_START;
+ Evas_Object *cancel_btn = NULL;
+
+ 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);
+ elm_entry_prediction_allow_set(entry, EINA_FALSE);
+ elm_entry_autocapital_type_set(entry, ELM_AUTOCAPITAL_TYPE_NONE);
+ elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH);
+
+ 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;
+}
+
+
diff --git a/src/smartsearch.cpp b/src/smartsearch.cpp
new file mode 100755
index 0000000..a372238
--- /dev/null
+++ b/src/smartsearch.cpp
@@ -0,0 +1,816 @@
+/*
+ * Copyright 2012-2013 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://floralicense.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.
+ */
+
+
+
+
+
+
+#include <stdio.h>
+#include <utilX.h>
+#include <ui-gadget.h>
+
+#include "smartsearch.h"
+#include "search_bar.h"
+#include "ps_makeupviews.h"
+#include "ps_searcher.h"
+
+#include <app.h>
+#include <app_manager.h>
+
+struct search_content_object_default {
+ int order;
+ int visible;
+ char name[DEF_BUF_LEN];
+ int string_type;
+ int contents_type;
+ int category_type;
+ char def_pkg_name[DEF_BUF_LEN];
+};
+
+struct search_category_info_default {
+ char btn_icon_path[MAX_LENGTH_PER_PATH];
+ char btn_icon_press_path[MAX_LENGTH_PER_PATH];
+};
+
+static struct search_content_object_default def_obj[SEARCH_CONT_MAX] = {
+ { 0, EINA_TRUE, "IDS_COM_BODY_CONTACTS", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_CONTACTS, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.contacts" },
+ { 1, EINA_TRUE, "IDS_COM_BODY_MESSAGES", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_MSG, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.message" },
+ { 2, EINA_TRUE, "IDS_COM_BODY_EMAIL", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_EMAIL, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.email" },
+ { 3, EINA_TRUE, "IDS_COM_BODY_IMAGES", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_IMAGES, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.image-viewer"},
+ { 4, EINA_TRUE, "IDS_COM_BODY_MUSIC", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_MUSIC, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.music-player"},
+ { 5, EINA_TRUE, "IDS_COM_BODY_VIDEOS", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_VIDEO, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.video-player"},
+ { 6, EINA_TRUE, "IDS_COM_BODY_CALENDAR", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_CALENDAR, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.calendar"},
+ { 7, EINA_TRUE, "IDS_COM_BODY_MEMO", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_MEMO, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.memo"},
+ { 8, EINA_TRUE, "IDS_COM_BODY_APPLICATIONS", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_MENU, SEARCH_OBJ_PHONE_CONTENTS, {0} },
+ { 9, EINA_TRUE, "IDS_COM_BODY_INTERNET", SEARCH_STR_TYPE_SYSTEM_STRING,
+ SEARCH_CONT_PHONE_BROWSER, SEARCH_OBJ_PHONE_CONTENTS, "org.tizen.browser"},
+};
+
+static struct search_category_info_default def_category[SEARCH_CATE_MAX] = {
+ { "B10_btn_icon_Phone.png", "B10_btn_icon_Phone_press.png" },
+};
+
+static void __search_win_delete_cb(void *data, Evas_Object * obj,
+ void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ elm_exit();
+
+ SEARCH_FUNC_END;
+}
+
+static Eina_Bool __search_mousedown_event(void *data, int type, void *event)
+{
+ 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);
+
+ ad->touch_x = ev->x;
+ ad->touch_y = ev->y;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+
+static Eina_Bool __search_keydown_event(void *data, int type, void *event)
+{
+ 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.
+ elm_exit();
+ }
+
+ SEARCH_FUNC_END;
+
+ return EINA_FALSE;
+}
+
+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);
+
+ 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);
+
+ layout = elm_layout_add(parent);
+
+ SEARCH_RETV_IF(layout == NULL, NULL);
+
+ //elm_layout_theme_set(layout, "standard", "window", "integration");
+ elm_layout_theme_set(layout, "layout", "application", "default");
+
+ 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_object_part_content_set(layout, "elm.swallow.bg", 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_END;
+
+ return layout;
+}
+
+static Evas_Object *__search_create_navigation_layout(Evas_Object * parent)
+{
+ SEARCH_FUNC_START;
+
+ Evas_Object *navi_bar; //, *sd;
+
+ SEARCH_RETV_IF(parent == NULL, NULL);
+
+ navi_bar = elm_naviframe_add(parent);
+
+ elm_object_part_content_set(parent, "elm.swallow.content", navi_bar);
+
+ evas_object_show(navi_bar);
+
+ SEARCH_FUNC_END;
+
+ return navi_bar;
+}
+
+static void __search_back_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+
+ elm_win_lower(ad->win_main);
+
+ if(ad->back_btn_type == BACK_BTN_TYPE_CLOSE)
+ elm_exit();
+
+ SEARCH_FUNC_END;
+}
+
+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->conformant);
+ elm_object_style_set(btn, "naviframe/end_btn/default");
+ evas_object_smart_callback_add(btn, "clicked", __search_back_btn_clicked_cb, ad);
+
+ SEARCH_FUNC_END;
+
+ return btn;
+}
+
+static int __search_init_smartsearch(struct appdata *ad)
+{
+ SEARCH_FUNC_START;
+
+ SEARCH_RETV_IF(ad == NULL, -1);
+
+ // Base Layout
+ 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_FUNC_END;
+
+ return 0;
+}
+
+static void __search_init_category_object(struct appdata *ad)
+{
+ 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);
+ ad->category_info[i].btn_icon_press_path = strdup(def_category[i].btn_icon_press_path);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_init_result_object(struct appdata *ad)
+{
+ SEARCH_FUNC_START;
+
+ int i = 0;
+ int rc = 0;
+ int ret = SEARCH_RET_SEARCH_NONE;
+
+ 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];
+
+ rc = sqlite3_step(sql_load);
+ if (rc != SQLITE_ROW) {
+ if (rc == SQLITE_DONE) {
+ SEARCH_DEBUG_WARNING("SELECT STEP : SQLITE_DONE. No result");
+ ret = SEARCH_RET_SEARCH_NONE;
+ } else {
+ SEARCH_DEBUG_ERROR("SELECT STEP FAIL : (%d)", rc);
+ ret = SEARCH_RET_SEARCH_FAIL;
+ }
+ } else {
+ SEARCH_DEBUG_LOG("SELECT STEP SUCCESS");
+ ret = SEARCH_RET_SEARCH_SUCCESS;
+}
+
+ if( ret != SEARCH_RET_SEARCH_SUCCESS ) {
+ /* If db result is NULL, initialize to default setting and insert this data to DB */
+ for( i = 0; i < SEARCH_CONT_MAX ; ++i ) {
+ sql_insert = ad->search_db_sql[SEARCH_STMT_INSERT_OBJECT_INFO];
+ ad->result_obj[i].order = def_obj[i].order;
+ ad->result_obj[i].visible = def_obj[i].visible;
+ ad->result_obj[i].contents_type = def_obj[i].contents_type;
+ ad->result_obj[i].category_type = def_obj[i].category_type;
+ 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);
+
+ if (ail_ret == APP_MANAGER_ERROR_NONE && imgpath) {
+ ad->result_obj[i].obj_icon_path = strdup(imgpath);
+ SEARCH_FREE(imgpath);
+}
+
+ /* Insert DB */
+ search_sql_bind_text(ad->search_db_hd, sql_insert, 1, ad->result_obj[i].name);
+ search_sql_bind_int(ad->search_db_hd, sql_insert, 2, ad->result_obj[i].string_type);
+ search_sql_bind_int(ad->search_db_hd, sql_insert, 3, ad->result_obj[i].visible);
+ search_sql_bind_int(ad->search_db_hd, sql_insert, 4, ad->result_obj[i].order);
+ search_sql_bind_int(ad->search_db_hd, sql_insert, 5, ad->result_obj[i].contents_type);
+ search_sql_bind_int(ad->search_db_hd, sql_insert, 6, ad->result_obj[i].category_type);
+ search_sql_bind_text(ad->search_db_hd, sql_insert, 7, ad->result_obj[i].def_pkg_name);
+
+ rc = sqlite3_step(sql_insert);
+
+ if( sql_insert != NULL )
+ search_sql_stmt_init(sql_insert);
+ }
+ } else {
+ /* Copy db data to structure */
+ for(i = 0; i < SEARCH_CONT_MAX && rc == SQLITE_ROW; ++i) {
+ char *name = (char *)sqlite3_column_text(sql_load, 0);
+ int string_type = sqlite3_column_int(sql_load, 1);
+ int visible = sqlite3_column_int(sql_load, 2);
+ int order = sqlite3_column_int(sql_load, 3);
+ int contents_type = sqlite3_column_int(sql_load, 4);
+ int category_type = sqlite3_column_int(sql_load, 5);
+ char *def_pkg_name = (char *)sqlite3_column_text(sql_load, 6);
+
+ ad->result_obj[i].order = order;
+ ad->result_obj[i].contents_type = contents_type;
+ ad->result_obj[i].string_type = string_type;
+ ad->result_obj[i].category_type = category_type;
+ ad->result_obj[i].name = ( name != NULL ) ? strdup(name): NULL;
+ ad->result_obj[i].visible = ( visible > 0 ) ? EINA_TRUE : EINA_FALSE;
+ ad->result_obj[i].def_pkg_name = ( def_pkg_name != NULL) ?
+ strdup(def_pkg_name) : NULL;
+
+ if (def_pkg_name) {
+ ail_ret = app_manager_get_app_icon_path(def_obj[i].def_pkg_name, &imgpath);
+
+ if (ail_ret == APP_MANAGER_ERROR_NONE && imgpath) {
+ ad->result_obj[i].obj_icon_path = strdup(imgpath);
+ SEARCH_FREE(imgpath);
+ }
+ }
+
+ rc = sqlite3_step(sql_load);
+ }
+ }
+
+ if( sql_load != NULL )
+ search_sql_stmt_init(sql_load);
+ if( sql_insert != NULL )
+ search_sql_stmt_init(sql_insert);
+
+ SEARCH_FUNC_END;
+ }
+
+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, ad);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(eo, w, h);
+ }
+
+ SEARCH_FUNC_END;
+
+ return eo;
+}
+
+static int __search_init_db_connect(struct appdata *ad)
+{
+ SEARCH_FUNC_START;
+
+ 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);
+ if (rc != SQLITE_OK) {
+ SEARCH_DEBUG_ERROR
+ ("db_util_open error : %d (%s)\n",
+ rc, SEARCH_DB_PATH);
+ ret = SEARCH_RET_FAIL;
+ } else {
+ int i = 0;
+ const char *query_list[SEARCH_STMT_MAX] = { SEARCH_DB_SQL_GET_CATEGORY_LIST_ALL,
+ SEARCH_DB_SQL_INSERT_OBJECT_IFNO,
+ SEARCH_DB_SQL_UPDATE_OBJECT_INFO
+ };
+
+ for (i = SEARCH_STMT_GET_CATEGORY_LIST_ALL; i < SEARCH_STMT_MAX ; ++i ) {
+ SEARCH_DEBUG_LOG("query : %s\n", query_list[i]);
+
+ ret = search_sql_prepare_stmt(ad->search_db_hd, query_list[i],
+ &(ad->search_db_sql[i]));
+ }
+ }
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+static void __search_deinit_db_connect(struct appdata *ad)
+ {
+ SEARCH_FUNC_START;
+
+ 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]);
+ ad->search_db_sql[i] = NULL;
+ }
+ }
+
+ if (ad->search_db_hd) {
+ rc = db_util_close(ad->search_db_hd);
+ if (rc != SQLITE_OK) {
+ SEARCH_DEBUG_WARNING
+ ("db_util_close error : %d / %s",
+ rc, SEARCH_DB_PATH);
+ } else {
+ SEARCH_DEBUG_LOG("db_util_close success");
+ }
+ ad->search_db_hd = NULL;
+ } else {
+ SEARCH_DEBUG_WARNING("db_handle(%s) is null", SEARCH_DB_PATH);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+static Eina_Bool __search_init_after_ui_create(gpointer data)
+{
+ 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,
+ ad);
+
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
+ __search_mousedown_event,
+ ad);
+
+ __search_init_db_connect(ad);
+ __search_init_result_object(ad);
+
+ UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
+
+ SEARCH_FUNC_END;
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+
+static void __search_update_lang(void *data)
+{
+ SEARCH_FUNC_START;
+ 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,
+ dgettext("sys_string", "IDS_COM_BODY_SEARCH"));
+
+ if (ad->search_bar)
+ elm_object_part_text_set(ad->search_bar,
+ "elm.guidetext",
+ dgettext("sys_string", "IDS_COM_BODY_SEARCH"));
+ if (ad->noresult_view)
+ elm_object_part_text_set(ad->noresult_view,
+ "elm.text",
+ dgettext("sys_string", "IDS_COM_BODY_NO_SEARCH_RESULTS"));
+
+ if (ad->search_cancel_btn)
+ elm_object_text_set(ad->search_cancel_btn,
+ dgettext("sys_string",
+ "IDS_COM_SK_CANCEL"));
+
+ for (i = 0; i < SEARCH_CONT_MAX; i++) {
+ Elm_Object_Item *it = ad->result_obj[i].gl_result_grp;
+ const char *item_name = ad->result_obj[i].name;
+
+ if (it && item_name)
+ elm_genlist_item_fields_update(it, "elm.text", ELM_GENLIST_ITEM_FIELD_TEXT);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+static bool __search_app_create(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ 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);
+
+ ad->scale_factor = elm_config_scale_get();
+
+ __search_init_category_object(ad);
+ __search_init_smartsearch(ad);
+
+ 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;
+
+ return true;
+}
+
+static void __search_app_terminate(void *data)
+{
+ SEARCH_FUNC_START;
+
+ 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->win_main) {
+ evas_object_del(ad->win_main);
+ ad->win_main = NULL;
+ }
+
+ if(ad->idler_create_ui)
+ ecore_idler_del(ad->idler_create_ui);
+
+ search_result_gl_deinit(ad);
+
+ search_app_disconnect(ad);
+ __search_deinit_db_connect(ad);
+
+ search_util_date_time_format_deinit();
+
+ for ( i = 0 ; i < SEARCH_CONT_MAX ; ++i ) {
+ SEARCH_FREE(ad->result_obj[i].name);
+ SEARCH_FREE(ad->result_obj[i].obj_icon_path);
+ SEARCH_FREE(ad->result_obj[i].def_pkg_name);
+ }
+
+ for ( i = 0 ; i < SEARCH_CATE_MAX ; ++i ) {
+ SEARCH_FREE(ad->category_info[i].btn_icon_path);
+ SEARCH_FREE(ad->category_info[i].btn_icon_press_path);
+ }
+
+ SEARCH_FREE(ad->search_word);
+ SEARCH_FREE(ad->not_markup_search_word);
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_app_pause(void *data)
+{
+ SEARCH_FUNC_START;
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_app_resume(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ SEARCH_RET_IF(ad == NULL);
+
+ if (ad->win_main) {
+ elm_object_focus_set(ad->back_btn, EINA_FALSE);
+ }
+
+ elm_genlist_select_mode_set(ad->search_gl, ELM_OBJECT_SELECT_MODE_DEFAULT);
+
+ if (elm_object_scroll_freeze_get(ad->search_gl) > 0) {
+ elm_object_scroll_freeze_pop(ad->search_gl);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_app_service(service_h service, void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ char *query = NULL;
+ char *keyword = NULL;
+ char *operation = NULL;
+
+ Evas_Object *cate_icon;
+ int ret = 0;
+ char *icon_path = NULL;
+
+ ad->back_btn_type = BACK_BTN_TYPE_LOWER;
+ SEARCH_FREE(ad->search_word);
+
+ ret = service_get_operation(service, &operation);
+
+ if (ret != 0) {
+ SEARCH_DEBUG_WARNING("Cannot get operation!");
+ return;
+ }
+
+ if(operation == NULL ) {
+ SEARCH_DEBUG_WARNING("Operation is NULL!");
+ return;
+ }
+
+ SEARCH_DEBUG_LOG("SERVICE OPERATION TYPE : %s", operation);
+ if (SEARCH_STRCMP(operation, SERVICE_OPERATION_SEARCH) == 0) {
+ ret = service_get_extra_data(service, "http://tizen.org/appcontrol/data/keyword", &query);
+
+ if(ret != 0) {
+ SEARCH_DEBUG_WARNING("Fail to Get Keyword data!");
+ query = NULL;
+ }
+
+ if( (query) && (strlen(query) > 0) ) {
+ keyword = (char*)malloc(strlen(query)+1);
+ memset(keyword, 0x00, strlen(query)+1);
+ strncpy(keyword, query, strlen(query));
+ }
+
+ ad->search_category = SEARCH_CATE_PHONE;
+ ad->back_btn_type = BACK_BTN_TYPE_CLOSE;
+
+ } else {
+ /* If Operation type is not SEARCH, Initializae valute to default */
+ keyword = vconf_get_str(SMARTSEARCH_KEY_KEYWORD);
+
+ if (keyword == NULL)
+ SEARCH_DEBUG_WARNING("Error(%d) : get current key from vconf", ret);
+
+ ad->search_category = SEARCH_CATE_PHONE;
+ }
+
+ SEARCH_DEBUG_LOG("current category : %d", ad->search_category);
+
+ icon_path = ad->category_info[ad->search_category].btn_icon_path;
+ cate_icon = search_searchbar_category_icon_add(icon_path,
+ ad->sb_layout,
+ SEARCH_CATEGORY_BTN_ICON_SIZE_WIDTH,
+ SEARCH_CATEGORY_BTN_ICON_SIZE_HEIGHT,
+ false);
+ elm_object_content_set(ad->cate_btn, cate_icon);
+
+ /* set current category to vconf */
+ ad->search_category = SEARCH_CATE_PHONE;
+
+ if ((keyword) && (strlen(keyword) > 0)) {
+ elm_object_text_set(ad->search_entry, keyword);
+ } else {
+ SEARCH_DEBUG_LOG("keyword is NULL");
+
+ elm_object_text_set(ad->search_entry, "");
+ elm_object_signal_emit(ad->search_bar, "cancel,hide", "");
+
+ search_set_result_list(ad);
+
+ /* set focus to entry for launching ime */
+ evas_object_show(ad->search_entry);
+ elm_object_focus_set(ad->search_entry,EINA_TRUE);
+ elm_object_signal_emit(ad->search_bar, "cancel,in", "");
+ }
+
+ SEARCH_FREE(keyword);
+ SEARCH_FREE(operation);
+ SEARCH_FREE(query);
+
+ elm_entry_cursor_end_set(ad->search_entry);
+
+ if (ad->win_main)
+ elm_win_activate(ad->win_main);
+
+ 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;
+ struct appdata *ad = (struct appdata *)data;
+
+ __search_update_lang(ad);
+
+ SEARCH_FUNC_END;
+}
+
+int main(int argc, char *argv[])
+{
+ SEARCH_FUNC_START;
+
+ struct appdata ad;
+
+ int i = 0;
+
+ app_event_callback_s event_callback;
+
+ event_callback.create = __search_app_create;
+ event_callback.terminate = __search_app_terminate;
+ event_callback.pause = __search_app_pause;
+ event_callback.resume = __search_app_resume;
+ event_callback.service = __search_app_service;
+ event_callback.low_memory = NULL;
+ event_callback.low_battery = NULL;
+ event_callback.device_orientation = __search_app_device_orientation_cb;
+ event_callback.language_changed = __search_app_lang_change;
+ event_callback.region_format_changed = search_region_format_cb;
+
+ memset(&ad, 0x0, sizeof(struct appdata));
+
+ for (i = 0; i < argc; i++)
+ SEARCH_DEBUG_LOG("argv[%d] = [%s]\n", i, argv[i]);
+
+ SEARCH_FUNC_END;
+
+ return app_efl_main(&argc, &argv, &event_callback, &ad);
+}