From: jk7744.park Date: Tue, 8 Sep 2015 12:33:50 +0000 (+0900) Subject: tizen 2.3.1 release X-Git-Tag: submit/tizen_2.3.1/20150915.072527^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed7fb071f39fcbf1d57b152db7b31352bc1e7c4e;p=apps%2Fconnectivity%2Fbluetooth-share-ui.git tizen 2.3.1 release --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..b00a70d --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Taesoo Jun +DoHyun Pyun diff --git a/CMakeLists.txt b/CMakeLists.txt index 6340d48..c973fc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ PROJECT(bluetooth-share-ui C) SET(SRCS ${CMAKE_SOURCE_DIR}/src/bt-share-ui-main.c ${CMAKE_SOURCE_DIR}/src/bt-share-ui-ipc.c + ${CMAKE_SOURCE_DIR}/src/bt-share-ui-widget.c + ${CMAKE_SOURCE_DIR}/src/bt-share-ui-popup.c ${CMAKE_SOURCE_DIR}/src/bt-share-ui-view.c ) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -27,20 +29,23 @@ pkg_check_modules(pkgs REQUIRED edbus edje elementary + efl-assist evas gobject-2.0 utilX bluetooth-api aul capi-appfw-application - bluetooth-share-api) + capi-network-bluetooth + bluetooth-share-api + notification) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -g") ENDFOREACH(flag) #SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -finstrument-functions") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g ") SET(CMAKE_C_FLAGS_RELEASE "-O2") #This is flag for Gprof @@ -56,7 +61,7 @@ ENDIF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}/\"") ADD_DEFINITIONS("-DSLP_DEBUG") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}) @@ -65,9 +70,9 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) # install desktop file & icon SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -INSTALL(FILES ${CMAKE_BINARY_DIR}/data/org.tizen.bluetooth-share-ui.xml DESTINATION /opt/share/packages) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/org.tizen.bluetooth-share-ui.png DESTINATION /opt/share/icons/default/small) -INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION ${PREFIX}/res/images FILES_MATCHING PATTERN "*.png") +INSTALL(FILES ${CMAKE_BINARY_DIR}/data/org.tizen.bluetooth-share-ui.xml DESTINATION /usr/share/packages) +INSTALL(FILES ${CMAKE_BINARY_DIR}/data/org.tizen.bluetooth-share-ui.efl DESTINATION /etc/smack/accesses.d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/org.tizen.bluetooth-share-ui.png DESTINATION /usr/share/icons/default/small) ADD_CUSTOM_TARGET(bt-share-layout.edj COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/data/images @@ -76,6 +81,14 @@ ADD_CUSTOM_TARGET(bt-share-layout.edj ) ADD_DEPENDENCIES(${PROJECT_NAME} bt-share-layout.edj) +ADD_CUSTOM_TARGET(images.edj + COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/data/images + ${CMAKE_CURRENT_SOURCE_DIR}/data/edc/images.edc ${CMAKE_CURRENT_BINARY_DIR}/images.edj + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/data/edc/images.edc +) +ADD_DEPENDENCIES(${PROJECT_NAME} images.edj) + # install edj file INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/bt-share-layout.edj DESTINATION ${PREFIX}/res/edje) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/images.edj DESTINATION ${PREFIX}/res/edje) diff --git a/LICENSE b/LICENSE index 7ccb5b5..571fe79 100644 --- a/LICENSE +++ b/LICENSE @@ -1,75 +1,206 @@ Flora License -Version 1.0, May, 2012 +Version 1.1, April, 2013 -http://www.tizenopensource.org/license +http://floralicense.org/license/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -"Tizen Certified Platform" shall mean a software platform that complies with the standards set forth in the Compatibility Definition Document and passes the Compatibility Test Suite as defined from time to time by the Tizen Technical Steering Group and certified by the Tizen Association or its designated agent. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work solely as incorporated into a Tizen Certified Platform, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work solely as incorporated into a Tizen Certified Platform to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof pursuant to the copyright license above, in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and - - 2. You must cause any modified files to carry prominent notices stating that You changed the files; and - - 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - - 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. +"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 Tizen Compliance Specification +and passes the Tizen Compliance Tests 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 + and your own copyright statement or terms and conditions do not conflict + the conditions stated in the License including section 3. + +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. +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"); + Licensed under the Flora License, Version 1.1 (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 + http://floralicense.org/license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + diff --git a/bluetooth-share-ui.manifest b/bluetooth-share-ui.manifest new file mode 100644 index 0000000..e71b4b8 --- /dev/null +++ b/bluetooth-share-ui.manifest @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/data/edc/bt-share-layout.edc b/data/edc/bt-share-layout.edc index 8d58e18..a8ccc2b 100644 --- a/data/edc/bt-share-layout.edc +++ b/data/edc/bt-share-layout.edc @@ -1,242 +1,337 @@ -#define PROGRESSBAR_WIDTH 570.0 -#define ITEM_HEIGHT 50 -#define ITEM_WIDTH 50 -#define X_ALIGN 0.5 -#define Y_ALIGN 0.5 - -#define BT_PAD_L \ - part { \ - name: "pad_l"; \ - type: RECT; \ - scale: 1; \ - description { state: "default" 0.0; \ - align: 0.0 0.0; \ - min: 20 0; \ - fixed: 1 0; \ - color: 0 0 0 0; \ - rel1 { relative: 0.0 0.0;} \ - rel2 { relative: 0.0 1.0;} \ - } \ - } +#define BG_COLOR 8 8 8 255 +#define FONT_COLOR 250 250 250 255 +#define NOCONTENT_FONT_COLOR 110 111 118 255 -#define BT_PAD_R \ - part { \ - name: "pad_r"; \ - type: RECT; \ - scale: 1; \ - description { state: "default" 0.0; \ - align: 1.0 0.0; \ - min: 20 0; \ - fixed: 1 0; \ - color: 0 0 0 0; \ - rel1 { relative: 1.0 0.0;} \ - rel2 { relative: 1.0 1.0;} \ - } \ - } +#define IMG_H 252 +#define IMG_W 252 -#define BT_POPUP_MSG_ITEM(sz, f1, f2, lo) \ - part { \ - name: "msg1"; \ - type: TEXT; \ - scale: 1; \ - description { \ - state: "default" 0.0; \ - min: sz 50; \ - align: 0.5 0.0; \ - fixed: f1 f2; \ - color: 0 0 0 255; \ - text { \ - font: "SLP:style=Roman"; \ - text_class: "slp_roman"; \ - size: 28; \ - min: 0 0; \ - align: 0.5 0.5; \ - } \ - rel1 { relative: 1.0 0.0; to_x: "pad_l";} \ - rel2 { relative: 0.0 lo; to_x: "pad_r";} \ - } \ - } +#define BT_POPUP_PAD_W 18 +#define BT_POPUP_PAD_H 18 +#define BT_POPUP_PROGRESSVIEW_CONTENT_MIN 320 0 +#define BT_POPUP_PROGRESSVIEW_PROGRESS_MIN 320 35 +#define BT_POPUP_PROGRESSVIEW_LABEL_MIN 320 28 -#define BT_POPUP_ITEM(item_name, pre_item_name) \ - part {name: "msg"item_name; \ - type: TEXT; \ - scale: 1; \ - description { \ - min: 0 ITEM_HEIGHT; \ - state: "default" 0.0; \ - align: X_ALIGN 0.0; \ - fixed: 0 1; \ - color: 0 0 0 255; \ - text { \ - font: "SLP:style=Roman"; \ - text_class: "slp_roman"; \ - size: 28; \ - min: 0 0; \ - align: X_ALIGN Y_ALIGN; \ - } \ - rel1 { relative: 1.0 1.0; to_x: "pad_l"; to_y: pre_item_name;} \ - rel2 { relative: 0.0 1.0; to_x: "pad_r"; to_y: pre_item_name;} \ - } \ - } +#define POPUP_TEXT_FONT_SIZE1 30 +#define POPUP_TEXT_FONT_SIZE2 24 +#define POPUP_PROGRESSBAR_2TEXT_VIEW_LAYOUT_BG_MIN_INC 0 168 +#define POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC 15 27 +#define POPUP_PROGRESSBAR_VIEW_LAYOUT_TEXT_FONT_SIZE_INC 0 38 +#define POPUP_PROGRESSBAR_VIEW_LAYOUT_SUBTEXT_FONT_SIZE_INC 0 32 +#define POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_INC 0 69 collections { + base_scale: 1.8; group { - name: "progress_popup"; + name: "popup_2text_progressbar_view_layout"; + styles { + style { + name: "popup_processing_style"; + base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE1" color=#FFFFFF color_class=T123 wrap=mixed ellipsis=1.0 text_class=T123"; + tag: "br" "\n"; + tag: "tab" "\t"; + } + style { + name: "popup_subtext_style"; + base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE2" color=#FFFFFF color_class=T024 wrap=mixed ellipsis=1.0 text_class=T024"; + tag: "br" "\n"; + tag: "tab" "\t"; + } + } parts { - BT_PAD_L - BT_PAD_R - BT_POPUP_MSG_ITEM(0, 0, 1, 0.0); - BT_POPUP_ITEM("2", "msg1"); - BT_POPUP_ITEM("3", "msg2"); - BT_POPUP_ITEM("4", "msg3"); - part { - name: "popup_pb"; - type: SWALLOW; + name: "bg"; + type: SPACER; scale: 1; - mouse_events: 0; - repeat_events: 1; description { state: "default" 0.0; - min: PROGRESSBAR_WIDTH 50; + min: POPUP_PROGRESSBAR_2TEXT_VIEW_LAYOUT_BG_MIN_INC; fixed: 1 0; - rel1 { relative: 1.0 0.8; to_x: "pad_l"; } - rel2 { relative: 0.0 1.0; to_x: "pad_r";} } } - - part { - name: "percent"; - type: TEXT; + part { name: "pad_l_t"; + type: SPACER; scale: 1; description { state: "default" 0.0; - min: 0 50; - align: 0.5 0.0; + min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC; + max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC; + fixed: 1 1; + rel2.relative: 0.0 0.0; + align: 0.0 0.0; + } + } + part { name: "pad_r_t"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + min: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC; + max: POPUP_PROGRESSBAR_VIEW_LAYOUT_PADDING_INC; + fixed: 1 1; + rel1.relative: 1.0 1.0; + align: 1.0 1.0; + } + } + part { name: "elm.text.description"; + type: TEXTBLOCK; + scale: 1; + description { + state: "default" 0.0; + min: POPUP_PROGRESSBAR_VIEW_LAYOUT_TEXT_FONT_SIZE_INC; fixed: 0 1; - color: 0 0 0 255; + rel1 { + relative: 1.0 1.0; + to: "pad_l_t"; + } + rel2 { + relative: 0.0 1.0; + to_x: "pad_r_t"; + to_y: "pad_l_t"; + } text { - font: "SLP:style=Roman"; - text_class: "slp_roman"; - size: 28; - min: 0 0; - align: 0.0 0.5; + style: "popup_processing_style"; + min: 0 1; } - - rel1 { relative: 0.7 0.9; to_x: "pad_l";} - rel2 { relative: 0.0 1.0; to_x: "pad_r";} + align: 0.0 0.0; } } - - part { - name: "status_text"; - type: TEXT; + part { name: "elm.subtext.description"; + type: TEXTBLOCK; scale: 1; description { state: "default" 0.0; - min: 0 50; - align: 1.0 0.0; - fixed: 0 1; - color: 0 0 0 255; + min: POPUP_PROGRESSBAR_VIEW_LAYOUT_SUBTEXT_FONT_SIZE_INC; + fixed: 1 1; + rel1 { + relative: 1.0 1.0; + to_x: "pad_l_t"; + to_y: "elm.text.description"; + } + rel2 { + relative: 0.0 1.0; + to_x: "pad_r_t"; + to_y: "elm.text.description"; + } text { - font: "SLP:style=Roman"; - text_class: "slp_roman"; - size: 28; - min: 0 0; - align: 1.0 0.5; + style: "popup_subtext_style"; + min: 0 1; } - - rel1 { relative: 0.7 0.9; to_x: "pad_l";} - rel2 { relative: 0.0 1.0; to_x: "pad_r";} + align: 0.0 0.0; } } - } - } + part { + name: "progressbar_bg"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + fixed: 0 1; + min: POPUP_PROGRESSBAR_VIEW_LAYOUT_BG_INC; + rel1 { + relative: 1.0 1.0; + to_x: "pad_l_t"; + to_y: "elm.subtext.description"; + offset: 0 7; - group { - name: "ft_popup"; - parts { - BT_PAD_L - BT_PAD_R - BT_POPUP_MSG_ITEM(150, 1, 0, 0.3); - BT_POPUP_ITEM("2", "msg1"); - BT_POPUP_ITEM("3", "msg2"); + } + rel2 { + relative: 0.0 1.0; + to_x: "pad_r_t"; + to_y: "elm.subtext.description"; + } + align: 0.0 0.0; + } + } + part { + name: "progressbar"; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + fixed: 0 1; + rel1.to: "progressbar_bg"; + rel2.to: "progressbar_bg"; + } + } } } - group { - name: "list"; - parts{ - part { name: "background"; - type: RECT; - mouse_events: 1; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 1.0; } - color: 0 0 0 0; + group { name: "progress_popup"; + parts { + part { name: "pad_t"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + align: 0.5 0.0; + min: 0 BT_POPUP_PAD_H; + fixed: 0 1; + rel1 { + relative: 1.0 0.0;to_x: "pad_l"; + } + rel2 { + relative: 0.0 0.0;to_x: "pad_r"; + } + } + } + part { name: "pad_l"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: BT_POPUP_PAD_W 0; + max: BT_POPUP_PAD_W 0; + fixed: 1 0; + rel1 { + relative: 0.0 0.0; + } + rel2 { + relative: 0.0 1.0; + } + align: 0.0 0.0; + } + } + part { name: "pad_r"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: BT_POPUP_PAD_W 0; + max: BT_POPUP_PAD_W 0; + fixed: 1 0; + rel1 { + relative: 1.0 0.0; + } + rel2 { + relative: 1.0 1.0; + } + align: 1.0 0.0; } } - part { name: "content"; + part { name:"elm.swallow.content"; type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + min: BT_POPUP_PROGRESSVIEW_CONTENT_MIN; + align: 0.5 0.5; + fixed: 1 0; + rel1 { + relative: 1.0 1.0; + to_x: "pad_l"; + to_y: "pad_t"; + } + rel2 { + relative: 0.0 0.0; + to_x: "pad_r"; + to_y: "pad_pb"; + } + } + } + part { name: "elm.swallow.progressbar"; + type: SWALLOW; + scale: 1; mouse_events: 1; - description { - state: "default" 0.0; - visible: 1; + repeat_events: 1; + description { state: "default" 0.0; + align: 0.5 1.0; + min: BT_POPUP_PROGRESSVIEW_PROGRESS_MIN; fixed: 1 1; - rel1 { relative: 0.0 0.0; offset: 0 0; to: "background"; } - rel2 { relative: 1.0 1.0; offset: 0 0; to: "background"; } + rel1 { + relative: 1.0 0.0; + to_x: "pad_l"; + to_y: "pad_pb"; + } + rel2 { + relative: 0.0 1.0; + to_x: "pad_r"; + to_y: "pad_pb"; + } + } + } + part { name: "pad_pb"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + align: 0.5 1.0; + min: 320 55; + fixed: 1 1; + rel1 { + relative: 1.0 1.0; + to_x: "pad_l"; + } + rel2 { + relative: 0.0 1.0; + to_x: "pad_r"; + } } } } } group { - name: "nocontent"; - + name: "share_view"; parts{ part { name: "background"; type: RECT; mouse_events: 1; + scale: 1; description { - state: "default" 0.0; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 1.0; } - color: 0 0 0 0; + state: "default" 0; + rel1 { relative: 0 0; } + rel2 { relative: 1 1; } + color_class: "B011"; } } - part { name: "content"; - type: SWALLOW; - mouse_events: 0; - description { - state: "default" 0.0; - visible: 1; - fixed: 1 1; - rel1 { relative: 0.3 0.2; offset: 0 0; to: "background"; } - rel2 { relative: 0.7 0.6; offset: 0 0; to: "background"; } + part { name: "elm.swallow.content"; + type: SWALLOW; + scale: 1; + description { + state: "default" 0; + visible: 1; + rel1 { relative: 0 0; to:"background"; } + rel2 { relative: 1 1; to:"background"; } + } } - } - part { name: "text"; - type: TEXT; - scale: 1; - description { - state: "default" 0.0; - min: 0 50; - align: 0.5 0.5; - fixed: 0 1; - color: 0 0 0 255; - text { - size: 36; - min: 0 0; + part { name: "elm.swallow.image"; + type: SWALLOW; + scale: 1; + description { + state: "default" 0; + visible: 1; + fixed: 1 1; + min: IMG_W IMG_H; align: 0.5 0.5; + rel1 { relative: 0.5 0.5; to:"background"; } + rel2 { relative: 0.5 0.5; to:"background"; } } - rel1 { relative: 0.0 0.8; offset: 0 0; to: "background"; } - rel2 { relative: 1.0 1.0; offset: 0 0; to: "background"; } + } + part { name: "elm.text"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + min: 0 20; + align: 0.5 0.5; + fixed: 0 1; + text { + text_class: "T0221"; + min: 0 0; + align: 0.5 0.5; + } + rel1 { + relative: 0 0; + to: "background"; + + } + + rel2 { + relative: 1 1; + to: "background"; + } + + } } } } diff --git a/data/edc/image_macro.edc b/data/edc/image_macro.edc new file mode 100644 index 0000000..04a9abb --- /dev/null +++ b/data/edc/image_macro.edc @@ -0,0 +1,55 @@ +#define RESOURCE_IMAGE( FILE_NAME ) \ + group { \ + name: FILE_NAME; \ + images.image: FILE_NAME COMP; \ + parts { \ + part { name: "image"; \ + description { \ + state: "default" 0.0; \ + image.normal: FILE_NAME; \ + aspect: 1 1; \ + aspect_preference: BOTH; \ + } \ + } \ + } \ + } + +#define RESOURCE_IMAGE_TRANSFER( FILE_NAME ) \ + group { \ + name: FILE_NAME; \ + images.image: FILE_NAME COMP; \ + parts { \ + part { name: "image"; \ + description { \ + state: "default" 0.0; \ + image.normal: FILE_NAME; \ + aspect: 1 1; \ + aspect_preference: BOTH; \ + color_class: "F011L1"; \ + } \ + description { \ + state: "selected" 0.0; \ + image.normal: FILE_NAME; \ + aspect: 1 1; \ + aspect_preference: BOTH; \ + color_class: "F011L1P"; \ + } \ + } \ + } \ + } + +#define RESOURCE_IMAGE_LOSSY( FILE_NAME ) \ + group { \ + name: FILE_NAME; \ + images.image: FILE_NAME LOSSY 85; \ + parts { \ + part { name: "image"; \ + description { \ + state: "default" 0.0; \ + image.normal: FILE_NAME; \ + aspect: 1 1; \ + aspect_preference: BOTH; \ + } \ + } \ + } \ + } diff --git a/data/edc/images.edc b/data/edc/images.edc new file mode 100644 index 0000000..89c0dfb --- /dev/null +++ b/data/edc/images.edc @@ -0,0 +1,9 @@ +#include "image_macro.edc" + +collections { + base_scale: 1.8; + RESOURCE_IMAGE_TRANSFER("bluetooth_inbound_transfer_failed.png"); + RESOURCE_IMAGE_TRANSFER("bluetooth_inbound_transfer_successed.png"); + RESOURCE_IMAGE_TRANSFER("bluetooth_outbound_transfer_failed.png"); + RESOURCE_IMAGE_TRANSFER("bluetooth_outbound_transfer_successed.png"); +} diff --git a/data/images/A01-4_Inbound_transfer_failed.png b/data/images/A01-4_Inbound_transfer_failed.png deleted file mode 100644 index 76f30c6..0000000 Binary files a/data/images/A01-4_Inbound_transfer_failed.png and /dev/null differ diff --git a/data/images/A01-4_Inbound_transfer_successed.png b/data/images/A01-4_Inbound_transfer_successed.png deleted file mode 100644 index c11f159..0000000 Binary files a/data/images/A01-4_Inbound_transfer_successed.png and /dev/null differ diff --git a/data/images/A01-4_No_items_Inbound_transfer.png b/data/images/A01-4_No_items_Inbound_transfer.png deleted file mode 100644 index 26bd3a7..0000000 Binary files a/data/images/A01-4_No_items_Inbound_transfer.png and /dev/null differ diff --git a/data/images/A01-4_No_items_Outbound_transfer.png b/data/images/A01-4_No_items_Outbound_transfer.png deleted file mode 100644 index 59946e6..0000000 Binary files a/data/images/A01-4_No_items_Outbound_transfer.png and /dev/null differ diff --git a/data/images/A01-4_Outbound_transfer_failed.png b/data/images/A01-4_Outbound_transfer_failed.png deleted file mode 100644 index b4fe450..0000000 Binary files a/data/images/A01-4_Outbound_transfer_failed.png and /dev/null differ diff --git a/data/images/A01-4_Outbound_transfer_successed.png b/data/images/A01-4_Outbound_transfer_successed.png deleted file mode 100644 index eec2b16..0000000 Binary files a/data/images/A01-4_Outbound_transfer_successed.png and /dev/null differ diff --git a/data/images/Q02_Notification_bluetooth.png b/data/images/Q02_Notification_bluetooth.png deleted file mode 100644 index 1719f19..0000000 Binary files a/data/images/Q02_Notification_bluetooth.png and /dev/null differ diff --git a/data/images/Q02_icon_BT_receive.png b/data/images/Q02_icon_BT_receive.png deleted file mode 100644 index 821f8ec..0000000 Binary files a/data/images/Q02_icon_BT_receive.png and /dev/null differ diff --git a/data/images/Q02_icon_BT_transmit.png b/data/images/Q02_icon_BT_transmit.png deleted file mode 100644 index 6819ca8..0000000 Binary files a/data/images/Q02_icon_BT_transmit.png and /dev/null differ diff --git a/data/images/bluetooth_inbound_transfer_failed.png b/data/images/bluetooth_inbound_transfer_failed.png new file mode 100644 index 0000000..303e974 Binary files /dev/null and b/data/images/bluetooth_inbound_transfer_failed.png differ diff --git a/data/images/bluetooth_inbound_transfer_successed.png b/data/images/bluetooth_inbound_transfer_successed.png new file mode 100644 index 0000000..23754e6 Binary files /dev/null and b/data/images/bluetooth_inbound_transfer_successed.png differ diff --git a/data/images/bluetooth_outbound_transfer_failed.png b/data/images/bluetooth_outbound_transfer_failed.png new file mode 100644 index 0000000..a668c13 Binary files /dev/null and b/data/images/bluetooth_outbound_transfer_failed.png differ diff --git a/data/images/bluetooth_outbound_transfer_successed.png b/data/images/bluetooth_outbound_transfer_successed.png new file mode 100644 index 0000000..157f7bb Binary files /dev/null and b/data/images/bluetooth_outbound_transfer_successed.png differ diff --git a/data/org.tizen.bluetooth-share-ui.efl b/data/org.tizen.bluetooth-share-ui.efl new file mode 100644 index 0000000..77af6f2 --- /dev/null +++ b/data/org.tizen.bluetooth-share-ui.efl @@ -0,0 +1,39 @@ +org.tizen.app-tray org.tizen.bluetooth-share-ui r-x--- ------ +org.tizen.quickpanel org.tizen.bluetooth-share-ui r-x--- ------ +org.tizen.indicator org.tizen.bluetooth-share-ui rwx--- ------ +org.tizen.lockscreen org.tizen.bluetooth-share-ui r-x--- ------ +org.tizen.bluetooth-share-ui org.tizen.indicator rw---- ------ +org.tizen.bluetooth-share-ui bt_share::db rw---- ------ +org.tizen.bluetooth-share-ui ail::db rw---- ------ +org.tizen.bluetooth-share-ui isf r----- ------ +org.tizen.bluetooth-share-ui system::use_internet r----- ------ +org.tizen.bluetooth-share-ui system::ext_storage rwxat- ------ +org.tizen.bluetooth-share-ui xorg rw---- ------ +org.tizen.bluetooth-share-ui sound_server rw---- ------ +org.tizen.bluetooth-share-ui dbus rw---- ------ +org.tizen.bluetooth-share-ui app-svc::db rw---- ------ +org.tizen.bluetooth-share-ui ug_bluetooth r-x--- ------ +org.tizen.bluetooth-share-ui stest-service -w---- ------ +org.tizen.bluetooth-share-ui aul::launch --x--- ------ +org.tizen.bluetooth-share-ui notification::db rw---- ------ +org.tizen.bluetooth-share-ui data-provider-master::notification -w---- ------ +org.tizen.bluetooth-share-ui data-provider-master::notification.client -w---- ------ +stest-service org.tizen.bluetooth-share-ui r-x--- ------ +org.tizen.bluetooth-share-ui system::homedir rwxat- ------ +org.tizen.bluetooth-share-ui system::vconf rwxat- ------ +org.tizen.bluetooth-share-ui system::media rwxat- ------ +org.tizen.bluetooth-share-ui system::share rwxat- ------ +org.tizen.bluetooth-share-ui pulseaudio rwxat- ------ +e17 org.tizen.bluetooth-share-ui -w---- ------ +org.tizen.bluetooth-share-ui device::app_logging -w---- ------ +org.tizen.bluetooth-share-ui sys-assert::core rwxat- ------ +org.tizen.bluetooth-share-ui privacy-manager::db r----l ------ +org.tizen.bluetooth-share-ui pkgmgr::db r----l ------ +org.tizen.bluetooth-share-ui system::vconf_inhouse rw---- ------ +org.tizen.bluetooth-share-ui system::vconf_setting rw---- ------ +org.tizen.bluetooth-share-ui system::vconf_privacy rw---- ------ +org.tizen.bluetooth-share-ui system::vconf_system rw---- ------ +org.tizen.bluetooth-share-ui system::vconf_multimedia rw---- ------ +org.tizen.bluetooth-share-ui system::vconf_network rw---- ------ +org.tizen.bluetooth-share-ui system::vconf_misc rw---- ------ +org.tizen.bluetooth-share-ui ecore::lock rwxat- ------ diff --git a/data/org.tizen.bluetooth-share-ui.png b/data/org.tizen.bluetooth-share-ui.png index 6aefb32..34dd0c1 100644 Binary files a/data/org.tizen.bluetooth-share-ui.png and b/data/org.tizen.bluetooth-share-ui.png differ diff --git a/data/org.tizen.bluetooth-share-ui.xml b/data/org.tizen.bluetooth-share-ui.xml index 3d53001..89cf260 100644 --- a/data/org.tizen.bluetooth-share-ui.xml +++ b/data/org.tizen.bluetooth-share-ui.xml @@ -1,11 +1,10 @@ - + Injun Yang Bluetooth Share UI application - - + org.tizen.bluetooth-share-ui.png - + diff --git a/debian/changelog b/debian/changelog index 80d8883..9ce8633 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,163 @@ +bluetooth-share-ui (0.0.38) unstable; urgency=low + + * Tagging and package upload + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.38 + + -- InJun Yang Fri, 22 Feb 2013 19:20:37 +0900 + +bluetooth-share-ui (0.0.37) unstable; urgency=low + + * Tagging and package upload + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.37 + + -- DoHyun Pyun Tue, 05 Feb 2013 19:15:09 +0900 + +bluetooth-share-ui (0.0.36) unstable; urgency=low + + * Tagging and package upload + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.36 + + -- InJun Yang Fri, 01 Feb 2013 20:19:22 +0900 + +bluetooth-share-ui (0.0.35) unstable; urgency=low + + * Tagging and package upload + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.35 + + -- DoHyun Pyun Thu, 24 Jan 2013 11:37:34 +0900 + +bluetooth-share-ui (0.0.34) unstable; urgency=low + + * Tagging and package upload + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.34 + + -- Jaganath K Tue, 15 Jan 2013 18:17:28 +0530 + +bluetooth-share-ui (0.0.33) unstable; urgency=low + + * Tagging and package upload + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.33 + + -- Sunil Kumar Behera Wed, 09 Jan 2013 19:49:19 +0900 + +bluetooth-share-ui (0.0.32) unstable; urgency=low + + * Tagging and package upload + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.32 + + -- Sunil Kumar Behera Wed, 26 Dec 2012 15:15:45 +0530 + +bluetooth-share-ui (0.0.31) unstable; urgency=low + + * Tagging and package upload + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.31 + + -- Sunil Kumar Behera Thu, 20 Dec 2012 16:50:02 +0530 + +bluetooth-share-ui (0.0.30) unstable; urgency=low + + * Tagging and package upload + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.30 + + -- Chethan T N Thu, 20 Dec 2012 17:41:51 +0900 + +bluetooth-share-ui (0.0.29) unstable; urgency=low + + * Display the clear button + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.29 + + -- DoHyun Pyun Thu, 15 Nov 2012 15:26:52 +0900 + +bluetooth-share-ui (0.0.28) unstable; urgency=low + + * Upload package for prevent defect fix + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.28 + + -- Chethan T N Fri, 09 Nov 2012 11:39:45 +0900 + +bluetooth-share-ui (0.0.27) unstable; urgency=low + + * Applied screen rotaion and prevent defect fix + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.27 + + -- Chethan T N Thu, 08 Nov 2012 17:44:59 +0900 + +bluetooth-share-ui (0.0.26) unstable; urgency=low + + * Add incicator window + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.26 + + -- InJun Yang Wed, 31 Oct 2012 15:01:01 +0900 + +bluetooth-share-ui (0.0.25) unstable; urgency=low + + * Fix : Retry file send crash issue + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.25 + + -- Chethan T N Fri, 26 Oct 2012 17:44:55 +0530 + +bluetooth-share-ui (0.0.24) unstable; urgency=low + + * Change directory path + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.24 + + -- InJun Yang Thu, 25 Oct 2012 13:58:16 +0900 + +bluetooth-share-ui (0.0.23) unstable; urgency=low + + * Upload the package + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.23 + + -- InJun Yang Fri, 12 Oct 2012 21:51:21 +0900 + +bluetooth-share-ui (0.0.22) unstable; urgency=low + + * Copy the license file in target + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.22 + + -- DoHyun Pyun Thu, 11 Oct 2012 15:52:05 +0900 + +bluetooth-share-ui (0.0.21) unstable; urgency=low + + * Apply smack manifest file + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.21 + + -- Sangki Park Mon, 24 Sep 2012 13:58:42 +0900 + +bluetooth-share-ui (0.0.20) unstable; urgency=low + + * Upload the package + * Git: magnolia/apps/connectivity/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.20 + + -- InJun Yang Thu, 23 Aug 2012 09:37:13 +0900 + +bluetooth-share-ui (0.0.19) unstable; urgency=low + + * Upload the package + * Git: slp/pkgs/b/bluetooth-share-ui + * Tag: bluetooth-share-ui_0.0.19 + + -- InJun Yang Fri, 10 Aug 2012 12:26:41 +0900 + bluetooth-share-ui (0.0.18) unstable; urgency=low * Upload the package diff --git a/debian/control b/debian/control index aa33fe5..6264d8c 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: main Priority: extra Maintainer: Hocheol Seo , DoHyun Pyun , InJun Yang , Chanyeol Park Uploaders: Sunil Behera , Syam Sidhardhan -Build-Depends: debhelper (>= 5),libevas-dev, libecore-dev, libelm-dev, libslp-sensor-dev, libappcore-efl-dev, libslp-utilx-dev, dlog-dev, libdbus-glib-1-dev, libglib2.0-dev, libaul-1-dev, libbluetooth-frwk-dev (>= 0.1.0), capi-appfw-application-dev, libbluetooth-share-dev +Build-Depends: debhelper (>= 5),libevas-dev, libecore-dev, libelm-dev, libappcore-efl-dev, libslp-utilx-dev, dlog-dev, libdbus-glib-1-dev, libglib2.0-dev, libaul-1-dev, libbluetooth-frwk-dev (>= 0.1.0), capi-appfw-application-dev, libbluetooth-share-dev Standards-Version: 0.1.0 Package: org.tizen.bluetooth-share-ui diff --git a/packaging/org.tizen.bluetooth-share-ui.spec b/packaging/org.tizen.bluetooth-share-ui.spec index 0f160b8..14f4b04 100644 --- a/packaging/org.tizen.bluetooth-share-ui.spec +++ b/packaging/org.tizen.bluetooth-share-ui.spec @@ -1,13 +1,19 @@ -%define _optdir /opt -%define _appdir %{_optdir}/apps +%define _usrdir /usr +%define _appdir %{_usrdir}/apps Name: org.tizen.bluetooth-share-ui Summary: bluetooth share UI application -Version: 0.0.18 +Version: 0.0.87 Release: 1 Group: TO_BE_FILLED -License: TO_BE_FILLED +License: Flora-1.1 Source0: %{name}-%{version}.tar.gz + +%if "%{?tizen_profile_name}" == "wearable" +ExcludeArch: %{arm} %ix86 x86_64 +%endif + +Requires(post): sys-assert BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(vconf) @@ -18,16 +24,22 @@ BuildRequires: pkgconfig(ecore-x) BuildRequires: pkgconfig(edbus) BuildRequires: pkgconfig(edje) BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(efl-assist) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(utilX) BuildRequires: pkgconfig(bluetooth-api) BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(capi-network-bluetooth) BuildRequires: pkgconfig(bluetooth-share-api) +BuildRequires: pkgconfig(notification) BuildRequires: cmake BuildRequires: edje-tools BuildRequires: gettext-devel +BuildRequires: hash-signer + +%define PKG_NAME org.tizen.bluetooth-share-ui %description bluetooth share UI application @@ -37,12 +49,29 @@ bluetooth share UI application %setup -q %build +export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" +export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" +export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" + +export CFLAGS="$CFLAGS -DTIZEN_EFL_THEME_2.2" +export CFLAGS+=" -fpie -fvisibility=hidden" +export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie" + cmake . -DCMAKE_INSTALL_PREFIX=%{_appdir}/org.tizen.bluetooth-share-ui make %{?jobs:-j%jobs} + %install rm -rf %{buildroot} %make_install +PKG_ID=org.tizen.bluetooth-share-ui +%define tizen_sign 1 +%define tizen_sign_base /usr/apps/${PKG_ID} +%define tizen_sign_level platform +%define tizen_author_sign 1 +%define tizen_dist_sign 1 + +install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/org.tizen.bluetooth-share-ui %post @@ -53,11 +82,15 @@ rm -rf %{buildroot} #%defattr(-,root,root,-) %files +%manifest bluetooth-share-ui.manifest +/etc/smack/accesses.d/org.tizen.bluetooth-share-ui.efl %defattr(-,root,root,-) %{_appdir}/org.tizen.bluetooth-share-ui/res/edje/bt-share-layout.edj -%{_appdir}/org.tizen.bluetooth-share-ui/res/images/* +%{_appdir}/org.tizen.bluetooth-share-ui/res/edje/images.edj %{_appdir}/org.tizen.bluetooth-share-ui/bin/bluetooth-share-ui -%{_optdir}/share/icons/default/small/org.tizen.bluetooth-share-ui.png -%{_optdir}/share/packages/org.tizen.bluetooth-share-ui.xml - +%{_appdir}/org.tizen.bluetooth-share-ui/author-signature.xml +%{_appdir}/org.tizen.bluetooth-share-ui/signature1.xml +%{_usrdir}/share/icons/default/small/org.tizen.bluetooth-share-ui.png +%{_usrdir}/share/packages/org.tizen.bluetooth-share-ui.xml +%{_datadir}/license/org.tizen.bluetooth-share-ui diff --git a/src/applog.h b/src/applog.h index dfb8e3a..2acc160 100644 --- a/src/applog.h +++ b/src/applog.h @@ -1,18 +1,25 @@ /* - * 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. - */ +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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 __APPLOG_H__ #define __APPLOG_H__ @@ -22,17 +29,6 @@ extern "C" { #endif /* - * SYSLOG_INFO(), SYSLOG_ERR(), SYSLOG_DBG() are syslog() wrappers. - * PRT_INFO(), PRT_ERR(), PRT_DBG() are fprintf() wrappers. - * - * If SLP_DEBUG is not defined, SYSLOG_DBG() and PRT_DBG() is ignored. - * - * IF SLP_SYSLOG_OUT or SLP_DAEMON is defined, - * INFO(), ERR(), DBG() are SYSLOG_XXX() - * Otherwise, - * They are PRT_XXX() - * - * * warn_if(exrp, fmt, ...) * If expr is true, The fmt string is printed using ERR(). * @@ -43,114 +39,28 @@ extern "C" { * */ -#if defined(SLP_SYSLOG_OUT) || defined(SLP_DAEMON) -#include -#endif #include #include -#define BT_SHARE "BT_SHARE_UI" +#undef LOG_TAG +#define LOG_TAG "BLUETOOTH_SHARE_UI" -#if defined(SLP_SYSLOG_OUT) || defined(SLP_DAEMON) -#define __LOG(prio, fmt, arg...) \ - do { syslog(prio, fmt, ##arg); } while (0) - -#define __LOGD(prio, fmt, arg...) \ - do { - syslog(prio, "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); - } while (0) -#else -#define __LOG(prio, fmt, arg...) do { } while (0) -#define __LOGD(prio, fmt, arg...) do { } while (0) -#endif - -#define __PRT(prio, fmt, arg...) \ - do { \ - fprintf((LOG_PRI(prio) == LOG_ERR ? stderr : stdout), \ - fmt"\n", ##arg); \ - } while (0) - -#define __PRTD(prio, fmt, arg...) \ - do { \ - fprintf((LOG_PRI(prio) == LOG_ERR ? stderr : stdout), \ - "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); \ - } while (0) -#define _NOUT (prio, fmt, arg...) do { } while (0) - -#ifdef SLP_DEBUG -#define _LOGD __LOGD -#define _LOG __LOGD -#define _PRTD __PRTD -#define _PRT __PRTD -#else -#define _LOGD _NOUT -#define _LOG __LOG -#define _PRTD _NOUT -#define _PRT __PRT -#endif - -#define SYSLOG_INFO(fmt, arg...) _LOG(LOG_INFO, fmt, ##arg) -#define SYSLOG_ERR(fmt, arg...) _LOG(LOG_ERR, fmt, ##arg) -#define SYSLOG_DBG(fmt, arg...) _LOGD(LOG_DEBUG, fmt, ##arg) - -#define PRT_INFO(fmt, arg...) \ - LOG(LOG_DEBUG, BT_SHARE, "%s:%d "fmt, __func__, __LINE__, ##arg) - -#define PRT_ERR(fmt, arg...) \ - LOG(LOG_DEBUG, BT_SHARE, "%s:%d "fmt, __func__, __LINE__, ##arg) - -#define PRT_DBG(fmt, arg...) \ - LOG(LOG_DEBUG, BT_SHARE, "%s:%d "fmt, __func__, __LINE__, ##arg) - -#if defined(SLP_SYSLOG_OUT) || defined(SLP_DAEMON) -#define INFO SYSLOG_INFO -#define ERR SYSLOG_ERR -#define DBG SYSLOG_DBG -#else #define INFO(fmt, arg...) \ - SLOG(LOG_DEBUG, BT_SHARE, "%s:%d "fmt, __func__, __LINE__, ##arg) + SLOGI(fmt, ##arg) #define ERR(fmt, arg...) \ - SLOG(LOG_DEBUG, BT_SHARE, "%s:%d "fmt, __func__, __LINE__, ##arg) + SLOGE(fmt, ##arg) #define DBG(fmt, arg...) \ - SLOG(LOG_DEBUG, BT_SHARE, "%s:%d "fmt, __func__, __LINE__, ##arg) -#endif + SLOGD(fmt, ##arg) -#ifdef SLP_DEBUG -#define warn_if(expr, fmt, arg...) do { \ - if (expr) { \ - ERR("(%s) -> "fmt, #expr, ##arg); \ - } \ - } while (0) -#define ret_if(expr) do { \ - if (expr) { \ - ERR("(%s) -> %s() return", #expr, __FUNCTION__); \ - return; \ - } \ - } while (0) -#define retv_if(expr, val) do { \ - if (expr) { \ - ERR("(%s) -> %s() return", #expr, __FUNCTION__); \ - return (val); \ - } \ - } while (0) -#define retm_if(expr, fmt, arg...) do { \ - if (expr) { \ - ERR(fmt, ##arg); \ - ERR("(%s) -> %s() return", #expr, __FUNCTION__); \ - return; \ - } \ - } while (0) -#define retvm_if(expr, val, fmt, arg...) do { \ - if (expr) { \ - ERR(fmt, ##arg); \ - ERR("(%s) -> %s() return", #expr, __FUNCTION__); \ - return (val); \ - } \ - } while (0) +#define DBG_SECURE(fmt, args...) SECURE_SLOGD(fmt, ##args) +#define ERR_SECURE(fmt, args...) SECURE_SLOGE(fmt, ##args) +#define INFO_SECURE(fmt, args...) SECURE_SLOGI(fmt, ##args) + +#define FN_START DBG("[ENTER FUNC]"); +#define FN_END DBG("[EXIT FUNC]"); -#else #define warn_if(expr, fmt, arg...) do { \ if (expr) { \ ERR(fmt, ##arg); \ @@ -179,8 +89,6 @@ extern "C" { } \ } while (0) -#endif - #ifdef __cplusplus } #endif diff --git a/src/bt-share-ui-ipc.c b/src/bt-share-ui-ipc.c old mode 100644 new mode 100755 index db4020d..28e2864 --- a/src/bt-share-ui-ipc.c +++ b/src/bt-share-ui-ipc.c @@ -1,113 +1,310 @@ /* - * 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. - */ +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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 #include #include #include #include -#include +#include #include "applog.h" #include "bt-share-ui-main.h" #include "bt-share-ui-ipc.h" #include "bt-share-ui-view.h" +#include "bt-share-ui-popup.h" #include "bt-share-ui-resource.h" -#include "bluetooth-share-api.h" -#define BT_ADDRESS_LENGTH_MAX 6 +#define BT_ADDRESS_LENGTH_MAX 6 +#define DBUS_CORE_APPS_PATH "/Org/Tizen/Coreapps/home/raise" +#define DBUS_CORE_APPS_INTERFACE "org.tizen.coreapps.home.raise" +#define DBUS_CORE_APPS_MEMBER "homeraise" -static void __handle_progress_signal(void *data, DBusMessage * msg) +static void __handle_opp_client_signal(void *data, DBusMessage *msg) { - int transfer_id; - int percentage; - const char *filename; - gboolean completed; - int error_type; - bt_share_appdata_t *ad = (bt_share_appdata_t *)data; - - retm_if(ad == NULL, "Invalid argument: data is NULL\n"); + bluetooth_event_param_t event_info = { 0, }; + int result = BLUETOOTH_ERROR_NONE; + const char *member = dbus_message_get_member(msg); + + retm_if(data == NULL, "Invalid argument: data is NULL\n"); retm_if(msg == NULL, "Invalid argument: msg is NULL\n"); - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_INT32, &transfer_id, - DBUS_TYPE_STRING, &filename, - DBUS_TYPE_INT32, &percentage, - DBUS_TYPE_BOOLEAN, &completed, - DBUS_TYPE_INT32, &error_type, - DBUS_TYPE_INVALID)) { - DBG("Event handling failed\n"); + if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) return; - } - if(completed == FALSE) { - _bt_update_progress_popup(ad, transfer_id, filename, percentage); - } else { - if(error_type == BLUETOOTH_ERROR_NONE) { - _bt_destroy_progress_popup(ad); + if (!dbus_message_has_interface(msg, BT_EVENT_SERVICE)) + return; - if (ad->app_layout == NULL) - _bt_terminate_app(); - } else { - DBG("Don,t terminate. Warning Popup will be shown.\n"); + if (!dbus_message_has_path(msg, BT_OPP_CLIENT_PATH)) + return; + + ret_if(member == NULL); + + if (strcasecmp(member, BT_OPP_CONNECTED) == 0) { + char *address = NULL; + int request_id = 0; + + if (!dbus_message_get_args(msg, NULL, + DBUS_TYPE_INT32, &result, + DBUS_TYPE_STRING, &address, + DBUS_TYPE_INT32, &request_id, + DBUS_TYPE_INVALID)) { + ERR("Unexpected parameters in signal"); + return; + } + event_info.event = BLUETOOTH_EVENT_OPC_CONNECTED; + event_info.param_data = address; + event_info.result = result; + event_info.user_data = data; + + _bt_share_ui_event_handler(BLUETOOTH_EVENT_OPC_CONNECTED, + &event_info, event_info.user_data); + } else if (strcasecmp(member, BT_TRANSFER_PROGRESS) == 0) { + char *file_name = NULL; + int request_id = 0; + guint64 size = 0; + int progress = 0; + bt_opc_transfer_info_t transfer_info; + + if (!dbus_message_get_args(msg, NULL, + DBUS_TYPE_INT32, &result, + DBUS_TYPE_STRING, &file_name, + DBUS_TYPE_UINT64, &size, + DBUS_TYPE_INT32, &progress, + DBUS_TYPE_INT32, &request_id, + DBUS_TYPE_INVALID)) { + ERR("Unexpected parameters in signal"); + return; + } + + memset(&transfer_info, 0x00, sizeof(bt_opc_transfer_info_t)); + + transfer_info.filename = g_strdup(file_name); + transfer_info.size = size; + transfer_info.percentage = progress; + + event_info.event = BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS; + event_info.param_data = &transfer_info; + event_info.result = result; + event_info.user_data = data; + + _bt_share_ui_event_handler( + BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS, + &event_info, event_info.user_data); + + g_free(transfer_info.filename); + } else if (strcasecmp(member, BT_TRANSFER_COMPLETED) == 0) { + char *file_name = NULL; + int request_id = 0; + guint64 size = 0; + bt_opc_transfer_info_t transfer_info; + + if (!dbus_message_get_args(msg, NULL, + DBUS_TYPE_INT32, &result, + DBUS_TYPE_STRING, &file_name, + DBUS_TYPE_UINT64, &size, + DBUS_TYPE_INT32, &request_id, + DBUS_TYPE_INVALID)) { + ERR("Unexpected parameters in signal"); + return; } + + memset(&transfer_info, 0x00, sizeof(bt_opc_transfer_info_t)); + + transfer_info.filename = g_strdup(file_name); + transfer_info.size = size; + + event_info.event = BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE; + event_info.param_data = &transfer_info; + event_info.result = result; + event_info.user_data = data; + + _bt_share_ui_event_handler( + BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE, + &event_info, event_info.user_data); + + g_free(transfer_info.filename); } } +static void __handle_obex_server_signal(void *data, DBusMessage *msg) +{ + bluetooth_event_param_t event_info = { 0, }; + int result = BLUETOOTH_ERROR_NONE; + const char *member = dbus_message_get_member(msg); + + retm_if(data == NULL, "Invalid argument: data is NULL\n"); + retm_if(msg == NULL, "Invalid argument: msg is NULL\n"); + + if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) + return; + + if (!dbus_message_has_interface(msg, BT_EVENT_SERVICE)) + return; + + if (!dbus_message_has_path(msg, BT_OPP_SERVER_PATH)) + return; + + retm_if(member == NULL, "member value is NULL\n"); + + if (strcasecmp(member, BT_TRANSFER_PROGRESS) == 0) { + char *file_name = NULL; + char *type = NULL; + int transfer_id = 0; + int progress = 0; + int server_type = 0; /* bt_server_type_t */ + guint64 size = 0; + bt_obex_server_transfer_info_t transfer_info; + + if (!dbus_message_get_args(msg, NULL, + DBUS_TYPE_INT32, &result, + DBUS_TYPE_STRING, &file_name, + DBUS_TYPE_STRING, &type, + DBUS_TYPE_UINT64, &size, + DBUS_TYPE_INT32, &transfer_id, + DBUS_TYPE_INT32, &progress, + DBUS_TYPE_INT32, &server_type, + DBUS_TYPE_INVALID)) { + ERR("Unexpected parameters in signal"); + return; + } -static void __handle_error_signal(void *data, DBusMessage * msg) + memset(&transfer_info, 0x00, + sizeof(bt_obex_server_transfer_info_t)); + + transfer_info.filename = g_strdup(file_name); + transfer_info.type = g_strdup(type); + transfer_info.file_size = size; + transfer_info.transfer_id = transfer_id; + transfer_info.percentage = progress; + + event_info.event = BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS; + event_info.param_data = &transfer_info; + event_info.result = result; + event_info.user_data = data; + + _bt_share_ui_event_handler( + BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS, + &event_info, event_info.user_data); + + g_free(transfer_info.filename); + g_free(transfer_info.type); + } else if (strcasecmp(member, BT_TRANSFER_COMPLETED) == 0) { + char *file_name = NULL; + char *device_name = NULL; + char *type = NULL; + char *file_path; + int transfer_id = 0; + int server_type = 0; /* bt_server_type_t */ + guint64 size = 0; + bt_obex_server_transfer_info_t transfer_info; + + if (!dbus_message_get_args(msg, NULL, + DBUS_TYPE_INT32, &result, + DBUS_TYPE_STRING, &file_name, + DBUS_TYPE_STRING, &type, + DBUS_TYPE_STRING, &device_name, + DBUS_TYPE_STRING, &file_path, + DBUS_TYPE_UINT64, &size, + DBUS_TYPE_INT32, &transfer_id, + DBUS_TYPE_INT32, &server_type, + DBUS_TYPE_INVALID)) { + ERR("Unexpected parameters in signal"); + return; + } + + memset(&transfer_info, 0x00, + sizeof(bt_obex_server_transfer_info_t)); + + transfer_info.filename = g_strdup(file_name); + transfer_info.type = g_strdup(type); + transfer_info.device_name = g_strdup(device_name); + transfer_info.file_path = g_strdup(file_path); + transfer_info.file_size = size; + transfer_info.transfer_id = transfer_id; + + event_info.event = BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED; + event_info.param_data = &transfer_info; + event_info.result = result; + event_info.user_data = data; + + _bt_share_ui_event_handler( + BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED, + &event_info, event_info.user_data); + + g_free(transfer_info.filename); + g_free(transfer_info.type); + g_free(transfer_info.device_name); + g_free(transfer_info.file_path); + } +} + +static void __handle_update_view_signal(void *data, DBusMessage * msg) { - int error; - bt_share_appdata_t *ad = (bt_share_appdata_t *)data; + bt_share_appdata_t *ad; + char *db; - retm_if(ad == NULL, "Invalid argument: data is NULL\n"); + retm_if(data == NULL, "Invalid argument: data is NULL\n"); retm_if(msg == NULL, "Invalid argument: msg is NULL\n"); - DBG("+\n"); + + ad = (bt_share_appdata_t *)data; + + DBG("+"); if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_INT32, &error, - DBUS_TYPE_INVALID)) { - ERR("Event handling failed\n"); + DBUS_TYPE_STRING, &db, + DBUS_TYPE_INVALID)) { + ERR("Event handling failed"); return; } - switch(error){ - case BLUETOOTH_ERROR_NOT_CONNECTED: - _bt_destroy_progress_popup(ad); - _bt_create_info_popup(ad, BT_STR_INFORMATION, - BT_STR_UNABLE_TO_SEND); - break; - case BLUETOOTH_ERROR_CANCEL: - _bt_destroy_progress_popup(ad); - _bt_create_info_popup(ad, BT_STR_INFORMATION, - BT_STR_UNABLE_TO_RECEIVE); - break; - case BLUETOOTH_ERROR_CANCEL_BY_USER: - case BLUETOOTH_ERROR_ACCESS_DENIED: - case BLUETOOTH_ERROR_OUT_OF_MEMORY: - case BLUETOOTH_ERROR_INTERNAL: - _bt_destroy_progress_popup(ad); - DBG("error : %d\n", error); - break; - default: - break; - } + _bt_share_ui_handle_update_view(ad, db); } +static void __handle_home_key_signal(void *data, DBusMessage *msg) +{ + const char *member; + + retm_if(data == NULL, "Invalid argument: data is NULL"); + retm_if(msg == NULL, "Invalid argument: msg is NULL"); + + member = dbus_message_get_member(msg); + retm_if(member == NULL, "member value is NULL"); + + if (dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_SIGNAL) + return; + + if (!dbus_message_has_interface(msg, DBUS_CORE_APPS_INTERFACE) || + !dbus_message_has_path(msg, DBUS_CORE_APPS_PATH)) + return; + + DBG("Received signal : %s", member); + + if (strcasecmp(member, DBUS_CORE_APPS_MEMBER) == 0) { + _bt_terminate_app(); + } +} static void __bt_add_tr_data_list(bt_share_appdata_t *ad, int transfer_type) { @@ -129,7 +326,7 @@ static void __bt_add_tr_data_list(bt_share_appdata_t *ad, int transfer_type) bt_share_close_db(db); /* Append new tr data to tr_data_list */ - len = g_slist_length(list); + len = g_slist_length(list); for (i = 0; i < len; i++) { info = list->data; if (transfer_type == BT_TR_OUTBOUND && @@ -138,70 +335,17 @@ static void __bt_add_tr_data_list(bt_share_appdata_t *ad, int transfer_type) else if (transfer_type == BT_TR_INBOUND && info->id > ad->inbound_latest_id) ad->tr_data_list = g_slist_append(ad->tr_data_list, info); + list = g_slist_next(list); + if (list == NULL) + return; } bt_share_release_tr_data_list(list); } -static void __handle_update_view_signal(void *data, DBusMessage * msg) -{ - retm_if(data== NULL, "Invalid argument: data is NULL\n"); - retm_if(msg == NULL, "Invalid argument: msg is NULL\n"); - - char *table; - bt_share_appdata_t *ad = (bt_share_appdata_t *)data; - GSList *list_iter = NULL; - sqlite3 *db = NULL; - int ret; - bt_tr_data_t *info = NULL; - int transfer_type; - - DBG("+\n"); - - if (ad->app_layout == NULL) - return; - - if (!dbus_message_get_args(msg, NULL, - DBUS_TYPE_STRING, &table, - DBUS_TYPE_INVALID)) { - ERR("Event handling failed\n"); - return; - } - - if (g_strcmp0(table, "inbound") == 0) - transfer_type = BT_TR_INBOUND; - else if (g_strcmp0(table, "outbound") == 0) - transfer_type = BT_TR_OUTBOUND; - - __bt_add_tr_data_list(ad, transfer_type); - - /* Insert new transfer result to first genlist item */ - list_iter = ad->tr_data_list; - if (transfer_type == BT_TR_INBOUND && ad->tr_type == BT_TR_INBOUND) { - while (NULL != list_iter) { - info = list_iter->data; - if (info->id > ad->inbound_latest_id) - _bt_prepend_genlist_tr_data_item(ad, info, transfer_type); - list_iter = g_slist_next(list_iter); - } - } else if (transfer_type == BT_TR_OUTBOUND && ad->tr_type == BT_TR_OUTBOUND) { - while (NULL != list_iter) { - info = list_iter->data; - if (info->id > ad->outbound_latest_id) - _bt_prepend_genlist_tr_data_item(ad, info, transfer_type); - list_iter = g_slist_next(list_iter); - } - } - - evas_object_show(ad->tr_genlist); - DBG("-\n"); -} - void _bt_signal_init(bt_share_appdata_t *ad) { - DBG("+\n"); - E_DBus_Connection *conn = NULL; E_DBus_Signal_Handler *sh = NULL; e_dbus_init(); @@ -213,53 +357,92 @@ void _bt_signal_init(bt_share_appdata_t *ad) sh = e_dbus_signal_handler_add(conn, NULL, - BT_SHARE_ENG_OBJECT, - BT_SHARE_ENG_INTERFACE, - BT_SHARE_ENG_SIGNAL_PROGRESS, - __handle_progress_signal, ad); - retm_if(sh == NULL, "Progress Event register failed\n"); - ad->progress_sh = sh; + BT_OPP_CLIENT_PATH, + BT_EVENT_SERVICE, + BT_TRANSFER_CONNECTED, + __handle_opp_client_signal, ad); + retm_if(sh == NULL, "Connect Event register failed\n"); + ad->client_connected_sh = sh; sh = e_dbus_signal_handler_add(conn, NULL, - BT_SHARE_ENG_OBJECT, - BT_SHARE_ENG_INTERFACE, - BT_SHARE_ENG_SIGNAL_ERROR, - __handle_error_signal, ad); - retm_if(sh == NULL, "Progress Event register failed\n"); - ad->error_sh = sh; + BT_OPP_CLIENT_PATH, + BT_EVENT_SERVICE, + BT_TRANSFER_PROGRESS, + __handle_opp_client_signal, ad); + retm_if(sh == NULL, "progress Event register failed\n"); + ad->client_progress_sh = sh; + + sh = e_dbus_signal_handler_add(conn, + NULL, + BT_OPP_CLIENT_PATH, + BT_EVENT_SERVICE, + BT_TRANSFER_COMPLETED, + __handle_opp_client_signal, ad); + retm_if(sh == NULL, "complete Event register failed\n"); + ad->client_completed_sh = sh; sh = e_dbus_signal_handler_add(conn, NULL, - BT_SHARE_ENG_OBJECT, - BT_SHARE_ENG_INTERFACE, - BT_SHARE_ENG_SIGNAL_UPDATE_VIEW, - __handle_update_view_signal, ad); + BT_OPP_SERVER_PATH, + BT_EVENT_SERVICE, + BT_TRANSFER_PROGRESS, + __handle_obex_server_signal, ad); + retm_if(sh == NULL, "progress Event register failed\n"); + ad->server_progress_sh = sh; + + sh = e_dbus_signal_handler_add(conn, + NULL, + BT_OPP_SERVER_PATH, + BT_EVENT_SERVICE, + BT_TRANSFER_COMPLETED, + __handle_obex_server_signal, ad); + retm_if(sh == NULL, "complete Event register failed\n"); + ad->server_completed_sh = sh; + + sh = e_dbus_signal_handler_add(conn, + NULL, + BT_SHARE_ENG_OBJECT, + BT_SHARE_ENG_INTERFACE, + BT_SHARE_ENG_SIGNAL_UPDATE_VIEW, + __handle_update_view_signal, ad); + retm_if(sh == NULL, "Progress Event register failed\n"); ad->update_sh = sh; + sh = e_dbus_signal_handler_add(conn, + NULL, + DBUS_CORE_APPS_PATH, + DBUS_CORE_APPS_INTERFACE, + DBUS_CORE_APPS_MEMBER, + __handle_home_key_signal, ad); + retm_if(sh == NULL, "Connect Event register failed"); + ad->app_core_sh = sh; + ad->dbus_conn = conn; - DBG(" -\n"); + return; } void _bt_signal_deinit(bt_share_appdata_t *ad) { - DBG("+\n"); ret_if(ad == NULL); - e_dbus_signal_handler_del(ad->dbus_conn, ad->progress_sh); - e_dbus_signal_handler_del(ad->dbus_conn, ad->error_sh); + e_dbus_signal_handler_del(ad->dbus_conn, ad->client_connected_sh); + e_dbus_signal_handler_del(ad->dbus_conn, ad->client_progress_sh); + e_dbus_signal_handler_del(ad->dbus_conn, ad->client_completed_sh); + e_dbus_signal_handler_del(ad->dbus_conn, ad->server_progress_sh); + e_dbus_signal_handler_del(ad->dbus_conn, ad->server_completed_sh); e_dbus_signal_handler_del(ad->dbus_conn, ad->update_sh); - DBG("-\n"); + e_dbus_signal_handler_del(ad->dbus_conn, ad->app_core_sh); return; } int _bt_abort_signal_send(bt_share_appdata_t *ad, bt_share_popup_data_t *pb_data) { - DBG("+\n"); + DBG("+"); DBusMessage *msg = NULL; retvm_if(pb_data == NULL, -1, @@ -277,46 +460,19 @@ int _bt_abort_signal_send(bt_share_appdata_t *ad, DBUS_TYPE_STRING, &pb_data->transfer_type, DBUS_TYPE_INT32, &pb_data->transfer_id, DBUS_TYPE_INVALID)) { - ERR("Abort sending failed\n"); + ERR("Abort sending failed"); dbus_message_unref(msg); return -1; } - DBG("pb_data->transfer_type = %s", pb_data->transfer_type); - DBG("pb_data->transfer_id = %d", pb_data->transfer_id); + ad->opp_transfer_abort = TRUE; /* Transfer aborted by user */ - e_dbus_message_send(ad->dbus_conn, msg, NULL, -1, NULL); - dbus_message_unref(msg); - DBG("-\n"); - return 0; -} - -int _bt_signal_send(bt_share_appdata_t *ad, char *signal, char *member) -{ - DBusMessage *msg = NULL; - - retvm_if(ad->dbus_conn== NULL, -1, - "Invalid argument: ad->dbus_conn is NULL\n"); - - msg = dbus_message_new_signal(BT_SHARE_ENG_OBJECT, - BT_SHARE_UI_INTERFACE, - signal); - - retvm_if(msg == NULL, -1, "msg is NULL\n"); - - if(member) { - if (!dbus_message_append_args(msg, - DBUS_TYPE_STRING, &member, - DBUS_TYPE_INVALID)) { - ERR("Connect sending failed\n"); - dbus_message_unref(msg); - return -1; - } - } + INFO("pb_data->transfer_type = %s", pb_data->transfer_type); + INFO("pb_data->transfer_id = %d", pb_data->transfer_id); e_dbus_message_send(ad->dbus_conn, msg, NULL, -1, NULL); dbus_message_unref(msg); - + DBG("-"); return 0; } @@ -342,31 +498,27 @@ static void __bt_conv_addr_string_to_addr_type(char *addr, int _bt_share_ui_ipc_retry_send(bt_share_appdata_t *ad, bt_tr_data_t *info) { - DBG("+\n"); + DBG("+"); DBusMessage *msg = NULL; - int reserved = 0; - int filecount = 1; - char *mode = NULL; + DBusMessageIter iter; + DBusMessageIter array_iter; + DBusMessageIter file_iter; + DBusMessageIter filepath_iter; const char *bd_addr = NULL; + char **file_path; + int i; retvm_if(info == NULL, -1, "Invalid argument: info is NULL\n"); retvm_if(ad->dbus_conn == NULL, -1, "Invalid argument: ad->dbus_conn is NULL\n"); - - mode = strdup("Normal"); - if (mode == NULL) - return -1; - - bd_addr = (char *)calloc(sizeof(char *), BT_ADDRESS_LENGTH_MAX); + bd_addr = (char *)calloc(sizeof(char), BT_ADDRESS_LENGTH_MAX); if (bd_addr == NULL) { - free(mode); return -1; } __bt_conv_addr_string_to_addr_type((char *)bd_addr, info->addr); - DBG("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5]); @@ -374,42 +526,82 @@ int _bt_share_ui_ipc_retry_send(bt_share_appdata_t *ad, bt_tr_data_t *info) msg = dbus_message_new_signal(BT_SHARE_ENG_OBJECT, BT_SHARE_UI_INTERFACE, BT_SHARE_UI_SIGNAL_SEND_FILE); - if (msg == NULL) { - ERR("msg is NULL\n"); + ERR("msg is NULL"); free((void *)bd_addr); - free(mode); return -1; } - if (!dbus_message_append_args(msg, - DBUS_TYPE_INT32, &reserved, - DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, - &bd_addr, BT_ADDRESS_LENGTH_MAX, - DBUS_TYPE_INT32, &filecount, - DBUS_TYPE_STRING, &info->file_path, - DBUS_TYPE_STRING, &mode, - DBUS_TYPE_INVALID)) { - ERR("Connect sending failed\n"); - dbus_message_unref(msg); + if (!g_utf8_validate(info->file_path, -1, NULL)) { + ERR("Invalid filepath"); free((void *)bd_addr); - free(mode); + + _bt_create_info_popup(ad, BT_STR_INFORMATION, + BT_STR_UNABLE_TO_SEND); + return -1; } +/* file validation check begin*/ + + if (access(info->file_path, F_OK) != 0) { + ERR("access failed. May be file is deleted from the Device"); + free((void *)bd_addr); + + _bt_create_info_popup(ad, BT_STR_INFORMATION, + BT_STR_FILE_NOT_EXIST); + + return 0; + } +/* file validation check end*/ + + file_path = g_new0(char *, 1); + file_path[0] = g_strdup(info->content); + + dbus_message_iter_init_append(msg, &iter); + + dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, + DBUS_TYPE_BYTE_AS_STRING, &array_iter); + + for (i = 0; i < BT_ADDRESS_LENGTH_MAX; i++) { + dbus_message_iter_append_basic(&array_iter, + DBUS_TYPE_BYTE, &bd_addr[i]); + } + dbus_message_iter_close_container(&iter, &array_iter); + + dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, + &info->dev_name); + dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, + &info->type); + + dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, + DBUS_TYPE_ARRAY_AS_STRING + DBUS_TYPE_BYTE_AS_STRING, &file_iter); + + dbus_message_iter_open_container(&file_iter, DBUS_TYPE_ARRAY, + DBUS_TYPE_BYTE_AS_STRING, &filepath_iter); + + for (i = 0; i < strlen(file_path[0]); i++) { + dbus_message_iter_append_basic(&filepath_iter, + DBUS_TYPE_BYTE, &file_path[0][i]); + } + + dbus_message_iter_close_container(&file_iter, &filepath_iter); + dbus_message_iter_close_container(&iter, &file_iter); e_dbus_message_send(ad->dbus_conn, msg, NULL, -1, NULL); dbus_message_unref(msg); free((void *)bd_addr); - free(mode); + g_free(file_path[0]); + g_free(file_path); - DBG("-\n"); + DBG("-"); return 0; } int _bt_share_ui_ipc_info_update(bt_share_appdata_t *ad, int uid) { - DBG("+\n"); + DBG("+"); retv_if(ad == NULL, -1); DBusMessage *msg = NULL; @@ -419,8 +611,8 @@ int _bt_share_ui_ipc_info_update(bt_share_appdata_t *ad, int uid) info_uid = uid; info_type = ad->tr_type; - DBG("info_uid = %d\n", info_uid); - DBG("info_type = %d\n", info_type); + INFO("info_uid = %d", info_uid); + INFO("info_type = %d", info_type); retvm_if(ad->dbus_conn == NULL, -1, "Invalid argument: ad->dbus_conn is NULL\n"); @@ -435,7 +627,7 @@ int _bt_share_ui_ipc_info_update(bt_share_appdata_t *ad, int uid) DBUS_TYPE_INT32, &info_uid, DBUS_TYPE_INT32, &info_type, DBUS_TYPE_INVALID)) { - ERR("Connect sending failed\n"); + ERR("Connect sending failed"); dbus_message_unref(msg); return -1; } @@ -443,7 +635,220 @@ int _bt_share_ui_ipc_info_update(bt_share_appdata_t *ad, int uid) e_dbus_message_send(ad->dbus_conn, msg, NULL, -1, NULL); dbus_message_unref(msg); - DBG("-\n"); + DBG("-"); return 0; } +void _bt_share_ui_handle_update_view(bt_share_appdata_t *ad, + char *table) +{ + GSList *list_iter = NULL; + bt_tr_data_t *info = NULL; + int transfer_type; + + DBG("+"); + + if (g_strcmp0(table, BT_INBOUND_TABLE) == 0) + transfer_type = BT_TR_INBOUND; + else if (g_strcmp0(table, BT_OUTBOUND_TABLE) == 0) + transfer_type = BT_TR_OUTBOUND; + else + return; + + __bt_add_tr_data_list(ad, transfer_type); + + /* Insert new transfer result to first genlist item */ + list_iter = ad->tr_data_list; + if (transfer_type == BT_TR_INBOUND && ad->tr_type == BT_TR_INBOUND) { + while (NULL != list_iter) { + info = list_iter->data; + if (info->id > ad->inbound_latest_id) + _bt_prepend_genlist_tr_data_item + (ad, info, transfer_type); + list_iter = g_slist_next(list_iter); + } + } else if (transfer_type == BT_TR_OUTBOUND && + ad->tr_type == BT_TR_OUTBOUND) { + while (NULL != list_iter) { + info = list_iter->data; + if (info->id > ad->outbound_latest_id) + _bt_prepend_genlist_tr_data_item + (ad, info, transfer_type); + list_iter = g_slist_next(list_iter); + } + } + + evas_object_show(ad->tr_genlist); + DBG("-"); +} + +static void __bt_share_ui_handle_progress(bt_share_appdata_t *ad, + int transfer_id, char *name, int percentage, + gboolean completed, int error_type) +{ + + if (completed == FALSE) { + _bt_update_progress_popup(ad, transfer_id, name, percentage); + } else { + if (error_type == BLUETOOTH_ERROR_NONE) { + if (ad->progress_popup && + (ad->pb_transfer_id == transfer_id)) + _bt_destroy_progress_popup(ad); + } else { + DBG("Don,t terminate. Warning Popup will be shown."); + } + } +} +static void __bt_share_ui_handle_error(bt_share_appdata_t *ad, int error_type, + bt_share_tr_type_e trans_type) +{ + + DBG("Error type : %d", error_type); + + switch (error_type) { + case BLUETOOTH_ERROR_NOT_CONNECTED: + _bt_destroy_progress_popup(ad); + _bt_create_info_popup(ad, BT_STR_INFORMATION, + BT_STR_UNABLE_TO_SEND); + break; + case BLUETOOTH_ERROR_CANCEL: + _bt_destroy_progress_popup(ad); + DBG("opp_transfer_abort by user:%d, trans_type = %d", + ad->opp_transfer_abort, ad->tr_type); + if (ad->ft_type != BT_FT_RETRY_POPUP && + ad->ft_type != BT_FT_SENT_POPUP && + ad->ft_type != BT_FT_FILE_NOT_EXIST && + (trans_type == BT_TR_INBOUND) && + !ad->opp_transfer_abort) + _bt_create_info_popup(ad, BT_STR_INFORMATION, + BT_STR_UNABLE_TO_RECEIVE); + else if (!ad->opp_transfer_abort && + (trans_type == BT_TR_OUTBOUND)) + _bt_create_info_popup(ad, BT_STR_INFORMATION, + BT_STR_UNABLE_TO_SEND); + ad->opp_transfer_abort = FALSE; + break; + case BLUETOOTH_ERROR_CANCEL_BY_USER: + case BLUETOOTH_ERROR_ACCESS_DENIED: + case BLUETOOTH_ERROR_OUT_OF_MEMORY: + case BLUETOOTH_ERROR_INTERNAL: + _bt_destroy_progress_popup(ad); + break; + default: + break; + } +} + +void _bt_share_ui_event_handler(int event, bluetooth_event_param_t *param, + void *user_data){ + + bt_obex_server_transfer_info_t *transfer_info; + bt_opc_transfer_info_t *client_info; + char *name = NULL; + int percentage = 0; + bt_share_appdata_t *ad = (bt_share_appdata_t *)user_data; + + switch (event) { + case BLUETOOTH_EVENT_OPC_CONNECTED: + INFO("BLUETOOTH_EVENT_OPC_CONNECTED"); + if (param->result != BLUETOOTH_ERROR_NONE) { + __bt_share_ui_handle_error(ad, param->result, + BT_TR_OUTBOUND); + _bt_share_ui_handle_update_view(ad, BT_OUTBOUND_TABLE); + } + break; + + case BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS: + client_info = (bt_opc_transfer_info_t *)param->param_data; + + name = strrchr(client_info->filename, '/'); + if (name) + name++; + else + name = client_info->filename; + + percentage = client_info->percentage; + __bt_share_ui_handle_progress(ad, 0, name, percentage, + FALSE, BLUETOOTH_ERROR_NONE); + break; + + case BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE: + INFO("BT_SHARE_EVENT_OPC_TRANSFER_COMPLETE "); + client_info = (bt_opc_transfer_info_t *)param->param_data; + + if (param->result != BLUETOOTH_ERROR_NONE) { + __bt_share_ui_handle_error(ad, param->result, + BT_TR_OUTBOUND); + + if (ad->tr_view) + _bt_share_ui_handle_update_view(ad, BT_OUTBOUND_TABLE); + else if (ad->info_popup == NULL) + _bt_terminate_app(); + + return; + } + + INFO_SECURE("client_info->filename = [%s]", + client_info->filename); + + name = strrchr(client_info->filename, '/'); + if (name) + name++; + else + name = client_info->filename; + + INFO("name address = [%x]", name); + __bt_share_ui_handle_progress(ad, 0, name, 100, TRUE, + param->result); + + if (ad->tr_view == NULL) + _bt_terminate_app(); + else + _bt_share_ui_handle_update_view(ad, BT_OUTBOUND_TABLE); + + break; + + case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS: + if (param->result == BLUETOOTH_ERROR_NONE) { + transfer_info = param->param_data; + __bt_share_ui_handle_progress(ad, + transfer_info->transfer_id, + transfer_info->filename, + transfer_info->percentage, + FALSE, BLUETOOTH_ERROR_NONE); + } + break; + + case BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED: + INFO("BT_EVENT_OBEX_TRANSFER_COMPLETED "); + + if (param->result != BLUETOOTH_ERROR_NONE) { + __bt_share_ui_handle_error(ad, param->result, + BT_TR_INBOUND); + + if (ad->tr_view) + _bt_share_ui_handle_update_view(ad, + BT_INBOUND_TABLE); + + return; + } + + transfer_info = param->param_data; + + __bt_share_ui_handle_progress(ad, transfer_info->transfer_id, + transfer_info->filename, + transfer_info->percentage, TRUE, param->result); + + if (ad->tr_view == NULL) + _bt_terminate_app(); + else + _bt_share_ui_handle_update_view(ad, BT_INBOUND_TABLE); + + break; + + default: + DBG("Unhandled event %x", event); + break; + } + +} diff --git a/src/bt-share-ui-ipc.h b/src/bt-share-ui-ipc.h index 4f576a4..4552bea 100644 --- a/src/bt-share-ui-ipc.h +++ b/src/bt-share-ui-ipc.h @@ -1,18 +1,25 @@ /* - * 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. - */ +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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_BT_SHARE_UI_IPC_H_ #define __DEF_BT_SHARE_UI_IPC_H_ @@ -22,6 +29,7 @@ extern "C" { #endif #include "bluetooth-share-api.h" +#include #define BT_SHARE_UI_INTERFACE "User.BluetoothShare.UI" #define BT_SHARE_UI_SIGNAL_OPPABORT "opp_abort" @@ -34,6 +42,17 @@ extern "C" { #define BT_SHARE_ENG_SIGNAL_PROGRESS "transfer_progress" #define BT_SHARE_ENG_SIGNAL_ERROR "error_type" #define BT_SHARE_ENG_SIGNAL_UPDATE_VIEW "update_view" +#define BT_INBOUND_TABLE "inbound" +#define BT_OUTBOUND_TABLE "outbound" + +#define BT_EVENT_SERVICE "org.projectx.bt_event" +#define BT_OPP_CLIENT_PATH "/org/projectx/bt/opp_client" +#define BT_OPP_SERVER_PATH "/org/projectx/bt/opp_server" +#define BT_OPP_CONNECTED "OppConnected" +#define BT_TRANSFER_STARTED "TransferStarted" +#define BT_TRANSFER_PROGRESS "TransferProgress" +#define BT_TRANSFER_COMPLETED "TransferCompleted" +#define BT_TRANSFER_CONNECTED "TransferConnected" typedef enum { BT_TR_ONGOING = -1, @@ -52,11 +71,15 @@ typedef struct { void _bt_signal_init(bt_share_appdata_t *ad); void _bt_signal_deinit(bt_share_appdata_t *ad); -int _bt_signal_send(bt_share_appdata_t *ad, char *signal, char *member); int _bt_share_ui_ipc_retry_send(bt_share_appdata_t *ad, bt_tr_data_t *info); int _bt_share_ui_ipc_info_update(bt_share_appdata_t *ad, int uid); int _bt_abort_signal_send(bt_share_appdata_t *ad, bt_share_popup_data_t *pb_data); +void _bt_share_ui_event_handler(int event, bluetooth_event_param_t *param, + void *user_data); +void _bt_share_ui_handle_update_view(bt_share_appdata_t *ad, + char *table); + #ifdef __cplusplus } #endif diff --git a/src/bt-share-ui-main.c b/src/bt-share-ui-main.c index fcc0b8f..1a52842 100644 --- a/src/bt-share-ui-main.c +++ b/src/bt-share-ui-main.c @@ -1,22 +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. - */ +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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 -#include -#include +#include +#include +#include #include #include #include @@ -25,165 +33,173 @@ #include #include #include +#include #include "applog.h" #include "bt-share-ui-main.h" #include "bt-share-ui-view.h" +#include "bt-share-ui-popup.h" #include "bt-share-ui-ipc.h" #include "bt-share-ui-resource.h" - -#include "bluetooth-share-api.h" +#include +#include bt_share_appdata_t *app_state = NULL; -static int __bt_utilx_ss_get_window_property(Display *dpy, - Window win, - Atom atom, - Atom type, - unsigned int *val, - unsigned int len) -{ - unsigned char *prop_ret; - Atom type_ret; - unsigned long bytes_after; - unsigned long num_ret; - int format_ret; - unsigned int i; - int num; - - prop_ret = NULL; - if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False, - type, &type_ret, &format_ret, &num_ret, - &bytes_after, &prop_ret) != Success) - return -1; - - if (type_ret != type || format_ret != 32) - num = -1; - else if (num_ret == 0 || !prop_ret) - num = 0; - else { - if (num_ret < len) - len = num_ret; - for (i = 0; i < len; i++) { - val[i] = ((unsigned long *)prop_ret)[i]; - } - num = len; - } - - if (prop_ret) - XFree(prop_ret); - - return num; -} - - -static int __bt_utilx_rotation_get(Display *dpy, Window win) +static void __bt_lang_changed_cb(app_event_info_h event_info, void *data) { - Window active_win; - Window root_win; - int rotation = -1; - int ret; + DBG("+"); + ret_if(data == NULL); - Atom atom_active_win; - Atom atom_win_rotate_angle; + bt_share_appdata_t *ad = (bt_share_appdata_t *)data; - root_win = XDefaultRootWindow(dpy); - - atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); - ret = - __bt_utilx_ss_get_window_property(dpy, root_win, atom_active_win, - XA_WINDOW, - (unsigned int *)&active_win, 1); - - if (ret < 0) - return ret; + if (ad->tr_genlist) { + elm_genlist_realized_items_update(ad->tr_genlist); + } - atom_win_rotate_angle = - XInternAtom(dpy, "_E_ILLUME_ROTATE_WINDOW_ANGLE", False); - ret = - __bt_utilx_ss_get_window_property(dpy, active_win, - atom_win_rotate_angle, - XA_CARDINAL, - (unsigned int *)&rotation, 1); + if (ad->navi_it) { + elm_object_item_text_set(ad->navi_it, + (ad->tr_type == BT_TR_INBOUND) ? + BT_STR_RECEIVED_FILES : + BT_STR_SENT_FILES); + Evas_Object *nocontents = elm_object_item_part_content_get( + ad->navi_it, + "elm.swallow.content"); + elm_object_part_text_set(nocontents, "elm.text", + BT_STR_NO_TRANSFER_HISTORY); + } - if (ret != -1) - return rotation; + if (ad->ft_popup) { + _bt_lang_changed_ft_popup(ad); + } - return -1; + if (ad->progress_popup) { + _bt_lang_changed_progress_popup(ad); + } } -static int __bt_x_rotation(Evas_Object *parent) +static int __bt_parse_launch_mode(bt_share_appdata_t *ad, bundle *b) { - Ecore_X_Window xwin; - Display *dpy; - int rotation; - - xwin = elm_win_xwindow_get(parent); - dpy = ecore_x_display_get(); - - rotation = __bt_utilx_rotation_get(dpy, xwin); + const char *launch_type = NULL; - if (rotation == -1) - rotation = 0; + retvm_if(ad == NULL, -1, "Invalid param"); + retvm_if(b == NULL, -1, "Invalid param"); - if (rotation >= 0) - elm_win_rotation_with_resize_set(parent, rotation); + launch_type = bundle_get_val(b, "launch-type"); + retv_if(!launch_type, -1); + if (!strcasecmp(launch_type, "ongoing")) { + ad->launch_mode = BT_LAUNCH_ONGOING; + } else if (!strcasecmp(launch_type, "warning_popup")) { + ad->launch_mode = BT_LAUNCH_WARNING_POPUP; + } else if (!strcasecmp(launch_type, "transfer_list")) { + ad->launch_mode = BT_LAUNCH_TRANSFER_LIST; + } else { + ERR("Invalid bundle value"); + return -1; + } return 0; } static int __bt_share_launch_handler(bt_share_appdata_t *ad, bundle *b) { - const char *launch_type = NULL; + INFO("+"); bt_share_popup_data_t *pb_data = NULL; const char *str = NULL; const char *transfer_type = NULL; const char *temp = NULL; + int tr_type = 0; + sqlite3 *db = NULL; + bt_adapter_state_e bt_state = BT_ADAPTER_DISABLED; retvm_if(ad == NULL, -1, "Invalid param"); retvm_if(b == NULL, -1, "Invalid param"); - launch_type = bundle_get_val(b, "launch-type"); - if (!launch_type) - return -1; + if (ad->launch_mode == BT_LAUNCH_ONGOING) { + INFO("BT_LAUNCH_ONGOING"); + + /*Check adapter state, if disabled then return */ + if (bt_adapter_get_state(&bt_state) == BT_ERROR_NONE) { + if (bt_state == BT_ADAPTER_DISABLED) { + DBG("Adapter disabled, returning"); + return 0; + } + } else + ERR("bt_adapter_get_state() failed"); + + + + if (ad->tr_view == NULL) { + Evas_Object *e = NULL; + Ecore_Evas *ee = NULL; + e = evas_object_evas_get(ad->win); + ee = ecore_evas_ecore_evas_get(e); + ecore_evas_name_class_set(ee,"APP_POPUP","APP_POPUP"); + } - if (!strcasecmp(launch_type, "ongoing")) { pb_data = g_new0(bt_share_popup_data_t, 1); pb_data->filename = g_strdup(bundle_get_val(b, "filename")); pb_data->percentage = g_strdup(bundle_get_val(b, "percentage")); - pb_data->transfer_type = g_strdup(bundle_get_val(b, "transfer_type")); + pb_data->transfer_type = g_strdup( + bundle_get_val(b, "transfer_type")); temp = bundle_get_val(b, "transfer_id"); if (temp != NULL) pb_data->transfer_id = atoi(temp); if (g_strcmp0(pb_data->transfer_type, "outbound") == 0) { pb_data->progress_cnt = g_strdup(bundle_get_val(b, "progress_cnt")); - DBG("progress cnt : %s \n", pb_data->progress_cnt); + INFO("progress cnt : %s", pb_data->progress_cnt); + ad->ft_type = BT_FT_SENT_POPUP; } - DBG("filename %s \n", pb_data->filename); - DBG("percentage %s \n", pb_data->percentage); - DBG("transfer_type %s \n", pb_data->transfer_type); - DBG("transfer_id %d \n", pb_data->transfer_id); - - _bt_create_progress_popup(pb_data); - } else if (!strcasecmp(launch_type, "warning_popup")) { - _bt_destroy_progress_popup(ad); + INFO_SECURE("filename %s", pb_data->filename); + INFO("percentage %s", pb_data->percentage); + INFO("transfer_type %s", pb_data->transfer_type); + INFO("transfer_id %d", pb_data->transfer_id); + /* Notificaton id of ongoing item */ + if (ad->progress_popup) + _bt_destroy_progress_popup(ad); + ad->progress_popup = _bt_create_progress_popup(pb_data); + retvm_if (ad->progress_popup == NULL, -1, "fail to create progress popup"); + + evas_object_data_set(ad->progress_popup, "progressbar_data", pb_data); + } else if (ad->launch_mode == BT_LAUNCH_WARNING_POPUP) { + INFO("BT_LAUNCH_WARNING_POPUP"); + if (ad->progress_popup) + _bt_destroy_progress_popup(ad); str = bundle_get_val(b, "message"); _bt_create_extinctive_info_popup(ad, BT_STR_INFORMATION, str); - } else if (!strcasecmp(launch_type, "transfer_list")) { - _bt_destroy_progress_popup(ad); - transfer_type = bundle_get_val(b, "transfer_type"); - if (!transfer_type) - return -1; + } else if (ad->launch_mode == BT_LAUNCH_TRANSFER_LIST) { + INFO("BT_LAUNCH_TRANSFER_LIST"); + elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE); - DBG("transfer_type %s \n", transfer_type); + if (ad->progress_popup) + _bt_destroy_progress_popup(ad); + transfer_type = bundle_get_val(b, "transfer_type"); + retvm_if (!transfer_type, -1, "Invalid transfer type!"); if (!strcmp(transfer_type, "outbound")) - ad->tr_type = BT_TR_OUTBOUND; + tr_type = BT_TR_OUTBOUND; + else + tr_type = BT_TR_INBOUND; + + retvm_if(ad->tr_view && ad->tr_type == tr_type, 0, + "same view. no need to create transfer view!"); + + INFO("Transfer type : %s", transfer_type); + ad->tr_type = tr_type; + + /* Get data from share DB */ + db = bt_share_open_db(); + retvm_if(!db, NULL, "fail to open db!"); + + ad->tr_data_list = bt_share_get_completed_tr_data_list(db, ad->tr_type); + bt_share_close_db(db); + + if (ad->tr_data_list) + _bt_create_transfer_view(ad); else - ad->tr_type = BT_TR_INBOUND; + _bt_nocontent_set(ad, TRUE); - if (_bt_create_transfer_list(ad)) - ERR("UI creation failed"); } else { ERR("Invalid bundle value"); return -1; @@ -192,57 +208,112 @@ static int __bt_share_launch_handler(bt_share_appdata_t *ad, bundle *b) return 0; } -static int __app_create(void *data) +static bool __app_create(void *data) { - DBG(" __app_create\n"); + INFO(" __app_create"); bt_share_appdata_t *ad = data; Evas_Object *win = NULL; + int ret; + bt_adapter_state_e status = BT_ADAPTER_DISABLED; + Ea_Theme_Color_Table *color_table = NULL; + Ea_Theme_Font_Table *font_table = NULL; + + elm_app_base_scale_set(1.8); /* create window */ win = _bt_create_win(PACKAGE); - retv_if(win == NULL, -1); + retv_if(win == NULL, false); ad->win = win; - /* init internationalization */ - if (appcore_set_i18n(BT_COMMON_PKG, BT_COMMON_RES) < 0) - return -1; + bindtextdomain(BT_COMMON_PKG, BT_COMMON_RES); - return 0; + /* Enable Changeable UI feature */ + ea_theme_changeable_ui_enabled_set(EINA_TRUE); + + color_table = _bt_color_table_set(); + font_table = _bt_font_table_set(); + + if (bt_initialize() != BT_ERROR_NONE) + ERR("bt_initialize() failed"); + + if (bt_adapter_get_state(&status) != BT_ERROR_NONE) + ERR("bt_adapter_get_state() failed!"); + + ad->bt_status = status; + + /* Set event callbacks */ + ret = + bt_adapter_set_state_changed_cb(_bt_cb_state_changed, (void *)ad); + if (ret != BT_ERROR_NONE) + ERR("bt_adapter_set_state_changed_cb failed"); + return true; } -static int __app_reset(bundle *b, void *data) +static void __app_service(app_control_h app_control, void *user_data) { - DBG("__app_reset\n"); - bt_share_appdata_t *ad = data; + INFO("__app_service"); + bt_share_appdata_t *ad = user_data; int ret; - retv_if(ad == NULL, -1); + bundle *b = NULL; + ret_if(ad == NULL); + + ret = app_control_export_as_bundle(app_control, &b); - if(ad->dbus_conn == NULL) { + if (ad->dbus_conn == NULL) { _bt_signal_init(ad); } + if(__bt_parse_launch_mode(ad, b) == -1) { + if (b) + bundle_free(b); + return; + } + + if (ad->launch_mode == BT_LAUNCH_ONGOING || + ad->launch_mode == BT_LAUNCH_WARNING_POPUP) { + if (ad->tr_view == NULL) { + if (elm_win_alpha_get(ad->win) == FALSE) { + elm_win_alpha_set(ad->win, TRUE); + Display *dpy; + Window win; + int ret; + + dpy = ecore_x_display_get(); + win = elm_win_xwindow_get(ad->win); + + ret = utilx_set_window_opaque_state(dpy, + win, UTILX_OPAQUE_STATE_ON); + if (!ret) + { + ERR("Error! Failed to set opaque state."); + } + } + } + } else if (elm_win_alpha_get(ad->win)) + elm_win_alpha_set(ad->win, FALSE); + + + /* Set rotation Callback */ + if (elm_win_wm_rotation_supported_get(ad->win)) { + int rots[4] = { 0, 90, 180, 270 }; + elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); + } + ret = __bt_share_launch_handler(ad, b); if (ret < 0) _bt_terminate_app(); - /* Set the real rotate mode */ - __bt_x_rotation(ad->win); - - if (ad->progress_popup || ad->info_popup) { - if (ad->app_layout == NULL) - elm_win_alpha_set(ad->win, 1); - } evas_object_show(ad->win); elm_win_activate(ad->win); - - return 0; + bundle_free(b); } -static int __app_terminate(void *data) +static void __app_terminate(void *data) { - DBG("__app_terminate \n"); + INFO("__app_terminate "); bt_share_appdata_t *ad = data; + int err; _bt_destroy_info_popup(ad); _bt_signal_deinit(ad); @@ -255,37 +326,51 @@ static int __app_terminate(void *data) if (ad->win) evas_object_del(ad->win); - return 0; + err = bt_adapter_unset_state_changed_cb(); + if (err != BT_ERROR_NONE) + ERR("unset of state change cb failed: %d", err); + + err = bt_deinitialize(); + if (err != BT_ERROR_NONE) + ERR("bt_deinitialize failed: %d", err); + + } -static int __app_pause(void *data) +static void __app_pause(void *data) { - DBG("__app_pause \n"); - return 0; + INFO("__app_pause "); } -static int __app_resume(void *data) +static void __app_resume(void *data) { - DBG("__app_resume\n"); - return 0; + INFO("__app_resume"); } - -int main(int argc, char *argv[]) +EXPORT int main(int argc, char *argv[]) { - bt_share_appdata_t ad; + DBG("Start bluetooth-share-ui main()"); + + ui_app_lifecycle_callback_s callback = {0,}; + app_event_handler_h lang_changed_handler; + bt_share_appdata_t ad = {0,}; app_state = &ad; - struct appcore_ops ops = { - .create = __app_create, - .terminate = __app_terminate, - .pause = __app_pause, - .resume = __app_resume, - .reset = __app_reset, - }; - - memset(&ad, 0x0, sizeof(bt_share_appdata_t)); - ops.data = &ad; - - return appcore_efl_main(PACKAGE, &argc, &argv, &ops); + + callback.create = __app_create; + callback.terminate = __app_terminate; + callback.pause = __app_pause; + callback.resume = __app_resume; + callback.app_control = __app_service; + + ui_app_add_event_handler(&lang_changed_handler, APP_EVENT_LANGUAGE_CHANGED, __bt_lang_changed_cb, &ad); + + DBG("ui_app_main() is called."); + int ret = ui_app_main(argc, argv, &callback, &ad); + if (ret != APP_ERROR_NONE) { + ERR("ui_app_main() is failed. err = %d", ret); + } + + DBG("End bluetooth-share-ui main()"); + return ret; } diff --git a/src/bt-share-ui-main.h b/src/bt-share-ui-main.h old mode 100644 new mode 100755 index 4991ed8..c93d9d5 --- a/src/bt-share-ui-main.h +++ b/src/bt-share-ui-main.h @@ -1,18 +1,25 @@ /* - * 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. - */ +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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_BT_SHARE_UI_MAIN_H_ #define __DEF_BT_SHARE_UI_MAIN_H_ @@ -25,32 +32,41 @@ extern "C" { #include #include #include - +#include +#include +#include +#define EXPORT __attribute__((visibility("default"))) #if !defined(PACKAGE) #define PACKAGE "org.tizen.bluetooth-share-ui" #endif -#if !defined(LOCALEDIR) -#define LOCALEDIR "/opt/apps/org.tizen.bluetooth/res/locale" -#endif - #if !defined(EDJFILE) -#define EDJFILE "/opt/apps/org.tizen.bluetooth-share-ui/res/edje/bt-share-layout.edj" +#define EDJDIR "/usr/apps/org.tizen.bluetooth-share-ui/res/edje" +#define EDJFILE EDJDIR"/bt-share-layout.edj" +#define EDJ_IMAGES EDJDIR "/images.edj" +#define VCONFKEY_SETAPPL_CHANGE_UI_THEME_INT VCONFKEY_SETAPPL_PREFIX"/change_ui/theme" + #endif typedef enum { BT_TR_OUTBOUND, BT_TR_INBOUND -} bt_share_tr_type_t; +} bt_share_tr_type_e; + +typedef enum { + CSC_DCM, + CSC_FTM, +} bt_share_csc_type_t; typedef enum { BT_FT_RECV_FAIL_POPUP, BT_FT_RECV_SUCCESS_POPUP, BT_FT_SENT_POPUP, - BT_FT_RETRY_POPUP -} bt_share_ft_popup_type_t; + BT_FT_RETRY_POPUP, + BT_FT_FILE_NOT_EXIST +} bt_share_ft_popup_type_e; typedef struct { const char *filename; @@ -61,23 +77,39 @@ typedef struct { } bt_share_popup_data_t; typedef struct { + bt_tr_data_t *tr_data; + gboolean highlighted; +} bt_gl_data_t; + +typedef enum { + BT_LAUNCH_ONGOING = 0x00, + BT_LAUNCH_WARNING_POPUP = 0x01, + BT_LAUNCH_TRANSFER_LIST = 0x02, +} bt_share_launch_mode_t; + +typedef struct { + bt_share_launch_mode_t launch_mode; + bt_adapter_state_e bt_status; Evas_Object *win; - Evas_Object *layout_main; - Evas_Object *app_layout; + Ea_Theme_Color_Table *table; + Evas_Object *bg; + Evas_Object *conform; + Evas_Object *tr_view; Evas_Object *navi_fr; - Evas_Object *nocontent; - Elm_Object_Item *toolbar_item; + Elm_Object_Item *navi_it; + Evas_Object *toolbar_btn; /* Progress Popup */ Evas_Object *progress_layout; Evas_Object *progress_popup; Evas_Object *pb; int pb_transfer_id; - + bt_share_popup_data_t *progress_data; /* File transfer status popup*/ - Evas_Object *ft_layout; Evas_Object *ft_popup; + bt_share_ft_popup_type_e ft_type; + bt_tr_data_t *ft_info; /* Information Popup */ Evas_Object *info_popup; @@ -92,14 +124,18 @@ typedef struct { int timer; E_DBus_Connection *dbus_conn; - E_DBus_Signal_Handler *progress_sh; - E_DBus_Signal_Handler *error_sh; + E_DBus_Signal_Handler *client_connected_sh; + E_DBus_Signal_Handler *client_progress_sh; + E_DBus_Signal_Handler *client_completed_sh; + E_DBus_Signal_Handler *server_progress_sh; + E_DBus_Signal_Handler *server_completed_sh; E_DBus_Signal_Handler *update_sh; + E_DBus_Signal_Handler *app_core_sh; - bt_share_tr_type_t tr_type; - int list_item_cnt; + bt_share_tr_type_e tr_type; int inbound_latest_id; int outbound_latest_id; + bool opp_transfer_abort; } bt_share_appdata_t; #ifdef __cplusplus diff --git a/src/bt-share-ui-popup.c b/src/bt-share-ui-popup.c new file mode 100755 index 0000000..84b5e14 --- /dev/null +++ b/src/bt-share-ui-popup.c @@ -0,0 +1,822 @@ +/* +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "applog.h" +#include "bt-share-ui-view.h" +#include "bt-share-ui-popup.h" +#include "bt-share-ui-ipc.h" +#include "bt-share-ui-resource.h" +#include "bt-share-ui-widget.h" +#include "bt-share-ui-main.h" + +#define NEW_LINE "\n" + +extern bt_share_appdata_t *app_state; + + +static void __bt_destroy_ft_popup(bt_share_appdata_t *ad) +{ + DBG(""); + ret_if(ad == NULL); + + if (ad->ft_popup) { + DBG("delete ft_popup"); + evas_object_del(ad->ft_popup); + ad->ft_popup = NULL; + } + + return; +} + +static void __bt_ft_retry_ok_cb(void *data, Evas_Object *obj, void *event_info) +{ + DBG("+"); + + ret_if(data == NULL); + bt_share_appdata_t *ad = app_state; + bt_tr_data_t *info = (bt_tr_data_t *)data; + + __bt_destroy_ft_popup(ad); + + if (ad->bt_status == BT_ADAPTER_ENABLED) { + if (!_bt_share_ui_ipc_retry_send(ad, info)) { + INFO(" info->id %d", info->id); + _bt_share_ui_ipc_info_update(ad, info->id); + _bt_delete_selected_item(ad); + } + } + + DBG("-"); + return; +} + +static void __bt_ft_retry_cancel_cb(void *data, Evas_Object *obj, void *event_info) +{ + DBG("+"); + + ret_if(data == NULL); + bt_share_appdata_t *ad = app_state; + + __bt_destroy_ft_popup(ad); + + DBG("-"); + return; +} + +static void __bt_ft_retry_mouseup_cb(void *data, + Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + bt_share_appdata_t *ad = app_state; + bt_tr_data_t *info = (bt_tr_data_t *)data; + + DBG("Mouse event callback function is called +"); + if (ev->button == 3) { + __bt_destroy_ft_popup(ad); + _bt_share_ui_ipc_info_update(ad, info->id); + } + + DBG("Mouse event callback -"); +} + +static void __bt_ft_ok_popup_cb(void *data, Evas_Object *obj, + void *event_info) +{ + DBG(" +"); + ret_if(data == NULL); + ret_if(!obj); + bt_share_appdata_t *ad = app_state; + bt_tr_data_t *info = (bt_tr_data_t *)data; + + const char *text = elm_object_text_get(obj); + + if (!g_strcmp0(text, BT_STR_RETRY)) { + __bt_ft_retry_ok_cb(data, obj, event_info); + return; + } + + __bt_destroy_ft_popup(ad); + + if (ad->bt_status == BT_ADAPTER_DISABLED) + _bt_update_tr_notification(info); + else /*Adapter enabled case */ + _bt_share_ui_ipc_info_update(ad, info->id); + + _bt_delete_selected_item(ad); + + DBG("-"); + return; +} + +static void __bt_ft_ok_mouseup_cb(void *data, + Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + bt_share_appdata_t *ad = app_state; + bt_tr_data_t *info = (bt_tr_data_t *)data; + + DBG("Mouse event callback function is called +"); + + if (ev->button == 3) { + __bt_destroy_ft_popup(ad); + _bt_share_ui_ipc_info_update(ad, info->id); + _bt_delete_selected_item(ad); + } + DBG("Mouse event callback -"); +} + +static Evas_Object *__bt_create_popup_layout(Evas_Object *parent, bt_share_appdata_t *ad) +{ + Evas_Object *layout = NULL; + + layout = elm_layout_add(parent); + elm_layout_file_set(layout, EDJFILE, "ft_popup"); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + ad->progress_layout = layout; + return layout; +} + +static Evas_Object *__bt_create_progressbar(Evas_Object *parent, bt_share_appdata_t *ad) +{ + Evas_Object *progressbar = NULL; + progressbar = elm_progressbar_add(parent); + elm_object_style_set(progressbar, "list_progress"); + elm_progressbar_horizontal_set(progressbar, EINA_TRUE); + evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); + evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_signal_emit(progressbar, "elm,units,show", "elm"); + elm_progressbar_value_set(progressbar, 0.0); + evas_object_show(progressbar); + return progressbar; +} + +static Evas_Object *__bt_create_popup_pb_layout(Evas_Object *parent, bt_share_appdata_t *ad) +{ + Evas_Object *layout = NULL; + + layout = elm_layout_add(parent); + elm_layout_file_set(layout, EDJFILE, "popup_2text_progressbar_view_layout"); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + ad->progress_layout = layout; + return layout; +} + +Evas_Object *_bt_create_ft_popup(bt_share_ft_popup_type_e type, bt_tr_data_t *info) +{ + DBG(" +"); + bt_share_appdata_t *ad = app_state; + Evas_Object *popup = NULL; + char msg[BT_GLOBALIZATION_STR_LENGTH] = { 0 }; + char tmp[BT_GLOBALIZATION_STR_LENGTH] = { 0 }; + char *name = NULL; + char *markup_text = NULL; + + if (info->file_path == NULL) { + ERR("Invalid data"); + return NULL; + } + + popup = elm_popup_add(ad->win); + evas_object_size_hint_weight_set(popup, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + INFO("Popup type : %d", type); + ad->ft_type = type; + ad->ft_info = info; + + if (type == BT_FT_SENT_POPUP) { + DBG("BT_FT_SENT_POPUP"); + elm_object_part_text_set(popup, "title,text", BT_STR_SENT_FILES); + char file_size_str[BT_FILE_SIZE_STR] = { 0 }; + + snprintf(msg, sizeof(msg), BT_STR_TO_S, info->dev_name); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + name = strrchr(info->file_path, '/'); + if (name != NULL) + name++; + else + name = info->file_path; + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, name); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + /* file size */ + if (info->size < 1024) + snprintf(file_size_str, sizeof(file_size_str), + "%dB", info->size); + else if (info->size > 1024 * 1024) + snprintf(file_size_str, sizeof(file_size_str), + "%dMB", info->size / (1024 * 1024)); + else + snprintf(file_size_str, sizeof(file_size_str), + "%dKB", info->size / 1024); + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_SIZE_S, file_size_str); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(popup, markup_text); + } else if (type == BT_FT_RECV_SUCCESS_POPUP) { + DBG("BT_FT_RECV_SUCCESS_POPUP"); + elm_object_part_text_set(popup, "title,text", BT_STR_RECEIVED_FILES); + char file_size_str[BT_FILE_SIZE_STR] = { 0 }; + + snprintf(msg, sizeof(msg), BT_STR_FROM_S, info->dev_name); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + name = strrchr(info->file_path, '/'); + if (name != NULL) + name++; + else + name = info->file_path; + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, name); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + /* file size */ + if (info->size < 1024) + snprintf(file_size_str, sizeof(file_size_str), + "%dB", info->size); + else if (info->size > 1024 * 1024) + snprintf(file_size_str, sizeof(file_size_str), + "%dMB", info->size / (1024 * 1024)); + else + snprintf(file_size_str, sizeof(file_size_str), + "%dKB", info->size / 1024); + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_SIZE_S, file_size_str); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(popup, markup_text); + } else if (type == BT_FT_RECV_FAIL_POPUP) { + DBG("BT_FT_RECV_FAIL_POPUP"); + elm_object_part_text_set(popup, "title,text", BT_STR_UNABLE_TO_RECEIVED_FILES); + + g_strlcat(msg, BT_STR_FILE_NOT_RECV, BT_GLOBALIZATION_STR_LENGTH); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, info->file_path); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(popup, markup_text); + } else if (type == BT_FT_FILE_NOT_EXIST) { + elm_object_part_text_set(popup, "title,text", BT_STR_RECEIVED_FILES); + __bt_create_popup_layout(popup, ad); + + g_strlcat(msg, BT_STR_FILE_NOT_EXIST, BT_GLOBALIZATION_STR_LENGTH); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, info->file_path); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(popup, markup_text); + } else if (type == BT_FT_RETRY_POPUP) { + elm_object_part_text_set(popup, "title,text", BT_STR_UNABLE_TO_SEND_FILES); + + snprintf(msg, sizeof(msg), BT_STR_SEND_FAIL_TO_S, info->dev_name); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + name = strrchr(info->file_path, '/'); + if (name != NULL) + name++; + else + name = info->file_path; + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, name); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(popup, markup_text); + } + + evas_object_show(popup); + + if (type == BT_FT_RETRY_POPUP) { + if (ad->bt_status == BT_ADAPTER_DISABLED || + access(info->file_path, F_OK) != 0) { + _bt_create_button(popup, "popup", "button1", + BT_STR_OK, NULL, __bt_ft_ok_popup_cb, info); + } else { + _bt_create_button(popup, "popup", "button1", + BT_STR_RETRY, NULL, __bt_ft_retry_ok_cb, info); + } + ea_object_event_callback_add(popup, EA_CALLBACK_BACK, + __bt_ft_retry_cancel_cb, info); + evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, + __bt_ft_retry_mouseup_cb, info); + } else { + _bt_create_button(popup, "popup", "button1", + BT_STR_OK, NULL, __bt_ft_ok_popup_cb, info); + ea_object_event_callback_add(popup, EA_CALLBACK_BACK, + __bt_ft_ok_popup_cb, info); + evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, + __bt_ft_ok_mouseup_cb, info); + } + + if(markup_text) + free(markup_text); + + DBG("-"); + return popup; +} + +void _bt_lang_changed_ft_popup(bt_share_appdata_t *ad) +{ + DBG(" +"); + char msg[BT_GLOBALIZATION_STR_LENGTH] = { 0 }; + char tmp[BT_GLOBALIZATION_STR_LENGTH] = { 0 }; + char *name = NULL; + char *markup_text = NULL; + Evas_Object *btn1 = NULL; + + if (ad->ft_type == BT_FT_SENT_POPUP) { + elm_object_part_text_set(ad->ft_popup, "title,text", BT_STR_SENT_FILES); + char file_size_str[BT_FILE_SIZE_STR] = { 0 }; + + snprintf(msg, sizeof(msg), BT_STR_FROM_S, ad->ft_info->dev_name); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + name = strrchr(ad->ft_info->file_path, '/'); + if (name != NULL) + name++; + else + name = ad->ft_info->file_path; + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, name); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + /* file size */ + if (ad->ft_info->size < 1024) + snprintf(file_size_str, sizeof(file_size_str), + "%dB", ad->ft_info->size); + else if (ad->ft_info->size > 1024 * 1024) + snprintf(file_size_str, sizeof(file_size_str), + "%dMB", ad->ft_info->size / (1024 * 1024)); + else + snprintf(file_size_str, sizeof(file_size_str), + "%dKB", ad->ft_info->size / 1024); + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_SIZE_S, file_size_str); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(ad->ft_popup, markup_text); + } else if (ad->ft_type == BT_FT_RECV_SUCCESS_POPUP) { + elm_object_part_text_set(ad->ft_popup, "title,text", BT_STR_RECEIVED_FILES); + char file_size_str[BT_FILE_SIZE_STR] = { 0 }; + + snprintf(msg, sizeof(msg), BT_STR_FROM_S, ad->ft_info->dev_name); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + name = strrchr(ad->ft_info->file_path, '/'); + if (name != NULL) + name++; + else + name = ad->ft_info->file_path; + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, name); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + /* file size */ + if (ad->ft_info->size < 1024) + snprintf(file_size_str, sizeof(file_size_str), + "%dB", ad->ft_info->size); + else if (ad->ft_info->size > 1024 * 1024) + snprintf(file_size_str, sizeof(file_size_str), + "%dMB", ad->ft_info->size / (1024 * 1024)); + else + snprintf(file_size_str, sizeof(file_size_str), + "%dKB", ad->ft_info->size / 1024); + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_SIZE_S, file_size_str); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(ad->ft_popup, markup_text); + } else if (ad->ft_type == BT_FT_RECV_FAIL_POPUP) { + elm_object_part_text_set(ad->ft_popup, "title,text", BT_STR_UNABLE_TO_RECEIVED_FILES); + + g_strlcat(msg, BT_STR_FILE_NOT_RECV, BT_GLOBALIZATION_STR_LENGTH); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, ad->ft_info->file_path); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + snprintf(tmp, sizeof(tmp), BT_STR_FAIL_S, BT_STR_TR_CANCELLED); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(ad->ft_popup, markup_text); + } else if (ad->ft_type == BT_FT_FILE_NOT_EXIST) { + elm_object_part_text_set(ad->ft_popup, "title,text", BT_STR_RECEIVED_FILES); + + g_strlcat(msg, BT_STR_FILE_NOT_EXIST, BT_GLOBALIZATION_STR_LENGTH); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, ad->ft_info->file_path); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(ad->ft_popup, markup_text); + } else if (ad->ft_type == BT_FT_RETRY_POPUP) { + elm_object_part_text_set(ad->ft_popup, "title,text", BT_STR_UNABLE_TO_SEND_FILES); + + snprintf(msg, sizeof(msg), BT_STR_SEND_FAIL_TO_S, ad->ft_info->dev_name); + g_strlcat(msg, NEW_LINE, BT_GLOBALIZATION_STR_LENGTH); + + name = strrchr(ad->ft_info->file_path, '/'); + if (name != NULL) + name++; + else + name = ad->ft_info->file_path; + + snprintf(tmp, sizeof(tmp), BT_STR_FILE_S, name); + g_strlcat(msg, tmp, BT_GLOBALIZATION_STR_LENGTH); + + markup_text = elm_entry_utf8_to_markup(msg); + elm_object_text_set(ad->ft_popup, markup_text); + } + + if (ad->ft_type == BT_FT_RETRY_POPUP) { + btn1 = elm_object_part_content_get(ad->ft_popup, "button1"); + if (ad->bt_status == BT_ADAPTER_DISABLED) { + if (btn1) + elm_object_text_set(btn1, BT_STR_OK); + } else { + if (btn1) + elm_object_text_set(btn1, BT_STR_RETRY); + } + } else { + btn1 = elm_object_part_content_get(ad->ft_popup, "button1"); + if (btn1) + elm_object_text_set(btn1, BT_STR_OK); + } + + if(markup_text) + free(markup_text); + + DBG(" -"); +} + +static void __bt_progress_ok_cb(void *data, Evas_Object *obj, void *event_info) +{ + DBG(" +"); + ret_if(data == NULL); + + bt_share_appdata_t *ad = NULL; + + ad = (bt_share_appdata_t *)data; + + _bt_destroy_progress_popup(ad); + + if (ad->tr_view == NULL) + _bt_terminate_app(); + + DBG("-"); + return; +} + +static void __bt_progress_cancel_cb(void *data, Evas_Object *obj, + void *event_info) +{ + DBG(" +"); + ret_if(data == NULL); + + bt_share_appdata_t *ad = NULL; + bt_share_popup_data_t *pb_data = NULL; + + ad = (bt_share_appdata_t *)data; + pb_data = evas_object_data_get(ad->progress_popup, "progressbar_data"); + _bt_abort_signal_send(ad, pb_data); + + _bt_destroy_progress_popup(ad); + + if (ad->tr_view == NULL) + _bt_terminate_app(); + + DBG("-"); + return; +} + +static void __bt_progress_mouseup_cb(void *data, + Evas *e, Evas_Object *obj, void *event_info) +{ + Evas_Event_Mouse_Up *ev = event_info; + bt_share_appdata_t *ad = NULL; + bt_share_popup_data_t *pb_data = NULL; + + ad = (bt_share_appdata_t *)data; + pb_data = evas_object_data_get(ad->progress_popup, "progressbar_data"); + + DBG("Mouse event callback function is called +"); + + if (ev->button == 3) { + _bt_abort_signal_send(ad, pb_data); + _bt_destroy_progress_popup(ad); + + if (ad->tr_view == NULL) + _bt_terminate_app(); + } + DBG("Mouse event callback -"); +} + +Evas_Object *_bt_create_progress_popup(bt_share_popup_data_t *data) +{ + DBG(" +"); + retv_if(data == NULL, NULL); + Evas_Object *popup = NULL; + Evas_Object *layout = NULL; + Evas_Object *progressbar = NULL; + bt_share_appdata_t *ad = app_state; + char temp[BT_PERCENT_STR_LEN] = { 0 }; + float i = 0.0; + int tmp = 0; + char *markup_text = NULL; + + popup = elm_popup_add(ad->win); + evas_object_size_hint_weight_set(popup, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + layout = __bt_create_popup_pb_layout(popup, ad); + + elm_object_part_text_set(popup, "title,text", (!strcmp(data->transfer_type, "outbound")) ? + BT_STR_SEND_FILES : BT_STR_RECEIVE_FILES); + elm_object_part_text_set(layout, "elm.text.description", (!strcmp(data->transfer_type, "outbound")) ? + BT_STR_SENDING : BT_STR_RECEIVING); + + markup_text = elm_entry_utf8_to_markup(data->filename); + elm_object_part_text_set(layout, "elm.subtext.description", markup_text); + + if(markup_text) + free(markup_text); + + progressbar = __bt_create_progressbar(popup, ad); + elm_object_part_content_set(layout, "progressbar", progressbar); + ad->pb = progressbar; + + tmp = atoi(data->percentage); + elm_progressbar_unit_format_set(ad->pb, NULL); + i = (float)tmp / (float)100.0; + elm_progressbar_value_set(ad->pb, i); + evas_object_show(ad->pb); + + snprintf(temp, BT_PERCENT_STR_LEN, "%d%%", tmp); + elm_object_part_text_set(progressbar,"elm.bottom.left.text", temp); + elm_object_signal_emit(progressbar, "elm,bottom,text,show", "elm"); + + ad->pb_transfer_id = data->transfer_id; + elm_object_content_set(popup, layout); + + _bt_create_button(popup, "popup", "button1", + BT_STR_RESUME, NULL, __bt_progress_ok_cb, ad); + _bt_create_button(popup, "popup", "button2", + BT_STR_CANCEL, NULL, __bt_progress_cancel_cb, ad); + ea_object_event_callback_add(popup, EA_CALLBACK_BACK, + __bt_progress_ok_cb, ad); + evas_object_event_callback_add(popup, EVAS_CALLBACK_MOUSE_UP, + __bt_progress_mouseup_cb, ad); + + evas_object_show(popup); + + DBG("-"); + ad->progress_data = data; + return popup; +} + +int _bt_destroy_progress_popup(bt_share_appdata_t *ad) +{ + DBG("+"); + + retvm_if(ad == NULL, 0, + "Invalid argument: ad is NULL"); + bt_share_popup_data_t *pb_data = NULL; + + if (ad->progress_popup) { + pb_data = evas_object_data_get(ad->progress_popup, + "progressbar_data"); + if (pb_data) { + g_free((gpointer)pb_data->filename); + g_free((gpointer)pb_data->percentage); + g_free((gpointer)pb_data->transfer_type); + g_free((gpointer)pb_data); + } + + evas_object_del(ad->progress_popup); + ad->progress_popup = NULL; + } + + DBG("-"); + return 0; +} + +void _bt_lang_changed_progress_popup(bt_share_appdata_t *ad) +{ + DBG(" +"); + ret_if(ad == NULL); + Evas_Object *btn1 = NULL; + Evas_Object *btn2 = NULL; + + elm_object_part_text_set(ad->progress_popup, "title,text", + (!strcmp(ad->progress_data->transfer_type, "outbound")) ? + BT_STR_SEND_FILES : BT_STR_RECEIVE_FILES); + elm_object_part_text_set(ad->progress_layout, "elm.text.description", + (!strcmp(ad->progress_data->transfer_type, "outbound")) ? + BT_STR_SENDING : BT_STR_RECEIVING); + + btn1 = elm_object_part_content_get(ad->progress_popup, "button1"); + if (btn1) + elm_object_text_set(btn1, BT_STR_RESUME); + btn2 = elm_object_part_content_get(ad->progress_popup, "button2"); + if (btn2) + elm_object_text_set(btn2, BT_STR_CANCEL); + + DBG(" -"); +} + +int _bt_update_progress_popup(bt_share_appdata_t *ad, + int transfer_id, const char *name, int percentage) +{ + char temp[BT_PERCENT_STR_LEN] = {0}; + + retvm_if(ad == NULL, 0, "Invalid argument: ad is NULL"); + retvm_if(ad->pb_transfer_id != transfer_id, 0, "Invalid transfer_id!"); + retvm_if(!ad->progress_popup, 0, "No progress_popup!"); + + float i = 0.0; + i = (float)(percentage) / (float)100.0; + elm_progressbar_value_set(ad->pb, i); + evas_object_show(ad->pb); + + snprintf(temp, BT_PERCENT_STR_LEN, "%d%%", percentage); + elm_object_part_text_set(ad->pb,"elm.bottom.left.text", temp); + elm_object_signal_emit(ad->pb, "elm,bottom,text,show", "elm"); + return 0; +} + + +static gboolean __bt_info_popup_timer_cb(void *data, Evas_Object *obj, + void *event_info) +{ + DBG("+"); + bt_share_appdata_t *ad = (bt_share_appdata_t *)data; + retv_if(ad == NULL, FALSE); + + _bt_destroy_info_popup(ad); + + if (ad->tr_view == NULL) { + _bt_terminate_app(); + } + DBG("-"); + return FALSE; +} + +Evas_Object *_bt_create_info_popup(bt_share_appdata_t *ad, + const char *title, const char *text) +{ + DBG("+"); + Evas_Object *popup = NULL; + + retv_if((!ad || !title || !text), NULL); + retv_if (ad->info_popup != NULL, NULL); + + popup = elm_popup_add(ad->win); + elm_object_style_set(popup, "toast"); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + + ea_object_event_callback_add(popup, EA_CALLBACK_BACK, + ea_popup_back_cb, NULL); + elm_object_part_text_set(popup,"elm.text", text); + evas_object_smart_callback_add(popup, "block,clicked", + (Evas_Smart_Cb)__bt_info_popup_timer_cb, ad); + + if(!elm_config_access_get()) { + elm_popup_timeout_set(popup, BT_INFO_POPUP_TIMEOUT_IN_SEC); + evas_object_smart_callback_add(popup, "timeout", + (Evas_Smart_Cb) __bt_info_popup_timer_cb, ad); + } else { + evas_object_smart_callback_add(popup, "access,read,stop", + (Evas_Smart_Cb) __bt_info_popup_timer_cb, ad); + } + + evas_object_show(popup); + ad->info_popup = popup; + + DBG("-"); + return popup; +} + +static gboolean __bt_extinctive_info_popup_timer_cb(void *data, + Evas_Object *obj, void *event_info) +{ + bt_share_appdata_t *ad; + ad = (bt_share_appdata_t *)data; + retv_if(ad == NULL, FALSE); + + _bt_destroy_info_popup(ad); + + if (!ad->tr_view) + _bt_terminate_app(); + + return FALSE; +} + +Evas_Object *_bt_create_extinctive_info_popup(bt_share_appdata_t *ad, + const char *title, const char *text) +{ + DBG("+"); + Evas_Object *popup = NULL; + + retv_if((!ad || !title || !text), NULL); + + if (ad->info_popup != NULL) + return NULL; + + popup = elm_popup_add(ad->win); + elm_object_style_set(popup, "toast"); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + + ea_object_event_callback_add(popup, EA_CALLBACK_BACK, + ea_popup_back_cb, NULL); + elm_object_part_text_set(popup,"elm.text", text); + evas_object_smart_callback_add(popup, "block,clicked", + (Evas_Smart_Cb)__bt_extinctive_info_popup_timer_cb, ad); + + if(!elm_config_access_get()) { + elm_popup_timeout_set(popup, BT_INFO_POPUP_TIMEOUT_IN_SEC); + evas_object_smart_callback_add(popup, "timeout", + (Evas_Smart_Cb) __bt_extinctive_info_popup_timer_cb, ad); + } else { + evas_object_smart_callback_add(popup, "access,read,stop", + (Evas_Smart_Cb) __bt_extinctive_info_popup_timer_cb, ad); + } + + evas_object_show(popup); + ad->info_popup = popup; + + DBG("-"); + return popup; +} + + +int _bt_destroy_info_popup(bt_share_appdata_t *ad) +{ + DBG("+"); + retvm_if(ad == NULL, 0, + "Invalid argument: ad is NULL\n"); + + if (ad->info_popup) { + DBG("delete popup"); + evas_object_del(ad->info_popup); + ad->info_popup = NULL; + } + + DBG("-"); + return 0; +} + diff --git a/src/bt-share-ui-popup.h b/src/bt-share-ui-popup.h new file mode 100644 index 0000000..8d8bed3 --- /dev/null +++ b/src/bt-share-ui-popup.h @@ -0,0 +1,68 @@ +/* +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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_BT_SHARE_UI_POPUP_H_ +#define __DEF_BT_SHARE_UI_POPUP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "bt-share-ui-main.h" + + +#define BT_POPUP_TEXT_LEN \ + (BT_GLOBALIZATION_STR_LENGTH + BT_FILE_NAME_LEN_MAX) +#define BT_PERCENT_STR_LEN 5 +#define BT_MIME_TYPE_MAX_LEN 20 +#define BT_FILE_SIZE_STR 10 +#define BT_INFO_POPUP_TIMEOUT_IN_SEC 2 + + +Evas_Object *_bt_create_ft_popup(bt_share_ft_popup_type_e type, + bt_tr_data_t *info); + +void _bt_lang_changed_ft_popup(bt_share_appdata_t *ad); + +Evas_Object *_bt_create_progress_popup(bt_share_popup_data_t *data); +void _bt_lang_changed_progress_popup(bt_share_appdata_t *ad); + +int _bt_update_progress_popup(bt_share_appdata_t *ad, int transfer_id, + const char *name, int percentage); + +int _bt_destroy_progress_popup(bt_share_appdata_t *ad); + + +Evas_Object *_bt_create_info_popup(bt_share_appdata_t *ad, const char *title, + const char *text); + +Evas_Object *_bt_create_extinctive_info_popup(bt_share_appdata_t *ad, + const char *title, const char *text); + +int _bt_destroy_info_popup(bt_share_appdata_t *ad); + +#ifdef __cplusplus +} +#endif +#endif /* __DEF_BT_SHARE_UI_POPUP_H_ */ diff --git a/src/bt-share-ui-resource.h b/src/bt-share-ui-resource.h index 75e5a68..66b5c27 100644 --- a/src/bt-share-ui-resource.h +++ b/src/bt-share-ui-resource.h @@ -1,18 +1,25 @@ /* - * 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. - */ +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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_BLUETOOTH_SHARE_UI_RES_H_ #define __DEF_BLUETOOTH_SHARE_UI_RES_H_ @@ -24,57 +31,85 @@ extern "C" { #include /*============== String ================= */ -#define BT_COMMON_PKG "ug-setting-bluetooth-efl" -#define BT_COMMON_RES "/opt/ug/res/locale" +#define BT_COMMON_PKG "ug-bluetooth-efl" +#define BT_COMMON_RES "/usr/apps/ug-bluetooth-efl/shared/res/locale/" #define BT_PKGNAME "org.tizen.bluetooth-share-ui" -#define BT_PREFIX "/opt/apps/"BT_PKGNAME -#define BT_IMAGE_DIR BT_PREFIX"/res/images/" +#define BT_PREFIX "/usr/apps/"BT_PKGNAME -#define BT_ICON_RECV_FAIL \ - BT_IMAGE_DIR"A01-4_Inbound_transfer_failed.png" -#define BT_ICON_RECV_PASS \ - BT_IMAGE_DIR"A01-4_Inbound_transfer_successed.png" -#define BT_ICON_SEND_FAIL \ - BT_IMAGE_DIR"A01-4_Outbound_transfer_failed.png" -#define BT_ICON_SEND_PASS \ - BT_IMAGE_DIR"A01-4_Outbound_transfer_successed.png" -#define BT_ICON_INBOUND \ - BT_IMAGE_DIR"A01-4_No_items_Inbound_transfer.png" -#define BT_ICON_OUTBOUND \ - BT_IMAGE_DIR"A01-4_No_items_Outbound_transfer.png" +#define BT_ICON_RECV_FAIL "bluetooth_inbound_transfer_failed.png" +#define BT_ICON_RECV_PASS "bluetooth_inbound_transfer_successed.png" +#define BT_ICON_SEND_FAIL "bluetooth_outbound_transfer_failed.png" +#define BT_ICON_SEND_PASS "bluetooth_outbound_transfer_successed.png" #define BT_STR_MEMORY_FULL \ dgettext(BT_COMMON_PKG, "IDS_BT_POP_MEMORYFULL") #define BT_STR_UNABLE_TO_SEND \ dgettext(BT_COMMON_PKG, "IDS_BT_POP_SENDINGFAIL") #define BT_STR_FT \ - dgettext(BT_COMMON_PKG, "IDS_BT_BODY_FILE_TRANSFER") + dgettext(BT_COMMON_PKG, "IDS_ST_BODY_TRANSFER_FILES") +#define BT_STR_SEND_FILES \ + dgettext(BT_COMMON_PKG, "IDS_SMT_POP_SEND_FILES") +#define BT_STR_SENDING \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_SENDING_ING") +#define BT_STR_RECEIVING \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_RECEIVING_ING") +#define BT_STR_CLR_LIST \ + dgettext(BT_COMMON_PKG, "IDS_BT_BODY_CLEAR_LIST") +#define BT_STR_FILE_NOT_EXIST \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_FILE_DOES_NOT_EXIST") +#define BT_STR_NO_TRANSFER_HISTORY \ + dgettext(BT_COMMON_PKG, "IDS_BT_BODY_NO_TRANSFER_HISTORY") +#define BT_STR_SEND_FAIL_TO_S \ + dgettext(BT_COMMON_PKG, "IDS_BT_BODY_SENDING_FAILED_TO_PS") +#define BT_STR_FILE_NOT_RECV \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_FILE_NOT_RECEIVED") +#define BT_STR_FILE_S \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_FILE_C_PS") +#define BT_STR_FAIL_S \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_FAILURE_REASON_C_PS") +#define BT_STR_TO_S \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_TO_C_PS") +#define BT_STR_FILE_TYPE_S \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_FILE_TYPE_C_PS") +#define BT_STR_FILE_SIZE_S \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_FILE_SIZE_C_PS") +#define BT_STR_FROM_S \ + dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_FROM_C_PS") +#define BT_STR_TR_CANCELLED \ + dgettext(BT_COMMON_PKG, "IDS_BT_POP_TRANSFER_CANCELLED") +#define BT_STR_UNABLE_TO_RECEIVE \ + dgettext(BT_COMMON_PKG, "IDS_BT_BODY_UNABLE_TO_RECEIVE") +#define BT_STR_SENT_FILES \ + dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_SENT_FILES") +#define BT_STR_RECEIVED_FILES \ + dgettext(BT_COMMON_PKG, "IDS_BT_OPT_RECEIVED_FILES") +#define BT_STR_RECEIVE_FILES \ + dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_RECEIVE_FILES_ABB") +#define BT_STR_UNABLE_TO_RECEIVED_FILES \ + dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_UNABLE_TO_RECEIVE_FILES_ABB") +#define BT_STR_UNABLE_TO_SEND_FILES \ + dgettext(BT_COMMON_PKG, "IDS_BT_HEADER_UNABLE_TO_SEND_FILES_ABB") +#define BT_STR_UNABLE_TO_FIND_APPLICATION \ + dgettext(BT_COMMON_PKG, "IDS_MF_TPOP_UNABLE_TO_FIND_APPLICATION_TO_PERFORM_THIS_ACTION") +#define BT_STR_TR_COPIED_STATUS \ + dgettext(BT_COMMON_PKG, "IDS_BT_MBODY_P1SD_FILES_COPIED_P2SD_FAILED_ABB") +#define BT_STR_TR_1FILE_COPIED_STATUS \ + dgettext(BT_COMMON_PKG, "IDS_BT_MBODY_1_FILE_COPIED_PD_FAILED_ABB") -#define BT_STR_SHARING_FN _("Sharing... %s") -#define BT_STR_INBOUND_TR _("Inbound transfers") -#define BT_STR_OUTBOUND_TR _("Outound transfers") -#define BT_STR_CLR_LIST _("Clear list") -#define BT_STR_YESTERDAY _("Yesterday") -#define BT_STR_FILE_NOT_RECV _("File not received") -#define BT_STR_FILE_S _("File: %s") -#define BT_STR_FAIL_S _("Failure reason: %s") -#define BT_STR_TR_CANCELLED _("Transfer Cancelled") -#define BT_STR_TO_S _("To: %s") -#define BT_STR_FROM_S _("From: %s") -#define BT_STR_FILE_TYPE_S _("File type: %s") -#define BT_STR_FILE_SIZE_S _("File size: %s") -#define BT_STR_SEND_FAIL_TO_S _("Sending failed to %s") -#define BT_STR_RETRY _("Retry") -#define BT_STR_TR_HISTORY_EMPTY _("Transfer history is empty") -#define BT_STR_SHARING _("Sharing... ") -#define BT_STR_RECEIVING _("Receiving...") -#define BT_STR_UNABLE_TO_RECEIVE "Unable to receive" +#define BT_STR_INFORMATION dgettext(BT_COMMON_PKG, "IDS_ST_BODY_INFORMATION") +#define BT_STR_OK dgettext(BT_COMMON_PKG, "IDS_BT_BUTTON_OK") +#define BT_STR_HIDE dgettext(BT_COMMON_PKG, "IDS_CST_OPT_HIDE") +#define BT_STR_RESUME dgettext(BT_COMMON_PKG, "IDS_MAPS_POP_RESUME") +#define BT_STR_CANCEL dgettext(BT_COMMON_PKG, "IDS_BR_SK_CANCEL") +#define BT_STR_CLOSE dgettext(BT_COMMON_PKG, "IDS_CAM_SK_CLOSE") +#define BT_STR_YESTERDAY dgettext(BT_COMMON_PKG, "IDS_ST_BODY_YESTERDAY") +#define BT_STR_RETRY dgettext(BT_COMMON_PKG, "IDS_ST_BUTTON_RETRY") -#define BT_STR_INFORMATION dgettext("sys_string", "IDS_COM_OPT_INFORMATION") -#define BT_STR_OK dgettext("sys_string", "IDS_COM_SK_OK") -#define BT_STR_CANCEL dgettext("sys_string", "IDS_COM_SK_CANCEL") -#define BT_STR_CLOSE dgettext("sys_string", "IDS_COM_BODY_CLOSE") +/* Access information */ +#define BT_STR_ACCES_INFO_MAX_LEN 512 +#define BT_STR_ACC_ICON "Icon" +#define BT_STR_ACC_TITLE "Title" #ifdef __cplusplus } diff --git a/src/bt-share-ui-view.c b/src/bt-share-ui-view.c old mode 100644 new mode 100755 index c1af79a..4b3eec7 --- a/src/bt-share-ui-view.c +++ b/src/bt-share-ui-view.c @@ -1,43 +1,54 @@ /* - * 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. - */ +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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 #include #include #include #include -#include #include #include +#include #include #include #include #include +#include +#include +#include #include "applog.h" #include "bt-share-ui-view.h" +#include "bt-share-ui-popup.h" #include "bt-share-ui-ipc.h" #include "bt-share-ui-resource.h" +#include "bt-share-ui-widget.h" #include "bt-share-ui-main.h" -#include "bluetooth-share-api.h" -#define BT_NAVI_ITEM_ADj 3 #define BT_TIMESTAMP_LEN_MAX 18 -#define DOWNLOAD_PATH "/opt/media/Downloads" +#define BT_DOWNLOAD_PHONE_FOLDER "/opt/usr/media/Downloads" +#define BT_DOWNLOAD_MMC_FOLDER "/opt/storage/sdcard/Downloads" #define BT_FILE_PATH_LEN_MAX (4096 + 10) extern bt_share_appdata_t *app_state; @@ -46,7 +57,8 @@ static char *month_str[] = { "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -static void __bt_nocontent_set(bt_share_appdata_t *ad, gboolean set); +static void __bt_more_menu_cb(void *data, + Evas_Object *obj, void *event_info); Evas_Object *_bt_create_win(const char *name) { @@ -54,660 +66,174 @@ Evas_Object *_bt_create_win(const char *name) int w; int h; - eo = elm_win_add(NULL, name, ELM_WIN_BASIC); - if (!eo) - return NULL; + eo = (Evas_Object *)app_get_preinitialized_window(name); + if (eo == NULL) { + ERR("app_get_preinitialized_window fail!"); + eo = elm_win_add(NULL, name, ELM_WIN_BASIC); + } + retv_if(!eo, NULL); elm_win_title_set(eo, name); elm_win_borderless_set(eo, EINA_TRUE); - ecore_x_window_size_get(ecore_x_window_root_first_get(), - &w, &h); + ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); evas_object_resize(eo, w, h); - return eo; } - void _bt_terminate_app(void) { - DBG(" +\n"); + DBG("Terminate BT SHARE UI"); elm_exit(); - DBG(" -\n"); } -static void __bt_sel_item_del(bt_share_appdata_t *ad) +void _bt_delete_selected_item(bt_share_appdata_t *ad) { + DBG("+"); ret_if(ad == NULL); +/* "Bluetooth share has closed unexpectedly" crash occurring. + After press OK in receive failed pop up. + TMWC-726 +*/ +#if 0 if (ad->selected_item == NULL) return; elm_object_item_del(ad->selected_item); ad->selected_item = NULL; - ad->list_item_cnt--; - if (ad->list_item_cnt == 0) { - __bt_nocontent_set(ad, TRUE); - elm_object_item_disabled_set(ad->toolbar_item, EINA_TRUE); - } -} - -static void __bt_destroy_ft_popup(bt_share_appdata_t *ad) -{ - DBG("+\n"); - - ret_if(ad == NULL); - - if (ad->ft_popup) { /* popup object */ - DBG("delete ft_popup\n"); - evas_object_del(ad->ft_popup); - ad->ft_popup = NULL; - } - - ad->ft_layout = NULL; - DBG("-\n"); - return; -} - -static void __bt_ft_retry_popup_cb(void *data, Evas_Object *obj, - void *event_info) -{ - DBG(" +\n"); - - ret_if(data == NULL); - bt_share_appdata_t *ad = app_state; - bt_tr_data_t *info = (bt_tr_data_t *)data; - const char *event = elm_object_text_get(obj); - - __bt_destroy_ft_popup(ad); - - if (!strcmp(event, BT_STR_RETRY)) { - DBG("Retry sending \n"); - if (!_bt_share_ui_ipc_retry_send(ad, info)) { - DBG(" info->id %d \n", info->id); - _bt_share_ui_ipc_info_update(ad, info->id); - __bt_sel_item_del(ad); - } - } else if (!strcmp(event, BT_STR_CANCEL)) { - DBG("Cancel \n"); - _bt_share_ui_ipc_info_update(ad, info->id); - __bt_sel_item_del(ad); - } - - if (obj != NULL) - evas_object_del(obj); - - DBG("-\n"); - return; -} - -static void __bt_ft_popup_cb(void *data, Evas_Object *obj, - void *event_info) -{ - DBG(" +\n"); - ret_if(data == NULL); - bt_share_appdata_t *ad = app_state; - bt_tr_data_t *info = (bt_tr_data_t *)data; - const char *event = elm_object_text_get(obj); +#endif - __bt_destroy_ft_popup(ad); - - if (!strcmp(event, BT_STR_OK)) { - DBG("OK \n"); - _bt_share_ui_ipc_info_update(ad, info->id); - __bt_sel_item_del(ad); + if (elm_genlist_items_count(ad->tr_genlist) == 0) { + _bt_nocontent_set(ad, TRUE); + ad->tr_genlist = NULL; } - - if (obj != NULL) - evas_object_del(obj); - - DBG("-\n"); - return; } -Evas_Object *_bt_create_popup_layout(bt_share_appdata_t *ad) +static void __bt_clear_view(void *data) { - Evas_Object *layout = NULL; + DBG("+"); - layout = elm_layout_add(ad->ft_popup); - elm_layout_file_set(layout, EDJFILE, "ft_popup"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - return layout; -} - -Evas_Object *_bt_create_popup_pb_layout(bt_share_appdata_t *ad, - Evas_Object *parent) -{ - Evas_Object *layout = NULL; - Evas_Object *pb = NULL; - - layout = elm_layout_add(parent); - elm_layout_file_set(layout, EDJFILE, "progress_popup"); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - - pb = elm_progressbar_add(layout); - elm_object_part_content_set(layout, "popup_pb", pb); - elm_object_style_set(pb, "list_progress"); - elm_progressbar_horizontal_set(pb, EINA_TRUE); - evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, - EVAS_HINT_FILL); - evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_show(pb); - ad->pb = pb; - - return layout; -} - -static void __bt_update_popup_pb_layout(Evas_Object *layout, - bt_share_ft_popup_type_t type, - char *device_name, char *filepath) -{ - char msg[BT_GLOBALIZATION_STR_LENGTH] = { 0 }; - char mime_type[BT_MIME_TYPE_MAX_LEN] = { 0 }; - char file_size_str[BT_FILE_SIZE_STR] = { 0 }; - char *name = NULL; - int file_size = 0; - struct stat file_attr; - - if (type == BT_FT_SENT_POPUP) - snprintf(msg, sizeof(msg), BT_STR_TO_S, device_name); - else - snprintf(msg, sizeof(msg), BT_STR_FROM_S, device_name); - - elm_object_part_text_set(layout, "msg1", msg); - - if (filepath != NULL) { - name = strrchr(filepath, '/'); - if (name != NULL) - name++; - else - name = filepath; + bt_share_appdata_t *ad = (bt_share_appdata_t *)data; + ret_if(!ad); - snprintf(msg, sizeof(msg), BT_STR_FILE_S, name); - elm_object_part_text_set(layout, "msg2", msg); + if (ad->tr_genlist) { + elm_genlist_clear(ad->tr_genlist); + ad->tr_genlist = NULL; } - if (aul_get_mime_from_file(filepath, mime_type, - BT_FILE_NAME_LEN_MAX) == AUL_R_OK) { - DBG(" mime type =%s \n", mime_type); - - snprintf(msg, sizeof(msg), BT_STR_FILE_TYPE_S, - mime_type); - elm_object_part_text_set(layout, "msg3", msg); + if (ad->toolbar_btn) { + evas_object_del(ad->toolbar_btn); + ad->toolbar_btn = NULL; } - if (stat(filepath, &file_attr) == 0) { - file_size = file_attr.st_size; - - if (file_size < 1024) - snprintf(file_size_str, sizeof(file_size_str), - "%dbytes", file_size); - else if (file_size > 1024 * 1024) - snprintf(file_size_str, sizeof(file_size_str), - "%dMB", file_size / (1024 * 1024)); - else - snprintf(file_size_str, sizeof(file_size_str), - "%dKB", file_size / 1024); - - snprintf(msg, sizeof(msg), BT_STR_FILE_SIZE_S, - file_size_str); - - elm_object_part_text_set(layout, "msg4", msg); + if (ad->navi_fr) { + evas_object_del(ad->navi_fr); + ad->navi_fr = NULL; } - return; -} - -Evas_Object *_bt_create_btn(Evas_Object *parent, char *btn_type, - char *btn_txt, void *cb, void *data) -{ - Evas_Object *btn = NULL; - if (btn_type == NULL || btn_txt == NULL) { - DBG("Invalid parameter!\n"); - return NULL; + if (ad->tr_view) { + evas_object_del(ad->tr_view); + ad->tr_view = NULL; } - - btn = elm_button_add(parent); - elm_object_style_set(btn, "popup_button/default"); - elm_object_text_set(btn, btn_txt); - elm_object_part_content_set(parent, btn_type, btn); - evas_object_smart_callback_add(btn, "clicked", cb, data); - return btn; + DBG("-"); } -Evas_Object *_bt_create_ft_popup(bt_share_ft_popup_type_t type, - bt_tr_data_t *info) +static Eina_Bool __bt_back_button_cb(void *data, Elm_Object_Item *it) { - DBG(" +\n"); - bt_share_appdata_t *ad = app_state; - Evas_Object *layout = NULL; - Evas_Object *btn1 = NULL; - Evas_Object *btn2 = NULL; - char msg[BT_GLOBALIZATION_STR_LENGTH] = { 0 }; - char *name = NULL; - - if (info->file_path == NULL) - return NULL; + DBG("pop current view "); + retvm_if(!data, EINA_FALSE, "invalid parameter!"); - ad->ft_popup = elm_popup_add(ad->win); - - evas_object_size_hint_weight_set(ad->ft_popup, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - elm_object_part_text_set(ad->ft_popup, "title,text", BT_STR_FT); - - if (type == BT_FT_RETRY_POPUP) { - btn1 = _bt_create_btn(ad->ft_popup, "button1", BT_STR_RETRY, - __bt_ft_retry_popup_cb, info); - btn2 = _bt_create_btn(ad->ft_popup, "button2", BT_STR_CANCEL, - __bt_ft_retry_popup_cb, info); - } else { - btn1 = _bt_create_btn(ad->ft_popup, "button1", BT_STR_OK, - __bt_ft_popup_cb, info); - } + bt_share_appdata_t *ad = (bt_share_appdata_t *)data; + int ret; - if (type == BT_FT_SENT_POPUP) { - layout = _bt_create_popup_pb_layout(ad, ad->ft_popup); - elm_progressbar_value_set(ad->pb, 1.0); - elm_object_part_text_set(layout, "percent", "100%"); - __bt_update_popup_pb_layout(layout, type, - info->dev_name, info->file_path); - } else if (type == BT_FT_RECV_SUCCESS_POPUP) { - layout = _bt_create_popup_pb_layout(ad, ad->ft_popup); - elm_progressbar_value_set(ad->pb, 1.0); - elm_object_part_text_set(layout, "percent", "100%"); - __bt_update_popup_pb_layout(layout, type, - info->dev_name, info->file_path); - } else if (type == BT_FT_RECV_FAIL_POPUP) { - layout = _bt_create_popup_layout(ad); - elm_object_part_text_set(layout, "msg1", BT_STR_FILE_NOT_RECV); - snprintf(msg, sizeof(msg), BT_STR_FILE_S, info->file_path); - elm_object_part_text_set(layout, "msg2", msg); - snprintf(msg, sizeof(msg), BT_STR_FAIL_S, BT_STR_TR_CANCELLED); - elm_object_part_text_set(layout, "msg3", msg); - } else if (type == BT_FT_RETRY_POPUP) { - layout = _bt_create_popup_layout(ad); - snprintf(msg, sizeof(msg), BT_STR_SEND_FAIL_TO_S, info->dev_name); - elm_object_part_text_set(layout, "msg1", msg); + __bt_clear_view(data); - name = strrchr(info->file_path, '/'); - if (name != NULL) - name++; - else - name = info->file_path; + if (ad->tr_data_list) { + ret = bt_share_release_tr_data_list(ad->tr_data_list); - snprintf(msg, sizeof(msg), BT_STR_FILE_S, name); - elm_object_part_text_set(layout, "msg2", msg); - snprintf(msg, sizeof(msg), BT_STR_FAIL_S, BT_STR_TR_CANCELLED); - elm_object_part_text_set(layout, "msg3", msg); + if (ret != BT_SHARE_ERR_NONE) + ERR("Transfer data release failed "); + ad->tr_data_list = NULL; } - ad->ft_layout = layout; - - elm_object_content_set(ad->ft_popup, layout); - evas_object_show(ad->ft_popup); + _bt_terminate_app(); - DBG(" -\n"); - return NULL; + return EINA_FALSE; } - -void _progress_popup_cb(void *data, Evas_Object *obj, - void *event_info) +static void __bt_clear_list_btn_cb(void *data, + Evas_Object *obj, + void *event_info) { - DBG(" +\n"); - bt_share_appdata_t *ad = app_state; - bt_share_popup_data_t *pb_data = NULL; - const char *event = elm_object_text_get(obj); - - ret_if(data == NULL); - - pb_data = (bt_share_popup_data_t *)data; - - _bt_destroy_progress_popup(ad); + bt_share_appdata_t *ad = (bt_share_appdata_t *)data; + int clear_list = -1; + int ret; - if (!strcmp(event, BT_STR_OK)) { - DBG("OK \n"); - } else if (!strcmp(event, BT_STR_CANCEL)) { - DBG("Cancel \n"); - _bt_abort_signal_send(ad, pb_data); - } + DBG("Clear genlist item"); - if (obj != NULL) - evas_object_del(obj); + notification_h noti = NULL; + int priv_id = 0; + notification_list_h list_head = NULL; + notification_list_h list_traverse = NULL; + char *app_id = NULL; + char *opp_role = NULL; - g_free((gpointer)pb_data->filename); - g_free((gpointer)pb_data->percentage); - g_free((gpointer)pb_data->transfer_type); - g_free((gpointer)pb_data); + if (ad->bt_status == BT_ADAPTER_DISABLED) { + sqlite3 *db = NULL; + bt_tr_db_table_e table; - if (ad->app_layout == NULL) - _bt_terminate_app(); + /* Update bt-share DB */ + db = bt_share_open_db(); + if (!db) + return; - DBG("-\n"); - return; -} + table = ad->tr_type ? BT_DB_INBOUND : BT_DB_OUTBOUND; + bt_share_remove_all_tr_data(db, table); + bt_share_close_db(db); -void _bt_create_progress_popup(bt_share_popup_data_t *data) -{ - DBG(" +\n"); - ret_if(data == NULL); - bt_share_appdata_t *ad = app_state; - char temp[BT_PERCENT_STR_LEN] = { 0 }; - float i = 0.0; - int tmp = 0; - char msg[2 * BT_FILE_NAME_LEN_MAX] = { 0, }; + /* Delete notification */ + notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &list_head); + list_traverse = list_head; - if (NULL == ad->progress_popup) { - ad->progress_popup = elm_popup_add(ad->win); - evas_object_size_hint_weight_set(ad->progress_popup, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + if (ad->tr_type == BT_DB_INBOUND) + opp_role = "bluetooth-share-opp-server"; + else + opp_role = "bluetooth-share-opp-client"; - _bt_create_btn(ad->progress_popup, "button1", BT_STR_CLOSE, - _progress_popup_cb, data); + while (list_traverse != NULL) { + noti = notification_list_get_data(list_traverse); + notification_get_pkgname(noti, &app_id); - _bt_create_btn(ad->progress_popup, "button2", BT_STR_CANCEL, - _progress_popup_cb, data); + if (g_strcmp0(app_id, opp_role) == 0) { + notification_get_id(noti, NULL, &priv_id); + notification_delete_by_priv_id(app_id, NOTIFICATION_TYPE_NOTI, priv_id); + priv_id = 0; + } + list_traverse = notification_list_get_next(list_traverse); + } - ad->progress_layout = _bt_create_popup_pb_layout(ad, ad->progress_popup); - } - tmp = atoi(data->percentage); - elm_progressbar_unit_format_set(ad->pb, NULL); - i = (float)tmp / (float)100.0; - elm_progressbar_value_set(ad->pb, i); - evas_object_show(ad->pb); - - if (!strcmp(data->transfer_type, "outbound")) { - snprintf(msg, sizeof(msg), BT_STR_SHARING); - elm_object_part_text_set(ad->progress_layout, "status_text", - data->progress_cnt); + if (list_head != NULL) { + notification_free_list(list_head); + list_head = NULL; + } } else { - snprintf(msg, sizeof(msg), BT_STR_RECEIVING); - } - - elm_object_part_text_set(ad->progress_layout, "msg2", - msg); - - elm_object_part_text_set(ad->progress_layout, "msg3", - data->filename); - - snprintf(temp, BT_PERCENT_STR_LEN, "%d%%", tmp); - elm_object_part_text_set(ad->progress_layout, "percent", - temp); - - ad->pb_transfer_id = data->transfer_id; - - elm_object_content_set(ad->progress_popup, ad->progress_layout); - evas_object_show(ad->progress_popup); - - DBG(" -\n"); - return; -} - - -int _bt_destroy_progress_popup(bt_share_appdata_t *ad) -{ - DBG("+\n"); - - retvm_if(ad == NULL, 0, - "Invalid argument: ad is NULL\n"); - - if (ad->progress_popup) { /* popup object */ - DBG("delete popup\n"); - evas_object_del(ad->progress_popup); - ad->progress_popup = NULL; - } - ad->pb = NULL; - ad->progress_layout = NULL; - ad->pb_transfer_id = -1; - - DBG("-\n"); - return 0; -} - -int _bt_update_progress_popup(bt_share_appdata_t *ad, int transfer_id, const char *name, int percentage) -{ - char temp[BT_PERCENT_STR_LEN] = {0}; - - retvm_if(ad == NULL, 0, - "Invalid argument: ad is NULL\n"); - - if (ad->pb_transfer_id != transfer_id) - return 0; - - elm_object_part_text_set(ad->progress_layout, - "msg3", name); - - float i = 0.0; - i = (float)(percentage) / (float)100.0; - elm_progressbar_value_set(ad->pb, i); - evas_object_show(ad->pb); - - snprintf(temp, BT_PERCENT_STR_LEN, "%d%%", percentage); - elm_object_part_text_set(ad->progress_layout, - "percent", temp); - - return 0; -} - - -static gboolean __bt_info_popup_timer_cb(void *data, Evas_Object *obj, - void *event_info) -{ - bt_share_appdata_t *ad; - ad = (bt_share_appdata_t *)data; - retv_if(ad == NULL, FALSE); - - _bt_destroy_info_popup(ad); - return FALSE; -} - -Evas_Object *_bt_create_info_popup(bt_share_appdata_t *ad, const char *title, const char *text) -{ - DBG("+\n"); - Evas_Object *popup = NULL; - retv_if((!ad || !title || !text), NULL); - - if(ad->info_popup != NULL ) - return NULL; - - popup = elm_popup_add(ad->win); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_object_part_text_set(popup, "title,text", title); - elm_object_text_set(popup, text); - elm_popup_timeout_set(popup, BT_INFO_POPUP_TIMEOUT_IN_SEC); - evas_object_smart_callback_add(popup, "timeout", - (Evas_Smart_Cb) __bt_info_popup_timer_cb, ad); - evas_object_show(popup); - ad->info_popup = popup; - - DBG("-\n"); - return popup; -} - -static gboolean __bt_extinctive_info_popup_timer_cb(void *data, Evas_Object *obj, - void *event_info) -{ - bt_share_appdata_t *ad; - ad = (bt_share_appdata_t *)data; - retv_if(ad == NULL, FALSE); - - _bt_destroy_info_popup(ad); - _bt_terminate_app(); - return FALSE; -} - -Evas_Object *_bt_create_extinctive_info_popup(bt_share_appdata_t *ad, const char *title, const char *text) -{ - DBG("+\n"); - Evas_Object *popup = NULL; - retv_if((!ad || !title || !text), NULL); - - if(ad->info_popup != NULL ) - return NULL; - - popup = elm_popup_add(ad->win); - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_object_part_text_set(popup, "title,text", title); - elm_object_text_set(popup, text); - elm_popup_timeout_set(popup, BT_INFO_POPUP_TIMEOUT_IN_SEC); - evas_object_smart_callback_add(popup, "timeout", - (Evas_Smart_Cb) __bt_extinctive_info_popup_timer_cb, ad); - evas_object_show(popup); - ad->info_popup = popup; - - DBG("-\n"); - return popup; -} - - -int _bt_destroy_info_popup(bt_share_appdata_t *ad) -{ - DBG("+\n"); - retvm_if(ad == NULL, 0, - "Invalid argument: ad is NULL\n"); - - if (ad->info_popup) { - DBG("delete popup\n"); - evas_object_del(ad->info_popup); - ad->info_popup = NULL; + _bt_share_ui_ipc_info_update(ad, clear_list); } - DBG("-\n"); - return 0; -} - -static void __bt_back_button_cb(void *data, - Evas_Object *obj, - void *event_info) -{ - bt_share_appdata_t *ad = (bt_share_appdata_t *)data; - int ret; - if (ad->tr_genlist) { elm_genlist_clear(ad->tr_genlist); ad->tr_genlist = NULL; } - if (ad->navi_fr) { - evas_object_del(ad->navi_fr); - ad->navi_fr = NULL; - } - - if (ad->layout_main) { - evas_object_del(ad->layout_main); - ad->layout_main = NULL; - } - if (ad->tr_data_list) { ret = bt_share_release_tr_data_list(ad->tr_data_list); if (ret != BT_SHARE_ERR_NONE) - ERR("Transfer data release failed \n"); + ERR("Transfer data release failed "); ad->tr_data_list = NULL; } - _bt_terminate_app(); -} - - -Evas_Object *__bt_create_bg(Evas_Object *parent, char *style) -{ - Evas_Object *bg = NULL; - - if (parent == NULL) - return NULL; - - bg = elm_bg_add(parent); - - evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - - if (style) - elm_object_style_set(bg, style); - - elm_win_resize_object_add(parent, bg); - - evas_object_show(bg); - - return bg; -} - -static void __bt_clear_list_btn_cb(void *data, - Evas_Object *obj, - void *event_info) -{ - DBG("+\n"); - bt_share_appdata_t *ad = (bt_share_appdata_t *)data; - int clear_list = -1; - - _bt_share_ui_ipc_info_update(ad, clear_list); - - if (ad->tr_genlist) { - elm_genlist_clear(ad->tr_genlist); - ad->tr_genlist = NULL; - } - - ad->list_item_cnt = 0; - __bt_nocontent_set(ad, TRUE); - elm_object_item_disabled_set(ad->toolbar_item, EINA_TRUE); - DBG("-\n"); -} + _bt_nocontent_set(ad, TRUE); -static gboolean __bt_is_year_leap(int year) -{ - if (year % 400 == 0 || ((year % 100 != 0) && (year % 4 == 0))) { - DBG("Year %d is a leap year\n", year); - return TRUE; - } else { - DBG("Year %d is not a leap year", year); - } - return FALSE; -} - -static int __bt_get_passed_day_count(int year, int month) -{ - int i = 1; - int days = 0; - int leap = 0; - - for (i = 1; i< month; i++) { - switch (i) { - /*Months with 30 days*/ - case 4: - case 6: - case 9: - case 11: - days = days +30; - break; - /*Month of February*/ - case 2: - leap = __bt_is_year_leap(year); - if (leap == TRUE) - days = days + 29; - else - days = days + 28; - break; - /*Months with 31 days*/ - case 1: - case 3: - case 5: - case 7: - case 8: - case 10: - case 12: - days = days + 31; - break; - - default: - DBG("Incorrect month\n"); - break; - } - } - return days; } static char *__bt_get_tr_timedate(time_t timestamp) @@ -726,12 +252,14 @@ static char *__bt_get_tr_timedate(time_t timestamp) /* Get current time */ time(&rawtime); current_time = localtime(&rawtime); + retv_if(current_time == NULL, NULL); cy = current_time->tm_year + 1900; cm = current_time->tm_mon + 1; cd = current_time->tm_mday; /* Get recorded time */ pt = localtime(×tamp); + retv_if(pt == NULL, NULL); ry = pt->tm_year + 1900; rm = pt->tm_mon + 1; rd = pt->tm_mday; @@ -739,11 +267,14 @@ static char *__bt_get_tr_timedate(time_t timestamp) if (cy == ry && cm == rm && cd == rd) { int format = 0; if (vconf_get_int(VCONFKEY_REGIONFORMAT_TIME1224, &format) != 0) { - ERR("vconf get failed\n"); + ERR("vconf get failed"); } if (format == VCONFKEY_TIME_FORMAT_12) - strftime(buf, sizeof(buf), "%I:%M %p", pt); + if (pt->tm_hour >=0 && pt->tm_hour < 12) + strftime(buf, sizeof(buf), "%I:%M AM", pt); + else + strftime(buf, sizeof(buf), "%I:%M PM", pt); else strftime(buf, sizeof(buf), "%H:%M", pt); } else if (cy == ry && cm == rm && cd - 1 == rd) { @@ -752,43 +283,51 @@ static char *__bt_get_tr_timedate(time_t timestamp) snprintf(buf, sizeof(buf), "%d %s %d", rd, month_str[rm - 1], ry); } - return g_strdup(buf); + return g_strdup(buf); } static Evas_Object *__bt_tr_icon_get(void *data, Evas_Object *obj, const char *part) { + Evas_Object *ly = NULL; Evas_Object *icon = NULL; bt_tr_data_t *info = NULL; bt_share_appdata_t *ad = app_state; + char *img; + bt_gl_data_t *gl_data; retv_if(data == NULL, NULL); - info = (bt_tr_data_t *)data; - if (!strcmp(part, "elm.icon")) { - icon = elm_icon_add(obj); - if (ad->tr_type == BT_TR_OUTBOUND) { - if (info->tr_status == BT_TR_SUCCESS) { - DBG("BT_ICON_SEND_PASS %s\n", BT_ICON_SEND_PASS); - elm_icon_file_set(icon, BT_ICON_SEND_PASS, NULL); - } else - elm_icon_file_set(icon, BT_ICON_SEND_FAIL, NULL); - } else { - if (info->tr_status == BT_TR_SUCCESS) - elm_icon_file_set(icon, BT_ICON_RECV_PASS, NULL); - else - elm_icon_file_set(icon, BT_ICON_RECV_FAIL, NULL); - } - evas_object_size_hint_aspect_set(icon, - EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); - elm_icon_resizable_set(icon, 1, 1); - evas_object_show(icon); - } else { - ERR("no image found. \n"); - return NULL; + gl_data = (bt_gl_data_t *)data; + + info = gl_data->tr_data; + retv_if(info == NULL, NULL); + + retv_if(strcmp(part, "elm.icon.1") != 0, NULL); + ly = elm_layout_add(obj); + elm_layout_theme_set(ly, "layout", "list/B/type.3", "default"); + + icon = elm_icon_add(obj); + if (ad->tr_type == BT_TR_OUTBOUND) { + img = (info->tr_status == BT_TR_SUCCESS) ? + BT_ICON_SEND_PASS : BT_ICON_SEND_FAIL; + } else { + img = (info->tr_status == BT_TR_SUCCESS) ? + BT_ICON_RECV_PASS : BT_ICON_RECV_FAIL; } - return icon; + elm_image_file_set(icon, EDJ_IMAGES, img); + evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + +#if 0 /* This icon color is not applied in platform -> AO001 is block color */ + ea_theme_object_color_set(icon, "AO005"); +#endif + ea_theme_object_color_set(icon, "AO001"); + + evas_object_show(icon); + elm_layout_content_set(ly, "elm.swallow.content", icon); + return ly; } static char *__bt_tr_label_get(void *data, Evas_Object *obj, @@ -797,11 +336,15 @@ static char *__bt_tr_label_get(void *data, Evas_Object *obj, bt_tr_data_t *info = NULL; char *name = NULL; char buf[BT_GLOBALIZATION_STR_LENGTH] = { 0 }; + bt_gl_data_t *gl_data; retv_if(data == NULL, NULL); - info = (bt_tr_data_t *)data; + gl_data = (bt_gl_data_t *)data; - if (!strcmp(part, "elm.text.1")) { + info = gl_data->tr_data; + retv_if(info == NULL, NULL); + + if (!strcmp(part, "elm.text.main.left.top")) { name = strrchr(info->file_path, '/'); if (name != NULL) name++; @@ -809,51 +352,139 @@ static char *__bt_tr_label_get(void *data, Evas_Object *obj, name = info->file_path; g_strlcpy(buf, name, BT_GLOBALIZATION_STR_LENGTH); - } else if (strcmp(part, "elm.text.2") == 0) { - g_strlcpy(buf, info->dev_name, BT_GLOBALIZATION_STR_LENGTH); - } else if (strcmp(part, "elm.text.3") == 0) { + } else if (strcmp(part, "elm.text.sub.left.bottom") == 0) { + char *marked_name = elm_entry_utf8_to_markup(info->dev_name); + g_strlcpy(buf, marked_name, BT_GLOBALIZATION_STR_LENGTH); + if (marked_name) + free(marked_name); + } else if (strcmp(part, "elm.text.sub.right.bottom") == 0) { char *date = NULL; date = __bt_get_tr_timedate((time_t)(info->timestamp)); g_strlcpy(buf, date, BT_GLOBALIZATION_STR_LENGTH); g_free(date); } else { - DBG("empty text for label. \n"); + DBG("empty text for label."); return NULL; } return strdup(buf); } -static Evas_Object *__bt_create_scroller(Evas_Object *parent, Evas_Object *ly) +static void __bt_tr_del(void *data, Evas_Object *obj) { - Evas_Object *scroller; + bt_gl_data_t *gl_data; + gl_data = (bt_gl_data_t *)data; - if(parent == NULL) - return NULL; + g_free(gl_data); +} + +static void __bt_genlist_realized_cb(void *data, + Evas_Object *obj, void *event_info) +{ + retm_if(event_info == NULL, "Invalid param\n"); + + Elm_Object_Item *item = (Elm_Object_Item *)event_info; +#ifdef KIRAN_ACCESSIBILITY + Evas_Object *ao; + char str[BT_STR_ACCES_INFO_MAX_LEN] = {0, }; +#endif + char *name; + char *date; + bt_tr_data_t *info; + bt_gl_data_t *gl_data; + + gl_data = (bt_gl_data_t *)elm_object_item_data_get(item); + ret_if(gl_data == NULL); + + info = gl_data->tr_data; + + ret_if(info == NULL); + ret_if(info->dev_name == NULL); + ret_if(info->file_path == NULL); + + name = strrchr(info->file_path, '/'); + if (name != NULL) + name++; + else + name = info->file_path; + + date = __bt_get_tr_timedate((time_t)(info->timestamp)); + +#ifdef KIRAN_ACCESSIBILITY + snprintf(str, sizeof(str), "%s, %s, %s, %s", + BT_STR_ACC_ICON, name, info->dev_name, date); + ao = elm_object_item_access_object_get(item); + elm_access_info_set(ao, ELM_ACCESS_INFO, str); +#endif + g_free(date); +} + +static void __bt_popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + DBG("+"); + retm_if(data == NULL, "data is NULL"); + bt_share_appdata_t *ad = (bt_share_appdata_t *)data; + + evas_object_del(ad->info_popup); + ad->info_popup = NULL; + DBG("-"); +} + +void __bt_popup_del_by_timeout(void *data, Evas_Object *obj, void *event_info) +{ + DBG("+"); + bt_share_appdata_t *ad = (bt_share_appdata_t *)data; + ret_if(!ad); + if (ad->info_popup){ + evas_object_del(ad->info_popup); + ad->info_popup = NULL; + } + DBG("-"); +} - scroller = elm_scroller_add(parent); +Evas_Object *__bt_create_error_popup(bt_share_appdata_t *ad) +{ + DBG("+"); + Evas_Object *popup = NULL; + retvm_if(ad == NULL, NULL, "ad is NULL"); + + popup = elm_popup_add(ad->win); + retvm_if(popup == NULL, NULL, "popup is NULL"); - elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE); - elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, - ELM_SCROLLER_POLICY_AUTO); + elm_object_focus_set(popup, EINA_FALSE); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - if (ly != NULL) - elm_object_content_set(scroller, ly); + elm_object_text_set(popup, BT_STR_UNABLE_TO_FIND_APPLICATION); - evas_object_show(scroller); + elm_popup_timeout_set(popup, 3); + evas_object_smart_callback_add(popup, "timeout", (Evas_Smart_Cb)__bt_popup_del_by_timeout, ad); + evas_object_show(popup); + evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, __bt_popup_del_cb, ad); + + ad->info_popup = popup; - return scroller; + DBG("-"); + return popup; } static gboolean __bt_open_received_file(const char *path) { - service_h handle; - service_create(&handle); - service_set_operation(handle, SERVICE_OPERATION_VIEW); - service_set_uri (handle, path); - service_send_launch_request(handle, NULL, NULL); - service_destroy(handle); - return TRUE; + DBG("+"); + app_control_h handle; + int ret; + bt_share_appdata_t *ad = app_state; + + app_control_create(&handle); + app_control_set_operation(handle, APP_CONTROL_OPERATION_VIEW); + app_control_set_uri(handle, path); + ret = app_control_send_launch_request(handle, NULL, NULL); + + if (ret == APP_CONTROL_ERROR_APP_NOT_FOUND) + __bt_create_error_popup(ad); + + app_control_destroy(handle); + DBG("-"); + return TRUE; } static gint __handle_compare(gconstpointer a, gconstpointer b) @@ -869,23 +500,106 @@ static gint __handle_compare(gconstpointer a, gconstpointer b) static void __bt_remove_tr_data_node(bt_share_appdata_t *ad, int id) { + DBG("+"); GSList *l = NULL; bt_tr_data_t *info = NULL; - l = g_slist_find_custom(ad->tr_data_list, (gconstpointer) id, __handle_compare); - if (!l) { + l = g_slist_find_custom(ad->tr_data_list, (gconstpointer)id, + __handle_compare); + if (l) { info = l->data; ad->tr_data_list = g_slist_remove(ad->tr_data_list, info); } + + if (g_slist_length(ad->tr_data_list) == 0) { + _bt_nocontent_set(ad, TRUE); + ad->tr_genlist = NULL; + } +} + +void _bt_update_tr_notification(void *data) +{ + ret_if(data == NULL); + + bt_share_appdata_t *ad = app_state; + bt_tr_data_t *info = NULL; + sqlite3 *db = NULL; + int success = 0; + int fail = 0; + char *opp_role = NULL; + notification_h noti = NULL; + int priv_id = 0; + notification_list_h list_head = NULL; + notification_list_h list_traverse = NULL; + char *app_id = NULL; + + info = (bt_tr_data_t *)data; + + DBG("Transfer type: %s", ad->tr_type == BT_DB_INBOUND ? "Receive" : "Sent"); + + db = bt_share_open_db(); + if (!db) + return; + + if (ad->tr_type == BT_DB_INBOUND) + opp_role = "bluetooth-share-opp-server"; + else + opp_role = "bluetooth-share-opp-client"; + + + /* Delete selected outbound db / notification info */ + if (bt_share_remove_tr_data_by_id(db, ad->tr_type, info->id) == 0) + DBG("successfully TR ID removed from DB"); + + bt_share_get_tr_result_count(db, ad->tr_type, &success, &fail); + DBG("success: %d, fail: %d", success, fail); + + /* Delete notification */ + notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &list_head); + list_traverse = list_head; + + while (list_traverse != NULL) { + noti = notification_list_get_data(list_traverse); + notification_get_pkgname(noti, &app_id); + + if (g_strcmp0(app_id, opp_role) == 0) { + notification_get_id(noti, NULL, &priv_id); + break; + } + list_traverse = notification_list_get_next(list_traverse); + } + + if (success == 0 && fail == 0) { + notification_delete_by_priv_id(app_id, NOTIFICATION_TYPE_NOTI, priv_id); + } else { + char str[BT_GLOBALIZATION_STR_LENGTH] = { 0 }; + if (success == 1) + snprintf(str, sizeof(str), BT_STR_TR_1FILE_COPIED_STATUS, fail); + else + snprintf(str, sizeof(str), BT_STR_TR_COPIED_STATUS, + success, fail); + + notification_set_content(noti, str, NULL); + notification_update(noti); + } + + if (list_head != NULL) { + notification_free_list(list_head); + list_head = NULL; + } + + bt_share_close_db(db); } static void __bt_tr_data_recv_item_sel(void *data, Evas_Object *obj, void *event_info) { - DBG("+ \n"); bt_share_appdata_t *ad = app_state; bt_tr_data_t *info = NULL; - char path[BT_FILE_PATH_LEN_MAX] = {0, }; + char *path = NULL; char *ext = NULL; + int default_memory = 0; + + DBG("Select received item"); ret_if(data == NULL); ret_if(event_info == NULL); @@ -898,38 +612,51 @@ static void __bt_tr_data_recv_item_sel(void *data, Evas_Object *obj, EINA_FALSE); if (info->tr_status == BT_TR_SUCCESS) { - if (info->file_path == NULL) - return; - - DBG("info->filepath = %s \n", info->file_path); - snprintf(path, BT_FILE_PATH_LEN_MAX-1, "%s/%s", - DOWNLOAD_PATH, info->file_path); - - ext = strrchr(path, '.') + 1; + ret_if(info->file_path == NULL); + INFO_SECURE("File : %s", info->file_path); + if (vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, + &default_memory) != 0) { + ERR("vconf get failed"); + } + path = info->file_path; + INFO_SECURE("path : %s", path); + ext = strrchr(path, '.'); if (ext) { - if (0 == strcmp(ext, "vcf") || 0 == strcmp(ext, "vcal")) { - free(info->file_path); - info->file_path = strdup(path); - _bt_create_ft_popup(BT_FT_RECV_SUCCESS_POPUP, info); - DBG("- \n"); + ext++; + if (0 == g_strcmp0(ext, "vcf")) { + ad->ft_popup = _bt_create_ft_popup( + BT_FT_RECV_SUCCESS_POPUP, info); return; } } - __bt_open_received_file(path); - _bt_share_ui_ipc_info_update(ad, info->id); - __bt_sel_item_del(ad); + if (access(path, F_OK) == 0) { + __bt_open_received_file(path); + if (ad->bt_status == BT_ADAPTER_DISABLED) { + _bt_update_tr_notification(info); + _bt_delete_selected_item(ad); + } else { /*Adapter enabled case */ + _bt_share_ui_ipc_info_update(ad, info->id); + _bt_delete_selected_item(ad); + } + } else { + ad->ft_popup = _bt_create_ft_popup(BT_FT_FILE_NOT_EXIST, + info); + _bt_share_ui_ipc_info_update(ad, info->id); + _bt_delete_selected_item(ad); + } + } else { - _bt_create_ft_popup(BT_FT_RECV_FAIL_POPUP, info); + ad->ft_popup = _bt_create_ft_popup(BT_FT_RECV_FAIL_POPUP, info); } - DBG("- \n"); + return; } static void __bt_tr_data_sent_item_sel(void *data, Evas_Object *obj, void *event_info) { - DBG("+ \n"); + DBG("+"); bt_share_appdata_t *ad = app_state; bt_tr_data_t *info = NULL; @@ -939,264 +666,450 @@ static void __bt_tr_data_sent_item_sel(void *data, Evas_Object *obj, info = (bt_tr_data_t *)data; ad->selected_item = (Elm_Object_Item *)event_info; elm_genlist_item_selected_set((Elm_Object_Item *)event_info, - EINA_FALSE); + EINA_FALSE); if (info->tr_status == BT_TR_SUCCESS) - _bt_create_ft_popup(BT_FT_SENT_POPUP, info); + ad->ft_popup = _bt_create_ft_popup(BT_FT_SENT_POPUP, info); else - _bt_create_ft_popup(BT_FT_RETRY_POPUP, info); - - __bt_remove_tr_data_node(ad, info->id); + ad->ft_popup = _bt_create_ft_popup(BT_FT_RETRY_POPUP, info); - DBG("- \n"); + DBG("-"); return; } -void _bt_append_genlist_tr_data_item(bt_share_appdata_t *ad, bt_tr_data_t *info, int tr_type) +void _bt_append_genlist_tr_data_item(bt_share_appdata_t *ad, + Evas_Object *genlist, bt_tr_data_t *info, int tr_type) { - DBG("+\n"); + DBG("+"); - if (ad == NULL) - return; + retm_if (ad == NULL || info == NULL, "Invalid parameters!"); - if (info == NULL) - return; + bt_gl_data_t *gl_data = NULL; + + gl_data = g_new0(bt_gl_data_t, 1); + gl_data->tr_data = info; if (tr_type == BT_TR_OUTBOUND) { - elm_genlist_item_append(ad->tr_genlist, ad->tr_data_itc, info, NULL, - ELM_GENLIST_ITEM_NONE, - __bt_tr_data_sent_item_sel, info); - ad->list_item_cnt++; + elm_genlist_item_append(genlist, ad->tr_data_itc, gl_data, + NULL, ELM_GENLIST_ITEM_NONE, + __bt_tr_data_sent_item_sel, info); if (ad->outbound_latest_id < info->id) ad->outbound_latest_id = info->id; } else if (tr_type == BT_TR_INBOUND) { - elm_genlist_item_append(ad->tr_genlist, ad->tr_data_itc, info, NULL, - ELM_GENLIST_ITEM_NONE, - __bt_tr_data_recv_item_sel, info); - ad->list_item_cnt++; + elm_genlist_item_append(genlist, ad->tr_data_itc, gl_data, + NULL, ELM_GENLIST_ITEM_NONE, + __bt_tr_data_recv_item_sel, info); if (ad->inbound_latest_id < info->id) ad->inbound_latest_id = info->id; } else { - DBG("Transfer is ongoing for data or data invalid. \n"); + ERR("Transfer type is invalid"); } - DBG("-\n"); - return; + evas_object_show(genlist); + + DBG("-"); } -void _bt_prepend_genlist_tr_data_item(bt_share_appdata_t *ad, bt_tr_data_t *info, int tr_type) +void _bt_prepend_genlist_tr_data_item(bt_share_appdata_t *ad, + bt_tr_data_t *info, int tr_type) { - DBG("+\n"); + DBG("+"); - if (ad == NULL) + if (ad == NULL || info == NULL) return; - if (info == NULL) - return; + if (elm_genlist_items_count(ad->tr_genlist) == 0) { + _bt_nocontent_set(ad, FALSE); + } + + bt_gl_data_t *gl_data; + + gl_data = g_new0(bt_gl_data_t, 1); + gl_data->tr_data = info; if (tr_type == BT_TR_OUTBOUND) { - elm_genlist_item_prepend(ad->tr_genlist, ad->tr_data_itc, info, NULL, - ELM_GENLIST_ITEM_NONE, - __bt_tr_data_sent_item_sel, info); - ad->list_item_cnt++; + elm_genlist_item_prepend(ad->tr_genlist, ad->tr_data_itc, + gl_data, NULL, + ELM_GENLIST_ITEM_NONE, + __bt_tr_data_sent_item_sel, info); if (ad->outbound_latest_id < info->id) ad->outbound_latest_id = info->id; } else if (tr_type == BT_TR_INBOUND) { - elm_genlist_item_prepend(ad->tr_genlist, ad->tr_data_itc, info, NULL, - ELM_GENLIST_ITEM_NONE, - __bt_tr_data_recv_item_sel, info); - ad->list_item_cnt++; + elm_genlist_item_prepend(ad->tr_genlist, ad->tr_data_itc, + gl_data, NULL, + ELM_GENLIST_ITEM_NONE, + __bt_tr_data_recv_item_sel, info); if (ad->inbound_latest_id < info->id) ad->inbound_latest_id = info->id; } else { - DBG("Transfer is ongoing for data or data invalid. \n"); + ERR("Transfer type is invalid"); + g_free(gl_data); } - DBG("-\n"); + evas_object_show(ad->tr_genlist); + + DBG("-"); return; } -static void __bt_add_tr_data_genlist(Evas_Object *parent, +static void __bt_share_gl_highlighted(void *data, Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *item = (Elm_Object_Item *)event_info; + bt_gl_data_t *gl_data; + DBG("+"); + + ret_if(item == NULL); + + gl_data = (bt_gl_data_t *)elm_object_item_data_get(item); + ret_if(gl_data == NULL); + + gl_data->highlighted = TRUE; + + elm_genlist_item_fields_update(item, "*", + ELM_GENLIST_ITEM_FIELD_CONTENT); + + DBG("-"); +} + +static void __bt_share_gl_unhighlighted(void *data, Evas_Object *obj, + void *event_info) +{ + Elm_Object_Item *item = (Elm_Object_Item *)event_info; + bt_gl_data_t *gl_data; + DBG("+"); + + ret_if(item == NULL); + + gl_data = (bt_gl_data_t *)elm_object_item_data_get(item); + ret_if(gl_data == NULL); + gl_data->highlighted = FALSE; + + elm_genlist_item_fields_update(item, "*", + ELM_GENLIST_ITEM_FIELD_CONTENT); + + DBG("-"); +} + +static Evas_Object *__bt_add_tr_data_genlist(Evas_Object *parent, bt_share_appdata_t *ad) { - if (ad == NULL) - return; + DBG("+"); + retvm_if (ad == NULL, NULL, "Inavalid parameter!"); - GSList *list_iter = NULL; - sqlite3 *db = NULL; + Evas_Object *genlist = elm_genlist_add(parent); - ad->tr_genlist = elm_genlist_add(parent); + evas_object_smart_callback_add(genlist, "highlighted", + __bt_share_gl_highlighted, ad); - /* Set item class for transfer data*/ - if (ad->tr_data_itc == NULL) { - ad->tr_data_itc = elm_genlist_item_class_new(); - if (ad->tr_data_itc == NULL) - return; + evas_object_smart_callback_add(genlist, "unhighlighted", + __bt_share_gl_unhighlighted, ad); - ad->tr_data_itc->item_style = "3text.1icon.2"; + evas_object_smart_callback_add(genlist, "realized", + __bt_genlist_realized_cb, ad); + + ad->tr_data_itc = elm_genlist_item_class_new(); + if (ad->tr_data_itc) { + ad->tr_data_itc->item_style = "2line.top.3"; ad->tr_data_itc->func.text_get = __bt_tr_label_get; ad->tr_data_itc->func.content_get = __bt_tr_icon_get; ad->tr_data_itc->func.state_get = NULL; - ad->tr_data_itc->func.del = NULL; + ad->tr_data_itc->func.del = __bt_tr_del; } - DBG("ad->tr_type = %d \n", ad->tr_type); + elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); + DBG("-"); + return genlist; +} - db = bt_share_open_db(); - if (!db) - return; +static Evas_Object * __bt_create_naviframe(bt_share_appdata_t *ad) +{ + DBG("+"); + retv_if (ad == NULL, NULL); + Evas_Object *navi_fr = NULL; + /* Naviframe */ + navi_fr = elm_naviframe_add(ad->tr_view); + ea_object_event_callback_add(navi_fr, EA_CALLBACK_BACK, + ea_naviframe_back_cb, NULL); + elm_object_part_content_set(ad->tr_view, "elm.swallow.content", navi_fr); + evas_object_show(navi_fr); + DBG("-"); + return navi_fr; +} - ad->tr_data_list = bt_share_get_completed_tr_data_list(db, ad->tr_type); - if (ad->tr_data_list == NULL) { - bt_share_close_db(db); - return; - } - bt_share_close_db(db); +void _bt_nocontent_set(bt_share_appdata_t *ad, gboolean set) +{ + DBG("+"); + ret_if(ad == NULL); + Evas_Object *layout = NULL; + Evas_Object *nocontents = NULL; + Evas_Object *genlist = NULL; + Elm_Object_Item *navi_it = NULL; - list_iter = ad->tr_data_list; + DBG("Set nocontent status : %d", set); - while (NULL != list_iter) { - _bt_append_genlist_tr_data_item(ad, list_iter->data, ad->tr_type); - list_iter = g_slist_next(list_iter); - } + if (set == TRUE) { + /* Full view layout */ + layout = elm_layout_add(ad->navi_fr); + elm_layout_file_set(layout, EDJFILE, "nocontents_layout"); + 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); + + /* Create elm_layout and set its style as nocontents/text */ + nocontents = elm_layout_add(layout); + elm_layout_theme_set(nocontents, "layout", "nocontents", "default"); + evas_object_size_hint_weight_set(nocontents, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(nocontents, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_part_text_set(nocontents, "elm.text", BT_STR_NO_TRANSFER_HISTORY); + elm_layout_signal_emit(nocontents, "text,disabled", ""); + elm_layout_signal_emit(nocontents, "align.center", "elm"); + + if (ad->navi_it) { + elm_object_item_part_content_set(ad->navi_it, + "elm.swallow.content", nocontents); + } else { + navi_it = elm_naviframe_item_push(ad->navi_fr, + (ad->tr_type == BT_TR_INBOUND) ? + BT_STR_RECEIVED_FILES : + BT_STR_SENT_FILES, + NULL, NULL, nocontents, NULL); + elm_naviframe_item_pop_cb_set(navi_it, + __bt_back_button_cb, ad); + ad->navi_it = navi_it; + } - evas_object_show(ad->tr_genlist); + if (ad->toolbar_btn) { + evas_object_del(ad->toolbar_btn); + ad->toolbar_btn = NULL; + } + ea_object_event_callback_del(ad->navi_fr, EA_CALLBACK_MORE, + __bt_more_menu_cb); - return; + }else { + genlist = __bt_add_tr_data_genlist(ad->tr_view, ad); + retvm_if (genlist == NULL, -1, "genlist is NULL!"); + + if (ad->tr_genlist) { + DBG("Clear the previous genlist"); + elm_genlist_clear(ad->tr_genlist); + ad->tr_genlist = NULL; + } + + ad->tr_genlist = genlist; + + if (ad->navi_it) { + elm_object_item_part_content_set(ad->navi_it, + "elm.swallow.content", genlist); + } else { + navi_it = elm_naviframe_item_push(ad->navi_fr, + (ad->tr_type == BT_TR_INBOUND) ? + BT_STR_RECEIVED_FILES : + BT_STR_SENT_FILES, + NULL, NULL, genlist, NULL); + elm_naviframe_item_pop_cb_set(navi_it, __bt_back_button_cb, ad); + ad->navi_it = navi_it; + } + + ea_object_event_callback_add(ad->navi_fr, EA_CALLBACK_MORE, + __bt_more_menu_cb, ad); + } } -static void __bt_nocontent_set(bt_share_appdata_t *ad, gboolean set) +void _bt_cb_state_changed(int result, + bt_adapter_state_e adapter_state, + void *user_data) { - Evas_Object *icon = NULL; - ret_if(ad == NULL); - elm_object_part_content_unset(ad->app_layout, "content"); + DBG("bluetooth %s", adapter_state == BT_ADAPTER_ENABLED ? + "enabled" : "disabled"); - if (set == TRUE) { - ad->nocontent = elm_layout_add(ad->layout_main); - if (ad->nocontent == NULL) - return; + ret_if(!user_data); + ret_if(result != BT_ERROR_NONE); - elm_layout_file_set(ad->nocontent, EDJFILE, "nocontent"); + bt_share_appdata_t *ad = (bt_share_appdata_t *)user_data; + Evas_Object *btn = NULL; - icon = elm_icon_add(ad->nocontent); + ad->bt_status = adapter_state; - if (ad->tr_type == BT_TR_OUTBOUND) - elm_icon_file_set(icon, BT_ICON_OUTBOUND, NULL); - else - elm_icon_file_set(icon, BT_ICON_INBOUND, NULL); + if (ad->ft_popup && ad->ft_type == BT_FT_RETRY_POPUP) { + btn = elm_object_part_content_get(ad->ft_popup, "button1"); + ret_if(!btn); + elm_object_text_set(btn, adapter_state == BT_ADAPTER_ENABLED ? BT_STR_RETRY : BT_STR_OK); + } - evas_object_size_hint_aspect_set(icon, - EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); - elm_icon_resizable_set(icon, 1, 1); - evas_object_show(icon); + if(adapter_state == BT_ADAPTER_DISABLED && ad->progress_popup) { + DBG("Adapter disabled, and progress popup is present, destroying"); + _bt_destroy_progress_popup(ad); + } +} - elm_object_part_text_set(ad->nocontent, "text", - BT_STR_TR_HISTORY_EMPTY); +static void __bt_move_clear_ctxpopup(Evas_Object *ctxpopup, + bt_share_appdata_t *ad) +{ + FN_START; + Evas_Coord w, h; + int pos = -1; - elm_object_part_content_set(ad->nocontent, "content", icon); - evas_object_show(ad->nocontent); - elm_object_part_content_set(ad->app_layout, "content", - ad->nocontent); - } else { - if (ad->nocontent != NULL) - evas_object_del(ad->nocontent); - } + ret_if(ad == NULL); + ret_if(ad->win == NULL); + + elm_win_screen_size_get(ad->win, NULL, NULL, &w, &h); + pos = elm_win_rotation_get(ad->win); + + switch (pos) { + case 0: + case 180: + evas_object_move(ctxpopup, (w / 2), h); + break; + case 90: + evas_object_move(ctxpopup, (h / 2), w); + break; + case 270: + evas_object_move(ctxpopup, (h / 2), w); + break; + } + FN_END; } -static Evas_Object *__bt_create_list_view(bt_share_appdata_t *ad) +static void __bt_clear_btn_del_cb(void *data) { - Evas_Object *scroller = NULL; - Evas_Object *layout = NULL; + FN_START; + bt_share_appdata_t *ad = NULL; - __bt_add_tr_data_genlist(ad->layout_main, ad); - scroller = __bt_create_scroller(ad->layout_main, ad->tr_genlist); - layout = elm_layout_add(ad->layout_main); + ret_if(data == NULL); + ad = (bt_share_appdata_t *)data; - if (layout == NULL) - return NULL; + if (ad->toolbar_btn != NULL) { + evas_object_del(ad->toolbar_btn); + ad->toolbar_btn = NULL; + } - elm_layout_file_set(layout, EDJFILE, "list"); - elm_object_part_content_set(layout, "content", scroller); - evas_object_show(layout); + FN_END; +} - return layout; +static void __bt_win_rotation_changed_cb(void *data, Evas_Object *obj, + void *event_info) +{ + bt_share_appdata_t *ad = (bt_share_appdata_t *)data; + __bt_move_clear_ctxpopup(ad->toolbar_btn, ad); } -int _bt_create_transfer_list(bt_share_appdata_t *ad) +static void __bt_clear_btn_delete_cb(void *data, Evas *e, + Evas_Object *obj, void *event_info) { - Elm_Object_Item *navi_it = NULL; - Evas_Object *back_btn = NULL; - Evas_Object *toolbar = NULL; - Elm_Object_Item *item = NULL; - char title[BT_GLOBALIZATION_STR_LENGTH] = { 0 }; - int i = 0; + FN_START; + Evas_Object *navi = (Evas_Object *)data; + Evas_Object *ctx = obj; - if (NULL == ad) - return -1; + ret_if (navi == NULL); - __bt_create_bg(ad->win, "group_list"); + evas_object_event_callback_del_full(ctx, EVAS_CALLBACK_DEL, + __bt_clear_btn_delete_cb, navi); + FN_END; +} - ad->layout_main = elm_layout_add(ad->win); - elm_layout_theme_set(ad->layout_main, "layout", "application", - "default"); - evas_object_size_hint_weight_set(ad->layout_main, - EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - elm_win_resize_object_add(ad->win, ad->layout_main); - elm_object_signal_emit(ad->layout_main, - "elm,state,show,content", "elm"); - evas_object_show(ad->layout_main); +static void __bt_more_menu_cb(void *data, + Evas_Object *obj, void *event_info) +{ + FN_START; - ad->navi_fr = elm_naviframe_add(ad->layout_main); - elm_object_part_content_set(ad->layout_main, "elm.swallow.content", - ad->navi_fr); - evas_object_show(ad->navi_fr); + Evas_Object *more_ctxpopup = NULL; + bt_share_appdata_t *ad; - back_btn = elm_button_add(ad->navi_fr); + ad = (bt_share_appdata_t *)data; + ret_if(ad == NULL); - ad->app_layout = __bt_create_list_view(ad); - if (ad->app_layout == NULL) - return -1; + more_ctxpopup = elm_ctxpopup_add(ad->win); + ad->toolbar_btn = more_ctxpopup; + ea_object_event_callback_add(more_ctxpopup, + EA_CALLBACK_BACK, __bt_clear_btn_del_cb, ad); + ea_object_event_callback_add(more_ctxpopup, + EA_CALLBACK_MORE, __bt_clear_btn_del_cb, ad); + elm_object_style_set(more_ctxpopup, "more/default"); + elm_ctxpopup_auto_hide_disabled_set(more_ctxpopup, EINA_TRUE); + + elm_ctxpopup_item_append(more_ctxpopup, BT_STR_CLR_LIST, + NULL, __bt_clear_list_btn_cb, ad); + evas_object_smart_callback_add(ad->win, "rotation,changed", + __bt_win_rotation_changed_cb, ad); + evas_object_event_callback_add(more_ctxpopup, EVAS_CALLBACK_DEL, + __bt_clear_btn_delete_cb, ad); + + elm_ctxpopup_direction_priority_set(more_ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, + ELM_CTXPOPUP_DIRECTION_DOWN, + ELM_CTXPOPUP_DIRECTION_UNKNOWN, + ELM_CTXPOPUP_DIRECTION_UNKNOWN); + + __bt_move_clear_ctxpopup(more_ctxpopup, ad); + evas_object_show(more_ctxpopup); + + FN_END; +} +int _bt_create_transfer_view(bt_share_appdata_t *ad) +{ + DBG("Create transfer view"); + retv_if (ad == NULL, -1); - if (ad->tr_type == BT_TR_OUTBOUND) - g_strlcpy(title, BT_STR_OUTBOUND_TR, - BT_GLOBALIZATION_STR_LENGTH); - else - g_strlcpy(title, BT_STR_INBOUND_TR, - BT_GLOBALIZATION_STR_LENGTH); + Elm_Object_Item *navi_it = NULL; + Evas_Object *conform = NULL; + Evas_Object *navi_fr = NULL; + Evas_Object *bg = NULL; + Evas_Object *layout = NULL; + Evas_Object *genlist = NULL; + GSList *list_iter = NULL; - navi_it = elm_naviframe_item_push(ad->navi_fr, - title, - back_btn, NULL, ad->app_layout, NULL); + __bt_clear_view(ad); + bg = _bt_create_bg(ad->win, NULL); + retv_if (bg == NULL, -1); + ad->bg = bg; - elm_object_style_set(back_btn, "naviframe/back_btn/default"); - evas_object_smart_callback_add(back_btn, "clicked", - __bt_back_button_cb, (void *)ad); - elm_object_focus_allow_set(back_btn, EINA_FALSE); + conform = _bt_create_conformant(ad->win, NULL); + retvm_if (conform == NULL, -1, "conform is NULL!"); + ad->conform = conform; - toolbar = elm_toolbar_add(ad->navi_fr); - if (toolbar == NULL) - return -1; + bg = elm_bg_add(conform); + elm_object_style_set(bg, "indicator/headerbg"); + elm_object_part_content_set(conform, "elm.swallow.indicator_bg", bg); + evas_object_show(bg); - elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND); - elm_object_style_set(toolbar, "default"); + layout = _bt_create_layout(conform, EDJFILE, "share_view"); + ad->tr_view = layout; - ad->toolbar_item = elm_toolbar_item_append(toolbar, NULL, BT_STR_CLR_LIST, - __bt_clear_list_btn_cb, ad); + elm_object_content_set(conform, layout); + elm_win_conformant_set(ad->win, EINA_TRUE); - /*Below code has been added to align the item as per UI specs.v1.6 */ - for (i = 0; i < BT_NAVI_ITEM_ADj; i++) { - item = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL); - elm_object_item_disabled_set(item, EINA_TRUE); - } + navi_fr = __bt_create_naviframe(ad); + retvm_if (navi_fr == NULL, -1, "navi_fr is NULL!"); + ad->navi_fr = navi_fr; - elm_object_item_part_content_set(navi_it, - "controlbar", toolbar); + /* Genlist */ + genlist = __bt_add_tr_data_genlist(layout, ad); + retvm_if (genlist == NULL, -1, "genlist is NULL!"); + ad->tr_genlist = genlist; + + list_iter = ad->tr_data_list; + /* Add genlist item */ + while (NULL != list_iter) { + _bt_append_genlist_tr_data_item(ad, genlist, list_iter->data, + ad->tr_type); + list_iter = g_slist_next(list_iter); + } + ea_object_event_callback_add(navi_fr, EA_CALLBACK_MORE, + __bt_more_menu_cb, ad); + navi_it = elm_naviframe_item_push(navi_fr, + (ad->tr_type == BT_TR_INBOUND) ? + BT_STR_RECEIVED_FILES : + BT_STR_SENT_FILES, + NULL, NULL, genlist, NULL); + elm_naviframe_item_pop_cb_set(navi_it, __bt_back_button_cb, ad); + ad->navi_it = navi_it; + + DBG("-"); return 0; } diff --git a/src/bt-share-ui-view.h b/src/bt-share-ui-view.h index 5635599..e221d8d 100644 --- a/src/bt-share-ui-view.h +++ b/src/bt-share-ui-view.h @@ -1,18 +1,25 @@ /* - * 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. - */ +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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_BT_SHARE_UI_VIEW_H_ #define __DEF_BT_SHARE_UI_VIEW_H_ @@ -24,32 +31,25 @@ extern "C" { #include "bt-share-ui-main.h" #include "bt-share-ui-ipc.h" -#include "bluetooth-share-api.h" +#include +#include #define BT_GLOBALIZATION_STR_LENGTH 256 #define BT_FILE_NAME_LEN_MAX 255 -#define BT_POPUP_TEXT_LEN \ - (BT_GLOBALIZATION_STR_LENGTH + BT_FILE_NAME_LEN_MAX) -#define BT_PERCENT_STR_LEN 5 - -#define BT_MIME_TYPE_MAX_LEN 20 -#define BT_FILE_SIZE_STR 10 -#define BT_INFO_POPUP_TIMEOUT_IN_SEC 2 Evas_Object *_bt_create_win(const char *name); void _bt_terminate_app(void); -void _bt_create_progress_popup(bt_share_popup_data_t *data); -int _bt_update_progress_popup(bt_share_appdata_t *ad, int transfer_id, const char *name, int percentage); -Evas_Object *_bt_create_info_popup(bt_share_appdata_t *ad, const char *title, const char *text); -Evas_Object *_bt_create_extinctive_info_popup(bt_share_appdata_t *ad, const char *title, const char *text); - - -int _bt_destroy_progress_popup(bt_share_appdata_t *ad); - -void _bt_append_genlist_tr_data_item(bt_share_appdata_t *ad, bt_tr_data_t *info, int tr_type); -void _bt_prepend_genlist_tr_data_item(bt_share_appdata_t *ad, bt_tr_data_t *info, int tr_type); -int _bt_create_transfer_list(bt_share_appdata_t *ad); -int _bt_destroy_info_popup(bt_share_appdata_t *ad); +void _bt_append_genlist_tr_data_item(bt_share_appdata_t *ad, + Evas_Object *genlist, bt_tr_data_t *info, int tr_type); +void _bt_prepend_genlist_tr_data_item(bt_share_appdata_t *ad, + bt_tr_data_t *info, int tr_type); +void _bt_delete_selected_item(bt_share_appdata_t *ad); +int _bt_create_transfer_view(bt_share_appdata_t *ad); +void _bt_nocontent_set(bt_share_appdata_t *ad, gboolean set); +void _bt_cb_state_changed(int result, + bt_adapter_state_e adapter_state, + void *user_data); +void _bt_update_tr_notification(void *data); #ifdef __cplusplus } diff --git a/src/bt-share-ui-widget.c b/src/bt-share-ui-widget.c new file mode 100644 index 0000000..43336b8 --- /dev/null +++ b/src/bt-share-ui-widget.c @@ -0,0 +1,215 @@ +/* +* ug-setting-bluetooth-efl +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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 "applog.h" +#include "bt-share-ui-widget.h" +#include "bt-share-ui-main.h" +#include + +#define IMG_PATH_MAX 256 +#define COLOR_TABLE "/usr/apps/ug-bluetooth-efl/res/tables/ug-bluetooth-efl_ChangeableColorTable.xml" +#define FONT_TABLE "/usr/apps/ug-bluetooth-efl/res/tables/ug-bluetooth-efl_FontInfoTable.xml" + + +Evas_Object *_bt_create_naviframe(Evas_Object *parent) +{ + Evas_Object *nf; + + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + + nf = elm_naviframe_add(parent); + elm_object_part_content_set(parent, "elm.swallow.content", nf); + evas_object_show(nf); + + return nf; +} + +Evas_Object *_bt_create_button(Evas_Object *parent, char *style, char *part, + char *text, char *icon_path, + Evas_Smart_Cb func, void *data) +{ + Evas_Object *btn = NULL; + Evas_Object *icon = NULL; + + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + btn = elm_button_add(parent); + + if (style) + elm_object_style_set(btn, style); + + if (part) + elm_object_part_content_set(parent, part, btn); + + if (icon_path) { + icon = elm_image_add(btn); + elm_image_file_set(icon, icon_path, NULL); + elm_object_part_content_set(btn, "elm.icon", icon); + } + + if (text) + elm_object_text_set(btn, text); + + if (func) + evas_object_smart_callback_add(btn, "clicked", func, data); + + evas_object_show(btn); + + return btn; +} + +Evas_Object *_bt_create_progressbar(Evas_Object *parent, const char *style) +{ + Evas_Object *progress_bar = NULL; + + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + + progress_bar = elm_progressbar_add(parent); + + if (style) + elm_object_style_set(progress_bar, style); + else + elm_object_style_set(progress_bar, "list_process"); + + evas_object_show(progress_bar); + elm_progressbar_pulse(progress_bar, EINA_TRUE); + + return progress_bar; +} + +Evas_Object *_bt_create_bg(Evas_Object *parent, char *style) +{ + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + + Evas_Object *bg = app_get_preinitialized_background(); + if (bg == NULL) { + ERR("app_get_preinitialized_background fail!"); + bg = elm_bg_add(parent); + } + + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + + if (style) + elm_object_style_set(bg, style); + + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(parent, bg); + evas_object_show(bg); + + return bg; +} + +Evas_Object *_bt_create_layout(Evas_Object *parent, char *edj, char *content) +{ + Evas_Object *layout; + + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + + layout = elm_layout_add(parent); + + if (edj != NULL && content != NULL) + elm_layout_file_set(layout, edj, content); + else { + elm_layout_theme_set(layout, "layout", "application", + "default"); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + } + + evas_object_show(layout); + + return layout; +} + +Evas_Object *_bt_create_label(Evas_Object *parent, const char *text) +{ + Evas_Object *label; + + retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n"); + + label = elm_label_add(parent); + elm_label_line_wrap_set(label, ELM_WRAP_MIXED); + + if (text) + elm_object_text_set(label, text); + + evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); + + evas_object_show(label); + + return label; +} + +Evas_Object *_bt_create_conformant(Evas_Object *parent, Evas_Object *content) +{ + Evas_Object *conform = NULL; + + elm_win_conformant_set(parent, 1); + conform = (Evas_Object *)app_get_preinitialized_conformant(); + if (conform == NULL) { + ERR("app_get_preinitialized_conformant fail!"); + conform = elm_conformant_add(parent); + } + + evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(parent, conform); + /* elm_object_style_set(conform, "internal_layout"); */ + evas_object_show(conform); + + if (content) + elm_object_content_set(conform, content); + + return conform; +} + +Ea_Theme_Color_Table *_bt_color_table_set(void) +{ + FN_START; + Ea_Theme_Color_Table *table = NULL; + + table = ea_theme_color_table_new(COLOR_TABLE); + retv_if(!table, NULL); + + DBG("Bluetooth color table : %p", table); + ea_theme_colors_set(table, EA_THEME_STYLE_DEFAULT); + FN_END; + return table; +} + +Ea_Theme_Font_Table *_bt_font_table_set(void) +{ + FN_START; + Ea_Theme_Font_Table *table = NULL; + + table = ea_theme_font_table_new(FONT_TABLE); + retv_if(!table, NULL); + ea_theme_fonts_set(table); + + DBG("Bluetooth font table : %p", table); + FN_END; + return table; +} + diff --git a/src/bt-share-ui-widget.h b/src/bt-share-ui-widget.h new file mode 100644 index 0000000..43da45e --- /dev/null +++ b/src/bt-share-ui-widget.h @@ -0,0 +1,60 @@ +/* +* bluetooth-share-ui +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Contact: Hocheol Seo +* GirishAshok Joshi +* DoHyun Pyun +* +* 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 __BT_SHARE_UI_WIDGET_H__ +#define __BT_SHARE_UI_WIDGET_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +Evas_Object *_bt_create_naviframe(Evas_Object *parent); + +Evas_Object *_bt_create_button(Evas_Object *parent, char *style, char *part, + char *text, char *icon_path, + Evas_Smart_Cb func, void *data); + +Evas_Object *_bt_create_progressbar(Evas_Object *parent, + const char *style); + +Evas_Object *_bt_create_bg(Evas_Object *parent, char *style); + +Evas_Object *_bt_create_layout(Evas_Object *parent, char *edj, + char *content); + +Evas_Object *_bt_create_label(Evas_Object *parent, const char *text); + +Evas_Object *_bt_create_conformant(Evas_Object *parent, + Evas_Object *content); + +Ea_Theme_Color_Table *_bt_color_table_set(void); + +Ea_Theme_Font_Table *_bt_font_table_set(void); + +#ifdef __cplusplus +} +#endif +#endif /* __BT_SHARE_UI_WIDGET_H__ */