diff options
125 files changed, 5823 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..7038fd0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,54 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(ug-attach-panel-document C) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(RESDIR ${PREFIX1}/res) + +ADD_DEFINITIONS("-D_USE_DLOG_") +ADD_DEFINITIONS("-D_USE_SECURE_LOG_") + +# subdir +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(res/edje) +ADD_SUBDIRECTORY(res/edje/icons) +ADD_SUBDIRECTORY(res/po) +ADD_SUBDIRECTORY(res/edje/sounds) + +CONFIGURE_FILE(attach-panel-document.manifest ${PKGNAME}.manifest) + +FUNCTION (BUILD_EDJ _in _out) + ADD_CUSTOM_TARGET(${_out} + COMMAND + edje_cc + -id ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/icons + -sd ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/sounds + ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/${_in} + ${CMAKE_BINARY_DIR}/${_out} + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/${_in} + ) + ADD_DEPENDENCIES(${PROJECT_NAME} ${_out}) + INSTALL(FILES ${CMAKE_BINARY_DIR}/${_out} DESTINATION ${RESDIR}/edje/${PROJECT_NAME}/) +ENDFUNCTION (BUILD_EDJ) + + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/res/edje) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/res/po) + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED + libtzplatform-config +) + +# Build edc files +BUILD_EDJ(attach-panel-document.edc attach-panel-document.edj) + + +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/icons DESTINATION ${RESDIR}/edje/icons/) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/sounds DESTINATION ${RESDIR}/edje/${PROJECT_NAME}/) +#INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/po DESTINATION ${RESDIR}/) + +#INSTALL(FILES attach-panel-document.xml DESTINATION ${TZ_SYS_RO_PACKAGES}) +INSTALL(FILES attach-panel-document.xml DESTINATION /usr/share/packages) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/icons DESTINATION ${PREFIX1}/res/images/ug-attach-panel-document) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/shared/res/org.tizen.attach-panel-document.png DESTINATION ${PREFIX1}/shared/res) @@ -0,0 +1,204 @@ +Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + 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. + + 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, + 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 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 in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) 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 + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache 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 Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 + + 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/attach-panel-document.manifest b/attach-panel-document.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/attach-panel-document.manifest @@ -0,0 +1,5 @@ +<manifest> + <request> + <domain name="_"/> + </request> +</manifest> diff --git a/attach-panel-document.xml b/attach-panel-document.xml new file mode 100644 index 0000000..513c5db --- /dev/null +++ b/attach-panel-document.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns="http://tizen.org/ns/packages" package="attach-panel-document" api-version="3.0" version="0.0.1" install-location="internal-only"> + <label>Document Appcontrol</label> + <author email="ch.kumar@samsung.com" href="www.samsung.com">Chandan Kumar</author> + <description>attach-panel-document UG</description> + <ui-application appid="attach-panel-document" exec="/usr/ug/bin/attach-panel-document" hw-acceleration="use-GL" nodisplay="true" multiple="true" type="capp" taskmanage="false" > + <icon>/usr/ug/res/images/attach-panel-document/attach-panel-document.png</icon> + <label>Document</label> + </ui-application> +</manifest> diff --git a/include/attach-panel-document.h b/include/attach-panel-document.h new file mode 100644 index 0000000..34415e3 --- /dev/null +++ b/include/attach-panel-document.h @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 __ATTACH_PANEL_DOCUMENT_H__ +#define __ATTACH_PANEL_DOCUMENT_H__ + +#include "doc-data-util.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define DOC_UG_RES_DIR PREFIX"/res/" +#define DOC_IMAGES_DIR DOC_UG_RES_DIR"images/"PACKAGE"/images/" +#define DOC_EDJ_DIR DOC_UG_RES_DIR"edje/"PACKAGE"/" +#define DOC_EDJ_FILE DOC_EDJ_DIR"attach-panel-document.edj" +#define DOC_GRP_LISTVIEW "document/listview" +#define DOC_BUNDLE_LAUNCH_TYPE "launch-type" +#define DOC_BUNDLE_SELECTION_MODE_SINGLE "single" +#define DOC_BUNDLE_SELECTION_MODE_MULTI "multiple" +#define DOC_BUNDLE_FILE_TYPE "file-type" +#define DOC_LAUNCH_SELECT_ONE "select-one" +#define DOC_LAUNCH_SELECT_MULTIPLE "select-multiple" +#define DOC_FILE_TYPE_IMAGE "image" +#define DOC_FILE_TYPE_VIDEO "video" +#define DOC_FILE_SELECT_RETURN_COUNT "count" +#define DOC_FILE_SELECT_RETURN_PATH "path" + + +/* MIME type */ +#define DOC_MIME_IMAGE_ALL "image/*" +#define DOC_MIME_VIDEO_ALL "video/*" + +#define DOC_NAVIFRAME_POP_CB_KEY "ge_naviframe_pop_cb_key" + +#define DOC_IF_DEL_TIMER(timer) if (timer) { ecore_timer_del(timer); timer = NULL; } +#define DOC_IF_DEL_IDLER(idler) if (idler) { ecore_idler_del(idler); idler = NULL; } +#define DOC_IF_DEL_OBJ(obj) if (obj) { evas_object_del(obj); obj = NULL; } + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __ATTACH_PANEL_DOCUMENT_H__ */ + diff --git a/include/doc-data-type.h b/include/doc-data-type.h new file mode 100644 index 0000000..160239c --- /dev/null +++ b/include/doc-data-type.h @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_DATA_TYPE_H_ +#define _DOC_DATA_TYPE_H_ + +#include <stdlib.h> +#include <eina_list.h> +#include <media_content.h> + +#define DOC_FREEIF(ptr) \ + do { \ + if (ptr != NULL) \ + { \ + free(ptr); \ + ptr = NULL; \ + } \ + } while (0) + +#define DOC_FREE(ptr) \ + do { \ + free(ptr); \ + ptr = NULL; \ + } while (0) + +#define DOC_GFREEIF(ptr) \ + do { \ + if (ptr != NULL) { \ + g_free(ptr); \ + ptr = NULL; \ + } \ + } while (0) + +#define DOC_GFREE(ptr) \ + do { \ + g_free(ptr); \ + ptr = NULL; \ + } while (0) + +#define DOC_TYPE_FOLDER (0x55551) +#define DOC_TYPE_MEDIA (0x55553) +#define DOC_TYPE_WEB_MEDIA (0x55554) + +typedef enum { + DOC_PHONE,/**< Stored only in phone */ + DOC_MMC, /**< Stored only in MMC */ + DOC_ALL, /**< Stored in Both */ +} _document_store_type_t; + + +typedef struct _doc_folder_t doc_folder_s; +typedef struct _doc_media_t doc_media_s; + +struct _doc_folder_t { + int gtype; /*self-defination type, when free this struct space, use it*/ + char *uuid; /*folder UUID*/ + char *display_name; /*folder name*/ + char *path; /*the full path of this folder*/ + int type; /*storage type*/ + time_t mtime; /*modified time*/ + int count; /*the media count in this folder*/ +}; + +struct _doc_media_t { + int gtype; /*self-defination type, when free this struct space, use it*/ + media_info_h media_h; /*the handle of operating this media*/ + char *uuid; /*meida id*/ + int type; /*meida type, image or video*/ + char *thumb_url; /*the thumbnail full path of this meida file*/ + char *file_url; /*the full path of this meida file*/ + time_t mtime; /*modified time*/ + char *display_name; /*item name*/ + int mode; /* Show icon indicates different camera shot mode */ + media_content_storage_e storage_type; /* Storage type got from DB */ + bool b_create_thumb; /* Request DB to create thumbnail */ +}; + +int doc_data_type_free_geitem(void **item); + +#endif /* __ATTACH_PANEL_DOCUMENT_H__ */ diff --git a/include/doc-data-util.h b/include/doc-data-util.h new file mode 100644 index 0000000..dc37d39 --- /dev/null +++ b/include/doc-data-util.h @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_DATA_UTIL_H_ +#define _DOC_DATA_UTIL_H_ + +#include <stdio.h> +#include <glib.h> +#include <string.h> +#include <media_content.h> +#include "doc-debug.h" +#include "doc-strings.h" +#include "doc-data-type.h" +#include "doc-ugdata.h" + +#ifdef _cplusplus +extern "C" { +#endif + +/*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music*/ +#define DOC_CONDITION_IMAGE_VIDEO "(MEDIA_TYPE=0 OR MEDIA_TYPE=1)" +#define DOC_CONDITION_IMAGE "(MEDIA_TYPE=0)" + +#define DOC_CONDITION_LOCAL_DOCUMENT "((MEDIA_TYPE=4) AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1))" + + +#define DOC_CONDITION_ORDER "MEDIA_TIMELINE, MEDIA_DISPLAY_NAME" +#define CONDITION_LENGTH 512 +#define KEYWORD_LENGTH 128 + +#define DOC_CAMERA_PATH_PHONE "/opt/usr/media/DCIM/Camera" +#define DOC_CAMERA_PATH_MMC "/opt/storage/sdcard/DCIM/Camera" +#define DOC_DOWNLOADS_PATH "/opt/usr/media/Downloads" + +#define DOC_ROOT_PATH_MMC "/opt/storage/sdcard" + +#define DOC_NOCONTENTS_LABEL_LEN_MAX 512 + +#define DOC_GET_UNTIL_LAST_RECORD 65536 /* Fixme: Do not use 65536. */ +#define DOC_GET_ALL_RECORDS -1 + +typedef struct _doc_transfer_data_t doc_transfer_data_s; + +struct _doc_transfer_data_t { + void **userdata; + char *album_id; + bool with_meta; + bool b_mtype; + int list_type; +}; + +typedef struct _ge_filter_t doc_filter_s; + +struct _ge_filter_t { + char cond[CONDITION_LENGTH]; /*set media type or favorite type, or other query statement*/ + media_content_collation_e collate_type; /*collate type*/ + media_content_order_e sort_type; /*sort type*/ + char sort_keyword[KEYWORD_LENGTH]; /*sort keyword*/ + int offset; /*offset*/ + int count; /*count*/ + bool with_meta; /*whether get image or video info*/ + int list_type; +}; + +typedef enum { + DOC_ALBUM_LIST_NONE, /**< */ + DOC_ALBUM_LIST_FIRST, /**< Get first several albums except Camera and Downloads */ + DOC_ALBUM_LIST_PATH, /**< Get a album via path */ + DOC_ALBUM_LIST_ALL, /**< Get all albums except Camera and Downloads */ +} doc_folder_list_e; + +doc_item *doc_data_util_calloc_geitem(void); +int doc_data_util_free_mtype_items(Eina_List **elist); +int doc_data_util_free_item(doc_item *gitem); +doc_sel_item_s* doc_data_util_new_sel_item(doc_item *gitem); +int doc_data_util_free_sel_item(doc_sel_item_s *item); +int doc_data_util_create_filter(doc_filter_s *condition, filter_h *filter); +int doc_data_util_destroy_filter(filter_h filter); +bool doc_data_util_clone_media(media_info_h media, doc_media_s **pitem, + bool b_meta); + +#ifdef _cplusplus +} +#endif + +#endif //_DOC_DATA_UTIL_H_ + diff --git a/include/doc-data.h b/include/doc-data.h new file mode 100644 index 0000000..3f073c4 --- /dev/null +++ b/include/doc-data.h @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_DATA_H_ +#define _DOC_DATA_H_ + +#include "doc-local-data.h" +#include "attach-panel-document.h" + +#ifdef _cplusplus +extern "C" { +#endif + +typedef int (*doc_restore_selected_cb)(Eina_List *sel_id, doc_item *gitem); + +int doc_data_get_item_cnt(doc_ugdata *ugd, int *item_cnt); +int doc_data_get_sel_paths(doc_ugdata *ugd, char **filepath, char ***filepath_arr, int *cnt); +int doc_data_get_media_data(doc_ugdata *ugd, int type, int start_pos, + int end_pos, Eina_List **pmedias_elist, + doc_restore_selected_cb restore_cb, Eina_List *sel_id); +int doc_del_media_data_by_id(doc_ugdata* ugd, const char *media_id); +int doc_data_init(doc_ugdata* ugd); +int doc_data_finalize(doc_ugdata* ugd); +#ifdef _cplusplus +} +#endif +#endif /* _DOC_DATA_H_ */ + diff --git a/include/doc-db-update.h b/include/doc-db-update.h new file mode 100644 index 0000000..8d90f23 --- /dev/null +++ b/include/doc-db-update.h @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_DB_UPDATE_H_ +#define _DOC_DB_UPDATE_H_ + +#include "doc-ugdata.h" + +bool doc_db_update_reg_cb(doc_ugdata *ugd); +bool doc_db_update_finalize(doc_ugdata *ugd); + +#endif //_DOC_DB_UPDATE_H_ + + diff --git a/include/doc-debug.h b/include/doc-debug.h new file mode 100644 index 0000000..852af25 --- /dev/null +++ b/include/doc-debug.h @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_DEBUG_H_ +#define _DOC_DEBUG_H_ + +#include <dlog.h> + +#ifdef _cplusplus +extern "C" { +#endif + +#ifdef LOG_TAG +#undef LOG_TAG +#endif + +#define LOG_TAG "ATTACH_PANEL_DOCUMENT" + +typedef enum { + DEBUG_CRITICAL, + DEBUG_CHECK, + MB_DEBUG_LOG, + DEBUG_MAX +} DOCDebugType; + +#ifdef _USE_DLOG_ +#define doc_dbg(fmt, arg...) LOGD(fmt, ##arg) +#define doc_dbgW(fmt, arg...) LOGW(fmt, ##arg) +#define doc_dbgE(fmt, arg...) LOGE(fmt, ##arg) + +#else + +#define doc_dbg(fmt,arg...) +#define doc_dbgW(fmt, arg...) +#define doc_dbgE(fmt, arg...) +#endif + +#ifdef _USE_SECURE_LOG_ +#define doc_sdbg(fmt, arg...) SECURE_LOGD(fmt, ##arg) +#define doc_sdbgW(fmt, arg...) SECURE_LOGI(fmt, ##arg) +#define doc_sdbgE(fmt, arg...) SECURE_LOGE(fmt, ##arg) +#endif + +#define doc_retm_if(expr, fmt, arg...) do { \ + if (expr) { \ + doc_dbgE(fmt, ##arg); \ + doc_dbgE("(%s) -> %s() return", #expr, __FUNCTION__); \ + return; \ + } \ + } while (0) +#define doc_retvm_if(expr, val, fmt, arg...) do { \ + if (expr) { \ + doc_dbgE(fmt, ##arg); \ + doc_dbgE("(%s) -> %s() return", #expr, __FUNCTION__); \ + return (val); \ + } \ + } while (0) + + +#define DOC_CHECK_VAL(expr, val) doc_retvm_if(!(expr), val, "Invalid parameter, return ERROR code!") +#define DOC_CHECK_NULL(expr) doc_retvm_if(!(expr), NULL, "Invalid parameter, return NULL!") +#define DOC_CHECK_FALSE(expr) doc_retvm_if(!(expr), false, "Invalid parameter, return FALSE!") +#define DOC_CHECK_CANCEL(expr) doc_retvm_if(!(expr), ECORE_CALLBACK_CANCEL, "Invalid parameter, return ECORE_CALLBACK_CANCEL!") +#define DOC_CHECK(expr) doc_retm_if(!(expr), "Invalid parameter, return!") + + +#include <time.h> +#include <sys/time.h> + +#ifdef _cplusplus +} +#endif + +#endif //_DOC_DEBUG_H_ + diff --git a/include/doc-list.h b/include/doc-list.h new file mode 100644 index 0000000..fb4b262 --- /dev/null +++ b/include/doc-list.h @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_LIST_H_ +#define _DOC_LIST_H_ + +#include "attach-panel-document.h" + +typedef enum _FILE_TYPE fsFileType; +enum _FILE_TYPE { + FILE_TYPE_NONE = 0, + FILE_TYPE_DIR, /**< Folder category */ + FILE_TYPE_FILE, /**< File category */ + FILE_TYPE_IMAGE, /**< Image category */ + FILE_TYPE_VIDEO, /**< Video category */ + FILE_TYPE_MUSIC, /**< Music category */ + FILE_TYPE_SOUND, /**< Sound category */ + FILE_TYPE_PDF, /**< Pdf category */ + FILE_TYPE_DOC, /**< Word category */ + FILE_TYPE_PPT, /**< Powerpoint category */ + FILE_TYPE_EXCEL, /**< Excel category */ + FILE_TYPE_VOICE, /**< Voice category */ + FILE_TYPE_HTML, /**< Html category */ + FILE_TYPE_FLASH, /**< Flash category */ + FILE_TYPE_GAME, /**< Game category */ + FILE_TYPE_APP, /**< Application category */ + FILE_TYPE_THEME, /**< Theme category */ + FILE_TYPE_TXT, /**< Txt category */ + FILE_TYPE_VCONTACT, /**< Vcontact category */ + FILE_TYPE_VCALENDAR, /**< Vcalendar category */ + FILE_TYPE_VNOTE, /**< Vnote category */ + FILE_TYPE_VBOOKMARK, /**< Vbookmark category */ + FILE_TYPE_VIDEO_PROJECT, /**< Video editor project category */ + FILE_TYPE_RADIO_RECORDED, /**< radio recorded clips category */ + FILE_TYPE_MOVIE_MAKER, /**< Movie maker project category */ + FILE_TYPE_SVG, /**< Svg category */ + FILE_TYPE_RSS, /**< Rss reader file, *.opml */ + FILE_TYPE_CERTIFICATION, /**< certification file, *.pem */ + FILE_TYPE_JAVA, /**< java file, *.jad, *.jar */ + FILE_TYPE_WGT, /**< wrt , *.wgt, *.wgt */ + FILE_TYPE_TPK, /**< *.tpk>*/ + FILE_TYPE_SNB, /**<*.snb> */ + FILE_TYPE_GUL, /**<*.gul> */ + FILE_TYPE_HWP, /**<*.hwp> */ + FILE_TYPE_ETC, /**< Other files category */ + FILE_TYPE_TASK, + FILE_TYPE_EML, + FILE_TYPE_CSV, + FILE_TYPE_SPD, + FILE_TYPE_MAX +}; + +/*************** Default Icon ***********************/ +#define DOC_DEFAULT_ICON "doc_icon_etc.png" +#define DOC_ICON_FOLDER "doc_icon_folder.png" +#define DOC_ICON_IMAGE "doc_icon_images.png" +#define DOC_ICON_VIDEO "doc_icon_video.png" +#define DOC_ICON_MUSIC "doc_icon_music.png" +#define DOC_ICON_SOUND "doc_icon_amr.png" +#define DOC_ICON_PDF "doc_icon_pdf.png" +#define DOC_ICON_DOC "doc_icon_word.png" +#define DOC_ICON_PPT "doc_icon_ppt.png" +#define DOC_ICON_EXCEL "doc_icon_excel.png" +#define DOC_ICON_HTML "doc_icon_html.png" +#define DOC_ICON_FLASH "doc_icon_swf.png" +#define DOC_ICON_TXT "doc_icon_text.png" +#define DOC_ICON_VCONTACT "doc_icon_vcard.png" +#define DOC_ICON_VCALENDAR "doc_icon_vcalender.png" +#define DOC_ICON_VNOTE "doc_icon_vText.png" +#define DOC_ICON_RSS "doc_icon_rss.png" +#define DOC_ICON_JAVA "doc_icon_java.png" +#define DOC_ICON_MUSIC_PAUSE "doc_icon_control_pause.png" //NotFound +#define DOC_ICON_VIDEO_PLAY "doc_icon_video_play.png" +#define DOC_ICON_TPK "doc_icon_tpk.png" +#define DOC_ICON_SNB "doc_icon_snb.png" +#define DOC_ICON_HWP "doc_icon_hwp.png" +#define DOC_ICON_GUL "doc_icon_etc.png" +#define DOC_ICON_EMAIL "doc_icon_email.png" +#define DOC_ICON_TASK "doc_icon_task.png" +#define DOC_ICON_ZIP "doc_icon_zip.png" +#define DOC_ICON_SVG "doc_icon_svg.png" + +#define SAFE_FREE_CHAR(x) do {\ + if ((x) != NULL) {\ + free(x); \ + x = NULL;\ + } \ + } while (0) +void doc_list_change_selection_mode(doc_ugdata *ugd, bool state); +int doc_list_lang_update(doc_ugdata *ugd); +int doc_update_genlist(doc_ugdata *ugd); +int doc_create_genlist(doc_ugdata *ugd); + +#endif /* _DOC_LIST_H_ */ + diff --git a/include/doc-local-data.h b/include/doc-local-data.h new file mode 100644 index 0000000..9f29d18 --- /dev/null +++ b/include/doc-local-data.h @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_LOCAL_DATA_H_ +#define _DOC_LOCAL_DATA_H_ + +#include "doc-data-util.h" + +int doc_local_data_connect(void); +int doc_local_data_disconnect(void); +int doc_local_data_get_folder_by_path(char *path, doc_folder_s **folder); +int doc_local_data_get_all_media_count(doc_filter_s *condtion, int *item_cnt); +int doc_local_data_get_all_folders_media_list(doc_filter_s *condition, + Eina_List **elist); + +#endif //_DOC_LOCAL_DATA_H_ + diff --git a/include/doc-main-view.h b/include/doc-main-view.h new file mode 100644 index 0000000..a701100 --- /dev/null +++ b/include/doc-main-view.h @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 __DOC_MAIN_VIEW_H__ +#define __DOC_MAIN_VIEW_H__ + +#include "doc-ugdata.h" + +int doc_main_view_create(doc_ugdata *ugd); + +#endif //__DOC_MAIN_VIEW_H__ + diff --git a/include/doc-strings.h b/include/doc-strings.h new file mode 100644 index 0000000..994d09e --- /dev/null +++ b/include/doc-strings.h @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_STRINGS_H_ +#define _DOC_STRINGS_H_ + +#ifdef _cplusplus +extern "C" { +#endif + +#define DOC_STR_DOMAIN_SYS "sys_string" +#define DOC_STR_DOMAIN_LOCAL "attach-panel-document" + +#define _DOC_GETSYSTEMSTR(ID) dgettext(DOC_STR_DOMAIN_SYS, (ID)) +#define _DOC_GETLOCALSTR(ID) dgettext(DOC_STR_DOMAIN_LOCAL, (ID)) + +#define DOC_STR_MAX_PICTURES_SELECTED _DOC_GETLOCALSTR("IDS_MEDIABR_POP_MAXIMUM_NUMBER_OF_PICTURES_HPD_EXCEEDED") +#define DOC_STR_UNSUPPORTED_FILE _DOC_GETLOCALSTR("IDS_GALLERY_TPOP_FILE_CORRUPT_OR_IN_UNSUPPORTED_FORMAT") +#define DOC_STR_PD_SELECTED _DOC_GETLOCALSTR("IDS_MEDIABR_HEADER_PD_SELECTED") +#define DOC_STR_NO_ITEMS _DOC_GETSYSTEMSTR("IDS_COM_BODY_NO_ITEMS") +#define DOC_STR_NO_ITEMS_HELP_TEXT _DOC_GETLOCALSTR("IDS_GALLERY_BODY_AFTER_YOU_TAKE_PICTURES_THEY_WILL_BE_SHOWN_HERE") + +#define ATTACH_PANEL_FLICK_MODE_ENABLE "enable" +#define ATTACH_PANEL_FLICK_MODE_DISABLE "disable" +#define ATTACH_PANEL_FLICK_MODE_KEY "__ATTACH_PANEL_FLICK_DOWN__" + +#ifdef _cplusplus +} +#endif +#endif //_DOC_STRINGS_H_ diff --git a/include/doc-ugdata.h b/include/doc-ugdata.h new file mode 100644 index 0000000..2c328be --- /dev/null +++ b/include/doc-ugdata.h @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 __DOC_UGDATA_H__ +#define __DOC_UGDATA_H__ + +#include <glib.h> +#include <Elementary.h> +#include <stdio.h> +#include <string.h> +#include <ui-gadget-module.h> +#include <Eina.h> +#include <app.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define HALF_MODE_PORTRAIT_HEIGHT 362 +#define FULL_MODE_PORTRAIT_HEIGHT 1036 +#define LANDSCAPE_HEIGHT 528 + +typedef enum { + DOC_FILE_SELECT_T_NONE, + DOC_FILE_SELECT_T_ONE, + DOC_FILE_SELECT_T_MULTIPLE, + DOC_FILE_SELECT_T_SLIDESHOW, +} doc_file_select_e; + +typedef enum { + DOC_FILE_T_NONE, + DOC_FILE_T_IMAGE, + DOC_FILE_T_VIDEO, + DOC_FILE_T_ALL, +} doc_file_type_e; + +typedef enum { + DOC_ROTATE_NONE, + DOC_ROTATE_PORTRAIT, + DOC_ROTATE_PORTRAIT_UPSIDEDOWN, + DOC_ROTATE_LANDSCAPE, + DOC_ROTATE_LANDSCAPE_UPSIDEDOWN, +} doc_rotate_mode; + +typedef enum { + DOC_UPDATE_NONE, + DOC_UPDATE_NORMAL, + DOC_UPDATE_MMC_REMOVED, + DOC_UPDATE_MMC_ADDED, + DOC_UPDATE_VIEW_INOTIFY +} doc_update_mode; + +typedef struct _doc_ugdata doc_ugdata; +typedef struct _doc_item doc_item; +typedef struct _doc_sel_item_t doc_sel_item_s; +typedef struct _doc_cluster doc_cluster; +typedef struct _doc_thumbs_t doc_thumbs_s; +typedef struct doc_db_noti_t doc_db_noti_s; + +typedef int (*doc_folder_append_cb)(doc_ugdata *ugd, doc_cluster *album); +typedef int (*doc_rotate_view_cb)(doc_ugdata *ugd); + + +struct _doc_sel_item_t { + char *uuid; + char *file_url; + int store_type; + int valid; + int sequence; +}; + +struct _doc_item { + doc_media_s* item; + doc_ugdata* ugd; + Elm_Object_Item *elm_item; + bool checked; + doc_cluster *album; + int store_type; + int sequence; +}; + +struct _doc_cluster { + doc_ugdata *ugd; + int sel_cnt; /* Selected medias count of current album */ + bool select; +}; + +typedef enum { + ATTACH_PANEL_NONE, + ATTACH_PANEL_FULL_MODE, + ATTACH_PANEL_HALF_MODE, +}_doc_attach_panel_display_mode; + +struct _doc_ugdata {//[ToDo] Check what all members needed. + Evas_Object *win; + Evas_Object *ly_parent; + Evas_Object *ly_main; + Evas_Object *bg; + Elm_Theme *th; + Evas_Object *naviframe; + Elm_Object_Item *nf_it; + Evas_Object *conform; + Elm_Win_Indicator_Opacity_Mode indi_o_mode; + Elm_Win_Indicator_Mode indi_mode; + bool overlap_mode; + int rotate_mode; + Eina_List *rotate_cbs; + Evas_Object *list_view; + Evas_Object *list_view_ly; + Evas_Object *nocontents; + Evas_Object *popup; + Ecore_Timer *del_timer; + ui_gadget_h ug_called_by_me; + ui_gadget_h ug; + char *ug_path; + app_control_h service; /*added for "ug_send_result"*/ + Eina_List *selected_elist; + Eina_Bool ck_state; + int file_select_mode; + int file_type_mode; + int max_count; + bool b_multifile; /* Multipe files selection */ + bool b_hide_indicator; + doc_thumbs_s *thumbs_d; + doc_db_noti_s *db_noti_d; + _doc_attach_panel_display_mode attach_panel_display_mode; + bool is_attach_panel; + long long int selsize; + long long int limitsize; +}; + +struct _doc_thumbs_t { + doc_ugdata *ugd; + Evas_Object *view; + Evas_Object *check; + Evas_Object *nocontents; + Evas_Object *layout; + Elm_Genlist_Item_Class *gic; + Elm_Object_Item *nf_it; + int store_type; + int tot_selected; + int medias_cnt; /* Data from DB */ + Eina_List *medias_elist; + bool b_multifile; /* Multiple file selection */ + bool b_mainview; /* First level view */ + doc_cluster *album; + bool b_editmode; + Evas_Object *genlist; +}; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __DOC_UGDATA_H__ */ + diff --git a/include/doc-ui-util.h b/include/doc-ui-util.h new file mode 100644 index 0000000..169c7df --- /dev/null +++ b/include/doc-ui-util.h @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_UI_UTIL_H_ +#define _DOC_UI_UTIL_H_ + +#include "attach-panel-document.h" + +#ifdef _cplusplus +extern "C" { +#endif + +#define DOC_NAVIFRAME_TITLE_RIGHT_BTN "title_right_btn" +#define DOC_NAVIFRAME_TITLE_LEFT_BTN "title_left_btn" + +#define _EDJ(o) elm_layout_edje_get(o) + +Evas_Object* doc_ui_create_naviframe(doc_ugdata *ugd, Evas_Object *parent); +Evas_Object *doc_ui_create_main_ly(Evas_Object *parent); +Evas_Object* doc_ui_load_edj(Evas_Object *parent, const char *file, const char *group); +int doc_ui_set_translate_str(Evas_Object *obj, const char *str); +int doc_ui_set_translate_part_str(Evas_Object *obj, const char *part, + const char *str); +int doc_ui_set_translatable_item(Elm_Object_Item *nf_it, const char *str); +int doc_ui_get_indicator_state(doc_ugdata *ugd); +int doc_ui_hide_indicator(doc_ugdata *ugd); + +#ifdef _cplusplus +} +#endif + +#endif //_DOC_UI_UTIL_H_ diff --git a/include/doc-util.h b/include/doc-util.h new file mode 100644 index 0000000..6fc0b28 --- /dev/null +++ b/include/doc-util.h @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 _DOC_UTIL_H_ +#define _DOC_UTIL_H_ + +#include "attach-panel-document.h" + +int doc_reg_db_update_noti(doc_ugdata* ugd); +int doc_dereg_db_update_noti(void); +Eina_Bool doc_update_view(doc_ugdata* ugd, int mode); +int doc_atoi(const char *number); +#endif //_DOC_UTIL_H_ + diff --git a/packaging/org.tizen.attach-panel-document.spec b/packaging/org.tizen.attach-panel-document.spec new file mode 100644 index 0000000..d6ac385 --- /dev/null +++ b/packaging/org.tizen.attach-panel-document.spec @@ -0,0 +1,98 @@ +Name: attach-panel-document +Summary: attach-panel-document UX +Version: 0.0.1 +Release: 1 +Group: Applications +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz + +%if "%{?tizen_profile_name}" == "wearable" || "%{?tizen_profile_name}" == "tv" +ExcludeArch: %{arm} %ix86 x86_64 +%endif + +BuildRequires: cmake +BuildRequires: gettext-tools +BuildRequires: edje-tools +BuildRequires: prelink +BuildRequires: libicu-devel +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(evas) +BuildRequires: pkgconfig(ui-gadget-1) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(capi-content-media-content) +BuildRequires: pkgconfig(appsvc) +BuildRequires: pkgconfig(efl-extension) +BuildRequires: pkgconfig(storage) +BuildRequires: pkgconfig(libtzplatform-config) + +%description +Description: attach-panel-document UG + +%prep +%setup -q + +%build + +%define _app_license_dir %{TZ_SYS_SHARE}/license + +%if 0%{?tizen_build_binary_release_type_eng} +export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE" +export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE" +export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE" +%endif + +cmake . \ + -DPREFIX=%{PREFIX} \ + -DPKGDIR=%{name} \ + -DIMGDIR=%{IMGDIR} \ + -DEDJDIR=%{EDJDIR} \ + -DPKGNAME=%{name} \ + -DBINDIR=%{BINDIR} \ + -DMANIFESTDIR=%{MANIFESTDIR} \ + -DEDJIMGDIR=%{EDJIMGDIR} \ + -DLIBDIR=%{LIBDIR} \ + -DICONDIR=%{ICONDIR} \ + -DLOCALEDIR=%{LOCALEDIR} \ + -DIMGICONDIR=%{IMGICONDIR} \ + -DPREFIX1=%{TZ_SYS_RO_UG} \ + -DRESDIR=%{RESDIR} + +%ifarch %{arm} +CXXFLAGS+=" -D_ARCH_ARM_ -mfpu=neon" +%endif + +cmake . -DCMAKE_INSTALL_PREFIX=%{TZ_SYS_RO_UG} \ + -DARCH=%{ARCH} \ + -DTZ_SYS_RO_PACKAGES=%{TZ_SYS_RO_PACKAGES} + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} + +%make_install + +mkdir -p %{buildroot}%{_app_license_dir} +cp LICENSE %{buildroot}%{_app_license_dir}/attach-panel-document + + +%post +mkdir -p /usr/ug/bin/ +ln -sf /usr/bin/ug-client %{TZ_SYS_RO_UG}/bin/attach-panel-document +%postun + +%files +%manifest attach-panel-document.manifest +%defattr(-,root,root,-) +%{TZ_SYS_RO_UG}/lib/libug-attach-panel-document.so* +%{TZ_SYS_RO_UG}/res/edje/ug-attach-panel-document/* +%{TZ_SYS_RO_UG}/res/images/ug-attach-panel-document/* +%{TZ_SYS_RO_UG}/res/locale/*/*/attach-panel-document.mo +%{TZ_SYS_RO_PACKAGES}/attach-panel-document.xml +%{TZ_SYS_RO_UG}/shared/res/org.tizen.attach-panel-document.png +%{TZ_SYS_SHARE}/license/attach-panel-document +%{TZ_SYS_RO_UG}/res/edje/icons/* + diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt new file mode 100644 index 0000000..923e409 --- /dev/null +++ b/res/CMakeLists.txt @@ -0,0 +1,23 @@ +SET(POFILES ar.po az.po bg.po bn.po ca.po cs.po da.po de.po el_GR.po en_PH.po en.po en_US.po es_ES.po es_US.po et.po eu.po fi.po fr_CA.po fr.po ga.po gl.po gu.po hi.po hr.po hu.po hy.po is.po it_IT.po ja_JP.po ka.po kk.po kn.po ko_KR.po lt.po lv.po mk.po ml.po mn_MN.po mr.po nb.po nl.po or.po pa.po pl.po pt_BR.po pt_PT.po ro.po ru_RU.po si.po sk.po sl.po sr.po sv.po ta.po te.po tr_TR.po uk.po uz.po zh_CN.po zh_HK.po zh_TW.po) + +SET(MSGFMT "/usr/bin/msgfmt") +SET(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/res/locale") + +FOREACH(pofile ${POFILES}) + SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile}) + MESSAGE("PO: ${pofile}") + GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE) + GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE) + SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo) + ADD_CUSTOM_COMMAND( + OUTPUT ${moFile} + COMMAND ${MSGFMT} -o ${moFile} ${absPofile} + DEPENDS ${absPofile} + ) + INSTALL(FILES ${moFile} DESTINATION ${LOCALEDIR}/${lang}/LC_MESSAGES RENAME ug-attach-panel-document.mo) + SET(moFiles ${moFiles} ${moFile}) +ENDFOREACH(pofile) + +MESSAGE(".mo files: ${moFiles}") +MESSAGE("Chandan: ${LOCALEDIR}") +ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles}) diff --git a/res/edje/attach-panel-document.edc b/res/edje/attach-panel-document.edc new file mode 100644 index 0000000..032ce4b --- /dev/null +++ b/res/edje/attach-panel-document.edc @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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. +* +*/ + +externals { + external: "elm"; + external: "feedback"; +} + +collections { + base_scale : 2.6; + plugins { + plugin { + name: "touch_sound_plugin"; + source: "feedback"; + param: "FEEDBACK_TYPE_SOUND FEEDBACK_PATTERN_TAP"; + } + } + + group { + name: "document/listview"; + parts { + part { + name: "background"; + type: "RECT"; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.0;} + rel2 { relative: 1.0 1.0; offset: -1 -1; } + color: 255 255 255 255; + } + } + part { + name: "contents"; + type: SWALLOW; + mouse_events: 1; + scale: 1; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.0; to: "background";} + rel2 { relative: 1.0 1.0; to: "background";} + } + } + } + } + + group { + name: "nocontent"; + parts { + part { + name: "background"; + type, RECT; + scale : 1; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.0; } + rel2 { relative:1.0 1.0; } + color: 255 255 255 255; + } + description { + state: "visible" 0.0; + rel1 { relative: 0.0 0.6; } + rel2 { relative:1.0 1.0; } + color: 0 255 0 255; + } + } + part { + name: "swallow"; + type: SWALLOW; + scale : 1; + description { + state: "default" 0.0; + rel1 { relative: 0.0 0.0; to: "background";} + rel2 { relative: 1.0 1.0; to: "background";} + } + } + } + } +} + diff --git a/res/edje/icons/doc_icon_amr.png b/res/edje/icons/doc_icon_amr.png Binary files differnew file mode 100755 index 0000000..ddb8831 --- /dev/null +++ b/res/edje/icons/doc_icon_amr.png diff --git a/res/edje/icons/doc_icon_email.png b/res/edje/icons/doc_icon_email.png Binary files differnew file mode 100755 index 0000000..c923d38 --- /dev/null +++ b/res/edje/icons/doc_icon_email.png diff --git a/res/edje/icons/doc_icon_etc.png b/res/edje/icons/doc_icon_etc.png Binary files differnew file mode 100755 index 0000000..088cf2d --- /dev/null +++ b/res/edje/icons/doc_icon_etc.png diff --git a/res/edje/icons/doc_icon_excel.png b/res/edje/icons/doc_icon_excel.png Binary files differnew file mode 100755 index 0000000..929d14f --- /dev/null +++ b/res/edje/icons/doc_icon_excel.png diff --git a/res/edje/icons/doc_icon_folder.png b/res/edje/icons/doc_icon_folder.png Binary files differnew file mode 100755 index 0000000..e71a8b7 --- /dev/null +++ b/res/edje/icons/doc_icon_folder.png diff --git a/res/edje/icons/doc_icon_html.png b/res/edje/icons/doc_icon_html.png Binary files differnew file mode 100755 index 0000000..d893a80 --- /dev/null +++ b/res/edje/icons/doc_icon_html.png diff --git a/res/edje/icons/doc_icon_hwp.png b/res/edje/icons/doc_icon_hwp.png Binary files differnew file mode 100755 index 0000000..a17f6e1 --- /dev/null +++ b/res/edje/icons/doc_icon_hwp.png diff --git a/res/edje/icons/doc_icon_images.png b/res/edje/icons/doc_icon_images.png Binary files differnew file mode 100755 index 0000000..d9133d6 --- /dev/null +++ b/res/edje/icons/doc_icon_images.png diff --git a/res/edje/icons/doc_icon_java.png b/res/edje/icons/doc_icon_java.png Binary files differnew file mode 100755 index 0000000..a083ee6 --- /dev/null +++ b/res/edje/icons/doc_icon_java.png diff --git a/res/edje/icons/doc_icon_music.png b/res/edje/icons/doc_icon_music.png Binary files differnew file mode 100755 index 0000000..d4988b0 --- /dev/null +++ b/res/edje/icons/doc_icon_music.png diff --git a/res/edje/icons/doc_icon_no_thumbnail.png b/res/edje/icons/doc_icon_no_thumbnail.png Binary files differnew file mode 100644 index 0000000..f16aaf2 --- /dev/null +++ b/res/edje/icons/doc_icon_no_thumbnail.png diff --git a/res/edje/icons/doc_icon_pdf.png b/res/edje/icons/doc_icon_pdf.png Binary files differnew file mode 100755 index 0000000..f937fcf --- /dev/null +++ b/res/edje/icons/doc_icon_pdf.png diff --git a/res/edje/icons/doc_icon_ppt.png b/res/edje/icons/doc_icon_ppt.png Binary files differnew file mode 100755 index 0000000..76e3dd4 --- /dev/null +++ b/res/edje/icons/doc_icon_ppt.png diff --git a/res/edje/icons/doc_icon_rss.png b/res/edje/icons/doc_icon_rss.png Binary files differnew file mode 100755 index 0000000..65740a3 --- /dev/null +++ b/res/edje/icons/doc_icon_rss.png diff --git a/res/edje/icons/doc_icon_sd_card.png b/res/edje/icons/doc_icon_sd_card.png Binary files differnew file mode 100755 index 0000000..f0803db --- /dev/null +++ b/res/edje/icons/doc_icon_sd_card.png diff --git a/res/edje/icons/doc_icon_snb.png b/res/edje/icons/doc_icon_snb.png Binary files differnew file mode 100755 index 0000000..5903558 --- /dev/null +++ b/res/edje/icons/doc_icon_snb.png diff --git a/res/edje/icons/doc_icon_svg.png b/res/edje/icons/doc_icon_svg.png Binary files differnew file mode 100755 index 0000000..12eb18d --- /dev/null +++ b/res/edje/icons/doc_icon_svg.png diff --git a/res/edje/icons/doc_icon_swf.png b/res/edje/icons/doc_icon_swf.png Binary files differnew file mode 100755 index 0000000..6bc8a79 --- /dev/null +++ b/res/edje/icons/doc_icon_swf.png diff --git a/res/edje/icons/doc_icon_task.png b/res/edje/icons/doc_icon_task.png Binary files differnew file mode 100755 index 0000000..8fa2938 --- /dev/null +++ b/res/edje/icons/doc_icon_task.png diff --git a/res/edje/icons/doc_icon_text.png b/res/edje/icons/doc_icon_text.png Binary files differnew file mode 100755 index 0000000..ef3e2c0 --- /dev/null +++ b/res/edje/icons/doc_icon_text.png diff --git a/res/edje/icons/doc_icon_tpk.png b/res/edje/icons/doc_icon_tpk.png Binary files differnew file mode 100755 index 0000000..0758614 --- /dev/null +++ b/res/edje/icons/doc_icon_tpk.png diff --git a/res/edje/icons/doc_icon_vText.png b/res/edje/icons/doc_icon_vText.png Binary files differnew file mode 100755 index 0000000..a0206f8 --- /dev/null +++ b/res/edje/icons/doc_icon_vText.png diff --git a/res/edje/icons/doc_icon_vcalender.png b/res/edje/icons/doc_icon_vcalender.png Binary files differnew file mode 100755 index 0000000..90271fd --- /dev/null +++ b/res/edje/icons/doc_icon_vcalender.png diff --git a/res/edje/icons/doc_icon_vcard.png b/res/edje/icons/doc_icon_vcard.png Binary files differnew file mode 100755 index 0000000..cf09ea0 --- /dev/null +++ b/res/edje/icons/doc_icon_vcard.png diff --git a/res/edje/icons/doc_icon_video.png b/res/edje/icons/doc_icon_video.png Binary files differnew file mode 100755 index 0000000..a2325fa --- /dev/null +++ b/res/edje/icons/doc_icon_video.png diff --git a/res/edje/icons/doc_icon_video_play.png b/res/edje/icons/doc_icon_video_play.png Binary files differnew file mode 100755 index 0000000..f9ecb0b --- /dev/null +++ b/res/edje/icons/doc_icon_video_play.png diff --git a/res/edje/icons/doc_icon_word.png b/res/edje/icons/doc_icon_word.png Binary files differnew file mode 100755 index 0000000..4585c4e --- /dev/null +++ b/res/edje/icons/doc_icon_word.png diff --git a/res/edje/icons/doc_icon_zip.png b/res/edje/icons/doc_icon_zip.png Binary files differnew file mode 100755 index 0000000..227f5a1 --- /dev/null +++ b/res/edje/icons/doc_icon_zip.png diff --git a/res/edje/sounds/Tizen_Touch.wav b/res/edje/sounds/Tizen_Touch.wav Binary files differnew file mode 100755 index 0000000..ef6e6ae --- /dev/null +++ b/res/edje/sounds/Tizen_Touch.wav diff --git a/res/edje/sounds/button-pressed.wav b/res/edje/sounds/button-pressed.wav Binary files differnew file mode 100755 index 0000000..99ba74d --- /dev/null +++ b/res/edje/sounds/button-pressed.wav diff --git a/res/po/CMakeLists.txt b/res/po/CMakeLists.txt new file mode 100644 index 0000000..589bf8a --- /dev/null +++ b/res/po/CMakeLists.txt @@ -0,0 +1,22 @@ +SET(POFILES ar.po az.po bg.po bn.po ca.po cs.po da.po de.po el_GR.po en_PH.po en.po en_US.po es_ES.po es_US.po et.po eu.po fi.po fr_CA.po fr.po ga.po gl.po gu.po hi.po hr.po hu.po hy.po is.po it_IT.po ja_JP.po ka.po kk.po kn.po ko_KR.po lt.po lv.po mk.po ml.po mn_MN.po mr.po nb.po nl.po or.po pa.po pl.po pt_BR.po pt_PT.po ro.po ru_RU.po si.po sk.po sl.po sr.po sv.po ta.po te.po tr_TR.po uk.po uz.po zh_CN.po zh_HK.po zh_TW.po) + +SET(MSGFMT "/usr/bin/msgfmt") +SET(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/res/locale") + +FOREACH(pofile ${POFILES}) + SET(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${pofile}) + MESSAGE("PO: ${pofile}") + GET_FILENAME_COMPONENT(absPofile ${pofile} ABSOLUTE) + GET_FILENAME_COMPONENT(lang ${absPofile} NAME_WE) + SET(moFile ${CMAKE_CURRENT_BINARY_DIR}/${lang}.mo) + ADD_CUSTOM_COMMAND( + OUTPUT ${moFile} + COMMAND ${MSGFMT} -o ${moFile} ${absPofile} + DEPENDS ${absPofile} + ) + INSTALL(FILES ${moFile} DESTINATION ${LOCALEDIR}/${lang}/LC_MESSAGES RENAME attach-panel-document.mo) + SET(moFiles ${moFiles} ${moFile}) +ENDFOREACH(pofile) + +MESSAGE(".mo files: ${moFiles}") +ADD_CUSTOM_TARGET(po ALL DEPENDS ${moFiles}) diff --git a/res/po/POTFILES.in b/res/po/POTFILES.in new file mode 100644 index 0000000..e8ad1de --- /dev/null +++ b/res/po/POTFILES.in @@ -0,0 +1,28 @@ +# List of source files containing translatable strings. +../src/gallery.c +../src/features/gl-albums.c +../src/features/gl-gridview.c +../src/features/gl-listview.c +../src/features/gl-places-footsteps.c +../src/features/gl-places.c +../src/features/gl-tags.c +../src/features/gl-webalbum.c +../src/widget/gl-button.c +../src/widget/gl-controlbar.c +../src/widget/gl-nocontents.c +../src/widget/gl-popup.c +../src/widget/gl-progressbar.c +../src/util/gl-2d-util.c +../src/util/gl-allshare-util.c +../src/util/gl-db-handler.c +../src/util/gl-debug.c +../src/util/gl-ext-exec.c +../src/util/gl-ext-ug-load.c +../src/util/gl-net-if.c +../src/util/gl-ptp-util.c +../src/util/gl-share-login.c +../src/util/gl-sns-util.c +../src/util/gl-ta.c +../src/util/gl-thread-util.c +../src/util/gl-ui-util.c +../src/util/gl-util.c diff --git a/res/po/ar.po b/res/po/ar.po new file mode 100644 index 0000000..64ef330 --- /dev/null +++ b/res/po/ar.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "لا توجد عناصر" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "تم تحديد %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "المستندات" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "تم" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "إلغاء" diff --git a/res/po/az.po b/res/po/az.po new file mode 100644 index 0000000..43851b7 --- /dev/null +++ b/res/po/az.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Elementlər yoxdur" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d seçilmişdir" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Sənədlər" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "HAZIR" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "LƏĞV ET" diff --git a/res/po/bg.po b/res/po/bg.po new file mode 100644 index 0000000..05bb436 --- /dev/null +++ b/res/po/bg.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Няма елементи" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d избрани" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Документи" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "ГОТОВО" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ОТКАЗ" diff --git a/res/po/bn.po b/res/po/bn.po new file mode 100644 index 0000000..4442352 --- /dev/null +++ b/res/po/bn.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "কোনও আইটেম নেই" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%dটি নির্বাচিত" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "নথিগুলি" diff --git a/res/po/ca.po b/res/po/ca.po new file mode 100644 index 0000000..6415749 --- /dev/null +++ b/res/po/ca.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "No hi ha elements" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d seleccionat" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documents" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "REALITZAT" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CANCEL·LAR" diff --git a/res/po/cs.po b/res/po/cs.po new file mode 100644 index 0000000..c640654 --- /dev/null +++ b/res/po/cs.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Žádné položky" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "Vybráno: %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumenty" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "HOTOVO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ZRUŠIT" diff --git a/res/po/da.po b/res/po/da.po new file mode 100644 index 0000000..d978a06 --- /dev/null +++ b/res/po/da.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Ingen elementer" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d valgt" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumenter" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "UDFØRT" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ANNULLER" diff --git a/res/po/de.po b/res/po/de.po new file mode 100644 index 0000000..a9a534f --- /dev/null +++ b/res/po/de.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Keine Elemente" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d ausgewählt" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumente" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "FERTIG" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ABBRECHEN" diff --git a/res/po/el_GR.po b/res/po/el_GR.po new file mode 100644 index 0000000..1f07319 --- /dev/null +++ b/res/po/el_GR.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Κανένα στοιχείο" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d επιλέχθηκαν" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Έγγραφα" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "ΤΕΛΟΣ" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ΑΚΥΡΟ" diff --git a/res/po/en.po b/res/po/en.po new file mode 100644 index 0000000..f4b4967 --- /dev/null +++ b/res/po/en.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "No items" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d selected" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documents" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "DONE" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CANCEL" diff --git a/res/po/en_PH.po b/res/po/en_PH.po new file mode 100644 index 0000000..f4b4967 --- /dev/null +++ b/res/po/en_PH.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "No items" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d selected" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documents" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "DONE" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CANCEL" diff --git a/res/po/en_US.po b/res/po/en_US.po new file mode 100644 index 0000000..f4b4967 --- /dev/null +++ b/res/po/en_US.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "No items" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d selected" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documents" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "DONE" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CANCEL" diff --git a/res/po/es_ES.po b/res/po/es_ES.po new file mode 100644 index 0000000..758d13a --- /dev/null +++ b/res/po/es_ES.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Ningún elemento" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d seleccionados" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documentos" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "HECHO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CANCELAR" diff --git a/res/po/es_US.po b/res/po/es_US.po new file mode 100644 index 0000000..df893e1 --- /dev/null +++ b/res/po/es_US.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Ningún elemento" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d seleccionado(s)" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documentos" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "REALIZADO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CANCELAR" diff --git a/res/po/et.po b/res/po/et.po new file mode 100644 index 0000000..c7b2a49 --- /dev/null +++ b/res/po/et.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Üksusi ei ole" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d valitud" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumendid" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "VALMIS" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "TÜHISTA" diff --git a/res/po/eu.po b/res/po/eu.po new file mode 100644 index 0000000..ad79347 --- /dev/null +++ b/res/po/eu.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Elementurik ez" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d aukeratuta" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumentuak" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "EGINA" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "UTZI" diff --git a/res/po/fi.po b/res/po/fi.po new file mode 100644 index 0000000..6361631 --- /dev/null +++ b/res/po/fi.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Ei kohteita" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d valittu" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Asiakirjat" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "VALMIS" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "PERUUTA" diff --git a/res/po/fr.po b/res/po/fr.po new file mode 100644 index 0000000..92d74f8 --- /dev/null +++ b/res/po/fr.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Aucun élément" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d sélectionné(es)" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documents" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "OK" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ANNULER" diff --git a/res/po/fr_CA.po b/res/po/fr_CA.po new file mode 100644 index 0000000..494aa59 --- /dev/null +++ b/res/po/fr_CA.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Aucun élément" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d sélect." + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documents" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "OK" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ANNULER" diff --git a/res/po/ga.po b/res/po/ga.po new file mode 100644 index 0000000..44e3146 --- /dev/null +++ b/res/po/ga.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Níl míreanna ann" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d roghnaithe" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Doiciméid" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "DÉANTA" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CUIR AR CEAL" diff --git a/res/po/gl.po b/res/po/gl.po new file mode 100644 index 0000000..d954dc4 --- /dev/null +++ b/res/po/gl.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Sen elementos" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d seleccionados" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documentos" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "FEITO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CANCELAR" diff --git a/res/po/gu.po b/res/po/gu.po new file mode 100644 index 0000000..7ae1f8d --- /dev/null +++ b/res/po/gu.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "કોઈ વસ્તુઓ નથી" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d પસંદ કર્યા" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "દસ્તાવેજો" diff --git a/res/po/hi.po b/res/po/hi.po new file mode 100644 index 0000000..56eb3a9 --- /dev/null +++ b/res/po/hi.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "कोई मदें नहीं" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d चयनित" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "दस्तावेज" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "पूर्ण" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "रद्द करें" diff --git a/res/po/hr.po b/res/po/hr.po new file mode 100644 index 0000000..9e2b097 --- /dev/null +++ b/res/po/hr.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Nema stavki" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d odabrano" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumenti" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "GOTOVO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ODUSTANI" diff --git a/res/po/hu.po b/res/po/hu.po new file mode 100644 index 0000000..d1af71f --- /dev/null +++ b/res/po/hu.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Nincs tétel" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d kiválasztva" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumentumok" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "KÉSZ" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "MÉGSE" diff --git a/res/po/hy.po b/res/po/hy.po new file mode 100644 index 0000000..300bdda --- /dev/null +++ b/res/po/hy.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Տարրեր չկան" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d ընտրվել է" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Փաստաթղթեր" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "ԱՐՎԱԾ" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ԴԱԴԱՐԵՑՆԵԼ" diff --git a/res/po/is.po b/res/po/is.po new file mode 100644 index 0000000..a5851b6 --- /dev/null +++ b/res/po/is.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Engin atriði" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d valið" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Skjöl" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "LOKIÐ" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "HÆTTA VIÐ" diff --git a/res/po/it_IT.po b/res/po/it_IT.po new file mode 100644 index 0000000..9d54c5b --- /dev/null +++ b/res/po/it_IT.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Nessun elemento" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d selezionato/i" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documenti" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "FATTO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ANNULLA" diff --git a/res/po/ja_JP.po b/res/po/ja_JP.po new file mode 100644 index 0000000..8b5efb9 --- /dev/null +++ b/res/po/ja_JP.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "アイテムがありません" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d件選択" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "ドキュメント" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "完了" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "キャンセル" diff --git a/res/po/ka.po b/res/po/ka.po new file mode 100644 index 0000000..cc1ac69 --- /dev/null +++ b/res/po/ka.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "ელემენტები არ არის" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d არჩეულია" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "დოკუმენტები" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "მზადაა" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "გაუქმება" diff --git a/res/po/kk.po b/res/po/kk.po new file mode 100644 index 0000000..887ee7b --- /dev/null +++ b/res/po/kk.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Баптар жоқ" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d таңдалды" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Құжаттар" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "ДАЙЫН" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "БАС ТАРТУ" diff --git a/res/po/kn.po b/res/po/kn.po new file mode 100644 index 0000000..48e2980 --- /dev/null +++ b/res/po/kn.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "ಅಂಶಗಳಿಲ್ಲ" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d ಆರಿಸಿದೆ" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "ಡಾಕ್ಯುಮೆಂಟ್ಗಳು" diff --git a/res/po/ko_KR.po b/res/po/ko_KR.po new file mode 100644 index 0000000..95dfb83 --- /dev/null +++ b/res/po/ko_KR.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "항목이 없습니다" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d개 선택" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "문서" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "완료" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "취소" diff --git a/res/po/lt.po b/res/po/lt.po new file mode 100644 index 0000000..edcd781 --- /dev/null +++ b/res/po/lt.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Elementų nėra" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "Pasirinkta: %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumentai" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "ATLIKTA" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ATŠAUKTI" diff --git a/res/po/lv.po b/res/po/lv.po new file mode 100644 index 0000000..c835f84 --- /dev/null +++ b/res/po/lv.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Nav vienumu" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "Izvēlēti: %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumenti" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "GATAVS" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ATCELT" diff --git a/res/po/mk.po b/res/po/mk.po new file mode 100644 index 0000000..a2ca488 --- /dev/null +++ b/res/po/mk.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Нема записи" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "Избрани се %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Документи" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "ГОТОВО" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ОТКАЖИ" diff --git a/res/po/ml.po b/res/po/ml.po new file mode 100644 index 0000000..02f779c --- /dev/null +++ b/res/po/ml.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "ഇനങ്ങള് ഒന്നുമില്ല" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d തിരഞ്ഞെടുത്തു" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "പ്രമാണങ്ങള്" diff --git a/res/po/mn_MN.po b/res/po/mn_MN.po new file mode 100644 index 0000000..7a2896a --- /dev/null +++ b/res/po/mn_MN.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Зүйл алга" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d сонгосон" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Бичиг баримт" diff --git a/res/po/mr.po b/res/po/mr.po new file mode 100644 index 0000000..021c5b5 --- /dev/null +++ b/res/po/mr.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "बाबी नाही" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d निवडले" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "दस्तऐवज" diff --git a/res/po/nb.po b/res/po/nb.po new file mode 100644 index 0000000..bfa0fb3 --- /dev/null +++ b/res/po/nb.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Ingen elementer" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d valgt" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumenter" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "FULLFØRT" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "AVBRYT" diff --git a/res/po/nl.po b/res/po/nl.po new file mode 100644 index 0000000..55297ec --- /dev/null +++ b/res/po/nl.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Geen items" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d geselecteerd" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documenten" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "GEREED" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ANNULEREN" diff --git a/res/po/or.po b/res/po/or.po new file mode 100644 index 0000000..255359d --- /dev/null +++ b/res/po/or.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "କୌଣସି ଆଇଟମ୍ ନାହିଁ" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d ଚୟନ ହୋଇଛି" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "ଡକ୍ୟୁମେଣ୍ଟଗୁଡିକ" diff --git a/res/po/pa.po b/res/po/pa.po new file mode 100644 index 0000000..d17d588 --- /dev/null +++ b/res/po/pa.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "ਕੋਈ ਆਈਟਮਸ ਨਹੀਂ" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d ਚੁਣੇ" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "ਦਸਤਾਵੇਜ਼" diff --git a/res/po/pl.po b/res/po/pl.po new file mode 100644 index 0000000..0eb7bf9 --- /dev/null +++ b/res/po/pl.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Brak elementów" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "Wybrano %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumenty" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "GOTOWE" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ANULUJ" diff --git a/res/po/pt_BR.po b/res/po/pt_BR.po new file mode 100644 index 0000000..88f945e --- /dev/null +++ b/res/po/pt_BR.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Sem itens" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d selecionado(s)" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documentos" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "CONCLUÍDO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CANCELAR" diff --git a/res/po/pt_PT.po b/res/po/pt_PT.po new file mode 100644 index 0000000..0a5730e --- /dev/null +++ b/res/po/pt_PT.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Sem itens" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d seleccionado(s)" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documentos" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "CONCLUÍDO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "CANCELAR" diff --git a/res/po/ro.po b/res/po/ro.po new file mode 100644 index 0000000..aec0474 --- /dev/null +++ b/res/po/ro.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Niciun element" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d selectate" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Documente" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "EFECTUAT" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ANULARE" diff --git a/res/po/ru_RU.po b/res/po/ru_RU.po new file mode 100644 index 0000000..4dd235c --- /dev/null +++ b/res/po/ru_RU.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Нет элементов" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "Выбрано: %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Документы" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "ГОТОВО" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ОТМЕНА" diff --git a/res/po/si.po b/res/po/si.po new file mode 100644 index 0000000..254f82a --- /dev/null +++ b/res/po/si.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "අයිතම නැත" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d ක් තෝරා ඇත" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "ලේඛන" diff --git a/res/po/sk.po b/res/po/sk.po new file mode 100644 index 0000000..16d2aa4 --- /dev/null +++ b/res/po/sk.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Žiadne položky" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "Vybraté: %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumenty" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "HOTOVO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "ZRUŠIŤ" diff --git a/res/po/sl.po b/res/po/sl.po new file mode 100644 index 0000000..c93ba4a --- /dev/null +++ b/res/po/sl.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Ni predmetov" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d izbranih" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumenti" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "KONČANO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "PREKLIČI" diff --git a/res/po/sr.po b/res/po/sr.po new file mode 100644 index 0000000..52b9f48 --- /dev/null +++ b/res/po/sr.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Nema stavki" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "Izabrano: %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokumenti" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "GOTOVO" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "OTKAŽI" diff --git a/res/po/sv.po b/res/po/sv.po new file mode 100644 index 0000000..ccb6dad --- /dev/null +++ b/res/po/sv.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Inga objekt" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d valda" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Dokument" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "KLAR" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "AVBRYT" diff --git a/res/po/ta.po b/res/po/ta.po new file mode 100644 index 0000000..07496cc --- /dev/null +++ b/res/po/ta.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "உருப்படிகள் இல்லை" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d தேர்வாகியுள்ளன" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "ஆவணங்கள்" diff --git a/res/po/te.po b/res/po/te.po new file mode 100644 index 0000000..6ff00fb --- /dev/null +++ b/res/po/te.po @@ -0,0 +1,8 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "ఐటమ్లు లేవు" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d ఎన్నుకోబడింది" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "పత్రాలు" diff --git a/res/po/tr_TR.po b/res/po/tr_TR.po new file mode 100644 index 0000000..7106b35 --- /dev/null +++ b/res/po/tr_TR.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Öğe yok" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d seçildi" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Belgeler" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "BİTTİ" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "İPTAL" diff --git a/res/po/uk.po b/res/po/uk.po new file mode 100644 index 0000000..878ef4f --- /dev/null +++ b/res/po/uk.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Немає елементів" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "Вибрано %d" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Документи" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "ГОТОВО" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "СКАСУВАТИ" diff --git a/res/po/uz.po b/res/po/uz.po new file mode 100644 index 0000000..166acc6 --- /dev/null +++ b/res/po/uz.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "Elementlar yo‘q" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d tanlangan" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "Hujjatlar" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "BAJARILDI" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "BEKOR QILISH" diff --git a/res/po/zh_CN.po b/res/po/zh_CN.po new file mode 100644 index 0000000..856cedf --- /dev/null +++ b/res/po/zh_CN.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "没有内容" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d 已选择" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "文档" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "完成" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "取消" diff --git a/res/po/zh_HK.po b/res/po/zh_HK.po new file mode 100644 index 0000000..b473fb7 --- /dev/null +++ b/res/po/zh_HK.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "無項目" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d 已選擇" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "文件" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "完成" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "取消" diff --git a/res/po/zh_TW.po b/res/po/zh_TW.po new file mode 100644 index 0000000..08b2a86 --- /dev/null +++ b/res/po/zh_TW.po @@ -0,0 +1,14 @@ +msgid "IDS_COM_BODY_NO_ITEMS" +msgstr "無項目" + +msgid "IDS_MEDIABR_HEADER_PD_SELECTED" +msgstr "%d已選擇" + +msgid "IDS_GALLERY_OPT_DOCUMENTS" +msgstr "文件" + +msgid "IDS_TPLATFORM_ACBUTTON_DONE_ABB" +msgstr "完成" + +msgid "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB" +msgstr "取消" diff --git a/shared/res/org.tizen.attach-panel-document.png b/shared/res/org.tizen.attach-panel-document.png Binary files differnew file mode 100644 index 0000000..9765b1b --- /dev/null +++ b/shared/res/org.tizen.attach-panel-document.png diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100755 index 0000000..7465c08 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,63 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(ug-attach-panel-document C) + +#SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(LIBDIR "${PREFIX1}/lib") + +SET(VERSION 0.0.1) + +SET(SRCS + attach-panel-document.c + doc-data.c + doc-data-util.c + doc-list.c + doc-main-view.c + doc-util.c + doc-data-type.c + doc-db-update.c + doc-local-data.c + doc-ui-util.c +) + + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/) + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED + elementary + evas + dlog + glib-2.0 + capi-appfw-application + capi-content-media-content + ui-gadget-1 + efl-extension + notification + appsvc + storage + libtzplatform-config +) + +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -fvisibility=hidden -Wall") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}") + +ADD_DEFINITIONS("-D_USE_DLOG_") +ADD_DEFINITIONS("-D_USE_SECURE_LOG_") +ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"") +ADD_DEFINITIONS("-DPACKAGE=\"${PROJECT_NAME}\"") +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DFEATURE_SIZE_CHECK") + +#Set Library +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0.0.1) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-ldl") + +# install binary +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR}) +#INSTALL(DIRECTORY ${ICONDIR} DESTINATION ${PREFIX1}/res/images/ug-attach-panel-document) diff --git a/src/attach-panel-document.c b/src/attach-panel-document.c new file mode 100644 index 0000000..f9da8df --- /dev/null +++ b/src/attach-panel-document.c @@ -0,0 +1,760 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 UG_MODULE_API +#define UG_MODULE_API __attribute__ ((visibility("default"))) +#endif + +#include <Evas.h> +#include <app.h> +#include "attach-panel-document.h" +#include "doc-list.h" +#include "doc-data.h" +#include "doc-ui-util.h" +#include "doc-util.h" +#include "doc-db-update.h" +#include "doc-main-view.h" + +#define DOC_BG_COLOR_DEFAULT 0 +#define DOC_BG_COLOR_A 255 + +static int _doc_create_main_view(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + DOC_CHECK_VAL(ugd->naviframe, -1); + + doc_main_view_create(ugd); + + return 0; +} + +static Evas_Object *_doc_create_bg(Evas_Object *parent) +{ + doc_dbg(""); + DOC_CHECK_NULL(parent); + Evas_Object *bg = NULL; + + /* Show special color of background */ + bg = evas_object_rectangle_add(evas_object_evas_get(parent)); + evas_object_color_set(bg, DOC_BG_COLOR_DEFAULT, DOC_BG_COLOR_DEFAULT, + DOC_BG_COLOR_DEFAULT, DOC_BG_COLOR_A); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(bg); + + return bg; +} + +static void _doc_win_rot_changed_cb(void *data, Evas_Object *obj, + void *event) +{ + DOC_CHECK(data); + DOC_CHECK(obj); + doc_ugdata *ugd = (doc_ugdata *)data; + + /* changed_ang value is 0 90 180 270 */ + int changed_ang = elm_win_rotation_get(obj); + /* Send event to UG */ + enum ug_event evt = UG_EVENT_NONE; + switch (changed_ang) { + case APP_DEVICE_ORIENTATION_0: + evt = DOC_ROTATE_PORTRAIT; + break; + case APP_DEVICE_ORIENTATION_90: + evt = DOC_ROTATE_LANDSCAPE_UPSIDEDOWN; + break; + case APP_DEVICE_ORIENTATION_180: + evt = DOC_ROTATE_PORTRAIT_UPSIDEDOWN; + break; + case APP_DEVICE_ORIENTATION_270: + evt = DOC_ROTATE_LANDSCAPE; + break; + } + + doc_dbg("New angle: %d, old angle: %d", evt, ugd->rotate_mode); + if (evt == ugd->rotate_mode) { + return; + } else { + ugd->rotate_mode = evt; + } + + /* Update rotate mode and view */ + int len = eina_list_count(ugd->rotate_cbs); + doc_rotate_view_cb rotate_cb = eina_list_nth(ugd->rotate_cbs, len - 1);//[ToDo] Really needed ?? + if (rotate_cb) { + doc_dbg("To rotate view"); + rotate_cb(ugd); + } else { + doc_dbgE("None callbacks exists[%d]!", len); + } +} + +static int _doc_view_initialize(doc_ugdata *ugd) +{ + doc_dbg(""); + DOC_CHECK_VAL(ugd, -1); + + /* Base Layout */ + ugd->ly_main = doc_ui_create_main_ly(ugd->win); + DOC_CHECK_VAL(ugd->ly_main, -1); + + /* Background */ + ugd->bg = _doc_create_bg(ugd->ly_main); + DOC_CHECK_VAL(ugd->bg, -1); + + /* Pack bg to swallow */ + elm_object_part_content_set(ugd->ly_main, "elm.swallow.bg", ugd->bg); + + /* Navigation Bar */ + ugd->naviframe = doc_ui_create_naviframe(ugd, ugd->ly_main); + DOC_CHECK_VAL(ugd->naviframe, -1); + + doc_dbgE("base view is pushed in the naviframe instead of content set"); + + + + ugd->nf_it = elm_naviframe_item_push(ugd->naviframe, "first naviframe bg", NULL, NULL, ugd->bg, NULL); + + + + if (ugd->nf_it != NULL) { + doc_dbgE("base view is push successfully in the nf"); + } else { + doc_dbgE("base view failed to push in nf "); + } + + + /* List view and its layout */ + if (_doc_create_main_view(ugd) != 0) { + doc_dbgE("Creating list view and layout failed!"); + return -1; + } + + return 0; +} + +static int _doc_create_view(doc_ugdata *ugd) +{ + doc_dbg(""); + DOC_CHECK_VAL(ugd, -1); + /* Add new theme */ + ugd->th = elm_theme_new(); + DOC_CHECK_VAL(ugd->th, -1); + elm_theme_ref_set(ugd->th, NULL); + elm_theme_extension_add(ugd->th, DOC_EDJ_FILE); //[ToDo] Really needed ?? + + if (_doc_view_initialize(ugd) != 0) { + doc_dbgE("Initialize view failed!"); + return -1; + } else { + doc_dbgE("view is intialized !!!!!!!!!!!!!"); + } + + /* Register MMC changed callback */ + if (doc_reg_db_update_noti(ugd) != 0) { + doc_dbgE("reg_db_update_noti failed!"); + return -1; + } else { + doc_dbgE("reg_db is updated storage state change"); + } + + return 0; +} + +static int _doc_close_view(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + + /************* Remove Callbacks **************/ + DOC_IF_DEL_TIMER(ugd->del_timer) + /* Remove win rotation callback */ + evas_object_smart_callback_del(ugd->win, "wm,rotation,changed", + _doc_win_rot_changed_cb); + doc_dereg_db_update_noti(); + + /************* Destroy UI objects **************/ + /* Destroy UG called by me */ + if (ugd->ug_called_by_me) { + doc_dbg("Destroy ug_called_by_me"); + ug_destroy(ugd->ug_called_by_me); + ugd->ug_called_by_me = NULL; + } + DOC_IF_DEL_OBJ(ugd->popup) + DOC_IF_DEL_OBJ(ugd->ly_main) + if (ugd->th) { + elm_theme_extension_del(ugd->th, DOC_EDJ_FILE); + elm_theme_free(ugd->th); + ugd->th = NULL; + } +#ifdef _USE_HIDE_INDICATOR + _ge_ui_reset_indicator(ugd); +#endif + + /************* Free data **************/ + if (ugd->service) { + app_control_destroy(ugd->service); + ugd->service = NULL; + } + DOC_FREEIF(ugd->ug_path); + /*Finalize db update callback*/ + doc_db_update_finalize(ugd); + /* Disconnet with libmedia-info */ + doc_data_finalize(ugd); + return 0; +} + +static int _doc_parse_param_file(doc_ugdata *ugd, app_control_h service) +{ + DOC_CHECK_VAL(ugd, -1); + DOC_CHECK_VAL(service, -1); + char *file_type = NULL; + char *mime = NULL; + + app_control_get_mime(service, &mime); + if (mime) { + if (!g_strcmp0(mime, DOC_MIME_IMAGE_ALL)) { + ugd->file_type_mode = DOC_FILE_T_IMAGE; + } else if (!g_strcmp0(mime, DOC_MIME_VIDEO_ALL)) { + ugd->file_type_mode = DOC_FILE_T_VIDEO; + } else { + ugd->file_type_mode = DOC_FILE_T_ALL; + } + + return 0; + } + + /* file-type */ + app_control_get_extra_data(service, DOC_BUNDLE_FILE_TYPE, &file_type); + if (file_type == NULL) { + doc_dbgW("file_type is empty!"); + goto DOC_DEFAULT_FILE_TYPE; + } + doc_dbg("file_type: %s", file_type); + + if (!strcasecmp(file_type, DOC_FILE_TYPE_IMAGE)) { + ugd->file_type_mode = DOC_FILE_T_IMAGE; + DOC_FREE(file_type); + return 0; + } else if (!strcasecmp(file_type, DOC_FILE_TYPE_VIDEO)) { + ugd->file_type_mode = DOC_FILE_T_VIDEO; + DOC_FREE(file_type); + return 0; + } + + +DOC_DEFAULT_FILE_TYPE: + + doc_dbg("file type is default, set default type(ALL)."); + ugd->file_type_mode = DOC_FILE_T_ALL; + return 0; +} + +/* analysis parameters */ +static int _doc_parse_param(doc_ugdata *ugd, app_control_h service) +{ + DOC_CHECK_VAL(ugd, -1); + DOC_CHECK_VAL(service, -1); + char *launch_type = NULL; + char *select_mode = NULL; + char *operation = NULL; + + app_control_get_operation(service, &operation); + doc_sdbg("operation [%s]", operation); + +#ifdef FEATURE_SIZE_CHECK + char *total_size = NULL; + int ret = app_control_get_extra_data(service, "http://tizen.org/appcontrol/data/total_size", &(total_size)); + if (ret != APP_CONTROL_ERROR_NONE) { + if(total_size) { + ugd->limitsize = atol(total_size); + } else { + ugd->limitsize = -1; + } + } else { + ugd->limitsize = -1; + } +#endif + + app_control_get_extra_data(service, APP_CONTROL_DATA_SELECTION_MODE, + &select_mode); + if (select_mode) { + if (!strcasecmp(select_mode, DOC_BUNDLE_SELECTION_MODE_SINGLE)) { + launch_type = strdup(DOC_LAUNCH_SELECT_ONE); + } else if (!strcasecmp(select_mode, DOC_BUNDLE_SELECTION_MODE_MULTI)) { + launch_type = strdup(DOC_LAUNCH_SELECT_MULTIPLE); + } + DOC_FREE(select_mode); + } + if (launch_type == NULL) { + app_control_get_extra_data(service, DOC_BUNDLE_LAUNCH_TYPE, + &launch_type); + } + if (launch_type == NULL) { + if (operation && + !strcasecmp(operation, APP_CONTROL_OPERATION_PICK)) { + launch_type = strdup(DOC_LAUNCH_SELECT_ONE); + doc_dbg("Set launch-type to default"); + } else { + DOC_FREEIF(operation); + doc_dbg("launch-type = NULL, galery ug exit"); + return -1; + } + } + if (launch_type) { + doc_dbg("launch-type [%s]", launch_type); + if (!strcasecmp(launch_type, DOC_LAUNCH_SELECT_ONE)) { + ugd->file_select_mode = DOC_FILE_SELECT_T_ONE; + } else if (!strcasecmp(launch_type, DOC_LAUNCH_SELECT_MULTIPLE)) { + ugd->file_select_mode = DOC_FILE_SELECT_T_MULTIPLE; + ugd->b_multifile = true; + } + _doc_parse_param_file(ugd, service); + } else { + //using default value + doc_dbg("Set launch-type to default"); + ugd->b_multifile = false; + } + + ugd->max_count = -1; + + char *max_cnt = NULL; + app_control_get_extra_data(service, APP_CONTROL_DATA_TOTAL_COUNT, &max_cnt); + if (max_cnt) { + ugd->max_count = doc_atoi(max_cnt); + DOC_FREE(max_cnt); + } + doc_sdbg("max count: %d", ugd->max_count); + + if (!ugd->overlap_mode) { + char *indicator = NULL; + app_control_get_extra_data(service, "indicator-state", &indicator); + if (indicator) { + doc_dbg("indicator: %s", indicator); + if (!strcasecmp(indicator, "hide")) { + ugd->b_hide_indicator = true; + } + DOC_FREE(indicator); + } + } + + DOC_FREEIF(operation); + DOC_FREEIF(launch_type); + return 0; +} + +static int _doc_get_rotate_value(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + DOC_CHECK_VAL(ugd->win, -1); + /* changed_ang value is 0 90 180 270 */ + int changed_ang = elm_win_rotation_get(ugd->win); + /* Send event to UG */ + switch (changed_ang) { + case APP_DEVICE_ORIENTATION_0: + ugd->rotate_mode = DOC_ROTATE_PORTRAIT; + break; + case APP_DEVICE_ORIENTATION_90: + ugd->rotate_mode = DOC_ROTATE_LANDSCAPE_UPSIDEDOWN; + break; + case APP_DEVICE_ORIENTATION_180: + ugd->rotate_mode = DOC_ROTATE_PORTRAIT_UPSIDEDOWN; + break; + case APP_DEVICE_ORIENTATION_270: + ugd->rotate_mode = DOC_ROTATE_LANDSCAPE; + break; + } + return ugd->rotate_mode; +} + +/** +* @brief +* +* @param ug +* @param mode +* @param data +* @param priv +* +* @return +*/ +static void * _doc_create(ui_gadget_h ug, enum ug_mode mode, app_control_h service, void *priv) +{ + doc_dbg("Enter..."); + doc_ugdata *ugd = NULL; + DOC_CHECK_NULL(priv); + DOC_CHECK_NULL(service); + DOC_CHECK_NULL(ug); + doc_dbgW("attach-panel-document begins..."); + + ugd = (doc_ugdata *)priv; + ugd->ug = ug; + ugd->attach_panel_display_mode = ATTACH_PANEL_NONE; + + /* Get window */ + ugd->win = (Evas_Object *)ug_get_window(); + DOC_CHECK_NULL(ugd->win); + + /* Get conformant */ + ugd->conform = ug_get_conformant(); + DOC_CHECK_NULL(ugd->conform); + + /* Get caller layout */ + ugd->ly_parent = (Evas_Object *)ug_get_parent_layout(ug); + DOC_CHECK_NULL(ugd->ly_parent); + + /* Bind text domain for internalization */ + bindtextdomain("attach-panel-document", "/usr/ug/res/locale"); + + /* Reset inited flag, it would be set as TRUE if list view created */ + doc_ui_get_indicator_state(ugd); +#ifdef _USE_HIDE_INDICATOR + doc_ui_hide_indicator(ugd); +#endif + /* Add window rotation callback to rotate view as fast as possible */ + evas_object_smart_callback_add(ugd->win, "wm,rotation,changed", + _doc_win_rot_changed_cb, (void *)ugd); + _doc_get_rotate_value(ugd); + + app_control_clone(&(ugd->service), service); + /* Connect DB first */ + if (doc_data_init(ugd) != 0) { + doc_dbgE("doc_data_init failed!"); + } + + /*Register db udpate callback*/ + doc_db_update_reg_cb(ugd); + + /* Parse parameters passed from parent */ + if (_doc_parse_param(ugd, service) != 0) { + doc_dbgE("Failed to parse parameters!"); + ug_send_result_full(ugd->ug, ugd->service, APP_CONTROL_RESULT_FAILED); + return NULL; + } + char *contact_id = NULL; + app_control_get_extra_data(service, "__CALLER_PANEL__", &contact_id); + if (contact_id && !strcmp(contact_id, "attach-panel")) { + if (ugd) { + ugd->is_attach_panel = true; + } + } else { + ugd->is_attach_panel = false; + } + + if (ugd->overlap_mode) { + ugd->b_hide_indicator = true; + } else if (ugd->b_hide_indicator) { + doc_ui_hide_indicator(ugd); + } else { + doc_dbg("Normal mode"); + } + if (ugd->file_select_mode != DOC_FILE_SELECT_T_NONE) { + /* create attach-panel-document UG */ + if (_doc_create_view(ugd) != 0) { + doc_dbgE("Failed to create Document view!"); + return NULL; + } + } else { + doc_dbgE("Wrong file_select_mode[%d]", + ugd->file_select_mode); + } + + return ugd->ly_main; +} + +/** +* @brief +* +* @param ug +* @param data +* @param priv +*/ +static void _doc_start(ui_gadget_h ug, app_control_h service, void *priv) +{ +} + +/** +* @brief +* +* @param ug +* @param data +* @param priv +*/ +static void _doc_pause(ui_gadget_h ug, app_control_h service, void *priv) +{ + doc_dbg("attach-panel-document paused"); +} + +/** +* @brief +* +* @param ug +* @param data +* @param priv +*/ +static void _doc_resume(ui_gadget_h ug, app_control_h service, void *priv) +{ + doc_dbg("attach-panel-document resumed"); + DOC_CHECK(priv); + doc_ugdata *ugd = (doc_ugdata *)priv; + /*update*/ + + if (ugd->ug_called_by_me == NULL && + ugd->file_select_mode != DOC_FILE_SELECT_T_SLIDESHOW) { + doc_update_view(ugd, DOC_UPDATE_NONE); + } +} + +/** +* @brief +* +* @param ug +* @param data +* @param priv +*/ +static void _doc_destroy(ui_gadget_h ug, app_control_h service, void *priv) +{ + doc_dbgW("!! Destroying attach-panel-document !!"); + DOC_CHECK(ug); + DOC_CHECK(priv); + _doc_close_view((doc_ugdata *)priv); + doc_dbgW("!! Destroyed attach-panel-document !!"); +} + +/** +* @brief +* +* @param ug +* @param msg +* @param data +* @param priv +*/ +static void _doc_message(ui_gadget_h ug, app_control_h msg, app_control_h service, void *priv) +{ + doc_dbg(""); + DOC_CHECK(priv); + doc_ugdata *ugd = (doc_ugdata *)priv; + char *display_mode = NULL; + char *pd_selected = DOC_STR_PD_SELECTED; + char *text = NULL; + Evas_Object *btn = NULL; + int win_x = 0; + int win_y = 0; + int win_w = 0; + int win_h = 0; + + elm_win_screen_size_get(ugd->win, &win_x, &win_y, &win_w, &win_h); + if (ugd->is_attach_panel) { + doc_dbg("called by attach panel "); + app_control_get_extra_data(msg, APP_CONTROL_DATA_SELECTION_MODE, &display_mode); + + if (display_mode) { + if (!strcmp(display_mode, "single")) { + doc_dbg("single_selection "); + if (ugd->nocontents) {//[ToDo] Really needed ?? + elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_w, win_h / 3); + } + ugd->attach_panel_display_mode = ATTACH_PANEL_HALF_MODE; + ugd->file_select_mode = DOC_FILE_SELECT_T_ONE; + ugd->b_multifile = false; + doc_list_change_selection_mode(ugd, false); + ugd->thumbs_d->b_editmode = false; + + elm_genlist_realized_items_update(ugd->thumbs_d->genlist); + + Eina_List *l = NULL; + doc_item *gitem = NULL; + + EINA_LIST_FOREACH(ugd->thumbs_d->medias_elist, l, gitem) { + if (gitem) { + gitem->checked = false; + } + } + + if (ugd->selected_elist) { + ugd->selected_elist = eina_list_free(ugd->selected_elist); + } + + ugd->thumbs_d->tot_selected = 0; + elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_FALSE, EINA_FALSE); + } else if (display_mode && !strcmp(display_mode, "multiple")) { + doc_dbg("multiple_selection"); + if (ugd->nocontents) { + if (ugd->rotate_mode == DOC_ROTATE_LANDSCAPE_UPSIDEDOWN || ugd->rotate_mode == DOC_ROTATE_LANDSCAPE) {//Chanadan:: Check for landscape behaviour for genlist + elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_h, LANDSCAPE_HEIGHT); + } else { + //elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_w, FULL_MODE_PORTRAIT_HEIGHT); + } + } + ugd->attach_panel_display_mode = ATTACH_PANEL_FULL_MODE; + ugd->file_select_mode = DOC_FILE_SELECT_T_MULTIPLE; + ugd->b_multifile = true; + doc_list_change_selection_mode(ugd, true); + ugd->thumbs_d->b_editmode = true; + + elm_genlist_realized_items_update(ugd->thumbs_d->genlist); + + ugd->thumbs_d->tot_selected = 0; + /*Update Title*/ + elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_TRUE, EINA_FALSE); + text = g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected); + elm_object_item_text_set(ugd->nf_it, text); + + /*Disable DONE Button if count is zero */ + if (!ugd->thumbs_d->tot_selected) { + btn = elm_object_item_part_content_get(ugd->nf_it , DOC_NAVIFRAME_TITLE_RIGHT_BTN); + if (btn == NULL) { + doc_dbgE("Failed to get part information"); + } + elm_object_disabled_set(btn, EINA_TRUE); + } + } else { + doc_dbg("invalid mode: %s", display_mode); + } + } + } +} + +/** +* @brief +* +* @param ug +* @param event +* @param data +* @param priv +*/ +static void _doc_event(ui_gadget_h ug, enum ug_event event, app_control_h service, void *priv) +{ + DOC_CHECK(priv); + doc_ugdata *ugd = (doc_ugdata *)priv; + + switch (event) { + case UG_EVENT_LOW_MEMORY: + doc_dbg("UG_EVENT_LOW_MEMORY"); + break; + + case UG_EVENT_LOW_BATTERY: + doc_dbg("UG_EVENT_LOW_BATTERY"); + break; + + case UG_EVENT_LANG_CHANGE: + doc_dbg("UG_EVENT_LANG_CHANGE"); + doc_list_lang_update(ugd); + break; + + case UG_EVENT_ROTATE_PORTRAIT: + doc_dbg("UG_EVENT_ROTATE_PORTRAIT"); + goto UG_ROTATE_EVENT; + break; + + case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN: + doc_dbg("UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN"); + goto UG_ROTATE_EVENT; + break; + + case UG_EVENT_ROTATE_LANDSCAPE: + doc_dbg("UG_EVENT_ROTATE_LANDSCAPE"); + goto UG_ROTATE_EVENT; + break; + + case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN: + doc_dbg("UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN"); + goto UG_ROTATE_EVENT; + break; + + default: + break; + } + + return; + +UG_ROTATE_EVENT: + + /* Update rotate mode and view */ + doc_dbg("rotate_mode: %d", ugd->rotate_mode); + + int win_x = 0; + int win_y = 0; + int win_w = 0; + int win_h = 0; + + elm_win_screen_size_get(ugd->win, &win_x, &win_y, &win_w, &win_h); +// int size = (win_w / 4); +// int landscape_size = (win_h / 7); + + if (ugd->rotate_mode == DOC_ROTATE_LANDSCAPE_UPSIDEDOWN || ugd->rotate_mode == DOC_ROTATE_LANDSCAPE) { + if (ugd->nocontents) { + elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_h, LANDSCAPE_HEIGHT); + } else { + //elm_gengrid_item_size_set(ugd->thumbs_d->genlist, landscape_size, landscape_size); + } + } else { + if (ugd->nocontents) { + if (ugd->attach_panel_display_mode == ATTACH_PANEL_FULL_MODE) { + elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_w, FULL_MODE_PORTRAIT_HEIGHT); + } else { + elm_gengrid_item_size_set(ugd->thumbs_d->genlist, win_w, HALF_MODE_PORTRAIT_HEIGHT); + } + } else { + //elm_gengrid_item_size_set(ugd->thumbs_d->genlist, size, size); + } + } +} + +/** +* @brief +* +* @param ops +*f +* @return +*/ +UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) +{ + doc_dbgW("UG_MODULE_INIT"); + doc_ugdata *ugd = NULL; + DOC_CHECK_VAL(ops, -1); + + ugd = calloc(1, sizeof(doc_ugdata)); + DOC_CHECK_VAL(ugd, -1); + + ops->create = _doc_create; + ops->start = _doc_start; + ops->pause = _doc_pause; + ops->resume = _doc_resume; + ops->destroy = _doc_destroy; + ops->message = _doc_message; + ops->event = _doc_event; + ops->priv = ugd; + ops->opt = UG_OPT_INDICATOR_ENABLE; + + return 0; +} + +/** +* @brief +* +* @param ops +* +* @return +*/ +UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops) +{ + DOC_CHECK(ops); + DOC_FREEIF(ops->priv); + doc_dbgW("UG_MODULE_EXIT"); +} + + diff --git a/src/doc-data-type.c b/src/doc-data-type.c new file mode 100644 index 0000000..7031779 --- /dev/null +++ b/src/doc-data-type.c @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 <media_content.h> +#include "doc-data-type.h" +#include "doc-debug.h" + +static int _doc_data_type_free_media(doc_media_s **item) +{ + DOC_CHECK_VAL(item, -1); + DOC_CHECK_VAL(*item, -1); + doc_media_s *tmp_item = *item; + + /* For local medias */ + if (tmp_item->media_h) { + if (tmp_item->b_create_thumb) { + media_info_cancel_thumbnail(tmp_item->media_h); + tmp_item->b_create_thumb = false; + } + media_info_destroy(tmp_item->media_h); + } + + DOC_FREEIF(tmp_item->uuid); + DOC_FREEIF(tmp_item->thumb_url); + DOC_FREEIF(tmp_item->file_url); + DOC_FREEIF(tmp_item->display_name); + DOC_FREE(tmp_item); + *item = NULL; + return 0; +} + +static int _doc_data_type_free_album(doc_folder_s **album) +{ + DOC_CHECK_VAL(album, -1); + DOC_CHECK_VAL(*album, -1); + doc_folder_s *tmp_album = *album; + + DOC_FREEIF(tmp_album->uuid); + DOC_FREEIF(tmp_album->display_name); + DOC_FREEIF(tmp_album->path); + DOC_FREE(tmp_album); + *album = NULL; + return 0; +} + +int doc_data_type_free_geitem(void **item) +{ + DOC_CHECK_VAL(item, -1); + DOC_CHECK_VAL(*item, -1); + int ret = -1; + + if (((doc_folder_s *)*item)->gtype == DOC_TYPE_FOLDER) { + ret = _doc_data_type_free_album((doc_folder_s **)item); + } else if (((doc_media_s *)*item)->gtype == DOC_TYPE_MEDIA || + ((doc_media_s *)*item)->gtype == DOC_TYPE_WEB_MEDIA) { + ret = _doc_data_type_free_media((doc_media_s **)item); + } + + if (ret < 0) { + return -1; + } else { + return 0; + } +} + diff --git a/src/doc-data-util.c b/src/doc-data-util.c new file mode 100644 index 0000000..406f50a --- /dev/null +++ b/src/doc-data-util.c @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 "doc-data-util.h" + +/* +* create a gitem +*/ +doc_item *doc_data_util_calloc_geitem(void) +{ + doc_item *gitem = (doc_item*)calloc(1, sizeof(doc_item)); + DOC_CHECK_NULL(gitem); + return gitem; +} + +/* +* destroy a doc_item +*/ +static int _doc_data_util_free_geitem(doc_item* gitem) +{ + if (gitem) { + if (gitem->item) { + doc_data_type_free_geitem((void **)&(gitem->item)); + gitem->item = NULL; + } + DOC_FREE(gitem); + } + return 0; +} + +int doc_data_util_free_mtype_items(Eina_List **elist) +{ + void *current = NULL; + + if (elist && *elist) { + doc_dbg("Clear Mitems list."); + EINA_LIST_FREE(*elist, current) { + if (current) { + doc_data_type_free_geitem((void **)¤t); + current = NULL; + } + } + + *elist = NULL; + } + + return 0; +} + +int doc_data_util_free_item(doc_item *gitem) +{ + DOC_CHECK_VAL(gitem, -1); + + _doc_data_util_free_geitem(gitem); + return 0; +} + +/* +* Create a gitem for selected item +*/ +doc_sel_item_s* doc_data_util_new_sel_item(doc_item *gitem) +{ + DOC_CHECK_NULL(gitem); + DOC_CHECK_NULL(gitem->item); + doc_sel_item_s *item = (doc_sel_item_s *)calloc(1, sizeof(doc_sel_item_s)); + DOC_CHECK_NULL(item); + item->uuid = strdup(gitem->item->uuid); + item->file_url = strdup(gitem->item->file_url); + item->store_type = gitem->store_type; + item->sequence = gitem->sequence; + return item; +} + +/* +* Free a doc_sel_item_s item +*/ +int doc_data_util_free_sel_item(doc_sel_item_s *item) +{ + DOC_CHECK_VAL(item, -1); + DOC_FREEIF(item->uuid); + DOC_FREEIF(item->file_url); + DOC_FREE(item); + return 0; +} + +int doc_data_util_create_filter(doc_filter_s *condition, filter_h *filter) +{ + DOC_CHECK_VAL(filter, -1); + DOC_CHECK_VAL(condition, -1); + int ret = -1; + filter_h tmp_filter = NULL; + + ret = media_filter_create(&tmp_filter); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Fail to create filter!"); + return -1; + } + + if (strlen(condition->cond) > 0) { + ret = media_filter_set_condition(tmp_filter, condition->cond, + condition->collate_type); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Fail to set condition!"); + goto DOC_DATA_UTIL_FAILED; + } + } + + if (strlen(condition->sort_keyword) > 0) { + ret = media_filter_set_order(tmp_filter, condition->sort_type, + condition->sort_keyword, + condition->collate_type); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Fail to set order!"); + goto DOC_DATA_UTIL_FAILED; + } + } + + doc_dbg("offset: %d, count: %d", condition->offset, condition->count); + if (condition->offset != -1) { + ret = media_filter_set_offset(tmp_filter, condition->offset, + condition->count); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Fail to set offset!"); + goto DOC_DATA_UTIL_FAILED; + } + } + + *filter = tmp_filter; + return 0; + +DOC_DATA_UTIL_FAILED: + + if (tmp_filter) { + media_filter_destroy(tmp_filter); + tmp_filter = NULL; + *filter = NULL; + } + return -1; +} + +int doc_data_util_destroy_filter(filter_h filter) +{ + DOC_CHECK_VAL(filter, -1); + + if (media_filter_destroy(filter) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Failed to destroy filter!"); + return -1; + } + + return 0; +} + +bool doc_data_util_clone_media(media_info_h media, doc_media_s **pitem, + bool b_meta) +{ + DOC_CHECK_FALSE(pitem); + doc_media_s *item = NULL; + + *pitem = NULL; + + item = (doc_media_s *)calloc(1, sizeof(doc_media_s)); + DOC_CHECK_FALSE(item); + item->gtype = DOC_TYPE_MEDIA; + + if (media_info_clone(&(item->media_h), media) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Clone media handle error"); + goto DOC_DATA_UTIL_FAILED; + } + if (media_info_get_media_id(media, &(item->uuid)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get media id error"); + goto DOC_DATA_UTIL_FAILED; + } + if (media_info_get_display_name(media, &(item->display_name)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get media display name error"); + goto DOC_DATA_UTIL_FAILED; + } + if (media_info_get_file_path(media, &(item->file_url)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get media file path error"); + goto DOC_DATA_UTIL_FAILED; + } + if (media_info_get_media_type(media, (media_content_type_e *)&(item->type)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get media type error"); + goto DOC_DATA_UTIL_FAILED; + } + if (media_info_get_thumbnail_path(media, &(item->thumb_url)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get media thumbnail path error"); + goto DOC_DATA_UTIL_FAILED; + } + doc_sdbg("thumb_url: %s", item->thumb_url); + + if (media_info_get_timeline(media, &(item->mtime)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get media modified time error"); + goto DOC_DATA_UTIL_FAILED; + } +/* if (media_info_get_mode(media, (media_content_mode_e *)&(item->mode)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get media mode failed!"); + goto DOC_DATA_UTIL_FAILED; + }*/ + media_content_storage_e storage_type = 0; + if (media_info_get_storage_type(media, &storage_type) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get storage type failed!"); + goto DOC_DATA_UTIL_FAILED; + } + if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */ + item->storage_type = DOC_PHONE; + } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */ + item->storage_type = DOC_MMC; + } else { + doc_dbgE("Undefined mode[%d]!", storage_type); + } + + *pitem = item; + return true; + +DOC_DATA_UTIL_FAILED: + + doc_data_type_free_geitem((void **)(&item)); + return false; +} + diff --git a/src/doc-data.c b/src/doc-data.c new file mode 100644 index 0000000..d843af6 --- /dev/null +++ b/src/doc-data.c @@ -0,0 +1,211 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 "doc-data.h" +#include "doc-debug.h" +#include "doc-strings.h" + +int doc_data_get_item_cnt(doc_ugdata *ugd, int *item_cnt) +{ + DOC_CHECK_VAL(item_cnt, -1); + DOC_CHECK_VAL(ugd, -1); + int err = -1; + doc_filter_s filter; + memset(&filter, 0x00, sizeof(doc_filter_s)); + + filter.sort_type = MEDIA_CONTENT_ORDER_DESC; + g_strlcpy(filter.sort_keyword, DOC_CONDITION_ORDER, KEYWORD_LENGTH); + filter.collate_type = MEDIA_CONTENT_COLLATE_NOCASE; + filter.offset = DOC_GET_ALL_RECORDS; + filter.count = DOC_GET_ALL_RECORDS; + filter.with_meta = false; + + g_strlcpy(filter.cond, DOC_CONDITION_LOCAL_DOCUMENT, + CONDITION_LENGTH); + + err = doc_local_data_get_all_media_count(&filter, item_cnt); + if (err < 0) { + doc_dbg("Failed to get item count[err: %d]!", err); + return -1; + } + + doc_dbg("Item count: %d.", *item_cnt); + return 0; +} + +/* Append items' path */ +int doc_data_get_sel_paths(doc_ugdata *ugd, char **filepath, char ***filepath_arr, int *cnt) +{ + if (filepath == NULL || ugd == NULL || ugd->selected_elist == NULL || filepath_arr == NULL) { + doc_dbgE("Invalid input!"); + return -1; + } + + Eina_List *path_list = NULL; + GString *selected_path = g_string_new(NULL); + int _cnt = 0; + + /* Get items path from folders */ + doc_dbg("File count: %d", eina_list_count(ugd->selected_elist)); + + doc_sel_item_s *sit = NULL; + Eina_List *l = NULL; + + EINA_LIST_FOREACH(ugd->selected_elist, l, sit) { + if (sit) { + g_string_append(selected_path, sit->file_url); + g_string_append_c(selected_path, ';'); + path_list = eina_list_append(path_list, sit); + _cnt++; + sit = NULL; + } + } + + /* copy path from path_list to path_array */ + int idx = 0; + sit = NULL; + if (_cnt > 0) { + *filepath_arr = (char **)calloc(_cnt, sizeof(char *)); + EINA_LIST_FREE(path_list, sit) { + if (sit && sit->file_url) { + (*filepath_arr)[idx] = strdup(sit->file_url); + idx++; + sit = NULL; + } else { + doc_sdbgE("Invalid file path"); + } + } + doc_dbg("array finished!"); + } else { + doc_sdbgE("Copy to path_array failed!"); + } + + int str_len = strlen(selected_path->str); + doc_dbg("path string length: %d", str_len); + g_string_truncate(selected_path, str_len - 1); + *filepath = g_string_free(selected_path, false); + + if (cnt) { + *cnt = _cnt; + } + return 0; +} + +int doc_data_get_media_data(doc_ugdata *ugd, int type, int start_pos, + int end_pos, Eina_List **pmedias_elist, + doc_restore_selected_cb restore_cb, Eina_List *sel_id) +{ + DOC_CHECK_VAL(pmedias_elist, -1); + DOC_CHECK_VAL(ugd, -1); + Eina_List *itemlist = NULL; + int err = -1; + doc_filter_s filter; + + memset(&filter, 0, sizeof(doc_filter_s)); + doc_dbg("--start_pos[%d], end_pos[%d]--", start_pos, end_pos); + g_strlcpy(filter.cond, DOC_CONDITION_LOCAL_DOCUMENT, + CONDITION_LENGTH); + + filter.collate_type = MEDIA_CONTENT_COLLATE_NOCASE; + filter.sort_type = MEDIA_CONTENT_ORDER_DESC; + g_strlcpy(filter.sort_keyword, DOC_CONDITION_ORDER, KEYWORD_LENGTH); + filter.offset = start_pos; + filter.count = end_pos - start_pos + 1; + filter.with_meta = true; + + + doc_dbg("--All Folder--"); + err = doc_local_data_get_all_folders_media_list(&filter, + &itemlist); + + if ((err == 0) && (itemlist != NULL)) { + doc_media_s *item = NULL; + doc_item* gitem = NULL; + EINA_LIST_FREE(itemlist, item) { + if (item == NULL || item->uuid == NULL) { + doc_dbgE("Invalid item!"); + continue; + } + + gitem = doc_data_util_calloc_geitem(); + if (gitem == NULL) { + doc_dbgE("doc_data_util_calloc_geitem() failed"); + doc_data_type_free_geitem((void **)&item); + continue; + } + + gitem->item = item; + gitem->ugd = ugd; + gitem->store_type = type; + *pmedias_elist = eina_list_append(*pmedias_elist, + gitem); + + if (restore_cb && sel_id) { + restore_cb(sel_id, gitem); + } + item = NULL; + gitem = NULL; + } + } else { + /* Free Mitems */ + if (itemlist) { + doc_data_util_free_mtype_items(&itemlist); + } + } + doc_dbg("medias_elist=%p", *pmedias_elist); + return err; +} + +int doc_del_media_data_by_id(doc_ugdata* ugd, const char *media_id) +{ + DOC_CHECK_VAL(media_id, -1); + int ret = media_info_delete_from_db(media_id); + if (ret != 0) { + doc_dbgE("Delete media failed[%d]!", ret); + return -1; + } + + return 0; +} + +int doc_data_init(doc_ugdata* ugd) +{ + doc_dbg("Connect to DB!"); + DOC_CHECK_VAL(ugd, -1); + int err = doc_local_data_connect(); + if (err != 0) { + doc_dbgE("Local connection failed[%d]!", err); + return -1; + } + + return 0; +} + +int doc_data_finalize(doc_ugdata* ugd) +{ + doc_dbg("Free memory and disconnect with DB!"); + DOC_CHECK_VAL(ugd, -1); + + int err = doc_local_data_disconnect(); + if (err != 0) { + doc_dbgE("Local disconnection failed[%d]!", err); + return -1; + } + + return 0; +} + diff --git a/src/doc-db-update.c b/src/doc-db-update.c new file mode 100644 index 0000000..c983834 --- /dev/null +++ b/src/doc-db-update.c @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 <media_content.h> +#include "attach-panel-document.h" +#include "doc-data.h" +#include "doc-local-data.h" +#include "doc-util.h" +#include "doc-debug.h" + +#define DOC_MONITOE_TIME_DELAY 1.0f + +struct doc_db_noti_t { + Ecore_Timer *db_timer; /*For update db data*/ + /*Make ture calling db update callback after other operations complete*/ + Ecore_Idler *db_idl; + //media_content_noti_h cloud_h; /* Notify handle fro cloud content updating in DB */ + media_content_db_update_item_type_e update_item; + media_content_db_update_type_e update_type; + int count; /* All media count got from DB */ +}; + +static Eina_Bool _doc_db_update_idler(void *data) +{ + DOC_CHECK_FALSE(data); + doc_ugdata *ugd = (doc_ugdata *)data; + DOC_CHECK_FALSE(ugd->db_noti_d); + doc_db_noti_s *db_noti = ugd->db_noti_d; + doc_update_view(ugd, DOC_UPDATE_VIEW_INOTIFY); + DOC_IF_DEL_IDLER(db_noti->db_idl); + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool _doc_db_update_timer_cb(void *data) +{ + DOC_CHECK_FALSE(data); + doc_ugdata *ugd = (doc_ugdata *)data; + DOC_CHECK_FALSE(ugd->db_noti_d); + doc_db_noti_s *db_noti = ugd->db_noti_d; + + DOC_IF_DEL_IDLER(db_noti->db_idl); + db_noti->db_idl = ecore_idler_add(_doc_db_update_idler, data); + + DOC_IF_DEL_TIMER(db_noti->db_timer); + return ECORE_CALLBACK_CANCEL; +} + +static int _doc_db_update_add_timer(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + DOC_CHECK_VAL(ugd->db_noti_d, -1); + doc_db_noti_s *db_noti = ugd->db_noti_d; + + DOC_IF_DEL_TIMER(db_noti->db_timer); + db_noti->db_timer = ecore_timer_add(DOC_MONITOE_TIME_DELAY, + _doc_db_update_timer_cb, ugd); + doc_dbgW("TIMER[1.0f] added!"); + return 0; +} + +static int _doc_db_update_op(media_content_error_e error, int pid, + media_content_db_update_item_type_e update_item, + media_content_db_update_type_e update_type, + media_content_type_e media_type, char *uuid, + char *path, char *mime_type, void *data) +{ + DOC_CHECK_VAL(data, -1); + doc_ugdata *ugd = (doc_ugdata *)data; + DOC_CHECK_VAL(ugd->db_noti_d, -1); + doc_db_noti_s *db_noti = ugd->db_noti_d; + + if (MEDIA_CONTENT_ERROR_NONE != error) { + doc_dbgE("Update db error[%d]!", error); + return -1; + } + if (update_item == MEDIA_ITEM_FILE && + MEDIA_CONTENT_TYPE_OTHERS != media_type) { + doc_dbg("Media type is wrong"); + return -1; + } else if (update_item == MEDIA_ITEM_DIRECTORY && media_type == -1) { + /* Batch operation, DB wouldn't return media type */ + int cnt = 0; + int ret = -1; + ret = doc_data_get_item_cnt(ugd, &cnt); + if (ret != 0 || cnt == 0) { + doc_dbgE("Empty!"); + } + doc_dbg("old: %d, new: %d", db_noti->count, cnt); + if (cnt == db_noti->count) { + doc_dbg("Nothing changed"); + if (path && + !strcmp(path, DOC_ROOT_PATH_MMC)) { + doc_dbg("MMC insert or remove!"); + } else if (path) { + doc_folder_s *album = NULL; + doc_local_data_get_folder_by_path(path, &album); + if (!album) { + return -1; + } else { + doc_data_type_free_geitem((void **)&album); + doc_dbgW("Updated album contains images"); + } + } else { + return -1; + } + } else { + db_noti->count = cnt; + } + } + + db_noti->update_item = update_item; + db_noti->update_type = update_type; + + _doc_db_update_add_timer(ugd); + return 0; +} + +static void _doc_db_update_cb(media_content_error_e error, int pid, + media_content_db_update_item_type_e update_item, + media_content_db_update_type_e update_type, + media_content_type_e media_type, char *uuid, + char *path, char *mime_type, void *data) +{ + doc_dbg("update_item[%d], update_type[%d], media_type[%d]", update_item, + update_type, media_type); + DOC_CHECK(data); + doc_dbg("uuid[%s], path[%s]", uuid, path); + _doc_db_update_op(error, pid, update_item, update_type, media_type, + uuid, path, mime_type, data); +} + +bool doc_db_update_reg_cb(doc_ugdata *ugd) +{ + DOC_CHECK_FALSE(ugd); + /*Init data*/ + doc_db_noti_s *db_noti = (doc_db_noti_s *)calloc(1, sizeof(doc_db_noti_s)); + DOC_CHECK_FALSE(db_noti); + ugd->db_noti_d = db_noti; + + int cnt = 0; + doc_data_get_item_cnt(ugd, &cnt); + db_noti->count = cnt; + + int ret = -1; + + doc_dbg("Set db updated callback"); + ret = media_content_set_db_updated_cb(_doc_db_update_cb, ugd); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Set db updated cb failed[%d]!", ret); + } + return true; +} + +bool doc_db_update_finalize(doc_ugdata *ugd) +{ + int ret = -1; + doc_dbg("Unset db updated callback"); + + ret = media_content_unset_db_updated_cb(); + if (ret != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("UNSet db updated cb failed[%d]!", ret); + } + + DOC_CHECK_FALSE(ugd); + DOC_CHECK_FALSE(ugd->db_noti_d); + doc_db_noti_s *db_noti = ugd->db_noti_d; + + DOC_IF_DEL_TIMER(db_noti->db_timer); + DOC_IF_DEL_IDLER(db_noti->db_idl); + DOC_FREE(ugd->db_noti_d); + return true; +} + diff --git a/src/doc-list.c b/src/doc-list.c new file mode 100644 index 0000000..8208169 --- /dev/null +++ b/src/doc-list.c @@ -0,0 +1,1363 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 "doc-list.h" +#include "doc-ui-util.h" +#include "doc-data.h" +#include "doc-main-view.h" +#include "doc-strings.h" +#include "doc-ugdata.h" +#include <notification.h> + +#define DEFAULT_THUMBNAIL "/opt/usr/share/media/.thumb/thumb_default.png" + +static char *icon_array[FILE_TYPE_MAX] = { + [FILE_TYPE_DIR] = DOC_ICON_FOLDER, + [FILE_TYPE_IMAGE] = DOC_ICON_IMAGE, + [FILE_TYPE_VIDEO] = DOC_ICON_VIDEO, + [FILE_TYPE_MUSIC] = DOC_ICON_MUSIC, + [FILE_TYPE_SOUND] = DOC_ICON_SOUND, + [FILE_TYPE_PDF] = DOC_ICON_PDF, + [FILE_TYPE_DOC] = DOC_ICON_DOC, + [FILE_TYPE_PPT] = DOC_ICON_PPT, + [FILE_TYPE_EXCEL] = DOC_ICON_EXCEL, + [FILE_TYPE_VOICE] = DOC_ICON_SOUND, + [FILE_TYPE_HTML] = DOC_ICON_HTML, + [FILE_TYPE_FLASH] = DOC_ICON_FLASH, + [FILE_TYPE_TXT] = DOC_ICON_TXT, + [FILE_TYPE_TPK] = DOC_ICON_TPK, + [FILE_TYPE_VCONTACT] = DOC_ICON_VCONTACT, + [FILE_TYPE_VCALENDAR] = DOC_ICON_VCALENDAR, + [FILE_TYPE_VNOTE] = DOC_ICON_VNOTE, + [FILE_TYPE_RSS] = DOC_ICON_RSS, + [FILE_TYPE_JAVA] = DOC_ICON_JAVA, + [FILE_TYPE_HWP] = DOC_ICON_HWP, + [FILE_TYPE_SNB] = DOC_ICON_SNB, + [FILE_TYPE_GUL] = DOC_ICON_GUL, + [FILE_TYPE_TASK] = DOC_ICON_TASK, + [FILE_TYPE_EML] = DOC_ICON_EMAIL, + [FILE_TYPE_CSV] = DOC_ICON_EXCEL, + [FILE_TYPE_SVG] = DOC_ICON_SVG, + [FILE_TYPE_WGT] = DOC_ICON_TPK, +}; + +static Evas_Object* _doc_list_add_view(doc_ugdata *ugd, Evas_Object *parent) +{ + doc_dbg(""); + DOC_CHECK_NULL(parent); + Evas_Object *layout = doc_ui_load_edj(parent, DOC_EDJ_FILE, + DOC_GRP_LISTVIEW); + DOC_CHECK_NULL(layout); + evas_object_show(layout); + return layout; +} + +static Eina_Bool _data_list_back_cb(void *data, Elm_Object_Item *it) +{ + doc_dbg(""); + DOC_CHECK_FALSE(data); + doc_ugdata *ugd = (doc_ugdata *)data; + Eina_List *l = NULL; + doc_item *gitem = NULL; + + void *pop_cb = evas_object_data_get(ugd->naviframe, + DOC_NAVIFRAME_POP_CB_KEY); + if (pop_cb) { + Eina_Bool(*_pop_cb)(void * ugd); + _pop_cb = pop_cb; + + if (_pop_cb(ugd)) { + /* Just pop edit view, dont destroy me */ + return EINA_FALSE; + } + } + + app_control_h app_control = NULL; + app_control_create(&app_control); + app_control_add_extra_data(app_control, DOC_FILE_SELECT_RETURN_COUNT, "0"); + app_control_add_extra_data(app_control, DOC_FILE_SELECT_RETURN_PATH, NULL); + app_control_add_extra_data(app_control, APP_CONTROL_DATA_SELECTED, NULL); + app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, NULL, 0); + ug_send_result_full(ugd->ug, app_control, APP_CONTROL_RESULT_FAILED); + app_control_destroy(app_control); + + if (!ugd->is_attach_panel) { + ug_destroy_me(ugd->ug); + doc_dbg("ug_destroy_me"); + } + + EINA_LIST_FOREACH(ugd->thumbs_d->medias_elist, l, gitem) { + if (gitem) { + gitem->checked = false; + } + } + + ugd->selected_elist = eina_list_free(ugd->selected_elist); + /*If return ture, ug will pop naviframe first.*/ + return EINA_FALSE; +} + +static void _doc_list_get_app_resource(const char *edj_file_in, char *edj_path_out, int edj_path_max) +{ + char *res_path = app_get_resource_path(); + if (res_path) { + snprintf(edj_path_out, edj_path_max, "%s%s", res_path, edj_file_in); + free(res_path); + } +} + +static Evas_Object* _doc_list_show_thumb(Evas_Object *obj, const char *path) +{ + DOC_CHECK_NULL(obj); + + char full_path[100]; + + snprintf(full_path, 100, "/usr/ug/res/images/ug-attach-panel-document/icons/%s", path); + + Evas_Object *ic = elm_icon_add(obj); + DOC_CHECK_NULL(ic); + if (!elm_image_file_set(ic, full_path, NULL)) + doc_dbgE("Image set failed"); + + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(ic, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE); + elm_image_preload_disabled_set(ic, EINA_TRUE); + elm_image_smooth_set(ic, EINA_TRUE); + elm_image_no_scale_set(ic, EINA_FALSE); + evas_object_show(ic); + + return ic; +} + +static void _doc_list_navi_done_cb(void *data, Evas_Object *obj, void *ei) +{ + doc_dbgE("Transferring Data to caller"); + doc_ugdata *ugd = (doc_ugdata*)data; + DOC_CHECK(ugd); + + /* file selection mode */ + char *paths = NULL; + char **path_array = NULL; /* the array size is sel_cnt */ + int sel_cnt = 0; + int i = 0; + + doc_data_get_sel_paths(ugd, &paths, &path_array, &sel_cnt); + if (sel_cnt <= 0) { + doc_dbgE("Invalid selected path count!"); + goto DOC_SEND_RESULT_FINISHED; + } + + char t_str[32] = {0,}; + eina_convert_itoa(sel_cnt, t_str); + + app_control_add_extra_data(ugd->service, + DOC_FILE_SELECT_RETURN_COUNT, t_str); + app_control_add_extra_data(ugd->service, DOC_FILE_SELECT_RETURN_PATH, + paths); + app_control_add_extra_data_array(ugd->service, APP_CONTROL_DATA_SELECTED, + (const char **)path_array, sel_cnt); + app_control_add_extra_data_array(ugd->service, APP_CONTROL_DATA_PATH, + (const char **)path_array, sel_cnt); + ug_send_result_full(ugd->ug, ugd->service, APP_CONTROL_RESULT_SUCCEEDED); + ugd->selected_elist = eina_list_free(ugd->selected_elist); + +DOC_SEND_RESULT_FINISHED: + + if (paths) { + g_free(paths); + paths = NULL; + } + if (path_array) { + for (i = 0; i < sel_cnt; i++) { + DOC_FREEIF(path_array[i]); + } + DOC_FREE(path_array); + } + + if (!ugd->is_attach_panel) { + ug_destroy_me(ugd->ug); + } +} + +static void _doc_list_check_state_changed_cb(void *data, Evas_Object *obj, void *ei) +{ + DOC_CHECK(obj); + DOC_CHECK(data); + doc_item *gitem = (doc_item *)data; + DOC_CHECK(gitem->item); + DOC_CHECK(gitem->item->file_url); + DOC_CHECK(gitem->ugd); + doc_ugdata *ugd = gitem->ugd; + DOC_CHECK(ugd->service); + DOC_CHECK(ugd->thumbs_d); + Eina_List *l = NULL; + doc_sel_item_s *sit = NULL; + doc_sel_item_s *sit1 = NULL; + Eina_Bool state = elm_check_state_get(obj); + + sit = doc_data_util_new_sel_item(gitem); + DOC_CHECK(sit); +#ifdef FEATURE_SIZE_CHECK + struct stat stFileInfo; + stat(sit->file_url, &stFileInfo); +#endif + if (state == EINA_TRUE) { + if (!g_strcmp0(gitem->item->thumb_url, DEFAULT_THUMBNAIL)) { + elm_check_state_set(obj, EINA_FALSE); + char *pStrWarning = g_strdup_printf( + DOC_STR_UNSUPPORTED_FILE); + notification_status_message_post(pStrWarning); + DOC_FREE(pStrWarning); + doc_data_util_free_sel_item(sit); + return; + } + if ((ugd->max_count != -1) && (gitem->ugd->thumbs_d->tot_selected + 1 > ugd->max_count)) { + elm_check_state_set(obj, EINA_FALSE); + char *noti_str = DOC_STR_MAX_PICTURES_SELECTED; + char *pStrWarning = g_strdup_printf( + noti_str, + ugd->max_count); + notification_status_message_post(pStrWarning); + DOC_FREE(pStrWarning); + doc_data_util_free_sel_item(sit); + return; + } +#ifdef FEATURE_SIZE_CHECK + if (ugd->limitsize > 0 && ugd->selsize + stFileInfo.st_size > ugd->limitsize) { + elm_check_state_set(obj, EINA_FALSE); + notification_status_message_post("maximum of 2MB can be selected"); + doc_data_util_free_sel_item(sit); + return; + } +#endif + doc_sdbg("append Path: %s", sit->file_url); + ugd->selected_elist = eina_list_append(ugd->selected_elist, sit); + ugd->thumbs_d->tot_selected++; +#ifdef FEATURE_SIZE_CHECK + ugd->selsize += stFileInfo.st_size; +#endif + gitem->checked = TRUE; + } else { + doc_sdbg("remove Path: %s", sit->file_url); + EINA_LIST_FOREACH(ugd->selected_elist, l, sit1) { + if (sit1 && !strcmp(sit->file_url, sit1->file_url)) { + ugd->selected_elist = eina_list_remove(ugd->selected_elist, sit1); + doc_data_util_free_sel_item(sit1); + } + } + ugd->thumbs_d->tot_selected--; +#ifdef FEATURE_SIZE_CHECK + ugd->selsize -= stFileInfo.st_size; +#endif + gitem->checked = FALSE; + doc_data_util_free_sel_item(sit); + } + + char *pd_selected = DOC_STR_PD_SELECTED; + char *text = NULL; + Evas_Object *btn = NULL; + + btn = elm_object_item_part_content_get(ugd->nf_it , DOC_NAVIFRAME_TITLE_RIGHT_BTN); + if (btn == NULL) { + doc_dbgE("Failed to get part information"); + } + + if (ugd->thumbs_d->tot_selected == 0) { + elm_object_disabled_set(btn, EINA_TRUE); + } else { + elm_object_disabled_set(btn, EINA_FALSE); + } + + /* Update the label text */ + if (ugd->thumbs_d->tot_selected >= 0) { + text = g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected); + elm_object_item_text_set(ugd->nf_it, text); + } +} + +static Evas_Object* _doc_nocontent_create(void *data) +{ + doc_ugdata *ugd = (doc_ugdata *)data; + + Evas_Object *layout = doc_ui_load_edj(ugd->list_view, DOC_EDJ_FILE, + "nocontent"); + doc_dbg("Nocontents label: %s", DOC_STR_NO_ITEMS); + + Evas_Object *noc_lay = elm_layout_add(layout); + DOC_CHECK_NULL(noc_lay); + + elm_layout_theme_set(noc_lay, "layout", "nocontents", "text"); + + doc_ui_set_translate_part_str(noc_lay, "elm.text", DOC_STR_NO_ITEMS); + doc_ui_set_translate_part_str(noc_lay, "elm.help.text", DOC_STR_NO_ITEMS_HELP_TEXT); + + elm_layout_signal_emit(noc_lay, "text,disabled", ""); + elm_layout_signal_emit(noc_lay, "align.center", "elm"); + elm_object_part_content_set(layout, "swallow", noc_lay); + 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); + DOC_CHECK_NULL(layout); + evas_object_show(layout); + + return layout; +} + +static Eina_Bool _doc_list_is_dir(const char *path) +{ + if (!path) { + return 0; + } + + struct stat info = {0,}; + + if (stat(path, &info) == 0) { + if (S_ISDIR(info.st_mode)) { + return 1; + } + } + + return 0; +} + +int _document_attr_is_dir(const char *filepath) +{ + DOC_CHECK_NULL(filepath); + + return _doc_list_is_dir(filepath); +} + +const char *_document_file_get(const char path[]) +{ + char *file = NULL; + if ((file = strrchr(path, '/'))) { + file++; + } else { + file = (char *) path; + } + + return file; +} + +static fsFileType _document_attr_get_category_by_file_ext(const char *file_ext) +{ + int i = 0; + + if (file_ext == NULL) { + return FILE_TYPE_ETC; + } + + if (file_ext[0] == '.') { + i = 1; + } + + switch (file_ext[i]) { + case 'a': + case 'A': + if (strcasecmp("ASF", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("AMR", &file_ext[i]) == 0) { + return FILE_TYPE_VOICE; + } + if (strcasecmp("AWB", &file_ext[i]) == 0) { + return FILE_TYPE_VOICE; + } + if (strcasecmp("AAC", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("AVI", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("AAC", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + + break; + case 'b': + case 'B': + if (strcasecmp("BMP", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + break; + case 'c': + case 'C': + if (strcasecmp("csv", &file_ext[i]) == 0) { + return FILE_TYPE_CSV; + } + break; + case 'd': + case 'D': + if (strcasecmp("DOC", &file_ext[i]) == 0) { + return FILE_TYPE_DOC; + } + if (strcasecmp("DOCX", &file_ext[i]) == 0) { + return FILE_TYPE_DOC; + } + if (strcasecmp("DIVX", &file_ext[i]) == 0) { + { + return FILE_TYPE_VIDEO; + } + } + break; + case 'E': + case 'e': + if (strcasecmp("EML", &file_ext[i]) == 0) { + return FILE_TYPE_EML; + } + break; + case 'f': + case 'F': + if (strcasecmp("FLAC", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + break; + case 'g': + case 'G': + if (strcasecmp("GIF", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("G72", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("GUL", &file_ext[i]) == 0) { + return FILE_TYPE_GUL; + } + break; + case 'h': + case 'H': + if (strcasecmp("HTML", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + if (strcasecmp("HTM", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + if (strcasecmp("HWP", &file_ext[i]) == 0) { + return FILE_TYPE_HWP; + } + break; + case 'i': + case 'I': + if (strcasecmp("IMY", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("IPK", &file_ext[i]) == 0) { + return FILE_TYPE_APP; + } + if (strcasecmp("ICS", &file_ext[i]) == 0) { + return FILE_TYPE_VCALENDAR; + } + break; + case 'j': + case 'J': + if (strcasecmp("JAD", &file_ext[i]) == 0) { + return FILE_TYPE_JAVA; + } + if (strcasecmp("JAR", &file_ext[i]) == 0) { + return FILE_TYPE_JAVA; + } + + if (strcasecmp("JPG", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("JPEG", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("JPE", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("JP2", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + break; + case 'm': + case 'M': + if (strcasecmp("MMF", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("MP3", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("MID", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("MIDI", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("MP4", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("MPG", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("MPEG", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("M4A", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("M3G", &file_ext[i]) == 0) { + return FILE_TYPE_FLASH; + } + if (strcasecmp("MXMF", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("MKV", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("MKA", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + break; + case 'o': + case 'O': + if (strcasecmp("opml", &file_ext[i]) == 0) { + return FILE_TYPE_RSS; + } + if (strcasecmp("ogg", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + break; + case 'p': + case 'P': + if (strcasecmp("PNG", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("PJPEG", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("PDF", &file_ext[i]) == 0) { + return FILE_TYPE_PDF; + } + if (strcasecmp("PPT", &file_ext[i]) == 0) { + return FILE_TYPE_PPT; + } + if (strcasecmp("PPTX", &file_ext[i]) == 0) { + return FILE_TYPE_PPT; + } + if (strcasecmp("PEM", &file_ext[i]) == 0) { + return FILE_TYPE_CERTIFICATION; + } + break; + case 'r': + case 'R': + if (strcasecmp("RA", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + break; + case 's': + case 'S': + if (strcasecmp("SDP", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("SPM", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("SMP", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("SPF", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("SWF", &file_ext[i]) == 0) { + return FILE_TYPE_FLASH; + } + if (strcasecmp("SCN", &file_ext[i]) == 0) { + return FILE_TYPE_MOVIE_MAKER; + } + if (strcasecmp("SVG", &file_ext[i]) == 0) { + return FILE_TYPE_SVG; + } + if (strcasecmp("SVGZ", &file_ext[i]) == 0) { + return FILE_TYPE_SVG; + } + if (strcasecmp("SNB", &file_ext[i]) == 0) { + return FILE_TYPE_SNB; + } + if (strcasecmp("SPD", &file_ext[i]) == 0) { + return FILE_TYPE_SPD; + } + + break; + case 't': + case 'T': + if (strcasecmp("TXT", &file_ext[i]) == 0) { + return FILE_TYPE_TXT; + } + if (strcasecmp("THM", &file_ext[i]) == 0) { + return FILE_TYPE_THEME; + } + if (strcasecmp("TPK", &file_ext[i]) == 0) { + return FILE_TYPE_TPK; + } + if (strcasecmp("TIF", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + break; + case 'v': + case 'V': + if (strcasecmp("VCF", &file_ext[i]) == 0) { + return FILE_TYPE_VCONTACT; + } + if (strcasecmp("VCS", &file_ext[i]) == 0) { + return FILE_TYPE_VCALENDAR; + } + if (strcasecmp("VNT", &file_ext[i]) == 0) { + return FILE_TYPE_VNOTE; + } + if (strcasecmp("VBM", &file_ext[i]) == 0) { + return FILE_TYPE_VBOOKMARK; + } + if (strcasecmp("VTS", &file_ext[i]) == 0) { + return FILE_TYPE_TASK; + } + break; + case 'w': + case 'W': + if (strcasecmp("WAV", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("WBMP", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + if (strcasecmp("WGT", &file_ext[i]) == 0) { + return FILE_TYPE_WGT; + } + if (strcasecmp("WMA", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("WMV", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("WML", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + if (strcasecmp("WAVE", &file_ext[i]) == 0) { + return FILE_TYPE_MUSIC; + } + if (strcasecmp("WMF", &file_ext[i]) == 0) { + return FILE_TYPE_IMAGE; + } + break; + case 'x': + case 'X': + if (strcasecmp("XLS", &file_ext[i]) == 0) { + return FILE_TYPE_EXCEL; + } + if (strcasecmp("XLSX", &file_ext[i]) == 0) { + return FILE_TYPE_EXCEL; + } + if (strcasecmp("XMF", &file_ext[i]) == 0) { + return FILE_TYPE_SOUND; + } + if (strcasecmp("XHTML", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + if (strcasecmp("XML", &file_ext[i]) == 0) { + return FILE_TYPE_HTML; + } + break; + case '3': + if (strcasecmp("3GP", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("3GPP", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + if (strcasecmp("3G2", &file_ext[i]) == 0) { + return FILE_TYPE_VIDEO; + } + break; + } + + return FILE_TYPE_ETC; +} + +int _document_file_category(const char *filepath, fsFileType * category) +{ + int i = 0; + int flag = 0; + + if (_document_attr_is_dir(filepath)) { + *category = FILE_TYPE_DIR; + return 0; + } + + const char *filename = NULL; + filename = _document_file_get(filepath); + if (filename == NULL) { + *category = FILE_TYPE_NONE; + return -1; + } + char *file_ext = NULL; + /*ToDo: error file name like the last letter is "." */ + for (i = strlen(filename); i >= 0; i--) { + if (filename[i] == '.') { + file_ext = g_strdup(&filename[i + 1]); + flag = 1; + break; + } + + if (filename[i] == '/') { + flag = 0; + break; + } + } + + if (flag == 1) { + *category = _document_attr_get_category_by_file_ext(file_ext); + SAFE_FREE_CHAR(file_ext); + return 0; + } else { + *category = FILE_TYPE_NONE; + SAFE_FREE_CHAR(file_ext); + return -1; + } +} + +const char* _document_file_attr_get_default_icon_by_type(fsFileType ftype) +{ + const char *icon_path = DOC_DEFAULT_ICON; + + if (icon_array[ftype]) { + icon_path = icon_array[ftype]; + } + + return icon_path; +} + + +static Evas_Object* _doc_list_item_content_get(void *data, Evas_Object *obj, const char *part) +{ + doc_item *gitem = NULL; + + if (strlen(part) <= 0) { + doc_dbgE("part length <= 0"); + return NULL; + } + + gitem = (doc_item*)data; + DOC_CHECK_NULL(gitem->item); + DOC_CHECK_NULL(gitem->ugd); + doc_ugdata *ugd = gitem->ugd; + DOC_CHECK_NULL(ugd->thumbs_d); + + Evas_Object *layout = NULL; + + if (!g_strcmp0(part, "elm.swallow.icon")) { + fsFileType type = FILE_TYPE_NONE; + _document_file_category(gitem->item->file_url, &type); + const char *thumb = _document_file_attr_get_default_icon_by_type(type); + + layout = _doc_list_show_thumb(obj, thumb); + + return layout; + + } else if (!g_strcmp0(part, "elm.swallow.end") && ugd->thumbs_d->b_editmode == true) { + Evas_Object* ck = NULL; + ck = elm_check_add(obj); + DOC_CHECK_NULL(ck); + + evas_object_propagate_events_set(ck, EINA_FALSE); + evas_object_repeat_events_set(ck, EINA_FALSE); + elm_check_state_set(ck, gitem->checked); + ugd->thumbs_d->check = ck; + evas_object_smart_callback_add(ck, "changed", + _doc_list_check_state_changed_cb, gitem); + evas_object_show(ck); + + return ck; + } + + return layout; +} + +static char* _doc_list_text_get_cb(void *data, Evas_Object *obj, const char *part) +{ + doc_item *gitem = (doc_item*)data; + DOC_CHECK_NULL(gitem->item); + DOC_CHECK_NULL(gitem->ugd); + doc_ugdata *ugd = gitem->ugd; + DOC_CHECK_NULL(ugd->thumbs_d); + + return strdup(gitem->item->display_name); +} + +static int _doc_list_select_one(doc_item *gitem, char *file_url) +{ + DOC_CHECK_VAL(file_url, -1); + DOC_CHECK_VAL(gitem, -1); + doc_ugdata *ugd = (doc_ugdata *)gitem->ugd; + DOC_CHECK_VAL(ugd, -1); + doc_sdbg("Service add:%s", file_url); + + int ret = -1; + + if (!g_strcmp0(gitem->item->thumb_url, DEFAULT_THUMBNAIL)) { + char *pStrWarning = g_strdup_printf(DOC_STR_UNSUPPORTED_FILE); + notification_status_message_post(pStrWarning); + DOC_FREE(pStrWarning); + return ret; + } + + char **path_array = (char **)calloc(1, sizeof(char *)); + if (!path_array) { + doc_dbgW("failed to allocate path"); + return ret; + } + path_array[0] = strdup(file_url); + + ret = app_control_add_extra_data(ugd->service, DOC_FILE_SELECT_RETURN_PATH, file_url); + + if (ret != APP_CONTROL_ERROR_NONE) { + doc_dbgW("Add file path failed!"); + } + ret = app_control_add_extra_data_array(ugd->service, APP_CONTROL_DATA_SELECTED, + (const char **)path_array, 1); + ret = app_control_add_extra_data_array(ugd->service, APP_CONTROL_DATA_PATH, + (const char **)path_array, 1); + if (ret != APP_CONTROL_ERROR_NONE) { + doc_dbgW("Add selected path failed!"); + } + ret = ug_send_result_full(ugd->ug, ugd->service, + APP_CONTROL_RESULT_SUCCEEDED); + if (ret != 0) { + doc_dbgW("Send result failed!"); + } + if (!ugd->is_attach_panel) { + ug_destroy_me(ugd->ug); + } + + DOC_FREEIF(path_array[0]); + DOC_FREEIF(path_array); + return ret; +} + +static void _doc_list_item_sel_cb(void *data, Evas_Object *obj, void *ei) +{ + + DOC_CHECK(data); + doc_item *gitem = (doc_item*)data; + DOC_CHECK(gitem->item); + DOC_CHECK(gitem->ugd); + doc_ugdata *ugd = gitem->ugd; + char *pd_selected = DOC_STR_PD_SELECTED; + char *text = NULL; + Evas_Object *btn = NULL; + Eina_List *l = NULL; + doc_sel_item_s *sit = NULL; + doc_sel_item_s *sit1 = NULL; + + elm_genlist_item_selected_set(ei, EINA_FALSE); + + if (ugd->file_select_mode == DOC_FILE_SELECT_T_ONE) { + int ret = _doc_list_select_one(gitem, gitem->item->file_url); + + if (ret != 0) { + doc_dbgE("Data Transfer Failed."); + } + } else if (ugd->file_select_mode == DOC_FILE_SELECT_T_MULTIPLE) { + Evas_Object *ck = elm_object_item_part_content_get((Elm_Object_Item *) ei, "elm.swallow.end"); + + Eina_Bool bl = elm_check_state_get(ck); + + if (bl == EINA_FALSE) { + if (!g_strcmp0(gitem->item->thumb_url, DEFAULT_THUMBNAIL)) { + char *pStrWarning = g_strdup_printf( + DOC_STR_UNSUPPORTED_FILE); + notification_status_message_post(pStrWarning); + DOC_FREE(pStrWarning); + return; + } + if ((ugd->max_count != -1) && (gitem->ugd->thumbs_d->tot_selected + 1 > ugd->max_count)) { + char *noti_str = DOC_STR_MAX_PICTURES_SELECTED; + char *pStrWarning = g_strdup_printf(noti_str, + ugd->max_count); + notification_status_message_post(pStrWarning); + DOC_FREE(pStrWarning); + return; + } + sit = doc_data_util_new_sel_item(gitem); + if (!sit) { + doc_dbgE("Invalid select item"); + return; + } +#ifdef FEATURE_SIZE_CHECK + struct stat stFileInfo; + stat(sit->file_url, &stFileInfo); + if (ugd->limitsize > 0 && ugd->selsize + stFileInfo.st_size > ugd->limitsize) { + notification_status_message_post("maximum of 2MB can be selected"); + doc_data_util_free_sel_item(sit); + return; + } +#endif + doc_sdbg("append Path: %s", sit->file_url); + ugd->selected_elist = eina_list_append(ugd->selected_elist, sit); + elm_check_state_set(ck, EINA_TRUE); + gitem->ugd->thumbs_d->tot_selected++; +#ifdef FEATURE_SIZE_CHECK + ugd->selsize += stFileInfo.st_size; +#endif + gitem->checked = TRUE; + } else { + sit = doc_data_util_new_sel_item(gitem); + if (!sit) { + doc_dbgE("Invalid select item"); + return; + } +#ifdef FEATURE_SIZE_CHECK + struct stat stFileInfo; + stat(sit->file_url, &stFileInfo); +#endif + doc_sdbg("remove Path: %s", sit->file_url); + EINA_LIST_FOREACH(ugd->selected_elist, l, sit1) { + if (sit1 && !strcmp(sit->file_url, sit1->file_url)) { + ugd->selected_elist = eina_list_remove(ugd->selected_elist, sit1); + doc_data_util_free_sel_item(sit1); + } + } + elm_check_state_set(ck, EINA_FALSE); + gitem->ugd->thumbs_d->tot_selected--; +#ifdef FEATURE_SIZE_CHECK + ugd->selsize -= stFileInfo.st_size; +#endif + gitem->checked = FALSE; + doc_data_util_free_sel_item(sit); + } + + btn = elm_object_item_part_content_get(ugd->nf_it, DOC_NAVIFRAME_TITLE_RIGHT_BTN); + if (btn == NULL) { + doc_dbgE("Failed to get part information"); + } + + if (ugd->thumbs_d->tot_selected == 0) { + elm_object_disabled_set(btn, EINA_TRUE); + } else { + elm_object_disabled_set(btn, EINA_FALSE); + } + + if (gitem->ugd->thumbs_d->tot_selected >= 0) { + text = g_strdup_printf(pd_selected, gitem->ugd->thumbs_d->tot_selected); + elm_object_item_text_set(gitem->ugd->nf_it, text); + } + } +} + +static void _doc_list_navi_cancel_cb(void *data, Evas_Object *obj, void *ei) +{ + doc_ugdata *app_data = (doc_ugdata *)data; + Eina_List *l = NULL; + doc_item *gitem = NULL; + + if (app_data->is_attach_panel && (app_data->attach_panel_display_mode == ATTACH_PANEL_FULL_MODE)) { + + int ret; + app_control_h app_control = NULL; + ret = app_control_create(&app_control); + if (ret == APP_CONTROL_ERROR_NONE) { + app_control_add_extra_data(app_control, ATTACH_PANEL_FLICK_MODE_KEY, ATTACH_PANEL_FLICK_MODE_ENABLE); + app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, + NULL, 0); + ret = ug_send_result_full(app_data->ug, app_control, APP_CONTROL_RESULT_FAILED); + } + app_control_destroy(app_control); + } + + EINA_LIST_FOREACH(app_data->thumbs_d->medias_elist, l, gitem) { + if (gitem) { + gitem->checked = false; + } + } + + app_data->selected_elist = eina_list_free(app_data->selected_elist); + elm_naviframe_item_pop(app_data->naviframe); +} + +void doc_list_change_selection_mode(doc_ugdata *ugd, bool state) +{ + DOC_CHECK(ugd); + DOC_CHECK(ugd->thumbs_d); + + if (ugd->thumbs_d->genlist) { + if (ugd->is_attach_panel && (ugd->attach_panel_display_mode != ATTACH_PANEL_FULL_MODE)) { + elm_scroller_movement_block_set(ugd->thumbs_d->genlist, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); + } else { + elm_scroller_movement_block_set(ugd->thumbs_d->genlist, ELM_SCROLLER_MOVEMENT_NO_BLOCK); + } + } +} + +static void _doc_list_move_stop_cb(void *data, Evas_Object *obj, void *ei) +{ + doc_dbg(""); + DOC_CHECK(data); + doc_ugdata *ugd = (doc_ugdata *)data; + int x, y, w, h; + int ret; + elm_scroller_region_get(obj, &x, &y, &w, &h); + + app_control_h app_control = NULL; + ret = app_control_create(&app_control); + if (ret == APP_CONTROL_ERROR_NONE) { + if (y == 0) { + app_control_add_extra_data(app_control, ATTACH_PANEL_FLICK_MODE_KEY, ATTACH_PANEL_FLICK_MODE_ENABLE); + } else { + app_control_add_extra_data(app_control, ATTACH_PANEL_FLICK_MODE_KEY, ATTACH_PANEL_FLICK_MODE_DISABLE); + } + ret = ug_send_result_full(ugd->ug, app_control, APP_CONTROL_RESULT_SUCCEEDED); + } + app_control_destroy(app_control); +} + +int _doc_ui_update_label_text(Elm_Object_Item *nf_it, int sel_cnt) +{ + DOC_CHECK_VAL(nf_it, -1); + doc_sdbg("Count: %d, text: %s", sel_cnt); + char *pd_selected = DOC_STR_PD_SELECTED; + + /* Update the label text */ + if (sel_cnt > 0) { + char *text = NULL; + text = g_strdup_printf(pd_selected, sel_cnt); + elm_object_item_text_set(nf_it, text); + DOC_GFREEIF(text); + } else { + /* Don't need to update text if it's called by language_changed_cb*/ + elm_object_item_text_set(nf_it, pd_selected); + doc_ui_set_translatable_item(nf_it, pd_selected); + } + return 0; +} + +static int _doc_list_get_sel_cnt(doc_ugdata *ugd) +{ + if (ugd == NULL || ugd->selected_elist == NULL || + ugd->thumbs_d == NULL) { + return 0; + } + + return eina_list_count(ugd->selected_elist); +} + +int _doc_list_update_lang(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + DOC_CHECK_VAL(ugd->thumbs_d, -1); + doc_dbg(""); + + Elm_Object_Item *nf_it = elm_naviframe_top_item_get(ugd->naviframe); + if (nf_it == NULL) { + doc_dbgE("Invalid naviframe item!"); + return -1; + } + int count = _doc_list_get_sel_cnt(ugd); + /* Update the label text */ + _doc_ui_update_label_text(nf_it, count); + return 0; +} + +int doc_list_lang_update(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + + _doc_list_update_lang(ugd); + return 0; +} + +int doc_update_genlist(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + DOC_CHECK_VAL(ugd->thumbs_d, -1); + + int ret = 0; + int i = 0; + doc_item* gitem = NULL; + int item_cnt = 0; + char *pd_selected = DOC_STR_PD_SELECTED; + doc_sel_item_s *sit = NULL; + Eina_List *l = NULL; + int win_x = 0; + int win_y = 0; + int win_w = 0; + int win_h = 0; + + elm_win_screen_size_get(ugd->win, &win_x, &win_y, &win_w, &win_h); + + if (ugd->thumbs_d->medias_elist) { + doc_data_util_free_mtype_items(&ugd->thumbs_d->medias_elist); + } + + ugd->thumbs_d->medias_cnt = 0; + + ugd->thumbs_d->tot_selected = 0; + + ret = doc_data_get_media_data(ugd, + DOC_ALL, + 0, + DOC_GET_UNTIL_LAST_RECORD, + &(ugd->thumbs_d->medias_elist), + NULL, NULL); + + if (ret != 0) { + doc_dbgE("###Get items list over[%d]###", ret); + return ret; + } + + ugd->thumbs_d->medias_cnt = eina_list_count(ugd->thumbs_d->medias_elist); + doc_dbg("Grid view updated media count: %d", ugd->thumbs_d->medias_cnt); + + + if (ugd->thumbs_d->medias_cnt == 0) { + doc_data_util_free_mtype_items(&ugd->selected_elist); + } else { + EINA_LIST_FOREACH(ugd->selected_elist, l, sit) { + bool flag = false; + for (i = 0; i < ugd->thumbs_d->medias_cnt; i++) { + gitem = eina_list_nth(ugd->thumbs_d->medias_elist, i); + if (gitem == NULL || gitem->item == NULL || + gitem->item->uuid == NULL) { + doc_dbgE("Invalid gitem!"); + continue; + } + if (sit && strcmp(sit->file_url, gitem->item->file_url) == 0) { + flag = true; + break; + } + } + if (flag == false) { + ugd->selected_elist = eina_list_remove(ugd->selected_elist, sit); + doc_data_util_free_sel_item(sit); + } + } + } + + elm_genlist_clear(ugd->thumbs_d->genlist); + if (ugd->thumbs_d->medias_cnt > 0) { + if (ugd->nocontents) { + evas_object_del(ugd->nocontents); + ugd->nocontents = NULL; + } + + for (i = 0; i < ugd->thumbs_d->medias_cnt; i++) { + gitem = eina_list_nth(ugd->thumbs_d->medias_elist, i); + if (gitem == NULL || gitem->item == NULL || + gitem->item->uuid == NULL) { + doc_dbgE("Invalid gitem!"); + continue; + } + + if (!gitem->item->file_url) { + doc_dbgE("file_url is invalid!"); + doc_del_media_data_by_id(ugd, gitem->item->uuid); + doc_data_util_free_item(gitem); + ugd->thumbs_d->medias_cnt--; + i--; + gitem = NULL; + continue; + } + + if (ugd->selected_elist) { + EINA_LIST_FOREACH(ugd->selected_elist, l, sit) { + if (sit && strcmp(sit->file_url, gitem->item->file_url) == 0) { + gitem->checked = true; + ugd->thumbs_d->tot_selected++; + } + } + } + + gitem->ugd = ugd; + gitem->elm_item = elm_genlist_item_append(ugd->thumbs_d->genlist, + ugd->thumbs_d->gic, + gitem, NULL, ELM_GENLIST_ITEM_NONE, _doc_list_item_sel_cb, + gitem); + + item_cnt++; + gitem->sequence = item_cnt + 1; + + evas_object_show(ugd->thumbs_d->genlist); + + elm_object_part_content_set(ugd->list_view, "contents", ugd->thumbs_d->genlist); + } + } else { + Evas_Object *nocontent_ly = _doc_nocontent_create(ugd); + elm_object_part_content_set(ugd->list_view, "contents", nocontent_ly); + } + + Evas_Object *btn = NULL; + + btn = elm_object_item_part_content_get(ugd->nf_it , DOC_NAVIFRAME_TITLE_RIGHT_BTN); + if (btn == NULL) { + doc_dbgE("Failed to get part information"); + } + + if (ugd->thumbs_d->tot_selected == 0) { + elm_object_disabled_set(btn, EINA_TRUE); + } else { + elm_object_disabled_set(btn, EINA_FALSE); + } + + char *text = g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected); + elm_object_item_text_set(ugd->nf_it, text); + + return 0; +} + +int doc_create_genlist(doc_ugdata *ugd) +{ + doc_dbgE(""); + DOC_CHECK_VAL(ugd, -1); + + ugd->list_view = _doc_list_add_view(ugd, ugd->list_view_ly); + + ugd->attach_panel_display_mode = ATTACH_PANEL_HALF_MODE; + + doc_dbgE("!!!!! List view !!!!!!!! is pushed in the naviframe"); + + int i = 0; + doc_item* gitem = NULL; + int item_cnt = 0; + int ret = -1; + + doc_thumbs_s *thumbs_d = NULL; + thumbs_d = (doc_thumbs_s *)calloc(1, sizeof(doc_thumbs_s)); + DOC_CHECK_VAL(thumbs_d, -1); + ugd->thumbs_d = thumbs_d; + ugd->thumbs_d->store_type = DOC_ALL; + ugd->thumbs_d->b_multifile = true; + ugd->thumbs_d->b_mainview = true; + ugd->thumbs_d->b_editmode = false; + ugd->thumbs_d->tot_selected = 0; + + ugd->attach_panel_display_mode = ATTACH_PANEL_HALF_MODE; + ugd->file_select_mode = DOC_FILE_SELECT_T_ONE; + + ret = doc_data_get_media_data(ugd, + DOC_ALL, + 0, + DOC_GET_UNTIL_LAST_RECORD, + &(ugd->thumbs_d->medias_elist), + NULL, NULL); + + if (ret != 0) { + doc_dbgE("###Get items list over[%d]###", ret); + } + + ugd->thumbs_d->medias_cnt = eina_list_count(ugd->thumbs_d->medias_elist); + doc_dbg("List view all medias count: %d", ugd->thumbs_d->medias_cnt); + + Evas_Object *genlist; + char edj_path[PATH_MAX] = {0, }; + + + _doc_list_get_app_resource(DOC_EDJ_FILE, edj_path, (int)PATH_MAX); + + genlist = elm_genlist_add(ugd->list_view); + ugd->thumbs_d->genlist = genlist; + elm_theme_extension_add(NULL, edj_path); + + elm_scroller_bounce_set(genlist, EINA_FALSE, EINA_TRUE); + + elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_AUTO); + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + if (ugd->is_attach_panel && (ugd->attach_panel_display_mode != ATTACH_PANEL_FULL_MODE)) { + elm_scroller_movement_block_set(genlist, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL); + } + + if (ugd->is_attach_panel) { + evas_object_smart_callback_add(genlist, "scroll,anim,stop", + _doc_list_move_stop_cb, ugd); + evas_object_smart_callback_add(genlist, "scroll,drag,stop", + _doc_list_move_stop_cb, ugd); + } + + ugd->thumbs_d->gic = elm_genlist_item_class_new(); + + if (ugd->thumbs_d->gic) { + ugd->thumbs_d->gic->item_style = "default"; + ugd->thumbs_d->gic->func.text_get = _doc_list_text_get_cb; + ugd->thumbs_d->gic->func.content_get = _doc_list_item_content_get; + ugd->thumbs_d->gic->func.state_get = NULL; + ugd->thumbs_d->gic->func.del = NULL; + } + + if (ugd->thumbs_d->medias_cnt > 0) { + for (i = 0; i < ugd->thumbs_d->medias_cnt; i++) { + gitem = eina_list_nth(ugd->thumbs_d->medias_elist, i); + if (gitem == NULL || gitem->item == NULL || + gitem->item->uuid == NULL) { + doc_dbgE("Invalid gitem!"); + continue; + } + + if (!gitem->item->file_url) { + doc_dbgE("file_url is invalid!"); + doc_del_media_data_by_id(ugd, gitem->item->uuid); + doc_data_util_free_item(gitem); + ugd->thumbs_d->medias_cnt--; + i--; + gitem = NULL; + continue; + } + + gitem->ugd = ugd; + gitem->elm_item = elm_genlist_item_append(genlist, + ugd->thumbs_d->gic, + gitem, NULL, ELM_GENLIST_ITEM_NONE, _doc_list_item_sel_cb, + gitem); + + item_cnt++; + gitem->sequence = item_cnt + 1; + + evas_object_show(genlist); + + elm_object_part_content_set(ugd->list_view, "contents", genlist); + } + } else { + Evas_Object *nocontent_ly = _doc_nocontent_create(ugd); + elm_object_part_content_set(ugd->list_view, "contents", nocontent_ly); + } + + char *pd_selected = DOC_STR_PD_SELECTED; + ugd->nf_it = elm_naviframe_item_push(ugd->naviframe, g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected), NULL, NULL, ugd->list_view, "basic/transparent"); + + /* Cancel Button */ + Evas_Object *btn1 = elm_button_add(ugd->naviframe); + elm_object_style_set(btn1, "naviframe/title_left"); + doc_ui_set_translate_str(btn1, "IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"); + elm_object_item_part_content_set(ugd->nf_it, DOC_NAVIFRAME_TITLE_LEFT_BTN, btn1); + evas_object_show(btn1); + evas_object_smart_callback_add(btn1, "clicked", _doc_list_navi_cancel_cb, ugd); + + /* Done Button*/ + Evas_Object *btn2 = elm_button_add(ugd->naviframe); + elm_object_style_set(btn2, "naviframe/title_right"); + doc_ui_set_translate_str(btn2, "IDS_TPLATFORM_ACBUTTON_DONE_ABB"); + elm_object_disabled_set(btn2, EINA_TRUE); + elm_object_item_part_content_set(ugd->nf_it, DOC_NAVIFRAME_TITLE_RIGHT_BTN, btn2); + evas_object_show(btn2); + evas_object_smart_callback_add(btn2, "clicked", _doc_list_navi_done_cb, (void *)ugd); + + elm_naviframe_item_title_enabled_set(ugd->nf_it, EINA_FALSE, EINA_FALSE); + + elm_naviframe_item_pop_cb_set(ugd->nf_it, _data_list_back_cb, ugd); + + return 0; +} diff --git a/src/doc-local-data.c b/src/doc-local-data.c new file mode 100644 index 0000000..04c990a --- /dev/null +++ b/src/doc-local-data.c @@ -0,0 +1,322 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +#include <stdio.h> +#include <media_content.h> +#include <media_info.h> +#include <glib.h> +#include <string.h> +#include "doc-data-util.h" +#include "doc-local-data.h" +#include "doc-debug.h" + + +static bool _doc_local_data_clone_album(media_folder_h folder, bool b_path, + doc_folder_s **palbum) +{ + DOC_CHECK_FALSE(folder); + DOC_CHECK_FALSE(palbum); + doc_folder_s *album = NULL; + + album = (doc_folder_s *)calloc(1, sizeof(doc_folder_s)); + if (album == NULL) { + doc_dbgE("Failed to calloc!"); + return false; + } + album->gtype = DOC_TYPE_FOLDER; + + if (b_path) { + if (media_folder_get_path(folder, &(album->path)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get folder path failed!"); + goto DOC_LOCAL_FAILED; + } + } + if (media_folder_get_folder_id(folder, &(album->uuid)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get folder id failed!"); + goto DOC_LOCAL_FAILED; + } + if (media_folder_get_modified_time(folder, &(album->mtime)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get modified time failed!"); + goto DOC_LOCAL_FAILED; + } + + media_content_storage_e storage_type; + if (media_folder_get_storage_type(folder, &storage_type) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get storage type failed!"); + goto DOC_LOCAL_FAILED; + } + + if (storage_type == MEDIA_CONTENT_STORAGE_INTERNAL) { /* The device's internal storage */ + album->type = DOC_PHONE; + } else if (storage_type == MEDIA_CONTENT_STORAGE_EXTERNAL) { /* The device's external storage */ + album->type = DOC_MMC; + } else { + doc_dbgE("Undefined mode[%d]!", storage_type); + } + + if (media_folder_get_name(folder, &(album->display_name)) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get folder name failed!"); + goto DOC_LOCAL_FAILED; + } + + *palbum = album; + return true; + +DOC_LOCAL_FAILED: + + doc_data_type_free_geitem((void **)(&album)); + *palbum = NULL; + return false; +} + +static bool _doc_local_data_get_media_list_cb(media_info_h media, void *data) +{ + DOC_CHECK_FALSE(data); + doc_transfer_data_s *td = (doc_transfer_data_s *)data; + DOC_CHECK_FALSE(td->userdata); + DOC_CHECK_FALSE(media); + doc_media_s *item = NULL; + + Eina_List **elist = (Eina_List **)(td->userdata); + + if (doc_data_util_clone_media(media, &item, td->with_meta)) { + *elist = eina_list_append(*elist, item); + return true; + } else { + return false; + } +} + +int doc_local_data_connect(void) +{ + int ret = -1; + + ret = media_content_connect(); + if (ret == MEDIA_CONTENT_ERROR_NONE) { + doc_dbg("DB connection is success"); + return 0; + } else { + doc_dbgE("DB connection is failed!"); + return -1; + } +} + +int doc_local_data_disconnect(void) +{ + int ret = -1; + + ret = media_content_disconnect(); + if (ret == MEDIA_CONTENT_ERROR_NONE) { + doc_dbg("DB disconnection is success"); + return 0; + } else { + doc_dbgE("DB disconnection is failed!"); + return -1; + } +} + +static bool _doc_local_data_get_album_list_cb(media_folder_h folder, + void *data) +{ + DOC_CHECK_FALSE(data); + doc_transfer_data_s *tmp_data = (doc_transfer_data_s *)data; + DOC_CHECK_FALSE(tmp_data->userdata); + DOC_CHECK_FALSE(folder); + Eina_List **elist = (Eina_List **)(tmp_data->userdata); + doc_folder_s *album = NULL; + + char *path = NULL; + if (media_folder_get_path(folder, &path) != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get folder path failed!"); + return false; + } + DOC_CHECK_FALSE(path); + + if (tmp_data->list_type != DOC_ALBUM_LIST_PATH) { + if (!g_strcmp0(DOC_CAMERA_PATH_PHONE, path) || + !g_strcmp0(DOC_CAMERA_PATH_MMC, path) || + !g_strcmp0(DOC_DOWNLOADS_PATH, path)) { + doc_dbgW("Camera or Downloads!"); + DOC_FREE(path); + return true; + } + } + + _doc_local_data_clone_album(folder, false, &album); + if (album == NULL) { + DOC_FREE(path); + doc_dbgE("Failed clone album!"); + return false; + } + album->path = path; + + *elist = eina_list_append(*elist, album); + return true; +} + +static int _doc_local_data_get_album_list(doc_filter_s *condition, Eina_List **elilst) +{ + DOC_CHECK_VAL(elilst, -1); + DOC_CHECK_VAL(condition, -1); + int ret = -1; + filter_h filter = NULL; + + ret = doc_data_util_create_filter(condition, &filter); + if (ret != 0) { + doc_dbgE("Create filter failed[%d]!", ret); + return -1; + } + + doc_transfer_data_s tran_data; + memset(&tran_data, 0x00, sizeof(doc_transfer_data_s)); + tran_data.userdata = (void **)elilst; + tran_data.album_id = NULL; + tran_data.with_meta = false; + tran_data.list_type = condition->list_type; + + doc_dbg("Get folders--start"); + ret = media_folder_foreach_folder_from_db(filter, + _doc_local_data_get_album_list_cb, + &tran_data); + doc_dbg("Get folders--over"); + + doc_data_util_destroy_filter(filter); + + if (ret != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get folders failed[%d]!", ret); + return -1; + } + + return 0; +} + +int doc_local_data_get_folder_by_path(char *path, doc_folder_s **folder) +{ + DOC_CHECK_VAL(path, -1); + DOC_CHECK_VAL(folder, -1); + int ret = -1; + Eina_List *list = NULL; + doc_filter_s condition; + doc_folder_s *_item = NULL; + int i = 0; + + if (strlen(path) <= 0) { + doc_dbgE("Invalid path!"); + return -1; + } + doc_dbg("path: %s", path); + + memset(&condition, 0x00, sizeof(doc_filter_s)); + condition.collate_type = MEDIA_CONTENT_COLLATE_NOCASE; + condition.sort_type = MEDIA_CONTENT_ORDER_DESC; + condition.offset = -1; + condition.count = -1; + condition.with_meta = false; + condition.list_type = DOC_ALBUM_LIST_PATH; + + snprintf(condition.cond, CONDITION_LENGTH, "%s AND %s=\'%s\'", + DOC_CONDITION_IMAGE_VIDEO, FOLDER_PATH, path); + + ret = _doc_local_data_get_album_list(&condition, &list); + if (ret != 0 || NULL == list) { + doc_dbgE("Failed to get album list[%d]!", ret); + ret = -1; + } else if (NULL != list) { + *folder = eina_list_nth(list, 0); + i = 1; + ret = 0; + } + + /* Free other items */ + if (list) { + int len = eina_list_count(list); + doc_dbg("len: %d", len); + + for (; i < len; i++) { + _item = eina_list_nth(list, i); + doc_data_type_free_geitem((void **)(&_item)); + } + + eina_list_free(list); + } + + return ret; +} + +int doc_local_data_get_all_media_count(doc_filter_s *condtion, int *item_cnt) +{ + DOC_CHECK_VAL(condtion, -1); + DOC_CHECK_VAL(item_cnt, -1); + int ret = -1; + filter_h filter = NULL; + + ret = doc_data_util_create_filter(condtion, &filter); + if (ret != 0) { + doc_dbgE("Create filter failed[%d]!", ret); + return -1; + } + + doc_dbg("Get media count--start"); + ret = media_info_get_media_count_from_db(filter, item_cnt); + doc_dbg("Get media count--over"); + + doc_data_util_destroy_filter(filter); + + if (ret != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get media count failed[d]!", ret); + return -1; + } + + return 0; +} + +int doc_local_data_get_all_folders_media_list(doc_filter_s *condition, + Eina_List **elist) +{ + DOC_CHECK_VAL(elist, -1); + DOC_CHECK_VAL(condition, -1); + int ret = -1; + filter_h filter = NULL; + + ret = doc_data_util_create_filter(condition, &filter); + if (ret != 0) { + doc_dbgE("Create filter failed!"); + return -1; + } + + doc_transfer_data_s tran_data; + memset(&tran_data, 0x00, sizeof(doc_transfer_data_s)); + tran_data.userdata = (void **)elist; + tran_data.album_id = NULL; + tran_data.with_meta = condition->with_meta; + + doc_dbg("Get all medias--start"); + ret = media_info_foreach_media_from_db(filter, + _doc_local_data_get_media_list_cb, + &tran_data); + doc_dbg("Get all medias--over"); + + doc_data_util_destroy_filter(filter); + + if (ret != MEDIA_CONTENT_ERROR_NONE) { + doc_dbgE("Get all medias failed[d]!", ret); + return -1; + } + + return 0; +} + diff --git a/src/doc-main-view.c b/src/doc-main-view.c new file mode 100644 index 0000000..0bb6716 --- /dev/null +++ b/src/doc-main-view.c @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 "attach-panel-document.h" +#include "doc-main-view.h" +#include "doc-ui-util.h" +#include "doc-list.h" + +static Evas_Object *_doc_main_create_ly(doc_ugdata *ugd, Evas_Object *parent) +{ + doc_dbg(""); + DOC_CHECK_NULL(parent); + Evas_Object *layout = doc_ui_load_edj(parent, DOC_EDJ_FILE, + DOC_GRP_LISTVIEW); + DOC_CHECK_NULL(layout); + evas_object_show(layout); + return layout; +} + +int doc_main_view_create(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + DOC_CHECK_VAL(ugd->naviframe, -1); + /* Create layout of list view */ + ugd->list_view_ly = _doc_main_create_ly(ugd, ugd->naviframe); + DOC_CHECK_VAL(ugd->list_view_ly, -1); + + doc_create_genlist(ugd); + return 0; +} + diff --git a/src/doc-ui-util.c b/src/doc-ui-util.c new file mode 100644 index 0000000..dd4ddf9 --- /dev/null +++ b/src/doc-ui-util.c @@ -0,0 +1,232 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 <notification.h> +#include "doc-ui-util.h" +#include "doc-list.h" +#include "doc-data.h" +#include <efl_extension.h> + +#define DOC_NOBUT_EXIT_POPUP_HIDE_TIME_DELAY 3.0 + +Evas_Object* doc_ui_load_edj(Evas_Object *parent, const char *file, const char *group) +{ + DOC_CHECK_NULL(parent); + DOC_CHECK_NULL(file); + DOC_CHECK_NULL(group); + Evas_Object *eo; + int r; + + eo = elm_layout_add(parent); + if (eo) { + r = elm_layout_file_set(eo, file, group); + if (!r) { + doc_dbg("failed to load layout"); + evas_object_del(eo); + return NULL; + } + + evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(eo, EVAS_HINT_FILL, EVAS_HINT_FILL); + } + + return eo; +} + +//[ToDo] Check for NoContent +Evas_Object* ge_ui_create_nocontents(doc_ugdata* ugd) +{ + DOC_CHECK_NULL(ugd); + Evas_Object *layout = NULL; + char label_str[DOC_NOCONTENTS_LABEL_LEN_MAX] = {0,}; + snprintf(label_str, sizeof(label_str), + "%s", (char*)DOC_STR_NO_ITEMS); + + doc_dbg("\nNocontents label: %s", label_str); + /* Full nocontents view layout */ + layout = elm_layout_add(ugd->naviframe); + DOC_CHECK_NULL(layout); + elm_layout_theme_set(layout, "layout", "nocontents", "text"); + elm_object_part_text_set(layout, "elm.text", label_str); + + return layout; +} + +Evas_Object *doc_ui_create_main_ly(Evas_Object *parent) +{ + DOC_CHECK_NULL(parent); + Evas_Object *layout = NULL; + + layout = elm_layout_add(parent); + DOC_CHECK_NULL(layout); + + /* Apply the layout style */ + const char *profile = elm_config_profile_get(); + doc_dbg("profile: %s", profile); + if (!g_strcmp0(profile, "mobile")) { + elm_layout_theme_set(layout, "layout", "application", + "default"); + } else if (!g_strcmp0(profile, "extension")) { + elm_layout_theme_set(layout, "layout", "application", + "noindicator"); + } 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* doc_ui_create_naviframe(doc_ugdata *ugd, Evas_Object *parent) +{ + DOC_CHECK_NULL(ugd); + DOC_CHECK_NULL(parent); + Evas_Object *nf = NULL; + + nf = elm_naviframe_add(parent); + DOC_CHECK_NULL(nf); + /* Disable Naviframe Back Button Auto creation function */ + elm_naviframe_prev_btn_auto_pushed_set(nf, EINA_FALSE); + if (ugd->th) { + elm_object_theme_set(nf, ugd->th); + } + elm_object_part_content_set(parent, "elm.swallow.content", nf); + + evas_object_show(nf); + + return nf; +} + +//[ToDo] Check for scroller +int _ge_ui_reset_scroller_pos(Evas_Object *obj) +{ + DOC_CHECK_VAL(obj, -1); + evas_object_data_set(obj, "prev_scroller_x", (void *)0); + evas_object_data_set(obj, "prev_scroller_y", (void *)0); + evas_object_data_set(obj, "prev_scroller_w", (void *)0); + evas_object_data_set(obj, "prev_scroller_h", (void *)0); + return 0; +} + +int _ge_ui_del_scroller_pos(Evas_Object *obj) +{ + DOC_CHECK_VAL(obj, -1); + evas_object_data_del(obj, "prev_scroller_x"); + evas_object_data_del(obj, "prev_scroller_y"); + evas_object_data_del(obj, "prev_scroller_w"); + evas_object_data_del(obj, "prev_scroller_h"); + return 0; +} + +int _ge_ui_save_scroller_pos(Evas_Object *obj) +{ + DOC_CHECK_VAL(obj, -1); + Evas_Coord x = 0; + Evas_Coord y = 0; + Evas_Coord w = 0; + Evas_Coord h = 0; + + elm_scroller_region_get(obj, &x, &y, &w, &h); + doc_dbg("(%dx%d), (%dx%d)", x, y, w, h); + evas_object_data_set(obj, "prev_scroller_x", (void *)x); + evas_object_data_set(obj, "prev_scroller_y", (void *)y); + evas_object_data_set(obj, "prev_scroller_w", (void *)w); + evas_object_data_set(obj, "prev_scroller_h", (void *)h); + return 0; +} + +int _ge_ui_restore_scroller_pos(Evas_Object *obj) +{ + DOC_CHECK_VAL(obj, -1); + Evas_Coord x = 0; + Evas_Coord y = 0; + Evas_Coord w = 0; + Evas_Coord h = 0; + + x = (Evas_Coord)evas_object_data_get(obj, "prev_scroller_x"); + y = (Evas_Coord)evas_object_data_get(obj, "prev_scroller_y"); + w = (Evas_Coord)evas_object_data_get(obj, "prev_scroller_w"); + h = (Evas_Coord)evas_object_data_get(obj, "prev_scroller_h"); + doc_dbg("(%dx%d), (%dx%d)", x, y, w, h); + if (w > 0 && h > 0) { + elm_scroller_region_show(obj, x, y, w, h); + } + return 0; +} + +int doc_ui_set_translate_str(Evas_Object *obj, const char *str) +{ + DOC_CHECK_VAL(str, -1); + DOC_CHECK_VAL(obj, -1); + char *domain = DOC_STR_DOMAIN_LOCAL; + elm_object_domain_translatable_text_set(obj, domain, str); + return 0; +} + +int doc_ui_set_translate_part_str(Evas_Object *obj, const char *part, + const char *str) +{ + DOC_CHECK_VAL(str, -1); + DOC_CHECK_VAL(part, -1); + DOC_CHECK_VAL(obj, -1); + + char *domain = DOC_STR_DOMAIN_LOCAL; + + elm_object_domain_translatable_part_text_set(obj, part, domain, str); + + return 0; +} + +int doc_ui_set_translatable_item(Elm_Object_Item *nf_it, const char *str) +{ + DOC_CHECK_VAL(str, -1); + DOC_CHECK_VAL(nf_it, -1); + char *domain = DOC_STR_DOMAIN_LOCAL; + elm_object_item_domain_text_translatable_set(nf_it, domain, EINA_TRUE); + return 0; +} + +int doc_ui_get_indicator_state(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + /* Save old view's indicator values */ + ugd->indi_mode = elm_win_indicator_mode_get(ugd->win); + ugd->indi_o_mode = elm_win_indicator_opacity_get(ugd->win); + doc_dbgW("indi_o_mode: %d, indi_mode: %d", ugd->indi_o_mode, + ugd->indi_mode); + /* Save old view's overlap mode */ + ugd->overlap_mode = (int)evas_object_data_get(ugd->conform, "overlap"); + doc_dbgW("overlap_mode: %d", ugd->overlap_mode); + return 0; +} + +int doc_ui_hide_indicator(doc_ugdata *ugd) +{ + DOC_CHECK_VAL(ugd, -1); + /* transparent indicator setting */ + elm_win_indicator_mode_set(ugd->win, ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_opacity_set(ugd->win, ELM_WIN_INDICATOR_TRANSPARENT); + /* Modify to start content from 0,0 */ + elm_object_signal_emit(ugd->conform, "elm,state,indicator,overlap", ""); + /* Save overlap mode when showing new view(ex: ug) */ + evas_object_data_set(ugd->conform, "overlap", (void *)EINA_TRUE); + return 0; +} + diff --git a/src/doc-util.c b/src/doc-util.c new file mode 100644 index 0000000..98e7e76 --- /dev/null +++ b/src/doc-util.c @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 +* +* 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 <sys/stat.h> +#include <errno.h> +#include <unistd.h> +#include <stdlib.h> +#include <math.h> +#include <storage.h> +#include "doc-list.h" +#include "doc-data.h" +#include "doc-util.h" +#include "doc-ui-util.h" + +static int __externalStorageId = 0; + +static bool _doc_util_getSupportedStorages_cb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) +{ + doc_dbg(""); + + if (type == STORAGE_TYPE_EXTERNAL) { + __externalStorageId = storageId; + return false; + } + + return true; +} + +static void _doc_db_update_sdcard_info(int storage_id, storage_state_e state, void *user_data) +{ + doc_dbgW("Storage state changed!"); + DOC_CHECK(user_data); + + int error = storage_foreach_device_supported(_doc_util_getSupportedStorages_cb, NULL); + if (error == STORAGE_ERROR_NONE) { + storage_state_e mmc_state; + int ret = storage_get_state(__externalStorageId, &mmc_state); + if (ret != STORAGE_ERROR_NONE) { + doc_dbgE("storage_get_state failed!"); + return; + } + + /* Update view */ + if (mmc_state == STORAGE_STATE_MOUNTED) { + doc_dbg("mmc_state[%d]: STORAGE_STATE_MOUNTED", mmc_state); + doc_update_view((doc_ugdata*)user_data, DOC_UPDATE_MMC_ADDED); + } else if (mmc_state == STORAGE_STATE_REMOVED) { + doc_dbg("mmc_state[%d]: STORAGE_STATE_REMOVED", mmc_state); + doc_update_view((doc_ugdata*)user_data, DOC_UPDATE_MMC_REMOVED); + } else if (mmc_state == STORAGE_STATE_UNMOUNTABLE) { + doc_dbg("mmc_state[%d]: STORAGE_STATE_UNMOUNTABLE", mmc_state); + doc_update_view((doc_ugdata*)user_data, DOC_UPDATE_MMC_REMOVED); + } + } +} + +Eina_Bool doc_update_view(doc_ugdata* ugd, int mode) +{ + doc_dbg("mode: %d", mode); + DOC_CHECK_FALSE(ugd); + int ret = -1; + + ret = doc_update_genlist(ugd); + + if (ret != 0) { + return EINA_FALSE; + } + return EINA_TRUE; +} + +int doc_reg_db_update_noti(doc_ugdata* ugd) +{ + doc_dbg(""); + DOC_CHECK_VAL(ugd, -1); + int error_code = 0; + + error_code = storage_set_state_changed_cb(__externalStorageId, _doc_db_update_sdcard_info, ugd); + if (error_code != STORAGE_ERROR_NONE) { + doc_dbgE("storage_set_state_changed_cb failed!"); + } + return 0; +} + +int doc_dereg_db_update_noti(void) +{ + doc_dbg(""); + int error_code = -1; + + error_code = storage_unset_state_changed_cb(__externalStorageId, _doc_db_update_sdcard_info); + if (error_code != STORAGE_ERROR_NONE) { + doc_dbgE("storage_set_state_changed_cb failed!"); + } + + return 0; +} + +int doc_atoi(const char *number) +{ + char *endptr = NULL; + long val = 0; + + errno = 0; + + val = strtol(number, &endptr, 10); + + if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) || (errno != 0 && val == 0)) { + doc_dbgE("strtol, val = %d", val); + return -1; + } + + if (endptr == number) { + doc_dbgE("No digits were found, number = %s", number); + return -1; + } + + return (int)val; +} + |