summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Kibum <kb0929.kim@samsung.com>2012-06-08 05:54:14 (GMT)
committerKim Kibum <kb0929.kim@samsung.com>2012-06-08 05:54:14 (GMT)
commitbf8879b3c9c9a58111b20ea76263a5845a2f56fb (patch)
treea5ef3437c6d260a0fcdce447cec29a5270905fd3
parent636878b6968ffd73d0fee4722d992ecb47e9f3a4 (diff)
downloadsmartsearch-bf8879b3c9c9a58111b20ea76263a5845a2f56fb.zip
smartsearch-bf8879b3c9c9a58111b20ea76263a5845a2f56fb.tar.gz
smartsearch-bf8879b3c9c9a58111b20ea76263a5845a2f56fb.tar.bz2
apply FSL(Flora Software License)
-rwxr-xr-xAUTHORS3
-rwxr-xr-xCMakeLists.txt107
-rwxr-xr-xLICENSE75
-rwxr-xr-xNOTICE0
-rwxr-xr-xdata/.goutputstream-A2OL5V18
-rwxr-xr-xdata/groups/search_result.edc174
-rwxr-xr-xdata/groups/ug_effect.edc109
-rwxr-xr-xdata/images/B10_Phone.pngbin0 -> 3054 bytes
-rwxr-xr-xdata/images/B10_Phone_press.pngbin0 -> 3054 bytes
-rwxr-xr-xdata/images/org.tizen.smartsearch.pngbin0 -> 24105 bytes
-rwxr-xr-xdata/org.tizen.smartsearch.desktop.in29
-rwxr-xr-xdata/smartsearch-color.edc20
-rwxr-xr-xdata/smartsearch.edc24
-rwxr-xr-xdata/smartsearch.ini2
-rwxr-xr-xdebian/changelog9
-rwxr-xr-xdebian/compat1
-rwxr-xr-xdebian/control43
-rw-r--r--debian/copyright0
-rwxr-xr-xdebian/org.tizen.smartsearch.install.in4
-rwxr-xr-xdebian/org.tizen.smartsearch.postinst.in26
-rwxr-xr-xdebian/rules120
-rwxr-xr-xinclude/common_util.h30
-rwxr-xr-xinclude/ps_app_interface.h37
-rwxr-xr-xinclude/ps_debug_util.h183
-rwxr-xr-xinclude/ps_makeupviews.h34
-rwxr-xr-xinclude/ps_searcher.h59
-rwxr-xr-xinclude/search_bar.h34
-rwxr-xr-xinclude/smartsearch.h119
-rwxr-xr-xinclude/smartsearch_define.h140
-rwxr-xr-xpackaging/org.tizen.smartsearch.spec88
-rwxr-xr-xpo/CMakeLists.txt24
-rwxr-xr-xpo/POTFILES.in10
-rwxr-xr-xpo/de.po27
-rwxr-xr-xpo/de_DE.po6
-rwxr-xr-xpo/el.po27
-rwxr-xr-xpo/el_GR.po6
-rwxr-xr-xpo/en.po6
-rwxr-xr-xpo/en_US.po27
-rwxr-xr-xpo/es.po27
-rwxr-xr-xpo/es_ES.po6
-rwxr-xr-xpo/fr.po27
-rwxr-xr-xpo/fr_FR.po6
-rwxr-xr-xpo/it.po27
-rwxr-xr-xpo/it_IT.po6
-rwxr-xr-xpo/ja.po27
-rwxr-xr-xpo/ja_JP.po6
-rwxr-xr-xpo/ko.po27
-rwxr-xr-xpo/ko_KR.po6
-rwxr-xr-xpo/nl.po27
-rwxr-xr-xpo/nl_NL.po6
-rwxr-xr-xpo/pt.po27
-rwxr-xr-xpo/pt_PT.po6
-rwxr-xr-xpo/ru.po27
-rwxr-xr-xpo/ru_RU.po6
-rwxr-xr-xpo/tk.po27
-rwxr-xr-xpo/tr_TR.po6
-rwxr-xr-xpo/zh_CN.po6
-rwxr-xr-xpo/zh_HK.po6
-rwxr-xr-xpo/zh_TW.po6
-rwxr-xr-xsrc/common_util.cpp354
-rwxr-xr-xsrc/ps_app_interface.cpp592
-rwxr-xr-xsrc/ps_makeupviews.cpp587
-rwxr-xr-xsrc/ps_searcher.cpp1496
-rwxr-xr-xsrc/search_bar.cpp426
-rwxr-xr-xsrc/smartsearch.cpp605
65 files changed, 5996 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100755
index 0000000..9f92fef
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+Junghyun Kim <jh1114.kim@samsung.com>
+Hakjoo Ko <hakjoo.ko@samsung.com>
+Hyungdeuk Kim <hd3.kim@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755
index 0000000..1806e34
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,107 @@
+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
+ utilX
+ x11
+ contacts-service
+ calendar
+ memo
+ icu-i18n
+ email-service
+ libmedia-service
+ appsvc
+ msg-service
+ libsoup-2.4
+ json-glib-1.0
+ glib-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 "${PREFIX}/data")
+SET(LOCALEDIR "${RESDIR}/locale")
+SET(ICONDIR "${RESDIR}/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("-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")
+
+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}/${SMARTSEARCH_PKG_NAME}.desktop DESTINATION /opt/share/applications/)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/${SMARTSEARCH_PKG_NAME}.png DESTINATION ${ICONDIR})
+
+# install ini file
+INSTALL(FILES ${CMAKE_BINARY_DIR}/data/${PROJECT_NAME}.ini DESTINATION share/process-info)
+
+#install application HOME directory
+INSTALL(DIRECTORY DESTINATION ${DATADIR})
+
+# i18n
+ADD_SUBDIRECTORY(po)
diff --git a/LICENSE b/LICENSE
new file mode 100755
index 0000000..7ccb5b5
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,75 @@
+Flora License
+
+Version 1.0, May, 2012
+
+http://www.tizenopensource.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://www.tizenopensource.org/license
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/NOTICE b/NOTICE
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/NOTICE
diff --git a/data/.goutputstream-A2OL5V b/data/.goutputstream-A2OL5V
new file mode 100755
index 0000000..d5eabbd
--- /dev/null
+++ b/data/.goutputstream-A2OL5V
@@ -0,0 +1,18 @@
+Name=Smart search
+Type=Application
+Exec=${PREFIX}/bin/smartsearch
+Icon=${SMARTSEARCH_PKG_NAME}.png
+Comment=Smart search Application
+X-SLP-BaseLayoutWidth=720
+X-SLP-BaseLayoutHeight=1280
+X-SLP-IsHorizontalScale=True
+Visible=True
+X-SLP-TaskManage=True
+X-SLP-Multiple=False
+X-SLP-Service=search_all
+X-SLP-SVC= slp.appsvc.operation.SEARCH:NULL:NULL
+
+Name[en_US]=Smart search
+Name[nl_NL]=Slim zoeken
+Name[de_DE]=Smart Search
+Name[zh_HK]= \ No newline at end of file
diff --git a/data/groups/search_result.edc b/data/groups/search_result.edc
new file mode 100755
index 0000000..83c294b
--- /dev/null
+++ b/data/groups/search_result.edc
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+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: 0 0 0 0;
+ }
+ }
+ part {
+ name: "searchbar_pad_top";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: 0 16;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { relative: 0.0 0.0; to: "bg";}
+ rel2 { relative: 1.0 0.0; to: "bg";}
+ color: SEARCHBAR_BACKGROUND_COLOR_DEFAULT;
+ }
+ }
+ part {
+ name: "searchbar_area";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: 0 74;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { relative: 0.0 1.0; to: "searchbar_pad_top";}
+ rel2 { relative: 1.0 1.0; to: "searchbar_pad_top";}
+ 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: 16 0;
+ fixed: 1 0;
+ align: 0 0.5;
+ rel1 { relative: 0.0 0.0; to: "searchbar_area";}
+ rel2 { relative: 0.0 1.0; to: "searchbar_area";}
+ 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: 80 74;
+ //max: 0 106;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 { relative: 1.0 0.0; to: "searchbar_area_category_pad_left";}
+ rel2 { relative: 1.0 1.0; to: "searchbar_area_category_pad_left";}
+ }
+ }
+ part {
+ name: "searchbar_area_category_pad_right";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: 16 0;
+ fixed: 1 0;
+ align: 0 0.5;
+ rel1 { relative: 1.0 0.0; to: "searchbar_area_category";}
+ rel2 { relative: 1.0 1.0; to: "searchbar_area_category";}
+ color: SEARCHBAR_BACKGROUND_COLOR_DEFAULT;
+ }
+ }
+ part {
+ name: "searchbar_area_entry";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 608 72;
+ fixed: 1 1;
+ align: 0.0 0.5;
+ rel1 { relative: 1.0 0.0; to: "searchbar_area_category_pad_right";}
+ rel2 { relative: 1.0 1.0; to: "searchbar_area";}
+ }
+ }
+ part {
+ name: "searchbar_pad_bottom";
+ type: RECT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: 0 16;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { relative: 0.0 1.0; to: "searchbar_area";}
+ rel2 { relative: 1.0 1.0; to: "searchbar_area";}
+ 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 1.0; to: "searchbar_pad_bottom"; }
+ rel2 { relative: 1.0 1.0; to: "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 1.0; to: "searchbar_pad_bottom"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
+ }
+ }
+ } //end parts
+} //end group
+
diff --git a/data/groups/ug_effect.edc b/data/groups/ug_effect.edc
new file mode 100755
index 0000000..9f5a9da
--- /dev/null
+++ b/data/groups/ug_effect.edc
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+group {
+ name: "ug_effect";
+ parts {
+ part {
+ name: "clip";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 1 0; }
+ rel2 { relative: 2 1; }
+ color: 255 255 255 0;
+ }
+ description {
+ state: "show" 0.0;
+ rel1 { relative: 0 0; }
+ rel2 { relative: 1 1; }
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name: "elm.swallow.content";
+ type: SWALLOW;
+ clip_to: "clip";
+ description {
+ rel1.to: "clip";
+ rel2.to: "clip";
+ }
+ }
+ part {
+ name: "event_blocker";
+ description {
+ state: "default" 0.0;
+ rel1.to: "clip";
+ rel2.to: "clip";
+ visible: 1;
+ }
+ description {
+ state: "show" 0.0;
+ inherit: "default" 0.0;
+ }
+ description {
+ state: "disabled" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "show";
+ signal: "elm,state,show";
+ action: STATE_SET "show" 0.0;
+ target: "clip";
+ target: "event_blocker";
+ transition: "DECELERATE" 0.5;
+ after: "show_end";
+ }
+ program {
+ name: "hide";
+ signal: "elm,state,hide";
+ action: STATE_SET "default" 0.0;
+ target: "clip";
+ target: "event_blocker";
+ transition: "DECELERATE" 0.5;
+ after: "hide_end";
+ }
+ program {
+ name: "disable_blocker";
+ name: "disable_event_blocker";
+ signal: "elm,state,blocker,disabled";
+ action: STATE_SET "disabled" 0.0;
+ target: "event_blocker";
+ }
+ program{
+ name: "disable_blocker";
+ action: SIGNAL_EMIT "elm,state,blocker,disabled" "";
+ }
+ program {
+ name: "show_end";
+ action: SIGNAL_EMIT "elm,action,show,finished" "";
+ after: "disable_blocker";
+ }
+ program {
+ name: "hide_end";
+ action: SIGNAL_EMIT "elm,action,hide,finished" "";
+ after: "disable_blocker";
+ }
+ }
+ }
+
diff --git a/data/images/B10_Phone.png b/data/images/B10_Phone.png
new file mode 100755
index 0000000..156842c
--- /dev/null
+++ b/data/images/B10_Phone.png
Binary files differ
diff --git a/data/images/B10_Phone_press.png b/data/images/B10_Phone_press.png
new file mode 100755
index 0000000..156842c
--- /dev/null
+++ b/data/images/B10_Phone_press.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..e843444
--- /dev/null
+++ b/data/images/org.tizen.smartsearch.png
Binary files differ
diff --git a/data/org.tizen.smartsearch.desktop.in b/data/org.tizen.smartsearch.desktop.in
new file mode 100755
index 0000000..d125e52
--- /dev/null
+++ b/data/org.tizen.smartsearch.desktop.in
@@ -0,0 +1,29 @@
+Name=Search
+Type=Application
+Exec=${PREFIX}/bin/smartsearch
+Icon=${SMARTSEARCH_PKG_NAME}.png
+Comment=Search Application
+nodisplay=False
+Version=0.3.15
+X-TIZEN-TaskManage=True
+X-TIZEN-Multiple=False
+X-TIZEN-Service=search_all
+X-TIZEN-SVC= http://tizen.org/appsvc/operation/search|NULL|NULL
+X-TIZEN-Removable=false
+
+Name[en_US]=Search
+Name[nl_NL]=Zoeken
+Name[de_DE]=Smart Search
+Name[zh_HK]=搜尋
+Name[zh_CN]=搜索
+Name[ru_RU]=Поиск
+Name[ko_KR]=검색
+Name[zh_TW]=搜尋
+Name[ja_JP]=検索
+Name[es_ES]=Buscar
+Name[el_GR]=Αναζήτηση
+Name[it_IT]=Cerca
+Name[tr_TR]=Akıllı Arama
+Name[pt_PT]=Procurar
+Name[fr_FR]=Rechercher
+
diff --git a/data/smartsearch-color.edc b/data/smartsearch-color.edc
new file mode 100755
index 0000000..b53f63f
--- /dev/null
+++ b/data/smartsearch-color.edc
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+#define SEARCHBAR_BACKGROUND_COLOR_DEFAULT 36 36 36 255
diff --git a/data/smartsearch.edc b/data/smartsearch.edc
new file mode 100755
index 0000000..e4872a9
--- /dev/null
+++ b/data/smartsearch.edc
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+collections {
+#include "smartsearch-color.edc"
+#include "groups/search_result.edc"
+#include "groups/ug_effect.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..ede405a
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,9 @@
+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..5e4422a
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,43 @@
+Source: smartsearch
+Section: main
+Priority: extra
+Maintainer: Junghyun Kim <jh1114.kim@samsung.com>, Hyungdeuk Kim <hd3.kim@samsung.com>, Hakjoo ko <hakjoo.ko@samsung.com>
+Uploaders: Junghyun Kim <jh1114.kim@samsung.com>, Hyungdeuk Kim <hd3.kim@samsung.com>, Hakjoo ko <hakjoo.ko@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,
+ libmedia-service-dev,
+ libail-0-dev,
+ libappsvc-dev,
+ libslp-msg-service-dev,
+ libsoup2.4-dev,
+ libjson-glib-dev,
+ libxml2-dev,
+ libappsvc-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..4290b8e
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,120 @@
+#!/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
+
+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..6ccea16
--- /dev/null
+++ b/include/common_util.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+#define CHECK_VALIDATE_UTF8 0
+
+int search_util_date_time_format_init(void *data);
+void search_util_date_time_format_deinit();
+void search_util_date_time_format_get_val(const struct tm *tm,
+ char *format_val);
+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..2a1e044
--- /dev/null
+++ b/include/ps_app_interface.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_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_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..eb6b800
--- /dev/null
+++ b/include/ps_debug_util.h
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_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_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_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_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..ae8d64f
--- /dev/null
+++ b/include/ps_makeupviews.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_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);
+Eina_Bool search_set_result_list(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);
+
+#endif // __DEF_PS_MAKEUPVIEWS_H__
diff --git a/include/ps_searcher.h b/include/ps_searcher.h
new file mode 100755
index 0000000..f190739
--- /dev/null
+++ b/include/ps_searcher.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __SEARCHSERVER_HEADER_H__
+#define __SEARCHSERVER_HEADER_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_contact_search_result_by_api(int type, int offset, int limit,
+ void *data);
+
+int search_sql_msg_search_result_by_api(int type, int offset, int limit,
+ void *data);
+
+int search_sql_email_search_result_by_api(int type, int offset, int limit,
+ void *data);
+
+int search_sql_calendar_search_result_by_api(int type, int offset, int limit,
+ void *data);
+
+int search_sql_memo_search_result_by_api(int type, int offset, int limit,
+ void *data);
+
+int search_sql_image_search_result_by_api(int type, int offset, int limit,
+ void *data);
+
+int search_sql_video_search_result_by_api(int type, int offset, int limit,
+ void *data);
+
+int search_sql_music_search_result_by_api(int type, int offset, int limit,
+ void *data);
+
+int search_sql_menu_search_result_by_api(int type, int offset, int limit,
+ char *keyword, void *data);
+
+#endif // __SEARCHSERVER_HEADER_H__
diff --git a/include/search_bar.h b/include/search_bar.h
new file mode 100755
index 0000000..035e9f5
--- /dev/null
+++ b/include/search_bar.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_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_searchbar_category_icon_add(int cate_type, int press_type, Evas_Object *parent);
+
+#endif /* __DEF_SEARCH_BAR_H__ */
diff --git a/include/smartsearch.h b/include/smartsearch.h
new file mode 100755
index 0000000..1edd84e
--- /dev/null
+++ b/include/smartsearch.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_SMARTSEARCH_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>
+extern "C" {
+}
+#include <sqlite3.h>
+#include <media-svc.h>
+#include <MapiControl.h>
+#include <MapiStorage.h>
+#include <MapiMessage.h>
+#include <MsgStorageTypes.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 search_item_sel {
+ unsigned char type;
+ char path[MAX_LENGTH_PER_PATH];
+ char main_id[MAX_LENGTH_PER_ID];
+ char main_buf[MAX_LENGTH_PER_LINE];
+ char sub_buf[MAX_LENGTH_PER_LINE];
+};
+
+struct appdata {
+ Evas_Object *win_main;
+ Evas_Object *layout_main;
+ Evas_Object *navi_bar;
+
+ 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_search;
+ Ecore_Idler *idler_create_ui;
+
+ int touch_x;
+ int touch_y;
+
+ Elm_Genlist_Item_Class *itc_pslist_1line;
+ Elm_Genlist_Item_Class *itc_pslist_2line;
+ Elm_Genlist_Item_Class *itc_grouptitle;
+ Elm_Genlist_Item_Class *itc_listmore;
+
+ search_more_result cate_info[SEARCH_TYPE_PHONE_MAX];
+
+ char *search_word;
+ char *not_markup_search_word;
+
+ int back_btn_type;
+
+ Evas_Object *effect_layout;
+ ui_gadget *detail_ug;
+
+ Elm_Object_Item *gl_result_group_item[PHONE_CATEGORY_LIST_CNT];
+
+ sqlite3 *search_db_hd;
+ sqlite3_stmt *search_db_sql_stmt[SEARCH_STMT_MAX];
+
+ /* Handle List */
+ MSG_HANDLE_T msg_handle;
+ MediaSvcHandle *media_handle;
+};
+
+#endif
diff --git a/include/smartsearch_define.h b/include/smartsearch_define.h
new file mode 100755
index 0000000..2cf2609
--- /dev/null
+++ b/include/smartsearch_define.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#ifndef __DEF_SMARTSEARCH_DEFINE_H__
+#define __DEF_SMARTSEARCH_DEFINE_H__
+
+
+enum {
+ SEARCH_TYPE_PHONE_CONTACTS = 0,
+ SEARCH_TYPE_PHONE_MSG,
+ SEARCH_TYPE_PHONE_EMAIL,
+ SEARCH_TYPE_PHONE_IMAGES,
+ SEARCH_TYPE_PHONE_MUSIC,
+ SEARCH_TYPE_PHONE_VIDEO,
+ SEARCH_TYPE_PHONE_CALENDAR,
+ SEARCH_TYPE_PHONE_MEMO,
+ SEARCH_TYPE_PHONE_MENU,
+ SEARCH_TYPE_PHONE_MAX
+};
+
+enum {
+ SEARCH_TYPE_PHONE = 0,
+};
+
+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_CATE_BTN_IMG_TYPE_UNPRESSED,
+ SEARCH_CATE_BTN_IMG_TYPE_PRESSED,
+ SEARCH_CATE_BTN_IMG_TYPE_MAX
+};
+
+enum {
+ SEARCH_RET_SEARCH_FAIL = -1,
+ SEARCH_RET_SEARCH_NONE,
+ SEARCH_RET_SEARCH_SUCCESS
+};
+
+enum {
+ SEARCH_RET_FAIL = -1,
+ SEARCH_RET_SUCCESS
+};
+
+enum {
+ SEARCH_STMT_GET_HISTORY_ALL = 0,
+ SEARCH_STMT_GET_HISTORY_WITH_KEYWORD,
+ SEARCH_STMT_INSERT_KEYWORD,
+ SEARCH_STMT_MAX
+};
+
+enum {
+ SEARCH_SQL_BIND_TYPE_SIMPLEX = 0,
+ SEARCH_SQL_BIND_TYPE_DUPLEX
+};
+
+//==============================================================================================================================
+
+#define SEARCH_PACKAGE "smartsearch"
+#define SEARCH_ICON_PATH RESDIR"/icons/"
+#define SEARCH_EDJ EDJDIR"/smartsearch.edj"
+
+#define DEF_BUF_LEN (512)
+#define MAX_LENGTH_PER_LINE (512)
+#define MAX_LENGTH_PER_PATH (512)
+#define MAX_LENGTH_PER_ID (10)
+#define MAX_SEARCH_WORD_SIZE (128)
+
+#define SMARTSEARCH_KEY_KEYWORD "db/smartsearch/keyword"
+
+#define PHONE_CATEGORY_LIST_CNT (SEARCH_TYPE_PHONE_MAX)
+#define DB_QUERY_LEN (512)
+
+#define NO_RESULT_BODY_LEN 7
+
+#define SEARCH_CATEGORY_LIST_MORE_CNT (20)
+
+#define DB_ESCAPE_CHAR "|"
+
+
+//==============================================================================================================================
+
+
+#define SEARCH_FREE(ptr) \
+ do { \
+ if(ptr != NULL) \
+ { \
+ free(ptr); \
+ ptr = NULL; \
+ } \
+ }while(0);
+
+#define SEARCH_MALLOC(ptr, size, type) \
+ do { \
+ if(size > 0) { \
+ ptr = (type *)malloc(size); \
+ if(ptr == NULL) \
+ assert(0); \
+ } else { \
+ assert(0); \
+ } \
+ } while(0);
+
+/* Gives comparison result of two strings and returns -1 if any of two is NULL */
+#define SEARCH_STRCMP(str1, str2) ((str1 && str2) ? strcmp(str1, str2) : -1)
+
+/* Returns string length of src and 0 if it is NULL */
+#define SEARCH_STRLEN(src) ((src != NULL)? strlen(src): 0)
+
+#define SEARCH_SCALABLED_SIZE(size, _scale_factor) (int)((size) * (_scale_factor))
+
+#endif
+
diff --git a/packaging/org.tizen.smartsearch.spec b/packaging/org.tizen.smartsearch.spec
new file mode 100755
index 0000000..7e26a25
--- /dev/null
+++ b/packaging/org.tizen.smartsearch.spec
@@ -0,0 +1,88 @@
+Name: org.tizen.smartsearch
+Summary: Smartsearch Application
+Version: 0.3.15
+Release: 1
+Group: main
+License: Flora Software License
+Source0: %{name}-%{version}.tar.gz
+Requires: elementary-bin
+BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(appsvc)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(calendar)
+BuildRequires: pkgconfig(contacts-service)
+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(libmedia-service)
+BuildRequires: pkgconfig(libsoup-2.4)
+BuildRequires: pkgconfig(memo)
+BuildRequires: pkgconfig(msg-service)
+BuildRequires: pkgconfig(ui-gadget)
+BuildRequires: pkgconfig(utilX)
+BuildRequires: pkgconfig(x11)
+BuildRequires: libug-contacts-devel
+
+BuildRequires: cmake
+BuildRequires: edje-tools
+BuildRequires: gettext-devel
+%description
+Smartsearch Application.
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "/opt/apps/org.tizen.smartsearch"
+%define RESDIR "/opt/apps/org.tizen.smartsearch/res"
+%define DATADIR "/opt/apps/org.tizen.smartsearch/data"
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{PREFIX}
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+
+touch %{buildroot}/opt/apps/org.tizen.smartsearch/data/.search.db
+touch %{buildroot}/opt/apps/org.tizen.smartsearch/data/.search.db-journal
+
+%post
+SEARCHPKG="org.tizen.smartsearch"
+
+# create db
+if [ ! -s /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
+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
+
+chmod 660 /opt/apps/$SEARCHPKG/data/.search.db
+chmod 660 /opt/apps/$SEARCHPKG/data/.search.db-journal
+
+vconftool set -t int db/smartsearch/category 0 -u 5000 -g 5000 2> /dev/null
+vconftool set -t string db/smartsearch/keyword '' -u 5000 -g 5000 2> /dev/null
+
+
+
+%files
+/opt/apps/org.tizen.smartsearch/bin/*
+/opt/apps/org.tizen.smartsearch/res/*
+%attr(-,inhouse,inhouse) /opt/apps/org.tizen.smartsearch/data/
+%config(noreplace,missingok) /opt/apps/org.tizen.smartsearch/data/.search.db
+%config(noreplace,missingok) /opt/apps/org.tizen.smartsearch/data/.search.db-journal
+/opt/share/applications/*
+/opt/apps/org.tizen.smartsearch/share/process-info/smartsearch.ini
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100755
index 0000000..fe43d1f
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,24 @@
+# for i18n
+
+SET(POFILES de_DE.po el_GR.po en.po es_ES.po fr_FR.po it_IT.po ja_JP.po ko_KR.po nl_NL.po pt_PT.po ru_RU.po tr_TR.po zh_CN.po zh_HK.po zh_TW.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/de.po b/po/de.po
new file mode 100755
index 0000000..a4fe132
--- /dev/null
+++ b/po/de.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Favoriten"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "Internet"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Dokument"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Bilder"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "Kein Suchergebnis"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "In Google suchen"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Videos"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Kategorien ändern"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "Abbrechen"
+
diff --git a/po/de_DE.po b/po/de_DE.po
new file mode 100755
index 0000000..4a0cdf6
--- /dev/null
+++ b/po/de_DE.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Mehr Ergebnisse"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Wörterbuch"
+
diff --git a/po/el.po b/po/el.po
new file mode 100755
index 0000000..04fbdf8
--- /dev/null
+++ b/po/el.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Σελιδοδείκτες"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "Πλοηγός"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Έγγραφο"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Εικόνες"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "Δεν υπ.απ.αναζ."
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Αναζήτηση μέσω Google"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Βίντεο"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Αλλαγή κατηγοριών"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "Άκυρο"
+
diff --git a/po/el_GR.po b/po/el_GR.po
new file mode 100755
index 0000000..6a863b8
--- /dev/null
+++ b/po/el_GR.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Περισσότερα αποτελέσματα"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Λεξικό"
+
diff --git a/po/en.po b/po/en.po
new file mode 100755
index 0000000..2a33305
--- /dev/null
+++ b/po/en.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "More results"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Dictionary"
+
diff --git a/po/en_US.po b/po/en_US.po
new file mode 100755
index 0000000..e916646
--- /dev/null
+++ b/po/en_US.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Bookmarks"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "Browser"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Document"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Images"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "No search result"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Search by Google"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Videos"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Change categories"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "Cancel"
+
diff --git a/po/es.po b/po/es.po
new file mode 100755
index 0000000..c27b7cf
--- /dev/null
+++ b/po/es.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Favoritos"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "Navegador"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Documento"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Imágenes"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "Sin resultados"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Buscar con Google"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Vídeos"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Cambiar categorías"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "Cancelar"
+
diff --git a/po/es_ES.po b/po/es_ES.po
new file mode 100755
index 0000000..8b19faa
--- /dev/null
+++ b/po/es_ES.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Más resultados"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Diccionario"
+
diff --git a/po/fr.po b/po/fr.po
new file mode 100755
index 0000000..1b92d0d
--- /dev/null
+++ b/po/fr.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Favoris"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "Navigateur"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Document"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Images"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "Aucun résultat"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Rechercher avec Google"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Vidéos"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Modifier les catégories"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "Annuler"
+
diff --git a/po/fr_FR.po b/po/fr_FR.po
new file mode 100755
index 0000000..d0b62de
--- /dev/null
+++ b/po/fr_FR.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Plus de résultats"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Dictionnaire"
+
diff --git a/po/it.po b/po/it.po
new file mode 100755
index 0000000..dba1ee8
--- /dev/null
+++ b/po/it.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Preferiti"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "Browser"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Documento"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Immagini"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "Nessun risultato ricerca"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Cerca con Google"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Video"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Cambia categorie"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "Annulla"
+
diff --git a/po/it_IT.po b/po/it_IT.po
new file mode 100755
index 0000000..0755121
--- /dev/null
+++ b/po/it_IT.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Altri risultati"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Dizionario"
+
diff --git a/po/ja.po b/po/ja.po
new file mode 100755
index 0000000..1944a9c
--- /dev/null
+++ b/po/ja.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "ブックマーク"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "ブラウザ"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "ドキュメント"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "画像"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "検索​結果​が​ありません"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Google​で​検索​"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "ムービー"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "カテゴリ​​を変更​"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "キャンセル"
+
diff --git a/po/ja_JP.po b/po/ja_JP.po
new file mode 100755
index 0000000..ea8c560
--- /dev/null
+++ b/po/ja_JP.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "他の​結果"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "辞書"
+
diff --git a/po/ko.po b/po/ko.po
new file mode 100755
index 0000000..dd52094
--- /dev/null
+++ b/po/ko.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "북마크"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "인터넷"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "문서"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "이미지"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "검색 결과가 없습니다"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Google 검색"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "동영상"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "범주 편집"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "취소"
+
diff --git a/po/ko_KR.po b/po/ko_KR.po
new file mode 100755
index 0000000..5419860
--- /dev/null
+++ b/po/ko_KR.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "결과 더보기"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "사전"
+
diff --git a/po/nl.po b/po/nl.po
new file mode 100755
index 0000000..12b6cc6
--- /dev/null
+++ b/po/nl.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Favorieten"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "Browser"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Document"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Afbeeldingen"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "Geen zoekresultaten"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Zoeken met Google"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Video's"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Categorieën wijzigen"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "Annul."
+
diff --git a/po/nl_NL.po b/po/nl_NL.po
new file mode 100755
index 0000000..66cb642
--- /dev/null
+++ b/po/nl_NL.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Meer resultaten"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Woordenboek"
+
diff --git a/po/pt.po b/po/pt.po
new file mode 100755
index 0000000..e675c60
--- /dev/null
+++ b/po/pt.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Favoritos"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "Browser"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Documento"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Imagens"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "S/ resul. pesq."
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Procurar através do Google"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Vídeos"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Alterar categorias"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "Cancelar"
+
diff --git a/po/pt_PT.po b/po/pt_PT.po
new file mode 100755
index 0000000..8b8baf8
--- /dev/null
+++ b/po/pt_PT.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Mais resultados"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Dicionário"
+
diff --git a/po/ru.po b/po/ru.po
new file mode 100755
index 0000000..8aa0aad
--- /dev/null
+++ b/po/ru.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Закладки"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "Интернет"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Документ"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Картинки"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "Нет результатов"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Поиск в Google"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Видео"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Изменить категории"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "Отмена"
+
diff --git a/po/ru_RU.po b/po/ru_RU.po
new file mode 100755
index 0000000..91767d1
--- /dev/null
+++ b/po/ru_RU.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Другие результаты"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Словарь"
+
diff --git a/po/tk.po b/po/tk.po
new file mode 100755
index 0000000..7dc1567
--- /dev/null
+++ b/po/tk.po
@@ -0,0 +1,27 @@
+msgid "IDS_SSEARCH_BODY_BOOKMARKS"
+msgstr "Yer imleri"
+
+msgid "IDS_SSEARCH_BODY_BROWSER"
+msgstr "İnternet"
+
+msgid "IDS_SSEARCH_BODY_DOCUMENT"
+msgstr "Belge"
+
+msgid "IDS_SSEARCH_BODY_IMAGES"
+msgstr "Resimler"
+
+msgid "IDS_SSEARCH_BODY_NO_SEARCH_RESULT"
+msgstr "Arama sonucu yok"
+
+msgid "IDS_SSEARCH_BODY_SEARCH_BY_GOOGLE"
+msgstr "Google ile ara"
+
+msgid "IDS_SSEARCH_BODY_VIDEOS"
+msgstr "Videolar"
+
+msgid "IDS_SSEARCH_OPT_CHANGE_CATEGORIES"
+msgstr "Kategorileri değiştir"
+
+msgid "IDS_SSEARCH_SK3_CANCEL"
+msgstr "İptal"
+
diff --git a/po/tr_TR.po b/po/tr_TR.po
new file mode 100755
index 0000000..fe48994
--- /dev/null
+++ b/po/tr_TR.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "Diğer sonuçlar"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "Sözlük"
+
diff --git a/po/zh_CN.po b/po/zh_CN.po
new file mode 100755
index 0000000..d3bf028
--- /dev/null
+++ b/po/zh_CN.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "更多结果"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "字典"
+
diff --git a/po/zh_HK.po b/po/zh_HK.po
new file mode 100755
index 0000000..091a25f
--- /dev/null
+++ b/po/zh_HK.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "更多結果"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "字典"
+
diff --git a/po/zh_TW.po b/po/zh_TW.po
new file mode 100755
index 0000000..091a25f
--- /dev/null
+++ b/po/zh_TW.po
@@ -0,0 +1,6 @@
+msgid "IDS_SSEARCH_BODY_MORE_RESULTS"
+msgstr "更多結果"
+
+msgid "IDS_SSEARCH_OPT_DICTIONARY"
+msgstr "字典"
+
diff --git a/src/common_util.cpp b/src/common_util.cpp
new file mode 100755
index 0000000..02b4f51
--- /dev/null
+++ b/src/common_util.cpp
@@ -0,0 +1,354 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#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;
+
+int search_util_date_time_format_init(void *data)
+{
+ SEARCH_FUNC_START;
+
+ UErrorCode status = U_ZERO_ERROR;
+ UChar customSkeleton[64] = { '\0' };
+ char skeleton[128] = { 0, };
+ int hr = 0;
+ int32_t bestPatternCapacity, bestPatternLength;
+ UChar bestPattern[64] = { 0, };
+ const char *locale;
+
+ /* 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 -1;
+ }
+
+ /* Date Time Format From Skeletons */
+ enum appcore_time_format timeformat;
+ int ret;
+ ret = appcore_get_timeformat(&timeformat);
+ if (ret == -1) {
+ // add exception handling
+ }
+
+ if (timeformat == APPCORE_TIME_FORMAT_24) {
+ snprintf(skeleton, 128, "%s%s", UDAT_YEAR_MONTH_DAY,
+ UDAT_HOUR24_MINUTE);
+ } else if (timeformat == APPCORE_TIME_FORMAT_12) {
+ snprintf(skeleton, 128, "%s%s", UDAT_YEAR_MONTH_DAY,
+ UDAT_HOUR_MINUTE);
+ } else {
+ SEARCH_DEBUG_WARNING("appcore_get_timeformat unknown error");
+ return -1;
+ }
+
+ 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 -1;
+ }
+
+ search_formatter =
+ udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, NULL, -1, bestPattern,
+ -1, &status);
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+void search_util_date_time_format_deinit()
+{
+ SEARCH_FUNC_START;
+
+ UErrorCode status = U_ZERO_ERROR;
+
+ if (search_pattern_generator) {
+ udatpg_close(search_pattern_generator);
+ search_pattern_generator = NULL;
+ }
+
+ if (search_formatter) {
+ udat_close(search_formatter);
+ search_formatter = NULL;
+ }
+
+ SEARCH_FUNC_END;
+
+ return;
+}
+
+void search_util_date_time_format_get_val(const struct tm *tm, char *format_val)
+{
+ SEARCH_FUNC_START;
+
+ UDate date;
+ time_t time;
+ UChar formatted[64] = { 0, };
+ int32_t formattedCapacity, formattedLength;
+ UErrorCode status = U_ZERO_ERROR;
+ char formattedString[128] = { 0, };
+
+ time = timelocal((struct tm *)tm);
+ date = (UDate) time *1000;
+
+ formattedCapacity =
+ (int32_t) (sizeof(formatted) / sizeof((formatted)[0]));
+ formattedLength =
+ udat_format(search_formatter, date, formatted, formattedCapacity,
+ NULL, &status);
+ if (formattedLength == -1) {
+ SEARCH_DEBUG_WARNING("udat_format fail");
+ return;
+ }
+
+ u_austrncpy(formattedString, formatted, 128);
+
+ 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)
+{
+ SEARCH_FUNC_START;
+
+ 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;
+
+ 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);
+ }
+
+ SEARCH_FUNC_END;
+
+ 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..56968f6
--- /dev/null
+++ b/src/ps_app_interface.cpp
@@ -0,0 +1,592 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#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 <appsvc.h>
+#include <bundle.h>
+
+#define UG_NAME_LEN 50
+
+static void __search_layout_ug_destroy(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ //D. Because the ug will be able to remove the base object, unset the content from the effect layout.
+ elm_object_part_content_unset(ad->effect_layout,
+ (char *)ug_get_layout(ad->detail_ug));
+
+ evas_object_del(ad->effect_layout);
+
+ ug_destroy(ad->detail_ug);
+
+ ad->detail_ug = NULL;
+ ad->effect_layout = NULL;
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_effect_layout_signal_hide_finished(void *data,
+ Evas_Object * obj,
+ const char *emission,
+ const char *source)
+{
+ SEARCH_FUNC_START;
+
+ __search_layout_ug_destroy(data);
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_effect_layout_render_flush_post_cb(void *data, Evas * e,
+ void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ if (!ad)
+ return;
+
+ //UG Show Effect
+ edje_object_signal_emit(elm_layout_edje_get(ad->effect_layout),
+ "elm,state,show", "");
+
+ //B.Remove the EVAS_RENDER_FLUSH_POST callback again.
+ evas_event_callback_del(e, EVAS_CALLBACK_RENDER_FLUSH_POST,
+ __search_effect_layout_render_flush_post_cb);
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_ug_layout_cb(struct ui_gadget *ug, enum ug_mode mode,
+ void *priv)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)priv;
+
+ Evas_Object *base = (Evas_Object *) ug_get_layout(ug);
+
+ if (!base)
+ return;
+
+#ifdef ENABLE_UG_EFFECT
+ if (!ad->effect_layout)
+ return;
+
+ elm_object_part_content_set(ad->effect_layout, "elm.swallow.content", base);
+ //B. Add the callback event for the EVAS_RENDER_FLUSH_POST
+ //B. This is one method to not skip the total effect time in creating the ug object.
+ evas_event_callback_add(evas_object_evas_get(ad->effect_layout),
+ EVAS_CALLBACK_RENDER_FLUSH_POST,
+ __search_effect_layout_render_flush_post_cb,
+ ad);
+#else
+ evas_object_show(base);
+#endif
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_ug_closed_cb(struct ui_gadget *ug, void *priv)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)priv;
+
+#ifdef ENABLE_UG_EFFECT
+ edje_object_signal_emit(elm_layout_edje_get(ad->effect_layout),
+ "elm,state,hide", "");
+#else
+ Evas_Object *base = (Evas_Object *) ug_get_layout(ug);
+
+ evas_object_hide(base);
+#endif
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_create_effect_layout(Evas_Object * parent,
+ struct appdata *ad)
+{
+ SEARCH_FUNC_START;
+
+ int ret;
+
+ //Create the layout then apply the edj
+ Evas_Object *ly = elm_layout_add(ad->win_main);
+
+ if (!ly)
+ return;
+
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ elm_win_resize_object_add(ad->win_main, ly);
+
+ ret = elm_layout_file_set(ly, SEARCH_EDJ, "ug_effect");
+
+ //Add a signal callback function which will be called after terminating hide effect.
+ edje_object_signal_callback_add(elm_layout_edje_get(ly),
+ "elm,action,hide,finished", "",
+ __search_effect_layout_signal_hide_finished,
+ ad);
+
+ //store the layout object to refer it at hide effect
+ ad->effect_layout = ly;
+
+ evas_object_show(ly);
+
+ 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;
+
+ bundle *kb;
+
+ struct ui_gadget *ug;
+ struct ug_cbs cbs = { 0, };
+
+ char buf[10] = { 0, };
+
+ if (ad->detail_ug) {
+ SEARCH_DEBUG_WARNING("prev ug is exist. destroy prev ug");
+ __search_layout_ug_destroy(ad);
+ }
+
+ kb = bundle_create();
+ if (!kb) {
+ SEARCH_DEBUG_ERROR("contact bundle_create");
+ return;
+ }
+
+ snprintf(buf, sizeof(buf), "%d", CT_UG_REQUEST_DETAIL);
+ bundle_add(kb, CT_UG_BUNDLE_TYPE, buf);
+ bundle_add(kb, CT_UG_BUNDLE_ID, cur_category_mem->main_id);
+
+#ifdef ENABLE_UG_EFFECT
+ __search_create_effect_layout(ad->win_main, ad);
+#endif
+
+ cbs.layout_cb = __search_ug_layout_cb;
+ cbs.result_cb = NULL;
+ cbs.destroy_cb = __search_ug_closed_cb;
+ cbs.priv = ad;
+
+ ug = ug_create(NULL, UG_CONTACTS_DETAILS, UG_MODE_FULLVIEW, kb, &cbs);
+ if (!ug) {
+ SEARCH_DEBUG_ERROR(" ... ug_create: failed !!!");
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ } else {
+ ad->detail_ug = ug;
+ }
+
+ bundle_free(kb);
+
+ 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;
+
+ bundle *b;
+ int ret = 0;
+
+ b = bundle_create();
+ if (!b) {
+ SEARCH_DEBUG_ERROR("search_launch_msg_view : bundle_create failed");
+ return;
+ }
+
+ bundle_add(b, "type", "msg_id");
+ bundle_add(b, "msgId", cur_category_mem->main_id);
+ ret = aul_launch_app("org.tizen.message", b);
+ if( (ret <= 0) && (ret != AUL_R_ETIMEOUT) ){
+ SEARCH_DEBUG_ERROR("msg aul launch app error(%d)", ret);
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
+
+ bundle_free(b);
+
+ SEARCH_FUNC_END;
+}
+
+void search_launch_email_view(void *data, void *record_info)
+{
+ SEARCH_FUNC_START;
+
+ bundle *b;
+ char *token_param = NULL;
+ char *saveptr1;
+ int i = 0;
+ int ret = 0;
+ struct appdata *ad = (struct appdata *)data;
+ struct search_item_sel *cur_category_mem =
+ (struct search_item_sel *)record_info;
+
+ b = bundle_create();
+ if (!b)
+ return;
+
+ char livemagazine[2] = { 0, };
+ char temp_path[MAX_LENGTH_PER_PATH] = { 0, };
+ livemagazine[0] = '0';
+
+ snprintf(temp_path, MAX_LENGTH_PER_PATH - 1, "%s",
+ cur_category_mem->path);
+
+ token_param = strtok_r(temp_path, " ", &saveptr1);
+
+ while (token_param != NULL) {
+ if (i == 0) {
+ bundle_add(b, "ACCOUNT_ID", token_param); //account_id
+ } else if (i == 1) {
+ bundle_add(b, "MAIL_ID", token_param); //mail_id
+ } else if (i == 2) {
+ bundle_add(b, "MAILBOX", token_param); //mailbox
+ } else {
+ break;
+ }
+
+ i++;
+ token_param = strtok_r(NULL, " ", &saveptr1);
+ }
+
+ bundle_add(b, "bLiveMagazine", livemagazine);
+
+ char runType[2] = { 0 };
+ snprintf(runType, sizeof(runType), "%d", 7);
+ bundle_add(b, "RUN_TYPE", runType);
+ ret = aul_launch_app("org.tizen.email", b);
+ if( (ret <= 0) && (ret != AUL_R_ETIMEOUT) ){
+ SEARCH_DEBUG_ERROR("email aul launch app error(%d)", ret);
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
+
+ bundle_free(b);
+
+ 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;
+
+ if (access(cur_category_mem->path, F_OK) != 0) {
+ SEARCH_DEBUG_ERROR("image access error : %s",
+ cur_category_mem->path);
+ search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND,
+ ad);
+ } else {
+ SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
+ cur_category_mem->path);
+
+ bundle* bd = NULL;
+ bd = bundle_create();
+
+ if (bd != NULL) {
+ appsvc_set_operation(bd, APPSVC_OPERATION_VIEW);
+ appsvc_set_uri(bd, cur_category_mem->path);
+ ret = appsvc_run_service(bd, 0, NULL, NULL);
+
+ if (ret < 0 )
+ search_launch_popup_error(LAUNCH_ERROR_APPSVC,
+ ad);
+ bundle_free(bd);
+ }
+
+ }
+
+ 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;
+
+ if (access(cur_category_mem->path, F_OK) != 0) {
+ SEARCH_DEBUG_ERROR("video access error : %s",
+ cur_category_mem->path);
+ search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND, ad);
+ } else {
+ bundle* bd = NULL;
+ bd = bundle_create();
+
+ appsvc_set_operation(bd, APPSVC_OPERATION_VIEW);
+ appsvc_set_uri(bd, cur_category_mem->path);
+ ret = appsvc_run_service(bd, 0, NULL, NULL);
+
+ if (ret < 0) {
+ SEARCH_DEBUG_ERROR("video app service error(%d) : %s",
+ ret, cur_category_mem->path);
+ search_launch_popup_error(LAUNCH_ERROR_APPSVC, ad);
+ }
+
+ bundle_free(bd);
+ }
+
+ 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;
+
+ if (access(cur_category_mem->path, F_OK) != 0) {
+ SEARCH_DEBUG_ERROR("music file access error : %s",
+ cur_category_mem->path);
+ search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND, ad);
+ } else {
+ SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
+ cur_category_mem->path);
+
+ bundle* bd = NULL;
+ bd = bundle_create();
+
+ if (bd != NULL) {
+ appsvc_set_operation(bd, APPSVC_OPERATION_VIEW);
+ appsvc_set_uri(bd, cur_category_mem->path);
+ ret = appsvc_run_service(bd, 0, NULL, NULL);
+
+ if (ret < 0) {
+ SEARCH_DEBUG_ERROR("music app service error(%d) : %s",
+ ret, cur_category_mem->path);
+ search_launch_popup_error(LAUNCH_ERROR_APPSVC,
+ ad);
+ }
+ bundle_free(bd);
+ }
+ }
+
+ 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;
+ struct ui_gadget *ug;
+ struct ug_cbs cbs = { 0, };
+
+ bundle *b;
+ int ret;
+
+ if (ad->detail_ug) {
+ SEARCH_DEBUG_WARNING("prev ug is exist. destroy prev ug");
+
+ __search_layout_ug_destroy(ad);
+ }
+
+ b = bundle_create();
+ if (!b)
+ return;
+
+ bundle_add(b, AUL_K_SERVICE_NAME, "view_event");
+ bundle_add(b, "index", cur_category_mem->main_id);
+
+ SEARCH_DEBUG_LOG("index : %s", cur_category_mem->main_id);
+
+ ret = aul_launch_app("org.tizen.efl-calendar", b);
+ if( (ret <= 0) && (ret != AUL_R_ETIMEOUT) ){
+ SEARCH_DEBUG_ERROR("calendar aul launch app error(%d)", ret);
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
+
+ bundle_free(b);
+
+ 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;
+ struct ui_gadget *ug;
+ struct ug_cbs cbs = { 0, };
+
+ bundle *b;
+
+ if (ad->detail_ug) {
+ SEARCH_DEBUG_WARNING("prev ug is exist. destroy prev ug");
+
+ __search_layout_ug_destroy(ad);
+ }
+
+ b = bundle_create();
+ if (!b)
+ return;
+
+ bundle_add(b, "index", cur_category_mem->main_id);
+
+ __search_create_effect_layout(ad->win_main, ad);
+
+ 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, b, &cbs);
+ if (!ug) {
+ SEARCH_DEBUG_ERROR("... create_ug_email : failed !!!");
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
+
+ ad->detail_ug = ug;
+
+ bundle_free(b);
+
+ 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;
+ int ret;
+
+ ret = aul_launch_app(cur_category_mem->path, NULL);
+
+ SEARCH_DEBUG_WARNING("path : %s, ret : %d", cur_category_mem->path, ret);
+
+ if( (ret <= 0) && (ret != AUL_R_ETIMEOUT) ){
+ SEARCH_DEBUG_ERROR("menu aul launch app error(%d) : %s", ret,
+ cur_category_mem->path);
+ search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
+ }
+
+ SEARCH_FUNC_END;
+}
+
+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;
+
+ 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;
+
+ 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;
+ }
+
+ 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,
+ dgettext("sys_string",
+ "IDS_COM_POP_SERVICE_UNAVAILABLE"));
+ break;
+ case LAUNCH_ERROR_APPSVC:
+ elm_object_text_set(popup,
+ dgettext("sys_string",
+ "IDS_COM_POP_SERVICE_UNAVAILABLE"));
+ break;
+ }
+
+ btn1 = elm_button_add(popup);
+ elm_object_text_set(btn1,
+ dgettext("sys_string","IDS_COM_SK_OK"));
+ 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..a46413d
--- /dev/null
+++ b/src/ps_makeupviews.cpp
@@ -0,0 +1,587 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#include "smartsearch.h"
+#include "ps_searcher.h"
+#include "ps_app_interface.h"
+
+static char *__search_get_phone_category_name(int type)
+{
+ SEARCH_FUNC_START;
+
+ char* name = NULL;
+
+ switch(type) {
+
+ case SEARCH_TYPE_PHONE_CONTACTS:
+ {
+ name = dgettext("sys_string", "IDS_COM_BODY_CONTACTS");
+ }
+ break;
+ case SEARCH_TYPE_PHONE_MSG:
+ {
+ name = dgettext("sys_string", "IDS_COM_BODY_MESSAGES");
+ }
+ break;
+ case SEARCH_TYPE_PHONE_EMAIL:
+ {
+ name = dgettext("sys_string", "IDS_COM_BODY_EMAIL");
+ }
+ break;
+ case SEARCH_TYPE_PHONE_IMAGES:
+ {
+ name = dgettext("sys_string", "IDS_COM_BODY_IMAGES");
+ }
+ break;
+ case SEARCH_TYPE_PHONE_MUSIC:
+ {
+ name = dgettext("sys_string", "IDS_COM_BODY_MUSIC");
+ }
+ break;
+ case SEARCH_TYPE_PHONE_VIDEO:
+ {
+ name = dgettext("sys_string", "IDS_COM_BODY_VIDEOS");
+ }
+ break;
+ case SEARCH_TYPE_PHONE_CALENDAR:
+ {
+ name = dgettext("sys_string", "IDS_COM_BODY_CALENDAR");
+ }
+ break;
+ case SEARCH_TYPE_PHONE_MEMO:
+ {
+ name = dgettext("sys_string", "IDS_COM_BODY_MEMO");
+ }
+ break;
+ case SEARCH_TYPE_PHONE_MENU:
+ {
+ name = dgettext("sys_string", "IDS_COM_BODY_APPLICATIONS");
+ }
+ break;
+ }
+
+ return name;
+}
+
+
+static Eina_Bool __search_gl_state_get(void *data, Evas_Object * obj,
+ const char *part)
+{
+ return EINA_FALSE;
+}
+
+static char *__search_gl_label_get(void *data, Evas_Object * obj,
+ const char *part)
+{
+ if (data == NULL) {
+ return g_strdup("");
+ }
+
+ char *buf;
+ struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+
+ if (!SEARCH_STRCMP(part, "elm.text") || !SEARCH_STRCMP(part, "elm.text.1")) {
+ buf = g_strdup(sel_mem_info->main_buf);
+ } else if (!SEARCH_STRCMP(part, "elm.text.sub") || !SEARCH_STRCMP(part, "elm.text.2")) {
+ buf = g_strdup(sel_mem_info->sub_buf);
+ } else {
+ buf = NULL;
+ }
+
+ return buf;
+}
+
+static char *__search_gl_label_get_title(void *data, Evas_Object * obj,
+ const char *part)
+{
+ SEARCH_FUNC_START;
+
+ char* category_name = NULL;
+
+ struct search_item_sel *sel_mem = (struct search_item_sel *)data;
+
+ category_name = __search_get_phone_category_name(sel_mem->type);
+
+ if(category_name)
+ return strdup(category_name);
+ else
+ return strdup("");
+}
+
+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(void *data, Evas_Object * obj)
+{
+ SEARCH_FUNC_START;
+
+ struct search_item_sel *sel_mem_info = (struct search_item_sel *)data;
+
+ SEARCH_FREE(sel_mem_info);
+
+ return;
+}
+
+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;
+ int ret = 0;
+
+ cur_category_mem =
+ (struct search_item_sel *)elm_object_item_data_get(it);
+ if (cur_category_mem == NULL) {
+ return;
+ }
+
+ switch (cur_category_mem->type) {
+
+ case SEARCH_TYPE_PHONE_CONTACTS:
+ search_launch_contact_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_TYPE_PHONE_MSG:
+ search_launch_msg_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_TYPE_PHONE_EMAIL:
+ search_launch_email_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_TYPE_PHONE_IMAGES:
+ search_launch_image_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_TYPE_PHONE_VIDEO:
+ search_launch_video_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_TYPE_PHONE_MUSIC:
+ search_launch_music_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_TYPE_PHONE_CALENDAR:
+ search_launch_calendar_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_TYPE_PHONE_MEMO:
+ search_launch_memo_view(ad, cur_category_mem);
+ break;
+
+ case SEARCH_TYPE_PHONE_MENU:
+ search_launch_menu_view(ad, cur_category_mem);
+ break;
+
+ default:
+ break;
+ }
+
+ elm_genlist_item_selected_set(it, EINA_FALSE);
+
+ SEARCH_FUNC_END;
+}
+
+void search_result_gl_init(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ 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.2";
+ ad->itc_pslist_1line->func.text_get = __search_gl_label_get;
+ ad->itc_pslist_1line->func.content_get = NULL;
+ ad->itc_pslist_1line->func.state_get = __search_gl_state_get;
+ ad->itc_pslist_1line->func.del = __search_gl_del;
+ }
+
+
+ if (ad->itc_pslist_2line == NULL) {
+ ad->itc_pslist_2line = elm_genlist_item_class_new();
+ ad->itc_pslist_2line->item_style = "2text.8";
+ ad->itc_pslist_2line->func.text_get = __search_gl_label_get;
+ ad->itc_pslist_2line->func.content_get = NULL;
+ ad->itc_pslist_2line->func.state_get = __search_gl_state_get;
+ ad->itc_pslist_2line->func.del = __search_gl_del;
+ }
+
+ if (ad->itc_grouptitle == NULL) {
+ ad->itc_grouptitle = elm_genlist_item_class_new();
+ ad->itc_grouptitle->item_style = "grouptitle";
+ ad->itc_grouptitle->func.text_get = __search_gl_label_get_title;
+ ad->itc_grouptitle->func.state_get = __search_gl_state_get;
+ ad->itc_grouptitle->func.del = __search_gl_del;
+ }
+
+ if (ad->itc_listmore == NULL) {
+ ad->itc_listmore = elm_genlist_item_class_new();
+ ad->itc_listmore->item_style = "1text.2";
+ 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;
+ }
+
+ ad->search_gl = NULL;
+
+ genlist = elm_genlist_add(ad->navi_bar);
+
+ // 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;
+
+ if (ad->itc_pslist_1line != NULL)
+ elm_genlist_item_class_free(ad->itc_pslist_1line);
+
+ if (ad->itc_pslist_2line != NULL)
+ elm_genlist_item_class_free(ad->itc_pslist_2line);
+
+ 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;
+}
+
+static int __search_gl_set_phone_search_result(int type, int offset, char *keyword,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ int rc = 0;
+ int category = 0;
+ int loop_cnt = 0;
+
+ int ret = 0;
+
+ int sel_cnt = SEARCH_CATEGORY_LIST_MORE_CNT + 1;
+ int func_ret = 1;
+
+ struct appdata *ad = (struct appdata *)data;
+ Evas_Object *glist;
+
+ ad->cate_info[type].offset = offset;
+
+ if (offset == 0) {
+ ad->cate_info[type].next_point = 0;
+ }
+
+ switch (type) {
+
+ case SEARCH_TYPE_PHONE_CONTACTS:
+ {
+ func_ret =
+ search_sql_contact_search_result_by_api(type,
+ offset,
+ sel_cnt,
+ data);
+ }
+ break;
+
+ case SEARCH_TYPE_PHONE_MSG:
+ {
+ if (ad->msg_handle != NULL) {
+ func_ret =
+ search_sql_msg_search_result_by_api(type,
+ offset,
+ sel_cnt,
+ data);
+ }
+ }
+ break;
+
+ case SEARCH_TYPE_PHONE_EMAIL:
+ {
+ func_ret =
+ search_sql_email_search_result_by_api(type,
+ offset,
+ sel_cnt,
+ data);
+ }
+ break;
+ case SEARCH_TYPE_PHONE_IMAGES:
+ {
+ if (ad->media_handle != NULL ) {
+ func_ret =
+ search_sql_image_search_result_by_api(type,
+ offset,
+ sel_cnt,
+ data);
+ }
+ }
+ break;
+ case SEARCH_TYPE_PHONE_MUSIC:
+ {
+ if (ad->media_handle != NULL ) {
+ func_ret =
+ search_sql_music_search_result_by_api(type,
+ offset,
+ sel_cnt,
+ data);
+ }
+ }
+ break;
+ case SEARCH_TYPE_PHONE_VIDEO:
+ {
+ if (ad->media_handle != NULL ) {
+ func_ret =
+ search_sql_video_search_result_by_api(type,
+ offset,
+ sel_cnt,
+ data);
+ }
+ }
+ break;
+
+ case SEARCH_TYPE_PHONE_CALENDAR:
+ {
+ func_ret =
+ search_sql_calendar_search_result_by_api(type,
+ offset,
+ sel_cnt,
+ data);
+ }
+ break;
+
+ case SEARCH_TYPE_PHONE_MEMO:
+ {
+ func_ret =
+ search_sql_memo_search_result_by_api(type,
+ offset,
+ sel_cnt,
+ data);
+ }
+ break;
+
+ case SEARCH_TYPE_PHONE_MENU:
+ {
+ func_ret =
+ search_sql_menu_search_result_by_api(type,
+ offset,
+ sel_cnt,
+ keyword,
+ data);
+ }
+ break;
+ }
+
+ SEARCH_FUNC_END;
+
+ return func_ret;
+}
+
+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;
+
+ int ret = 0;
+
+ struct search_item_sel *sel_mem =
+ (search_item_sel *) elm_object_item_data_get(it);
+ struct search_item_sel *sel_mem_info = NULL;
+ struct search_item_sel *sel_mem_more = NULL;
+
+ char* escape_added_keyword = NULL;
+ SEARCH_MALLOC(escape_added_keyword, strlen(ad->search_word)*2+5, char);
+ memset(escape_added_keyword, 0x0, strlen(ad->search_word)*2+5);
+
+ int rc = 0, i = 0;
+ int type = sel_mem->type;
+ int offset = ad->cate_info[type].next_point;
+
+ search_sql_make_keyword_bind_value(ad->search_word, escape_added_keyword, SEARCH_SQL_BIND_TYPE_DUPLEX);
+
+ elm_object_item_del(it);
+
+ __search_gl_set_phone_search_result(type, offset, escape_added_keyword, ad);
+
+ SEARCH_FUNC_END;
+}
+
+static int __search_set_phone_result_list(struct appdata *ad, bool is_input_keyword, const char* search_keyword)
+{
+ SEARCH_FUNC_START;
+
+ int i = 0, is_search_result = 0, ret = 0;
+
+ if (is_input_keyword == false) {
+ return SEARCH_RET_SEARCH_NONE;
+ } else {
+
+ int offset = 0;
+
+ while (i < PHONE_CATEGORY_LIST_CNT) {
+ ret = __search_gl_set_phone_search_result(i,
+ offset,
+ (char*)search_keyword,
+ ad);
+ if (ret == SEARCH_RET_SEARCH_SUCCESS) {
+ is_search_result = 1;
+ }
+
+ i++;
+ }
+
+ if(is_search_result == 0) {
+ return SEARCH_RET_SEARCH_NONE;
+ } else {
+ return SEARCH_RET_SEARCH_SUCCESS;
+ }
+ }
+}
+
+Eina_Bool search_set_result_list(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ char *text;
+ int ret = 0;
+ bool is_input_keyword = false;
+ char* escape_added_keyword = NULL;
+ int bind_type = 0;
+ int search_ret = SEARCH_RET_SEARCH_NONE;
+
+ SEARCH_ASSERT_IF(!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)) {
+ ad->not_markup_search_word = strdup(elm_object_text_get(ad->search_entry));
+ ad->search_word = text;
+
+ SEARCH_MALLOC(escape_added_keyword, strlen(ad->search_word)*2+5, char);
+ memset(escape_added_keyword, 0x0, strlen(ad->search_word)*2+5);
+
+ bind_type = SEARCH_SQL_BIND_TYPE_DUPLEX;
+
+ search_sql_make_keyword_bind_value(ad->search_word, escape_added_keyword, bind_type);
+ is_input_keyword = true;
+
+ elm_genlist_clear(ad->search_gl);
+
+ search_ret = __search_set_phone_result_list(ad, is_input_keyword, ad->search_word);
+ }
+
+ if(search_ret == SEARCH_RET_SEARCH_SUCCESS) {
+ search_layout_set_search_list(ad);
+ } else {
+ search_layout_set_search_no_result(ad);
+ }
+
+ SEARCH_FREE(escape_added_keyword);
+
+ SEARCH_FUNC_END;
+
+ return EINA_FALSE;
+}
+
+void search_layout_set_search_list(void* data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ 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);
+
+ elm_object_part_content_set(ad->sb_layout, "list", ad->search_gl);
+ evas_object_show(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;
+
+ if (elm_object_part_content_get(ad->sb_layout,"list")) {
+ elm_object_part_content_unset(ad->sb_layout, "list");
+ 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;
+
+ 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..58414c6
--- /dev/null
+++ b/src/ps_searcher.cpp
@@ -0,0 +1,1496 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#include "smartsearch.h"
+
+#include <sqlite3.h>
+
+#include <contacts-svc.h>
+#include <calendar-svc-provider.h>
+#include <memo-db.h>
+
+#include <email-types.h>
+#include <email-api.h>
+
+#include <visual-svc.h>
+#include <visual-svc-types.h>
+#include <audio-svc.h>
+#include <audio-svc-types.h>
+#include <audio-svc-error.h>
+
+#include <ail.h>
+
+static GList *g_history_list;
+
+char* g_keyword = NULL;
+
+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;
+}
+
+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;
+}
+
+static int __search_sql_contact_search_result_cb(CTSvalue * value,
+ void *user_data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)user_data;
+
+ struct search_item_sel *sel_mem = NULL;
+ int type = SEARCH_TYPE_PHONE_CONTACTS;
+
+ struct search_item_sel *sel_mem_info = NULL;
+ char display_name[128] = { 0, };
+ const char *first, *last, *display, *number;
+
+ bool is_word_in_str;
+
+ if (ad->cate_info[type].next_point == 0) {
+ //### Set group title
+
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct
+ search_item_sel));
+ sel_mem->type = type;
+
+ ad->gl_result_group_item[type] =
+ elm_genlist_item_append(ad->search_gl,
+ (ad->itc_grouptitle), sel_mem,
+ (Elm_Object_Item *) NULL,
+ ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ }
+
+ if (ad->cate_info[type].next_point <
+ ad->cate_info[type].offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
+ sel_mem_info =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct
+ search_item_sel));
+ sel_mem_info->type = type;
+
+ /************ START : set search result to sel_mem_info buf ************/
+
+ /***********************************************************************/
+
+ memset(display_name, 0x00, sizeof(display_name));
+
+ display =
+ contacts_svc_value_get_str(value,
+ CTS_LIST_NUM_CONTACT_DISPLAY_STR);
+
+ if (display) {
+ snprintf(display_name, sizeof(display_name), "%s",
+ display);
+ } else {
+ first =
+ contacts_svc_value_get_str(value,
+ CTS_LIST_NUM_CONTACT_FIRST_STR);
+ last =
+ contacts_svc_value_get_str(value,
+ CTS_LIST_NUM_CONTACT_LAST_STR);
+
+ if (CTS_ORDER_NAME_FIRSTLAST ==
+ contacts_svc_get_order(CTS_ORDER_OF_DISPLAY)) {
+ if (first) {
+ if (last) {
+ snprintf(display_name,
+ sizeof(display_name),
+ "%s %s", first, last);
+ } else {
+ snprintf(display_name,
+ sizeof(display_name),
+ "%s", first);
+ }
+ } else {
+ if (last) {
+ snprintf(display_name,
+ sizeof(display_name),
+ "%s", last);
+ }
+ }
+ } else {
+ if (last) {
+ if (first) {
+ snprintf(display_name,
+ sizeof(display_name),
+ "%s %s", last, first);
+ } else {
+ snprintf(display_name,
+ sizeof(display_name),
+ "%s", last);
+ }
+ } else {
+ if (first) {
+ snprintf(display_name,
+ sizeof(display_name),
+ "%s", first);
+ }
+ }
+ }
+ }
+
+ if((display_name) && strlen(display_name) > 0) {
+ char* markup_text_1line = elm_entry_utf8_to_markup(display_name);
+
+ strncpy(sel_mem_info->main_buf,
+ search_markup_keyword(markup_text_1line, ad->not_markup_search_word, &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+
+ SEARCH_FREE(markup_text_1line);
+ }
+
+ /***********************************************************************/
+
+ number = contacts_svc_value_get_str(value, CTS_LIST_NUM_NUMBER_STR);
+
+ if((number) && strlen(number) > 0) {
+ char* markup_text_2line = elm_entry_utf8_to_markup(number);
+
+ strncpy(sel_mem_info->sub_buf,
+ search_markup_keyword(markup_text_2line, ad->not_markup_search_word, &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_2line);
+ }
+
+ /***********************************************************************/
+
+ snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID - 1, "%d",
+ contacts_svc_value_get_int(value,
+ CTS_LIST_NUM_CONTACT_ID_INT));
+
+ /***********************************************************************/
+ /************ END : set search result to sel_mem_info buf **************/
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_pslist_2line),
+ sel_mem_info,
+ ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_phone_result_sel, ad);
+
+ ad->cate_info[type].next_point++;
+ } else if (ad->cate_info[type].next_point ==
+ ad->cate_info[type].offset +
+ SEARCH_CATEGORY_LIST_MORE_CNT) {
+ /* Set more title to genlist (under 'search all') */
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct
+ search_item_sel));
+ sel_mem->type = type;
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_listmore),
+ sel_mem, ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_result_more_item_append_cb,
+ ad);
+ } else {
+ SEARCH_DEBUG_WARNING
+ ("__search_sql_contact_search_result_cb wrong index : %d",
+ ad->cate_info[type].next_point);
+ }
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+int search_sql_contact_search_result_by_api(int type, int offset, int limit,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ int ret = 0;
+
+ /* Check whether search result is exist or not */
+ ret =
+ contacts_svc_smartsearch_excl(ad->search_word, limit, offset,
+ __search_sql_contact_search_result_cb,
+ data);
+ if (ret != CTS_SUCCESS) {
+ SEARCH_DEBUG_WARNING("contacts svc search return error : %d",
+ ret);
+ return SEARCH_RET_SEARCH_FAIL;
+ }
+
+ if (ad->cate_info[type].next_point == 0) {
+ SEARCH_DEBUG_WARNING("contacts svc search no result");
+ return SEARCH_RET_SEARCH_NONE;
+ }
+
+ SEARCH_FUNC_END;
+
+ return SEARCH_RET_SEARCH_SUCCESS;
+}
+
+int search_sql_calendar_search_result_by_api(int type, int offset, int limit,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ int ret;
+ struct appdata *ad = (struct appdata *)data;
+
+ cal_struct *event = NULL;
+ cal_iter *iter = NULL;
+
+ struct search_item_sel *sel_mem = NULL;
+ Elm_Object_Item *git = NULL;
+ Evas_Object *glist;
+
+ struct search_item_sel *sel_mem_info = NULL;
+ int loop_cnt = 0;
+
+ char *summary = NULL;
+ bool is_word_in_str;
+
+ time_t start_time = 0;
+
+ ret =
+ calendar_svc_search_list(0, 0, CAL_STRUCT_SCHEDULE,
+ CAL_VALUE_TXT_SUMMARY, ad->search_word,
+ offset, limit, &iter);
+
+ if (ret == CAL_SUCCESS) {
+ ret = calendar_svc_iter_next(iter);
+ if (ret != CAL_SUCCESS) {
+ SEARCH_DEBUG_WARNING
+ ("calendar svc search no result : %d", ret);
+ return SEARCH_RET_SEARCH_NONE;
+ }
+ /* Set group title */
+ glist = ad->search_gl;
+
+ if (offset == 0) {
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct
+ search_item_sel));
+ sel_mem->type = type;
+
+ git =
+ elm_genlist_item_append(glist,
+ (ad->itc_grouptitle),
+ sel_mem,
+ (Elm_Object_Item *) NULL,
+ ELM_GENLIST_ITEM_GROUP,
+ NULL, NULL);
+
+ ad->gl_result_group_item[type] = git;
+ }
+ /* Set search result to genlist */
+ do {
+ loop_cnt++;
+
+ if (loop_cnt == limit) {
+ break;
+ }
+ /********** START : set search result to sel_mem_info buf ************/
+
+ ret = calendar_svc_iter_get_info(iter, &event);
+
+ if (ret == CAL_SUCCESS) {
+ sel_mem_info =
+ (struct search_item_sel *)calloc(1,
+ sizeof
+ (struct
+ search_item_sel));
+ sel_mem_info->type = type;
+
+ summary =
+ calendar_svc_struct_get_str(event,
+ CAL_VALUE_TXT_SUMMARY);
+
+ if ((summary) && (strlen(summary) > 0)) {
+ char* markup_text_1line = elm_entry_utf8_to_markup(summary);
+
+ strncpy(sel_mem_info->main_buf,
+ search_markup_keyword(markup_text_1line,
+ ad->not_markup_search_word,
+ &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+
+ SEARCH_FREE(markup_text_1line);
+ }
+
+ snprintf(sel_mem_info->main_id,
+ MAX_LENGTH_PER_ID - 1, "%d",
+ calendar_svc_struct_get_int(event,
+ CAL_VALUE_INT_INDEX));
+
+ start_time =
+ calendar_svc_struct_get_time(event,
+ CAL_VALUE_GMT_START_DATE_TIME,
+ CAL_TZ_FLAG_GMT);
+ search_util_date_time_format_get_val(localtime
+ (&start_time),
+ sel_mem_info->sub_buf);
+
+ calendar_svc_struct_free(&event);
+ summary = NULL;
+
+ elm_genlist_item_append(glist,
+ (ad->itc_pslist_1line),
+ sel_mem_info,
+ ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_phone_result_sel,
+ ad);
+ sel_mem_info = NULL;
+ } else {
+ SEARCH_DEBUG_WARNING
+ ("calendar_svc_iter_get_info fail : %d",
+ ret);
+ break;
+ }
+
+ }
+ while (calendar_svc_iter_next(iter) == CAL_SUCCESS);
+ } else {
+ SEARCH_DEBUG_WARNING("calendar_svc_search_list fail : %d", ret);
+ return SEARCH_RET_SEARCH_FAIL;
+ }
+
+ /* Set more title to genlist (under 'search all') */
+ if (loop_cnt == limit) {
+ ad->cate_info[type].next_point = offset + limit - 1;
+
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct
+ search_item_sel));
+ sel_mem->type = type;
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_listmore),
+ sel_mem, ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_result_more_item_append_cb,
+ ad);
+ }
+
+ SEARCH_FUNC_END;
+ return SEARCH_RET_SEARCH_SUCCESS;
+}
+
+static void __search_sql_memo_search_result_cb(memo_data_t * value,
+ void *user_data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)user_data;
+
+ struct search_item_sel *sel_mem = NULL;
+ int type = SEARCH_TYPE_PHONE_MEMO;
+
+ struct search_item_sel *sel_mem_info = NULL;
+
+ bool is_word_in_str;
+
+ if(!value) {
+ SEARCH_DEBUG_WARNING("memo data value is null");
+ return;
+ }
+
+ if (ad->cate_info[type].next_point == 0) {
+ /* Set group title */
+
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct
+ search_item_sel));
+ sel_mem->type = type;
+
+ ad->gl_result_group_item[type] =
+ elm_genlist_item_append(ad->search_gl,
+ (ad->itc_grouptitle), sel_mem,
+ (Elm_Object_Item *) NULL,
+ ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+ }
+
+ if (ad->cate_info[type].next_point <
+ ad->cate_info[type].offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
+ sel_mem_info =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct
+ search_item_sel));
+ sel_mem_info->type = type;
+
+ /********** START : set search result to sel_mem_info buf ************/
+ /* 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)) {
+ char* markup_text_1line = elm_entry_utf8_to_markup(value->comment);
+
+ strncpy(sel_mem_info->main_buf,
+ search_markup_keyword(markup_text_1line, ad->not_markup_search_word,
+ &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+
+ SEARCH_FREE(markup_text_1line);
+ } else if ((value->content) && (strlen(value->content) > 0)) {
+ char* markup_text_1line = elm_entry_utf8_to_markup(value->content);
+
+ strncpy(sel_mem_info->main_buf,
+ search_markup_keyword(markup_text_1line, ad->not_markup_search_word,
+ &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+
+ SEARCH_FREE(markup_text_1line);
+ }
+ snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID - 1, "%d", value->id);
+
+ search_util_date_time_format_get_val(localtime
+ (&value->modi_time),
+ sel_mem_info->sub_buf);
+
+ /********** END : set search result to sel_mem_info buf *************/
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_pslist_1line),
+ sel_mem_info,
+ ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_phone_result_sel, ad);
+
+ ad->cate_info[type].next_point++;
+ } else if (ad->cate_info[type].next_point ==
+ ad->cate_info[type].offset +
+ SEARCH_CATEGORY_LIST_MORE_CNT) {
+ /* Set more title to genlist (under 'search all') */
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct
+ search_item_sel));
+ sel_mem->type = type;
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_listmore),
+ sel_mem, ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_result_more_item_append_cb,
+ ad);
+ } else {
+ SEARCH_DEBUG_WARNING
+ ("__search_sql_memo_search_result_cb wrong index : %d",
+ ad->cate_info[type].next_point);
+ }
+
+ SEARCH_FUNC_END;
+
+ return;
+}
+
+int search_sql_memo_search_result_by_api(int type, int offset, int limit,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ memo_search_data(ad->search_word,
+ limit, offset,
+ MEMO_SORT_TITLE_ASC,
+ __search_sql_memo_search_result_cb,
+ data);
+
+ if (ad->cate_info[type].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(int type, int offset, int limit,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ int result_cnt = 0;
+ int ret = 0;
+ int i = 0;
+ emf_mail_list_item_t *mail_list = NULL;
+
+ struct search_item_sel *sel_mem = NULL;
+ Elm_Object_Item *git = NULL;
+ Evas_Object *glist;
+
+ struct search_item_sel *sel_mem_info = NULL;
+ bool is_word_in_str;
+
+ ret = email_find_mail(0, NULL, 0, EMF_SEARCH_FILTER_ALL ,
+ ad->search_word, offset, limit, EMF_SORT_DATETIME_HIGH,
+ &mail_list, &result_cnt);
+
+ if(ret < 1) {
+ SEARCH_DEBUG_WARNING("no email search result");
+ return SEARCH_RET_SEARCH_FAIL;
+ }
+
+ if(result_cnt == 0) {
+ SEARCH_DEBUG_WARNING("no email search result");
+ return SEARCH_RET_SEARCH_NONE;
+ }
+
+ if(mail_list == NULL) {
+ SEARCH_DEBUG_WARNING("mail_list is null");
+ return SEARCH_RET_SEARCH_NONE;
+ }
+
+ /* Set group title */
+ glist = ad->search_gl;
+
+ if (offset == 0) {
+ sel_mem = (struct search_item_sel *)calloc(1,
+ sizeof(struct search_item_sel));
+
+ sel_mem->type = type;
+
+ git = elm_genlist_item_append(glist,
+ (ad->itc_grouptitle),
+ sel_mem,
+ (Elm_Object_Item *) NULL,
+ ELM_GENLIST_ITEM_GROUP,
+ NULL, NULL);
+
+ ad->gl_result_group_item[type] = git;
+ }
+
+ /* Set search result to genlist */
+ for(i=0;i<result_cnt;i++) {
+
+ if(i == limit -1)
+ break;
+
+ sel_mem_info = (struct search_item_sel *)calloc(1,
+ sizeof(struct search_item_sel));
+
+ sel_mem_info->type = type;
+
+ snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID - 1, "%d", mail_list[i].mail_id);
+
+ snprintf(sel_mem_info->path, MAX_LENGTH_PER_PATH - 1, "%d %d %s",
+ mail_list[i].account_id, mail_list[i].mail_id, mail_list[i].mailbox_name);
+
+ SEARCH_DEBUG_LOG("subject : %s", mail_list[i].subject);
+
+ if((mail_list[i].subject) && (strlen(mail_list[i].subject) > 0)) {
+ char* markup_text_1line = elm_entry_utf8_to_markup(mail_list[i].subject);
+
+ strncpy(sel_mem_info->main_buf,
+ search_markup_keyword(markup_text_1line, ad->not_markup_search_word, &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_1line);
+ }
+
+ if((mail_list[i].from) && (strlen(mail_list[i].from) > 0)) {
+ char* markup_text_2line = elm_entry_utf8_to_markup(mail_list[i].from);
+
+ strncpy(sel_mem_info->sub_buf,
+ search_markup_keyword(markup_text_2line, ad->not_markup_search_word, &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_2line);
+ }
+
+ if(is_word_in_str == false && (mail_list[i].recipients) && (strlen(mail_list[i].recipients) > 0)) {
+ char* markup_text_2line = elm_entry_utf8_to_markup(mail_list[i].recipients);
+
+ strncpy(sel_mem_info->sub_buf,
+ search_markup_keyword(markup_text_2line, ad->not_markup_search_word, &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_2line);
+ }
+
+ elm_genlist_item_append(glist,
+ (ad->itc_pslist_2line),
+ sel_mem_info,
+ ad->gl_result_group_item
+ [type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_phone_result_sel,
+ ad);
+ sel_mem_info = NULL;
+ }
+
+ SEARCH_FREE(mail_list);
+
+ /* Set more title to genlist (under 'search all') */
+ if (result_cnt == limit) {
+ ad->cate_info[type].next_point = offset + result_cnt - 1;
+
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct search_item_sel));
+ sel_mem->type = type;
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_listmore),
+ sel_mem, ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_result_more_item_append_cb,
+ ad);
+ }
+
+ SEARCH_FUNC_END;
+ return SEARCH_RET_SEARCH_SUCCESS;
+}
+
+static int __search_sql_media_search_item_list_search_cb( Mitem* item, void* user_data)
+{
+ GList** list = (GList**) user_data;
+ *list = g_list_append( *list, item );
+
+ return 0;
+}
+
+static int __search_sql_media_search_result_by_api(int type, int offset, int limit,
+ minfo_file_type media_type, void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ int result_cnt = 0;
+ int ret = 0;
+ int i = 0;
+ int func_ret = SEARCH_RET_SEARCH_SUCCESS;
+
+ struct search_item_sel *sel_mem = NULL;
+ Elm_Object_Item *git = NULL;
+ Evas_Object *glist;
+
+ struct search_item_sel *sel_mem_info = NULL;
+ bool is_word_in_str;
+
+ GList *p_media_list = NULL;
+ Mitem* item = NULL;
+ minfo_item_filter item_filter;
+
+ memset(&item_filter, 0x00, sizeof(minfo_item_filter));
+
+ minfo_search_field_t search_field = MINFO_SEARCH_BY_NAME;
+ minfo_folder_type folder_type = MINFO_CLUSTER_TYPE_ALL;
+
+ item_filter.file_type = media_type;
+
+ /* MINFO_MEDIA_SORT_BY_NAME_DESC, MINFO_MEDIA_SORT_BY_DATE_DESC, MINFO_MEDIA_SORT_BY_DATE_ASC ... */
+ item_filter.sort_type = MINFO_MEDIA_SORT_BY_NAME_ASC;
+
+ item_filter.start_pos = offset;
+ item_filter.end_pos = offset+limit-1;
+
+ item_filter.with_meta = 0;
+ item_filter.favorite = MINFO_MEDIA_FAV_ALL;
+
+ /* get a set of items */
+ ret = minfo_get_item_list_search(ad->media_handle,
+ search_field,
+ ad->search_word,
+ folder_type,
+ item_filter,
+ __search_sql_media_search_item_list_search_cb,
+ &p_media_list);
+ if (ret < 0) {
+ SEARCH_DEBUG_WARNING("minfo_get_item_list_search failed : %d\n", ret);
+ func_ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ if (p_media_list == NULL) {
+ SEARCH_DEBUG_WARNING("minfo_get_item_list_search media list null\n");
+ func_ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ result_cnt = g_list_length(p_media_list);
+ if (result_cnt == 0) {
+ SEARCH_DEBUG_WARNING("minfo_item_list length 0\n");
+ func_ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ /* Set group title */
+ glist = ad->search_gl;
+
+ if (offset == 0) {
+ sel_mem = (struct search_item_sel *)calloc(1,
+ sizeof(struct search_item_sel));
+
+ sel_mem->type = type;
+
+ git = elm_genlist_item_append(glist,
+ (ad->itc_grouptitle),
+ sel_mem,
+ (Elm_Object_Item *) NULL,
+ ELM_GENLIST_ITEM_GROUP,
+ NULL, NULL);
+
+ ad->gl_result_group_item[type] = git;
+ }
+
+ /* Set search result to genlist */
+ for (i = 0; i < result_cnt; i++) {
+
+ if(i == limit -1)
+ break;
+
+ item = NULL;
+ item = (Mitem*)g_list_nth_data(p_media_list, i);
+
+ if(item == NULL) {
+ break;
+ }
+
+ sel_mem_info = (struct search_item_sel *)calloc(1,
+ sizeof(struct search_item_sel));
+
+ sel_mem_info->type = type;
+
+ if ((item->display_name) && (strlen(item->display_name) > 0)) {
+ char* markup_text_1line = elm_entry_utf8_to_markup(item->display_name);
+
+ strncpy(sel_mem_info->main_buf,
+ search_markup_keyword(markup_text_1line,
+ ad->not_markup_search_word,
+ &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_1line);
+ }
+
+ snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID, "%d",
+ item->type);
+
+ snprintf(sel_mem_info->path, MAX_LENGTH_PER_PATH - 1, "%s",
+ item->file_url);
+
+ elm_genlist_item_append(glist,
+ (ad->itc_pslist_1line),
+ sel_mem_info,
+ ad->gl_result_group_item
+ [type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_phone_result_sel,
+ ad);
+ sel_mem_info = NULL;
+ }
+
+ /* delete list to avoid memory leak */
+ for (i = 0; i < result_cnt; i++) {
+ item = (Mitem*)g_list_nth_data(p_media_list, i);
+ minfo_destroy_mtype_item(item);
+ }
+
+ g_list_free(p_media_list);
+ p_media_list = NULL;
+
+ /* Set more title to genlist (under 'search all') */
+ if (result_cnt == limit) {
+ ad->cate_info[type].next_point = offset + result_cnt - 1;
+
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct search_item_sel));
+ sel_mem->type = type;
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_listmore),
+ sel_mem, ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_result_more_item_append_cb,
+ ad);
+ }
+
+out_func:
+ SEARCH_FUNC_END;
+ return SEARCH_RET_SEARCH_SUCCESS;
+}
+
+
+int search_sql_image_search_result_by_api(int type, int offset, int limit,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ int ret;
+
+ ret = __search_sql_media_search_result_by_api(type,
+ offset,
+ limit,
+ MINFO_ITEM_IMAGE,
+ data);
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+int search_sql_video_search_result_by_api(int type, int offset, int limit,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ int ret;
+
+ ret = __search_sql_media_search_result_by_api(type,
+ offset,
+ limit,
+ MINFO_ITEM_VIDEO,
+ data);
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+int search_sql_music_search_result_by_api(int type, int offset, int limit,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ int loop_cnt = 0;
+ int ret = SEARCH_RET_SEARCH_NONE;
+ int i = 0;
+ int rc = 0;
+
+ struct search_item_sel *sel_mem = NULL;
+ Elm_Object_Item *git = NULL;
+
+ struct search_item_sel *sel_mem_info = NULL;
+ bool is_word_in_str;
+
+ AudioHandleType *handle = NULL;
+
+ rc = audio_svc_search_item_new(&handle, limit);
+ if (rc < 0) {
+ SEARCH_DEBUG_WARNING("audio_svc_search_item_new failed:%d\n",
+ rc);
+ return -1;
+ }
+
+ rc = audio_svc_list_by_search(ad->media_handle,
+ handle,
+ AUDIO_SVC_ORDER_BY_TITLE_ASC,
+ offset,
+ limit,
+ AUDIO_SVC_SEARCH_TITLE,
+ ad->search_word,
+ strlen(ad->search_word),
+ AUDIO_SVC_SEARCH_ALBUM,
+ ad->search_word,
+ strlen(ad->search_word),
+ AUDIO_SVC_SEARCH_ARTIST,
+ ad->search_word,
+ strlen(ad->search_word),
+ -1);
+
+ if (rc != AUDIO_SVC_ERROR_NONE) {
+ SEARCH_DEBUG_WARNING("audio_svc_list_by_search error : %d",
+ rc);
+
+ ret = SEARCH_RET_SEARCH_FAIL;
+ goto out_func;
+ }
+
+ for (loop_cnt = 0; loop_cnt < limit; loop_cnt++) {
+ AudioHandleType *item = NULL;
+ char *title = NULL;
+ char *artist = NULL;
+ char *pathname = NULL;
+ char *album = NULL;
+ int size = 0;
+ char* audio_id = NULL;
+
+ rc = audio_svc_search_item_get(handle, loop_cnt, &item);
+ if (rc < 0) {
+ break;
+ } else {
+ if (loop_cnt == limit -1)
+ break;
+
+ audio_svc_item_get_val(item,
+ AUDIO_SVC_TRACK_DATA_AUDIO_ID, &audio_id, &size,
+ AUDIO_SVC_TRACK_DATA_PATHNAME, &pathname, &size,
+ AUDIO_SVC_TRACK_DATA_TITLE, &title, &size,
+ AUDIO_SVC_TRACK_DATA_ARTIST, &artist, &size,
+ AUDIO_SVC_TRACK_DATA_ALBUM, &album, &size,
+ -1);
+
+ if( audio_id == NULL) {
+ SEARCH_DEBUG_WARNING("audio_id value error. loop break");
+ break;
+ }
+
+ ret = SEARCH_RET_SEARCH_SUCCESS;
+
+ if ((loop_cnt == 0) && (offset == 0)) {
+ /* Set group title */
+ sel_mem = (struct search_item_sel *)calloc(1,
+ sizeof(struct search_item_sel));
+
+ sel_mem->type = type;
+
+ git = elm_genlist_item_append(ad->search_gl,
+ (ad->itc_grouptitle),
+ sel_mem,
+ (Elm_Object_Item *) NULL,
+ ELM_GENLIST_ITEM_GROUP,
+ NULL, NULL);
+
+ ad->gl_result_group_item[type] = git;
+ }
+
+ sel_mem_info = (struct search_item_sel *)calloc(1,
+ sizeof(struct search_item_sel));
+
+ sel_mem_info->type = type;
+
+ if ((title) && (strlen(title) > 0)) {
+ char* markup_text_1line = elm_entry_utf8_to_markup(title);
+
+ strncpy(sel_mem_info->main_buf,
+ search_markup_keyword(markup_text_1line, ad->not_markup_search_word, &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_1line);
+ }
+
+ if (is_word_in_str) {
+ if ((artist) && (strlen(artist) > 0)) {
+ char* markup_text_2line = elm_entry_utf8_to_markup(artist);
+
+ strncpy(sel_mem_info->sub_buf,
+ search_markup_keyword(markup_text_2line,
+ ad->not_markup_search_word,
+ &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_2line);
+ }
+ } else {
+ memset(sel_mem_info->sub_buf, '\0', MAX_LENGTH_PER_LINE);
+
+ if ((artist) && (strlen(artist) > 0)) {
+ char* markup_text_2line = elm_entry_utf8_to_markup(artist);
+
+ strncpy(sel_mem_info->sub_buf,
+ search_markup_keyword(markup_text_2line,
+ ad->not_markup_search_word,
+ &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_2line);
+ }
+
+ if (is_word_in_str == false && (album) && (strlen(album) > 0)) {
+ char* markup_text_2line = elm_entry_utf8_to_markup(album);
+
+ strncpy(sel_mem_info->sub_buf,
+ search_markup_keyword(markup_text_2line,
+ ad->not_markup_search_word,
+ &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_2line);
+ }
+
+ if (is_word_in_str == false) {
+ SEARCH_DEBUG_LOG("search_result is 0. No match keyword in title,album,artist string");
+ }
+ }
+
+ snprintf(sel_mem_info->main_id,
+ MAX_LENGTH_PER_ID - 1, "%s", audio_id);
+
+ strncpy(sel_mem_info->path, pathname, MAX_LENGTH_PER_PATH);
+
+ elm_genlist_item_append(ad->search_gl,
+ (ad->itc_pslist_2line),
+ sel_mem_info,
+ ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_phone_result_sel,
+ ad);
+ sel_mem_info = NULL;
+ }
+ }
+
+ /* Set more title to genlist (under 'search all') */
+ if (loop_cnt == limit) {
+ ad->cate_info[type].next_point = offset + loop_cnt - 1;
+
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct search_item_sel));
+ sel_mem->type = type;
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_listmore),
+ sel_mem, ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_result_more_item_append_cb,
+ ad);
+ }
+
+out_func:
+
+ audio_svc_search_item_free(handle);
+
+ 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 appdata *ad = (struct appdata *)data;
+
+ struct search_item_sel *sel_mem = NULL;
+ struct search_item_sel *sel_mem_info = NULL;
+
+ int type = SEARCH_TYPE_PHONE_MENU;
+
+ bool is_word_in_str;
+ ail_cb_ret_e ret;
+
+ if(ad->cate_info[type].loop_cnt < ad->cate_info[type].next_point) {
+ ad->cate_info[type].loop_cnt++;
+ return AIL_CB_RET_CONTINUE;
+ }
+
+ if(ad->cate_info[type].next_point <
+ ad->cate_info[type].offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
+
+ sel_mem_info = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
+ sel_mem_info->type = type;
+
+ /********** START : set search result to sel_mem_info buf ************/
+
+ char *name = NULL;
+ char *package = NULL;
+
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
+ if ((package) && (strlen(package) > 0)) {
+
+ if(strcmp(package, SEARCHPKG) == 0) {
+ ad->cate_info[type].loop_cnt++;
+ SEARCH_FREE(sel_mem_info);
+ return AIL_CB_RET_CONTINUE;
+ }
+
+ strncpy(sel_mem_info->path, package, MAX_LENGTH_PER_PATH - 1);
+ }
+
+ ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &name);
+ if ((name) && (strlen(name) > 0)) {
+ char* markup_text_1line = elm_entry_utf8_to_markup(name);
+
+ strncpy(sel_mem_info->main_buf,
+ search_markup_keyword(markup_text_1line, ad->not_markup_search_word,&is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_1line);
+
+ SEARCH_DEBUG_LOG("name : %s", name);
+ } else {
+ SEARCH_DEBUG_LOG("name : null");
+}
+if(ad->cate_info[type].next_point == 0) {
+ /* Set group title */
+ sel_mem = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
+ sel_mem->type = type;
+ ad->gl_result_group_item[type] = elm_genlist_item_append(
+ ad->search_gl,
+ (ad->itc_grouptitle),
+ sel_mem,
+ (Elm_Object_Item *) NULL,
+ ELM_GENLIST_ITEM_GROUP,
+ NULL,
+ NULL);
+ }
+
+ /********** END : set search result to sel_mem_info buf *************/
+
+ elm_genlist_item_append(ad->search_gl,
+ (ad->itc_pslist_1line),
+ sel_mem_info,
+ ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_phone_result_sel,
+ ad);
+
+ ad->cate_info[type].next_point++;
+ ad->cate_info[type].loop_cnt++;
+
+ ret = AIL_CB_RET_CONTINUE;
+
+ } else if (ad->cate_info[type].next_point ==
+ ad->cate_info[type].offset + SEARCH_CATEGORY_LIST_MORE_CNT) {
+
+ /* Check that only "SMARTSEARCH" is left in more result */
+ if(ad->cate_info[type].next_point == ad->cate_info[type].result_cnt-1) {
+
+ char *package = NULL;
+
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
+ if ((package) && (strlen(package) > 0) && (strcmp(package, SEARCHPKG) == 0)) {
+ return AIL_CB_RET_CANCEL;
+ }
+ }
+
+ /* Set more title to genlist (under 'search all') */
+ sel_mem = (struct search_item_sel *)calloc(1, sizeof(struct search_item_sel));
+ sel_mem->type = type;
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_listmore),
+ sel_mem, ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_result_more_item_append_cb,
+ ad);
+
+ ret = AIL_CB_RET_CANCEL;
+ } else {
+ SEARCH_DEBUG_WARNING
+ ("__search_sql_memo_search_result_cb wrong index : %d",
+ ad->cate_info[type].next_point);
+
+ ret = AIL_CB_RET_CANCEL;
+ }
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+int search_sql_menu_search_result_by_api(int type, int offset, int limit,
+ char *keyword, void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ int cnt = 0;
+ int ret = 0;
+
+ ail_filter_h filter;
+ ail_error_e rc;
+
+ rc = ail_filter_new(&filter);
+ if (rc != AIL_ERROR_OK) {
+ SEARCH_DEBUG_WARNING("menu search - ail_filter_new error : %d", rc);
+ return SEARCH_RET_SEARCH_FAIL;
+ }
+
+ rc = ail_filter_add_str(filter, AIL_PROP_NAME_STR, 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;
+ }
+
+ ad->cate_info[type].result_cnt = cnt;
+
+ if(cnt > 0) {
+ ad->cate_info[type].loop_cnt = 0;
+ rc = ail_filter_list_appinfo_foreach(filter, __search_sql_menu_search_result_cb, data);
+ 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(ad->cate_info[type].next_point == 0) {
+ ret = SEARCH_RET_SEARCH_NONE;
+ } else {
+ ret = SEARCH_RET_SEARCH_SUCCESS;
+ }
+ } else {
+ ret = SEARCH_RET_SEARCH_NONE;
+ }
+
+out_func:
+ ail_filter_destroy(filter);
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+int search_sql_msg_search_result_by_api(int type, int offset, int limit,
+ void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ int loop_cnt = 0;
+ int ret = 0;
+
+ struct search_item_sel *sel_mem = NULL;
+ Elm_Object_Item *git = NULL;
+
+ struct search_item_sel *sel_mem_info = NULL;
+ bool is_word_in_str;
+
+ Evas_Object *glist;
+
+ MSG_HANDLE_T msgHandle = NULL;
+ MSG_ERROR_T err = MSG_SUCCESS;
+ MSG_LIST_S msgList;
+ int i = 0;
+ int j = 0;
+ bool is_more_btn = false;
+ bool is_word_in_title = false;
+
+ int address_cnt = 0;
+
+ MSG_SEARCH_CONDITION_S searchCon = {0,};
+
+ searchCon.msgType = MSG_TYPE_INVALID;
+ searchCon.folderId = MSG_ALLBOX_ID;
+ searchCon.pSearchVal = ad->search_word;
+
+ err = msg_search_message(ad->msg_handle, &searchCon, offset, limit, &msgList);
+
+ if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+ SEARCH_DEBUG_WARNING("msg_search_message is failed : %d", err);
+ return SEARCH_RET_SEARCH_FAIL;
+ }
+
+ if (msgList.nCount <= 0) {
+ SEARCH_DEBUG_WARNING("no msg search result");
+ ret = SEARCH_RET_SEARCH_NONE;
+ } else {
+
+ /* Set group title */
+ glist = ad->search_gl;
+
+ if (offset == 0) {
+ sel_mem =
+ (struct search_item_sel *)calloc(1,
+ sizeof(struct
+ search_item_sel));
+ sel_mem->type = type;
+
+ git =
+ elm_genlist_item_append(glist,
+ (ad->itc_grouptitle),
+ sel_mem,
+ (Elm_Object_Item *) NULL,
+ ELM_GENLIST_ITEM_GROUP,
+ NULL, NULL);
+
+ ad->gl_result_group_item[type] = git;
+ }
+
+ /* Set search result to genlist */
+
+ if(msgList.nCount < limit) {
+ loop_cnt = msgList.nCount;
+ is_more_btn = false;
+ } else {
+ loop_cnt = limit-1;
+ is_more_btn = true;
+ }
+
+ /********** START : set search result to sel_mem_info buf ************/
+
+ for (i = 0; i < loop_cnt; i++) {
+ const char *text_1line = NULL;
+ const char *text_2line = NULL;
+ const char *msg_address = NULL;
+ const char *markup_keyword = NULL;
+
+ sel_mem_info = (struct search_item_sel *)
+ calloc(1,sizeof(struct search_item_sel));
+ sel_mem_info->type = type;
+
+ snprintf(sel_mem_info->main_id, MAX_LENGTH_PER_ID - 1, "%d", msg_get_message_id(msgList.msgInfo[i]));
+
+ /* Set 1st line string */
+ if(msg_is_mms(msgList.msgInfo[i])) {
+ /* MMS case */
+ char* markup_text_1line = NULL;
+
+ text_1line = msg_get_subject(msgList.msgInfo[i]);
+ markup_text_1line = elm_entry_utf8_to_markup(text_1line);
+
+ markup_keyword = search_markup_keyword(markup_text_1line,
+ ad->not_markup_search_word,
+ &is_word_in_title);
+
+ if (!is_word_in_title) {
+ text_1line = msg_mms_get_text_contents(msgList.msgInfo[i]);
+ markup_text_1line = elm_entry_utf8_to_markup(text_1line);
+ markup_keyword = search_markup_keyword(markup_text_1line,
+ ad->not_markup_search_word,
+ &is_word_in_title);
+ }
+
+ if ((text_1line) && (strlen(text_1line) > 0 ))
+ strncpy(sel_mem_info->main_buf, markup_keyword, MAX_LENGTH_PER_LINE - 1);
+
+ SEARCH_FREE(markup_text_1line);
+ } else {
+ /* SMS Case */
+ char* markup_text_1line = NULL;
+
+ text_1line = msg_sms_get_message_body(msgList.msgInfo[i]);
+ markup_text_1line = elm_entry_utf8_to_markup(text_1line);
+ markup_keyword = search_markup_keyword(markup_text_1line,
+ ad->not_markup_search_word,
+ &is_word_in_title);
+
+ if ((text_1line) && (strlen(text_1line) > 0))
+ strncpy(sel_mem_info->main_buf, markup_keyword, MAX_LENGTH_PER_LINE - 1);
+
+ SEARCH_FREE(markup_text_1line);
+ }
+
+ /* Set 2nd line string */
+ address_cnt = msg_get_address_count(msgList.msgInfo[i]);
+
+ for(j = 0; j < address_cnt; j++) {
+
+ if(msg_get_ith_contact_id(msgList.msgInfo[i],j) > 0) {
+ text_2line = msg_get_ith_name(msgList.msgInfo[i],j);
+ } else {
+ text_2line = msg_get_ith_address(msgList.msgInfo[i],j);
+ }
+
+ if ((text_2line) && (strlen(text_2line) > 0)) {
+ char* markup_text_2line = NULL;
+
+ markup_text_2line = elm_entry_utf8_to_markup(text_2line);
+ strncpy(sel_mem_info->sub_buf,
+ search_markup_keyword(markup_text_2line,
+ ad->not_markup_search_word,
+ &is_word_in_str),
+ MAX_LENGTH_PER_LINE - 1);
+ SEARCH_FREE(markup_text_2line);
+ }
+
+ if ((is_word_in_title) || (is_word_in_str)) {
+ break;
+ }
+ }
+
+ elm_genlist_item_append(glist,
+ (ad->itc_pslist_2line),
+ sel_mem_info,
+ ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_phone_result_sel,
+ ad);
+ sel_mem_info = NULL;
+ }
+
+ msg_release_message_list(&msgList);
+
+ /* Set more title to genlist (under 'search all') */
+ if (is_more_btn) {
+ ad->cate_info[type].next_point = offset + limit - 1;
+
+ sel_mem = (struct search_item_sel *)
+ calloc(1,sizeof(struct search_item_sel));
+ sel_mem->type = type;
+
+ elm_genlist_item_append(ad->search_gl, (ad->itc_listmore),
+ sel_mem, ad->gl_result_group_item[type],
+ ELM_GENLIST_ITEM_NONE,
+ search_gl_result_more_item_append_cb,
+ ad);
+ }
+
+ ret = SEARCH_RET_SEARCH_SUCCESS;
+ }
+
+ SEARCH_FUNC_END;
+ return ret;
+}
+
diff --git a/src/search_bar.cpp b/src/search_bar.cpp
new file mode 100755
index 0000000..9403621
--- /dev/null
+++ b/src/search_bar.cpp
@@ -0,0 +1,426 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#include <string.h>
+#include "smartsearch.h"
+#include "Elementary.h"
+
+static const char* g_search_category_icon[SEARCH_CATE_BTN_IMG_TYPE_MAX] =
+{
+ "B10_Phone.png",
+ "B10_Phone_press.png",
+};
+
+void __search_searchbar_entry_changed_cb(void *data, Evas_Object * obj,
+ void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ const char *text;
+ text = elm_entry_markup_to_utf8(elm_object_text_get(ad->search_entry));
+
+ SEARCH_DEBUG_LOG("text : %s", text);
+
+ 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");
+ }
+
+ if ((text != NULL) && (strlen(text) > 0)
+ && (SEARCH_STRCMP(text, ad->search_word) == 0)) {
+ SEARCH_DEBUG_LOG("text is same as prev text");
+ } else {
+ if(ad->idler_search)
+ ecore_idler_del(ad->idler_search);
+
+ ad->idler_search = ecore_idler_add(search_set_result_list, 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;
+
+ 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;
+
+ 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;
+
+ 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;
+
+ elm_entry_entry_set(ad->search_entry, "");
+
+ 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;
+
+ 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;
+
+ 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);
+
+ 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;
+}
+
+static void __search_searchbar_create(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ if (!ad)
+ return;
+
+ if (ad->search_bar) {
+ elm_object_signal_callback_del(
+ ad->search_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;
+ }
+
+ ad->search_bar = elm_layout_add(ad->navi_bar);
+ elm_layout_theme_set(ad->search_bar , "layout", "searchbar", "cancel_button");
+
+ ad->search_cancel_btn = elm_button_add(ad->search_bar);
+ elm_object_part_content_set(ad->search_bar, "button_cancel", ad->search_cancel_btn);
+ elm_object_style_set(ad->search_cancel_btn, "searchbar/default");
+ elm_object_text_set(ad->search_cancel_btn, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
+
+ ad->search_entry = elm_entry_add(ad->search_bar);
+ elm_entry_scrollable_set(ad->search_entry, EINA_TRUE);
+ elm_entry_single_line_set(ad->search_entry, EINA_TRUE);
+ elm_object_part_content_set(ad->search_bar, "elm.swallow.content", ad->search_entry);
+ elm_object_part_text_set(ad->search_bar, "elm.guidetext", dgettext("sys_string", "IDS_COM_BODY_SEARCH"));
+ elm_entry_cnp_mode_set(ad->search_entry, ELM_CNP_MODE_PLAINTEXT);
+
+ evas_object_size_hint_weight_set(ad->search_bar, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(ad->search_bar, EVAS_HINT_FILL, 0.0);
+
+ elm_entry_input_panel_layout_set(ad->search_entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
+ Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(ad->search_entry);
+ ecore_imf_context_input_panel_event_callback_add(imf_context,
+ ECORE_IMF_INPUT_PANEL_STATE_EVENT,
+ __search_searchbar_state_event_cb,
+ data);
+
+ /* Set Searchbar Callback */
+ elm_object_signal_callback_add(
+ ad->search_bar,
+ "elm,bg,clicked",
+ "elm",
+ __search_searchbar_bg_clicked_cb,
+ ad);
+ elm_object_signal_callback_add(
+ ad->search_bar,
+ "elm,eraser,clicked",
+ "elm",
+ __search_searchbar_eraser_clicked_cb,
+ ad);
+
+ /* Set Search-Entry Callback */
+ evas_object_smart_callback_add(
+ ad->search_entry,
+ "changed",
+ __search_searchbar_entry_changed_cb,
+ ad);
+ evas_object_smart_callback_add(
+ ad->search_entry,
+ "preedit,changed",
+ __search_searchbar_entry_changed_cb,
+ ad);
+
+ evas_object_smart_callback_add(
+ ad->search_entry,
+ "focused",
+ __search_searchbar_entry_focused_cb,
+ ad);
+ evas_object_smart_callback_add(
+ ad->search_entry,
+ "unfocused",
+ __search_searchbar_entry_unfocused_cb,
+ ad);
+ evas_object_event_callback_add(
+ ad->search_entry,
+ EVAS_CALLBACK_KEY_DOWN,
+ __search_searchbar_key_down_cb,
+ ad);
+
+ /* Set Searchbar Cancel Button Callback */
+ evas_object_smart_callback_add(
+ ad->search_cancel_btn,
+ "clicked",
+ __search_searchbar_cancel_clicked_cb,
+ ad);
+
+ evas_object_show(ad->search_bar);
+
+ SEARCH_FUNC_END;
+}
+
+static Evas_Object *__search_init_noresult_view(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ Evas_Object *noc;
+
+ noc = elm_layout_add(ad->navi_bar);
+ elm_layout_theme_set(noc, "layout", "nocontents", "search");
+ elm_object_part_text_set(noc, "elm.text", dgettext("sys_string", "IDS_COM_BODY_NO_SEARCH_RESULTS"));
+ elm_object_focus_allow_set(noc, EINA_TRUE);
+
+ SEARCH_FUNC_END;
+
+ return noc;
+}
+
+Evas_Object *search_searchbar_category_icon_add(int cate_type, int press_type, Evas_Object *parent)
+{
+ SEARCH_FUNC_START;
+
+ Evas_Object* cate_icon;
+ char buf[128] = { 0, };
+
+ cate_icon = elm_icon_add(parent);
+
+ snprintf(buf, sizeof(buf), SEARCH_ICON_PATH "%s", g_search_category_icon[press_type]);
+
+ elm_icon_file_set(cate_icon, buf, NULL);
+
+ evas_object_size_hint_aspect_set(cate_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ elm_icon_resizable_set(cate_icon, EINA_TRUE, EINA_TRUE);
+
+ SEARCH_FUNC_END;
+
+ return cate_icon;
+}
+
+void search_searchbar_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ Evas_Object *cate_btn;
+ Evas_Object *cate_icon;
+ int category = 0;
+ int err = 0;
+
+ /* create layout */
+
+ ad->sb_layout = elm_layout_add(ad->navi_bar);
+ elm_layout_file_set(ad->sb_layout,
+ SEARCH_EDJ,
+ "smartsearch/search_result");
+
+ category = SEARCH_TYPE_PHONE;
+
+ cate_icon = search_searchbar_category_icon_add(category,
+ SEARCH_CATE_BTN_IMG_TYPE_UNPRESSED,
+ ad->sb_layout);
+
+ cate_btn = elm_button_add(ad->sb_layout);
+ elm_object_content_set(ad->cate_btn, cate_icon);
+
+ evas_object_show(cate_btn);
+ ad->cate_btn = cate_btn;
+
+ elm_object_part_content_set(ad->sb_layout, "searchbar_area_category", cate_btn);
+
+ /* set search bar area */
+ __search_searchbar_create(ad);
+ elm_object_part_content_set(ad->sb_layout, "searchbar_area_entry", ad->search_bar);
+
+ /* set search result area */
+ ad->noresult_view = __search_init_noresult_view(ad);
+
+ elm_object_part_content_set(ad->sb_layout,
+ "list_noresult",
+ ad->noresult_view);
+
+ evas_object_size_hint_weight_set(
+ ad->sb_layout,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ SEARCH_FUNC_END;
+}
diff --git a/src/smartsearch.cpp b/src/smartsearch.cpp
new file mode 100755
index 0000000..f37725e
--- /dev/null
+++ b/src/smartsearch.cpp
@@ -0,0 +1,605 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+
+
+#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 <contacts-svc.h>
+#include <calendar-svc-provider.h>
+#include <memo-db.h>
+#include <appsvc.h>
+#include <aul_service.h>
+
+static int __search_app_terminate(void *data);
+
+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 = (Ecore_Event_Mouse_Button *) event;
+ 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;
+
+ if (!SEARCH_STRCMP(ev->keyname, KEY_END)) {
+ //end key concept is close.
+ elm_exit();
+ }
+
+ SEARCH_FUNC_END;
+
+ return EINA_FALSE;
+}
+
+static Evas_Object *__search_create_layout_main(Evas_Object * parent)
+{
+ SEARCH_FUNC_START;
+
+ Evas_Object *layout;
+ Evas_Object *bg;
+
+ 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_win_resize_object_add(parent, layout);
+
+ bg = elm_bg_add(parent);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(parent, bg);
+ elm_object_part_content_set(layout, "elm.swallow.bg", bg);
+
+ evas_object_show(bg);
+
+ edje_object_signal_emit(_EDJ(layout), "elm,state,show,indicator","elm");
+ edje_object_signal_emit(_EDJ(layout), "elm,state,show,content", "elm");
+ evas_object_show(layout);
+
+ SEARCH_FUNC_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;
+
+ elm_win_lower(ad->win_main);
+
+ if(ad->back_btn_type == BACK_BTN_TYPE_CLOSE)
+ elm_exit();
+
+ SEARCH_FUNC_END;
+}
+
+static void __search_add_back_btn(struct appdata *ad)
+{
+ SEARCH_FUNC_START;
+
+ Elm_Object_Item *navi_it;
+
+ /* add back key */
+ Evas_Object *btn = elm_button_add(ad->navi_bar);
+ elm_object_style_set(btn, "naviframe/end_btn/default");
+ evas_object_smart_callback_add(btn, "clicked", __search_back_btn_clicked_cb, ad);
+
+#ifdef __ENABLE_TOP_BACK_BTN
+ navi_it = elm_naviframe_item_push(ad->navi_bar,
+ dgettext("sys_string", "IDS_COM_BODY_SEARCH"),
+ NULL, NULL, ad->sb_layout, NULL);
+
+ elm_object_item_part_content_set(navi_it, "title_right_btn", btn);
+ elm_object_item_signal_emit(navi_it, "elm,state,controlbar,close", "");
+#else
+ elm_naviframe_item_push(ad->navi_bar,
+ dgettext("sys_string", "IDS_COM_BODY_SEARCH"),
+ btn, NULL, ad->sb_layout, NULL);
+#endif
+
+ ad->back_btn = btn;
+
+ SEARCH_FUNC_END;
+}
+
+static int __search_init_smartsearch(struct appdata *ad)
+{
+ SEARCH_FUNC_START;
+
+ SEARCH_RETV_IF(ad == NULL, -1);
+
+ // Base Layout
+ ad->layout_main = __search_create_layout_main(ad->win_main);
+ SEARCH_RETV_IF(ad->layout_main == NULL, -1);
+
+ // 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);
+
+ search_result_gl_init(ad);
+
+ search_searchbar_cb(ad, NULL, NULL);
+
+ __search_add_back_btn(ad);
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+static int __search_deinit_smartsearch(struct appdata *ad)
+{
+ SEARCH_FUNC_START;
+
+ SEARCH_RETV_IF(ad == NULL, -1);
+
+ search_result_gl_deinit(ad);
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+static Evas_Object *__search_create_win(const char *name)
+{
+ SEARCH_FUNC_START;
+
+ Evas_Object *eo;
+ int w, h;
+
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+ elm_win_borderless_set(eo, EINA_TRUE);
+ evas_object_smart_callback_add(eo, "delete,request",
+ __search_win_delete_cb, NULL);
+ 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_app_connect(struct appdata *ad)
+{
+ SEARCH_FUNC_START;
+
+ int rc = 0, conn_ret = 0, type = 0;
+ char sql_query[DB_QUERY_LEN] = { 0, };
+ int ret = SEARCH_RET_SUCCESS;
+
+ for (type = 0; type < PHONE_CATEGORY_LIST_CNT; type++) {
+
+ switch(type) {
+
+ case SEARCH_TYPE_PHONE_CONTACTS:
+ {
+ rc = contacts_svc_connect();
+ if (rc != CTS_SUCCESS) {
+ SEARCH_DEBUG_WARNING
+ ("contacts svc connect fail : %d",
+ rc);
+ }
+ }
+ break;
+
+ case SEARCH_TYPE_PHONE_MSG:
+ {
+ MSG_ERROR_T err = MSG_SUCCESS;
+ 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;
+ }
+ }
+ break;
+ case SEARCH_TYPE_PHONE_EMAIL:
+ break;
+
+ /* IMAGE, MUSIC, VIDEO use common handle */
+ case SEARCH_TYPE_PHONE_IMAGES:
+ case SEARCH_TYPE_PHONE_MUSIC:
+ case SEARCH_TYPE_PHONE_VIDEO:
+ if( ad->media_handle == NULL ) {
+ conn_ret = media_svc_connect(&ad->media_handle);
+ if(conn_ret < 0) {
+ SEARCH_DEBUG_WARNING("media_svc_connect failed : %d\n", conn_ret);
+ ad->media_handle = NULL;
+ }
+ }
+ break;
+ case SEARCH_TYPE_PHONE_CALENDAR:
+ {
+ rc = calendar_svc_connect();
+ if (rc != CAL_SUCCESS) {
+ SEARCH_DEBUG_WARNING
+ ("calendar svc connect fail : %d",
+ rc);
+ }
+ }
+ break;
+ case SEARCH_TYPE_PHONE_MEMO:
+ {
+ rc = memo_init(NULL);
+ if (rc == -1) {
+ SEARCH_DEBUG_WARNING
+ ("memo svc connect fail : %d", rc);
+ }
+ }
+ break;
+ }
+ }
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}
+
+static int __search_deinit_app_disconnect(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ int rc = 0, conn_ret = 0, type = 0;
+
+ for (type = 0; type < PHONE_CATEGORY_LIST_CNT; type++) {
+ switch (type) {
+
+ case SEARCH_TYPE_PHONE_CONTACTS:
+ {
+ rc = contacts_svc_disconnect();
+ if (rc != CTS_SUCCESS) {
+ SEARCH_DEBUG_WARNING
+ ("contacts svc disconnect fail : %d",
+ rc);
+ }
+ }
+ break;
+ case SEARCH_TYPE_PHONE_MSG:
+ {
+ 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_TYPE_PHONE_EMAIL:
+ break;
+ case SEARCH_TYPE_PHONE_IMAGES:
+ case SEARCH_TYPE_PHONE_MUSIC:
+ case SEARCH_TYPE_PHONE_VIDEO:
+ {
+ conn_ret = media_svc_disconnect(ad->media_handle);
+ if(conn_ret < 0) {
+ SEARCH_DEBUG_WARNING("media_svc_disconnect failed : %d\n", conn_ret);
+ }
+ ad->media_handle = NULL;
+ }
+ break;
+ case SEARCH_TYPE_PHONE_CALENDAR:
+ {
+ rc = calendar_svc_close();
+ if (rc != CAL_SUCCESS) {
+ SEARCH_DEBUG_WARNING
+ ("calendar svc disconnect fail : %d",
+ rc);
+ }
+ }
+ break;
+ case SEARCH_TYPE_PHONE_MEMO:
+ {
+ memo_fini();
+ }
+ break;
+ }
+ }
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+static Eina_Bool __search_init_after_ui_create(gpointer data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ 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);
+
+ /* add system event callback */
+ appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE,
+ search_util_date_time_format_init,
+ NULL);
+
+ UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
+
+ SEARCH_FUNC_END;
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static int __search_app_create(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ appcore_set_i18n(SEARCH_PACKAGE, LOCALEDIR);
+
+ ad->win_main = __search_create_win(SEARCH_PACKAGE);
+
+ SEARCH_RETV_IF(ad->win_main == NULL, -1);
+
+ evas_object_show(ad->win_main);
+
+ ad->scale_factor = elm_config_scale_get();
+
+ __search_init_smartsearch(ad);
+
+ search_util_date_time_format_init(NULL);
+
+ __search_init_app_connect(ad);
+
+ ad->idler_create_ui = ecore_idler_add(__search_init_after_ui_create, ad);
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+static int __search_app_terminate(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ 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);
+
+ if(ad->idler_search)
+ ecore_idler_del(ad->idler_search);
+
+ __search_deinit_smartsearch(ad);
+
+ __search_deinit_app_disconnect(ad);
+
+ search_util_date_time_format_deinit();
+
+ SEARCH_FREE(ad->search_word);
+ SEARCH_FREE(ad->not_markup_search_word);
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+static int __search_app_pause(void *data)
+{
+ SEARCH_FUNC_START;
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+static int __search_app_resume(void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+
+ if (ad->win_main) {
+ elm_object_focus_set(ad->back_btn, EINA_FALSE);
+ }
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+static int __search_app_reset(bundle * b, void *data)
+{
+ SEARCH_FUNC_START;
+
+ struct appdata *ad = (struct appdata *)data;
+ const char *query = NULL;
+ const char *svcname = NULL;
+ const char *category = NULL;
+ char* keyword = NULL;
+
+ Evas_Object *cate_icon;
+ int ret;
+
+ ad->back_btn_type = BACK_BTN_TYPE_LOWER;
+
+ if (b == NULL) {
+ keyword = vconf_get_str(SMARTSEARCH_KEY_KEYWORD);
+ } else {
+ svcname = appsvc_get_operation(b);
+ if(svcname) {
+ if(SEARCH_STRCMP(svcname, APPSVC_OPERATION_SEARCH) == 0) {
+ query = appsvc_get_data(b, APPSVC_DATA_KEYWORD);
+ } else {
+ SEARCH_DEBUG_WARNING("wrong app service name : %s", svcname);
+ }
+
+ ad->back_btn_type = BACK_BTN_TYPE_CLOSE;
+ } else {
+ svcname = bundle_get_val(b, AUL_K_SERVICE_NAME);
+
+ if(svcname) {
+ if(SEARCH_STRCMP(svcname, SEARCH_SVC) == 0) {
+ query = bundle_get_val(b, "query");
+ } else {
+ SEARCH_DEBUG_WARNING("wrong aul service name : %s", svcname);
+ }
+ }
+ }
+
+ cate_icon = search_searchbar_category_icon_add(SEARCH_TYPE_PHONE, SEARCH_CATE_BTN_IMG_TYPE_UNPRESSED, ad->sb_layout);
+ elm_object_content_set(ad->cate_btn, cate_icon);
+
+ /*
+ * keyword input param is only enabled for phone search
+ * if there is no keyword input param, set latest search keyword for phone search
+ */
+ if( (query) && (strlen(query) > 0) ) {
+ keyword = (char*)malloc(strlen(query)+1);
+ memset(keyword, 0x00, strlen(query)+1);
+ strncpy(keyword, query, strlen(query));
+ } else {
+ keyword = vconf_get_str(SMARTSEARCH_KEY_KEYWORD);
+ }
+
+ }
+
+ if ((keyword) && (strlen(keyword) > 0)) {
+ elm_object_text_set(ad->search_entry, keyword);
+ } else {
+ 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);
+
+ elm_entry_cursor_end_set(ad->search_entry);
+
+ if (ad->win_main)
+ elm_win_activate(ad->win_main);
+
+ SEARCH_FUNC_END;
+
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ SEARCH_FUNC_START;
+
+ struct appdata ad;
+ struct appcore_ops ops;
+ int ret = 0;
+ int i = 0;
+
+ ops.create = &__search_app_create;
+ ops.terminate = &__search_app_terminate;
+ ops.pause = &__search_app_pause;
+ ops.resume = &__search_app_resume;
+ ops.reset = &__search_app_reset;
+
+ memset(&ad, 0x0, sizeof(struct appdata));
+ ops.data = &ad;
+
+ for (i = 0; i < argc; i++)
+ SEARCH_DEBUG_LOG("argv[%d] = [%s]\n", i, argv[i]);
+
+ ret = appcore_efl_main(SEARCH_PACKAGE, &argc, &argv, &ops);
+
+ SEARCH_FUNC_END;
+
+ return ret;
+}