diff options
-rw-r--r-- | CMakeLists.txt | 22 | ||||
-rwxr-xr-x | NOTICE | 1 | ||||
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 31 | ||||
-rw-r--r-- | debian/copyright | 0 | ||||
-rw-r--r-- | debian/libug-myfile-efl.install.in | 3 | ||||
-rwxr-xr-x | debian/rules | 127 | ||||
-rw-r--r-- | icons/01_myfile_add_icon.png | bin | 256 -> 0 bytes | |||
-rw-r--r-- | icons/06_myfiles_list_folder.png | bin | 1729 -> 0 bytes | |||
-rw-r--r-- | icons/47_myfiles_icon_music.png | bin | 7531 -> 0 bytes | |||
-rw-r--r-- | icons/47_myfiles_icon_ring_tone.png | bin | 8576 -> 0 bytes | |||
-rw-r--r-- | icons/60_myfiles_file_amr.png | bin | 2022 -> 0 bytes | |||
-rw-r--r-- | icons/60_myfiles_file_etc.png | bin | 1292 -> 0 bytes | |||
-rw-r--r-- | icons/60_myfiles_icon_music_default.png | bin | 1770 -> 0 bytes | |||
-rw-r--r-- | icons/60_myfiles_icon_vText.png | bin | 1350 -> 0 bytes | |||
-rw-r--r-- | icons/60_myfiles_icon_vcalender.png | bin | 1706 -> 0 bytes | |||
-rw-r--r-- | icons/60_myfiles_icon_vcard.png | bin | 1606 -> 0 bytes | |||
-rw-r--r-- | icons/myfile_icon_USB.png (renamed from icons/U01_icon_USB.png) | bin | 3891 -> 3891 bytes | |||
-rw-r--r-- | icons/myfile_icon_cancel.png | bin | 0 -> 3426 bytes | |||
-rw-r--r-- | icons/myfile_icon_control_pause.png (renamed from icons/34_control_pause.png) | bin | 3013 -> 3013 bytes | |||
-rw-r--r-- | icons/myfile_icon_control_play.png (renamed from icons/34_control_play.png) | bin | 3032 -> 3032 bytes | |||
-rw-r--r-- | icons/myfile_icon_copy.png | bin | 0 -> 1024 bytes | |||
-rw-r--r-- | icons/myfile_icon_create_folder.png | bin | 0 -> 892 bytes | |||
-rw-r--r-- | icons/myfile_icon_delete.png | bin | 0 -> 899 bytes | |||
-rw-r--r-- | icons/myfile_icon_done.png | bin | 0 -> 3007 bytes | |||
-rw-r--r-- | icons/myfile_icon_edit.png | bin | 0 -> 1262 bytes | |||
-rw-r--r-- | icons/myfile_icon_etc.png | bin | 0 -> 5229 bytes | |||
-rw-r--r-- | icons/myfile_icon_excel.png (renamed from icons/47_myfiles_icon_excel.png) | bin | 5986 -> 5986 bytes | |||
-rw-r--r-- | icons/myfile_icon_folder.png | bin | 0 -> 3799 bytes | |||
-rw-r--r-- | icons/myfile_icon_folder_open.png (renamed from icons/47_myfiles_icon_folder_created.png) | bin | 4170 -> 4233 bytes | |||
-rw-r--r-- | icons/myfile_icon_html.png (renamed from icons/47_myfiles_icon_html.png) | bin | 6416 -> 6416 bytes | |||
-rw-r--r-- | icons/myfile_icon_images.png (renamed from icons/60_myfiles_icon_images.png) | bin | 1454 -> 1454 bytes | |||
-rw-r--r-- | icons/myfile_icon_java.png (renamed from icons/60_myfiles_icon_java.png) | bin | 3005 -> 3005 bytes | |||
-rw-r--r-- | icons/myfile_icon_list_by.png | bin | 0 -> 875 bytes | |||
-rw-r--r-- | icons/myfile_icon_mmc.png (renamed from icons/60_myfiles_memorycard.png) | bin | 3006 -> 3006 bytes | |||
-rw-r--r-- | icons/myfile_icon_mmc_sub.png (renamed from icons/60_myfiles_memorycard_sub.png) | bin | 691 -> 691 bytes | |||
-rw-r--r-- | icons/myfile_icon_move.png | bin | 0 -> 1130 bytes | |||
-rw-r--r-- | icons/myfile_icon_move_here.png | bin | 0 -> 873 bytes | |||
-rw-r--r-- | icons/myfile_icon_music.png (renamed from icons/47_myfiles_icon_folder.png) | bin | 4067 -> 4425 bytes | |||
-rw-r--r-- | icons/myfile_icon_paste_here.png | bin | 0 -> 1024 bytes | |||
-rw-r--r-- | icons/myfile_icon_pause_focus.png (renamed from icons/47_myfiles_icon_pause_focus.png) | bin | 2908 -> 2908 bytes | |||
-rw-r--r-- | icons/myfile_icon_pdf.png (renamed from icons/47_myfiles_icon_pdf.png) | bin | 4794 -> 4794 bytes | |||
-rw-r--r-- | icons/myfile_icon_phone.png (renamed from icons/60_myfiles_phone.png) | bin | 3028 -> 3028 bytes | |||
-rw-r--r-- | icons/myfile_icon_play_focus.png (renamed from icons/47_myfiles_icon_play_focus.png) | bin | 3179 -> 3179 bytes | |||
-rw-r--r-- | icons/myfile_icon_ppt.png (renamed from icons/47_myfiles_icon_ppt.png) | bin | 5417 -> 5417 bytes | |||
-rw-r--r-- | icons/myfile_icon_rss.png (renamed from icons/47_myfiles_icon_rss.png) | bin | 5082 -> 5082 bytes | |||
-rw-r--r-- | icons/myfile_icon_search.png | bin | 0 -> 1491 bytes | |||
-rw-r--r-- | icons/myfile_icon_share.png | bin | 0 -> 1106 bytes | |||
-rw-r--r-- | icons/myfile_icon_store_here.png | bin | 0 -> 3147 bytes | |||
-rw-r--r-- | icons/myfile_icon_svg.png | bin | 0 -> 5890 bytes | |||
-rw-r--r-- | icons/myfile_icon_swf.png (renamed from icons/47_myfiles_icon_swf.png) | bin | 5653 -> 5653 bytes | |||
-rw-r--r-- | icons/myfile_icon_text.png (renamed from icons/47_myfiles_icon_text.png) | bin | 4023 -> 4023 bytes | |||
-rw-r--r-- | icons/myfile_icon_upper_folder_black_theme.png (renamed from icons/47_myfiles_icon_upper_folder_black_theme.png) | bin | 3197 -> 3197 bytes | |||
-rw-r--r-- | icons/myfile_icon_upper_folder_focus.png (renamed from icons/47_myfiles_icon_upper_folder_focus.png) | bin | 3134 -> 3134 bytes | |||
-rw-r--r-- | icons/myfile_icon_upper_folder_white_theme.png (renamed from icons/47_myfiles_icon_upper_folder_white_theme.png) | bin | 348 -> 348 bytes | |||
-rw-r--r-- | icons/myfile_icon_video.png (renamed from icons/47_myfiles_icon_video.png) | bin | 8062 -> 8062 bytes | |||
-rw-r--r-- | icons/myfile_icon_video_play.png (renamed from icons/47_myfiles_icon_folder_sinced.png) | bin | 4525 -> 5001 bytes | |||
-rw-r--r-- | icons/myfile_icon_word.png (renamed from icons/47_myfiles_icon_word.png) | bin | 5865 -> 5865 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_excel.png | bin | 0 -> 9778 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_folder.png | bin | 0 -> 4585 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_folder_open.png | bin | 0 -> 5735 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_html.png | bin | 0 -> 10712 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_music.png | bin | 0 -> 7876 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_pdf.png | bin | 0 -> 7328 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_ppt.png | bin | 0 -> 8639 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_rss.png | bin | 0 -> 7469 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_svg.png | bin | 0 -> 8226 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_swf.png | bin | 0 -> 9507 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_text.png | bin | 0 -> 5914 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_unkown.png | bin | 0 -> 8219 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_video.png | bin | 0 -> 19631 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_video_play.png | bin | 0 -> 8407 bytes | |||
-rw-r--r-- | icons/myfile_thumbnail_icon_word.png | bin | 0 -> 10262 bytes | |||
-rw-r--r-- | packaging/ug-myfile-efl.spec | 73 | ||||
-rwxr-xr-x[-rw-r--r--] | po/POTFILES.in | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | po/ug-myfile-efl.pot | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | po/update-po.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/common/file-system/mf-ug-file-attr.c | 308 | ||||
-rw-r--r--[-rwxr-xr-x] | src/common/file-system/mf-ug-fs-oper.c | 665 | ||||
-rw-r--r--[-rwxr-xr-x] | src/common/mf-ug-cb.c | 775 | ||||
-rw-r--r--[-rwxr-xr-x] | src/common/mf-ug-fm-svc-wapper.c | 420 | ||||
-rw-r--r--[-rwxr-xr-x] | src/common/mf-ug-inotify-handle.c | 14 | ||||
-rw-r--r--[-rwxr-xr-x] | src/common/mf-ug-list-play.c | 810 | ||||
-rw-r--r-- | src/common/mf-ug-search-internal.c | 880 | ||||
-rw-r--r-- | src/common/mf-ug-search.c | 131 | ||||
-rw-r--r--[-rwxr-xr-x] | src/common/mf-ug-util.c | 261 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-cb.h | 23 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-conf.h | 23 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-dlog.h | 14 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-fm-svc-wrapper.h | 20 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-fs-util.h | 154 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-inotify-handle.h | 14 | ||||
-rw-r--r-- | src/include/mf-ug-list-play.h | 41 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-main.h | 84 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-resource.h | 43 | ||||
-rw-r--r-- | src/include/mf-ug-search-internal.h | 75 | ||||
-rw-r--r-- | src/include/mf-ug-search.h | 218 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-util.h | 73 | ||||
-rw-r--r--[-rwxr-xr-x] | src/include/mf-ug-winset.h | 38 | ||||
-rw-r--r--[-rwxr-xr-x] | src/mf-ug-main.c | 232 | ||||
-rw-r--r--[-rwxr-xr-x] | src/widget/mf-ug-ctrl-bar.c | 546 | ||||
-rw-r--r--[-rwxr-xr-x] | src/widget/mf-ug-genlist.c | 312 | ||||
-rw-r--r--[-rwxr-xr-x] | src/widget/mf-ug-navi-bar.c | 288 | ||||
-rw-r--r--[-rwxr-xr-x] | src/widget/mf-ug-popup.c | 226 | ||||
-rw-r--r-- | src/widget/mf-ug-search-view.c | 366 | ||||
-rw-r--r--[-rwxr-xr-x] | src/widget/mf-ug-tab-bar.c | 95 | ||||
-rw-r--r-- | ug-myfile-efl.xml | 28 | ||||
-rw-r--r--[-rwxr-xr-x] | ug_navibar_layout.edc | 158 |
109 files changed, 6102 insertions, 1498 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 136fb81..99684a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,12 +28,15 @@ SET(SRCS ${UG-UTILITY-DIR}/mf-ug-fm-svc-wapper.c ${UG-UTILITY-DIR}/mf-ug-inotify-handle.c ${UG-UTILITY-DIR}/mf-ug-list-play.c + ${UG-UTILITY-DIR}/mf-ug-search-internal.c + ${UG-UTILITY-DIR}/mf-ug-search.c ########### winset wrap ########## ${UG-WIDGET-DIR}/mf-ug-navi-bar.c ${UG-WIDGET-DIR}/mf-ug-genlist.c ${UG-WIDGET-DIR}/mf-ug-popup.c ${UG-WIDGET-DIR}/mf-ug-ctrl-bar.c ${UG-WIDGET-DIR}/mf-ug-tab-bar.c + ${UG-WIDGET-DIR}/mf-ug-search-view.c ################ file system ######### ${UG-FS-DIR}/mf-ug-file-attr.c ${UG-FS-DIR}/mf-ug-fs-oper.c @@ -43,17 +46,20 @@ INCLUDE_DIRECTORIES(${UGINCLUDE}) INCLUDE(FindPkgConfig) pkg_check_modules(ug_pkgs REQUIRED -ecore-x ecore-evas +ecore-x +ecore-evas elementary vconf glib-2.0 -mm-common -mm-sound -mm-player -ui-gadget -libmedia-service -aul +drm-client +ui-gadget-1 +capi-appfw-application +capi-content-media-content dlog +capi-media-sound-manager +capi-media-player +capi-system-haptic +capi-system-power ) FOREACH(flag ${ug_pkgs_CFLAGS}) @@ -88,7 +94,7 @@ ADD_CUSTOM_TARGET(ug_navibar_layout.edj ADD_DEPENDENCIES(${PROJECT_NAME} ug_navibar_layout.edj) INSTALL(FILES ${CMAKE_BINARY_DIR}/ug_navibar_layout.edj DESTINATION ${EDJDIR}) - +INSTALL(FILES ${CMAKE_BINARY_DIR}/${MFUGNAME}.xml DESTINATION /opt/share/packages) # images INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/icons/ DESTINATION ${IMAGEDIR} FILES_MATCHING PATTERN "*.png" @@ -1 +0,0 @@ - diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index e57f0d9..0000000 --- a/debian/changelog +++ /dev/null @@ -1,7 +0,0 @@ -ug-myfile-efl (0.0.1-62) unstable; urgency=low - - * inital version - * Git: pkgs/u/ug-myfile-efl - * Tag: ug-myfile-efl_0.0.1-62 - - -- Guangliang Wang <gliang.wang@samsung.com> Mon, 23 Apr 2012 20:34:18 +0800 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100644 index 30ea80d..0000000 --- a/debian/control +++ /dev/null @@ -1,31 +0,0 @@ -Source: ug-myfile-efl -Section: libs -Priority: extra -Maintainer: Aram Kim <aramie.kim@samsung.com>, Liu Ruichao <ruichao.liu@samsung.com>, Guangliang Wang <gliang.wang@samsung.com>, Tang Feng <feng.tang@samsung.com>, Hyungmin Kim <hm2007.kim@samsung.com> -Uploaders: Liu RuiChao <ruichao.liu@samsung.com>, Tang Feng <feng.tang@samsung.com>, Guangliang Wang <gliang.wang@samsung.com> -Build-Depends: debhelper (>= 5), - libelm-dev, - libmm-player-dev, - libmm-sound-dev, - dlog-dev, - libui-gadget-dev, - libmedia-service-dev, - libslp-setting-dev, - libeina-dev, - libedbus-dev, - libdbus-glib-1-dev, - libdbus-1-dev, - libecore-dev, -Standards-Version: 0.1.0 - -Package: libug-myfile-efl -Section: libs -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Myfile UI Gadget (EFL) - -Package: libug-myfile-efl-dbg -Section: debug -Architecture: any -Depends: ${misc:Depends}, libug-myfile-efl (= ${Source-Version}) -Description: Myfile UI Gadget(unstripped)
\ No newline at end of file diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index e69de29..0000000 --- a/debian/copyright +++ /dev/null diff --git a/debian/libug-myfile-efl.install.in b/debian/libug-myfile-efl.install.in deleted file mode 100644 index cdb492b..0000000 --- a/debian/libug-myfile-efl.install.in +++ /dev/null @@ -1,3 +0,0 @@ -/opt/ug/lib/* -/opt/ug/res/* - diff --git a/debian/rules b/debian/rules deleted file mode 100755 index a8c5062..0000000 --- a/debian/rules +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -CFLAGS ?= -Wall -g -CXXFLAGS ?= -Wall -g -LDFLAGS ?= -PREFIX ?= /usr -DATADIR ?= /opt - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 - CXXFLAGS += -O0 -else - CFLAGS += -O2 - CXXFLAGS += -O2 -endif - -CFLAGS += -fpie -LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed,--hash-style=both -pie - -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX) - - touch configure-stamp - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - - # Add here commands to compile the package. - $(MAKE) - #docbook-to-man debian/wavplayer.sgml > wavplayer.1 - - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - cat $$f > $${f%.in}; \ - sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ - sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ - done - - - touch $@ - -clean: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) clean - rm -rf CMakeCache.txt - rm -rf CMakeFiles - rm -rf cmake_install.cmake - rm -rf Makefile - rm -rf install_manifest.txt - rm -rf po/CMakeFiles/ - rm -rf po/cmake_install.cmake - rm -rf po/Makefile - rm -rf *.so - rm -rf debian/*.install - rm -rf *.edj - - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - rm -f $${f%.in}; \ - done - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/wavplayer. - $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples - dh_install --sourcedir=debian/tmp -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_python -# dh_installinit -# dh_installcron -# dh_installinfo - dh_installman - dh_link - dh_strip - dh_strip --dbg-package=libug-myfile-efl-dbg - dh_compress - dh_fixperms -# dh_perl -# dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/icons/01_myfile_add_icon.png b/icons/01_myfile_add_icon.png Binary files differdeleted file mode 100644 index 290e2a5..0000000 --- a/icons/01_myfile_add_icon.png +++ /dev/null diff --git a/icons/06_myfiles_list_folder.png b/icons/06_myfiles_list_folder.png Binary files differdeleted file mode 100644 index 52b77ba..0000000 --- a/icons/06_myfiles_list_folder.png +++ /dev/null diff --git a/icons/47_myfiles_icon_music.png b/icons/47_myfiles_icon_music.png Binary files differdeleted file mode 100644 index 43d7798..0000000 --- a/icons/47_myfiles_icon_music.png +++ /dev/null diff --git a/icons/47_myfiles_icon_ring_tone.png b/icons/47_myfiles_icon_ring_tone.png Binary files differdeleted file mode 100644 index 5e6d2c5..0000000 --- a/icons/47_myfiles_icon_ring_tone.png +++ /dev/null diff --git a/icons/60_myfiles_file_amr.png b/icons/60_myfiles_file_amr.png Binary files differdeleted file mode 100644 index 93c66f3..0000000 --- a/icons/60_myfiles_file_amr.png +++ /dev/null diff --git a/icons/60_myfiles_file_etc.png b/icons/60_myfiles_file_etc.png Binary files differdeleted file mode 100644 index 26748d8..0000000 --- a/icons/60_myfiles_file_etc.png +++ /dev/null diff --git a/icons/60_myfiles_icon_music_default.png b/icons/60_myfiles_icon_music_default.png Binary files differdeleted file mode 100644 index 5f001a2..0000000 --- a/icons/60_myfiles_icon_music_default.png +++ /dev/null diff --git a/icons/60_myfiles_icon_vText.png b/icons/60_myfiles_icon_vText.png Binary files differdeleted file mode 100644 index 97b5a62..0000000 --- a/icons/60_myfiles_icon_vText.png +++ /dev/null diff --git a/icons/60_myfiles_icon_vcalender.png b/icons/60_myfiles_icon_vcalender.png Binary files differdeleted file mode 100644 index 5bc9826..0000000 --- a/icons/60_myfiles_icon_vcalender.png +++ /dev/null diff --git a/icons/60_myfiles_icon_vcard.png b/icons/60_myfiles_icon_vcard.png Binary files differdeleted file mode 100644 index 4ed5743..0000000 --- a/icons/60_myfiles_icon_vcard.png +++ /dev/null diff --git a/icons/U01_icon_USB.png b/icons/myfile_icon_USB.png Binary files differindex bf4dc00..bf4dc00 100644 --- a/icons/U01_icon_USB.png +++ b/icons/myfile_icon_USB.png diff --git a/icons/myfile_icon_cancel.png b/icons/myfile_icon_cancel.png Binary files differnew file mode 100644 index 0000000..8d12808 --- /dev/null +++ b/icons/myfile_icon_cancel.png diff --git a/icons/34_control_pause.png b/icons/myfile_icon_control_pause.png Binary files differindex 56943c0..56943c0 100644 --- a/icons/34_control_pause.png +++ b/icons/myfile_icon_control_pause.png diff --git a/icons/34_control_play.png b/icons/myfile_icon_control_play.png Binary files differindex e5d7928..e5d7928 100644 --- a/icons/34_control_play.png +++ b/icons/myfile_icon_control_play.png diff --git a/icons/myfile_icon_copy.png b/icons/myfile_icon_copy.png Binary files differnew file mode 100644 index 0000000..13c40bb --- /dev/null +++ b/icons/myfile_icon_copy.png diff --git a/icons/myfile_icon_create_folder.png b/icons/myfile_icon_create_folder.png Binary files differnew file mode 100644 index 0000000..d74811f --- /dev/null +++ b/icons/myfile_icon_create_folder.png diff --git a/icons/myfile_icon_delete.png b/icons/myfile_icon_delete.png Binary files differnew file mode 100644 index 0000000..faaa0d3 --- /dev/null +++ b/icons/myfile_icon_delete.png diff --git a/icons/myfile_icon_done.png b/icons/myfile_icon_done.png Binary files differnew file mode 100644 index 0000000..d771640 --- /dev/null +++ b/icons/myfile_icon_done.png diff --git a/icons/myfile_icon_edit.png b/icons/myfile_icon_edit.png Binary files differnew file mode 100644 index 0000000..4ddc598 --- /dev/null +++ b/icons/myfile_icon_edit.png diff --git a/icons/myfile_icon_etc.png b/icons/myfile_icon_etc.png Binary files differnew file mode 100644 index 0000000..0cc767d --- /dev/null +++ b/icons/myfile_icon_etc.png diff --git a/icons/47_myfiles_icon_excel.png b/icons/myfile_icon_excel.png Binary files differindex 109b7de..109b7de 100644 --- a/icons/47_myfiles_icon_excel.png +++ b/icons/myfile_icon_excel.png diff --git a/icons/myfile_icon_folder.png b/icons/myfile_icon_folder.png Binary files differnew file mode 100644 index 0000000..d53be43 --- /dev/null +++ b/icons/myfile_icon_folder.png diff --git a/icons/47_myfiles_icon_folder_created.png b/icons/myfile_icon_folder_open.png Binary files differindex 5c24399..85e0f19 100644 --- a/icons/47_myfiles_icon_folder_created.png +++ b/icons/myfile_icon_folder_open.png diff --git a/icons/47_myfiles_icon_html.png b/icons/myfile_icon_html.png Binary files differindex 78646b4..78646b4 100644 --- a/icons/47_myfiles_icon_html.png +++ b/icons/myfile_icon_html.png diff --git a/icons/60_myfiles_icon_images.png b/icons/myfile_icon_images.png Binary files differindex 4dd3be3..4dd3be3 100644 --- a/icons/60_myfiles_icon_images.png +++ b/icons/myfile_icon_images.png diff --git a/icons/60_myfiles_icon_java.png b/icons/myfile_icon_java.png Binary files differindex a083ee6..a083ee6 100644 --- a/icons/60_myfiles_icon_java.png +++ b/icons/myfile_icon_java.png diff --git a/icons/myfile_icon_list_by.png b/icons/myfile_icon_list_by.png Binary files differnew file mode 100644 index 0000000..0c17352 --- /dev/null +++ b/icons/myfile_icon_list_by.png diff --git a/icons/60_myfiles_memorycard.png b/icons/myfile_icon_mmc.png Binary files differindex f486674..f486674 100644 --- a/icons/60_myfiles_memorycard.png +++ b/icons/myfile_icon_mmc.png diff --git a/icons/60_myfiles_memorycard_sub.png b/icons/myfile_icon_mmc_sub.png Binary files differindex faced52..faced52 100644 --- a/icons/60_myfiles_memorycard_sub.png +++ b/icons/myfile_icon_mmc_sub.png diff --git a/icons/myfile_icon_move.png b/icons/myfile_icon_move.png Binary files differnew file mode 100644 index 0000000..fdc8c8a --- /dev/null +++ b/icons/myfile_icon_move.png diff --git a/icons/myfile_icon_move_here.png b/icons/myfile_icon_move_here.png Binary files differnew file mode 100644 index 0000000..06e7946 --- /dev/null +++ b/icons/myfile_icon_move_here.png diff --git a/icons/47_myfiles_icon_folder.png b/icons/myfile_icon_music.png Binary files differindex f425327..9909d9c 100644 --- a/icons/47_myfiles_icon_folder.png +++ b/icons/myfile_icon_music.png diff --git a/icons/myfile_icon_paste_here.png b/icons/myfile_icon_paste_here.png Binary files differnew file mode 100644 index 0000000..13c40bb --- /dev/null +++ b/icons/myfile_icon_paste_here.png diff --git a/icons/47_myfiles_icon_pause_focus.png b/icons/myfile_icon_pause_focus.png Binary files differindex fd1c6a2..fd1c6a2 100644 --- a/icons/47_myfiles_icon_pause_focus.png +++ b/icons/myfile_icon_pause_focus.png diff --git a/icons/47_myfiles_icon_pdf.png b/icons/myfile_icon_pdf.png Binary files differindex 2480d81..2480d81 100644 --- a/icons/47_myfiles_icon_pdf.png +++ b/icons/myfile_icon_pdf.png diff --git a/icons/60_myfiles_phone.png b/icons/myfile_icon_phone.png Binary files differindex 1c92369..1c92369 100644 --- a/icons/60_myfiles_phone.png +++ b/icons/myfile_icon_phone.png diff --git a/icons/47_myfiles_icon_play_focus.png b/icons/myfile_icon_play_focus.png Binary files differindex 88575c1..88575c1 100644 --- a/icons/47_myfiles_icon_play_focus.png +++ b/icons/myfile_icon_play_focus.png diff --git a/icons/47_myfiles_icon_ppt.png b/icons/myfile_icon_ppt.png Binary files differindex 42c1100..42c1100 100644 --- a/icons/47_myfiles_icon_ppt.png +++ b/icons/myfile_icon_ppt.png diff --git a/icons/47_myfiles_icon_rss.png b/icons/myfile_icon_rss.png Binary files differindex 1b566e2..1b566e2 100644 --- a/icons/47_myfiles_icon_rss.png +++ b/icons/myfile_icon_rss.png diff --git a/icons/myfile_icon_search.png b/icons/myfile_icon_search.png Binary files differnew file mode 100644 index 0000000..ff46fa3 --- /dev/null +++ b/icons/myfile_icon_search.png diff --git a/icons/myfile_icon_share.png b/icons/myfile_icon_share.png Binary files differnew file mode 100644 index 0000000..c1a20b5 --- /dev/null +++ b/icons/myfile_icon_share.png diff --git a/icons/myfile_icon_store_here.png b/icons/myfile_icon_store_here.png Binary files differnew file mode 100644 index 0000000..65290d8 --- /dev/null +++ b/icons/myfile_icon_store_here.png diff --git a/icons/myfile_icon_svg.png b/icons/myfile_icon_svg.png Binary files differnew file mode 100644 index 0000000..64a841c --- /dev/null +++ b/icons/myfile_icon_svg.png diff --git a/icons/47_myfiles_icon_swf.png b/icons/myfile_icon_swf.png Binary files differindex ee50e85..ee50e85 100644 --- a/icons/47_myfiles_icon_swf.png +++ b/icons/myfile_icon_swf.png diff --git a/icons/47_myfiles_icon_text.png b/icons/myfile_icon_text.png Binary files differindex c937ef8..c937ef8 100644 --- a/icons/47_myfiles_icon_text.png +++ b/icons/myfile_icon_text.png diff --git a/icons/47_myfiles_icon_upper_folder_black_theme.png b/icons/myfile_icon_upper_folder_black_theme.png Binary files differindex 050c295..050c295 100644 --- a/icons/47_myfiles_icon_upper_folder_black_theme.png +++ b/icons/myfile_icon_upper_folder_black_theme.png diff --git a/icons/47_myfiles_icon_upper_folder_focus.png b/icons/myfile_icon_upper_folder_focus.png Binary files differindex d8dd048..d8dd048 100644 --- a/icons/47_myfiles_icon_upper_folder_focus.png +++ b/icons/myfile_icon_upper_folder_focus.png diff --git a/icons/47_myfiles_icon_upper_folder_white_theme.png b/icons/myfile_icon_upper_folder_white_theme.png Binary files differindex e3853c1..e3853c1 100644 --- a/icons/47_myfiles_icon_upper_folder_white_theme.png +++ b/icons/myfile_icon_upper_folder_white_theme.png diff --git a/icons/47_myfiles_icon_video.png b/icons/myfile_icon_video.png Binary files differindex a8e832a..a8e832a 100644 --- a/icons/47_myfiles_icon_video.png +++ b/icons/myfile_icon_video.png diff --git a/icons/47_myfiles_icon_folder_sinced.png b/icons/myfile_icon_video_play.png Binary files differindex 8027943..bbde433 100644 --- a/icons/47_myfiles_icon_folder_sinced.png +++ b/icons/myfile_icon_video_play.png diff --git a/icons/47_myfiles_icon_word.png b/icons/myfile_icon_word.png Binary files differindex b399bad..b399bad 100644 --- a/icons/47_myfiles_icon_word.png +++ b/icons/myfile_icon_word.png diff --git a/icons/myfile_thumbnail_icon_excel.png b/icons/myfile_thumbnail_icon_excel.png Binary files differnew file mode 100644 index 0000000..c5ff6e6 --- /dev/null +++ b/icons/myfile_thumbnail_icon_excel.png diff --git a/icons/myfile_thumbnail_icon_folder.png b/icons/myfile_thumbnail_icon_folder.png Binary files differnew file mode 100644 index 0000000..c4b91e1 --- /dev/null +++ b/icons/myfile_thumbnail_icon_folder.png diff --git a/icons/myfile_thumbnail_icon_folder_open.png b/icons/myfile_thumbnail_icon_folder_open.png Binary files differnew file mode 100644 index 0000000..d928ea2 --- /dev/null +++ b/icons/myfile_thumbnail_icon_folder_open.png diff --git a/icons/myfile_thumbnail_icon_html.png b/icons/myfile_thumbnail_icon_html.png Binary files differnew file mode 100644 index 0000000..2e99180 --- /dev/null +++ b/icons/myfile_thumbnail_icon_html.png diff --git a/icons/myfile_thumbnail_icon_music.png b/icons/myfile_thumbnail_icon_music.png Binary files differnew file mode 100644 index 0000000..54c18e7 --- /dev/null +++ b/icons/myfile_thumbnail_icon_music.png diff --git a/icons/myfile_thumbnail_icon_pdf.png b/icons/myfile_thumbnail_icon_pdf.png Binary files differnew file mode 100644 index 0000000..30ea8e9 --- /dev/null +++ b/icons/myfile_thumbnail_icon_pdf.png diff --git a/icons/myfile_thumbnail_icon_ppt.png b/icons/myfile_thumbnail_icon_ppt.png Binary files differnew file mode 100644 index 0000000..bb97df2 --- /dev/null +++ b/icons/myfile_thumbnail_icon_ppt.png diff --git a/icons/myfile_thumbnail_icon_rss.png b/icons/myfile_thumbnail_icon_rss.png Binary files differnew file mode 100644 index 0000000..8fc1384 --- /dev/null +++ b/icons/myfile_thumbnail_icon_rss.png diff --git a/icons/myfile_thumbnail_icon_svg.png b/icons/myfile_thumbnail_icon_svg.png Binary files differnew file mode 100644 index 0000000..92b89e0 --- /dev/null +++ b/icons/myfile_thumbnail_icon_svg.png diff --git a/icons/myfile_thumbnail_icon_swf.png b/icons/myfile_thumbnail_icon_swf.png Binary files differnew file mode 100644 index 0000000..8d1278d --- /dev/null +++ b/icons/myfile_thumbnail_icon_swf.png diff --git a/icons/myfile_thumbnail_icon_text.png b/icons/myfile_thumbnail_icon_text.png Binary files differnew file mode 100644 index 0000000..39cdc23 --- /dev/null +++ b/icons/myfile_thumbnail_icon_text.png diff --git a/icons/myfile_thumbnail_icon_unkown.png b/icons/myfile_thumbnail_icon_unkown.png Binary files differnew file mode 100644 index 0000000..37a22ec --- /dev/null +++ b/icons/myfile_thumbnail_icon_unkown.png diff --git a/icons/myfile_thumbnail_icon_video.png b/icons/myfile_thumbnail_icon_video.png Binary files differnew file mode 100644 index 0000000..b4c1c66 --- /dev/null +++ b/icons/myfile_thumbnail_icon_video.png diff --git a/icons/myfile_thumbnail_icon_video_play.png b/icons/myfile_thumbnail_icon_video_play.png Binary files differnew file mode 100644 index 0000000..4fe90b2 --- /dev/null +++ b/icons/myfile_thumbnail_icon_video_play.png diff --git a/icons/myfile_thumbnail_icon_word.png b/icons/myfile_thumbnail_icon_word.png Binary files differnew file mode 100644 index 0000000..ef5b578 --- /dev/null +++ b/icons/myfile_thumbnail_icon_word.png diff --git a/packaging/ug-myfile-efl.spec b/packaging/ug-myfile-efl.spec index 156e858..d2f4cef 100644 --- a/packaging/ug-myfile-efl.spec +++ b/packaging/ug-myfile-efl.spec @@ -1,47 +1,52 @@ -%define _optdir /opt -%define _ugdir %{_optdir}/ug - - +#sbs-git:slp/pkgs/u/ug-myfile-efl ug-myfile-efl 0.0.1 1b44640a2e59d1af1ab0792e39a73bf3680b25c9 Name: ug-myfile-efl -Summary: Myfile UI-Gadget (EFL) -Version: 0.0.1 -Release: 2.1 -Group: TO_BE/FILLED_IN -License: Flora Software License +Summary: Myfile UI Gadget (EFL) +Version: 0.0.22 +Release: 1 +Group: misc +License: flora Source0: %{name}-%{version}.tar.gz -BuildRequires: cmake -BuildRequires: gettext-tools -BuildRequires: pkgconfig(aul) -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(ecore-evas) -BuildRequires: pkgconfig(ecore-x) -BuildRequires: pkgconfig(elementary) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(libmedia-service) -BuildRequires: pkgconfig(mm-common) -BuildRequires: pkgconfig(mm-player) -BuildRequires: pkgconfig(mm-sound) -BuildRequires: pkgconfig(ui-gadget) -BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(icu-uc) -BuildRequires: edje-tools + +BuildRequires: cmake +BuildRequires: edje-bin +BuildRequires: embryo-bin +BuildRequires: gettext + +BuildRequires: pkgconfig(ecore-x) +BuildRequires: pkgconfig(ecore-evas) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(drm-client) +BuildRequires: pkgconfig(ui-gadget-1) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(capi-media-sound-manager) +BuildRequires: pkgconfig(capi-media-player) +BuildRequires: pkgconfig(capi-system-haptic) +BuildRequires: pkgconfig(capi-content-media-content) +BuildRequires: pkgconfig(capi-system-power) %description -Description: Myfile Detail UI-Gadget (EFL) +Myfile UI Gadget (EFL) v1.0. %prep -%setup -q +%setup -q -n %{name}-%{version} %build -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} - +cmake . -DCMAKE_INSTALL_PREFIX="%{PREFIX}" make %{?jobs:-j%jobs} +%post +mkdir -p /opt/ug/bin/ +ln -sf /usr/bin/ug-client /opt/ug/bin/myfile-efl + %install +rm -rf %{buildroot} %make_install -%find_lang ug-myfile-efl -%files -f ug-myfile-efl.lang -/opt/ug/lib/libug-myfile-efl.so -/opt/ug/res/edje/ug-myfile-efl/ug_navibar_layout.edj -/opt/ug/res/images/ug-myfile-efl/* +%files +%defattr(-,root,root,-) +/opt/ug/lib/* +/opt/ug/res/* +/opt/share/packages/*.xml diff --git a/po/POTFILES.in b/po/POTFILES.in index 92bd4d0..92bd4d0 100644..100755 --- a/po/POTFILES.in +++ b/po/POTFILES.in diff --git a/po/ug-myfile-efl.pot b/po/ug-myfile-efl.pot index c89d2ef..c89d2ef 100644..100755 --- a/po/ug-myfile-efl.pot +++ b/po/ug-myfile-efl.pot diff --git a/po/update-po.sh b/po/update-po.sh index ff5bff7..ff5bff7 100644..100755 --- a/po/update-po.sh +++ b/po/update-po.sh diff --git a/src/common/file-system/mf-ug-file-attr.c b/src/common/file-system/mf-ug-file-attr.c index 082e394..58ef220 100755..100644 --- a/src/common/file-system/mf-ug-file-attr.c +++ b/src/common/file-system/mf-ug-file-attr.c @@ -1,17 +1,20 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ @@ -19,13 +22,35 @@ #include <regex.h> #include <sys/types.h> -#include <aul.h> -#include <visual-svc.h> -#include <media-svc.h> +#include <media_content.h> +#include <drm_client.h> +#include <drm_client_types.h> #include "mf-ug-fs-util.h" +#include "mf-ug-util.h" #define MF_UG_PHONE_DEFAULT_LEVEL 2 /*the phone path is /opt/media, it consists of opt and media two parts*/ #define MF_UG_MMC_DEFAULT_LEVEL 3 /*the mmc path is /opt/storage/sdcard, it consists of opt and storage and sdcard three parts*/ +#define CONDITION_LENGTH 200 +#define UG_CONDITION_IMAGE_VIDEO "(MEDIA_TYPE=0 OR MEDIA_TYPE=1)" + +typedef struct __ug_filter_s ug_filter_s; +struct __ug_filter_s { + char *cond; /*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; /*sort keyword*/ + int offset; /*offset*/ + int count; /*count*/ + bool with_meta; /*whether get image or video info*/ +}; + +typedef struct __ug_transfer_data_s ug_transfer_data_s; + +struct __ug_transfer_data_s { + const char *file_path; + char *thumbnail_path; +}; + struct _ug_ftype_by_mime { const char *mime; @@ -203,7 +228,14 @@ static mf_ug_fs_file_type __mf_ug_file_attr_get_category_by_file_ext(const char return UG_FILE_TYPE_DOC; } if (strcasecmp("DIVX", &file_ext[i]) == 0) { - return UG_FILE_TYPE_VIDEO; + if (mf_ug_file_attr_is_drm_file(fullpath) == 0) { + return UG_FILE_TYPE_DRM; + } else { + return UG_FILE_TYPE_VIDEO; + } + } + if (strcasecmp("DCF", &file_ext[i]) == 0) { + return UG_FILE_TYPE_DRM; } break; case 'g': @@ -425,7 +457,7 @@ static mf_ug_fs_file_type __mf_ug_file_attr_get_category_by_file_ext(const char } /********************* -**Function name: __mf_ug_file_attr_is_valid_name +**Function name: mf_ug_file_attr_is_valid_name **Parameter: ** const char *filename: the file/dir name we need to check ** @@ -437,7 +469,7 @@ static mf_ug_fs_file_type __mf_ug_file_attr_get_category_by_file_ext(const char ** check if the name is valid by file name ** *********************/ -static int __mf_ug_file_attr_is_valid_name(const char *filename) +int mf_ug_file_attr_is_valid_name(const char *filename) { char *pattern; int ret, z, cflags = 0; @@ -675,6 +707,33 @@ int mf_ug_file_attr_get_store_type_by_full(const char *filepath, mf_ug_storage_t } /********************* +**Function name: mf_ug_file_attr_is_drm_file +**Parameter: +** const char* filepath: file full path +** +**Return value: +** true if it is a DRM file +** false if it is not a DRM file +** +**Action: +** check if file is drm file +** +*********************/ +int mf_ug_file_attr_is_drm_file(const char *file_fullpath) +{ + if (file_fullpath == NULL) + return MYFILE_ERR_DRM_PERMISSION_DENY; + drm_bool_type_e drmFlag = DRM_FALSE; + int res = 0; + res = drm_is_drm_file(file_fullpath, &drmFlag); + + if (res == DRM_RETURN_SUCCESS && drmFlag == DRM_TRUE) + return 0; + else + return MYFILE_ERR_DRM_PERMISSION_DENY; +} + +/********************* **Function name: mf_ug_file_attr_get_file_ext **Parameter: ** const char* filepath: file full path @@ -687,8 +746,11 @@ int mf_ug_file_attr_get_store_type_by_full(const char *filepath, mf_ug_storage_t ** get file extension by file full path ** *********************/ -int mf_ug_file_attr_get_file_ext(const char *filepath, char *file_ext) +int mf_ug_file_attr_get_file_ext(const char *filepath, char **file_ext) { + ug_mf_retvm_if(filepath == NULL, MYFILE_ERR_INVALID_FILE_NAME, "filepath is NULL"); + ug_mf_retvm_if(file_ext == NULL, MYFILE_ERR_INVALID_FILE_NAME, "file_ext is NULL"); + const char *filename = NULL; filename = ecore_file_file_get(filepath); @@ -701,7 +763,7 @@ int mf_ug_file_attr_get_file_ext(const char *filepath, char *file_ext) if (!pdot) { return MYFILE_ERR_EXT_GET_ERROR; } else if (pdot != filepath) { - memcpy(file_ext, pdot + 1, strlen(pdot) - 1); + *file_ext = g_strdup(pdot + 1); return MYFILE_ERR_NONE; } else { return MYFILE_ERR_EXT_GET_ERROR; @@ -742,7 +804,7 @@ int mf_ug_file_attr_is_right_dir_path(const char *dir_path) const char *file_name = NULL; file_name = ecore_file_file_get(dir_path); - result = __mf_ug_file_attr_is_valid_name(file_name); + result = mf_ug_file_attr_is_valid_name(file_name); if (result != MYFILE_ERR_NONE) { ug_mf_error("Is NOT Valid dir path name"); @@ -777,7 +839,7 @@ int mf_ug_file_attr_is_right_file_path(const char *file_path) const char *file_name = NULL; file_name = ecore_file_file_get(file_path); - result = __mf_ug_file_attr_is_valid_name(file_name); + result = mf_ug_file_attr_is_valid_name(file_name); if (result != MYFILE_ERR_NONE) { ug_mf_error("Is NOT Valid dir path name"); } @@ -786,8 +848,136 @@ int mf_ug_file_attr_is_right_file_path(const char *file_path) } +static int __mf_ug_create_filter(filter_h *filter, ug_filter_s *condition) +{ + ug_mf_retvm_if(filter == NULL, -1, "filter is NULL"); + ug_mf_retvm_if(condition == NULL, -1, "condition is NULL"); + + int ret = MEDIA_CONTENT_ERROR_NONE; + filter_h tmp_filter = NULL; + ret = media_filter_create(&tmp_filter); + if(ret != MEDIA_CONTENT_ERROR_NONE) { + ug_debug("Fail to create filter"); + return ret; + } + if (condition->cond) { + ret = media_filter_set_condition(tmp_filter, condition->cond, + condition->collate_type); + if(ret != MEDIA_CONTENT_ERROR_NONE) { + ug_debug("Fail to set condition"); + goto ERROR; + } + } + + if (condition->sort_keyword) { + ret = media_filter_set_order(tmp_filter, condition->sort_type, + condition->sort_keyword, + condition->collate_type); + if(ret != MEDIA_CONTENT_ERROR_NONE) { + ug_debug("Fail to set order"); + goto ERROR; + } + } + + ug_debug("offset is %d, count is %d", condition->offset, condition->count); + if (condition->offset != -1 && condition->count != -1 && + condition->count > condition->offset) { + ret = media_filter_set_offset(tmp_filter, condition->offset, + condition->count); + if(ret != MEDIA_CONTENT_ERROR_NONE) { + ug_debug("Fail to set offset"); + goto ERROR; + } + } + *filter = tmp_filter; + return ret; + ERROR: + if (tmp_filter) { + media_filter_destroy(*filter); + tmp_filter = NULL; + *filter = NULL; + } + return ret; +} + +static int __mf_ug_destroy_filter(filter_h filter) +{ + ug_mf_retvm_if(filter == NULL, -1, "filter is NULL"); + int ret = MEDIA_CONTENT_ERROR_NONE; + ret = media_filter_destroy(filter); + + return ret; +} + +static bool __mf_ug_local_data_get_media_thumbnail_cb(media_info_h media, void *data) +{ + ug_mf_retvm_if(data == NULL, -1, "filter is NULL"); + ug_transfer_data_s *tmp_data = (ug_transfer_data_s *)data; + + char *file_path = NULL; + char *thumbnail_path = NULL; + + media_info_get_thumbnail_path(media, &(tmp_data->thumbnail_path)); + + return false; +} + + -char *mf_ug_file_attr_get_file_icon(MediaSvcHandle *handle, const char *file_path, int *error_code) +int static __mf_ug_local_thumbnail_get(void *data, ug_filter_s *condition) +{ + + int ret = -1; + filter_h filter = NULL; + ret = __mf_ug_create_filter(&filter, condition); + if (ret != 0) { + ug_debug("Create filter failed"); + return ret; + } + + + ret = media_info_foreach_media_from_db(filter, + __mf_ug_local_data_get_media_thumbnail_cb, + data); + if (ret != 0) { + ug_debug("media_info_foreach_media_from_db failed: %d", ret); + } else { + ug_debug("media_info_foreach_media_from_db success!", ret); + } + __mf_ug_destroy_filter(filter); + + return ret; + +} + +const char *mf_ug_file_attr_get_thumbnail(void *data) +{ + ug_mf_retvm_if(data == NULL, -1, "data is NULL"); + + ug_transfer_data_s *mp_data = (ug_transfer_data_s *)data; + ug_filter_s filter; + int ret = -1; + + memset(&filter, 0, sizeof(ug_filter_s)); + + char *condition = NULL; + condition = g_strdup_printf("%s and MEDIA_PATH=\"%s\"", UG_CONDITION_IMAGE_VIDEO, mp_data->file_path); + ug_debug("condition [%s]", condition); + filter.cond = condition; + filter.collate_type = MEDIA_CONTENT_COLLATE_DEFAULT; + filter.sort_type = MEDIA_CONTENT_ORDER_DESC; + filter.sort_keyword = MEDIA_MODIFIED_TIME; + filter.with_meta = true; + + ret = __mf_ug_local_thumbnail_get(data, &filter); + UG_SAFE_FREE_CHAR(condition); + + + + return ret; +} + +char *mf_ug_file_attr_get_file_icon(const char *file_path, int *error_code) { int index = 0; char *icon_path = NULL; @@ -812,35 +1002,15 @@ char *mf_ug_file_attr_get_file_icon(MediaSvcHandle *handle, const char *file_pat switch (ftype) { case UG_FILE_TYPE_IMAGE: - { - int err = 0; - thumbnail_path = calloc(1, (MYFILE_FILE_PATH_LEN_MAX + 1)); - if (thumbnail_path == NULL) { - return NULL; - } - - err = minfo_get_thumb_path(handle, file_path, thumbnail_path, MYFILE_FILE_PATH_LEN_MAX); - if (err == 0) { - icon_path = thumbnail_path; - } else { - icon_path = NULL; - if (error_code) - *error_code = err; - } - } - break; case UG_FILE_TYPE_VIDEO: { int err = 0; - thumbnail_path = calloc(1, (MYFILE_FILE_PATH_LEN_MAX + 1)); - if (thumbnail_path == NULL) { - return NULL; - } - - err = minfo_get_thumb_path_for_video(handle, file_path, thumbnail_path, MYFILE_FILE_PATH_LEN_MAX); - + ug_transfer_data_s tmp_data; + memset(&tmp_data,0x00,sizeof(ug_transfer_data_s)); + tmp_data.file_path = file_path; + err = mf_ug_file_attr_get_thumbnail(&tmp_data);//minfo_get_thumb_path(handle, file_path, image_thumb, sizeof(image_thumb)); if (err == 0) { - icon_path = thumbnail_path; + icon_path = g_strdup(tmp_data.thumbnail_path); } else { icon_path = NULL; if (error_code) @@ -1070,3 +1240,59 @@ mf_ug_fs_file_type mf_ug_file_attr_get_file_type_by_mime(const char *file_path) return ftype; } + +int mf_ug_file_attr_is_duplicated_name(const char *dir, const char *name) +{ + + char *file_path = g_strconcat(dir, "/", name, NULL); + if (ecore_file_exists(file_path)) { + UG_SAFE_FREE_CHAR(file_path); + return MYFILE_ERR_DUPLICATED_NAME; + } else { + UG_SAFE_FREE_CHAR(file_path); + return MYFILE_ERR_NONE; + } +} + +int mf_ug_file_attr_get_logical_path_by_full(const char *full_path, char **path) +{ + ug_mf_retvm_if(full_path == NULL, MYFILE_ERR_INVALID_FILE_PATH, "fullpath is NULL"); + ug_mf_retvm_if(path == NULL, MYFILE_ERR_INVALID_FILE_PATH, "path is NULL"); + + mf_ug_storage_type store_type = 0; + int root_len = 0; + int error_code = 0; + + error_code = mf_ug_file_attr_get_store_type_by_full(full_path, &store_type); + + *path = g_strdup(full_path); + if (*path == NULL) { + return MYFILE_ERR_ALLOCATE_MEMORY_FAIL; + } + + memset(*path, 0, strlen(*path)); + switch (store_type) { + case MF_UG_PHONE: + root_len = strlen(PHONE_FOLDER); + break; + case MF_UG_MMC: + root_len = strlen(MEMORY_FOLDER); + break; + default: + return MYFILE_ERR_STORAGE_TYPE_ERROR; + } + + /* + ** *path has the same length with full_path + ** strlen(*path) is 0 since the memset called + ** we use length of full_path to reprecent the *path's + */ + g_strlcpy(*path, full_path + root_len, strlen(full_path)); + if (strlen(*path) == 0) { + UG_SAFE_FREE_CHAR(*path); + *path = g_strdup("/"); + } + + return MYFILE_ERR_NONE; +} + diff --git a/src/common/file-system/mf-ug-fs-oper.c b/src/common/file-system/mf-ug-fs-oper.c index 71fa889..363e621 100755..100644 --- a/src/common/file-system/mf-ug-fs-oper.c +++ b/src/common/file-system/mf-ug-fs-oper.c @@ -1,29 +1,38 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ - - #include <libgen.h> #include <glib.h> #include "mf-ug-fs-util.h" +#include "mf-ug-util.h" - +static int __mf_ug_fs_oper_sort_by_date_cb_O2R(const void *d1, const void *d2); +static int __mf_ug_fs_oper_sort_by_name_cb_A2Z(const void *d1, const void *d2); +static int __mf_ug_fs_oper_sort_by_type_cb_A2Z(const void *d1, const void *d2); +static int __mf_ug_fs_oper_sort_by_size_cb_S2L(const void *d1, const void *d2); +static int __mf_ug_fs_oper_sort_by_name_cb_Z2A(const void *d1, const void *d2); +static int __mf_ug_fs_oper_sort_by_date_cb_R2O(const void *d1, const void *d2); +static int __mf_ug_fs_oper_sort_by_type_cb_Z2A(const void *d1, const void *d2); +static int __mf_ug_fs_oper_sort_by_size_cb_L2S(const void *d1, const void *d2); /********************* **Function name: __mf_ug_fs_oper_file_system_error @@ -39,6 +48,22 @@ ** input parameter checking ** *********************/ +static const char *__mf_ug_fs_oper_get_file(const char *path) +{ + char *result = NULL; + + if (!path) { + return NULL; + } + if ((result = strrchr(path, '/'))) { + result++; + } else { + result = (char *)path; + } + return result; +} + + static int __mf_ug_fs_oper_file_system_error(const char *src, const char *dst, int check_option) { if ((check_option & MF_ERROR_CHECK_SRC_ARG_VALID) && (src == NULL)) { @@ -59,6 +84,21 @@ static int __mf_ug_fs_oper_file_system_error(const char *src, const char *dst, i } } } + + if (check_option & MF_ERROR_CHECK_DUPLICATED) { + char *parent_path = NULL; + + if (!mf_ug_file_attr_get_parent_path(dst, &parent_path)) { + if (mf_ug_file_attr_is_duplicated_name(parent_path, __mf_ug_fs_oper_get_file(dst))) { + UG_SAFE_FREE_CHAR(parent_path); + return MYFILE_ERR_DUPLICATED_NAME; + } + UG_SAFE_FREE_CHAR(parent_path); + } else { + UG_SAFE_FREE_CHAR(parent_path); + return MYFILE_ERR_GET_PARENT_PATH_FAIL; + } + } return MYFILE_ERR_NONE; } @@ -78,6 +118,7 @@ static int __mf_ug_fs_oper_file_system_error(const char *src, const char *dst, i *********************/ int mf_ug_fs_oper_read_dir(const char *path, Eina_List **dir_list, Eina_List **file_list) { + UG_TRACE_BEGIN; DIR *pDir = NULL; struct dirent *ent; @@ -143,9 +184,9 @@ int mf_ug_fs_oper_read_dir(const char *path, Eina_List **dir_list, Eina_List **f *dir_list = eina_list_append(*dir_list, pNode); } else { ug_mf_debug("file append\n"); - ret = mf_ug_file_attr_get_file_ext(childpath->str, pNode->ext); + ret = mf_ug_file_attr_get_file_ext(childpath->str, &pNode->ext); if (ret != MYFILE_ERR_NONE) { - memset(pNode->ext, 0, FILE_EXT_LEN_MAX); + pNode->ext = NULL; } *file_list = eina_list_append(*file_list, pNode); } @@ -153,6 +194,7 @@ int mf_ug_fs_oper_read_dir(const char *path, Eina_List **dir_list, Eina_List **f g_string_free(childpath, TRUE); } closedir(pDir); + UG_TRACE_END; return MYFILE_ERR_NONE; } @@ -169,6 +211,121 @@ int mf_ug_fs_oper_read_dir(const char *path, Eina_List **dir_list, Eina_List **f **Action: ** check if the node satisfied the filter option *********************/ +static mf_ug_drm_file_mime_type __mf_ug_fs_oper_get_drm_file_type_by_mime(char *mime_type) +{ + gchar **result = NULL; + if (mime_type != NULL) { + result = g_strsplit(mime_type, "/", 0); + if (result && (*result)) { + ug_mf_debug("*result is [%s]", *result); + if (g_strcmp0(*result, "audio") == 0) { + g_strfreev(result); + return MF_UG_DRM_RINGTONE_FILE; + } else if (g_strcmp0(*result, "image") == 0) { + g_strfreev(result); + return MF_UG_DRM_IMAGE_FILE; + } else { + g_strfreev(result); + return MF_UG_DRM_UNKNOW_FILE; + } + } else { + g_strfreev(result); + return MF_UG_DRM_UNKNOW_FILE; + } + } else { + return MF_UG_DRM_UNKNOW_FILE; + } +} + +mf_ug_drm_file_mime_type mf_ug_fs_oper_get_drm_type(char *path) +{ + drm_result_e res = 0; + drm_content_info_s dcf_content_info; + + res = drm_get_content_info(path, &dcf_content_info); + + + if (res == DRM_RETURN_SUCCESS) { + mf_ug_drm_file_mime_type drm_mime_type = __mf_ug_fs_oper_get_drm_file_type_by_mime(dcf_content_info.mime_type); + return drm_mime_type; + } else { + return MF_UG_DRM_UNKNOW_FILE; + } +} + +static int __drm_is_action_allowed(const char *path, drm_action_type_e action) +{ + drm_bool_type_e is_allowed = 0; + drm_action_allowed_data_s action_data; + + int ret = -1; + memset(&action_data,0x0,sizeof(drm_action_allowed_data_s)); + UG_SAFE_STRCPY(action_data.file_path, path); + + ret = drm_is_action_allowed(action,&action_data,&is_allowed); + if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_allowed){ + return true; + }else{ + return false; + } +} + +static bool __mf_ug_fs_oper_exec_drm_filter(ugFsNodeInfo *pnode_info, int option) +{ + if (pnode_info == NULL) { + return FALSE; + } + + int result = -1; + char *fullpath = NULL; + drm_result_e res = DRM_RETURN_INTERNAL_ERROR; + if (option & MF_UG_FILTER_DRM_ALL) { + return TRUE; + } + + if (option & MF_UG_FILTER_DRM_WITHOUT_FL) { + fullpath = g_strconcat(pnode_info->path, "/", pnode_info->name, NULL); + res = __drm_is_action_allowed(fullpath, DRM_IS_FORWARDING_ALLOWED); + if (res == DRM_RETURN_SUCCESS) { + return FALSE; + } else { + return TRUE; + } + } + + if (option & MF_UG_FILTER_DRM_IMAGE) { + fullpath = g_strconcat(pnode_info->path, "/", pnode_info->name, NULL); + + result = __drm_is_action_allowed(fullpath, DRM_HAS_VALID_SETAS_STATUS); + if (result) { + mf_ug_drm_file_mime_type drm_mime_type = mf_ug_fs_oper_get_drm_type(fullpath); + if (drm_mime_type == MF_UG_DRM_IMAGE_FILE) + return TRUE; + else + return FALSE; + } else { + return FALSE; + } + } + + if (option & MF_UG_FILTER_DRM_RINGTONE) { + fullpath = g_strconcat(pnode_info->path, "/", pnode_info->name, NULL); + + result = __drm_is_action_allowed(fullpath, DRM_HAS_VALID_SETAS_STATUS); + if (result) { + mf_ug_drm_file_mime_type drm_mime_type = mf_ug_fs_oper_get_drm_type(fullpath); + if (drm_mime_type == MF_UG_DRM_RINGTONE_FILE) + return TRUE; + else + return FALSE; + } else { + return FALSE; + } + + } + + return FALSE; +} static bool __mf_ug_fs_oper_exec_filter(ugFsNodeInfo *pnode_info, int option) { @@ -293,7 +450,7 @@ static bool __mf_ug_fs_oper_exec_filter(ugFsNodeInfo *pnode_info, int option) return FALSE; } -int mf_ug_fs_oper_list_filter(Eina_List *in_list, Eina_List **out_list, int option) +int mf_ug_fs_oper_list_filter(Eina_List *in_list, Eina_List **out_list, int option, int drm_opt) { ug_mf_debug(); if (in_list == NULL) { @@ -312,7 +469,10 @@ int mf_ug_fs_oper_list_filter(Eina_List *in_list, Eina_List **out_list, int opti Eina_List *l = NULL; ugFsNodeInfo *data = NULL; EINA_LIST_FOREACH(in_list, l, data) { - if (__mf_ug_fs_oper_exec_filter(data, option)) { + if (data->type == UG_FILE_TYPE_DRM && __mf_ug_fs_oper_exec_drm_filter(data, drm_opt)) { + ug_debug("file [%s] is drm file", data->name); + *out_list = eina_list_append(*out_list, data); + } else if (__mf_ug_fs_oper_exec_filter(data, option)) { *out_list = eina_list_append(*out_list, data); } } @@ -367,6 +527,8 @@ int mf_ug_fs_oper_list_filter_by_extension(Eina_List *in_list, Eina_List **out_l continue; } for (params = result; *params; params++) { + if (data->ext == NULL) + break; if (strcasecmp(data->ext, *params) == 0) { *out_list = eina_list_append(*out_list, data); break; @@ -379,3 +541,482 @@ int mf_ug_fs_oper_list_filter_by_extension(Eina_List *in_list, Eina_List **out_l free(temp_ext); return MYFILE_ERR_NONE; } + +static int __mf_ug_fs_oper_sort_by_priority(const void *d1, const void *d2, int sequence_type) +{ + int ret = 0; + switch(sequence_type) { + case MF_UG_SORT_BY_PRIORITY_TYPE_A2Z: + ret = __mf_ug_fs_oper_sort_by_date_cb_O2R(d1, d2); + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_size_cb_S2L(d1, d2); + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_name_cb_A2Z(d1, d2); + } + } + break; + case MF_UG_SORT_BY_PRIORITY_TYPE_Z2A: + ret = __mf_ug_fs_oper_sort_by_date_cb_R2O(d1, d2); + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_size_cb_L2S(d1, d2); + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_name_cb_Z2A(d1, d2); + } + } + break; + case MF_UG_SORT_BY_PRIORITY_DATE_O2R: + ret = __mf_ug_fs_oper_sort_by_size_cb_S2L(d1, d2); + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_name_cb_A2Z(d1, d2); + } + break; + case MF_UG_SORT_BY_PRIORITY_DATE_R2O: + ret = __mf_ug_fs_oper_sort_by_size_cb_L2S(d1, d2); + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_name_cb_Z2A(d1, d2); + } + break; + case MF_UG_SORT_BY_PRIORITY_SIZE_S2L: + ret = __mf_ug_fs_oper_sort_by_name_cb_A2Z(d1, d2); + break; + case MF_UG_SORT_BY_PRIORITY_SIZE_L2S: + ret = __mf_ug_fs_oper_sort_by_name_cb_Z2A(d1, d2); + break; + default: + break; + } + return ret; +} +/********************* +**Function name: __sort_by_name_cb +**Parameter: +** const void *d1: node1 to compare +** const void *d2: node2 to compare +** +**Return value: +** -1 if d1 > d2 +** 0 if d1 = d2 +** 1 if d1 > d2 +** +**Action: +** sort the list order by the Assic table + +** +*********************/ +static int __mf_ug_fs_oper_sort_by_name_cb_A2Z(const void *d1, const void *d2) +{ + ugFsNodeInfo *txt1 = (ugFsNodeInfo *) d1; + ugFsNodeInfo *txt2 = (ugFsNodeInfo *) d2; + gchar *name1 = NULL; + gchar *name2 = NULL; + int result = 0; + + if (!txt1 || !txt1->name) { + return (1); + } + if (!txt2 || !txt2->name) { + return (-1); + } + + name1 = g_ascii_strdown(txt1->name, strlen(txt1->name)); + if (name1 == NULL) { + return (-1); + } + name2 = g_ascii_strdown(txt2->name, strlen(txt2->name)); + if (name2 == NULL) { + g_free(name1); + name1 = NULL; + return (-1); + } + result = g_strcmp0(name1, name2); + + g_free(name1); + name1 = NULL; + g_free(name2); + name2 = NULL; + return result; + +} + +/********************* +**Function name: __sort_by_date_cb +**Parameter: +** const void *d1: node1 to compare +** const void *d2: node2 to compare +** +**Return value: +** -1 if d1 > d2 +** 0 if d1 = d2 +** 1 if d1 > d2 +** +**Action: +** sort the list order by the later created the later shown +*********************/ +static int __mf_ug_fs_oper_sort_by_date_cb_O2R(const void *d1, const void *d2) +{ + int ret = 0; + ugFsNodeInfo *time1 = (ugFsNodeInfo *) d1; + ugFsNodeInfo *time2 = (ugFsNodeInfo *) d2; + + if (!d1) { + return 1; + } + if (!d2) { + return -1; + } + + if (time1->date > time2->date) { + ret = 1; + } else if (time1->date < time2->date) { + ret = -1; + } else { + ret = 0; + } + + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_DATE_O2R); + } + return ret; +} + +/********************* +**Function name: __sort_by_type_cb +**Parameter: +** const void *d1: node1 to compare +** const void *d2: node2 to compare +** +**Return value: +** -1 if d1 < d2 +** 0 if d1 = d2 +** 1 if d1 > d2 +** +**Action: +** sort the list order by the category type value +*********************/ +static int __mf_ug_fs_oper_sort_by_type_cb_A2Z(const void *d1, const void *d2) +{ + ugFsNodeInfo *type1 = (ugFsNodeInfo *) d1; + ugFsNodeInfo *type2 = (ugFsNodeInfo *) d2; + gchar *ext1 = NULL; + gchar *ext2 = NULL; + int result = 0; + + if (type1 == NULL || type1->ext == NULL) { + return 1; + } + + if (type2 == NULL || type2->ext == NULL) { + return -1; + } + ext1 = g_ascii_strdown(type1->ext, strlen(type1->ext)); + if (ext1 == NULL) { + return (-1); + } + ext2 = g_ascii_strdown(type2->ext, strlen(type2->ext)); + if (ext2 == NULL) { + g_free(ext1); + ext1 = NULL; + return (-1); + } + result = g_strcmp0(ext1, ext2); + + g_free(ext1); + ext1 = NULL; + g_free(ext2); + ext2 = NULL; + + if (result == 0) { + result = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_TYPE_A2Z); + } + + return result; +} + +/*order: the one with smaller size will be shown earlier*/ +/********************* +**Function name: __sort_by_name_cb +**Parameter: +** const void *d1: node1 to compare +** const void *d2: node2 to compare +** +**Return value: +** -1 if d1 > d2 +** 0 if d1 = d2 +** 1 if d1 > d2 +** +**Action: +** sort the list order by size, rule is the smaller the later shown +*********************/ +static int __mf_ug_fs_oper_sort_by_size_cb_S2L(const void *d1, const void *d2) +{ + int ret = 0; + ugFsNodeInfo *size1 = (ugFsNodeInfo *) d1; + ugFsNodeInfo *size2 = (ugFsNodeInfo *) d2; + + if (!d1) { + return 1; + } + + if (!d2) { + return -1; + } + + if (size1->size > size2->size) { + ret = 1; + } else if (size1->size < size2->size) { + ret = -1; + } else { + ret = 0; + } + + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_SIZE_S2L); + } + return ret; +} + +/********************* +**Function name: __mf_fs_oper_sort_by_name_cb_Z2A +**Parameter: +** const void *d1: node1 to compare +** const void *d2: node2 to compare +** +**Return value: +** 1 if d1 > d2 +** -1 if d1 <= d2 +** +**Action: +** sort the list order by the Assic table + +** +*********************/ +static int __mf_ug_fs_oper_sort_by_name_cb_Z2A(const void *d1, const void *d2) +{ + ugFsNodeInfo *txt1 = (ugFsNodeInfo *) d1; + ugFsNodeInfo *txt2 = (ugFsNodeInfo *) d2; + + int result = 0; + + if (!txt1 || !txt1->name) { + return (1); + } + if (!txt2 || !txt2->name) { + return (-1); + } + result = strcasecmp(txt1->name, txt2->name); + + if (result < 0) { + return (1); + } else { + return (-1); + } +} + +/********************* +**Function name: __sort_by_date_cb +**Parameter: +** const void *d1: node1 to compare +** const void *d2: node2 to compare +** +**Return value: +** -1 if d1 > d2 +** 0 if d1 = d2 +** 1 if d1 < d2 +** +**Action: +** sort the list order by the later created the later shown +*********************/ +static int __mf_ug_fs_oper_sort_by_date_cb_R2O(const void *d1, const void *d2) +{ + int ret = 0; + ugFsNodeInfo *time1 = (ugFsNodeInfo *) d1; + ugFsNodeInfo *time2 = (ugFsNodeInfo *) d2; + + if (!d1) { + return -1; + } + if (!d2) { + return 1; + } + if (time1->date > time2->date) { + ret = -1; + } else if (time1->date < time2->date) { + ret = 1; + } else { + ret = 0; + } + + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_DATE_R2O); + } + return ret; +} + +/********************* +**Function name: __sort_by_type_cb +**Parameter: +** const void *d1: node1 to compare +** const void *d2: node2 to compare +** +**Return value: +** -1 if d1 > d2 +** 0 if d1 = d2 +** 1 if d1 < d2 +** +**Action: +** sort the list order by the category type value +*********************/ +static int __mf_ug_fs_oper_sort_by_type_cb_Z2A(const void *d1, const void *d2) +{ + ugFsNodeInfo *type1 = (ugFsNodeInfo *) d1; + ugFsNodeInfo *type2 = (ugFsNodeInfo *) d2; + gchar *ext1 = NULL; + gchar *ext2 = NULL; + int result = 0; + + if (type1 == NULL || type1->ext == NULL) { + return -1; + } + + if (type2 == NULL || type2->ext == NULL) { + return 1; + } + + ext1 = g_ascii_strdown(type1->ext, strlen(type1->ext)); + if (ext1 == NULL) { + return (1); + } + ext2 = g_ascii_strdown(type2->ext, strlen(type2->ext)); + if (ext2 == NULL) { + g_free(ext1); + ext1 = NULL; + return (-1); + } + result = g_strcmp0(ext1, ext2); + g_free(ext1); + ext1 = NULL; + g_free(ext2); + ext2 = NULL; + if (result == 0) { + result = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_TYPE_Z2A); + } + + return -result; +} + +/*order: the one with smaller size will be shown earlier*/ +/********************* +**Function name: __sort_by_name_cb +**Parameter: +** const void *d1: node1 to compare +** const void *d2: node2 to compare +** +**Return value: +** -1 if d1 > d2 +** 0 if d1 = d2 +** 1 if d1 < d2 +** +**Action: +** sort the list order by size, rule is the smaller the later shown +*********************/ +static int __mf_ug_fs_oper_sort_by_size_cb_L2S(const void *d1, const void *d2) +{ + int ret = 0; + ugFsNodeInfo *size1 = (ugFsNodeInfo *) d1; + ugFsNodeInfo *size2 = (ugFsNodeInfo *) d2; + + if (!d1) { + return -1; + } + + if (!d2) { + return 1; + } + + if (size1->size > size2->size) { + ret = -1; + } else if (size1->size < size2->size) { + ret = 1; + } else { + ret = 0; + } + + if (ret == 0) { + ret = __mf_ug_fs_oper_sort_by_priority(d1, d2, MF_UG_SORT_BY_PRIORITY_SIZE_L2S); + } + return ret; +} + +/********************* +**Function name: mf_fs_oper_sort_list +**Parameter: +** Eina_List **list: the list we need to sort +** int sort_opt: sort option +** +**Return value: +** void +** +**Action: +** sort the list order by sort option with the call back +*********************/ +void mf_ug_fs_oper_sort_list(Eina_List **list, int sort_opt) +{ + Eina_Compare_Cb sort_func = NULL; + if (!(*list)) { + return; + } + switch (sort_opt) { + case MF_UG_SORT_BY_NAME_A2Z: + sort_func = __mf_ug_fs_oper_sort_by_name_cb_A2Z; + break; + case MF_UG_SORT_BY_TYPE_A2Z: + sort_func = __mf_ug_fs_oper_sort_by_type_cb_A2Z; + break; + case MF_UG_SORT_BY_SIZE_S2L: + sort_func = __mf_ug_fs_oper_sort_by_size_cb_S2L; + break; + case MF_UG_SORT_BY_DATE_O2R: + sort_func = __mf_ug_fs_oper_sort_by_date_cb_O2R; + break; + case MF_UG_SORT_BY_NAME_Z2A: + sort_func = __mf_ug_fs_oper_sort_by_name_cb_Z2A; + break; + case MF_UG_SORT_BY_TYPE_Z2A: + sort_func = __mf_ug_fs_oper_sort_by_type_cb_Z2A; + break; + case MF_UG_SORT_BY_SIZE_L2S: + sort_func = __mf_ug_fs_oper_sort_by_size_cb_L2S; + break; + case MF_UG_SORT_BY_DATE_R2O: + sort_func = __mf_ug_fs_oper_sort_by_date_cb_R2O; + break; + default: + sort_func = __mf_ug_fs_oper_sort_by_type_cb_A2Z; + break; + } + *list = eina_list_sort(*list, eina_list_count(*list), sort_func); +} + +int mf_ug_fs_oper_create_dir(const char *dir) +{ + int option = MF_ERROR_CHECK_SRC_ARG_VALID | MF_ERROR_CHECK_DUPLICATED; + int ret = __mf_ug_fs_oper_file_system_error(dir, dir, option); + + if (ret != 0) { + return ret; + } + + ret = mf_ug_file_attr_is_right_dir_path(dir); + + if (ret != 0) { + return ret; + } + + mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; + + if (mkdir(dir, default_mode) < 0) { + return MYFILE_ERR_DIR_CREATE_FAIL; + } + return MYFILE_ERR_NONE; +} + diff --git a/src/common/mf-ug-cb.c b/src/common/mf-ug-cb.c index ac94a2b..b98efed 100755..100644 --- a/src/common/mf-ug-cb.c +++ b/src/common/mf-ug-cb.c @@ -1,34 +1,39 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
-
#include <stdio.h>
#include <Elementary.h>
#include <vconf.h>
#include <vconf-keys.h>
#include <pthread.h>
+#include <power.h>
#include "mf-ug-main.h"
+#include "mf-ug-util.h"
#include "mf-ug-inotify-handle.h"
#include "mf-ug-winset.h"
#include "mf-ug-fs-util.h"
#include "mf-ug-fm-svc-wrapper.h"
#include "mf-ug-resource.h"
+#define UG_MAX_LEN_VIB_DURATION 0.5
+
/******************************
** Prototype : mf_ug_cb_back_button_cb
** Description :
@@ -59,87 +64,107 @@ void mf_ug_cb_back_button_cb(void *data, Evas_Object *obj, void *event_info) if (0 != ugd->ug_ListPlay.ug_Player) {
mf_ug_list_play_destory_playing_file(ugd);
}
- if (ugd->ug_Status.ug_bSettingEntry == true && ugd->ug_Status.ug_bInSettingView == false) {
- Eina_List *l = NULL;
- void *item = NULL;
- ugNaviBar *pNavi_s = NULL;
- ugNaviBar *pNavi_toshow = NULL;
- GString *title = NULL;
-
- if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PLAYING || ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PAUSED) {
- mf_ug_list_play_destory_playing_file(ugd);
- }
+ if (ugd->ug_Status.ug_iMore == UG_MORE_SEARCH) {
- EINA_LIST_FOREACH(ugd->ug_MainWindow.ug_pNaviBarList, l, item) {
- pNavi_s = (ugNaviBar *)item;
- if (pNavi_s == NULL)
- return;
- if (g_strcmp0(pNavi_s->ug_pNaviLabel, MF_UG_LABEL_PHONE) == 0) {
- if (pNavi_s->ug_pCurrentPath != NULL) {
- free(pNavi_s->ug_pCurrentPath);
- pNavi_s->ug_pCurrentPath = NULL;
- }
- pNavi_s->ug_pCurrentPath = strdup(UG_SETTING_RINGTONE_PATH);
- pNavi_s->ug_bNaviFlagInUse = true;
- pNavi_toshow = pNavi_s;
- } else {
- if (pNavi_s->ug_pCurrentPath != NULL) {
- free(pNavi_s->ug_pCurrentPath);
- pNavi_s->ug_pCurrentPath = NULL;
+ ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
+ ug_mf_retm_if(pNavi_s == NULL, "get navi failed");
+ Evas_Object *playout = ugd->ug_MainWindow.ug_pNaviLayout;
+ ug_mf_retm_if(playout == NULL, "get conformant failed");
+ Evas_Object *newContent = NULL;
+
+ newContent = mf_ug_genlist_create_content_list_view(ugd);
+
+ Evas_Object *unUsed = elm_object_part_content_unset(playout, "part1");
+ evas_object_del(unUsed);
+
+ elm_object_part_content_set(playout, "part1", newContent);
+ ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
+ mf_ug_ctrl_bar_listby_item_diable(ugd->ug_MainWindow.ug_pNaviCtrlBar, false);
+ } else {
+ if (ugd->ug_Status.ug_bSettingEntry == true && ugd->ug_Status.ug_bInSettingView == false) {
+ Eina_List *l = NULL;
+ void *item = NULL;
+ ugNaviBar *pNavi_s = NULL;
+ ugNaviBar *pNavi_toshow = NULL;
+ GString *title = NULL;
+
+ if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PLAYING || ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PAUSED) {
+ mf_ug_list_play_destory_playing_file(ugd);
+ }
+
+ EINA_LIST_FOREACH(ugd->ug_MainWindow.ug_pNaviBarList, l, item) {
+ pNavi_s = (ugNaviBar *)item;
+ if (pNavi_s == NULL)
+ return;
+ if (g_strcmp0(pNavi_s->ug_pNaviLabel, MF_UG_LABEL_PHONE) == 0) {
+ if (pNavi_s->ug_pCurrentPath != NULL) {
+ free(pNavi_s->ug_pCurrentPath);
+ pNavi_s->ug_pCurrentPath = NULL;
+ }
+ pNavi_s->ug_pCurrentPath = strdup(UG_SETTING_RINGTONE_PATH);
+ pNavi_s->ug_bNaviFlagInUse = true;
+ pNavi_toshow = pNavi_s;
+ } else {
+ if (pNavi_s->ug_pCurrentPath != NULL) {
+ free(pNavi_s->ug_pCurrentPath);
+ pNavi_s->ug_pCurrentPath = NULL;
+ }
+ pNavi_s->ug_pCurrentPath = strdup(MEMORY_FOLDER);
+ pNavi_s->ug_bNaviFlagInUse = false;
}
- pNavi_s->ug_pCurrentPath = strdup(MEMORY_FOLDER);
- pNavi_s->ug_bNaviFlagInUse = false;
+
}
- }
+ if (pNavi_toshow == NULL) {
+ ug_debug("pNavi_toshow is NULL");
+ return;
+ }
- if (pNavi_toshow == NULL) {
- ug_debug("pNavi_toshow is NULL");
- return;
- }
+ if (ugd->ug_Status.ug_pPath) {
+ g_string_free(ugd->ug_Status.ug_pPath, TRUE);
+ ugd->ug_Status.ug_pPath = NULL;
+ }
- if (ugd->ug_Status.ug_pPath) {
- g_string_free(ugd->ug_Status.ug_pPath, TRUE);
- ugd->ug_Status.ug_pPath = NULL;
- }
+ ugd->ug_Status.ug_bInSettingView = true;
- ugd->ug_Status.ug_bInSettingView = true;
+ if (ugd->ug_Status.ug_pPath) {
+ g_string_free(ugd->ug_Status.ug_pPath, TRUE);
+ ugd->ug_Status.ug_pPath = NULL;
+ }
- if (ugd->ug_Status.ug_pPath) {
- g_string_free(ugd->ug_Status.ug_pPath, TRUE);
- ugd->ug_Status.ug_pPath = NULL;
- }
- pNavi_toshow->ug_pCurrentPath = strdup(UG_SETTING_RINGTONE_PATH);
- ugd->ug_Status.ug_pPath = g_string_new(pNavi_toshow->ug_pCurrentPath);
- title = mf_ug_fm_svc_wapper_get_file_name(ugd->ug_Status.ug_pPath);
-
- if (title != NULL) {
- pNavi_toshow->ug_pNaviTitle = g_strdup(title->str);
- g_string_free(title, TRUE);
- title = NULL;
- }
- mf_ug_navi_bar_create_default_view(ugd);
- mf_ug_ctrl_bar_set_item_disable(ugd);
+ pNavi_toshow->ug_pCurrentPath = strdup(UG_SETTING_RINGTONE_PATH);
+ ugd->ug_Status.ug_pPath = g_string_new(pNavi_toshow->ug_pCurrentPath);
+ title = mf_ug_fm_svc_wapper_get_file_name(ugd->ug_Status.ug_pPath);
- elm_object_item_text_set(pNavi_toshow->ug_pNaviItem, pNavi_toshow->ug_pNaviTitle);
- elm_naviframe_item_title_visible_set(pNavi_toshow->ug_pNaviItem, EINA_TRUE);
+ if (title != NULL) {
+ pNavi_toshow->ug_pNaviTitle = g_strdup(title->str);
+ g_string_free(title, TRUE);
+ title = NULL;
+ }
+ mf_ug_navi_bar_create_default_view(ugd);
+ mf_ug_ctrl_bar_set_item_disable(ugd);
- if (ugd->ug_MainWindow.ug_pTabBar && mf_ug_tab_bar_items_count_get(ugd->ug_MainWindow.ug_pTabBar) > 1) {
- elm_object_part_content_unset(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.content");
- elm_object_part_content_unset(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.tabbar");
- elm_object_part_content_unset(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content");
+ elm_object_item_text_set(ugd->ug_MainWindow.ug_pNaviItem, pNavi_toshow->ug_pNaviTitle);
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_TRUE);
- mf_ug_tab_bar_remove_all_items(ugd->ug_MainWindow.ug_pTabBar);
- UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pTabBar);
- mf_ug_navi_bar_remove_navi_list_item_by_label(ugd, MF_UG_LABEL_MMC);
+ if (ugd->ug_MainWindow.ug_pTabBar && mf_ug_tab_bar_items_count_get(ugd->ug_MainWindow.ug_pTabBar) > 1) {
+ elm_object_part_content_unset(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.content");
+ elm_object_part_content_unset(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.tabbar");
+ elm_object_part_content_unset(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content");
- Evas_Object *navibar = ug_mf_navi_bar_get_navibar_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, MF_UG_LABEL_PHONE);
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", navibar);
- evas_object_hide(ugd->ug_MainWindow.ug_pTabLayout);
- UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pTabLayout);
+ //mf_ug_tab_bar_remove_all_items(ugd->ug_MainWindow.ug_pTabBar);
+ UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pTabBar);
+ mf_ug_navi_bar_remove_navi_list_item_by_label(ugd, MF_UG_LABEL_MMC);
+
+ Evas_Object *navibar = ugd->ug_MainWindow.ug_pNaviBar;
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", navibar);
+ evas_object_hide(ugd->ug_MainWindow.ug_pTabLayout);
+ UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pTabLayout);
+ }
+ } else {
+ ug_destroy_me(ugd->ug);
}
- } else {
- ug_destroy_me(ugd->ug);
+
}
UG_TRACE_END;
@@ -169,25 +194,30 @@ void mf_ug_cb_add_button_cb(void *data, Evas_Object *obj, void *event_info) ugData *ugd = (ugData *)data;
ug_mf_retm_if(ugd == NULL, "ugData is NULL");
- bundle *b = NULL;
+ service_h service;
+
char *result = NULL;
if (ugd->ug_Status.ug_b_NaviPushFlag) {
UG_TRACE_END;
return;
}
- result = mf_ug_util_get_send_result(ugd);
+
+ if (ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE) {
+ result = g_strdup(ugd->ug_Status.ug_pPath->str);
+ } else {
+ result = mf_ug_util_get_send_result(ugd);
+ }
if (result) {
- b = bundle_create();
- ug_debug("result is [%s]", result);
- bundle_add(b, "result", result);
- ug_send_result(ugd->ug, b);
- if (result) {
- free(result);
- }
- if (b) {
- bundle_free(b);
+ int ret = 0;
+ ret = service_create(&service);
+ if (ret == SERVICE_ERROR_NONE) {
+ service_add_extra_data(service, "result", result);
+ ug_send_result(ugd->ug, service);
+ service_destroy(service);
}
+ ug_debug("result is [%s]", result);
+ UG_SAFE_FREE_CHAR(result);
}
if (0 != ugd->ug_ListPlay.ug_Player) {
@@ -197,6 +227,111 @@ void mf_ug_cb_add_button_cb(void *data, Evas_Object *obj, void *event_info) UG_TRACE_END;
}
+void mf_ug_cb_list_by_response_cb(void *data)
+{
+ ugData *ugd = (ugData *)data;
+ assert(ugd);
+
+ ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
+ ug_mf_retm_if(pNavi_s == NULL, "get navi failed");
+ Evas_Object *playout = ugd->ug_MainWindow.ug_pNaviLayout;
+ ug_mf_retm_if(playout == NULL, "get conformant failed");
+ Evas_Object *newContent = NULL;
+
+ newContent = mf_ug_genlist_create_content_list_view(ugd);
+
+ Evas_Object *unUsed = elm_object_part_content_unset(playout, "part1");
+ evas_object_del(unUsed);
+
+ elm_object_part_content_set(playout, "part1", newContent);
+
+}
+
+
+void mf_ug_cb_list_by_button_callback(void *data, Evas_Object * obj, void *event_info)
+{
+ assert(data);
+ assert(obj);
+ ugData *ugd = (ugData *)data;
+
+ Evas_Object *btn = (Evas_Object *)obj;
+ const char *label = elm_object_text_get(btn);
+ int iListBySortType = 0;
+
+ if (g_strcmp0(label, MF_UG_LABEL_ASCENDING) == 0 ) {
+ switch(ugd->ug_Status.ug_iSelectedSortType) {
+ case 0:
+ iListBySortType = MF_UG_SORT_BY_NAME_Z2A;
+ break;
+ case 1:
+ iListBySortType = MF_UG_SORT_BY_DATE_R2O;
+ break;
+
+ case 2:
+ iListBySortType = MF_UG_SORT_BY_SIZE_L2S;
+ break;
+ case 3:
+ iListBySortType = MF_UG_SORT_BY_TYPE_Z2A;
+ break;
+ default:
+ iListBySortType = MF_UG_SORT_BY_DATE_R2O;
+ break;
+ }
+ } else if(g_strcmp0(label, MF_UG_LABEL_DESCENDING) == 0 ) {
+ switch(ugd->ug_Status.ug_iSelectedSortType) {
+ case 0:
+ iListBySortType = MF_UG_SORT_BY_NAME_A2Z;
+ break;
+ case 1:
+ iListBySortType = MF_UG_SORT_BY_DATE_O2R;
+ break;
+
+ case 2:
+ iListBySortType = MF_UG_SORT_BY_SIZE_S2L;
+ break;
+ case 3:
+ iListBySortType = MF_UG_SORT_BY_TYPE_A2Z;
+ break;
+ default:
+ iListBySortType = MF_UG_SORT_BY_DATE_O2R;
+ break;
+ }
+
+ }
+ ugd->ug_Status.ug_iSortType = iListBySortType;
+ mf_ug_cb_list_by_response_cb(ugd);
+}
+
+
+void mf_ug_cb_popup_deleted_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ ugData *ugd = (ugData *)data;
+ assert(ugd);
+
+ mf_ug_cb_list_by_button_callback(data, obj, event_info);
+
+ if (ugd->ug_MainWindow.ug_pNormalPopup != NULL) {
+ evas_object_del(ugd->ug_MainWindow.ug_pNormalPopup);
+ }
+ ugd->ug_MainWindow.ug_pNormalPopup = NULL;
+
+}
+
+void mf_ug_cb_sort_by_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ UG_TRACE_BEGIN;
+ ugData *ugd = (ugData *)data;
+ ug_mf_retm_if(ugd == NULL, "ugData is NULL");
+
+ if (ugd->ug_Status.ug_b_NaviPushFlag) {
+ UG_TRACE_END;
+ return;
+ }
+ mf_ug_popup_create(ugd, UG_POPMODE_LIST_BY, MF_UG_LABEL_LIST_BY,
+ NULL, NULL, NULL, NULL, mf_ug_cb_popup_deleted_cb, ugd);
+ UG_TRACE_END;
+}
+
void mf_ug_cb_goto_myfile_button_cb(void *data, Evas_Object *obj, void *event_info)
{
UG_TRACE_BEGIN;
@@ -212,8 +347,7 @@ void mf_ug_cb_goto_myfile_button_cb(void *data, Evas_Object *obj, void *event_in ugNaviBar *pNavi_s = NULL;//ug_mf_navi_bar_get_navi_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, MF_UG_LABEL_PHONE);
ugNaviBar *pNavi_toshow = NULL;
- int mmc_card = 0;
- int error_code = 0;
+
EINA_LIST_FOREACH(ugd->ug_MainWindow.ug_pNaviBarList, l, item) {
pNavi_s = (ugNaviBar *)item;
if (pNavi_s == NULL)
@@ -245,45 +379,15 @@ void mf_ug_cb_goto_myfile_button_cb(void *data, Evas_Object *obj, void *event_in g_string_free(ugd->ug_Status.ug_pPath, TRUE);
ugd->ug_Status.ug_pPath = NULL;
}
- ugd->ug_Status.ug_pPath = g_string_new(PHONE_FOLDER);
+ ugd->ug_Status.ug_pPath = g_string_new(SOUNDS_FOLDER);
+ UG_SAFE_FREE_CHAR(pNavi_s->ug_pCurrentPath);
+ pNavi_s->ug_pCurrentPath = strdup(ugd->ug_Status.ug_pPath->str);
ugd->ug_Status.ug_bInSettingView = false;
mf_ug_navi_bar_create_default_view(ugd);
ugd->ug_Status.ug_bCancelDisableFlag = true;
-
- error_code = mf_ug_util_get_mmc_state(&mmc_card);
- if (error_code == 0 && mmc_card == 1) {
- Elm_Object_Item *pItemPhone = NULL;
- Elm_Object_Item *pItemMMC = NULL;
-
- if (ugd->ug_MainWindow.ug_pTabLayout == NULL) {
- ugd->ug_MainWindow.ug_pTabLayout = mf_ug_main_tab_layout_create(ugd->ug_MainWindow.ug_pWindow);
- ugd->ug_MainWindow.ug_pTabBackGround = mf_ug_main_create_bg(ugd->ug_MainWindow.ug_pWindow);
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.bg", ugd->ug_MainWindow.ug_pTabBackGround);
- }
- if (ugd->ug_MainWindow.ug_pTabBar == NULL) {
- ugd->ug_MainWindow.ug_pTabBar = mf_ug_tab_bar_create(ugd->ug_MainWindow.ug_pWindow);
- }
-
- pItemPhone =
- mf_ug_tab_bar_append_item(ugd->ug_MainWindow.ug_pTabBar, UG_ICON_PHONE, MF_UG_LABEL_PHONE,
- ugd);
- pItemMMC =
- mf_ug_tab_bar_append_item(ugd->ug_MainWindow.ug_pTabBar, UG_ICON_MEMORY, MF_UG_LABEL_MMC,
- ugd);
-
- //mf_ug_tab_bar_set_selected_item(pItemPhone);
- elm_object_part_content_unset(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content");
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.content", pNavi_toshow->ug_pNaviBar);
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.tabbar", ugd->ug_MainWindow.ug_pTabBar);
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pTabLayout);
- evas_object_show(ugd->ug_MainWindow.ug_pTabLayout);
- if (ugd->ug_Status.ug_bMassStorageFlag) {
- mf_ug_tab_bar_set_item_disable(ugd->ug_MainWindow.ug_pTabBar, EINA_TRUE);
- }
- }
-
mf_ug_ctrl_bar_set_item_disable(ugd);
+ mf_ug_tab_bar_init(ugd);
}
@@ -350,6 +454,8 @@ void mf_ug_cb_upper_click_cb(void *data, Evas_Object * obj, void *event_info) }
if (ugd->ug_Status.ug_pPath != NULL && pNavi_s->ug_pCurrentPath != NULL) {
+
+
if (g_strcmp0(pNavi_s->ug_pCurrentPath, MF_UG_LABEL_PHONE) == 0
|| g_strcmp0(pNavi_s->ug_pCurrentPath, MF_UG_LABEL_MMC) == 0) {
mf_ug_navi_bar_create_default_view(ugd);
@@ -374,6 +480,8 @@ void mf_ug_cb_upper_click_cb(void *data, Evas_Object * obj, void *event_info) }
mf_ug_navi_bar_create_default_view(ugd);
mf_ug_ctrl_bar_set_item_disable(ugd);
+ mf_ug_ctrl_bar_listby_item_diable(ugd->ug_MainWindow.ug_pNaviCtrlBar, false);
+ mf_ug_tar_bar_disable(ugd, false);
UG_TRACE_END;
}
@@ -393,6 +501,8 @@ void mf_ug_cb_home_button_cb(void *data, Evas_Object * obj, void *event_info) int storage = MF_UG_PHONE;
+ mf_ug_tar_bar_disable(ugd, false);
+
storage = mf_ug_fm_svc_wapper_get_location(ugd->ug_Status.ug_pPath->str);
switch (storage) {
case MF_UG_PHONE:
@@ -415,6 +525,7 @@ void mf_ug_cb_home_button_cb(void *data, Evas_Object * obj, void *event_info) mf_ug_navi_bar_create_default_view(ugd);
mf_ug_ctrl_bar_set_item_disable(ugd);
+ mf_ug_tar_bar_disable(ugd, false);
UG_TRACE_END;
}
@@ -479,11 +590,12 @@ void mf_ug_cb_tab_bar_cb(void *data, Evas_Object *obj, void *event_info) /*if the muisc is playing, destory the play */
/*1. get navi bar pointer by the label */
- pNaviBar = ug_mf_navi_bar_get_navibar_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, label);
+ pNaviBar = ugd->ug_MainWindow.ug_pNaviBar;
+ pNavi_s_toshow = ug_mf_navi_bar_get_navi_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, label);
ug_debug("label is %s", label);
/*2. create navi bar if not created, otherwise get it by pNaviBar */
- if (pNaviBar == NULL) {
+ if (pNavi_s_toshow == NULL) {
/*2.0 get root path by storage label */
rootpath = mf_ug_fm_svc_wapper_get_root_path_by_tab_label(label);
if (rootpath == NULL) {
@@ -499,15 +611,6 @@ void mf_ug_cb_tab_bar_cb(void *data, Evas_Object *obj, void *event_info) return;
}
- pNavi_s_toshow->ug_pNaviBar = mf_ug_navi_bar_create_navi_bar(ugd->ug_MainWindow.ug_pMainLayout);
- if (pNavi_s_toshow->ug_pNaviBar == NULL) {
- ug_debug("pNavi_s_toshow->ug_pNaviBar is NULL");
- free(rootpath);
- rootpath = NULL;
- free(pNavi_s_toshow);
- pNavi_s_toshow = NULL;
- return;
- }
pNavi_s_toshow->ug_bNaviFlagInUse = TRUE;
/*2.2 set path as root path of the storage */
pNavi_s_toshow->ug_pCurrentPath = g_strdup(rootpath);
@@ -525,12 +628,11 @@ void mf_ug_cb_tab_bar_cb(void *data, Evas_Object *obj, void *event_info) mf_ug_navi_bar_create_default_view(ugd);
/*2.4 set the navi to tab bar item */
- mf_ug_tab_bar_set_item_view(it, ugd->ug_MainWindow.ug_pTabLayout, pNavi_s_toshow->ug_pNaviBar);
mf_ug_navi_bar_set_blocking(ugd, false);
} else {
/*/2.1 get the navi of the tab */
- pNavi_s_toshow = mf_ug_navi_bar_get_navi_struct_by_navi(ugd, pNaviBar);
+ pNavi_s_toshow = mf_ug_navi_bar_get_navi_struct_by_label(ugd, label);
pNavi_s_toshow->ug_bNaviFlagInUse = TRUE;
@@ -542,12 +644,12 @@ void mf_ug_cb_tab_bar_cb(void *data, Evas_Object *obj, void *event_info) ugd->ug_Status.ug_pPath = g_string_new(pNavi_s_toshow->ug_pCurrentPath);
/*/2.3 update the content to catch update */
newContent = mf_ug_genlist_create_content_list_view(ugd);
- pNavi_s_toshow->ug_pContent = newContent;
- mf_ug_navi_bar_set_new_content(pNavi_s_toshow->ug_pNaviLayout, newContent);
- mf_ug_tab_bar_set_item_view(it, ugd->ug_MainWindow.ug_pTabLayout, pNavi_s_toshow->ug_pNaviBar);
+ ugd->ug_MainWindow.ug_pContent = newContent;
+ mf_ug_navi_bar_set_new_content(ugd->ug_MainWindow.ug_pNaviLayout, newContent);
}
-
+ mf_ug_tab_bar_set_item_view(ugd->ug_MainWindow.ug_pTabLayout, ugd->ug_MainWindow.ug_pNaviBar);
mf_ug_ctrl_bar_set_item_disable(ugd);
+ mf_ug_ctrl_bar_listby_item_diable(ugd->ug_MainWindow.ug_pNaviCtrlBar, false);
} else {
ug_debug("Invalid argument: label is NULL\n");
}
@@ -741,14 +843,9 @@ void mf_ug_cb_mmc_changed_cb(keynode_t *key, void *data) ugd->ug_Status.ug_iMmcFlag = MMC_ON;
return;
}
+ ugd->ug_Status.ug_iMmcFlag = MMC_ON;
mf_ug_util_storage_insert_action(ugd, MF_UG_LABEL_MMC);
-#ifdef MF_UG_FEATURE_NEW_UX
- ugNaviBar *pNaviInUseStruct = mf_ug_navi_bar_get_in_use_navi(ugd);
- elm_naviframe_item_title_visible_set(pNaviInUseStruct->ug_pNaviItem, EINA_FALSE);
-#endif
- ugd->ug_Status.ug_iMmcFlag = MMC_ON;
- return;
} else {
ugNaviBar *pNaviInUseStruct = NULL;
@@ -780,9 +877,7 @@ void mf_ug_cb_mmc_changed_cb(keynode_t *key, void *data) mf_ug_navi_bar_remove_navi_list_item_by_label(ugd, labelStorage);
mf_ug_tab_bar_remove_item_by_label(ugd->ug_MainWindow.ug_pTabBar, labelStorage);
if (mf_ug_util_set_main_layout_by_tab_item_count(ugd) == 0) {
- pNaviInUseStruct = mf_ug_navi_bar_get_in_use_navi(ugd);
- ug_debug("pNaviInUseStruct is [%p]", pNaviInUseStruct);
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", pNaviInUseStruct->ug_pNaviBar);
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pNaviBar);
evas_object_show(ugd->ug_MainWindow.ug_pMainLayout);
}
} else {
@@ -799,19 +894,22 @@ void mf_ug_cb_mmc_changed_cb(keynode_t *key, void *data) mf_ug_tab_bar_remove_item_by_label(ugd->ug_MainWindow.ug_pTabBar, labelStorage);
pNaviInUseStruct = mf_ug_navi_bar_get_in_use_navi(ugd);
if (mf_ug_util_set_main_layout_by_tab_item_count(ugd) == 0) {
- ug_debug();
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", pNaviInUseStruct->ug_pNaviBar);
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pNaviBar);
evas_object_show(ugd->ug_MainWindow.ug_pMainLayout);
}
mf_ug_navi_bar_refresh_navibar_recovered_view(ugd, pNaviInUseStruct);
}
-#ifdef MF_UG_FEATURE_NEW_UX
- if (ugd->ug_Status.ug_iMmcFlag == MMC_ON && !(ugd->ug_Status.ug_bSettingEntry == true && ugd->ug_Status.ug_bInSettingView == true))
- elm_naviframe_item_title_visible_set(pNaviInUseStruct->ug_pNaviItem, EINA_FALSE);
- else
- elm_naviframe_item_title_visible_set(pNaviInUseStruct->ug_pNaviItem, EINA_TRUE);
-#endif
+ }
+
+ if ((ugd->ug_Status.ug_bSettingEntry == true && ugd->ug_Status.ug_bInSettingView == true)) {
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_TRUE);
+ } else if (!mf_ug_fm_svc_wapper_is_root_path(ugd)) {
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_FALSE);
+ } else if (ugd->ug_Status.ug_iMmcFlag == MMC_OFF && mf_ug_fm_svc_wapper_is_root_path(ugd)) {
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_TRUE);
+ } else {
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_FALSE);
}
UG_TRACE_END;
return;
@@ -839,8 +937,8 @@ void mf_ug_cb_mass_storage_changed_cb(keynode_t *key, void *data) ug_mf_retm_if(pNavi_toshow == NULL, "get navigation bar in use failed");
ugd->ug_Status.ug_bMassStorageFlag = false;
- pNavi_toshow->ug_pContent = newContent = mf_ug_genlist_create_content_list_view(ugd);
- mf_ug_navi_bar_set_new_content(pNavi_toshow->ug_pNaviLayout, newContent);
+ ugd->ug_MainWindow.ug_pContent = newContent = mf_ug_genlist_create_content_list_view(ugd);
+ mf_ug_navi_bar_set_new_content(ugd->ug_MainWindow.ug_pNaviLayout, newContent);
mf_ug_ctrl_bar_set_item_disable(ugd);
if (ugd->ug_MainWindow.ug_pTabBar) {
@@ -961,8 +1059,8 @@ void mf_ug_cb_dir_pipe_cb(void *data, void *buffer, unsigned int nbyte) ug_mf_error("Unknown event");
break;
}
- pNavi_s->ug_pContent = newContent = mf_ug_genlist_create_content_list_view(ugd);
- mf_ug_navi_bar_set_new_content(pNavi_s->ug_pNaviLayout, newContent);
+ ugd->ug_MainWindow.ug_pContent = newContent = mf_ug_genlist_create_content_list_view(ugd);
+ mf_ug_navi_bar_set_new_content(ugd->ug_MainWindow.ug_pNaviLayout, newContent);
mf_ug_ctrl_bar_set_item_disable(ugd);
if (msg->name) {
free(msg->name);
@@ -1022,7 +1120,7 @@ Eina_Bool mf_ug_cb_thumb_timer_cb(void *data) elm_genlist_item_update(it);
} else if (ecore_file_exists(item_data->ug_pItemName->str)) {
- char *new_thumb = mf_ug_file_attr_get_file_icon(ugd->ug_Status.ug_pMedia_svc_handle, item_data->ug_pItemName->str, NULL);
+ char *new_thumb = mf_ug_file_attr_get_file_icon(item_data->ug_pItemName->str, NULL);
if (new_thumb) {
if (item_data->ug_pThumbPath) {
free(item_data->ug_pThumbPath);
@@ -1050,3 +1148,358 @@ Eina_Bool mf_ug_cb_thumb_timer_cb(void *data) }
}
#endif
+
+void mf_ug_cb_create_new_folder(void *data, Evas_Object * obj, void *event_info)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is NULL");
+
+ ugData *ugd = (ugData *)data;
+
+ if (ugd->ug_Status.ug_b_NaviPushFlag) {
+ UG_TRACE_END;
+ return;
+ }
+
+ if (ugd->ug_Status.ug_iMore == UG_MORE_CREATE_FOLDER)
+ return;
+
+ int ret = 0;
+ ugd->ug_Status.ug_iMore = UG_MORE_CREATE_FOLDER;
+
+ ret = mf_ug_util_check_disk_space(ugd);
+ if (ret == MYFILE_ERR_NO_FREE_SPACE) {
+ ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
+ return;
+ }
+#ifdef UG_THUMB_REAL_TIME_UPDATE
+ if (ugd->ug_Status.ug_pThumbUpdateTimer != NULL) {
+ ecore_timer_del(ugd->ug_Status.ug_pThumbUpdateTimer);
+ ugd->ug_Status.ug_pThumbUpdateTimer = NULL;
+ }
+#endif
+ mf_ug_navi_bar_create_new_folder_view(ugd);
+
+}
+
+void mf_ug_cb_warning_popup_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is NULL");
+ ugData *ugd = (ugData *)data;
+
+ Evas_Object *btn = (Evas_Object *)obj;
+ const char *label = elm_object_text_get(btn);
+
+ if (g_strcmp0(label, MF_UG_LABEL_OK) == 0 ) {
+ evas_object_del(ugd->ug_MainWindow.ug_pNormalPopup);
+ ugd->ug_MainWindow.ug_pNormalPopup = NULL;
+ }
+}
+
+void mf_ug_cb_reach_max_len_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is NULL");
+ ugData *ugd = (ugData *)data;
+
+ mf_ug_util_play_vibration(ugd, UG_MAX_LEN_VIB_DURATION);
+ UG_TRACE_END;
+}
+
+void mf_ug_cb_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ elm_entry_entry_set(data, "");
+}
+
+void mf_ug_cb_cancel_new_folder_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is NULL");
+ ugData *ugd = (ugData *)data;
+
+ mf_ug_navi_bar_reset_tab_to_main(ugd);
+ ugNaviBar *pNavi_toshow = NULL;
+ pNavi_toshow = mf_ug_navi_bar_get_in_use_navi(ugd);
+ ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
+ ecore_imf_context_input_panel_hide(elm_entry_imf_context_get(ugd->ug_MainWindow.ug_pEntry));
+ evas_object_del(ugd->ug_MainWindow.ug_pEntry);
+
+ mf_ug_navi_bar_create_default_view(ugd);
+ mf_ug_ctrl_bar_set_item_disable(ugd);
+}
+
+static int __mf_cb_imk_cancel_cb(void *data)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retvm_if(data == NULL, false, "data is NULL");
+ ugData *ugd = (ugData *)data;
+
+ mf_ug_cb_cancel_new_folder_cb(ugd, NULL, NULL);
+ return 0;
+}
+
+
+static void __mf_ug_cb_illegal_char_popup_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is NULL");
+ ugData *ugd = (ugData *)data;
+
+ Evas_Object *btn = (Evas_Object *)obj;
+ const char *label = elm_object_text_get(btn);
+
+ if (g_strcmp0(label, MF_UG_LABEL_YES) == 0 ) {
+ UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pNormalPopup);
+
+ Evas_Object *entry = ugd->ug_MainWindow.ug_pEntry;
+ if (entry != NULL)
+ elm_object_focus_set(entry, EINA_TRUE);
+
+ } else if (g_strcmp0(label, MF_UG_LABEL_NO) == 0 ) {
+ UG_SAFE_FREE_OBJ(ugd->ug_MainWindow.ug_pNormalPopup);
+ ecore_idler_add((Ecore_Task_Cb) __mf_cb_imk_cancel_cb, ugd);
+ }
+
+}
+
+static int __mf_ug_cb_ime_mkdir_cb(void *data, char *fileName)
+{
+ UG_TRACE_BEGIN;
+ ugData *ugd = (ugData *)data;
+
+ ug_mf_retvm_if(ugd == NULL, MYFILE_ERR_SRC_ARG_INVALID, "ugd is NULL");
+ ug_mf_retvm_if(fileName == NULL, MYFILE_ERR_SRC_ARG_INVALID, "data is NULL");
+ ug_mf_retvm_if(ugd->ug_Status.ug_pPath == NULL, MYFILE_ERR_SRC_ARG_INVALID, "ugd is NULL");
+ ug_mf_retvm_if(ugd->ug_Status.ug_pPath->str == NULL, MYFILE_ERR_SRC_ARG_INVALID, "ugd is NULL");
+
+
+ int ret = 0;
+ const char *message = NULL;
+ const char *left_label = NULL;
+ const char *right_label = NULL;
+
+ left_label = MF_UG_LABEL_YES;
+ right_label = MF_UG_LABEL_NO;
+ if (strlen(fileName)) {
+
+ GString *fullpathdir = g_string_new(ugd->ug_Status.ug_pPath->str);
+
+ if (fullpathdir == NULL) {
+ mf_ug_util_operation_alloc_failed(ugd);
+ return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
+ }
+ GString *fullpathname = g_string_new(fileName);
+
+ if (fullpathname == NULL) {
+ g_string_free(fullpathdir, TRUE);
+ fullpathdir = NULL;
+ mf_ug_util_operation_alloc_failed(ugd);
+ return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
+ }
+ /*check the space */
+ gchar *test_space = g_strdup(fileName);
+ if (test_space == NULL) {
+ g_string_free(fullpathdir, TRUE);
+ fullpathdir = NULL;
+ g_string_free(fullpathname, TRUE);
+ fullpathname = NULL;
+ mf_ug_util_operation_alloc_failed(ugd);
+ return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
+ }
+ if (strlen(g_strchug(test_space)) == 0) {
+ message = MF_UG_LABEL_NAME_INVALID; /*TODO */
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
+ left_label, right_label, NULL,
+ __mf_ug_cb_illegal_char_popup_cb, ugd);
+
+ g_string_free(fullpathdir, TRUE);
+ fullpathdir = NULL;
+ g_string_free(fullpathname, TRUE);
+ fullpathname = NULL;
+ g_free(test_space);
+ test_space = NULL;
+ return MYFILE_ERR_DIR_CREATE_FAIL;
+ }
+
+ g_free(test_space);
+ test_space = NULL;
+
+ /*check if input name is valid */
+ if (mf_ug_file_attr_is_valid_name(fullpathname->str) == MYFILE_ERR_INVALID_FILE_NAME) {
+
+ message = MF_UG_LABEL_ILLEGAL_CHAR;
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
+ left_label, right_label, NULL,
+ __mf_ug_cb_illegal_char_popup_cb, ugd);
+ g_string_free(fullpathdir, TRUE);
+ fullpathdir = NULL;
+ g_string_free(fullpathname, TRUE);
+ fullpathname = NULL;
+
+ return MYFILE_ERR_DIR_CREATE_FAIL;
+ }
+
+ GString *fullpath = NULL;
+ char *temp_fullpath = g_strconcat(fullpathdir->str, "/", fullpathname->str, NULL);
+ if (temp_fullpath) {
+ fullpath = g_string_new(temp_fullpath);
+
+ free(temp_fullpath);
+ temp_fullpath = NULL;
+ if (fullpath == NULL) {
+ g_string_free(fullpathdir, TRUE);
+ fullpathdir = NULL;
+ g_string_free(fullpathname, TRUE);
+ fullpathname = NULL;
+ mf_ug_util_operation_alloc_failed(ugd);
+ return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
+ }
+ } else {
+ g_string_free(fullpathdir, TRUE);
+ fullpathdir = NULL;
+ g_string_free(fullpathname, TRUE);
+ fullpathname = NULL;
+ return MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
+ }
+
+ /*check whether DIR name is override(DIR name has no extention) */
+ /*check whether path length is override */
+ if ((strlen(fullpathdir->str) + strlen(fullpathname->str)) > MYFILE_FILE_PATH_LEN_MAX) {
+
+ message = MF_UG_LABEL_PATH_REACH_MAX_LEN;
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
+ left_label, right_label, NULL,
+ __mf_ug_cb_illegal_char_popup_cb, ugd);
+ g_string_free(fullpathdir, TRUE);
+ fullpathdir = NULL;
+ g_string_free(fullpathname, TRUE);
+ fullpathname = NULL;
+ ret = MYFILE_ERR_DIR_CREATE_FAIL;
+ }
+ /*check if duplicated name */
+ else if (mf_ug_file_attr_is_duplicated_name(ugd->ug_Status.ug_pPath->str, fileName) == MYFILE_ERR_DUPLICATED_NAME) {
+ message = MF_UG_LABEL_DUP_NAME;
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
+ left_label, right_label, NULL,
+ __mf_ug_cb_illegal_char_popup_cb, ugd);
+
+ g_string_free(fullpathdir, TRUE);
+ fullpathdir = NULL;
+ g_string_free(fullpathname, TRUE);
+ fullpathname = NULL;
+ ret = MYFILE_ERR_DIR_CREATE_FAIL;
+ }
+ /*check if DIR name is all spaces */
+ else {
+ ret = mf_ug_fm_svc_wrapper_create_service(ugd, fullpath);
+ /*check whether operate on read only area */
+ if (errno == EROFS) {
+ message = MF_UG_LABEL_OPER_READ_ONLY;
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
+ ret = MYFILE_ERR_DIR_CREATE_FAIL;
+ } else if (ret) {
+ message = MF_UG_LABEL_CREATE_DIR_FAILED;
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, message, NULL, NULL, NULL, NULL, NULL);
+ }
+
+ g_string_free(fullpathdir, TRUE);
+ fullpathdir = NULL;
+ g_string_free(fullpathname, TRUE);
+ fullpathname = NULL;
+ g_string_free(fullpath, TRUE);
+ fullpath = NULL;
+
+ }
+ } else {
+ message = MF_UG_LABEL_EMPTY_FOLDER_NAME;
+
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
+ left_label, right_label, NULL,
+ __mf_ug_cb_illegal_char_popup_cb, ugd);
+ ret = MYFILE_ERR_DIR_CREATE_FAIL;
+ }
+ return ret;
+}
+
+
+void mf_ug_cb_save_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is NULL");
+ ugData *ugd = (ugData *)data;
+
+ if (ugd->ug_Status.ug_b_NaviPushFlag) {
+ UG_TRACE_END;
+ return;
+ }
+
+ int ret = 0;
+ const char *message = NULL;
+ const char *left_label = NULL;
+ const char *right_label = NULL;
+
+ if (ugd->ug_Status.ug_iMore == UG_MORE_CREATE_FOLDER) {
+ const char *entry_data = NULL;
+ char *name = NULL;
+
+ /*hide IMF*/
+ if (ugd->ug_MainWindow.ug_pEntry != NULL) {
+ Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ugd->ug_MainWindow.ug_pEntry);
+ if (imf_context != NULL)
+ ecore_imf_context_hide(imf_context);
+ }
+
+ entry_data = elm_entry_entry_get(ugd->ug_MainWindow.ug_pEntry);
+
+ if (entry_data) {
+ name = elm_entry_markup_to_utf8(entry_data);
+ } else {
+ message = MF_UG_LABEL_GET_NAME_FAILED;
+ left_label = MF_UG_LABEL_YES;
+ right_label = MF_UG_LABEL_NO;
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT_TWO_BTN, NULL, message,
+ left_label, right_label, NULL,
+ __mf_ug_cb_illegal_char_popup_cb, ugd);
+ return;
+ }
+
+ if (name == NULL)
+ return;
+
+ ret = __mf_ug_cb_ime_mkdir_cb(ugd, name);
+ if (ret == 0) {
+ mf_ug_navi_bar_reset_tab_to_main(ugd);
+ ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT;
+ ecore_imf_context_input_panel_hide(elm_entry_imf_context_get(ugd->ug_MainWindow.ug_pEntry));
+ evas_object_del(ugd->ug_MainWindow.ug_pEntry);
+
+ mf_ug_navi_bar_create_default_view(ugd);
+ mf_ug_ctrl_bar_set_item_disable(ugd);
+ }
+
+ if (name != NULL) {
+ free(name);
+ name = NULL;
+ }
+ }
+}
+
+void mf_ug_cb_lcd_state_changed_cb(power_state_e state, void *user_data)
+{
+ UG_TRACE_BEGIN;
+
+ ug_mf_retm_if(user_data == NULL, "user_data is NULL");
+ ugData *ugd = (ugData *)user_data;
+
+ if(state == POWER_STATE_SCREEN_OFF){
+ if (0 != ugd->ug_ListPlay.ug_Player) {
+ ug_debug("destory the playing file");
+ mf_ug_list_play_destory_playing_file(ugd);
+ mf_ug_list_play_update_item_icon(ugd);
+ UG_SAFE_FREE_CHAR(ugd->ug_ListPlay.ug_pPlayFilePath);
+ }
+ }
+ UG_TRACE_END;
+}
+
diff --git a/src/common/mf-ug-fm-svc-wapper.c b/src/common/mf-ug-fm-svc-wapper.c index c7296e0..f4eb7f9 100755..100644 --- a/src/common/mf-ug-fm-svc-wapper.c +++ b/src/common/mf-ug-fm-svc-wapper.c @@ -1,22 +1,25 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
+#include <sys/statvfs.h>
#include "mf-ug-util.h"
#include "mf-ug-cb.h"
@@ -95,6 +98,7 @@ static int __mf_ug_fm_svc_wapper_COMESFROM(char *fullpath) ******************************/
static int __mf_ug_fm_svc_wapper_get_file_list(GString *fullpath, Eina_List **dir_list, Eina_List **file_list)
{
+ UG_TRACE_BEGIN;
ug_mf_retvm_if(fullpath == NULL, MYFILE_ERR_INVALID_ARG, "fullpath is NULL");
ug_mf_retvm_if(fullpath->str == NULL, MYFILE_ERR_INVALID_ARG, "fullpath->str is NULL");
ug_mf_retvm_if(fullpath->len == 0, MYFILE_ERR_INVALID_ARG, "fullpath->len is 0");
@@ -107,6 +111,7 @@ static int __mf_ug_fm_svc_wapper_get_file_list(GString *fullpath, Eina_List **di } else {
ug_debug("success get the file list\n");
}
+ UG_TRACE_END;
return error_code;
}
@@ -166,6 +171,54 @@ unsigned long mf_ug_fm_svc_wapper_get_file_filter(int file_filter_mode) return filter;
}
+int mf_ug_fm_svc_wapper_get_drm_filter(int drm_filter_mode, unsigned long file_filter)
+{
+ int drm_filter = 0;
+ unsigned long filter = file_filter;
+ unsigned long all = (unsigned long)(UG_FILTER_CATEGORY_ALL);
+
+ switch (drm_filter_mode) {
+ case DRM_FILTER_ALL:
+ if (filter == all) {
+ ug_debug("drm_filter is ALL");
+ drm_filter |= MF_UG_FILTER_DRM_ALL;
+ } else {
+ if (filter & UG_FILTER_CATEGORY_IMAGE) {
+ ug_debug("drm_filter is IMAGE");
+ drm_filter |= MF_UG_FILTER_DRM_IMAGE;
+ }
+ if (filter & UG_FILTER_CATEGORY_SOUND) {
+ ug_debug("drm_filter is SOUND");
+ drm_filter |= MF_UG_FILTER_DRM_RINGTONE;
+ }
+ if (filter & UG_FILTER_CATEGORY_MUSIC) {
+ ug_debug("drm_filter is MUSIC");
+ drm_filter |= MF_UG_FILTER_DRM_RINGTONE;
+ }
+ }
+ break;
+ case DRM_FILTER_WITHOUT_FL:
+ drm_filter |= MF_UG_FILTER_DRM_WITHOUT_FL;
+ if (filter == all) {
+ drm_filter |= MF_UG_FILTER_DRM_ALL;
+ } else {
+ if (filter & UG_FILTER_CATEGORY_IMAGE) {
+ drm_filter |= MF_UG_FILTER_DRM_IMAGE;
+ }
+ if (filter & UG_FILTER_CATEGORY_SOUND) {
+ drm_filter |= MF_UG_FILTER_DRM_RINGTONE;
+ }
+ if (filter & UG_FILTER_CATEGORY_MUSIC) {
+ drm_filter |= MF_UG_FILTER_DRM_RINGTONE;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return drm_filter;
+}
+
int mf_ug_fm_svc_wapper_get_file_list_by_filter(ugData *data, GString *fullpath, Eina_List **dir_list, Eina_List **filter_list)
{
ugData *ugd = data;
@@ -177,12 +230,14 @@ int mf_ug_fm_svc_wapper_get_file_list_by_filter(ugData *data, GString *fullpath, int error_code = 0;
int filter_mode = 0;
int file_filter = 0;
+ int drm_filter = 0;
int file_list_len = 0;
Eina_List *file_list = NULL;
char *extension = NULL;
filter_mode = ugd->ug_UiGadget.ug_iFilterMode;
file_filter = ugd->ug_UiGadget.ug_iFileFilter;
+ drm_filter = ugd->ug_UiGadget.ug_iDrmFilter;
ug_debug("fullpath is [%s]", fullpath->str);
error_code = __mf_ug_fm_svc_wapper_get_file_list(fullpath, dir_list, &file_list);
@@ -195,7 +250,8 @@ int mf_ug_fm_svc_wapper_get_file_list_by_filter(ugData *data, GString *fullpath, ug_debug("file_filter is [%d]\n", filter_mode);
if (filter_mode != SHOW_BY_EXTENSION) {
- error_code = mf_ug_fs_oper_list_filter(file_list, filter_list, file_filter);
+ ug_debug("file_filter is [%d] drm_filter is [%d]", file_filter, drm_filter);
+ error_code = mf_ug_fs_oper_list_filter(file_list, filter_list, file_filter, drm_filter);
} else if (ugd->ug_UiGadget.ug_pExtension != NULL) {
extension = strdup(ugd->ug_UiGadget.ug_pExtension);
error_code = mf_ug_fs_oper_list_filter_by_extension(file_list, filter_list, extension);
@@ -545,3 +601,353 @@ char *mf_ug_fm_svc_wapper_path_info_get(char *original_path) }
+unsigned long mf_ug_fm_svc_wrapper_get_free_space(int state)
+{
+ struct statvfs info;
+ char *path = NULL;
+
+ if (state == MF_UG_PHONE) {
+ path = PHONE_FOLDER;
+ } else if (state == MF_UG_MMC) {
+ path = MEMORY_FOLDER;
+ } else {
+ return -1;
+ }
+
+ if (-1 == statvfs(path, &info)) {
+ return -2;
+ }
+ return (info.f_bsize) * info.f_bfree;
+}
+
+bool mf_ug_fm_svc_wrapper_detect_duplication(GString *to)
+{
+ int existing = MYFILE_ERR_NONE;
+ if (to == NULL) {
+ return false;
+ }
+ GString *parent_path = mf_ug_fm_svc_wrapper_get_file_parent_path(to);
+ GString *file_name = mf_ug_fm_svc_wapper_get_file_name(to);
+
+ ug_debug("full path and file name %s", to->str);
+ if (file_name == NULL || parent_path == NULL || file_name->len == 0) {
+ return false;
+ }
+
+ if (parent_path->str != NULL) {
+ ug_debug("parent_path->str is %s", parent_path->str);
+ }
+ if (file_name->str != NULL) {
+ ug_debug("file_name->str is %s", file_name->str);
+ }
+
+ existing = mf_ug_file_attr_is_duplicated_name(parent_path->str, file_name->str);
+
+ ug_debug("EXIST result is %d", existing);
+
+ if (parent_path != NULL) {
+ g_string_free(parent_path, TRUE);
+ }
+ parent_path = NULL;
+
+ if (file_name != NULL) {
+ g_string_free(file_name, TRUE);
+ }
+ file_name = NULL;
+
+ if (existing == MYFILE_ERR_NONE) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+static int __mf_ug_fm_svc_wrapper_get_next_number(char *file_name_without_ext, int file_name_type)
+{
+ int nCount = 0;
+ int nLength = 0;
+ int nUnderline = 0;
+ bool bAllDigits = true;
+ int i;
+
+ /* check _02d format */
+ nLength = strlen(file_name_without_ext);
+
+ if (file_name_type == FILE_NAME_WITH_UNDERLINE) {
+ if (nLength < 3) { /*4 means the # of minimum characters (*_n) */
+ return 1; /*doesn't match */
+ } else { /* input is more than 3 bytes */
+ /* find '_' */
+ for (nUnderline = nLength - 1; nUnderline >= 0; nUnderline--) {
+ if (file_name_without_ext[nUnderline] == '_') {
+ break;
+ }
+ }
+
+ if (nUnderline == 0 && file_name_without_ext[0] != '_') {
+ return 1; /* doesn't match */
+ }
+ /* check the right characters are all digits */
+ for (i = nUnderline + 1; i < nLength; i++) {
+ if (file_name_without_ext[i] < '0' || file_name_without_ext[i] > '9') {
+ bAllDigits = false;
+ break;
+ }
+ }
+
+ if (bAllDigits) {
+ for (i = nUnderline + 1; i < nLength; i++) {
+ nCount *= 10;
+ nCount += file_name_without_ext[i] - '0';
+ }
+
+ file_name_without_ext[nUnderline] = '\0'; /* truncate the last '_dd' */
+ }
+ }
+ } else {
+
+ if (nLength < 5) { /* 5 means the # of minimum characters (*_(n)) */
+ return 1; /*doesn't match */
+ } else { /* input is more than 3 bytes */
+ /* find '_' */
+ for (nUnderline = nLength - 1; nUnderline >= 0; nUnderline--) {
+ if (file_name_without_ext[nUnderline] == '(') {
+ break;
+ }
+ }
+
+ if (nUnderline == 0 && file_name_without_ext[0] != '(') {
+ return 1; /* doesn't match */
+ }
+ /* check the right characters are all digits */
+ for (i = nUnderline + 1; i < nLength - 1; i++) {
+ if (file_name_without_ext[i] < '0' || file_name_without_ext[i] > '9') {
+ bAllDigits = false;
+ break;
+ }
+ }
+
+ /* and more than 2 columns. */
+ if (bAllDigits) {
+ for (i = nUnderline + 1; i < nLength - 1; i++) {
+ nCount *= 10;
+ nCount += file_name_without_ext[i] - '0';
+ }
+
+ file_name_without_ext[nUnderline] = '\0'; /* truncate the last '_dd' */
+ }
+ }
+ }
+
+ /* increase nCount by 1 */
+ nCount++;
+
+ return nCount;
+}
+
+
+static int __mf_ug_fm_svc_wrapper_get_unique_name(const char *default_dir_full_path, char *original_file_name, char **unique_file_name,
+ int file_name_type, void *data)
+{
+ ug_mf_retvm_if(unique_file_name == NULL, MYFILE_ERR_SRC_ARG_INVALID, "unique_file_name is NULL");
+ ug_mf_retvm_if(data == NULL, MYFILE_ERR_SRC_ARG_INVALID, "data is NULL");
+
+ char *file_name_without_ext = NULL;
+ char *file_ext = NULL;
+ char *new_file_name = NULL;
+ bool result = false;
+ char *dir_rel_path = NULL;
+ int slash = 1;
+ int nCount = 0;
+ bool bExt = false;
+ int error_code = 0;
+
+ if (default_dir_full_path == NULL || original_file_name == NULL) {
+ ug_debug("default_dir_full_path == NULL || \
+ original_file_name == NULL || \
+ unique_file_name == NULL || \
+ error_code == NULL ");
+ error_code = MYFILE_ERR_SRC_ARG_INVALID;
+ goto Exception;
+ }
+ result = mf_ug_file_attr_get_logical_path_by_full(default_dir_full_path, &dir_rel_path);
+
+ if (result) {
+ error_code = MYFILE_ERR_GET_LOGIC_PATH_FAIL;
+ goto Exception;
+ }
+
+ if (strncmp(dir_rel_path, "/", strlen(dir_rel_path)) == 0) {
+ slash = 0;
+ }
+
+ error_code = mf_ug_file_attr_is_duplicated_name(default_dir_full_path, original_file_name);
+ if (error_code == 0) {
+ ug_debug("unique_file_name [%s]", *unique_file_name);
+ ug_debug("original_file_name [%s]", new_file_name);
+ *unique_file_name = g_strdup(original_file_name);
+ ug_debug("unique_file_name [%s]", *unique_file_name);
+ }
+
+ while (error_code < 0) {
+ error_code = 0;
+ bExt = mf_ug_file_attr_get_file_ext(original_file_name, &file_ext);
+ file_name_without_ext = g_strdup(original_file_name);
+
+ if (file_name_without_ext == NULL) {
+ error_code = MYFILE_ERR_ALLOCATE_MEMORY_FAIL;
+ goto Exception;
+ }
+
+ /* add a condition, whether extention is or not. */
+ if (bExt == 0) {
+ file_name_without_ext[strlen(file_name_without_ext) - strlen(file_ext) - 1] = '\0';
+ }
+
+ nCount = __mf_ug_fm_svc_wrapper_get_next_number(file_name_without_ext, file_name_type);
+ if (nCount == 1 && file_name_type == FILE_NAME_WITH_BRACKETS) {
+ char *file_name_with_space = g_strconcat(file_name_without_ext, " ", NULL);
+ if (file_name_with_space) {
+ UG_SAFE_FREE_CHAR(file_name_without_ext);
+ file_name_without_ext = file_name_with_space;
+ file_name_with_space = NULL;
+ }
+ }
+
+ if (bExt == 0) {
+ if (file_name_type == FILE_NAME_WITH_BRACKETS)
+ new_file_name = g_strdup_printf("%s(%d).%s", file_name_without_ext, nCount, file_ext);
+ else
+ new_file_name = g_strdup_printf("%s_%d.%s", file_name_without_ext, nCount, file_ext);
+ } else {
+
+ if (file_name_type == FILE_NAME_WITH_BRACKETS)
+ new_file_name = g_strdup_printf("%s(%d)", file_name_without_ext, nCount);
+ else
+ new_file_name = g_strdup_printf("%s_%d", file_name_without_ext, nCount);
+ }
+ UG_SAFE_FREE_CHAR(file_name_without_ext);
+
+ ug_debug("new name is %s\n", new_file_name);
+
+ if (error_code != 0) {
+ original_file_name = g_strdup(new_file_name);
+ error_code = MYFILE_ERR_DUPLICATED_NAME;
+ UG_SAFE_FREE_CHAR(new_file_name);
+ UG_SAFE_FREE_CHAR(file_ext);
+ continue;
+ } else {
+ error_code = mf_ug_file_attr_is_duplicated_name(default_dir_full_path, new_file_name);
+ if (error_code == 0) {
+ *unique_file_name = g_strdup(new_file_name);
+ //ug_debug("rename finished\n");
+ error_code = MYFILE_ERR_NONE;
+ goto Exception;
+ } else {
+ //ug_debug("rename continue\n");
+ original_file_name = g_strdup(new_file_name);
+ UG_SAFE_FREE_CHAR(new_file_name);
+ }
+ }
+ UG_SAFE_FREE_CHAR(file_ext);
+ }
+
+ return MYFILE_ERR_NONE;
+
+Exception:
+ UG_SAFE_FREE_CHAR(dir_rel_path);
+ UG_SAFE_FREE_CHAR(file_ext);
+ UG_SAFE_FREE_CHAR(new_file_name);
+ return error_code;
+}
+
+int mf_ug_fm_svc_wrapper_file_auto_rename(void *data, GString *fullpath, int file_name_type, GString **filename)
+{
+ ug_mf_retvm_if(data == NULL, MYFILE_ERR_SRC_ARG_INVALID, "data is NULL");
+ ugData *ugd = (ugData *)data;
+
+ GString *parent_path = mf_ug_fm_svc_wrapper_get_file_parent_path(fullpath);
+ GString *file_name = mf_ug_fm_svc_wapper_get_file_name(fullpath);
+
+ if (parent_path == NULL || file_name == NULL) {
+ return MYFILE_ERR_GENERATE_NAME_FAIL;
+ }
+ if (parent_path->str == NULL || parent_path->str == NULL) {
+ g_string_free(parent_path, TRUE);
+ parent_path = NULL;
+ g_string_free(file_name, TRUE);
+ file_name = NULL;
+ return MYFILE_ERR_GENERATE_NAME_FAIL;
+ }
+
+ char *name = NULL;
+ int error_code = 0;
+
+ if (parent_path->str != NULL) {
+ //mf_debug("parent_full_path is [%s]", parent_path->str);
+ }
+
+ if (file_name->str != NULL) {
+ //mf_debug("original_file_name is [%s]", file_name->str);
+ }
+ error_code = __mf_ug_fm_svc_wrapper_get_unique_name(parent_path->str, file_name->str, &name, file_name_type, ugd);
+ if (error_code) {
+ UG_SAFE_FREE_CHAR(name);
+ return MYFILE_ERR_GENERATE_NAME_FAIL;
+ }
+ g_string_append_printf(parent_path, "/%s", name);
+ ug_debug("After gstring append, PATH ::: [%s]", parent_path->str);
+
+ if (file_name != NULL) {
+ g_string_free(file_name, TRUE);
+ }
+
+ file_name = NULL;
+ if (name != NULL) {
+ free(name);
+ name = NULL;
+ }
+
+ *filename = parent_path;
+ return MYFILE_ERR_NONE;
+}
+
+int mf_ug_fm_svc_wrapper_create_service(void *data, GString *fullpath)
+{
+ int error_code;
+
+ mf_ug_util_remove_dir_watch();
+ error_code = mf_ug_fs_oper_create_dir(fullpath->str);
+
+ if (error_code != 0) {
+ ug_debug("Make DIR error\n");
+ }
+
+ return error_code;
+}
+
+int mf_ug_fm_svc_wrapper_create_p(const char *fullpath)
+{
+ UG_TRACE_BEGIN;
+
+ ug_debug("path is [%s]", fullpath);
+ int error_code = MYFILE_ERR_NONE;
+
+ char *parent = NULL;
+ error_code = mf_ug_file_attr_get_parent_path(fullpath, &parent);
+
+ goto_if(error_code != MYFILE_ERR_NONE, EXIT);
+
+ if (ecore_file_exists(parent) == false) {
+ error_code = mf_ug_fm_svc_wrapper_create_p(parent);
+ goto_if(error_code != MYFILE_ERR_NONE, EXIT);
+
+ }
+
+ ug_debug("create [%s]", fullpath);
+ error_code = mf_ug_fs_oper_create_dir(fullpath);
+ goto_if(error_code != MYFILE_ERR_NONE, EXIT);
+
+EXIT:
+ return error_code;
+}
diff --git a/src/common/mf-ug-inotify-handle.c b/src/common/mf-ug-inotify-handle.c index 33432b2..a45b22a 100755..100644 --- a/src/common/mf-ug-inotify-handle.c +++ b/src/common/mf-ug-inotify-handle.c @@ -1,24 +1,26 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ - #include <stdio.h> #include <glib.h> #include <sys/inotify.h> diff --git a/src/common/mf-ug-list-play.c b/src/common/mf-ug-list-play.c index 64591ec..9f0b8bd 100755..100644 --- a/src/common/mf-ug-list-play.c +++ b/src/common/mf-ug-list-play.c @@ -1,28 +1,28 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
#include <stdio.h>
#include <Elementary.h>
#include <Ecore_X.h>
-#include <mm_player.h>
-#include <mm_error.h>
#include <vconf.h>
#include <stdbool.h>
@@ -34,8 +34,12 @@ #include "mf-ug-winset.h"
#include "mf-ug-dlog.h"
#include "mf-ug-fs-util.h"
+#include "mf-ug-resource.h"
+#include "mf-ug-list-play.h"
+static mf_player_cbs *g_player_cbs = NULL;
+static Ecore_Pipe *g_player_pipe = NULL;
-
+static void __mf_ug_list_play_control_cb(void *data);
/******************************
** Prototype : __mf_ug_list_play_init_data
@@ -69,9 +73,9 @@ static void __mf_ug_list_play_init_data(void *data) }
/******************************
-** Prototype : _mp_playing_error
-** Description :
-** Input : void * data
+** Prototype : __mf_ug_list_play_drm_has_valid_ro
+** Description : Samsung
+** Input : char *path
** Output : None
** Return Value :
** Calls :
@@ -83,15 +87,225 @@ static void __mf_ug_list_play_init_data(void *data) ** Modification : Created function
**
******************************/
-static int __mf_ug_list_play_playing_error(ugListItemData *data)
+static bool __mf_ug_list_play_drm_has_valid_ro(char *path)
{
UG_TRACE_BEGIN;
- ugListItemData *itemData = data;
- ug_mf_retvm_if(itemData == NULL, 0, "itemData is NULL");
+ drm_result_e res = DRM_RETURN_INVALID_ARG;
+ drm_license_status_e licence_status;
+
+ if (path) {
+ res = drm_get_license_status(path, DRM_PERMISSION_TYPE_PLAY, &licence_status);
+ }
+
+ if (res == DRM_RETURN_SUCCESS && licence_status == DRM_LICENSE_STATUS_VALID) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+/******************************
+** Prototype : __mf_ug_list_play_check_drm_left_ro
+** Description : Samsung
+** Input : void *data
+** char *path
+** Output : None
+** Return Value :
+** Calls :
+** Called By :
+**
+** History :
+** 1.Date : 2010/12/10
+** Author : Samsung
+** Modification : Created function
+**
+******************************/
+static bool __mf_ug_list_play_check_drm_left_ro(void *data, char *path)
+{
+ UG_TRACE_BEGIN;
+ ugData *ugd = (ugData *)data;
+ ug_mf_retvm_if(ugd == NULL, false, "ugd is NULL");
+
+
+ char left_ro_message[MAX_MESSAGE_LEN] = "\0";
+
+ bool ro_valid = false;
+ bool expired = false;
+
+
+ const char *title = ecore_file_file_get(path);
+ ugd->ug_ListPlay.ug_bDrmContentCanPlay = false;
+
+ if (__mf_ug_list_play_drm_has_valid_ro(path))
+ {
+ drm_constraint_info_s constraint;
+ memset(&constraint, 0x0, sizeof(drm_constraint_info_s));
+
+ int res = drm_get_constraint_info(path, DRM_PERMISSION_TYPE_PLAY, &constraint);
+ if (res == DRM_RETURN_SUCCESS) {
+ if (constraint.const_type.is_unlimited) {
+ ug_debug("UNLIMITED");
+ ugd->ug_ListPlay.ug_bDrmContentCanPlay = TRUE;
+ return TRUE;
+ }
+
+ if (constraint.const_type.is_count) {
+ int remain_count = constraint.remaining_count;
+
+ if (remain_count == 1) {
+ snprintf(left_ro_message, sizeof(left_ro_message), "You can play \"%s\" just one more time", title);
+ ro_valid = true;
+ ugd->ug_ListPlay.ug_bDrmContentCanPlay = true;
+ } else if (remain_count == 0) {
+ snprintf(left_ro_message, sizeof(left_ro_message), "You can't play \"%s\" anymore", title);
+ ro_valid = false;
+ } else {
+ ro_valid = true;
+ ugd->ug_ListPlay.ug_bDrmContentCanPlay = true;
+ }
+ }
+
+ if (constraint.const_type.is_datetime) {
+ ug_debug("DRM_DATETIME\n");
+ snprintf(ugd->ug_ListPlay.ug_DrmInfo.validity, sizeof(ugd->ug_ListPlay.ug_DrmInfo.validity),
+ "%d.%d.%d %d:%d~%d.%d.%d %d:%d",
+ constraint.start_time.tm_mday,
+ constraint.start_time.tm_mon + 1,
+ constraint.start_time.tm_year + 109,
+ constraint.start_time.tm_hour,
+ constraint.start_time.tm_min,
+ constraint.end_time.tm_mday,
+ constraint.end_time.tm_mon + 1,
+ constraint.end_time.tm_year + 109,
+ constraint.end_time.tm_hour,
+ constraint.end_time.tm_min);
+ }
+
+ if (constraint.const_type.is_interval) {
+ ug_debug("DRM_INTERVAL\n");
+ snprintf(ugd->ug_ListPlay.ug_DrmInfo.validity, sizeof(ugd->ug_ListPlay.ug_DrmInfo.validity),
+ "until %d.%d.%d %d:%d",
+ constraint.interval_time.tm_mon,
+ constraint.interval_time.tm_mday,
+ constraint.interval_time.tm_year,
+ constraint.interval_time.tm_hour,
+ constraint.interval_time.tm_min);
+ }
+
+ if (constraint.const_type.is_timedcount) {
+ int count = constraint.timed_remaining_count;
+ int time = constraint.timed_count_timer;
+ snprintf(ugd->ug_ListPlay.ug_DrmInfo.validity, sizeof(ugd->ug_ListPlay.ug_DrmInfo.validity),
+ "%d left (%d sec)", count, time);
+ ug_debug("DRM_TIMED_COUNT [%d]\n", count);
+ if (count == 1)
+ {
+ snprintf(left_ro_message, sizeof(left_ro_message),
+ "You can play \"%s\" just one more time", title);
+ ugd->ug_ListPlay.ug_bDrmContentCanPlay = TRUE;
+ }
+ else if (count == 0)
+ {
+ snprintf(left_ro_message, sizeof(left_ro_message),
+ "You can't play \"%s\" anymore", title);
+ }
+ }
+
+ if (constraint.const_type.is_accumulated) {
+ int sec = constraint.accumulated_remaining_seconds;
+ int ndays = sec / ACCUMULATED_DATE;
+ ug_debug("DRM_ACCUMULATED [%d]\n", ndays);
+ snprintf(ugd->ug_ListPlay.ug_DrmInfo.validity, sizeof(ugd->ug_ListPlay.ug_DrmInfo.validity),
+ "%" UG_TIME_FORMAT " left", UG_TIME_ARGS(ndays));
+
+ if (ndays < ACCUMULATED_DATE)
+ {
+ snprintf(left_ro_message, sizeof(left_ro_message),
+ "You can play %s just one day", title);
+
+ ugd->ug_ListPlay.ug_bDrmContentCanPlay = TRUE;
+ }
+ }
+
+ if (constraint.const_type.is_individual) {
+ ug_debug("DRM_INDIVISUAL_ID [%s]", constraint.individual_id);
+ }
+
+ if (constraint.const_type.is_system) {
+ ug_debug("DRM_SYSTEM [ID:%s, type:%d]", constraint.system_id, constraint.system_identity_type);
+ }
+ }
+ } else {
+ ug_debug("have no valid ro\n");
+ snprintf(left_ro_message, sizeof(left_ro_message), "No valid RO for <br>\"%s\"", title);
+ ro_valid = false;
+ expired = true;
+ }
+
- mf_ug_list_play_destory_playing_file(itemData->ug_pData);
UG_TRACE_END;
- return 0;
+
+ return true;
+}
+
+/******************************
+** Prototype : __mf_ug_list_play_check_drm_forward
+** Description : Samsung
+** Input : void *data
+** char *path
+** Output : None
+** Return Value :
+** Calls :
+** Called By :
+**
+** History :
+** 1.Date : 2010/12/10
+** Author : Samsung
+** Modification : Created function
+**
+******************************/
+static drm_file_type_e __drm_get_file_type(void *path)
+{
+ drm_file_type_e type = DRM_TYPE_UNDEFINED;
+ drm_result_e res = -1;
+
+ res = drm_get_file_type(path, &type);
+ if (res == DRM_RETURN_SUCCESS) {
+ return type;
+ } else {
+ return DRM_TYPE_UNDEFINED;
+ }
+}
+static bool __mf_ug_list_play_check_drm_forward(void *data, char *path)
+{
+ UG_TRACE_BEGIN;
+ ugData *ugd = (ugData *)data;
+ drm_file_type_e type = __drm_get_file_type(path);
+
+ if (type == DRM_TYPE_OMA_V1 || type == DRM_TYPE_OMA_V2) {
+
+ drm_file_info_s info;
+ memset(&info, 0x0, sizeof(drm_file_info_s));
+ int ret = drm_get_file_info(path, &info);
+ if (ret == DRM_RETURN_SUCCESS) {
+ if (info.oma_info.method == DRM_METHOD_TYPE_FORWARD_LOCK) {
+ ugd->ug_ListPlay.ug_DrmInfo.forward = true;
+ return TRUE;
+ }
+ }
+ ugd->ug_ListPlay.ug_DrmInfo.forward = false;
+ return false;
+ } else if (type == DRM_TYPE_PLAYREADY) {
+ ug_debug("playready drm file");
+ ugd->ug_ListPlay.ug_DrmInfo.forward = true;
+ } else {
+ ug_debug("Not supported drm type");
+ UG_TRACE_END;
+ return false;
+ }
+ UG_TRACE_END;
+ return true;
}
/******************************
@@ -110,9 +324,10 @@ static int __mf_ug_list_play_playing_error(ugListItemData *data) ** Modification : Created function
**
******************************/
-static void __mf_ug_list_play_update_item_icon(void *data)
+void mf_ug_list_play_update_item_icon(void *data)
{
UG_TRACE_BEGIN;
+
ugData *ugd = (ugData *)data;
ug_mf_retm_if(ugd == NULL, "ugd is NULL");
@@ -122,10 +337,12 @@ static void __mf_ug_list_play_update_item_icon(void *data) Evas_Object *pGenlist = NULL;
if (ugd->ug_ListPlay.ug_pPlayFilePath == NULL || strlen(ugd->ug_ListPlay.ug_pPlayFilePath) == 0) {
+
+ UG_TRACE_END;
return;
}
pNaviInUse = mf_ug_navi_bar_get_in_use_navi(ugd);
- pGenlist = pNaviInUse->ug_pContent;
+ pGenlist = ugd->ug_MainWindow.ug_pContent;
gl_item = elm_genlist_first_item_get(pGenlist);
while (gl_item) {
@@ -140,7 +357,7 @@ static void __mf_ug_list_play_update_item_icon(void *data) gl_item = elm_genlist_item_next_get(gl_item);
}
- ug_debug("__mf_ug_list_play_update_item_icon failed");
+ ug_debug("mf_ug_list_play_update_item_icon failed");
UG_TRACE_END;
}
@@ -221,11 +438,10 @@ static void __mf_ug_list_play_set_play_pause_status(ugData *data) }
/******************************
-** Prototype : __mf_ug_list_play_msg_cb
+** Prototype : _mp_player_mgr_create
** Description :
-** Input : int msg_type
-** void *msg_param
-** void *user_param
+** Input : void *data
+** const gchar *path
** Output : None
** Return Value :
** Calls :
@@ -237,115 +453,119 @@ static void __mf_ug_list_play_set_play_pause_status(ugData *data) ** Modification : Created function
**
******************************/
-static int __mf_ug_list_play_msg_cb(int msg_type, void *msg_param, ugListItemData *user_param)
+static void __mf_player_mgr_callback_pipe_handler(void *data, void *buffer, unsigned int nbyte)
{
- UG_TRACE_BEGIN;
- ugListItemData *itemData = user_param;
- ug_mf_retvm_if(itemData == NULL, false, "itemData is NULL");
- ugData *ugd = itemData->ug_pData;
- ug_mf_retvm_if(ugd == NULL, false, "ugd is NULL");
+ mf_player_cb_extra_data *extra_data = buffer;
+ ug_mf_retm_if(extra_data == NULL, "NULL");
+ ug_mf_retm_if(g_player_cbs == NULL, "NULL");
+
+ switch (extra_data->cb_type) {
+ case MF_PLAYER_CB_TYPE_STARTED:
+ if (g_player_cbs->started_cb)
+ g_player_cbs->started_cb(g_player_cbs->user_data[MF_PLAYER_CB_TYPE_STARTED]);
+ break;
+
+ case MF_PLAYER_CB_TYPE_PAUSED:
+ if (g_player_cbs->paused_cb)
+ g_player_cbs->paused_cb(g_player_cbs->user_data[MF_PLAYER_CB_TYPE_PAUSED]);
+ break;
+
+ case MF_PLAYER_CB_TYPE_COMPLETED:
+ if (g_player_cbs->completed_cb)
+ g_player_cbs->completed_cb(g_player_cbs->user_data[MF_PLAYER_CB_TYPE_COMPLETED]);
+ break;
+
+ case MF_PLAYER_CB_TYPE_INTURRUPTED:
+ if (g_player_cbs->interrupted_cb)
+ g_player_cbs->interrupted_cb(extra_data->param.interrupted_code, g_player_cbs->user_data[MF_PLAYER_CB_TYPE_INTURRUPTED]);
+ break;
+
+ case MF_PLAYER_CB_TYPE_ERROR:
+ if (g_player_cbs->error_cb)
+ g_player_cbs->error_cb(extra_data->param.error_code, g_player_cbs->user_data[MF_PLAYER_CB_TYPE_ERROR]);
+ break;
+
+ case MF_PLAYER_CB_TYPE_BUFFERING:
+ if (g_player_cbs->buffering_cb)
+ g_player_cbs->buffering_cb(extra_data->param.percent ,g_player_cbs->user_data[MF_PLAYER_CB_TYPE_BUFFERING]);
+ break;
+
+ default:
+ ug_debug("Not suppoted callback type [%d]", extra_data->cb_type);
+ }
+}
- MMMessageParamType *param = (MMMessageParamType *) msg_param;
+void *__mf_ug_list_play_mgr_start_cb(void *data)
+{
+ MF_CHECK(g_player_pipe);
- ug_debug("msg_type is [%d]", msg_type);
- if (ugd->ug_ListPlay.ug_Player == 0) {
- return false;
- } else {
- switch (msg_type) {
- case MM_MESSAGE_BEGIN_OF_STREAM:
- ug_debug("receive MM_MESSAGE_BEGIN_OF_STREAM\n");
- break;
- case MM_MESSAGE_ERROR:
- ug_debug("receive MM_MESSAGE_ERROR Error Code=%x\n", param->code);
- switch (param->code) {
- case MM_ERROR_PLAYER_INTERNAL:
- ug_debug("receive MM_ERROR_PLAYER_INTERNAL\n");
- break;
- }
- ecore_idler_add((Ecore_Task_Cb) __mf_ug_list_play_playing_error, itemData);
- break;
- case MM_MESSAGE_WARNING:
- ug_debug("receive MM_MESSAGE_WARNING\n");
- break;
- case MM_MESSAGE_STATE_CHANGED:
-
- ug_mf_retvm_if(param == NULL, false, "param is NULL");
- ug_debug("msg_type is [%d]", param->state.current);
- switch (param->state.current) {
- case MM_PLAYER_STATE_NONE:
- ug_debug("==> [MediaPlayerApp] Player is [NONE]\n");
- break;
- case MM_PLAYER_STATE_READY:
- ug_debug("==> [MediaPlayerApp] Player is [READY]\n");
- ugd->ug_ListPlay.ug_iPlayState = PLAY_STATE_READY;
- __mf_ug_list_play_update_item_icon(ugd);
- break;
- case MM_PLAYER_STATE_PLAYING:
- ug_debug("==> [MediaPlayerApp] Player is [PLAYING]\n");
- if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_READY) {
- if (ugd->ug_ListPlay.ug_pPlayFilePath == NULL)
- ugd->ug_ListPlay.ug_pPlayFilePath = g_strdup(itemData->ug_pItemName->str);
- __mf_ug_list_play_set_play_start_status(ugd, itemData->ug_pItemName->str);
- } else if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PAUSED) {
- if (ugd->ug_ListPlay.ug_pPlayFilePath == NULL)
- ugd->ug_ListPlay.ug_pPlayFilePath = g_strdup(itemData->ug_pItemName->str);
- __mf_ug_list_play_set_play_resume_status(ugd);
- }
- __mf_ug_list_play_update_item_icon(ugd);
- break;
- case MM_PLAYER_STATE_PAUSED:
- ug_debug("==> [MediaPlayerApp] Player is [PAUSED]\n");
- __mf_ug_list_play_set_play_pause_status(ugd);
- __mf_ug_list_play_update_item_icon(ugd);
- break;
- case MM_PLAYER_STATE_NULL:
- ug_debug("==> [MediaPlayerApp] Player is [NULL]\n");
- if (ugd->ug_ListPlay.ug_pPlayFilePath != NULL) {
- g_free(ugd->ug_ListPlay.ug_pPlayFilePath);
- ugd->ug_ListPlay.ug_pPlayFilePath = NULL;
- }
- break;
- default:
- break;
- }
+ mf_player_cb_extra_data extra_data;
+ extra_data.cb_type = MF_PLAYER_CB_TYPE_STARTED;
+
+ ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mf_player_cb_extra_data));
- break;
- case MM_MESSAGE_STATE_INTERRUPTED:
- ug_debug("receive MM_MESSAGE_STATE_CHANGED_BY_ASM\n");
- __mf_ug_list_play_set_play_pause_status(ugd);
- __mf_ug_list_play_update_item_icon(ugd);
- break;
- case MM_MESSAGE_END_OF_STREAM:
- mf_ug_list_play_destory_playing_file(ugd);
- if (ugd->ug_ListPlay.ug_pPlayFilePath != NULL) {
- g_free(ugd->ug_ListPlay.ug_pPlayFilePath);
- ugd->ug_ListPlay.ug_pPlayFilePath = NULL;
- }
- break;
- default:
- UG_TRACE_END;
- return false;
- }
- }
- return true;
}
-/******************************
-** Prototype : _mp_player_mgr_create
-** Description :
-** Input : void *data
-** const gchar *path
-** Output : None
-** Return Value :
-** Calls :
-** Called By :
-**
-** History :
-** 1.Date : 2010/12/10
-** Author : Samsung
-** Modification : Created function
-**
-******************************/
+static void
+__mf_ug_list_play_mgr_paused_cb(void *userdata)
+{
+ MF_CHECK(g_player_pipe);
+
+ mf_player_cb_extra_data extra_data;
+ extra_data.cb_type = MF_PLAYER_CB_TYPE_PAUSED;
+
+ ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mf_player_cb_extra_data));
+}
+
+static void
+__mf_ug_list_play_mgr_completed_cb(void *userdata)
+{
+ MF_CHECK(g_player_pipe);
+
+ mf_player_cb_extra_data extra_data;
+ extra_data.cb_type = MF_PLAYER_CB_TYPE_COMPLETED;
+
+ ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mf_player_cb_extra_data));
+}
+
+static void
+__mf_ug_list_play_mgr_interrupted_cb(player_interrupted_code_e code, void *userdata)
+{
+ MF_CHECK(g_player_pipe);
+
+ mf_player_cb_extra_data extra_data;
+ extra_data.cb_type = MF_PLAYER_CB_TYPE_INTURRUPTED;
+ extra_data.param.interrupted_code = code;
+
+ ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mf_player_cb_extra_data));
+}
+
+
+static void
+__mf_ug_list_play_mgr_error_cb(int error_code, void *userdata)
+{
+ MF_CHECK(g_player_pipe);
+
+ mf_player_cb_extra_data extra_data;
+ extra_data.cb_type = MF_PLAYER_CB_TYPE_ERROR;
+ extra_data.param.error_code = error_code;
+
+ ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mf_player_cb_extra_data));
+}
+
+static void
+__mf_ug_list_play_mgr_buffering_cb(int percent, void *userdata)
+{
+ MF_CHECK(g_player_pipe);
+
+ mf_player_cb_extra_data extra_data;
+ extra_data.cb_type = MF_PLAYER_CB_TYPE_BUFFERING;
+ extra_data.param.percent = percent;
+
+ ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mf_player_cb_extra_data));
+}
+
+
static bool __mf_ug_list_play_create_player_mgr(void *data, const char *path)
{
UG_TRACE_BEGIN;
@@ -354,27 +574,32 @@ static bool __mf_ug_list_play_create_player_mgr(void *data, const char *path) int path_len = strlen(path);
char *g_err_name = NULL;
- int ret = MM_ERROR_NONE;
+ int ret = 0;
if (path_len > 0 && path_len < MYFILE_DIR_PATH_LEN_MAX) {
if (ugd->ug_ListPlay.ug_Player == 0) {
- if (mm_player_create(&ugd->ug_ListPlay.ug_Player) != MM_ERROR_NONE) {
+ if (player_create(&ugd->ug_ListPlay.ug_Player) != PLAYER_ERROR_NONE) {
ug_debug("Error when __mf_ug_list_play_create_player_mgr\n");
UG_TRACE_END;
return false;
}
+ ug_debug("player is [%d]", ugd->ug_ListPlay.ug_Player);
/*avsysaudiosink volume table setting */
- ret = mm_player_set_attribute(ugd->ug_ListPlay.ug_Player, &g_err_name, "sound_volume_type", MM_SOUND_VOLUME_TYPE_MEDIA,
- "profile_uri", path, strlen(path), NULL);
- if (ret != MM_ERROR_NONE) {
+ //ret = mm_player_set_attribute(ugd->ug_ListPlay.ug_Player, &g_err_name, "sound_volume_type", MM_SOUND_VOLUME_TYPE_MEDIA,
+ // "profile_uri", path, strlen(path), NULL);
+
+ ug_debug("path is [%s]", path);
+ ret = player_set_uri(ugd->ug_ListPlay.ug_Player, path);
+ //player_set_sound_type(ugd->ug_ListPlay.ug_Player, SOUND_TYPE_MEDIA);
+ if (ret != PLAYER_ERROR_NONE) {
ug_debug(">>>>>>>>>>>>>g_err_name : %s\n", g_err_name);
UG_TRACE_END;
return false;
- } else {
- UG_TRACE_END;
- return true;
}
+
+ player_set_sound_type(ugd->ug_ListPlay.ug_Player, SOUND_TYPE_MEDIA);
+
} else {
ug_debug("player handle is exist");
UG_TRACE_END;
@@ -385,6 +610,24 @@ static bool __mf_ug_list_play_create_player_mgr(void *data, const char *path) UG_TRACE_END;
return false;
}
+
+ UG_SAFE_FREE_CHAR(g_player_cbs);
+ if (g_player_pipe) {
+ ecore_pipe_del(g_player_pipe);
+ g_player_pipe = NULL;
+ }
+ g_player_cbs = calloc(1, sizeof(mf_player_cbs));
+ g_player_pipe = ecore_pipe_add(__mf_player_mgr_callback_pipe_handler, ugd);
+
+
+ player_set_started_cb(ugd->ug_ListPlay.ug_Player, __mf_ug_list_play_mgr_start_cb, NULL);
+ player_set_paused_cb(ugd->ug_ListPlay.ug_Player, __mf_ug_list_play_mgr_paused_cb, NULL);
+ player_set_completed_cb(ugd->ug_ListPlay.ug_Player, __mf_ug_list_play_mgr_completed_cb, NULL);
+ player_set_interrupted_cb(ugd->ug_ListPlay.ug_Player, __mf_ug_list_play_mgr_interrupted_cb, NULL);
+ player_set_error_cb(ugd->ug_ListPlay.ug_Player, __mf_ug_list_play_mgr_error_cb, NULL);
+ //player_set_buffering_cb(ugd->ug_ListPlay.ug_Player, _mp_player_mgr_buffering_cb, NULL);
+ return true;
+
}
/******************************
@@ -403,7 +646,100 @@ static bool __mf_ug_list_play_create_player_mgr(void *data, const char *path) ** Modification : Created function
**
******************************/
-static bool __mf_ug_list_play_set_player_mgr_msg_cb(MMMessageCallback cb, gpointer user_data)
+static void __mf_ug_list_play_start_cb(void *data)
+{
+ UG_TRACE_BEGIN;
+ ugListItemData *itemData = (ugListItemData *)data;
+ ug_mf_retm_if(itemData == NULL, "itemData is NULL");
+ ugData *ugd = itemData->ug_pData;
+ ug_mf_retm_if(ugd == NULL, "ugd is NULL");
+ int error_code = -1;
+ player_state_e state = PLAYER_STATE_NONE;
+
+ error_code = player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ ug_debug("state is [%d]", state);
+ if (error_code == 0 && state == PLAYER_STATE_PLAYING) {
+ if (ugd->ug_ListPlay.ug_pPlayFilePath == NULL)
+ ugd->ug_ListPlay.ug_pPlayFilePath = g_strdup(itemData->ug_pItemName->str);
+ __mf_ug_list_play_set_play_start_status(ugd, itemData->ug_pItemName->str);
+ } else if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PAUSED) {
+ if (ugd->ug_ListPlay.ug_pPlayFilePath == NULL)
+ ugd->ug_ListPlay.ug_pPlayFilePath = g_strdup(itemData->ug_pItemName->str);
+ __mf_ug_list_play_set_play_resume_status(ugd);
+ }
+ mf_ug_list_play_update_item_icon(ugd);
+ UG_TRACE_END;
+}
+
+static void __mf_ug_list_play_pauset_cb(void *data)
+{
+ UG_TRACE_BEGIN;
+
+ ugData *ugd = (ugData *)data;
+ ug_mf_retm_if(ugd == NULL, "ugd is NULL");
+
+ __mf_ug_list_play_set_play_pause_status(ugd);
+ mf_ug_list_play_update_item_icon(ugd);
+ UG_TRACE_END;
+}
+
+static void __mf_ug_list_play_complete_cb(void *data)
+{
+ UG_TRACE_BEGIN;
+
+ ugData *ugd = (ugData *)data;
+ ug_mf_retm_if(ugd == NULL, "ugd is NULL");
+
+ mf_ug_list_play_destory_playing_file(ugd);
+ mf_ug_list_play_update_item_icon(ugd);
+ if (ugd->ug_ListPlay.ug_pPlayFilePath != NULL) {
+ g_free(ugd->ug_ListPlay.ug_pPlayFilePath);
+ ugd->ug_ListPlay.ug_pPlayFilePath = NULL;
+ }
+ UG_TRACE_END;
+}
+
+static void __mf_ug_list_play_interrupt_cb(player_interrupted_code_e code, void *data)
+{
+ UG_TRACE_BEGIN;
+ ugData *ugd = (ugData *)data;
+ ug_mf_retm_if(ugd == NULL, "ugd is NULL");
+ switch (code) {
+ case PLAYER_INTERRUPTED_BY_OTHER_APP:
+ ug_debug("Interrupt :: PLAYER_INTERRUPTED_BY_OTHER_APP");
+ break;
+ case PLAYER_INTERRUPTED_BY_CALL:
+ ug_debug("Interrupt :: PLAYER_INTERRUPTED_BY_CALL_START");
+ break;
+ case PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT:
+ ug_debug("Interrupt :: PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT");
+ break;
+ case PLAYER_INTERRUPTED_BY_ALARM:
+ ug_debug("Interrupt :: PLAYER_INTERRUPTED_BY_ALARM_START");
+ break;
+ case PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG:
+ ug_debug("Interrupt :: PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG");
+ break;
+ case PLAYER_INTERRUPTED_COMPLETED:
+ ug_debug("PLAYER_INTERRUPTED_COMPLETED");
+ /* ready to resume */
+ ug_debug("ugd->ug_ListPlay.ug_iPlayState is [%d]", ugd->ug_ListPlay.ug_iPlayState);
+ if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PAUSED) {
+ ug_debug();
+ __mf_ug_list_play_control_cb(ugd);
+ }
+ return;
+ default:
+ break;
+ }
+ __mf_ug_list_play_set_play_pause_status(ugd);
+ mf_ug_list_play_update_item_icon(ugd);
+ UG_TRACE_END;
+
+}
+
+
+static bool __mf_ug_list_play_set_player_mgr_msg_cb(gpointer user_data)
{
UG_TRACE_BEGIN;
@@ -414,14 +750,12 @@ static bool __mf_ug_list_play_set_player_mgr_msg_cb(MMMessageCallback cb, gpoint ug_mf_retvm_if(ugd == NULL, false, "ugd is NULL");
if (ugd->ug_ListPlay.ug_Player != 0) {
- if (mm_player_set_message_callback(ugd->ug_ListPlay.ug_Player, cb, user_data) != MM_ERROR_NONE) {
- ug_debug("Error when _mp_player_mgr_set_msg_callback\n");
- UG_TRACE_END;
- return false;
- } else {
- UG_TRACE_END;
- return true;
- }
+ player_set_started_cb(ugd->ug_ListPlay.ug_Player, __mf_ug_list_play_start_cb, itemData);
+ player_set_paused_cb(ugd->ug_ListPlay.ug_Player, __mf_ug_list_play_pauset_cb, ugd);
+ player_set_completed_cb(ugd->ug_ListPlay.ug_Player, __mf_ug_list_play_complete_cb, ugd);
+ player_set_interrupted_cb(ugd->ug_ListPlay.ug_Player, __mf_ug_list_play_interrupt_cb, ugd);
+ UG_TRACE_END;
+ return true;
}
UG_TRACE_END;
return false;
@@ -451,13 +785,14 @@ static bool __mf_ug_list_play_realize_player_mgr(void *data) ug_mf_retvm_if(ugd == NULL, false, "ugd is NULL");
int error_code = 0;
- MMPlayerStateType state = MM_PLAYER_STATE_NONE;
+ player_state_e state = PLAYER_STATE_NONE;
if (ugd->ug_ListPlay.ug_Player != 0) {
- error_code = mm_player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ error_code = player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ ug_debug("state is [%d]", state);
- if (0 == error_code && MM_PLAYER_STATE_NULL == state) {
- if (mm_player_realize(ugd->ug_ListPlay.ug_Player) != MM_ERROR_NONE) {
+ if (0 == error_code && PLAYER_STATE_IDLE == state) {
+ if (player_prepare(ugd->ug_ListPlay.ug_Player) != 0) {
ug_debug("Error when _mp_player_mgr_realize\n");
UG_TRACE_END;
return false;
@@ -480,7 +815,7 @@ static bool __mf_ug_list_play_realize_player_mgr(void *data) ** Prototype : __mf_ug_list_play_ready_new_file_play
** Description : Samsung
** Input : void *data
-**
+** bool drm_check_flag
** Output : None
** Return Value :
** Calls :
@@ -492,7 +827,58 @@ static bool __mf_ug_list_play_realize_player_mgr(void *data) ** Modification : Created function
**
******************************/
-static bool __mf_ug_list_play_ready_new_file_play(void *data)
+void mf_player_mgr_set_started_cb(player_started_cb callback, void *user_data)
+{
+ MF_CHECK(g_player_cbs);
+
+ g_player_cbs->started_cb = callback;
+ g_player_cbs->user_data[MF_PLAYER_CB_TYPE_STARTED] = user_data;
+}
+
+void mf_player_mgr_set_paused_cb(player_paused_cb callback, void *user_data)
+{
+ MF_CHECK(g_player_cbs);
+
+ g_player_cbs->paused_cb = callback;
+ g_player_cbs->user_data[MF_PLAYER_CB_TYPE_PAUSED] = user_data;
+}
+
+void mf_player_mgr_set_completed_cb(player_completed_cb callback, void *user_data)
+{
+
+ MF_CHECK(g_player_cbs);
+
+ g_player_cbs->completed_cb = callback;
+ g_player_cbs->user_data[MF_PLAYER_CB_TYPE_COMPLETED] = user_data;
+}
+
+void mf_player_mgr_set_interrupted_cb(player_interrupted_cb callback, void *user_data)
+{
+
+ MF_CHECK(g_player_cbs);
+
+ g_player_cbs->interrupted_cb = callback;
+ g_player_cbs->user_data[MF_PLAYER_CB_TYPE_INTURRUPTED] = user_data;
+}
+
+void mf_player_mgr_set_error_cb(player_error_cb callback, void *user_data)
+{
+
+ MF_CHECK(g_player_cbs);
+
+ g_player_cbs->error_cb = callback;
+ g_player_cbs->user_data[MF_PLAYER_CB_TYPE_ERROR] = user_data;
+}
+
+void mf_player_mgr_set_buffering_cb(player_buffering_cb callback, void *user_data)
+{
+ MF_CHECK(g_player_cbs);
+
+ g_player_cbs->buffering_cb = callback;
+ g_player_cbs->user_data[MF_PLAYER_CB_TYPE_BUFFERING] = user_data;
+}
+
+static bool __mf_ug_list_play_ready_new_file_play(void *data, bool drm_check_flag)
{
UG_TRACE_BEGIN;
@@ -513,6 +899,26 @@ static bool __mf_ug_list_play_ready_new_file_play(void *data) UG_TRACE_END;
return false;
}
+ /*/check if file is drm file */
+ if (mf_ug_file_attr_is_drm_file(path) == 0) {
+ if (!__mf_ug_list_play_check_drm_left_ro(ugd, path)) {
+ free(path);
+ path = NULL;
+ UG_TRACE_END;
+ return false;
+ }
+
+ if (!__mf_ug_list_play_check_drm_forward(ugd, path)) {
+ free(path);
+ path = NULL;
+ UG_TRACE_END;
+ return false;
+ }
+
+ ugd->ug_ListPlay.ug_bDrmconsumption = true;
+ } else {
+ ugd->ug_ListPlay.ug_bDrmconsumption = true;
+ }
if (!__mf_ug_list_play_create_player_mgr(ugd, path)) {
ug_debug();
@@ -522,14 +928,20 @@ static bool __mf_ug_list_play_ready_new_file_play(void *data) return false;
}
-
- if (!__mf_ug_list_play_set_player_mgr_msg_cb((MMMessageCallback) __mf_ug_list_play_msg_cb, itemData)) {
+#if 0
+ if (!__mf_ug_list_play_set_player_mgr_msg_cb(itemData)) {
free(path);
path = NULL;
UG_TRACE_END;
return false;
}
-
+#endif
+ mf_player_mgr_set_started_cb(__mf_ug_list_play_start_cb, itemData);
+ mf_player_mgr_set_paused_cb(__mf_ug_list_play_pauset_cb, ugd);
+ mf_player_mgr_set_completed_cb(__mf_ug_list_play_complete_cb, ugd);
+ mf_player_mgr_set_interrupted_cb(__mf_ug_list_play_interrupt_cb, ugd);
+ //mf_player_mgr_set_error_cb(_mp_play_control_error_cb, ad);
+ //mf_player_mgr_set_buffering_cb(_mp_play_control_buffering_cb, ad);
if (!__mf_ug_list_play_realize_player_mgr(ugd)) {
free(path);
@@ -570,16 +982,28 @@ static bool __mf_ug_list_play_play(void *data) ugData *ugd = (ugData *)data;
ug_mf_retvm_if(ugd == NULL, false, "ugd is NULL");
- int err = MM_ERROR_NONE;
+ int err = 0;
int error_code = 0;
- MMPlayerStateType state = MM_PLAYER_STATE_NONE;
+ player_state_e state = PLAYER_STATE_NONE;
if (ugd->ug_ListPlay.ug_Player != 0) {
- error_code = mm_player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ error_code = player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ ug_debug("state is [%d]", state);
+
+ if (0 == error_code && PLAYER_STATE_READY == state) {
+ err = player_start(ugd->ug_ListPlay.ug_Player);
+ if (err != PLAYER_ERROR_NONE) {
- if (0 == error_code && MM_PLAYER_STATE_READY == state) {
- err = mm_player_start(ugd->ug_ListPlay.ug_Player);
- if (err != MM_ERROR_NONE) {
+ if (err == PLAYER_ERROR_SOUND_POLICY)
+ {
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, MF_UG_LABEL_UNABLE_TO_PLAY_DURING_CALL, NULL,
+ NULL, NULL, NULL, NULL);
+ }
+ else
+ {
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, MF_UG_LABEL_UNABLE_TO_PLAY_ERROR_OCCURRED, NULL,
+ NULL, NULL, NULL, NULL);
+ }
ug_debug("Error when _mp_player_mgr_play. err[%x]\n", err);
UG_TRACE_END;
return false;
@@ -618,20 +1042,22 @@ static bool __mf_ug_list_play_stop(ugData *data) ugData *ugd = (ugData *)data;
ug_mf_retvm_if(ugd == NULL, false, "ugd is NULL");
- MMPlayerStateType state = MM_PLAYER_STATE_NONE;
+ player_state_e state = PLAYER_STATE_NONE;
int error_code = 0;
if (ugd->ug_ListPlay.ug_Player != 0) {
- error_code = mm_player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ error_code = player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ ug_debug("state is [%d]", state);
- if (0 == error_code && (MM_PLAYER_STATE_PLAYING == state || MM_PLAYER_STATE_PAUSED == state)) {
- if (mm_player_stop(ugd->ug_ListPlay.ug_Player) != MM_ERROR_NONE) {
+ if (0 == error_code && (PLAYER_STATE_PLAYING == state || PLAYER_STATE_PAUSED == state)) {
+ if (player_stop(ugd->ug_ListPlay.ug_Player) != 0) {
ug_debug("Error when __mf_ug_list_play_stop\n");
UG_TRACE_END;
return false;
} else {
ugd->ug_ListPlay.ug_iPlayState = PLAY_STATE_STOP;
+ ugd->ug_ListPlay.ug_bDrmContentCanPlay = false;
UG_TRACE_END;
return true;
}
@@ -669,7 +1095,7 @@ static bool __mf_ug_list_play_unrealize(ugData *data) if (ugd->ug_ListPlay.ug_Player != 0) {
/*/unrealize can be invoked at any state */
- if (mm_player_unrealize(ugd->ug_ListPlay.ug_Player) != MM_ERROR_NONE) {
+ if (player_unprepare(ugd->ug_ListPlay.ug_Player) != 0) {
ug_debug("Error when __mf_ug_list_play_unrealize\n");
UG_TRACE_END;
return false;
@@ -705,7 +1131,7 @@ static bool __mf_ug_list_play_destory(ugData *data) if (ugd->ug_ListPlay.ug_Player != 0) {
/*/destroy can be invoked at any state */
- if (mm_player_destroy(ugd->ug_ListPlay.ug_Player) != MM_ERROR_NONE) {
+ if (player_destroy(ugd->ug_ListPlay.ug_Player) != 0) {
ug_debug("Error when __mf_ug_list_play_destory\n");
UG_TRACE_END;
return false;
@@ -716,6 +1142,12 @@ static bool __mf_ug_list_play_destory(ugData *data) return true;
}
}
+
+ UG_SAFE_FREE_CHAR(g_player_cbs);
+ if (g_player_pipe) {
+ ecore_pipe_del(g_player_pipe);
+ g_player_pipe = NULL;
+ }
UG_TRACE_END;
return false;
}
@@ -741,12 +1173,15 @@ static bool __mf_ug_list_play_play_current_file(ugData *data) UG_TRACE_BEGIN;
ugData *ugd = (ugData *)data;
ug_mf_retvm_if(ugd == NULL, false, "ugd is NULL");
+ int error_code = 0;
- if (ugd->ug_ListPlay.ug_iPlayState != PLAY_STATE_READY) {
+ player_state_e state = PLAYER_STATE_NONE;
+ error_code = player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ ug_debug("state is [%d]", state);
+ if (state != PLAYER_STATE_READY) {
UG_TRACE_END;
return false;
}
-
if (!__mf_ug_list_play_play(ugd)) {
mf_ug_list_play_destory_playing_file(ugd);
UG_TRACE_END;
@@ -777,20 +1212,23 @@ static bool __mf_ug_list_play_resume(void *data) ugData *ugd = (ugData *)data;
ug_mf_retvm_if(ugd == NULL, false, "ugd is NULL");
- MMPlayerStateType state = MM_PLAYER_STATE_NONE;
+ player_state_e state = PLAYER_STATE_NONE;
int error_code = 0;
int err = -1;
if (ugd->ug_ListPlay.ug_Player != 0) {
- error_code = mm_player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ error_code = player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ ug_debug("state is [%d]", state);
- if (0 == error_code && MM_PLAYER_STATE_PAUSED == state) {
- err = mm_player_resume(ugd->ug_ListPlay.ug_Player);
- if (err != MM_ERROR_NONE) {
+ if (0 == error_code && PLAYER_STATE_PAUSED == state) {
+ err = player_start(ugd->ug_ListPlay.ug_Player);
+ if (err != 0) {
ug_debug("Error when _ug_player_mgr_resume. err[%x]\n", err);
UG_TRACE_END;
return false;
} else {
+ __mf_ug_list_play_set_play_start_status(ugd, ugd->ug_ListPlay.ug_pPlayFilePath);
+ mf_ug_list_play_update_item_icon(ugd);
UG_TRACE_END;
return true;
}
@@ -826,16 +1264,17 @@ static bool __mf_ug_list_play_pause(void *data) ugData *ugd = (ugData *)data;
ug_mf_retvm_if(ugd == NULL, false, "ugd is NULL");
- int err = MM_ERROR_NONE;
- MMPlayerStateType state = MM_PLAYER_STATE_NONE;
+ int err = 0;
+ player_state_e state = PLAYER_STATE_NONE;
int error_code = 0;
if (ugd->ug_ListPlay.ug_Player) {
- error_code = mm_player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ error_code = player_get_state(ugd->ug_ListPlay.ug_Player, &state);
+ ug_debug("state is [%d]", state);
- if (0 == error_code && MM_PLAYER_STATE_PLAYING == state) {
- err = mm_player_pause(ugd->ug_ListPlay.ug_Player);
- if (err != MM_ERROR_NONE) {
+ if (0 == error_code && PLAYER_STATE_PLAYING == state) {
+ err = player_pause(ugd->ug_ListPlay.ug_Player);
+ if (err != 0) {
ug_debug("Error when _ug_player_mgr_pause. err[%x]\n", err);
UG_TRACE_END;
return false;
@@ -887,7 +1326,7 @@ static void __mf_ug_list_play_control_cb(void *data) UG_TRACE_END;
}
-static bool __mf_ug_list_play_play_new_file(ugListItemData *data)
+static bool __mf_ug_list_play_play_new_file(ugListItemData *data, bool drm_check_flag)
{
UG_TRACE_BEGIN;
ugListItemData *itemData = data;
@@ -898,7 +1337,7 @@ static bool __mf_ug_list_play_play_new_file(ugListItemData *data) __mf_ug_list_play_init_data(ugd);
- if (!__mf_ug_list_play_ready_new_file_play(itemData)) {
+ if (!__mf_ug_list_play_ready_new_file_play(itemData, true)) {
UG_TRACE_END;
return false;
}
@@ -939,22 +1378,29 @@ void mf_ug_list_play_play_music_item(ugListItemData *data) int key = 0;
int error_code = 0;
error_code = vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &key);
+
ug_debug("key is [%d]", key);
+ ug_debug("ugd->ug_ListPlay.ug_iPlayState is [%d]", ugd->ug_ListPlay.ug_iPlayState);
+
if (error_code == 0 && key <= VCONFKEY_SYSMAN_BAT_POWER_OFF) {
mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, ("Battery low, play failed!"), NULL, NULL, NULL, NULL, NULL);
} else if (error_code != 0) {
mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, ("Unkown error, play failed!"), NULL, NULL, NULL, NULL, NULL);
} else {
if (ugd->ug_ListPlay.ug_pPlayFilePath != NULL) {
+ ug_debug();
if (g_strcmp0(ugd->ug_ListPlay.ug_pPlayFilePath, itemData->ug_pItemName->str) != 0) {
mf_ug_list_play_destory_playing_file(ugd);
- __mf_ug_list_play_play_new_file(itemData);
+ mf_ug_list_play_update_item_icon(ugd);
+ __mf_ug_list_play_play_new_file(itemData, true);
} else {
+ ug_debug();
/*/ playing the same file */
__mf_ug_list_play_control_cb(ugd);
}
} else {
- __mf_ug_list_play_play_new_file(itemData);
+ ug_debug();
+ __mf_ug_list_play_play_new_file(itemData, true);
}
}
UG_TRACE_END;
diff --git a/src/common/mf-ug-search-internal.c b/src/common/mf-ug-search-internal.c new file mode 100644 index 0000000..d8160e9 --- /dev/null +++ b/src/common/mf-ug-search-internal.c @@ -0,0 +1,880 @@ +/* + * myfile + * + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + + + +#include <glib.h> +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <dirent.h> +#include <pthread.h> +#include <Ecore.h> + +#include "mf-ug-main.h" +#include "mf-ug-search.h" +#include "mf-ug-search-internal.h" +#include "mf-ug-fs-util.h" + +#define APPEND_SIZE 2 /* for null and slash */ +#define MF_ERR_BUF 256 + +#define NORMALIZE_OPTION G_NORMALIZE_NFD + +#ifdef CHECK_RESTRICTED_PATH +/* TODO + * This code should be revised. + * How to get restricted path information? + * I think this module should not depend on other lib(except glib and stdlib). +*/ +#define ROOT_UMS "/opt/media" +#define ROOT_MMC "/opt/storage/sdcard" +#endif /* CHECK_RESTRICTED_PATH */ + +int flagSearchMsg = 1; +pthread_mutex_t gLockSearchMsg; +pthread_cond_t gCondSearchMsg; + +static void __mf_ug_search_tx_wait(); +static void __mf_ug_search_result_publish_msg(mf_search_pipe_msg_type type, void *result, void *user_data); + +inline static void __mf_ug_search_cmd_lock(ms_handle_t *handle) +{ + if (handle && handle->cmd_lock) { + g_mutex_lock(handle->cmd_lock); + } + return; +} + +inline static void __mf_ug_search_cmd_unlock(ms_handle_t *handle) +{ + if (handle && handle->cmd_lock) { + g_mutex_unlock(handle->cmd_lock); + } + return; +} + +inline static void __mf_ug_search_thread_lock(ms_handle_t *handle) +{ + if (handle && handle->thread_mutex) { + g_mutex_lock(handle->thread_mutex); + } + return; +} + +inline static void __mf_ug_search_thread_unlock(ms_handle_t *handle) +{ + if (handle && handle->thread_mutex) { + g_mutex_unlock(handle->thread_mutex); + } + return; +} + +inline static void __mf_ug_search_args_free(ms_args_t *args) +{ + if (args) { + if (args->root_path) { + g_list_foreach(args->root_path, (GFunc) g_free, NULL); + g_list_free(args->root_path); + args->root_path = NULL; + } + + if (args->needle) + g_free(args->needle); + + g_free(args); + } + return; +} + +inline static void __mf_ug_search_result_free(mf_search_result_t *result) +{ + if (result) { + if (result->current_dir) { + g_free(result->current_dir); + result->current_dir = NULL; + } + if (result->dir_list) { + g_list_foreach(result->dir_list, (GFunc) g_free, NULL); + g_list_free(result->dir_list); + result->dir_list = NULL; + } + if (result->file_list) { + g_list_foreach(result->file_list, (GFunc) g_free, NULL); + g_list_free(result->file_list); + result->file_list = NULL; + } + g_free(result); + } + return; +} + +#ifdef CHECK_RESTRICTED_PATH +gboolean __mf_ug_search_check_licet_path(const char *path) +{ + return (gboolean) (strstr(path, ROOT_UMS) || strstr(path, ROOT_MMC)); +} +#endif /*CHECK_RESTRICTED_PATH*/ + + + /*This function is for testing and should be revised for performance before applying*/ +static inline gboolean __mf_ug_search_has_nonspacing_mark(const char *nstr) +{ + if (nstr) { + const char *p_str = nstr; + while (p_str && *p_str) { + gunichar uc; + uc = g_utf8_get_char(p_str); + if (g_unichar_type(uc) == G_UNICODE_NON_SPACING_MARK) { + return TRUE; + } else { + p_str = g_utf8_next_char(p_str); + } + } + } + return FALSE; +} + +static gboolean __mf_ug_search_NFD_ext(const char *str, const char *needle) +{ + int s_len = 0; + int n_len = 0; + if (!str) { + return FALSE; + } + s_len = strlen(str); + + if (!needle) { + return FALSE; + } else { + n_len = strlen(needle); + if (n_len == 0) { + return FALSE; + } + } + if (s_len < n_len) + return FALSE; + char *pdot = strrchr(str, '.'); + + if (!pdot) { + return FALSE; + } else if (pdot != str) { + char ext[8] = {0,}; + memcpy(ext, pdot + 1, strlen(pdot) - 1); + if (g_strcmp0(ext, needle)== 0) + return TRUE; + else + return FALSE; + } else { + return FALSE; + } + +} +static gboolean __mf_ug_search_NFD_strstr(const char *str, const char *needle) +{ + int s_len = 0; + int n_len = 0; + + if (!str) { + return FALSE; + } + s_len = strlen(str); + + if (!needle) { + return FALSE; + } else { + n_len = strlen(needle); + if (n_len == 0) { + return FALSE; + } + } + + if (s_len < n_len) + return FALSE; + + if (__mf_ug_search_has_nonspacing_mark(str)) { + const char *p_str = str; + const char *end = p_str + s_len - n_len; + + while (p_str && p_str <= end && *p_str) { + const char *s = p_str; + const char *n = needle; + while (n && *n) { + if (s && *s) { + gunichar sc, nc; + sc = g_utf8_get_char(s); + nc = g_utf8_get_char(n); + if (g_unichar_type(sc) == G_UNICODE_NON_SPACING_MARK) { + if (g_unichar_type(nc) == G_UNICODE_NON_SPACING_MARK) { + if (sc != nc) { + goto next; + } else { + s = g_utf8_next_char(s); + n = g_utf8_next_char(n); + } + } else { + s = g_utf8_next_char(s); + } + } else if (sc != nc) { + goto next; + } else { + s = g_utf8_next_char(s); + n = g_utf8_next_char(n); + } + } else { + return FALSE; + } + } + + return TRUE; +next: + p_str = g_utf8_next_char(p_str); + } + } else { + return (gboolean) (!(!strstr(str, needle))); + } + return FALSE; +} + +static GList *__mf_ug_search_do_find(const char *root, const char *needle, mf_search_option option, ms_handle_t *handle) +{ + DIR *directory = NULL; + GList *candidate = NULL; + + char *up_needle = NULL; + char *up_name = NULL; + char err_buf[MF_ERR_BUF] = {0,}; + + if (!handle) { + ms_error("handle is NULL"); + return NULL; + } + + if (!handle->result) { + ms_error("handle->result is NULL"); + return NULL; + } + + if (!root || !needle) { + ms_error("invaild args"); + return NULL; + } + + if (!g_file_test(root, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) { + ms_error("invaild root_path : %s", root); + return NULL; + } + + directory = opendir(root); + if (directory) { + mf_search_result_t *result = NULL; + struct dirent *entry = NULL; + + result = handle->result; + __mf_ug_search_thread_lock(handle); + if (result->current_dir) { + g_free(result->current_dir); + } + result->current_dir = g_strdup(root); + __mf_ug_search_thread_unlock(handle); + while ((entry = readdir(directory)) != NULL) { + if (!(option & MF_SEARCH_OPT_HIDDEN) && (0 == strncmp(entry->d_name, ".", 1))) { + ms_debug("[%s] is hidden file. Skip it", entry->d_name); + continue; + } + + if (handle->is_stop == TRUE) { + ms_debug("break from do find"); + break; + } + + if (entry->d_type & DT_REG) { + if (option & MF_SEARCH_OPT_FILE) { + __mf_ug_search_thread_lock(handle); + result->total_count++; + __mf_ug_search_thread_unlock(handle); + + up_name = g_utf8_strup(entry->d_name, strlen(entry->d_name)); + up_needle = g_utf8_strup(needle, strlen(needle)); + + /*Todo:*/ + /* should we check the return value for further use? */ + gchar *nor_str = g_utf8_normalize(up_name, -1, NORMALIZE_OPTION); + if (__mf_ug_search_NFD_strstr(nor_str, up_needle)) + { + gchar *path = NULL; + gssize len = strlen(root) + strlen(entry->d_name) + APPEND_SIZE; /* for null and slash*/ + path = g_malloc(sizeof(gchar) * len); + if (path) { + g_snprintf(path, len, "%s/%s", root, entry->d_name); + + __mf_ug_search_thread_lock(handle); + result->file_list = g_list_append(result->file_list, (gpointer) path); + result->is_end = FALSE; + __mf_ug_search_thread_unlock(handle); + + __mf_ug_search_tx_wait(); + __mf_ug_search_result_publish_msg(MF_SEARCH_PIPE_MSG_RESULT_REPORT, result, + handle->args->user_data); + } + /*1 TODO: how can i handle else case?*/ + } + g_free(nor_str); + free(up_needle); + up_needle = NULL; + free(up_name); + up_name = NULL; + }else if (option & MF_SEARCH_OPT_EXT) { + __mf_ug_search_thread_lock(handle); + result->total_count++; + __mf_ug_search_thread_unlock(handle); + + up_name = g_utf8_strup(entry->d_name, strlen(entry->d_name)); + up_needle = g_utf8_strup(needle, strlen(needle)); + + /*Todo:*/ + /* should we check the return value for further use? */ + gchar *nor_str = g_utf8_normalize(up_name, -1, NORMALIZE_OPTION); + if (__mf_ug_search_NFD_ext(nor_str, up_needle)) + { + gchar *path = NULL; + gssize len = strlen(root) + strlen(entry->d_name) + APPEND_SIZE; /* for null and slash*/ + path = g_malloc(sizeof(gchar) * len); + if (path) { + g_snprintf(path, len, "%s/%s", root, entry->d_name); + + __mf_ug_search_thread_lock(handle); + result->file_list = g_list_append(result->file_list, (gpointer) path); + result->is_end = FALSE; + __mf_ug_search_thread_unlock(handle); + + __mf_ug_search_tx_wait(); + __mf_ug_search_result_publish_msg(MF_SEARCH_PIPE_MSG_RESULT_REPORT, result, + handle->args->user_data); + } + /*1 TODO: how can i handle else case?*/ + } + g_free(nor_str); + free(up_needle); + up_needle = NULL; + free(up_name); + up_name = NULL; + + } + } else if (entry->d_type & DT_DIR) { + gchar *path = NULL; + gssize len = 0; + + len = strlen(entry->d_name); + /*skip current and upper directory*/ + if (0 == strncmp(entry->d_name, ".", strlen(".")) || 0 == strncmp(entry->d_name, "..", strlen(".."))) { + continue; + } + /* we are not going to search /opt/media/SLP_Debug folder */ + if ((strlen(result->current_dir) == strlen(PHONE_FOLDER)) && (strcmp(result->current_dir, PHONE_FOLDER) == 0) + && (strlen(entry->d_name) == strlen(DEBUG_FOLDER)) && (strcmp(entry->d_name, DEBUG_FOLDER) == 0)) { + ms_debug("[%s] is hidden folder. Skip it", entry->d_name); + continue; + } + + len = strlen(root) + strlen(entry->d_name) + APPEND_SIZE; /* for null and slash */ + path = g_malloc(sizeof(gchar) * len); + if (path) { + g_snprintf(path, len, "%s/%s", root, entry->d_name); + candidate = g_list_append(candidate, (gpointer) path); + } + /*1 TODO: how can i handle else case?*/ + if (option & MF_SEARCH_OPT_DIR) { + __mf_ug_search_thread_lock(handle); + result->total_count++; + __mf_ug_search_thread_unlock(handle); + + up_name = g_utf8_strup(entry->d_name, strlen(entry->d_name)); + up_needle = g_utf8_strup(needle, strlen(needle)); + gchar *nor_str = g_utf8_normalize(up_name, -1, NORMALIZE_OPTION); + if (__mf_ug_search_NFD_strstr(nor_str, up_needle)) + { + __mf_ug_search_thread_lock(handle); + result->dir_list = g_list_append(result->dir_list, (gpointer) g_strdup(path)); + result->is_end = FALSE; + __mf_ug_search_thread_unlock(handle); + __mf_ug_search_tx_wait(); + __mf_ug_search_result_publish_msg(MF_SEARCH_PIPE_MSG_RESULT_REPORT, result, handle->args->user_data); + } + g_free(nor_str); + free(up_name); + up_name = NULL; + + free(up_needle); + up_needle = NULL; + } + } + } + closedir(directory); + directory = NULL; + } else { + MF_FILE_ERROR_LOG(err_buf, "open failed", root); + } + + return candidate; +} + +static gpointer __mf_ug_search_find_thread(gpointer data) +{ + ms_handle_t *handle = (ms_handle_t *) data; + if (handle) { + ms_args_t *args = NULL; + mf_search_result_t *result = NULL; + + result = handle->result; + args = handle->args; + + if (args && result) { + GList *root = NULL; + GList *candidate = NULL; /*use this list as stack*/ + root = args->root_path; + while (root) { + char *path = (char *)root->data; + if (path) { + /*push root paths to stack*/ + candidate = g_list_append(candidate, (gpointer) g_strdup(path)); + } + root = g_list_next(root); + } + + while (candidate) { + GList *new_list = NULL; + GList *list = NULL; + gchar *item = NULL; + + __mf_ug_search_thread_lock(handle); + if (handle->is_stop) { + __mf_ug_search_thread_unlock(handle); + result->is_end = TRUE; + goto MF_FIND_THREAD_EXIT; + } + __mf_ug_search_thread_unlock(handle); + + list = g_list_first(candidate); + /*pop one path from stack*/ + candidate = g_list_remove_link(candidate, list); + item = (gchar *) list->data; + if (item) { + ms_debug("current : %s", item); +#if 0 + __mf_ug_search_thread_lock(handle); + if (result->current_dir) { + g_free(result->current_dir); + } + result->current_dir = g_strdup(item); + __mf_ug_search_thread_unlock(handle); +#endif + /*publish root change message here*/ + __mf_ug_search_tx_wait(); + if (handle->is_stop) { + result->is_end = TRUE; + goto MF_FIND_THREAD_EXIT; + } + __mf_ug_search_result_publish_msg(MF_SEARCH_PIPE_MSG_ROOT_CHANGE, item, args->user_data); + new_list = __mf_ug_search_do_find(item, args->needle, args->option, handle); + g_free(item); + item = NULL; + g_list_free(list); + list = NULL; + } + /*push new paths to stack*/ + candidate = g_list_concat(new_list, candidate); + } + + __mf_ug_search_thread_lock(handle); + result->is_end = TRUE; + __mf_ug_search_thread_unlock(handle); + __mf_ug_search_tx_wait(); + __mf_ug_search_result_publish_msg(MF_SEARCH_PIPE_MSG_FINISHED, handle->result, args->user_data); +MF_FIND_THREAD_EXIT: + if (candidate) { + g_list_foreach(candidate, (GFunc) g_free, NULL); + g_list_free(candidate); + candidate = NULL; + } + } else { + ms_error("args : %p or result : %p is not allocated yet!!", handle->args, handle->result); + } + } + /*g_thread_exit(NULL);*/ + return NULL; +} + +int _mf_ug_search_init(ms_handle_t **handle) +{ + GMutex *lock = NULL; + ms_handle_t *ms_handle = NULL; + + ms_debug(""); + + if (!handle) { + return MF_SEARCH_ERROR_INVAL_P; + } + + ms_handle = g_malloc0(sizeof(ms_handle_t)); + if (ms_handle == NULL) { + ms_error("Fail to allocate memory for handle "); + *handle = NULL; + return MF_SEARCH_ERROR_ALLOC; + } + + ms_handle->state = MF_SEARCH_STATE_INIT; + ms_handle->is_stop = FALSE; + + lock = g_mutex_new(); + if (!lock) { + ms_error("Fail to create cmd_lock"); + g_free(ms_handle); + return MF_SEARCH_ERROR_ALLOC; + } + ms_handle->cmd_lock = lock; + + *handle = ms_handle; + + ms_info("Success to make search handle : %p", ms_handle); + return MF_SEARCH_ERROR_NONE; +} + +int _mf_ug_search_start(ms_handle_t *handle, const char **root_path, unsigned int path_num, const char *needle, mf_search_option option, void *user_data) +{ + ms_args_t *args = NULL; + mf_search_result_t *result = NULL; + mf_search_option l_opt = MF_SEARCH_OPT_NONE; + int ret = MF_SEARCH_ERROR_NONE; + int i = 0; + + if (!handle) { + ms_error("handle is NULL"); + return MF_SEARCH_ERROR_INVAL_P; + } + + if (handle->state != MF_SEARCH_STATE_INIT) { + ms_error("invaild state : %d", handle->state); + return MF_SEARCH_ERROR_INVAL_S; + } + + if (!root_path || !needle || path_num < 1) { + ms_error("invaild arguments - root[%p], path_num[%d], needle[%p]", root_path, path_num, needle); + return MF_SEARCH_ERROR_INVAL_P; + } + + __mf_ug_search_cmd_lock(handle); + + if (handle->args) { + __mf_ug_search_args_free(handle->args); + handle->args = NULL; + } + handle->args = args = g_malloc0(sizeof(ms_args_t)); + if (!args) { + ms_error("fail to alloc args"); + ret = MF_SEARCH_ERROR_ALLOC; + goto FAIL_FREE_MEM; + } + + if (option == MF_SEARCH_OPT_NONE) { + ms_warn("option is MF_SEARCH_OPT_NONE, set all option automatically "); + l_opt = MF_SEARCH_OPT_HIDDEN | MF_SEARCH_OPT_DIR | MF_SEARCH_OPT_FILE; + } else { + l_opt = option; + } + + for (i = 0; i < path_num; i++) { + const char *path = root_path[i]; + ms_debug("%d th root path is %s", i, path); +#ifdef CHECK_RESTRICTED_PATH + if (!__mf_ug_search_check_licet_path(path)) { + ms_error("%dth root path[%s] is invaild", i, path); + ret = MF_SEARCH_ERROR_INVAL_P; + goto FAIL_FREE_MEM; + } +#endif /*CHECK_RESTRICTED_PATH*/ + if (g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) + && ((l_opt & MF_SEARCH_OPT_HIDDEN) || strncmp(path, ".", 1)) + && TRUE) { + gchar *new_path = NULL; + gssize len = strlen(path); + + if (path[len - 1] == '/') { + new_path = g_strndup(path, len - 1); + } else { + new_path = g_strndup(path, len); + } + args->root_path = g_list_append(args->root_path, (gpointer) new_path); + } else { + ms_error("Fail to test %dthe root path[%s]", i, path); + ret = MF_SEARCH_ERROR_INVAL_P; + goto FAIL_FREE_MEM; + } + } + args->user_data = user_data; + + + args->needle = g_utf8_normalize(needle, -1, NORMALIZE_OPTION); + if (!args->needle) { + ms_error("fail to alloc args->needle"); + goto FAIL_FREE_MEM; + } + + args->option = l_opt; + + if (handle->result) { + __mf_ug_search_result_free(handle->result); + handle->result = NULL; + } + handle->result = result = g_malloc0(sizeof(ms_args_t)); + if (!result) { + ms_error("fail to alloc result"); + ret = MF_SEARCH_ERROR_ALLOC; + goto FAIL_FREE_MEM; + } + + handle->thread_mutex = g_mutex_new(); + if (!handle->thread_mutex) { + ms_error("fail to alloc handle->thread_mutex"); + ret = MF_SEARCH_ERROR_ALLOC; + goto FAIL_FREE_MEM; + } + + handle->is_stop = FALSE; + handle->result->is_end = FALSE; + + /*create thread for find item.*/ + handle->thread_h = g_thread_create(__mf_ug_search_find_thread, handle, TRUE, NULL); + if (!handle->thread_h) { + ms_error("fail to create __mf_ug_search_find_thread"); + ret = MF_SEARCH_ERROR_INTERNAL; + goto FAIL_FREE_MEM; + } + /*create idler for reporting find result.*/ + handle->state = MF_SEARCH_STATE_SEARCH; + __mf_ug_search_cmd_unlock(handle); + return MF_SEARCH_ERROR_NONE; + +FAIL_FREE_MEM: + if (args) { + __mf_ug_search_args_free(args); + handle->args = NULL; + } + + if (result) { + __mf_ug_search_result_free(result); + handle->result = NULL; + } + + if (handle->thread_mutex) { + g_mutex_free(handle->thread_mutex); + handle->thread_mutex = NULL; + } + + if (handle->thread_h) { + __mf_ug_search_thread_lock(handle); + handle->is_stop = TRUE; + __mf_ug_search_thread_unlock(handle); + g_thread_join(handle->thread_h); + handle->thread_h = NULL; + } + __mf_ug_search_cmd_unlock(handle); + + return ret; +} + +int _mf_ug_search_stop(ms_handle_t *handle) +{ + ms_debug(""); + + if (!handle) { + ms_error("handle is NULL"); + return MF_SEARCH_ERROR_INVAL_P; + } + + if (handle->state != MF_SEARCH_STATE_SEARCH) { + ms_error("invaild state : %d", handle->state); + return MF_SEARCH_ERROR_INVAL_S; + } + + __mf_ug_search_cmd_lock(handle); + + __mf_ug_search_thread_lock(handle); + handle->is_stop = TRUE; + __mf_ug_search_thread_unlock(handle); + + pthread_mutex_lock(&gLockSearchMsg); + if (flagSearchMsg == 0) { + flagSearchMsg = 1; + pthread_cond_signal(&gCondSearchMsg); + } + pthread_mutex_unlock(&gLockSearchMsg); + + if (handle->thread_h) { + g_thread_join(handle->thread_h); + handle->thread_h = NULL; + } + + if (handle->thread_mutex) { + g_mutex_free(handle->thread_mutex); + handle->thread_mutex = NULL; + } + + if (handle->args) { + __mf_ug_search_args_free(handle->args); + handle->args = NULL; + } + if (handle->result) { + __mf_ug_search_result_free(handle->result); + handle->result = NULL; + } + + handle->state = MF_SEARCH_STATE_INIT; + handle->is_stop = FALSE; + + __mf_ug_search_cmd_unlock(handle); + + return MF_SEARCH_ERROR_NONE; +} + +void _mf_ug_search_finalize(ms_handle_t **handle) +{ + ms_handle_t *ms_handle = *handle; + + ms_debug(""); + + if (!ms_handle) { + ms_warn("invaild handle"); + return; + } + + if (ms_handle->state == MF_SEARCH_STATE_SEARCH) { + mf_ug_search_stop(ms_handle); + } +/* __mf_ug_search_cmd_lock(ms_handle); */ +/* __mf_ug_search_cmd_unlock(ms_handle); */ + + if (ms_handle->cmd_lock) { + g_mutex_free(ms_handle->cmd_lock); + ms_handle->cmd_lock = NULL; + } + g_free(ms_handle); + *handle = NULL; + + return; +} + +/*+++++++++++++++++++++++++ UTIL APIs ++++++++++++++++++++++++++++++ */ +static void __mf_ug_search_tx_wait() +{ + pthread_mutex_lock(&gLockSearchMsg); + while (flagSearchMsg == 0) { + pthread_cond_wait(&gCondSearchMsg, &gLockSearchMsg); + } + flagSearchMsg = 0; + pthread_mutex_unlock(&gLockSearchMsg); +} + +static void __mf_ug_search_result_publish_msg(mf_search_pipe_msg_type type, void *result, void *user_data) +{ + ugData *ugd = (ugData *)user_data; + /*generate message block*/ + mf_search_pipe_msg msg; + memset(&msg, 0, sizeof(mf_search_pipe_msg)); + + msg.mf_sp_msg_type = type; + if (msg.mf_sp_msg_type == MF_SEARCH_PIPE_MSG_RESULT_REPORT) { + msg.report_result = g_strdup((gchar *) result); + msg.current_path = NULL; + } else if (msg.mf_sp_msg_type == MF_SEARCH_PIPE_MSG_ROOT_CHANGE) { + msg.report_result = NULL; + msg.current_path = g_strdup((gchar *) result); + ms_debug("current path is %s", msg.current_path); + } else if (msg.mf_sp_msg_type == MF_SEARCH_PIPE_MSG_FINISHED) { + msg.report_result = result; + msg.current_path = NULL; + } else { + msg.report_result = NULL; + msg.current_path = NULL; + } + + /*write message to pipe*/ + ecore_pipe_write(ugd->ug_UiGadget.ug_pSyncPipe, &msg, sizeof(msg)); +} + +gchar *_mf_ug_search_result_dir_get(mf_search_result_t * result) +{ + gchar *name = NULL; + if (result) { + GList *list = NULL; + list = result->dir_list; + if (list && list->data) { + gchar *item = (gchar *) list->data; + result->dir_list = g_list_remove(list, item); + name = item; + } + } + return name; +} + +gchar *_mf_ug_search_result_file_get(mf_search_result_t * result) +{ + gchar *name = NULL; + if (result) { + GList *list = NULL; + list = result->file_list; + if (list && list->data) { + gchar *item = (gchar *) list->data; + result->file_list = g_list_remove(list, item); + name = item; + } + } + return name; +} + +gboolean _mf_ug_search_result_is_end(mf_search_result_t *result) +{ + gboolean end = FALSE; + if (result) { + end = result->is_end; + } + return end; +} + +guint _mf_ug_search_result_total_count_get(mf_search_result_t *result) +{ + guint count = 0; + if (result) { + count = result->total_count; + } + return count; +} + +gchar *_mf_ug_search_result_current_dir_get(mf_search_result_t * result) +{ + gchar *c_dir = NULL; + if (result) { + if (result->current_dir) { + c_dir = result->current_dir; + result->current_dir = NULL; + } + } + return c_dir; +} diff --git a/src/common/mf-ug-search.c b/src/common/mf-ug-search.c new file mode 100644 index 0000000..ebfd3fd --- /dev/null +++ b/src/common/mf-ug-search.c @@ -0,0 +1,131 @@ +/* + * myfile + * + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + + + +#include <stdio.h> +#include <dirent.h> +#include <sys/types.h> +#include <string.h> +#include <glib.h> + +#include "mf-ug-dlog.h" +#include "mf-ug-search.h" +#include "mf-ug-search-internal.h" + + +/*+++++++++++++++++++++++ APIs +++++++++++++++++++++++*/ + +int mf_ug_search_init(mf_search_handle *handle) +{ + int ret = 0; + ms_handle_t *ms_handle = NULL; + + if (!handle) { + return -1; + } + if (!g_thread_supported()) { + g_thread_init(NULL); + } + ret = _mf_ug_search_init(&ms_handle); + if (ret < 0) { + ms_error("Fail to init search handle "); + *handle = (mf_search_handle) 0; + return ret; + } + + *handle = (mf_search_handle) ms_handle; + + return MF_SEARCH_ERROR_NONE; +} + +int mf_ug_search_start(mf_search_handle handle, + const char **root_path, unsigned int path_num, const char *needle, mf_search_option option, void *user_data) +{ + int ret = 0; + if (!handle) { + return MF_SEARCH_ERROR_INVAL_P; + } + + if (!root_path || !needle || path_num < 1) { + return MF_SEARCH_ERROR_INVAL_P; + } + + ret = _mf_ug_search_start((ms_handle_t *) handle, root_path, path_num, needle, option, user_data); + + if (ret < 0) { + ms_error("Fail to start search "); + } + return ret; +} + +int mf_ug_search_stop(mf_search_handle handle) +{ + int ret = 0; + + ret = _mf_ug_search_stop((ms_handle_t *) handle); + if (ret < 0) { + ms_error("Fail to stop search "); + } + return ret; +} + +void mf_ug_search_finalize(mf_search_handle *handle) +{ + _mf_ug_search_finalize((ms_handle_t **) handle); + return; +} + +/*+++++++++++++++++++++++ UTIL APIs +++++++++++++++++++++++*/ + +char *mf_ug_search_result_dir_get(mf_search_result_t *result) +{ + return _mf_ug_search_result_dir_get(result); +} + +char *mf_ug_search_result_file_get(mf_search_result_t *result) +{ + return _mf_ug_search_result_file_get(result); +} + +int mf_ug_search_result_is_end(mf_search_result_t *result, int *is_end) +{ + if (result) { + *is_end = _mf_ug_search_result_is_end(result); + } else { + return MF_SEARCH_ERROR_INVAL_P; + } + return MF_SEARCH_ERROR_NONE; +} + +int mf_ug_search_result_total_count_get(mf_search_result_t *result, unsigned int *count) +{ + if (result) { + *count = _mf_ug_search_result_total_count_get(result); + } else { + return MF_SEARCH_ERROR_INVAL_P; + } + return MF_SEARCH_ERROR_NONE; +} + +char *mf_ug_search_result_current_dir_get(mf_search_result_t *result) +{ + return _mf_ug_search_result_current_dir_get(result); +} diff --git a/src/common/mf-ug-util.c b/src/common/mf-ug-util.c index e934f33..b60374e 100755..100644 --- a/src/common/mf-ug-util.c +++ b/src/common/mf-ug-util.c @@ -1,33 +1,41 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
#include <pthread.h>
#include <vconf.h>
+#include <haptic.h>
#include "mf-ug-util.h"
+#include "mf-ug-cb.h"
#include "mf-ug-winset.h"
#include "mf-ug-fm-svc-wrapper.h"
#include "mf-ug-fs-util.h"
#include "mf-ug-inotify-handle.h"
#include "mf-ug-resource.h"
+#define MF_UG_TIMER_INTERVAL_VIBRATION 0.5
+#define MF_UG_VIBRATION_DEVICE 0
+#define MF_UG_VIBRATION_DURATION 500
+
/******************************
** Prototype : ug_genlist_selected_state_get
** Description :
@@ -56,7 +64,7 @@ bool mf_ug_util_is_genlist_selected(void *data) ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
ug_mf_retvm_if(pNavi_s == NULL, false, "get navigation bar in use failed");
- genlist = pNavi_s->ug_pContent;
+ genlist = ugd->ug_MainWindow.ug_pContent;
gli = elm_genlist_first_item_get(genlist);
while (gli) {
@@ -249,8 +257,7 @@ static void __mf_ug_util_get_marked_off_selected_items(void *data, Eina_List **s ug_mf_retm_if(select_list == NULL, "selected_list is NULL");
- ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
- Evas_Object *content = pNavi_s->ug_pContent;
+ Evas_Object *content = ugd->ug_MainWindow.ug_pContent;
Elm_Object_Item *gli = elm_genlist_first_item_get(content);
int radio_id = 1;
Elm_Object_Item *nli = NULL;
@@ -268,7 +275,9 @@ static void __mf_ug_util_get_marked_off_selected_items(void *data, Eina_List **s }
radio_id++;
}
- } else if (ugd->ug_UiGadget.ug_iSelectMode == MULTI_ALL_MODE || ugd->ug_UiGadget.ug_iSelectMode == MULTI_FILE_MODE) {
+ } else if (ugd->ug_UiGadget.ug_iSelectMode == MULTI_ALL_MODE ||
+ ugd->ug_UiGadget.ug_iSelectMode == MULTI_FILE_MODE ||
+ ugd->ug_UiGadget.ug_iSelectMode == IMPORT_MODE) {
if (params->ug_pCheckBox) {
if (params->ug_bChecked == true) {
*select_list = eina_list_append(*select_list, strdup(params->ug_pItemName->str));
@@ -451,6 +460,10 @@ int mf_ug_util_add_dir_watch(const char *path, void *data) return mf_ug_inotify_handle_add_inotify_watch(path, mf_ug_cb_dir_update_cb, data);
}
+int mf_ug_util_remove_dir_watch(void)
+{
+ return mf_ug_inotify_handle_rm_inotify_watch();
+}
/******************************
** Prototype : mf_ug_util_set_mmc_state_cb
@@ -566,33 +579,22 @@ void mf_ug_util_storage_insert_action(void *data, char *pItemLabel) ug_mf_retm_if(ugd == NULL, "ugd is NULL");
Elm_Object_Item *pItemPhone = NULL;
- Elm_Object_Item *pItemMMC = NULL;
- Evas_Object *pTabBar = NULL;
- Evas_Object *pOldContent = NULL;
+ ugNaviBar *pNaviBarStruct = NULL;
- if (ugd->ug_MainWindow.ug_pTabBar == NULL) {
- /*1. unset the current content of main layout */
- pOldContent = elm_object_part_content_unset(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content");
- /*2. create Tab Bar */
- if (ugd->ug_MainWindow.ug_pTabLayout == NULL) {
- ugd->ug_MainWindow.ug_pTabLayout = mf_ug_main_tab_layout_create(ugd->ug_MainWindow.ug_pWindow);
- }
- pTabBar = mf_ug_tab_bar_create(ugd->ug_MainWindow.ug_pWindow);
- ugd->ug_MainWindow.ug_pTabBar = pTabBar;
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.content", pOldContent);
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.tabbar", ugd->ug_MainWindow.ug_pTabBar);
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pTabLayout);
- evas_object_show(ugd->ug_MainWindow.ug_pTabLayout);
- /*3. set Navi Bars of phone and mmc as sub view of Tab Bar */
- pItemPhone = mf_ug_tab_bar_append_item(pTabBar, UG_ICON_PHONE, MF_UG_LABEL_PHONE, ugd);
- pItemMMC = mf_ug_tab_bar_append_item(pTabBar, UG_ICON_MEMORY, MF_UG_LABEL_MMC, ugd);
- /*4. set selected */
- //mf_ug_tab_bar_set_selected_item(pItemPhone);
-
- } else {
- pItemMMC = mf_ug_tab_bar_append_item(pTabBar, UG_ICON_MEMORY, MF_UG_LABEL_MMC, ugd);
+ mf_ug_tab_bar_init(ugd);
+ if (!mf_ug_fm_svc_wapper_is_root_path(ugd)) {
+ return;
}
+ pNaviBarStruct = ug_mf_navi_bar_get_navi_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, MF_UG_LABEL_PHONE);
+ elm_object_part_content_unset(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content");
+ pItemPhone = mf_ug_tab_bar_get_item_by_label(ugd->ug_MainWindow.ug_pTabBar, pNaviBarStruct->ug_pNaviLabel);
+ mf_ug_tab_bar_set_selected_item(pItemPhone);
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pNaviBar);
+
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.tabbar", ugd->ug_MainWindow.ug_pTabBar);
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pTabLayout);
+
if (ugd->ug_Status.ug_bMassStorageFlag) {
mf_ug_tab_bar_set_item_disable(ugd->ug_MainWindow.ug_pTabBar, EINA_TRUE);
}
@@ -671,23 +673,72 @@ mf_ug_launch_type mf_ug_util_get_file_launch_type(char *path) UG_TRACE_END;
return LAUNCH_TYPE_UNSUPPORT;
}
+ if (mf_ug_file_attr_is_drm_file(path) == 0) {
+ mf_ug_drm_file_mime_type drm_file_type = mf_ug_fs_oper_get_drm_type(path);
- mf_ug_fs_file_type category_t = 0;
- mf_ug_file_attr_get_file_category(path, &category_t);
- if (category_t == UG_FILE_TYPE_MUSIC || category_t == UG_FILE_TYPE_SOUND || category_t == UG_FILE_TYPE_VOICE) {
- UG_TRACE_END;
- return LAUNCH_TYPE_MUSIC;
- } else if (category_t == UG_FILE_TYPE_IMAGE) {
- UG_TRACE_END;
- return LAUNCH_TYPE_IMAGE;
+ if (drm_file_type == MF_UG_DRM_RINGTONE_FILE) {
+ UG_TRACE_END;
+ return LAUNCH_TYPE_MUSIC;
+ } else if (drm_file_type == MF_UG_DRM_IMAGE_FILE) {
+ UG_TRACE_END;
+ return LAUNCH_TYPE_IMAGE;
+ } else if (drm_file_type == MF_UG_DRM_VIDEO_FILE) {
+ UG_TRACE_END;
+ return LAUNCH_TYPE_VIDEO;
+ } else {
+ UG_TRACE_END;
+ return LAUNCH_TYPE_UNSUPPORT;
+ }
} else {
- UG_TRACE_END;
- return LAUNCH_TYPE_UNSUPPORT;
+ mf_ug_fs_file_type category_t = 0;
+ mf_ug_file_attr_get_file_category(path, &category_t);
+ if (category_t == UG_FILE_TYPE_MUSIC || category_t == UG_FILE_TYPE_SOUND || category_t == UG_FILE_TYPE_VOICE) {
+ UG_TRACE_END;
+ return LAUNCH_TYPE_MUSIC;
+ } else if (category_t == UG_FILE_TYPE_IMAGE) {
+ UG_TRACE_END;
+ return LAUNCH_TYPE_IMAGE;
+ } else {
+ UG_TRACE_END;
+ return LAUNCH_TYPE_UNSUPPORT;
+ }
}
-
UG_TRACE_END;
}
+mf_ug_theme_type mf_ug_util_get_theme(void)
+{
+ mf_ug_theme_type theme = UG_THEME_INVALID;
+ char *name;
+
+ char *theme_name = vconf_get_str(VCONFKEY_SETAPPL_WIDGET_THEME_STR);
+ ug_debug("theme is [%s]", theme_name);
+ ug_mf_retvm_if(theme_name == NULL, UG_THEME_ERROR, "Failed to get vconf value"); /* file system exceptional handle */
+
+ name = strrchr(theme_name, '/');
+
+ if (!name)
+ name = theme_name;
+ else
+ ++name;
+
+ ug_debug("name is [%s]", name);
+ //SETTING_TRACE("name:%s", name);
+ /* special theme process.. */
+ if (0 == g_strcmp0("tizen-black.edj", name) || 0 == g_strcmp0("tizen-black-hd.edj", name)) {
+ theme = UG_THEME_NBEAT_BLACK;
+ } else if (0 == g_strcmp0("tizen.edj", name) || 0 == g_strcmp0("tizen-hd.edj", name)
+ || 0 == g_strcmp0("blue-hd.edj", name)) {
+ theme = UG_THEME_NBEAT;
+ } else {
+ theme = UG_THEME_ERROR;
+ }
+ free(theme_name);
+ theme_name = NULL;
+ ug_debug("theme is [%d]", theme);
+ return theme;
+}
+
char *mf_ug_util_upper_folder_name_get(void *data, GString *fullpath)
{
@@ -727,3 +778,123 @@ FAILED_EXIT: }
+void mf_ug_util_sort_the_file_list(void *data)
+{
+
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is null");
+ ugData *ugd = (ugData *)data;
+
+ int iSortTypeValue = 0;
+
+ iSortTypeValue = ugd->ug_Status.ug_iSortType;
+
+ mf_ug_fs_oper_sort_list(&ugd->ug_UiGadget.ug_pFilterList, iSortTypeValue);
+ /*need to sort folder items only By Name and Date*/
+ mf_ug_fs_oper_sort_list(&ugd->ug_UiGadget.ug_pDirList, iSortTypeValue);
+}
+
+int mf_ug_util_check_disk_space(void *data)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retvm_if(data == NULL, MYFILE_ERR_SRC_ARG_INVALID, "data is null");
+ ugData *ugd = (ugData *)data;
+
+ mf_ug_storage_type state = MF_UG_NONE;
+ unsigned long free_space = 0;
+
+ if (ugd->ug_Status.ug_iMore == UG_MORE_CREATE_FOLDER) {
+ state = mf_ug_fm_svc_wapper_get_location(ugd->ug_Status.ug_pPath->str);
+ free_space = mf_ug_fm_svc_wrapper_get_free_space(state);
+ ug_debug("free size is %lu\n", free_space);
+ /*
+ ** in vfat fs type, sector size is 16K.
+ ** it is to say that the limited size of the free space should be 16K
+ ** or it will report space used up.
+ ** check free_space == 0 can make sure at least 16K is free on the disk
+ ** while every dir takes 4K
+ */
+ if (free_space == 0) {
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL,
+ MF_UG_LABEL_NOT_ENOUGH_SPACE, MF_UG_LABEL_OK,
+ NULL, NULL, mf_ug_cb_warning_popup_cb, ugd);
+ return MYFILE_ERR_NO_FREE_SPACE;
+ }
+ }
+
+ return MYFILE_ERR_NONE;
+}
+
+static void __mf_ug_util_stop_vibration(void *data)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is null");
+ ugData *ugd = (ugData *)data;
+
+ int ret = -1;
+
+ if (ugd->ug_Status.ug_haptic_handle >= 0) {
+ ret = haptic_stop_device(MF_UG_VIBRATION_DEVICE);
+ if (ret != 0)
+ ug_debug("haptic_stop_device failed[%d]!", ret);
+
+ ret = haptic_deinitialize();
+ if (ret != HAPTIC_ERROR_NONE)
+ ug_debug("haptic_deinitialize failed[%d]!", ret);
+ ugd->ug_Status.ug_haptic_handle = -1;
+ }
+ UG_TRACE_END;
+}
+
+static Eina_Bool __mf_ug_util_vibration_timer_cb(void *data)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retvm_if(data == NULL, FALSE, "data is null");
+ ugData *ugd = (ugData *)data;
+
+ ugd->ug_Status.vibration_timer = NULL;
+ __mf_ug_util_stop_vibration(ugd);
+
+ return ECORE_CALLBACK_DONE;
+}
+
+
+bool mf_ug_util_play_vibration(void *data, float duration)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retvm_if(data == NULL, FALSE, "data is null");
+ ug_mf_retvm_if(duration <= 0, FALSE, "Invalid parameter");
+ ugData *ugd = (ugData *)data;
+ int ret = -1;
+
+ ret = haptic_initialize();
+ if (ret != HAPTIC_ERROR_NONE) {
+ ug_debug("haptic_initialize failed[%d]!", ret);
+ return -1;
+ }
+
+ UG_SAFE_DEL_ECORE_TIMER(ugd->ug_Status.vibration_timer);
+ ugd->ug_Status.vibration_timer = ecore_timer_add(MF_UG_TIMER_INTERVAL_VIBRATION, __mf_ug_util_vibration_timer_cb, ugd);
+
+ ret = haptic_vibrate_monotone(MF_UG_VIBRATION_DEVICE, MF_UG_VIBRATION_DURATION, HAPTIC_LEVEL_3);
+
+
+ if (ret != HAPTIC_ERROR_NONE) {
+ ug_debug("haptic_play_pattern failed[%d]!", ret);
+ return -1;
+ }
+ ugd->ug_Status.ug_haptic_handle = MF_UG_VIBRATION_DEVICE;
+
+ return TRUE;
+}
+
+void mf_ug_util_operation_alloc_failed(void *data)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is null");
+ ugData *ugd = (ugData *)data;
+
+ mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, MF_UG_LABEL_MEMORY_NOT_ENOUGH,
+ NULL, NULL, NULL, (Evas_Smart_Cb) elm_exit, NULL);
+}
+
diff --git a/src/include/mf-ug-cb.h b/src/include/mf-ug-cb.h index f0bf01f..bef243d 100755..100644 --- a/src/include/mf-ug-cb.h +++ b/src/include/mf-ug-cb.h @@ -1,24 +1,25 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
-
#ifndef __DEF_MF_UG_CB_H_
#define __DEF_MF_UG_CB_H_
@@ -46,5 +47,13 @@ int mf_ug_cb_set_mass_storage_state_cb(void *data); void mf_ug_cb_mass_storage_changed_cb(keynode_t *key, void *data);
void mf_ug_cb_upper_click_cb(void *data, Evas_Object * obj, void *event_info);
void mf_ug_cb_home_button_cb(void *data, Evas_Object * obj, void *event_info);
+void mf_ug_cb_sort_by_cb(void *data, Evas_Object *obj, void *event_info);
+void mf_ug_search_view_enter_search_routine(void *data, Evas_Object * obj, void *event_info);
+void mf_ug_cb_warning_popup_cb(void *data, Evas_Object * obj, void *event_info);
+void mf_ug_cb_reach_max_len_cb(void *data, Evas_Object * obj, void *event_info);
+void mf_ug_cb_eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
+void mf_ug_cb_save_cb(void *data, Evas_Object *obj, void *event_info);
+void mf_ug_cb_cancel_new_folder_cb(void *data, Evas_Object * obj, void *event_info);
+void mf_ug_cb_create_new_folder(void *data, Evas_Object * obj, void *event_info);
#endif
diff --git a/src/include/mf-ug-conf.h b/src/include/mf-ug-conf.h index af5b8a2..d97807d 100755..100644 --- a/src/include/mf-ug-conf.h +++ b/src/include/mf-ug-conf.h @@ -1,17 +1,20 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ @@ -45,6 +48,8 @@ #define UG_SELECT_MODE_SINGLE_ALL "SINGLE_ALL" #define UG_SELECT_MODE_MULTI_FILE "MULTI_FILE" #define UG_SELECT_MODE_SINGLE_FILE "SINGLE_FILE" +#define UG_SELECT_MODE_IMPORT "IMPORT" +#define UG_SELECT_MODE_EXPORT "EXPORT" #define UG_FILE_FILTER_IMAGE "IMAGE" #define UG_FILE_FILTER_SOUND "SOUND" @@ -56,14 +61,20 @@ #define UG_FILE_FILTER_VS "VS" #define UG_FILE_FILTER_ALL "ALL" +#define UG_DRM_FILTER_ALL "DRM_ALL" +#define UG_DRM_FILTER_NONE "DRM_NONE" +#define UG_DRM_FILTER_WITHOUT_FL "DRM_WITHOUT_FL" + #define UG_MUSIC_PATH "/opt/media/Sounds and music/Music" #define UG_RINGTION_PATH "/opt/media/Sounds and music/Ringtones" #define UG_SETTING_RINGTONE_PATH "/opt/share/settings/Ringtones" -#define UG_SETTING_ALERTS_PATH "/opt/share/settings/Alerts" +#define UG_SETTING_MSG_ALERTS_PATH "/opt/share/settings/Alerts" +#define UG_SETTING_ALERTS_PATH "/opt/share/settings/Alarms" #define MAX_MESSAGE_LEN 1024 #define ACCUMULATED_DATE 86400 /* 24*60*60 */ +#define DRM_MESSAGE_LEN 256 #define UG_LABEL_STRING_LENGTH 128 #define UG_TIME_FORMAT "02u:%02u:%02u" diff --git a/src/include/mf-ug-dlog.h b/src/include/mf-ug-dlog.h index dd32beb..5459f1f 100755..100644 --- a/src/include/mf-ug-dlog.h +++ b/src/include/mf-ug-dlog.h @@ -1,23 +1,25 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ - #ifndef __DEF_MF_UG_DLOG_H_ #define __DEF_MF_UG_DLOG_H_ diff --git a/src/include/mf-ug-fm-svc-wrapper.h b/src/include/mf-ug-fm-svc-wrapper.h index f971e33..804b8ef 100755..100644 --- a/src/include/mf-ug-fm-svc-wrapper.h +++ b/src/include/mf-ug-fm-svc-wrapper.h @@ -1,22 +1,24 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ - #ifndef __DEF_MF_UG_FM_SVC_WRAPPER_H_ #define __DEF_MF_UG_FM_SVC_WRAPPER_H_ @@ -28,6 +30,7 @@ /* file information get/set */ unsigned long mf_ug_fm_svc_wapper_get_file_filter(int file_filter_mode); +int mf_ug_fm_svc_wapper_get_drm_filter(int drm_filter_mode, unsigned long file_filter); int mf_ug_fm_svc_wapper_get_file_list_by_filter(ugData *data, GString *fullpath, Eina_List **dir_list, Eina_List **filter_list); bool mf_ug_fm_svc_wapper_is_root_path(void *data); GString *mf_ug_fm_svc_wapper_get_file_name(GString *path); @@ -37,5 +40,10 @@ gint mf_ug_fm_svc_wapper_get_folder_foldersystem(GString *path, bool *result); GString *mf_ug_fm_svc_wrapper_get_file_parent_path(GString *fullpath); char *mf_ug_fm_svc_wapper_path_info_get(char *original_path); char *mf_ug_fm_svc_path_info_translate(char *path_info, int path_info_max_len); +unsigned long mf_ug_fm_svc_wrapper_get_free_space(int state); +int mf_ug_fm_svc_wrapper_file_auto_rename(void *data, GString *fullpath, int file_name_type, GString **filename); +int mf_ug_fm_svc_wrapper_create_service(void *data, GString *fullpath); +bool mf_ug_fm_svc_wrapper_detect_duplication(GString *to); +int mf_ug_fm_svc_wrapper_create_p(const char *fullpath); #endif diff --git a/src/include/mf-ug-fs-util.h b/src/include/mf-ug-fs-util.h index 1e3e08f..b754d65 100755..100644 --- a/src/include/mf-ug-fs-util.h +++ b/src/include/mf-ug-fs-util.h @@ -1,23 +1,24 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ - - #ifndef __DEF_MF_UG_FS_UTIL_H_ #define __DEF_MF_UG_FS_UTIL_H_ @@ -34,8 +35,9 @@ #include <Eina.h> #include <Elementary.h> -#include <visual-svc.h> -#include <media-svc.h> +#include <drm_client.h> +#include <drm_client_types.h> +#include <media_content.h> #include "mf-ug-dlog.h" @@ -50,6 +52,7 @@ /* File system related String definition */ #define PHONE_FOLDER "/opt/media" #define MEMORY_FOLDER "/opt/storage/sdcard" +#define SOUNDS_FOLDER "/opt/media/Sounds" #define DEBUG_FOLDER "SLP_debug" #define MYFILE_NAME_PATTERN "[\\:;*\"<>|?/]" @@ -82,38 +85,41 @@ #endif #ifndef UG_DEFAULT_ICON -#define UG_DEFAULT_ICON UG_ICON_PATH"/60_myfiles_file_etc.png" +#define UG_DEFAULT_ICON UG_ICON_PATH"/myfile_icon_etc.png" #endif -#define UG_ICON_FOLDER UG_ICON_PATH"/47_myfiles_icon_folder.png" -#define UG_ICON_IMAGE UG_ICON_PATH"/60_myfiles_icon_images.png" -#define UG_ICON_VIDEO UG_ICON_PATH"/47_myfiles_icon_video.png" -#define UG_ICON_MUSIC UG_ICON_PATH"/47_myfiles_icon_music.png" -#define UG_ICON_SOUND UG_ICON_PATH"/60_myfiles_icon_music_default.png" -#define UG_ICON_PDF UG_ICON_PATH"/47_myfiles_icon_pdf.png" -#define UG_ICON_DOC UG_ICON_PATH"/47_myfiles_icon_word.png" -#define UG_ICON_PPT UG_ICON_PATH"/47_myfiles_icon_ppt.png" -#define UG_ICON_EXCEL UG_ICON_PATH"/47_myfiles_icon_excel.png" -#define UG_ICON_VOICE UG_ICON_PATH"/60_myfiles_file_amr.png" -#define UG_ICON_HTML UG_ICON_PATH"/47_myfiles_icon_html.png" -#define UG_ICON_FLASH UG_ICON_PATH"/47_myfiles_icon_swf.png" -#define UG_ICON_TXT UG_ICON_PATH"/47_myfiles_icon_text.png" -#define UG_ICON_VCONTACT UG_ICON_PATH"/60_myfiles_icon_vcard.png" -#define UG_ICON_VCALENDAR UG_ICON_PATH"/60_myfiles_icon_vcalender.png" -#define UG_ICON_VNOTE UG_ICON_PATH"/60_myfiles_icon_vText.png" -#define UG_ICON_RSS UG_ICON_PATH"/47_myfiles_icon_rss.png" -#define UG_ICON_JAVA UG_ICON_PATH"/60_myfiles_icon_java.png" -#define UG_ICON_MEMORY_SUB UG_ICON_PATH"/60_myfiles_memorycard_sub.png" -#define UG_ICON_MUSIC_PLAY UG_ICON_PATH"/34_control_play.png" -#define UG_ICON_MUSIC_PAUSE UG_ICON_PATH"/34_control_pause.png" -#define UG_ICON_MUSIC_PLAY_WHITE UG_ICON_PATH"/47_myfiles_icon_play_focus.png" -#define UG_ICON_MUSIC_PAUSE_WHITE UG_ICON_PATH"/47_myfiles_icon_pause_focus.png" -#define UG_ICON_UPPER UG_ICON_PATH"/47_myfiles_icon_upper_folder_white_theme.png" - -#define UG_ICON_FOLDER_CREATED UG_ICON_PATH"/47_myfiles_icon_folder_created.png" -#define UG_ICON_FOLDER_SINCED UG_ICON_PATH"/47_myfiles_icon_folder_sinced.png" -#define UG_ICON_PHONE UG_ICON_PATH"/60_myfiles_phone.png" -#define UG_ICON_MEMORY UG_ICON_PATH"/60_myfiles_memorycard.png" +#define UG_ICON_FOLDER UG_ICON_PATH"/myfile_icon_folder.png" +#define UG_ICON_FOLDER_OPEN UG_ICON_PATH"/myfile_icon_folder_open.png" + +#define UG_ICON_IMAGE UG_ICON_PATH"/myfile_icon_images.png" +#define UG_ICON_VIDEO UG_ICON_PATH"/myfile_icon_video.png" +#define UG_ICON_MUSIC UG_ICON_PATH"/myfile_icon_music.png" +#define UG_ICON_SOUND UG_ICON_PATH"/myfile_icon_music.png" +#define UG_ICON_PDF UG_ICON_PATH"/myfile_icon_pdf.png" +#define UG_ICON_DOC UG_ICON_PATH"/myfile_icon_word.png" +#define UG_ICON_PPT UG_ICON_PATH"/myfile_icon_ppt.png" +#define UG_ICON_EXCEL UG_ICON_PATH"/myfile_icon_excel.png" +#define UG_ICON_VOICE UG_ICON_PATH"/myfile_icon_music.png" +#define UG_ICON_HTML UG_ICON_PATH"/myfile_icon_html.png" +#define UG_ICON_FLASH UG_ICON_PATH"/myfile_icon_swf.png" +#define UG_ICON_TXT UG_ICON_PATH"/myfile_icon_text.png" +#define UG_ICON_VCONTACT UG_ICON_PATH"/myfile_icon_svg.png" +#define UG_ICON_VCALENDAR UG_ICON_PATH"/myfile_icon_svg.png" +#define UG_ICON_VNOTE UG_ICON_PATH"/myfile_icon_text.png" +#define UG_ICON_RSS UG_ICON_PATH"/myfile_icon_rss.png" +#define UG_ICON_JAVA UG_ICON_PATH"/myfile_icon_java.png" +#define UG_ICON_MEMORY_SUB UG_ICON_PATH"/myfile_icon_mmc_sub.png" +#define UG_ICON_MUSIC_PLAY UG_ICON_PATH"/myfile_icon_control_play.png" +#define UG_ICON_MUSIC_PAUSE UG_ICON_PATH"/myfile_icon_control_pause.png" +#define UG_ICON_MUSIC_PLAY_WHITE UG_ICON_PATH"/myfile_icon_play_focus.png" +#define UG_ICON_MUSIC_PAUSE_WHITE UG_ICON_PATH"/myfile_icon_pause_focus.png" + +#define UG_ICON_BLACK_THEME_UPPER UG_ICON_PATH"/myfile_icon_upper_folder_black_theme.png" +#define UG_ICON_WHITE_THEME_UPPER UG_ICON_PATH"/myfile_icon_upper_folder_white_theme.png" + +#define UG_ICON_PHONE UG_ICON_PATH"/myfile_icon_phone.png" +#define UG_ICON_MEMORY UG_ICON_PATH"/myfile_icon_mmc.png" +#define UG_ICON_VIDEO_PLAY UG_ICON_PATH"/myfile_icon_video_play.png" typedef enum _mf_ug_fs_file_type mf_ug_fs_file_type; @@ -148,6 +154,7 @@ enum _mf_ug_fs_file_type { UG_FILE_TYPE_CERTIFICATION, /**< certification file, *.pem */ UG_FILE_TYPE_JAVA, /**< java file, *.jad, *.jar */ UG_FILE_TYPE_WGT, /**< wrt , *.wgt, *.wgt */ + UG_FILE_TYPE_DRM, /**< drm file , *.dcf */ UG_FILE_TYPE_ETC, /**< Other files category */ UG_FILE_TYPE_MAX }; @@ -181,6 +188,15 @@ enum _mf_ug_iter_category_filter_t { }; +typedef enum _mf_ug_drm_filter mf_ug_drm_filter; +enum _mf_ug_drm_filter { + MF_UG_FILTER_DRM_NONE = 0x00000000, /**< Default */ + MF_UG_FILTER_DRM_ALL = 0x00000001, + MF_UG_FILTER_DRM_WITHOUT_FL = 0x00000002, + MF_UG_FILTER_DRM_IMAGE = 0x00000004, + MF_UG_FILTER_DRM_RINGTONE = 0x00000008, +}; + typedef enum _mf_ug_storage_type mf_ug_storage_type; enum _mf_ug_storage_type { MF_UG_NONE, @@ -190,10 +206,46 @@ enum _mf_ug_storage_type { }; + +typedef enum _mf_ug_drm_file_mime_type mf_ug_drm_file_mime_type; +enum _mf_ug_drm_file_mime_type { + MF_UG_DRM_UNKNOW_FILE = 0, + MF_UG_DRM_IMAGE_FILE, + MF_UG_DRM_RINGTONE_FILE, + MF_UG_DRM_VIDEO_FILE, + MF_UG_DRM_FILE_MAX +}; + +typedef enum _mf_ug_sort_option mf_ug_sort_option; + +enum _mf_ug_sort_option { + MF_UG_SORT_BY_NONE = 0, /**< Sort by default */ + MF_UG_SORT_BY_NAME_A2Z, /**< Sort by file name ascending */ + MF_UG_SORT_BY_SIZE_S2L, /**< Sort by file size ascending */ + MF_UG_SORT_BY_DATE_O2R, /**< Sort by file date ascending */ + MF_UG_SORT_BY_TYPE_A2Z, /**< Sort by file type ascending */ + MF_UG_SORT_BY_NAME_Z2A, /**< Sort by file name descending */ + MF_UG_SORT_BY_SIZE_L2S, /**< Sort by file size descending */ + MF_UG_SORT_BY_DATE_R2O, /**< Sort by file date descending */ + MF_UG_SORT_BY_TYPE_Z2A, /**< Sort by file type descending */ + MF_UG_SORT_BY_MAX +} ; + +typedef enum __MF_UG_SORT_BY_PRIORITY_SEQUENCE MF_UG_SORT_BY_PRIORITY_SEQUENCE; +enum __MF_UG_SORT_BY_PRIORITY_SEQUENCE { + MF_UG_SORT_BY_PRIORITY_TYPE_A2Z, + MF_UG_SORT_BY_PRIORITY_TYPE_Z2A, + MF_UG_SORT_BY_PRIORITY_DATE_O2R, + MF_UG_SORT_BY_PRIORITY_DATE_R2O, + MF_UG_SORT_BY_PRIORITY_SIZE_S2L, + MF_UG_SORT_BY_PRIORITY_SIZE_L2S, +}; + /* File operation error check options definition */ #define MF_ERROR_CHECK_SRC_ARG_VALID 0x0001 #define MF_ERROR_CHECK_SRC_EXIST 0x0002 #define MF_ERROR_CHECK_SRC_PATH_VALID 0x0004 +#define MF_ERROR_CHECK_DUPLICATED 0x0008 /* File system error definition */ #define MF_ERROR_MASKL16 0xFFFF @@ -211,6 +263,7 @@ enum _mf_ug_storage_type { #define MYFILE_ERR_INVALID_DIR_PATH (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x04)) /**< exception of invalid dir path */ #define MYFILE_ERR_INVALID_FILE_NAME (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x05)) /**< exception of invalid file name */ #define MYFILE_ERR_INVALID_FILE_PATH (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x06)) /**< exception of invalid file path */ +#define MYFILE_ERR_DRM_PERMISSION_DENY (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x07)) /**< can't copy/move drm file because of permission */ #define MYFILE_ERR_SRC_NOT_EXIST (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x08)) /**< source not found */ #define MYFILE_ERR_STORAGE_TYPE_ERROR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x09)) /**< storage type error */ #define MYFILE_ERR_EXT_GET_ERROR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x0a)) /**< get ext type failed */ @@ -223,6 +276,14 @@ enum _mf_ug_storage_type { #define MYFILE_ERR_INVALID_PATH (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x11)) /**< invalid path string */ #define MYFILE_ERR_GET_THUMBNAIL_FAILED (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x12)) /**<get thumbnail failed */ #define MYFILE_ERR_UNKNOW_ERROR (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x13)) /**<unknow error */ +#define MYFILE_ERR_NO_FREE_SPACE (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x14)) /**< get free space failed */ +#define MYFILE_ERR_DUPLICATED_NAME (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x15)) /**< exception of duplicated dir name*/ +#define MYFILE_ERR_ALLOCATE_MEMORY_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x16)) /**< exception of memory allocation */ +#define MYFILE_ERR_GET_LOGIC_PATH_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x17)) /**< get logical path failed */ +#define MYFILE_ERR_GENERATE_NAME_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x18)) /**< generate name failed */ +#define MYFILE_ERR_DIR_CREATE_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x19)) /**< exception of create dir */ +#define MYFILE_ERR_GET_PARENT_PATH_FAIL (MID_CONTENTS_MGR_ERROR - MF_ERROR_SET(0x1a)) /**< get parent path failed */ + /* File system related callback definition */ typedef struct _ugFsNodeInfo ugFsNodeInfo; @@ -231,7 +292,7 @@ struct _ugFsNodeInfo { char name[MYFILE_FILE_NAME_LEN_MAX]; time_t date; mf_ug_fs_file_type type; - char ext[FILE_EXT_LEN_MAX]; + char *ext; unsigned int size; }; @@ -242,16 +303,23 @@ int mf_ug_file_attr_get_file_stat(const char *filename, ugFsNodeInfo ** node); int mf_ug_file_attr_get_file_category(const char *filepath, mf_ug_fs_file_type * category); int mf_ug_file_attr_is_dir(const char *filepath); int mf_ug_file_attr_get_store_type_by_full(const char *filepath, mf_ug_storage_type * store_type); -int mf_ug_file_attr_get_file_ext(const char *filepath, char *file_ext); +int mf_ug_file_attr_is_drm_file(const char *file_fullpath); +int mf_ug_file_attr_get_file_ext(const char *filepath, char **file_ext); int mf_ug_file_attr_is_right_dir_path(const char *dir_path); int mf_ug_file_attr_is_right_file_path(const char *file_path); +int mf_ug_file_attr_is_duplicated_name(const char *dir, const char *name); +int mf_ug_file_attr_get_logical_path_by_full(const char *full_path, char **path); +int mf_ug_file_attr_is_valid_name(const char *filename); /********** File Operation Related **********/ int mf_ug_fs_oper_read_dir(const char *path, Eina_List **dir_list, Eina_List **file_list); -int mf_ug_fs_oper_list_filter(Eina_List *in_list, Eina_List **out_list, int option); +int mf_ug_fs_oper_list_filter(Eina_List *in_list, Eina_List **out_list, int option, int drm_opt); int mf_ug_fs_oper_list_filter_by_extension(Eina_List *in_list, Eina_List **out_list, char *ext); -char *mf_ug_file_attr_get_file_icon(MediaSvcHandle *handle, const char *file_path, int *error_code); +char *mf_ug_file_attr_get_file_icon(const char *file_path, int *error_code); +mf_ug_drm_file_mime_type mf_ug_fs_oper_get_drm_type(char *path); int mf_ug_file_attr_is_system_dir(char *fullpath, bool * result); mf_ug_fs_file_type mf_ug_file_attr_get_file_type_by_mime(const char *file_path); +int mf_ug_fs_oper_create_dir(const char *dir); +void mf_ug_fs_oper_sort_list(Eina_List **list, int sort_opt); #endif diff --git a/src/include/mf-ug-inotify-handle.h b/src/include/mf-ug-inotify-handle.h index bd1627e..c01dd06 100755..100644 --- a/src/include/mf-ug-inotify-handle.h +++ b/src/include/mf-ug-inotify-handle.h @@ -1,23 +1,25 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ - #ifndef __DEF_MF_UG_INOTIFY_HANDLE_H #define __DEF_MF_UG_INOTIFY_HANDLE_H diff --git a/src/include/mf-ug-list-play.h b/src/include/mf-ug-list-play.h new file mode 100644 index 0000000..806089c --- /dev/null +++ b/src/include/mf-ug-list-play.h @@ -0,0 +1,41 @@ +#ifndef __MF_UG_LIST_PLAY_H +#define __MF_UG_LIST_PLAY_H + +#include <player.h> + +typedef enum { + MF_PLAYER_CB_TYPE_STARTED, + MF_PLAYER_CB_TYPE_PAUSED, + MF_PLAYER_CB_TYPE_COMPLETED, + MF_PLAYER_CB_TYPE_INTURRUPTED, + MF_PLAYER_CB_TYPE_ERROR, + MF_PLAYER_CB_TYPE_BUFFERING, + MF_PLAYER_CB_TYPE_NUM, +} mf_player_cb_type; + +typedef struct __mf_player_cbs mf_player_cbs; +struct __mf_player_cbs{ + /* player callbacks */ + player_started_cb started_cb; + player_paused_cb paused_cb; + player_completed_cb completed_cb; + player_interrupted_cb interrupted_cb; + player_error_cb error_cb; + player_buffering_cb buffering_cb; + + /* callback user data */ + void *user_data[MF_PLAYER_CB_TYPE_NUM]; +}; + + +typedef struct { + mf_player_cb_type cb_type; + + union { + player_interrupted_code_e interrupted_code; + int error_code; + int percent; + } param; +} mf_player_cb_extra_data; + +#endif diff --git a/src/include/mf-ug-main.h b/src/include/mf-ug-main.h index d2fbd08..1bd1237 100755..100644 --- a/src/include/mf-ug-main.h +++ b/src/include/mf-ug-main.h @@ -1,23 +1,25 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
#ifndef __DEF_MF_UG_MAIN_H_
#define __DEF_MF_UG_MAIN_H_
@@ -28,16 +30,20 @@ #include <glib.h>
#include <Ecore.h>
#include <glib-object.h>
-#include <mm_player.h>
#include <ui-gadget-module.h>
#include <ui-gadget.h>
-#include <bundle.h>
+#include <app.h>
#include <stdbool.h>
-#include <visual-svc.h>
-#include <media-svc.h>
+#include <drm_client.h>
+#include <drm_client_types.h>
+#include <media_content.h>
+#include <player.h>
+
+
#include "mf-ug-dlog.h"
#include "mf-ug-conf.h"
+#include "mf-ug-search.h"
/*********** Global Definitions ***********/
#ifndef UG_MODULE_API
#define UG_MODULE_API __attribute__ ((visibility("default")))
@@ -48,15 +54,6 @@ typedef void (*ugCallBack) (void *, Evas_Object *, void *); typedef struct _ugNaviBar ugNaviBar;
struct _ugNaviBar {
- Evas_Object *ug_pNaviBar;
- Evas_Object *ug_pNaviBox;
- Evas_Object *ug_pNaviLayout;
- Evas_Object *ug_pContent;
- Evas_Object *ug_pNaviCtrlBar;
- Evas_Object *ug_pCtrlBarButton[3];
-
- Elm_Object_Item *ug_pPreNaviItem;
- Elm_Object_Item *ug_pNaviItem;
char *ug_pNaviLabel;
char *ug_pNaviTitle;
char *ug_pCurrentPath;
@@ -76,6 +73,17 @@ struct _ugMainWindow { Evas_Object *ug_pRadioGroup;
Evas_Object *ug_pTabBar;
Evas_Object *ug_pTabLayout;
+
+ Evas_Object *ug_pNaviBar;
+ Evas_Object *ug_pNaviLayout;
+ Evas_Object *ug_pContent;
+ Evas_Object *ug_pNaviCtrlBar;
+
+ Evas_Object *ug_pEditField;
+ Evas_Object *ug_pEntry;
+
+ Elm_Object_Item *ug_pPreNaviItem;
+ Elm_Object_Item *ug_pNaviItem;
Eina_List *ug_pNaviBarList;
};
@@ -88,6 +96,10 @@ struct _ugStatus { int ug_iRadioOn;
int ug_iMmcFlag;
int ug_iCtrlBarType;
+ int ug_iRadioValue; /** current the radio box selected item value **/
+ int ug_iSelectedSortType;
+ int ug_iMore;
+ int ug_haptic_handle;
bool ug_bAudioPlayFlag;
bool ug_bInstallFlag;
bool ug_bSettingEntry;
@@ -96,6 +108,7 @@ struct _ugStatus { bool ug_bNoContentFlag;
bool ug_bCancelDisableFlag;
bool ug_b_NaviPushFlag;
+ int ug_iThemeType;
char *ug_pUpper_folder;
bool ug_bUpperFlag;
Elm_Genlist_Item_Class ug_itc;
@@ -106,10 +119,18 @@ struct _ugStatus { Elm_Genlist_Item_Class ug_editfileditc;
Elm_Genlist_Item_Class ug_editfiledUpperSeperatoritc;
Elm_Genlist_Item_Class ug_editfiledBottomSeperatoritc;
+ Elm_Genlist_Item_Class ug_newfolderitec;
+ Elm_Genlist_Item_Class ug_pathinfoitec;
#ifdef UG_THUMB_REAL_TIME_UPDATE
Ecore_Timer *ug_pThumbUpdateTimer;
#endif
- MediaSvcHandle *ug_pMedia_svc_handle;
+ Evas_Object *ug_pRadioGroup;
+ mf_search_handle search_handler;
+
+ Eina_List *search_result_list;
+ Ecore_Timer *vibration_timer;
+ Ecore_Timer *callback_timer;
+ const char *callback_label;
};
@@ -118,19 +139,36 @@ struct _ugUiGadget { int ug_iFilterMode;
int ug_iSelectMode;
int ug_iMarkedMode;
+ int ug_iDrmFilterMode;
+ int ug_iImportMode;
unsigned long ug_iFileFilter;
+ int ug_iDrmFilter;
char *ug_pExtension;
Eina_List *ug_pDirList;
Eina_List *ug_pFilterList;
Eina_List *ug_pMultiSelectFileList;
Ecore_Pipe *ug_pInotifyPipe;
+ Ecore_Pipe *ug_pSyncPipe;
};
+typedef struct _ugDrmInfo ugDrmInfo;
+struct _ugDrmInfo {
+ int version;
+ int constraint_type;
+ char validity[DRM_MESSAGE_LEN];
+ char description[DRM_MESSAGE_LEN];
+ bool forward;
+};
+
+
typedef struct _ugListPlay ugListPlay;
struct _ugListPlay {
char *ug_pPlayFilePath;
- MMHandleType ug_Player;
+ player_h ug_Player;
int ug_iPlayState;
+ bool ug_bDrmContentCanPlay;
+ bool ug_bDrmconsumption;
+ ugDrmInfo ug_DrmInfo;
};
@@ -140,8 +178,10 @@ struct _ugData { ugStatus ug_Status;
ugUiGadget ug_UiGadget;
ugListPlay ug_ListPlay;
- struct ui_gadget *ug;
+ ui_gadget_h ug;
};
+Evas_Object *mf_ug_main_tab_layout_create(Evas_Object *parent);
+Evas_Object *mf_ug_main_create_bg(Evas_Object *win);
#endif /* __DEF_MYFILE_H_ */
diff --git a/src/include/mf-ug-resource.h b/src/include/mf-ug-resource.h index 3e9296f..c888e62 100755..100644 --- a/src/include/mf-ug-resource.h +++ b/src/include/mf-ug-resource.h @@ -1,22 +1,24 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ - #ifndef __DEF_MF_UG_RESOURCE_H_ #define __DEF_MF_UG_RESOURCE_H_ @@ -36,6 +38,35 @@ #define MF_UG_LABEL_OK dgettext("sys_string", "IDS_COM_SK_OK") #define MF_UG_LABEL_HOME dgettext(UGPACKAGE, "IDS_MF_BUTTON_HOME") #define MF_UG_LABEL_UPPER dgettext(UGPACKAGE, "IDS_MF_TAB_UP") +#define MF_UG_LABEL_UNABLE_TO_PLAY_DURING_CALL "Unable to play during call" +#define MF_UG_LABEL_UNABLE_TO_PLAY_ERROR_OCCURRED "Unable to play. Error occurred" +#define MF_UG_LABEL_LIST_BY dgettext(UGPACKAGE, "IDS_MF_OPT_LIST_BY") +#define MF_UG_LABEL_DATE dgettext("sys_string", "IDS_COM_POP_DATE") +#define MF_UG_LABEL_SIZE dgettext("sys_string", "IDS_COM_POP_SIZE") +#define MF_UG_LABEL_TYPE dgettext("sys_string", "IDS_COM_POP_TYPE") +#define MF_UG_LABEL_NAME dgettext("sys_string", "IDS_COM_POP_NAME") +#define MF_UG_LABEL_ASCENDING dgettext(UGPACKAGE, "IDS_MF_POP_ASCENDING") +#define MF_UG_LABEL_DESCENDING dgettext(UGPACKAGE, "IDS_MF_POP_DESCENDING") +#define MF_UG_LABEL_SEARCH dgettext("sys_string", "IDS_COM_BODY_SEARCH") +#define MF_UG_LABEL_CANCEL dgettext("sys_string", "IDS_COM_SK_CANCEL") +#define MF_UG_LABEL_NO_RESULT ("No search result") +#define MF_UG_LABEL_IMPORT dgettext("sys_string", "IDS_COM_OPT_IMPORT") +#define MF_UG_LABEL_EXPORT "Export" +#define MF_UG_LABEL_CREATE dgettext("sys_string", "IDS_COM_BODY_CREATE_FOLDER") +#define MF_UG_LABEL_NOT_ENOUGH_SPACE "Space is not enough" +#define MF_UG_LABEL_FOLDER dgettext("sys_string", "IDS_COM_POP_FOLDER") +#define MF_UG_LABEL_SAVE dgettext("sys_string", "IDS_COM_SK_SAVE") +#define MF_UG_LABEL_GET_NAME_FAILED "Get name failed. try again!" +#define MF_UG_LABEL_YES dgettext("sys_string", "IDS_COM_SK_YES") +#define MF_UG_LABEL_NO dgettext("sys_string", "IDS_COM_SK_NO") +#define MF_UG_LABEL_MEMORY_NOT_ENOUGH dgettext(UGPACKAGE, "IDS_MF_POP_NOT_ENOUGH_HEAP_MEMORY") +#define MF_UG_LABEL_NAME_INVALID ("Invalid name, retry!") +#define MF_UG_LABEL_ILLEGAL_CHAR "Name contains illegal character, Retry!" +#define MF_UG_LABEL_PATH_REACH_MAX_LEN "Full path length should be less than 4096,Retry!" +#define MF_UG_LABEL_DUP_NAME "Duplicated name, retry!" +#define MF_UG_LABEL_OPER_READ_ONLY "Operation failed: Read Only Area" +#define MF_UG_LABEL_CREATE_DIR_FAILED "Create Directory failed" +#define MF_UG_LABEL_EMPTY_FOLDER_NAME "Folder name can't be empty, Retry!" #endif diff --git a/src/include/mf-ug-search-internal.h b/src/include/mf-ug-search-internal.h new file mode 100644 index 0000000..a8027d1 --- /dev/null +++ b/src/include/mf-ug-search-internal.h @@ -0,0 +1,75 @@ +/* + * myfile + * + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + + + + +#ifndef _MF_SEARCH_INTERNAL_H_ +#define _MF_SEARCH_INTERNAL_H_ + +#include "mf-ug-search.h" + +#ifdef MS_USE_DEF_LOG + +#include "mf-ug-dlog.h" + +#define ms_debug(fmt , args...) ug_debug +#define ms_info(fmt , args...) ug_debug +#define ms_warn(fmt , args...) ug_debug +#define ms_error(fmt , args...) ug_debug +#define ms_assert(fmt , args...) ug_debug + +#else + + +#ifdef DEBUG_ON +#define ms_debug(fmt , args...) do { printf("[%10s:%4d][D] "fmt"\n", __func__, __LINE__, ##args); } while (0) +#define ms_info(fmt , args...) do { printf("[%10s:%4d][I] "fmt"\n", __func__, __LINE__, ##args); } while (0) +#define ms_warn(fmt , args...) do { printf("[%10s:%4d][W] "fmt"\n", __func__, __LINE__, ##args); } while (0) +#define ms_error(fmt , args...) do { printf("[%10s:%4d][E] "fmt"\n", __func__, __LINE__, ##args); } while (0) +#define ms_assert(fmt , args...) do { printf("[%10s:%4d][A] "fmt"\n", __func__, __LINE__, ##args); } while (0) +#else +#define ms_debug(fmt , args...) do { (void)0; } while (0) +#define ms_info(fmt , args...) do { (void)0; } while (0) +#define ms_warn(fmt , args...) do { (void)0; } while (0) +#define ms_error(fmt , args...) do { (void)0; } while (0) +#define ms_assert(fmt , args...) do { (void)0; } while (0) +#endif +#endif + +/** + * Enumerations of search state + **/ + +int _mf_ug_search_init(ms_handle_t **handle); +int _mf_ug_search_start(ms_handle_t *handle, const char **root_path, unsigned int path_num, const char *needle, mf_search_option option, + void *user_data); +int _mf_ug_search_stop(ms_handle_t *handle); +void _mf_ug_search_finalize(ms_handle_t **handle); + +/*+++++++++++++++++++++++++ UTIL APIs ++++++++++++++++++++++++++++++ */ + +gchar *_mf_ug_search_result_dir_get(mf_search_result_t *result); +gchar *_mf_ug_search_result_file_get(mf_search_result_t *result); +gboolean _mf_ug_search_result_is_end(mf_search_result_t *result); +gchar *_mf_ug_search_result_current_dir_get(mf_search_result_t *result); +guint _mf_ug_search_result_total_count_get(mf_search_result_t *result); + +#endif diff --git a/src/include/mf-ug-search.h b/src/include/mf-ug-search.h new file mode 100644 index 0000000..9b4eeff --- /dev/null +++ b/src/include/mf-ug-search.h @@ -0,0 +1,218 @@ +/* + * myfile + * + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + + + + +#ifndef _MF_SEARCH_H_ +#define _MF_SEARCH_H_ + +/*+++++++++++++++++++++++ Definitions and Types +++++++++++++++++++++++*/ + +/** + * Handle type for mf_search + **/ +typedef unsigned int mf_search_handle; + +/** + * Handle type for search result + **/ +typedef unsigned int mf_search_result; + +/** + * Enumerations of search option + **/ + +typedef enum _mf_search_option mf_search_option; + +enum _mf_search_option { + MF_SEARCH_OPT_NONE = (1 << 0), + MF_SEARCH_OPT_HIDDEN = (1 << 1), + MF_SEARCH_OPT_DIR = (1 << 2), + MF_SEARCH_OPT_FILE = (1 << 3), + MF_SEARCH_OPT_EXT = (1 << 4), +}; + +typedef enum _mf_search_pipe_msg_type mf_search_pipe_msg_type; +enum _mf_search_pipe_msg_type { + MF_SEARCH_PIPE_MSG_NONE = 0, + MF_SEARCH_PIPE_MSG_ROOT_CHANGE, + MF_SEARCH_PIPE_MSG_RESULT_REPORT, + MF_SEARCH_PIPE_MSG_FINISHED, + MF_SEARCH_PIPE_MSG_MAX, +}; + +typedef enum _mf_search_state mf_search_state; +enum _mf_search_state { + MF_SEARCH_STATE_NONE = 0, + MF_SEARCH_STATE_INIT, + MF_SEARCH_STATE_SEARCH, + MF_SEARCH_STATE_MAX, +}; + +typedef struct _mf_search_result_t mf_search_result_t; +struct _mf_search_result_t { + GList *dir_list; + GList *file_list; + gchar *current_dir; + guint total_count; + gboolean is_end; +}; + +typedef struct _ms_args_t ms_args_t; +struct _ms_args_t { + GList *root_path; + gchar *needle; + mf_search_option option; + void *user_data; +} ; + +typedef struct _ms_handle_t ms_handle_t; +struct _ms_handle_t { + mf_search_state state; + GMutex *cmd_lock; + ms_args_t *args; + + GThread *thread_h; + GMutex *thread_mutex; + /* critical section */ + gboolean is_stop; + mf_search_result_t *result; + /* critical section */ +}; + +typedef struct _mf_search_pipe_msg mf_search_pipe_msg; +struct _mf_search_pipe_msg { + mf_search_pipe_msg_type mf_sp_msg_type; + void *report_result; + gchar *current_path; +}; + +/** + * mf_Search_Cb: + * @result: the handle of result, use util APIs to get detail result with this handle. + * @user_data: user data specified when installing the function, in mf_ug_search_start() + **/ +typedef void (*mf_Search_Cb) (mf_search_pipe_msg_type type, mf_search_result result, void *user_data); + +/** + * Definition of error code + **/ +#define MF_SEARCH_ERROR_NONE (0) +#define MF_SEARCH_ERROR_INTERNAL (-(1)) /* Internal error */ +#define MF_SEARCH_ERROR_INVAL_P (-(2)) /* Invalid params */ +#define MF_SEARCH_ERROR_INVAL_S (-(3)) /* Invalid status */ +#define MF_SEARCH_ERROR_ALLOC (-(4)) /* Memory allocation failed */ +#define MF_SEARCH_ERROR_FS (-(5)) /* File system error */ + +/*+++++++++++++++++++++++ APIs +++++++++++++++++++++++*/ + +/** + * mf_ug_search_init: + * @handle: the handle of mf_search + * Creates a new @handle for search. If success, + * #mf_search state is changed from MF_SEARCH_STATE_NONE to MF_SEARCH_STATE_INIT + * Return value: This function returns zero on success, or negative value. + **/ +int mf_ug_search_init(mf_search_handle *handle); + +/** + * mf_ug_search_start: + * @handle: the handle of mf_search + * @root_path: array of the root path for search + * @path_num: the number of the root path for search + * @needle: the key string for search + * @option : bitfield of mf_search_option flags + * @user_data: user data + * Start searching in given @root_path with @needle, + * every each idle time, @callback will be called with #mf_search_result_t and @user_data. + * If success, #mf_search state is changed from MF_SEARCH_STATE_INIT to MF_SEARCH_STATE_SEARCH + * Return value: This function returns zero on success, or negative value. + **/ +int mf_ug_search_start(mf_search_handle handle, const char **root_path, unsigned int path_num, const char *needle, mf_search_option option, + void *user_data); +/** + * mf_ug_search_stop: + * @handle: the handle of mf_search + * Stops search + * If success, #mf_search state is changed from MF_SEARCH_STATE_SEARCH to MF_SEARCH_STATE_INIT + * Return value: This function returns zero on success, or negative value. + **/ +int mf_ug_search_stop(mf_search_handle handle); + +/** + * mf_ug_search_stop: + * @handle: the handle of mf_search + * Finalizes search @handle + * #mf_search state is changed from MF_SEARCH_STATE_INIT to MF_SEARCH_STATE_NONE + **/ +void mf_ug_search_finalize(mf_search_handle *handle); + + +/*+++++++++++++++++++++++ UTIL APIs +++++++++++++++++++++++*/ + +/** + * mf_ug_search_result_dir_get: + * @result: the handle of search result + * Gets one of directory name in given search @result + * Return value: a directory name which is a newly-allocated string that must be freed after use + * or NULL if no more result for directory. + **/ +char *mf_ug_search_result_dir_get(mf_search_result_t *result); + +/** + * mf_ug_search_result_file_get: + * @result: the handle of search result + * Gets one of file name given search @result + * Return value: a file name which is a newly-allocated string that must be freed after use + * or NULL if no more result for directory. + **/ +char *mf_ug_search_result_file_get(mf_search_result_t *result); + +/** + * mf_ug_search_result_current_dir_get: + * @result: the handle of search result + * Gets current searching directory name in given search @result + * Return value: current searching directory name which is a newly-allocated string that must be freed after use + * or NULL if fail to get current searching directory name. + **/ +char *mf_ug_search_result_current_dir_get(mf_search_result_t *result); + +/** + * mf_ug_search_result_is_end: + * @result: the handle of search result + * @is_end : If @result is last result handle, set it to a non-zero value, if not set it to zero. + * Tests if given search @result is the last one or not + * Return value: This function returns zero on success, or negative value. + **/ +int mf_ug_search_result_is_end(mf_search_result_t *result, int *is_end); + +/** + * mf_ug_search_result_total_count_get: + * @result: the handle of search result + * @count: the items(which is explored directories and files) count. + * Gets current explored items(this is not result count) + * Return value: This function returns zero on success, or negative value. + **/ +int mf_ug_search_result_total_count_get(mf_search_result_t *result, unsigned int *count); + +void mf_ug_search_view_item_append(void *data, void *user_data); + +#endif diff --git a/src/include/mf-ug-util.h b/src/include/mf-ug-util.h index f4a0de4..4a1cbd3 100755..100644 --- a/src/include/mf-ug-util.h +++ b/src/include/mf-ug-util.h @@ -1,23 +1,25 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ - #ifndef __DEF_MF_UG_UTIL_H_ #define __DEF_MF_UG_UTIL_H_ @@ -69,6 +71,23 @@ } \ } while (0) +#define UG_SAFE_STRCPY(dest, src) \ + do{if(!dest||!src)break;\ + strncpy (dest , src, sizeof(dest)-1);\ + dest[sizeof(dest)-1] = 0; }while(0) + +#define UG_SAFE_DEL_ECORE_TIMER(timer) do { \ + if (timer) { \ + ecore_timer_del(timer);\ + timer = NULL; \ + } \ + } while (0) + +#define goto_if(x, dest) do { \ + if (x) {\ + goto dest;\ + }\ + } while (0) typedef enum _mf_ug_list_play_state mf_ug_list_play_state; enum _mf_ug_list_play_state { @@ -88,9 +107,21 @@ enum _mf_ug_select_mode { SINGLE_ALL_MODE, MULTI_FILE_MODE, MULTI_ALL_MODE, + EXPORT_MODE, + IMPORT_MODE, SELECT_MODE_MAX }; +typedef enum _mf_ug_drm_mode mf_ug_drm_mode; +enum _mf_ug_drm_mode { + DRM_FILTER_NONE = 0, + DRM_FILTER_ALL, + DRM_FILTER_WITHOUT_FL, + DRM_FILTER_IMAGE, + DRM_FILTER_RINGTONE, + DRM_FILTER_MAX +}; + typedef enum _mf_ug_marked_switch mf_ug_marked_switch; enum _mf_ug_marked_switch { MARKED_OFF = 0, @@ -175,6 +206,30 @@ struct _ug_dir_event_t { char *name; }; +typedef enum _mf_ug_theme_type mf_ug_theme_type; +enum _mf_ug_theme_type { + UG_THEME_INVALID = -1, + UG_THEME_NBEAT = 0, + UG_THEME_NBEAT_BLACK = 1, + UG_THEME_ERROR +}; + +typedef enum _mf_ug_more_type_e mf_ug_more_type_e; + +enum _mf_ug_more_type_e{ /* softkey / contextual popup */ + UG_MORE_DEFAULT = 0, + UG_MORE_CREATE_FOLDER, + UG_MORE_SEARCH, + UG_MORE_TYPE_MAX +}; + +typedef enum _mf_ug_file_name_type_e mf_ug_file_name_type_e; +enum _mf_ug_file_name_type_e { + FILE_NAME_WITH_BRACKETS, + FILE_NAME_WITH_UNDERLINE, + FILE_NAME_NONE, +}; + bool mf_ug_util_is_mass_storage_on(); int mf_ug_util_create_dir_monitor(void *data); int mf_ug_util_set_mmc_state_cb(void *data); @@ -195,7 +250,13 @@ int mf_ug_util_add_dir_watch(const char *path, void *data); mf_ug_launch_type mf_ug_util_get_file_launch_type(char *path); void mf_ug_util_destory_mass_storage_callback(); +mf_ug_theme_type mf_ug_util_get_theme(void); int mf_ug_file_attr_get_parent_path(const char *path, char **parent_path); char *mf_ug_util_upper_folder_name_get(void *data, GString *fullpath); +void mf_ug_util_operation_alloc_failed(void *data); +int mf_ug_util_remove_dir_watch(void); +void mf_ug_util_sort_the_file_list(void *data); +bool mf_ug_util_play_vibration(void *data, float duration); +int mf_ug_util_check_disk_space(void *data); #endif /* __DEF_MYFILE_UTIL_H_ */ diff --git a/src/include/mf-ug-winset.h b/src/include/mf-ug-winset.h index cd52adf..0cbf33c 100755..100644 --- a/src/include/mf-ug-winset.h +++ b/src/include/mf-ug-winset.h @@ -1,22 +1,24 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
#ifndef __DEF_MF_UG_WINSET_H_
#define __DEF_MF_UG_WINSET_H_
@@ -29,7 +31,6 @@ #include "mf-ug-main.h"
-#include "mf-ug-cb.h"
#include "mf-ug-conf.h"
@@ -42,7 +43,6 @@ Evas_Object *mf_ug_navi_bar_create_navi_bar(Evas_Object *parent); void mf_ug_navi_bar_set_new_content(Evas_Object *pLayout, Evas_Object *NaviContent);
void mf_ug_navi_bar_create_default_view(void *data);
ugNaviBar *mf_ug_navi_bar_get_in_use_navi(void *data);
-ugNaviBar *mf_ug_navi_bar_get_navi_struct_by_navi(void *data, Evas_Object *pNaviBar);
void mf_ug_navi_bar_reset_navi_object(ugNaviBar *pNavi_s);
void mf_ug_navi_bar_refresh_navibar_recovered_view(void *data, ugNaviBar *pNaviStruct);
void mf_ug_navi_bar_remove_navi_list_item_by_label(void *data, const char *pNaviLabel);
@@ -50,6 +50,11 @@ void mf_ug_navi_bar_set_select_info_label(void *data, int dir_count, int file_co void mf_ug_navi_bar_set_blocking(void *data, bool bblock_during_transition);
void mf_ug_navi_bar_remove_previous_contents(void *data);
void mf_ug_navi_bar_del_item_directly(void *data);
+void mf_ug_navi_bar_create_new_folder_view(void *data);
+ugNaviBar *ug_mf_navi_bar_get_navi_from_navilist(Eina_List *navilist, const char *label);
+ugNaviBar *mf_ug_navi_bar_get_navi_struct_by_label(void *data, const char *pNaviLabel);
+void mf_ug_navi_bar_reset_tab_to_main(void *data);
+void mf_ug_navi_bar_set_navi_to_main(void *data);
/********** Control Bar Definition ********/
@@ -70,17 +75,23 @@ enum _eCtrlBarButtonType { void mf_ug_ctrl_bar_set(void *data, ugNaviBar *pNavi_s);
void mf_ug_ctrl_bar_disable_item(void *data, bool disable);
void mf_ug_ctrl_bar_set_item_disable(void *data);
+void mf_ug_ctrl_bar_listby_item_diable(Evas_Object *pCtrlbar, bool disable);
/**********Tab Bar Definition *************/
Evas_Object *mf_ug_tab_bar_create(Evas_Object *parent);
Elm_Object_Item *mf_ug_tab_bar_append_item(Evas_Object *pTabBar, char *pTabIconPath, char *pTabBarLabel, void *user_data);
-void mf_ug_tab_bar_set_item_view(Evas_Object *parent, Evas_Object *tab_layout, Evas_Object *view);
+void mf_ug_tab_bar_set_item_view(Evas_Object *tab_layout, Evas_Object *view);
void mf_ug_tab_bar_remove_item_by_label(Evas_Object *pTabBar, char *pTabLabel);
void mf_ug_tab_bar_remove_all_items(Evas_Object *pTabBar);
void mf_ug_tab_bar_set_selected_item(Elm_Object_Item *pItem);
void mf_ug_tab_bar_set_item_disable(Evas_Object *pTabBar, Eina_Bool disable);
void mf_ug_ctrl_bar_recover(void *data);
+Elm_Object_Item *mf_ug_tab_bar_get_item_by_label(Evas_Object *pTabBar, char *pTabLabel);
+void mf_ug_tab_bar_init(void *data);
+void mf_ug_tar_bar_disable(void *data, Eina_Bool disabled);
+int mf_ug_tab_bar_items_count_get(Evas_Object *pTabBar);
+void mf_ug_ctrl_bar_listby_item_diable(Evas_Object *pCtrlbar, bool disable);
/*********** Popup Definition ************/
@@ -95,6 +106,8 @@ enum _mf_ug_popup_mode { UG_POPMODE_TITLE_TEXT_BTN,
UG_POPMODE_TITLE_TEXT_THREE_BTN,
UG_POPMODE_PROGRESSBAR,
+ UG_POPMODE_SEARCH,
+ UG_POPMODE_LIST_BY,
UG_POPMPDE_MAX
};
@@ -113,8 +126,8 @@ enum _mf_ug_popup_event_type { };
/*********** Popup API ************/
-void mf_ug_popup_create(void *data, mf_ug_popup_mode popupMode, char *title, char *context, char *first_btn_text, char *second_btn_text,
- char *third_btn_text, Evas_Smart_Cb func, void *param);
+void mf_ug_popup_create(void *data, mf_ug_popup_mode popupMode, char *title, const char *context, const char *first_btn_text, const char *second_btn_text,
+ const char *third_btn_text, Evas_Smart_Cb func, void *param);
/******************* Genlist API *********************/
@@ -125,5 +138,8 @@ Evas_Object *mf_navi_bar_upper_create(Evas_Object *parent); void mf_ug_genlist_goto_myfile_style_set(void *data);
void mf_ug_genlist_upper_style_set(void *data);
Evas_Object *mf_ug_genlist_create_content_list_view(void *data);
+Evas_Object *__mf_ug_genlist_create_gl(void *data);
+Evas_Object *mf_ug_genlist_create_list_new_folder_style(void *data);
+Evas_Object *mf_ug_genlist_create_path_info(Evas_Object *parent, Elm_Genlist_Item_Class *itc, char *info);
#endif
diff --git a/src/mf-ug-main.c b/src/mf-ug-main.c index af80db3..a415596 100755..100644 --- a/src/mf-ug-main.c +++ b/src/mf-ug-main.c @@ -1,30 +1,31 @@ /* + * myfile + * * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); - * - * You may not use this file except in compliance with the License. + * you may not use this file except in compliance with the License. * You may obtain a copy of the License at + * * http://www.tizenopensource.org/license * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an "AS IS" BASIS, + * 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. * - * See the License for the specific language governing permissions and limitations under the License. */ - #include <stdio.h> #include <sys/time.h> #include <Elementary.h> #include <Ecore_X.h> #include <vconf.h> -#include <visual-svc.h> -#include <media-svc.h> +#include <media_content.h> #include "mf-ug-main.h" #include "mf-ug-fs-util.h" @@ -34,6 +35,7 @@ #include "mf-ug-winset.h" #include "mf-ug-fm-svc-wrapper.h" #include "mf-ug-resource.h" +#include "mf-ug-cb.h" /****************************** ** Prototype : __mf_ug_main_init_data @@ -68,10 +70,12 @@ static void __mf_ug_main_init_data(void *data) ugd->ug_Status.ug_bInstallFlag = true; ugd->ug_Status.ug_bInSettingView = false; ugd->ug_Status.ug_bSettingEntry = false; + ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT; ugd->ug_UiGadget.ug_iSelectMode = SINGLE_FILE_MODE; ugd->ug_UiGadget.ug_iFilterMode = SHOW_ALL_LIST; ugd->ug_UiGadget.ug_pExtension = NULL; + ugd->ug_UiGadget.ug_iDrmFilter = DRM_FILTER_NONE; ugd->ug_UiGadget.ug_iMarkedMode = MARKED_OFF; ugd->ug_UiGadget.ug_pMultiSelectFileList = NULL; @@ -173,11 +177,6 @@ static void __mf_ug_main_free_evas_object(void *data) for (index = 0; index < iNaviListLen; index++) { ugNaviBar *pNavi_s = NULL; pNavi_s = (ugNaviBar *)eina_list_nth(ugd->ug_MainWindow.ug_pNaviBarList, index); - evas_object_del(pNavi_s->ug_pNaviCtrlBar); - evas_object_del(pNavi_s->ug_pContent); - evas_object_del(pNavi_s->ug_pNaviLayout); - evas_object_del(pNavi_s->ug_pNaviBox); - evas_object_del(pNavi_s->ug_pNaviBar); if (pNavi_s->ug_pNaviLabel != NULL) { free(pNavi_s->ug_pNaviLabel); pNavi_s->ug_pNaviLabel = NULL; @@ -189,7 +188,6 @@ static void __mf_ug_main_free_evas_object(void *data) } if (ugd->ug_MainWindow.ug_pTabBar != NULL) { - mf_ug_tab_bar_remove_all_items(ugd->ug_MainWindow.ug_pTabBar); evas_object_del(ugd->ug_MainWindow.ug_pTabBar); ugd->ug_MainWindow.ug_pTabBar = NULL; } @@ -315,7 +313,8 @@ static int __mf_ug_main_set_path_option(void *data, const char *path) return MYFILE_ERR_ALLOCATE_FAIL; } } else if (strncmp(path, UG_SETTING_RINGTONE_PATH, strlen(UG_SETTING_RINGTONE_PATH)) == 0 - || strncmp(path, UG_SETTING_ALERTS_PATH, strlen(UG_SETTING_ALERTS_PATH)) == 0) { + || strncmp(path, UG_SETTING_ALERTS_PATH, strlen(UG_SETTING_ALERTS_PATH)) == 0 + || strncmp(path, UG_SETTING_MSG_ALERTS_PATH, strlen(UG_SETTING_MSG_ALERTS_PATH)) == 0) { /**check whether is setting ringtone or alerts path */ entry_path = strdup(path); @@ -347,9 +346,18 @@ static int __mf_ug_main_set_path_option(void *data, const char *path) } if (ecore_file_exists(entry_path) == false) { - ug_mf_debug("path is not exist"); - free(entry_path); - return MYFILE_ERR_INVALID_FILE_PATH; + + if (ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE || + ugd->ug_UiGadget.ug_iSelectMode == IMPORT_MODE) { + error_code = mf_ug_fm_svc_wrapper_create_p(entry_path); + if (error_code != MYFILE_ERR_NONE) { + free(entry_path); + return MYFILE_ERR_INVALID_FILE_PATH; + } + } else { + free(entry_path); + return MYFILE_ERR_INVALID_FILE_PATH; + } } if (ecore_file_is_dir(entry_path) == false) { ug_mf_debug("path is not a directory"); @@ -400,13 +408,13 @@ static void __mf_ug_main_set_select_mode(void *data, const char *select_mode) } else if (!strncmp(select_mode, UG_SELECT_MODE_MULTI_FILE, strlen(select_mode))) { ugd->ug_UiGadget.ug_iSelectMode = MULTI_FILE_MODE; } else if (!strncmp(select_mode, UG_SELECT_MODE_SINGLE_ALL, strlen(select_mode))) { - ugd->ug_UiGadget.ug_iSelectMode = SINGLE_ALL_MODE; - } - - else if (!strncmp(select_mode, UG_SELECT_MODE_MULTI_ALL, strlen(select_mode))) { - + } else if (!strncmp(select_mode, UG_SELECT_MODE_MULTI_ALL, strlen(select_mode))) { ugd->ug_UiGadget.ug_iSelectMode = MULTI_ALL_MODE; + } else if(!strncmp(select_mode, UG_SELECT_MODE_IMPORT, strlen(select_mode))) { + ugd->ug_UiGadget.ug_iSelectMode = IMPORT_MODE; + } else if(!strncmp(select_mode, UG_SELECT_MODE_EXPORT, strlen(select_mode))) { + ugd->ug_UiGadget.ug_iSelectMode = EXPORT_MODE; } else { ugd->ug_UiGadget.ug_iSelectMode = SINGLE_FILE_MODE; } @@ -464,6 +472,9 @@ static void __mf_ug_main_set_filter_mode(void *data, const char *file_filter) } else { ugd->ug_UiGadget.ug_iFilterMode = SHOW_BY_EXTENSION; ugd->ug_UiGadget.ug_pExtension = strdup(file_filter); + if (g_strcmp0(file_filter, "opml") == 0) { + ugd->ug_UiGadget.ug_iImportMode = 1; + } } } else { ugd->ug_UiGadget.ug_iFilterMode = SHOW_ALL_LIST; @@ -520,10 +531,10 @@ static void __mf_ug_main_set_marked_mode(void *data, const char *marked_mode) /****************************** -** Prototype : __mf_ug_main_set_option_status +** Prototype : __mf_ug_main_set_drm_filter_mode ** Description : Samsung ** Input : void *data -** bundle *option +** char *drm_filter ** Output : None ** Return Value : ** Calls : @@ -536,24 +547,71 @@ static void __mf_ug_main_set_marked_mode(void *data, const char *marked_mode) ** ******************************/ -static void __mf_ug_main_set_option_status(void *data, bundle * option) +static void __mf_ug_main_set_drm_filter_mode(void *data, const char *drm_filter) { + UG_TRACE_BEGIN; ugData *ugd = (ugData *)data; ug_mf_retm_if(ugd == NULL, "ugd is NULL"); - ug_mf_retm_if(option == NULL, "option is NULL"); - char *key[UG_OPTION_COUNT] = { "path", "select_type", "file_type", "marked_mode"}; - const char *path = NULL, *select_mode = NULL, *filter_mode = NULL, *marked_mode = NULL; + if (drm_filter != NULL) { + if (!strncmp(drm_filter, UG_DRM_FILTER_NONE, strlen(drm_filter))) { + ugd->ug_UiGadget.ug_iDrmFilterMode = DRM_FILTER_NONE; + } else if (!strncmp(drm_filter, UG_DRM_FILTER_ALL, strlen(drm_filter))) { + ugd->ug_UiGadget.ug_iDrmFilterMode = DRM_FILTER_ALL; + } else if (!strncmp(drm_filter, UG_DRM_FILTER_WITHOUT_FL, strlen(drm_filter))) { + ugd->ug_UiGadget.ug_iDrmFilterMode = DRM_FILTER_WITHOUT_FL; + } else { + ugd->ug_UiGadget.ug_iDrmFilterMode = DRM_FILTER_NONE; + } + } else { + ugd->ug_UiGadget.ug_iDrmFilterMode = DRM_FILTER_NONE; + } - path = bundle_get_val(option, key[0]); - select_mode = bundle_get_val(option, key[1]); - filter_mode = bundle_get_val(option, key[2]); - marked_mode = bundle_get_val(option, key[3]); + ugd->ug_UiGadget.ug_iDrmFilter = mf_ug_fm_svc_wapper_get_drm_filter(ugd->ug_UiGadget.ug_iDrmFilterMode, ugd->ug_UiGadget.ug_iFileFilter); + UG_TRACE_END; +} + + +/****************************** +** Prototype : __mf_ug_main_set_option_status +** Description : Samsung +** Input : void *data +** service_h service +** Output : None +** Return Value : +** Calls : +** Called By : +** +** History : +** 1.Date : 2010/12/10 +** Author : Samsung +** Modification : Created function +** +******************************/ + +static void __mf_ug_main_set_option_status(void *data, service_h service) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + char *key[UG_OPTION_COUNT] = { "path", "select_type", "file_type", "marked_mode", "drm_type"}; + char *path = NULL; + char *select_mode = NULL; + char *filter_mode = NULL; + char *marked_mode = NULL; + char *drm_filter_mode = NULL; + + service_get_extra_data(service, key[0], &path); + service_get_extra_data(service, key[1], &select_mode); + service_get_extra_data(service, key[2], &filter_mode); + service_get_extra_data(service, key[3], &marked_mode); + service_get_extra_data(service, key[4], &drm_filter_mode); - __mf_ug_main_set_path_option(ugd, path); __mf_ug_main_set_select_mode(ugd, select_mode); + __mf_ug_main_set_path_option(ugd, path); __mf_ug_main_set_filter_mode(ugd, filter_mode); __mf_ug_main_set_marked_mode(ugd, marked_mode); + __mf_ug_main_set_drm_filter_mode(ugd, drm_filter_mode); UG_TRACE_END; } @@ -575,7 +633,6 @@ static void __mf_ug_main_set_option_status(void *data, bundle * option) ******************************/ static Evas_Object *__mf_ug_main_create_default_layout(Evas_Object *parent, void *data) { - UG_TRACE_BEGIN; ugData *ugd = (ugData *)data; ug_mf_retvm_if(ugd == NULL, NULL, "ugd is NULL"); ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL"); @@ -599,9 +656,9 @@ static Evas_Object *__mf_ug_main_create_default_layout(Evas_Object *parent, void ugNaviBar *pNavi_phone = calloc(1, sizeof(ugNaviBar)); ug_mf_retvm_if(pNavi_phone == NULL, NULL, "pNavi_phone is NULL"); - pNavi_phone->ug_pNaviBar = mf_ug_navi_bar_create_navi_bar(parent); - if (pNavi_phone->ug_pNaviBar == NULL) { - ug_debug("pNavi_phone->ug_pNaviBar is NULL"); + ugd->ug_MainWindow.ug_pNaviBar = mf_ug_navi_bar_create_navi_bar(parent); + if (ugd->ug_MainWindow.ug_pNaviBar == NULL) { + ug_debug("ugd->ug_MainWindow.ug_pNaviBar is NULL"); free(pNavi_phone); pNavi_phone = NULL; UG_TRACE_END; @@ -633,7 +690,7 @@ static Evas_Object *__mf_ug_main_create_default_layout(Evas_Object *parent, void //mf_ug_tab_bar_set_selected_item(pItemPhone); } UG_TRACE_END; - return pNavi_phone->ug_pNaviBar; + return ugd->ug_MainWindow.ug_pNaviBar; } /****************************** @@ -665,24 +722,27 @@ static void __mf_ug_main_start(void *data) if (pContent != NULL) { error_code = mf_ug_util_get_mmc_state(&mmc_card); - if (error_code == 0 && mmc_card == 1) { - ug_debug(" mmc is inserted"); - ugd->ug_Status.ug_iMmcFlag = MMC_ON; - if (ugd->ug_Status.ug_bSettingEntry) { - ug_debug(" entry from setting sounds"); - elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", pContent); + if (!mf_ug_fm_svc_wapper_is_root_path(ugd)) { + elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", pContent); + } else { + if (error_code == 0 && mmc_card == 1) { + ug_debug(" mmc is inserted"); + ugd->ug_Status.ug_iMmcFlag = MMC_ON; + if (ugd->ug_Status.ug_bSettingEntry) { + ug_debug(" entry from setting sounds"); + elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", pContent); + } else { + ug_debug(" not entry from setting sounds"); + evas_object_show(ugd->ug_MainWindow.ug_pTabLayout); + elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.content", pContent); + elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.tabbar", ugd->ug_MainWindow.ug_pTabBar); + elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pTabLayout); + } } else { - ug_debug(" not entry from setting sounds"); - evas_object_show(ugd->ug_MainWindow.ug_pTabLayout); - elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.content", pContent); - elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.tabbar", ugd->ug_MainWindow.ug_pTabBar); - elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pTabLayout); + ug_debug(" mmc is not inserted"); + elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", pContent); } - } else { - ug_debug(" mmc is not inserted"); - elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", pContent); } - mf_ug_navi_bar_create_default_view(ugd); mf_ug_ctrl_bar_set_item_disable(ugd); if (ugd->ug_Status.ug_bMassStorageFlag && ugd->ug_MainWindow.ug_pTabBar) { @@ -705,9 +765,9 @@ static void __mf_ug_main_start(void *data) /****************************** ** Prototype : on_create ** Description : Samsung -** Input : struct ui_gadget *ug +** Input : ui_gadget_h ug ** enum ug_mode mode -** bundle *data +** service_h service ** void *priv ** Output : None ** Return Value : @@ -721,14 +781,13 @@ static void __mf_ug_main_start(void *data) ** ******************************/ -static void *on_create(struct ui_gadget *ug, enum ug_mode mode, bundle * data, void *priv) +static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv) { UG_TRACE_BEGIN; Evas_Object *win = NULL; ugData *ugd = NULL; - ug_mf_retv_if(NULL == ug, NULL); ug_mf_retv_if(NULL == priv, NULL); ugd = priv; @@ -743,6 +802,7 @@ static void *on_create(struct ui_gadget *ug, enum ug_mode mode, bundle * data, v ugd->ug_Status.ug_bInstallFlag = false; ugd->ug_Status.ug_bMassStorageFlag = false; ugd->ug_Status.ug_bCancelDisableFlag = false; + ugd->ug_UiGadget.ug_iImportMode = 0; ugd->ug_MainWindow.ug_pMainLayout = __mf_ug_main_create_main_layout(ugd->ug_MainWindow.ug_pWindow); ugd->ug_MainWindow.ug_pTabLayout = mf_ug_main_tab_layout_create(ugd->ug_MainWindow.ug_pWindow); ugd->ug_MainWindow.ug_pBackGround = mf_ug_main_create_bg(ugd->ug_MainWindow.ug_pWindow); @@ -766,10 +826,13 @@ static void *on_create(struct ui_gadget *ug, enum ug_mode mode, bundle * data, v #endif { __mf_ug_main_init_data(ugd); - __mf_ug_main_set_option_status(ugd, data); - media_svc_connect(&ugd->ug_Status.ug_pMedia_svc_handle); + __mf_ug_main_set_option_status(ugd, service); + media_content_connect(); + ugd->ug_Status.ug_iThemeType = mf_ug_util_get_theme(); __mf_ug_main_start(ugd); + + power_set_changed_cb(mf_ug_cb_lcd_state_changed_cb, ugd); UG_TRACE_END; return ugd->ug_MainWindow.ug_pMainLayout; } @@ -778,8 +841,8 @@ static void *on_create(struct ui_gadget *ug, enum ug_mode mode, bundle * data, v /****************************** ** Prototype : on_start ** Description : -** Input : struct ui_gadget *ug -** bundle *data +** Input : ui_gadget_h ug +** service_h service ** void *priv ** Output : None ** Return Value : @@ -792,7 +855,7 @@ static void *on_create(struct ui_gadget *ug, enum ug_mode mode, bundle * data, v ** Modification : Created function ** ******************************/ -static void on_start(struct ui_gadget *ug, bundle * data, void *priv) +static void on_start(ui_gadget_h ug, service_h service, void *priv) { } @@ -800,8 +863,8 @@ static void on_start(struct ui_gadget *ug, bundle * data, void *priv) /****************************** ** Prototype : on_pause ** Description : -** Input : struct ui_gadget *ug -** bundle *data +** Input : ui_gadget_h ug +** service_h service ** void *priv ** Output : None ** Return Value : @@ -814,21 +877,22 @@ static void on_start(struct ui_gadget *ug, bundle * data, void *priv) ** Modification : Created function ** ******************************/ -static void on_pause(struct ui_gadget *ug, bundle * data, void *priv) +static void on_pause(ui_gadget_h ug, service_h service, void *priv) { + UG_TRACE_BEGIN; if (!priv) return; ugData *ugd = (ugData *)priv; if (0 != ugd->ug_ListPlay.ug_Player) { - mf_ug_list_play_destory_playing_file(ugd); + //mf_ug_list_play_destory_playing_file(ugd); } } /****************************** ** Prototype : on_resume ** Description : -** Input : struct ui_gadget *ug +** Input : ui_gadget_h ug ** bundle *data ** void *priv ** Output : None @@ -850,7 +914,7 @@ inline bool __mf_ug_main_check_exist(const char *path) return false; } -static void on_resume(struct ui_gadget *ug, bundle * data, void *priv) +static void on_resume(ui_gadget_h ug, service_h service, void *priv) { UG_TRACE_BEGIN; ug_mf_retm_if(NULL == priv, "priv is NULL"); @@ -904,7 +968,7 @@ static void on_resume(struct ui_gadget *ug, bundle * data, void *priv) /****************************** ** Prototype : on_message ** Description : -** Input : struct ui_gadget *ug +** Input : ui_gadget_h ug ** bundle *msg ** bundle *data ** void *priv @@ -919,16 +983,16 @@ static void on_resume(struct ui_gadget *ug, bundle * data, void *priv) ** Modification : Created function ** ******************************/ -static void on_message(struct ui_gadget *ug, bundle * msg, bundle * data, void *priv) +static void on_message(ui_gadget_h ug, service_h msg, service_h service, void *priv) { } /****************************** ** Prototype : on_event ** Description : -** Input : struct ui_gadget *ug +** Input : ui_gadget_h ug ** enum ug_event event -** bundle *data +** service_h service ** void *priv ** Output : None ** Return Value : @@ -941,7 +1005,7 @@ static void on_message(struct ui_gadget *ug, bundle * msg, bundle * data, void * ** Modification : Created function ** ******************************/ -static void on_event(struct ui_gadget *ug, enum ug_event event, bundle * data, void *priv) +static void on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv) { UG_TRACE_BEGIN; switch (event) { @@ -977,9 +1041,9 @@ static void on_event(struct ui_gadget *ug, enum ug_event event, bundle * data, v /****************************** ** Prototype : on_key_event ** Description : Samsung -** Input : struct ui_gadget *ug +** Input : ui_gadget_h ug ** enum ug_key_event event -** bundle *data +** service_h service ** void *priv ** Output : None ** Return Value : @@ -993,7 +1057,7 @@ static void on_event(struct ui_gadget *ug, enum ug_event event, bundle * data, v ** ******************************/ -static void on_key_event(struct ui_gadget *ug, enum ug_key_event event, bundle * data, void *priv) +static void on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h service, void *priv) { UG_TRACE_BEGIN; ugData *ugd = (ugData *)priv; @@ -1019,8 +1083,8 @@ static void on_key_event(struct ui_gadget *ug, enum ug_key_event event, bundle * /****************************** ** Prototype : on_destroy ** Description : -** Input : struct ui_gadget *ug -** bundle *data +** Input : ui_gadget_h ug +** service_h service ** void *priv ** Output : None ** Return Value : @@ -1033,7 +1097,7 @@ static void on_key_event(struct ui_gadget *ug, enum ug_key_event event, bundle * ** Modification : Created function ** ******************************/ -static void on_destroy(struct ui_gadget *ug, bundle * data, void *priv) +static void on_destroy(ui_gadget_h ug, service_h service, void *priv) { UG_TRACE_BEGIN; ugData *ugd = (ugData *)priv; @@ -1044,13 +1108,19 @@ static void on_destroy(struct ui_gadget *ug, bundle * data, void *priv) if (ugd->ug_Status.ug_bInstallFlag == true) { mf_ug_util_destory_dir_monitor(ugd); mf_ug_util_destory_mmc_state_cb(); - media_svc_disconnect(ugd->ug_Status.ug_pMedia_svc_handle); + media_content_disconnect(); mf_ug_util_destory_mass_storage_callback(); } if (0 != ugd->ug_ListPlay.ug_Player) { mf_ug_list_play_destory_playing_file(ugd); } + + if (ugd->ug_Status.callback_timer) { + ecore_timer_del(ugd->ug_Status.ug_pThumbUpdateTimer); + ugd->ug_Status.ug_pThumbUpdateTimer = NULL; + } + if (ugd->ug_Status.ug_pThumbUpdateTimer != NULL) { ecore_timer_del(ugd->ug_Status.ug_pThumbUpdateTimer); ugd->ug_Status.ug_pThumbUpdateTimer = NULL; diff --git a/src/widget/mf-ug-ctrl-bar.c b/src/widget/mf-ug-ctrl-bar.c index 969d804..495c350 100755..100644 --- a/src/widget/mf-ug-ctrl-bar.c +++ b/src/widget/mf-ug-ctrl-bar.c @@ -1,277 +1,269 @@ -/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- * See the License for the specific language governing permissions and limitations under the License.
- */
-
-
-
-#include <Eina.h>
-#include <Elementary.h>
-
-#include "mf-ug-winset.h"
-#include "mf-ug-cb.h"
-#include "mf-ug-fm-svc-wrapper.h"
-#include "mf-ug-util.h"
-#include "mf-ug-resource.h"
-
-#define UG_CTRL_STYLE_TYPE "controlbar"
-
-/******************************
-** Prototype : __mf_ug_ctrl_bar_create
-** Description : Samsung
-** Input : Evas_Object *parent
-** Output : None
-** Return Value :
-** Calls :
-** Called By :
-**
-** History :
-** 1.Date : 2010/12/10
-** Author : Samsung
-** Modification : Created function
-**
-******************************/
-static Evas_Object *__mf_ug_ctrl_bar_create(Evas_Object *parent)
-{
- UG_TRACE_BEGIN;
- ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL");
-
- Evas_Object *pCtrlBar = NULL;
- pCtrlBar = elm_toolbar_add(parent);
- elm_toolbar_shrink_mode_set(pCtrlBar, ELM_TOOLBAR_SHRINK_EXPAND);
- elm_object_style_set(pCtrlBar, "naviframe");
- elm_toolbar_homogeneous_set(pCtrlBar, EINA_TRUE);
- evas_object_show(pCtrlBar);
-
- UG_TRACE_END;
- return pCtrlBar;
-}
-
-/******************************
-** Prototype : __mf_ug_ctrl_bar_create_button
-** Description : Samsung
-** Input : Evas_Object *parent
-** eCtrlBarButtonType type
-** Output : None
-** Return Value :
-** Calls :
-** Called By :
-**
-** History :
-** 1.Date : 2010/12/10
-** Author : Samsung
-** Modification : Created function
-**
-******************************/
-#ifndef MF_UG_FEATURE_NEW_UX
-static Evas_Object *__mf_ug_ctrl_bar_create_button(Evas_Object *parent, eCtrlBarButtonType type)
-{
- ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL");
- Evas_Object *button = NULL;
-
-
- button = elm_button_add(parent);
-
- evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0.5);
- elm_object_style_set(button, "naviframe_control/multiline");
-
-
- switch (type) {
- case CTRL_BUTTON_CANCEL:
- elm_object_text_set(button, MF_UG_LABEL_CANCEL);
- break;
- case CTRL_BUTTON_ADD:
- elm_object_text_set(button, MF_UG_LABEL_SET);
- break;
- case CTRL_BUTTON_DONE:
- elm_object_text_set(button, MF_UG_LABEL_ATTACH);
- break;
- default:
- break;
- }
-
- evas_object_show(button);
- UG_TRACE_END;
- return button;
-}
-#endif
-
-/******************************
-** Prototype : __mf_ug_ctrl_bar_append_item
-** Description : Samsung
-** Input : void *data
-** Evas_Object *ctrl_bar
-** int type
-** Output : None
-** Return Value :
-** Calls :
-** Called By :
-**
-** History :
-** 1.Date : 2010/12/10
-** Author : Samsung
-** Modification : Created function
-**
-******************************/
-static void __mf_ug_ctrl_bar_append_item(void *data, Evas_Object *ctrl_bar, int type)
-{
- UG_TRACE_BEGIN;
- ugData *ugd = (ugData *)data;
- ug_mf_retm_if(ugd == NULL, "ugd is NULL");
- Evas_Object *pCtrlBar = ctrl_bar;
- ug_mf_retm_if(pCtrlBar == NULL, "pCtrlBar is NULL");
-
- if (ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE)
- elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_SET, (Evas_Smart_Cb) mf_ug_cb_add_button_cb, ugd);
- else
- elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_ATTACH, (Evas_Smart_Cb) mf_ug_cb_add_button_cb, ugd);
-
- elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_CANCEL, (Evas_Smart_Cb) mf_ug_cb_back_button_cb, ugd);
-
-
- UG_TRACE_END;
-}
-
-
-/******************************
-** Prototype : mf_ug_ctrl_bar_set
-** Description : Samsung
-** Input : void* data
-** ugNaviBar *pNavi_s
-** Output : None
-** Return Value :
-** Calls :
-** Called By :
-**
-** History :
-** 1.Date : 2010/12/10
-** Author : Samsung
-** Modification : Created function
-**
-******************************/
-void mf_ug_ctrl_bar_set(void *data, ugNaviBar *pNavi_s)
-{
- UG_TRACE_BEGIN;
- ugData *ugd = (ugData *)data;
- ug_mf_retm_if(ugd == NULL, "ugd is NULL");
-
- Evas_Object *pNaviBar = pNavi_s->ug_pNaviBar;
- Evas_Object *pCtrlBar = NULL;
-
- int type = ugd->ug_Status.ug_iCtrlBarType;
- pCtrlBar = __mf_ug_ctrl_bar_create(pNaviBar);
- pNavi_s->ug_pNaviCtrlBar = pCtrlBar;
- type = CTRL_BAR_NORMAL;
- __mf_ug_ctrl_bar_append_item(ugd, pCtrlBar, type);
- evas_object_show(pCtrlBar);
- elm_object_item_part_content_set(pNavi_s->ug_pNaviItem, UG_CTRL_STYLE_TYPE, pCtrlBar);
- UG_TRACE_END;
-}
-
-/******************************
-** Prototype : mf_ug_ctrl_bar_disable_item
-** Description : Samsung
-** Input : void *data
-** bool disable
-** Output : None
-** Return Value :
-** Calls :
-** Called By :
-**
-** History :
-** 1.Date : 2010/12/10
-** Author : Samsung
-** Modification : Created function
-**
-******************************/
-void mf_ug_ctrl_bar_disable_item(void *data, bool disable)
-{
- UG_TRACE_BEGIN;
- ugData *ugd = (ugData *)data;
- ug_mf_retm_if(ugd == NULL, "ugd is NULL");
-
- Evas_Object *pCtrlBar = NULL;
-
- ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
- ug_mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed");
-
- pCtrlBar = pNavi_s->ug_pNaviCtrlBar;
-
- Elm_Object_Item *it = NULL;
- it = elm_toolbar_first_item_get(pCtrlBar);
-
- while(it) {
- const char *button_label = elm_object_item_text_get(it);
- const char *disable_labe = NULL;
- if (ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE)
- disable_labe = MF_UG_LABEL_SET;
- else
- disable_labe = MF_UG_LABEL_ATTACH;
- if (g_strcmp0(button_label, disable_labe) == 0) {
- elm_object_item_disabled_set(it, !disable);
- }
- it = elm_toolbar_item_next_get(it);
- }
-}
-
-
-/******************************
-** Prototype : mf_ug_ctrl_bar_set_item_disable
-** Description : Samsung
-** Input : void *data
-** Output : None
-** Return Value :
-** Calls :
-** Called By :
-**
-** History :
-** 1.Date : 2010/12/10
-** Author : Samsung
-** Modification : Created function
-**
-******************************/
-void mf_ug_ctrl_bar_set_item_disable(void *data)
-{
- UG_TRACE_BEGIN;
- ugData *ugd = (ugData *)data;
- ug_mf_retm_if(ugd == NULL, "ugd is NULL");
- bool disable = false;
-
- if (ugd->ug_Status.ug_bNoContentFlag == true) {
- mf_ug_ctrl_bar_disable_item(ugd, false);
- } else {
- disable = mf_ug_util_is_genlist_selected(ugd);
-
- mf_ug_ctrl_bar_disable_item(ugd, disable);
- }
- UG_TRACE_END;
-}
-
-void mf_ug_ctrl_bar_recover(void *data)
-{
- UG_TRACE_BEGIN;
- ugData *ugd = (ugData *)data;
- ug_mf_retm_if(ugd == NULL, "ugd is NULL");
-
- ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
- ug_mf_retm_if(pNavi_s == NULL, "get navi failed");
-
- Evas_Object *naviBar = pNavi_s->ug_pNaviBar;
- Evas_Object *ctrl_bar = NULL;
-
- ug_mf_retm_if(naviBar == NULL, "navi is NULL");
- ctrl_bar = elm_object_item_part_content_get(pNavi_s->ug_pNaviItem, UG_CTRL_STYLE_TYPE);
- pNavi_s->ug_pNaviCtrlBar = ctrl_bar;
-}
+/* + * myfile + * + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + + +#include <Eina.h> +#include <Elementary.h> + +#include "mf-ug-winset.h" +#include "mf-ug-cb.h" +#include "mf-ug-fm-svc-wrapper.h" +#include "mf-ug-util.h" +#include "mf-ug-resource.h" + +#define UG_CTRL_STYLE_TYPE "controlbar" + + +/****************************** +** Prototype : __mf_ug_ctrl_bar_create +** Description : Samsung +** Input : Evas_Object *parent +** Output : None +** Return Value : +** Calls : +** Called By : +** +** History : +** 1.Date : 2010/12/10 +** Author : Samsung +** Modification : Created function +** +******************************/ +static Evas_Object *__mf_ug_ctrl_bar_create(Evas_Object *parent) +{ + UG_TRACE_BEGIN; + ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL"); + + Evas_Object *pCtrlBar = NULL; + + pCtrlBar = elm_toolbar_add(parent); + elm_toolbar_shrink_mode_set(pCtrlBar, ELM_TOOLBAR_SHRINK_EXPAND); + elm_object_style_set(pCtrlBar, "naviframe"); + elm_toolbar_homogeneous_set(pCtrlBar, EINA_TRUE); + //elm_index_autohide_disabled_set(index, EINA_TRUE); + elm_object_focus_set(pCtrlBar, EINA_FALSE); + evas_object_show(pCtrlBar); + UG_TRACE_END; + return pCtrlBar; +} + + +/****************************** +** Prototype : __mf_ug_ctrl_bar_append_item +** Description : Samsung +** Input : void *data +** Evas_Object *ctrl_bar +** int type +** Output : None +** Return Value : +** Calls : +** Called By : +** +** History : +** 1.Date : 2010/12/10 +** Author : Samsung +** Modification : Created function +** +******************************/ +static void __mf_ug_ctrl_bar_append_item(void *data, Evas_Object *ctrl_bar, int type) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + Evas_Object *pCtrlBar = ctrl_bar; + ug_mf_retm_if(pCtrlBar == NULL, "pCtrlBar is NULL"); + + if (ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE) { + Elm_Object_Item *item = NULL; + item = elm_toolbar_item_append(pCtrlBar, NULL, NULL, NULL, NULL); + elm_object_item_disabled_set(item, EINA_TRUE); + item = elm_toolbar_item_append(pCtrlBar, NULL, NULL, NULL, NULL); + elm_object_item_disabled_set(item, EINA_TRUE); + item = elm_toolbar_item_append(pCtrlBar, NULL, NULL, NULL, NULL); + elm_object_item_disabled_set(item, EINA_TRUE); + //elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_SET, (Evas_Smart_Cb) mf_ug_cb_add_button_cb, ugd); + } else { + if (ugd->ug_UiGadget.ug_iSelectMode == IMPORT_MODE) { + elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_IMPORT, (Evas_Smart_Cb) mf_ug_cb_add_button_cb, ugd); + elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_SEARCH, (Evas_Smart_Cb) mf_ug_search_view_enter_search_routine, ugd); + } else if (ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE) { + elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_EXPORT, (Evas_Smart_Cb) mf_ug_cb_add_button_cb, ugd); + elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_CREATE, (Evas_Smart_Cb) mf_ug_cb_create_new_folder, ugd); + } else { + elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_ATTACH, (Evas_Smart_Cb) mf_ug_cb_add_button_cb, ugd); + } + } + + elm_toolbar_item_append(pCtrlBar, NULL, MF_UG_LABEL_CANCEL, (Evas_Smart_Cb) mf_ug_cb_back_button_cb, ugd); + + + UG_TRACE_END; +} + + +/****************************** +** Prototype : mf_ug_ctrl_bar_set +** Description : Samsung +** Input : void* data +** ugNaviBar *pNavi_s +** Output : None +** Return Value : +** Calls : +** Called By : +** +** History : +** 1.Date : 2010/12/10 +** Author : Samsung +** Modification : Created function +** +******************************/ +void mf_ug_ctrl_bar_set(void *data, ugNaviBar *pNavi_s) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + + Evas_Object *pNaviBar = ugd->ug_MainWindow.ug_pNaviBar; + Evas_Object *pCtrlBar = NULL; + + int type = ugd->ug_Status.ug_iCtrlBarType; + pCtrlBar = __mf_ug_ctrl_bar_create(pNaviBar); + ugd->ug_MainWindow.ug_pNaviCtrlBar = pCtrlBar; + type = CTRL_BAR_NORMAL; + __mf_ug_ctrl_bar_append_item(ugd, pCtrlBar, type); + evas_object_show(pCtrlBar); + elm_object_item_part_content_set(ugd->ug_MainWindow.ug_pNaviItem, UG_CTRL_STYLE_TYPE, pCtrlBar); + UG_TRACE_END; +} + +/****************************** +** Prototype : mf_ug_ctrl_bar_disable_item +** Description : Samsung +** Input : void *data +** bool disable +** Output : None +** Return Value : +** Calls : +** Called By : +** +** History : +** 1.Date : 2010/12/10 +** Author : Samsung +** Modification : Created function +** +******************************/ +void mf_ug_ctrl_bar_listby_item_diable(Evas_Object *pCtrlbar, bool disable) +{ + UG_TRACE_BEGIN; + ug_mf_retm_if(pCtrlbar == NULL, "pCtrlbar is NULL"); + Elm_Object_Item *it = NULL; + it = elm_toolbar_first_item_get(pCtrlbar); + + while(it) { + const char *button_label = elm_object_item_text_get(it); + const char *disable_labe = MF_UG_LABEL_LIST_BY; + + if (g_strcmp0(button_label, disable_labe) == 0) { + elm_object_item_disabled_set(it, disable); + } + it = elm_toolbar_item_next_get(it); + } +} +void mf_ug_ctrl_bar_disable_item(void *data, bool disable) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + + Evas_Object *pCtrlBar = NULL; + + ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd); + ug_mf_retm_if(pNavi_s == NULL, "get navigation bar in use failed"); + + pCtrlBar = ugd->ug_MainWindow.ug_pNaviCtrlBar; + + Elm_Object_Item *it = NULL; + it = elm_toolbar_first_item_get(pCtrlBar); + + while(it) { + const char *button_label = elm_object_item_text_get(it); + const char *disable_labe = NULL; + if (ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE) { + disable_labe = MF_UG_LABEL_SET; + } else if (ugd->ug_UiGadget.ug_iSelectMode == IMPORT_MODE) { + disable_labe = MF_UG_LABEL_IMPORT; + } else { + disable_labe = MF_UG_LABEL_ATTACH; + } + if (g_strcmp0(button_label, disable_labe) == 0) { + elm_object_item_disabled_set(it, !disable); + } + it = elm_toolbar_item_next_get(it); + } +} + +/****************************** +** Prototype : mf_ug_ctrl_bar_set_item_disable +** Description : Samsung +** Input : void *data +** Output : None +** Return Value : +** Calls : +** Called By : +** +** History : +** 1.Date : 2010/12/10 +** Author : Samsung +** Modification : Created function +** +******************************/ +void mf_ug_ctrl_bar_set_item_disable(void *data) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + bool disable = false; + + if (ugd->ug_Status.ug_bNoContentFlag == true) { + mf_ug_ctrl_bar_disable_item(ugd, false); + } else { + disable = mf_ug_util_is_genlist_selected(ugd); + + mf_ug_ctrl_bar_disable_item(ugd, disable); + } + UG_TRACE_END; +} + +void mf_ug_ctrl_bar_recover(void *data) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + + ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd); + ug_mf_retm_if(pNavi_s == NULL, "get navi failed"); + + Evas_Object *naviBar = ugd->ug_MainWindow.ug_pNaviBar; + Evas_Object *ctrl_bar = NULL; + + ug_mf_retm_if(naviBar == NULL, "navi is NULL"); + ctrl_bar = elm_object_item_part_content_get(ugd->ug_MainWindow.ug_pNaviItem, UG_CTRL_STYLE_TYPE); + ugd->ug_MainWindow.ug_pNaviCtrlBar = ctrl_bar; +} diff --git a/src/widget/mf-ug-genlist.c b/src/widget/mf-ug-genlist.c index ff3db4b..ec3ee46 100755..100644 --- a/src/widget/mf-ug-genlist.c +++ b/src/widget/mf-ug-genlist.c @@ -1,29 +1,31 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
-
#include <Eina.h>
#include "mf-ug-winset.h"
#include "mf-ug-util.h"
#include "mf-ug-fm-svc-wrapper.h"
#include "mf-ug-fs-util.h"
#include "mf-ug-resource.h"
+#include "mf-ug-cb.h"
#define MF_UG_SELECTED_ITEM_BRING_UP_COUNT 7
@@ -165,8 +167,7 @@ static void __mf_ug_genlist_show_select_info(void *data) int iDirCount = 0, iFileCount = 0;
Elm_Object_Item *it = NULL;
- ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
- Evas_Object *pGenlist = pNavi_s->ug_pContent;
+ Evas_Object *pGenlist = ugd->ug_MainWindow.ug_pContent;
it = elm_genlist_first_item_get(pGenlist);
while (it) {
@@ -291,6 +292,7 @@ static void __mf_ug_genlist_radio_box_cb(void *data, Evas_Object *obj, void *eve itemData->ug_pData->ug_Status.ug_iRadioOn = itemData->ug_iGroupValue;
elm_radio_value_set(itemData->ug_pData->ug_MainWindow.ug_pRadioGroup, itemData->ug_iGroupValue);
mf_ug_ctrl_bar_set_item_disable(itemData->ug_pData);
+ mf_ug_cb_add_button_cb(itemData->ug_pData, NULL, NULL);
UG_TRACE_END;
}
@@ -362,7 +364,7 @@ static void __mf_ug_genlist_get_thumbnail(void *data) itemData->ug_pThumbPath = strdup(dir_icon_path);
itemData->ug_bRealThumbFlag = true;
} else {
- icon_path = mf_ug_file_attr_get_file_icon(itemData->ug_pData->ug_Status.ug_pMedia_svc_handle, itemData->ug_pItemName->str, &error_code);
+ icon_path = mf_ug_file_attr_get_file_icon(itemData->ug_pItemName->str, &error_code);
if (icon_path) {
itemData->ug_pThumbPath = strdup(icon_path);
itemData->ug_bRealThumbFlag = true;
@@ -636,7 +638,10 @@ static Evas_Object *__mf_ug_genlist_get_gl_icon(void *data, Evas_Object *obj, co if (!strcmp(part, "elm.icon")) {
if (strncmp(listItemData->ug_pItemName->str, "Upper Level", strlen(listItemData->ug_pItemName->str)) == 0) {
- listItemData->ug_pThumbPath = strdup(UG_ICON_UPPER);
+ if (ugd->ug_Status.ug_iThemeType == UG_THEME_NBEAT)
+ listItemData->ug_pThumbPath = strdup(UG_ICON_WHITE_THEME_UPPER);
+ else
+ listItemData->ug_pThumbPath = strdup(UG_ICON_BLACK_THEME_UPPER);
thumb = __mf_ug_genlist_create_thumbnail(listItemData, obj);
return thumb;
}
@@ -666,7 +671,9 @@ static Evas_Object *__mf_ug_genlist_get_gl_icon(void *data, Evas_Object *obj, co selected_box = __mf_ug_genlist_add_radio_box(listItemData, obj);
}
} else {
- if (ugd->ug_UiGadget.ug_iSelectMode == MULTI_FILE_MODE || ugd->ug_UiGadget.ug_iSelectMode == MULTI_ALL_MODE) {
+ if (ugd->ug_UiGadget.ug_iSelectMode == MULTI_FILE_MODE
+ || ugd->ug_UiGadget.ug_iSelectMode == MULTI_ALL_MODE
+ || ugd->ug_UiGadget.ug_iSelectMode == IMPORT_MODE) {
selected_box = __mf_ug_genlist_add_checkbox(listItemData, obj);
} else if (ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE) {
@@ -698,18 +705,43 @@ static Evas_Object *__mf_ug_genlist_get_gl_icon(void *data, Evas_Object *obj, co if (g_strcmp0(ugd->ug_ListPlay.ug_pPlayFilePath, listItemData->ug_pItemName->str) == 0) {
if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PLAYING) {
- pause_icon = strdup(UG_ICON_MUSIC_PAUSE_WHITE);
+ if (ugd->ug_Status.ug_iThemeType == UG_THEME_NBEAT) {
+ pause_icon = strdup(UG_ICON_MUSIC_PAUSE_WHITE);
+ } else {
+ pause_icon = strdup(UG_ICON_MUSIC_PAUSE);
+ }
elm_icon_file_set(music_icon, pause_icon, NULL);
} else if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PAUSED) {
- play_icon = strdup(UG_ICON_MUSIC_PLAY_WHITE);
+ if (ugd->ug_Status.ug_iThemeType == UG_THEME_NBEAT) {
+ play_icon = strdup(UG_ICON_MUSIC_PLAY_WHITE);
+ } else {
+ play_icon = strdup(UG_ICON_MUSIC_PLAY);
+ }
+ elm_icon_file_set(music_icon, play_icon, NULL);
+ } else {
+ if (ugd->ug_Status.ug_iThemeType == UG_THEME_NBEAT) {
+ play_icon = strdup(UG_ICON_MUSIC_PLAY_WHITE);
+ } else {
+ play_icon = strdup(UG_ICON_MUSIC_PLAY);
+ }
+
elm_icon_file_set(music_icon, play_icon, NULL);
}
} else {
- play_icon = strdup(UG_ICON_MUSIC_PLAY_WHITE);
+ if (ugd->ug_Status.ug_iThemeType == UG_THEME_NBEAT) {
+ play_icon = strdup(UG_ICON_MUSIC_PLAY_WHITE);
+ } else {
+ play_icon = strdup(UG_ICON_MUSIC_PLAY);
+ }
+
elm_icon_file_set(music_icon, play_icon, NULL);
}
} else {
- play_icon = strdup(UG_ICON_MUSIC_PLAY_WHITE);
+ if (ugd->ug_Status.ug_iThemeType == UG_THEME_NBEAT) {
+ play_icon = strdup(UG_ICON_MUSIC_PLAY_WHITE);
+ } else {
+ play_icon = strdup(UG_ICON_MUSIC_PLAY);
+ }
elm_icon_file_set(music_icon, play_icon, NULL);
}
evas_object_size_hint_aspect_set(music_icon, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
@@ -868,12 +900,17 @@ static void __mf_ug_genlist_selected_gl(void *data, Evas_Object *obj, void *even mf_ug_navi_bar_create_default_view(ugd);
} else if (!ecore_file_is_dir(selected->ug_pItemName->str)) {
+ if (ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE) {
+ return;
+ }
+
if (ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE) {
if (elm_radio_value_get(ugd->ug_MainWindow.ug_pRadioGroup) != selected->ug_iGroupValue) {
ugd->ug_Status.ug_iRadioOn = selected->ug_iGroupValue;
selected->ug_bChecked = true;
elm_radio_value_set(ugd->ug_MainWindow.ug_pRadioGroup, selected->ug_iGroupValue);
}
+ mf_ug_cb_add_button_cb(ugd, NULL, NULL);
} else {
if (selected->ug_bChecked == 0) {
@@ -885,6 +922,7 @@ static void __mf_ug_genlist_selected_gl(void *data, Evas_Object *obj, void *even __mf_ug_genlist_show_select_info(selected);
}
} else if (ecore_file_is_dir(selected->ug_pItemName->str) && strcmp(selected->ug_pItemName->str, "Upper Level")) {
+ mf_ug_tar_bar_disable(ugd, true);
if (ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PLAYING || ugd->ug_ListPlay.ug_iPlayState == PLAY_STATE_PAUSED) {
mf_ug_list_play_destory_playing_file(ugd);
@@ -909,6 +947,119 @@ static void __mf_ug_genlist_selected_gl(void *data, Evas_Object *obj, void *even }
+static Evas_Object *__mf_ug_genlist_create_editfield(Evas_Object *parent, Evas_Object **pEntry)
+{
+ ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL");
+
+ Evas_Object *layout = elm_layout_add(parent);
+ elm_layout_theme_set(layout, "layout", "editfield", "default");
+ Evas_Object *entry = elm_entry_add(parent);
+ elm_object_part_content_set(layout, "elm.swallow.content", entry);
+ *pEntry = entry;
+ return layout;
+}
+
+static Evas_Object *__mf_ug_genlist_gl_new_folder_icon_get(void *data, Evas_Object * obj, const char *part)
+{
+ UG_TRACE_BEGIN;
+ ugData *ugd = (ugData *)data;
+ ug_mf_retvm_if(ugd == NULL, NULL, "ugd is NULL");
+
+ if (!strcmp(part, "elm.icon")) {
+ int error_code = 0;
+ char *fileName = NULL;
+ char *fullpath = (char *)malloc(sizeof(char) * MYFILE_FILE_PATH_LEN_MAX);
+ if (fullpath == NULL) {
+ return NULL;
+ }
+ GString *dest_fullpath;
+ static Elm_Entry_Filter_Limit_Size limit_filter;
+ Evas_Object *entry = NULL;
+
+ Evas_Object *edit_field = __mf_ug_genlist_create_editfield(obj, &entry);
+
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+
+ elm_object_signal_emit(edit_field, "elm,state,eraser,show", "elm");
+
+ evas_object_size_hint_weight_set(edit_field, 1, 1);
+ evas_object_size_hint_align_set(edit_field, 1, 0.5);
+ //evas_object_show(edit_field);
+ ugd->ug_MainWindow.ug_pEditField = edit_field;
+
+ ugd->ug_MainWindow.ug_pEntry = entry;
+
+ limit_filter.max_char_count = MYFILE_FILE_NAME_LEN_MAX;
+ limit_filter.max_byte_count = 0;
+
+ memset(fullpath, 0, MYFILE_FILE_PATH_LEN_MAX);
+ fileName = elm_entry_markup_to_utf8(MF_UG_LABEL_FOLDER);
+ snprintf(fullpath, (MYFILE_FILE_PATH_LEN_MAX), "%s/%s", (char *)ugd->ug_Status.ug_pPath->str, fileName);
+
+ dest_fullpath = g_string_new(fullpath);
+
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter);
+ evas_object_smart_callback_add(entry, "maxlength,reached", mf_ug_cb_reach_max_len_cb, ugd);
+
+ if (mf_ug_fm_svc_wrapper_detect_duplication(dest_fullpath)) {
+ ug_debug("dectetion result is TRUE\ndest_fullpath is %s\n", dest_fullpath->str);
+ error_code = mf_ug_fm_svc_wrapper_file_auto_rename(ugd, dest_fullpath, FILE_NAME_WITH_BRACKETS, &dest_fullpath);
+ ug_debug("rename result is %s\n", dest_fullpath->str);
+ memset(fullpath, 0, strlen(fullpath));
+ int len = strlen(ugd->ug_Status.ug_pPath->str) + 1;
+ strncpy(fullpath, dest_fullpath->str + len, MYFILE_FILE_PATH_LEN_MAX);
+ /*memset(fileName,0,strlen(fileName));*/
+
+ UG_SAFE_FREE_CHAR(fileName);
+ fileName = elm_entry_markup_to_utf8(fullpath);
+ }
+
+ /*elm_entry_entry_set(entry, ecore_file_file_get(params->m_ItemName->str));*/
+
+ elm_object_signal_callback_add(edit_field, "elm,eraser,clicked", "elm", mf_ug_cb_eraser_clicked_cb, entry);
+
+ evas_object_show(entry);
+ elm_object_focus_set(entry, EINA_TRUE);
+
+ elm_entry_entry_set(entry, fileName);
+ elm_entry_cursor_end_set(entry);
+ UG_SAFE_FREE_CHAR(fullpath);
+ UG_SAFE_FREE_GSTRING(dest_fullpath);
+ UG_SAFE_FREE_CHAR(fileName);
+ return edit_field;
+ }
+ return NULL;
+}
+
+Evas_Object *mf_ug_genlist_create_list_new_folder_style(void *data)
+{
+
+ UG_TRACE_BEGIN;
+ ugData *ugd = (ugData *)data;
+ ug_mf_retvm_if(ugd == NULL, NULL, "ugd is NULL");
+
+ Evas_Object *genlist = NULL;
+ Evas_Object *pNaviBar = NULL;
+
+ Elm_Object_Item *it = NULL;
+
+ pNaviBar = ugd->ug_MainWindow.ug_pNaviBar;
+
+ genlist = elm_genlist_add(pNaviBar);
+ elm_object_focus_set(genlist, EINA_FALSE);
+
+ ugd->ug_Status.ug_newfolderitec.item_style = "dialogue/bg/1icon";
+ ugd->ug_Status.ug_newfolderitec.func.text_get = NULL;
+ ugd->ug_Status.ug_newfolderitec.func.content_get = __mf_ug_genlist_gl_new_folder_icon_get;
+ ugd->ug_Status.ug_newfolderitec.func.state_get = NULL;
+ ugd->ug_Status.ug_newfolderitec.func.del = NULL;
+
+ it = elm_genlist_item_append(genlist, &ugd->ug_Status.ug_newfolderitec, ugd, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ return genlist;
+}
+
/******************************
** Prototype : __mf_ug_genlist_create_gl
** Description : Samsung
@@ -924,7 +1075,7 @@ static void __mf_ug_genlist_selected_gl(void *data, Evas_Object *obj, void *even ** Modification : Created function
**
******************************/
-static Evas_Object *__mf_ug_genlist_create_gl(void *data)
+Evas_Object *__mf_ug_genlist_create_gl(void *data)
{
UG_TRACE_BEGIN;
@@ -935,8 +1086,7 @@ static Evas_Object *__mf_ug_genlist_create_gl(void *data) ug_mf_retvm_if(pNaviInUse == NULL, NULL, "pNaviInUse is NULL");
Evas_Object *genlist;
- ug_debug("pNaviInUse->ug_pNaviBar is [%p]", pNaviInUse->ug_pNaviBar);
- genlist = elm_genlist_add(pNaviInUse->ug_pNaviBar);
+ genlist = elm_genlist_add(ugd->ug_MainWindow.ug_pNaviBar);
evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -956,7 +1106,10 @@ static Evas_Object *__mf_ug_genlist_create_gl(void *data) ugd->ug_Status.ug_itc.func.del = __mf_ug_genlist_del_gl;
- if (ugd->ug_UiGadget.ug_iSelectMode == MULTI_FILE_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE) {
+ if (ugd->ug_UiGadget.ug_iSelectMode == MULTI_FILE_MODE ||
+ ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE ||
+ ugd->ug_UiGadget.ug_iSelectMode == IMPORT_MODE ||
+ ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE) {
ugd->ug_Status.ug_normalitc.item_style = "1text.1icon.2";
ugd->ug_Status.ug_normalitc.func.text_get = __mf_ug_genlist_get_gl_label;
ugd->ug_Status.ug_normalitc.func.content_get = __mf_ug_genlist_get_gl_icon;
@@ -1114,6 +1267,7 @@ void mf_ug_upper_genlist_item_append(Evas_Object *pGenlist, void *data) // separator with no bottom line
item = elm_genlist_item_append(pGenlist, &ugd->ug_Status.ug_separtor_no_bottom_line_itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
// button for dialogue item (dialogue bg)
@@ -1170,8 +1324,8 @@ Evas_Object *mf_ug_genlist_create_content_list_view(void *data) ugd->ug_Status.ug_bNoContentFlag = false;
genlist = __mf_ug_genlist_create_gl(ugd);
- ug_mf_retvm_if(genlist == NULL, NULL, "genlist create failed");
- pNaviInUse->ug_pContent = genlist;
+
+ ugd->ug_MainWindow.ug_pContent = genlist;
GString *fullpath = g_string_new(ugd->ug_Status.ug_pPath->str);
@@ -1190,6 +1344,8 @@ Evas_Object *mf_ug_genlist_create_content_list_view(void *data) }
ugd->ug_UiGadget.ug_pFilterList = file_list;
ugd->ug_UiGadget.ug_pDirList = dir_list;
+ mf_ug_util_sort_the_file_list(ugd);
+
}
/* list option set */
unsigned int dir_list_len = eina_list_count(dir_list);
@@ -1199,10 +1355,12 @@ Evas_Object *mf_ug_genlist_create_content_list_view(void *data) if ((dir_list_len == 0 && filter_file_list_len == 0) || (ugd->ug_Status.ug_bMassStorageFlag && !ugd->ug_Status.ug_bInSettingView)) {
Evas_Object *layout;
- Evas_Object *nocontent;
+ Evas_Object *nocontent = NULL;
+
nocontent = elm_layout_add(ugd->ug_MainWindow.ug_pMainLayout);
elm_layout_theme_set(nocontent, "layout", "nocontents", "text");
elm_object_part_text_set(nocontent, "elm.text", MF_UG_LABEL_NO_FILES);
+
ugd->ug_Status.ug_bNoContentFlag = true;
elm_genlist_bounce_set(genlist, EINA_FALSE, EINA_FALSE);
@@ -1222,7 +1380,7 @@ Evas_Object *mf_ug_genlist_create_content_list_view(void *data) ugFsNodeInfo *pNode = NULL;
Eina_List *l = NULL;
- EINA_LIST_FOREACH(dir_list, l, pNode) {
+ EINA_LIST_FOREACH(ugd->ug_UiGadget.ug_pDirList, l, pNode) {
char *real_name = NULL;
count++;
if (pNode != NULL) {
@@ -1245,7 +1403,10 @@ Evas_Object *mf_ug_genlist_create_content_list_view(void *data) }
continue;
}
- if (ugd->ug_UiGadget.ug_iSelectMode == MULTI_FILE_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE) {
+ if (ugd->ug_UiGadget.ug_iSelectMode == MULTI_FILE_MODE ||
+ ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE ||
+ ugd->ug_UiGadget.ug_iSelectMode == IMPORT_MODE ||
+ ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE) {
ug_ItemData->ug_iGroupValue = 0;
it = elm_genlist_item_append(genlist, &ugd->ug_Status.ug_normalitc, ug_ItemData, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
@@ -1263,9 +1424,8 @@ Evas_Object *mf_ug_genlist_create_content_list_view(void *data) }
}
- EINA_LIST_FOREACH(file_list, l, pNode) {
+ EINA_LIST_FOREACH(ugd->ug_UiGadget.ug_pFilterList, l, pNode) {
char *real_name = NULL;
- mf_ug_launch_type launch_type = LAUNCH_TYPE_FORK;
count++;
real_name = g_strconcat(pNode->path, "/", pNode->name, NULL);
ug_debug("real_name is %s", real_name);
@@ -1283,16 +1443,31 @@ Evas_Object *mf_ug_genlist_create_content_list_view(void *data) if (ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE) {
ug_ItemData->ug_iGroupValue = groupValue;
groupValue++;
-
if (__mf_ug_genlist_is_file_marked(ugd->ug_UiGadget.ug_pMultiSelectFileList, ug_ItemData->ug_pItemName)) {
ug_ItemData->ug_bChecked = true;
ugd->ug_Status.ug_iRadioOn = ug_ItemData->ug_iGroupValue;
}
+
+ it = elm_genlist_item_append(genlist, &ugd->ug_Status.ug_itc, ug_ItemData, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ } else if (ugd->ug_UiGadget.ug_iSelectMode == EXPORT_MODE) {
+ it = elm_genlist_item_append(genlist, &ugd->ug_Status.ug_normalitc, ug_ItemData, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ } else {
+ it = elm_genlist_item_append(genlist, &ugd->ug_Status.ug_itc, ug_ItemData, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
- it = elm_genlist_item_append(genlist, &ugd->ug_Status.ug_itc, ug_ItemData, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
ug_ItemData->ug_pItem = it;
+#if 0
+ if ((ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE) && ug_ItemData->ug_bChecked) {
+ if (ugd->ug_Status.ug_bUpperFlag ) {
+ if (count > MF_UG_SELECTED_ITEM_BRING_UP_COUNT)
+ elm_genlist_item_top_show(it);
+ } else {
+ if (count > MF_UG_SELECTED_ITEM_BRING_UP_COUNT_MAX)
+ elm_genlist_item_top_show(it);
+ }
+ }
+#endif
ug_debug();
if (real_name) {
ug_debug("free real_name\n");
@@ -1309,57 +1484,36 @@ Evas_Object *mf_ug_genlist_create_content_list_view(void *data) return genlist;
}
+static char *__get_title_gl_text(void *data, Evas_Object *obj, const char *part)
+{
+ if (data)
+ return g_strdup((char *)data);
+ else
+ return NULL;
+}
+static void __del_title_gl(void *data, Evas_Object * obj)
+{
+ UG_SAFE_FREE_CHAR(data);
+}
-/******************************
-** Prototype : mf_ug_genlist_update_main_layout_content
-** Description : Samsung
-** Input : void *data
-** char* pItemLabel
-** Output : None
-** Return Value :
-** Calls :
-** Called By :
-**
-** History :
-** 1.Date : 2010/12/10
-** Author : Samsung
-** Modification : Created function
-**
-******************************/
-void mf_ug_genlist_update_main_layout_content(void *data, char *pItemLabel)
+Evas_Object *mf_ug_genlist_create_path_info(Evas_Object *parent, Elm_Genlist_Item_Class *itc, char *info)
{
- ugData *ugd = (ugData *)data;
- ug_mf_retm_if(ugd == NULL, "ugd is NULL");
+ ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL");
- ug_mf_retm_if(pItemLabel == NULL, "invalid parameter pItemLabel");
- Evas_Object *pOldContent = NULL;
- /*/1. delete the sepcified item from tab bar */
- /*/1.1 get navi bar pointer from the control bar item */
- Evas_Object *pNaviBar_toDel = ug_mf_navi_bar_get_navibar_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, pItemLabel);
-
- ugNaviBar *pNavi_s = mf_ug_navi_bar_get_navi_struct_by_navi(ugd, pNaviBar_toDel);
- /*/1.2 delete the item */
- evas_object_del(pNaviBar_toDel);
- mf_ug_tab_bar_remove_item_by_label(ugd->ug_MainWindow.ug_pTabBar, pItemLabel);
- /*2. delete the item from navigation bar list */
- Eina_List *plistNaviMMC = eina_list_data_find_list(ugd->ug_MainWindow.ug_pNaviBarList, pNavi_s);
- /*/2.1 Todo: clear all the data in the structure. */
- mf_ug_navi_bar_reset_navi_object(pNavi_s);
- /*/2.2 remove from the list. */
- ugd->ug_MainWindow.ug_pNaviBarList = eina_list_remove_list(ugd->ug_MainWindow.ug_pNaviBarList, plistNaviMMC);
- /*/2.3 set first navi as navi in use */
- pNavi_s = (ugNaviBar *)eina_list_nth(ugd->ug_MainWindow.ug_pNaviBarList, 1);
- pNavi_s->ug_bNaviFlagInUse = TRUE;
- /*/3. check if tab bar has at least 2 items */
- if (eina_list_count(ugd->ug_MainWindow.ug_pNaviBarList) < 2) {
- /*/no: tab bar delete operation */
- pOldContent = elm_object_part_content_unset(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content");
- evas_object_del(pOldContent);
- /*/3.1 get pNavi Inuse */
- pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
- elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", pNavi_s->ug_pNaviBar);
- } else {
- /*/yes: do nothing */
- //elm_toolbar_item_selected_set(elm_toolbar_first_item_get(ugd->ug_MainWindow.ug_pTabBar), EINA_TRUE);
- }
+ Evas_Object *genlist = NULL;
+ Evas_Object *index = NULL;
+ Elm_Object_Item *git=NULL;
+
+ genlist = elm_genlist_add(parent);
+ elm_genlist_homogeneous_set(genlist, EINA_TRUE);
+
+ itc->item_style = "grouptitle";
+ itc->func.text_get = __get_title_gl_text;
+ itc->func.del = __del_title_gl;
+
+ git = elm_genlist_item_append(genlist, itc, info, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ return genlist;
}
+
diff --git a/src/widget/mf-ug-navi-bar.c b/src/widget/mf-ug-navi-bar.c index b94700c..da69082 100755..100644 --- a/src/widget/mf-ug-navi-bar.c +++ b/src/widget/mf-ug-navi-bar.c @@ -1,22 +1,24 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
#include "mf-ug-winset.h"
#include "mf-ug-cb.h"
#include "mf-ug-fm-svc-wrapper.h"
@@ -80,17 +82,19 @@ static void __mf_ug_navi_bar_create_group_radio_box(void *data) ** Modification : Created function
**
******************************/
-static void __mf_ug_navi_bar_push_content(ugNaviBar *pNavi_s, Evas_Object *NaviContent)
+static void __mf_ug_navi_bar_push_content(void *data, Evas_Object *NaviContent)
{
UG_TRACE_BEGIN;
- ug_mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
+ ug_mf_retm_if(data == NULL, "pNavi_s is NULL");
+ ugData *ugd = (ugData *)data;
+ ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
- Evas_Object *NaviBar = pNavi_s->ug_pNaviBar;
+ Evas_Object *NaviBar = ugd->ug_MainWindow.ug_pNaviBar;
char *title = pNavi_s->ug_pNaviTitle;
- pNavi_s->ug_pPreNaviItem = pNavi_s->ug_pNaviItem;
+ ugd->ug_MainWindow.ug_pPreNaviItem = ugd->ug_MainWindow.ug_pNaviItem;
- pNavi_s->ug_pNaviItem = elm_naviframe_item_push(NaviBar, title, NULL, NULL, NaviContent, MF_UG_NAVI_STYLE_ENABLE);
+ ugd->ug_MainWindow.ug_pNaviItem = elm_naviframe_item_push(NaviBar, title, NULL, NULL, NaviContent, MF_UG_NAVI_STYLE_ENABLE);
UG_TRACE_END;
}
@@ -169,25 +173,9 @@ void mf_ug_navi_bar_set_select_info_label(void *data, int dir_count, int file_co char lable_file[UG_LABEL_STRING_LENGTH] = { '\0', };
char *select_lable = NULL;
/*1 TODO: need to update for multi-language */
- if (dir_count > 1) {
- snprintf(lable_dir, sizeof(lable_dir), "%d %s", dir_count, ("folders"));
- } else if (dir_count == 1) {
- snprintf(lable_dir, sizeof(lable_dir), "%d %s", dir_count, ("folder"));
- }
- if (file_count > 1) {
- snprintf(lable_file, sizeof(lable_file), "%d %s", file_count, ("files"));
- } else if (file_count == 1) {
- snprintf(lable_file, sizeof(lable_file), "%d %s", file_count, ("file"));
- }
-
- if (dir_count < 1) {
- select_lable = g_strconcat("Selected (", lable_file, ")", NULL);
- } else if (file_count < 1) {
- select_lable = g_strconcat("Selected (", lable_dir, ")", NULL);
- } else {
- select_lable = g_strconcat("Selected (", lable_dir, " , ", lable_file, ")", NULL);
- }
+ snprintf(lable_file, sizeof(lable_file), "%d", (dir_count+file_count));
+ select_lable = g_strconcat("Selected (", lable_file, ")", NULL);
elm_object_part_text_set(ugd->ug_MainWindow.ug_pSelectInfoLayout, "elm.text", select_lable);
edje_object_part_text_set(_EDJ(ugd->ug_MainWindow.ug_pSelectInfoLayout), "elm.text", select_lable);
@@ -264,7 +252,6 @@ Evas_Object *mf_ug_navi_bar_create_box(Evas_Object * parent) ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL");
Evas_Object *box = NULL;
- ug_debug("parent is [%p]", parent);
box = elm_box_add(parent);
ug_mf_retvm_if(box == NULL, NULL, "box is NULL");
elm_object_focus_set(box, EINA_FALSE);
@@ -313,33 +300,13 @@ Evas_Object *mf_ug_navi_bar_create_layout(Evas_Object *parent, const char *edj, ** Modification : Created function
**
******************************/
-Evas_Object *mf_ug_navi_bar_pathinfo_label_create(Evas_Object *parent, char *pathinfo)
+Evas_Object *__mf_ug_navi_bar_pathinfo_create(Evas_Object *parent, Evas_Object *content)
{
UG_TRACE_BEGIN;
ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL");
- ug_mf_retvm_if(pathinfo == NULL, NULL, "pathinfo is NULL");
-
- Evas_Object *label = NULL;
-
- label = elm_label_add(parent);
- elm_object_focus_set(label, EINA_FALSE);
- evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_object_text_set(label, pathinfo);
- evas_object_show(label);
- UG_SAFE_FREE_CHAR(pathinfo);
- UG_TRACE_END;
- return label;
-}
-
-Evas_Object *__mf_ug_navi_bar_pathinfo_create(Evas_Object *parent, char *pathinfo)
-{
- UG_TRACE_BEGIN;
- ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL");
- ug_mf_retvm_if(pathinfo == NULL, NULL, "pathinfo is NULL");
+ ug_mf_retvm_if(content == NULL, NULL, "content is NULL");
Evas_Object *layout = NULL;
- Evas_Object *label = NULL;
layout = elm_layout_add(parent);
elm_object_focus_set(layout, EINA_FALSE);
@@ -347,8 +314,7 @@ Evas_Object *__mf_ug_navi_bar_pathinfo_create(Evas_Object *parent, char *pathinf 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);
- label = mf_ug_navi_bar_pathinfo_label_create(layout, pathinfo);
- elm_object_part_content_set(layout, "info", label);
+ elm_object_part_content_set(layout, "info", content);
evas_object_show(layout);
UG_TRACE_END;
return layout;
@@ -375,8 +341,7 @@ void mf_ug_navi_bar_create_default_view(void *data) mf_ug_list_play_destory_playing_file(ugd);
}
- box = mf_ug_navi_bar_create_box(pNavi_s->ug_pNaviBar);
- pNavi_s->ug_pNaviBox = box;
+ box = mf_ug_navi_bar_create_box(ugd->ug_MainWindow.ug_pNaviBar);
if (ugd->ug_Status.ug_bSettingEntry == true && ugd->ug_Status.ug_bInSettingView == true) {
top_layout = mf_ug_navi_bar_create_box(box);
@@ -400,22 +365,34 @@ void mf_ug_navi_bar_create_default_view(void *data) pathinfo = mf_ug_fm_svc_wapper_path_info_get(ugd->ug_Status.ug_pPath->str);
info = mf_ug_fm_svc_path_info_translate(pathinfo, MF_UG_PATH_INFO_MAX_LENGTH_PORTRAIT);
- pathinfo_layout = __mf_ug_navi_bar_pathinfo_create(top_layout, info);
+
+ Evas_Object *genlist = mf_ug_genlist_create_path_info(top_layout, &ugd->ug_Status.ug_pathinfoitec, info);
+
+ pathinfo_layout = __mf_ug_navi_bar_pathinfo_create(top_layout, genlist);
+
upper_layout = elm_layout_add(top_layout);
elm_object_focus_set(upper_layout, EINA_FALSE);
elm_layout_file_set(upper_layout, UG_EDJ_NAVIGATIONBAR, UG_GRP_UPPER_LAYOUT);
- evas_object_size_hint_weight_set(upper_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_weight_set(upper_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);//(upper_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(upper_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(upper_layout);
- upper_genlist = mf_navi_bar_upper_create(top_layout);
- //mf_ug_genlist_upper_style_set(ugd);
- mf_ug_upper_genlist_item_append(upper_genlist, ugd);
+ Evas_Object *home_btn = elm_button_add(upper_layout);
+ elm_object_text_set(home_btn, MF_UG_LABEL_HOME);
+ evas_object_smart_callback_add(home_btn, "clicked", mf_ug_cb_home_button_cb, ugd);
+ evas_object_show(home_btn);
+
+ Evas_Object *up_btn = elm_button_add(upper_layout);
+ elm_object_text_set(up_btn, MF_UG_LABEL_UPPER);
+ evas_object_smart_callback_add(up_btn, "clicked", mf_ug_cb_upper_click_cb, ugd);
+ evas_object_show(up_btn);
+
+ elm_object_part_content_set(upper_layout, "home", home_btn);
+ elm_object_part_content_set(upper_layout, "upper", up_btn);
- elm_object_part_content_set(upper_layout, "upper", upper_genlist);
- elm_box_pack_end(top_layout, pathinfo_layout);
elm_box_pack_end(top_layout, upper_layout);
+ elm_box_pack_end(top_layout, pathinfo_layout);
ugd->ug_Status.ug_bUpperFlag = true;
}
@@ -426,13 +403,13 @@ void mf_ug_navi_bar_create_default_view(void *data) }
pNaviLayout = mf_ug_navi_bar_create_layout(box, UG_EDJ_NAVIGATIONBAR, UG_GRP_NAVI_VIEW);
- pNavi_s->ug_pNaviLayout = pNaviLayout;
+ ugd->ug_MainWindow.ug_pNaviLayout = pNaviLayout;
/*set content */
if (ugd->ug_UiGadget.ug_iSelectMode == SINGLE_ALL_MODE || ugd->ug_UiGadget.ug_iSelectMode == SINGLE_FILE_MODE) {
__mf_ug_navi_bar_create_group_radio_box(ugd);
}
newContent = mf_ug_genlist_create_content_list_view(ugd);
- pNavi_s->ug_pContent = newContent;
+ ugd->ug_MainWindow.ug_pContent = newContent;
/*set title segment or title */
if (mf_ug_fm_svc_wapper_is_root_path(ugd)) {
title = g_string_new(MF_UG_LABEL_MYFILES);
@@ -449,19 +426,77 @@ void mf_ug_navi_bar_create_default_view(void *data) evas_object_show(newContent);
elm_object_part_content_set(pNaviLayout, "part1", newContent);
elm_box_pack_end(box, pNaviLayout);
- __mf_ug_navi_bar_push_content(pNavi_s, box);
+ __mf_ug_navi_bar_push_content(ugd, box);
/*add control bar for navigation bar */
mf_ug_ctrl_bar_set(ugd, pNavi_s);
-#ifdef MF_UG_FEATURE_NEW_UX
- if (ugd->ug_Status.ug_iMmcFlag == MMC_ON && !(ugd->ug_Status.ug_bSettingEntry == true && ugd->ug_Status.ug_bInSettingView == true))
- elm_naviframe_item_title_visible_set(pNavi_s->ug_pNaviItem, EINA_FALSE);
-#endif
+
+ if ((ugd->ug_Status.ug_bSettingEntry == true && ugd->ug_Status.ug_bInSettingView == true)) {
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_TRUE);
+ } else if (!mf_ug_fm_svc_wapper_is_root_path(ugd)) {
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_FALSE);
+ } else if (ugd->ug_Status.ug_iMmcFlag == MMC_OFF && mf_ug_fm_svc_wapper_is_root_path(ugd)) {
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_TRUE);
+ } else {
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_FALSE);
+ }
mf_ug_navi_bar_remove_previous_contents(ugd);
UG_TRACE_END;
}
+void mf_ug_navi_bar_create_new_folder_view(void *data)
+{
+
+ UG_TRACE_BEGIN;
+ ugData *ugd = (ugData *)data;
+ ug_mf_retm_if(ugd == NULL, "ugd is NULL");
+
+ Evas_Object *newContent = NULL;
+
+ Evas_Object *pNaviBar = NULL;
+ GString *title = NULL;
+
+ mf_ug_navi_bar_set_navi_to_main(ugd);
+
+ ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
+ ug_mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
+
+ pNaviBar = ugd->ug_MainWindow.ug_pNaviBar;
+
+ /*set content*/
+ newContent = mf_ug_genlist_create_list_new_folder_style(ugd);
+ /*set title segment or title*/
+ title = g_string_new(MF_UG_LABEL_CREATE);
+
+ if (title != NULL) {
+ pNavi_s->ug_pNaviTitle = g_strdup(title->str);
+ g_string_free(title, TRUE);
+ title = NULL;
+ }
+ /*navigation view integration*/
+ __mf_ug_navi_bar_push_content(ugd, newContent);
+
+ Evas_Object *l_bt = NULL;
+ Evas_Object *r_bt = NULL;
+ r_bt = elm_button_add(pNaviBar);
+ elm_object_focus_set(r_bt, EINA_FALSE);
+ elm_object_style_set(r_bt, "naviframe/title/default");
+ elm_object_text_set(r_bt, MF_UG_LABEL_CANCEL);
+ evas_object_smart_callback_add(r_bt, "clicked", mf_ug_cb_cancel_new_folder_cb, ugd);
+ elm_object_item_part_content_set(ugd->ug_MainWindow.ug_pNaviItem, "title_right_btn", r_bt);
+
+ l_bt = elm_button_add(pNaviBar);
+ elm_object_focus_set(l_bt, EINA_FALSE);
+ elm_object_style_set(l_bt, "naviframe/title/default");
+ elm_object_text_set(l_bt, MF_UG_LABEL_SAVE);
+ evas_object_smart_callback_add(l_bt, "clicked", mf_ug_cb_save_cb, ugd);
+ elm_object_item_part_content_set(ugd->ug_MainWindow.ug_pNaviItem, "title_left_btn", l_bt);
+
+
+
+}
+
/******************************
** Prototype : mf_ug_navi_bar_get_in_use_navi
** Description : Samsung
@@ -498,7 +533,6 @@ ugNaviBar *mf_ug_navi_bar_get_in_use_navi(void *data) ret = NULL;
}
}
- ug_debug(" ret is [%p]", ret);
UG_TRACE_END;
return ret;
}
@@ -524,9 +558,6 @@ void mf_ug_navi_bar_reset_navi_object(ugNaviBar *pNavi_s) UG_TRACE_BEGIN;
ug_mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL");
- UG_SAFE_FREE_OBJ(pNavi_s->ug_pNaviBar);
- pNavi_s->ug_pContent = NULL;
- pNavi_s->ug_pNaviCtrlBar = NULL;
pNavi_s->ug_pNaviTitle = NULL;
if (pNavi_s->ug_pCurrentPath != NULL) {
free(pNavi_s->ug_pCurrentPath);
@@ -539,47 +570,6 @@ void mf_ug_navi_bar_reset_navi_object(ugNaviBar *pNavi_s) }
/******************************
-** Prototype : mf_ug_navi_bar_get_navi_struct_by_navi
-** Description : Samsung
-** Input : void* data
-** Evas_Object* pNaviBar
-** Output : None
-** Return Value :
-** Calls :
-** Called By :
-**
-** History :
-** 1.Date : 2010/12/10
-** Author : Samsung
-** Modification : Created function
-**
-******************************/
-ugNaviBar *mf_ug_navi_bar_get_navi_struct_by_navi(void *data, Evas_Object *pNaviBar)
-{
- UG_TRACE_BEGIN;
- ugData *ugd = (ugData *)data;
- ug_mf_retvm_if(ugd == NULL, NULL, "ugd is NULL");
- ug_mf_retvm_if(pNaviBar == NULL, NULL, "pNaviBar is NULL");
-
- Eina_List *pNaviList = ugd->ug_MainWindow.ug_pNaviBarList;
- ug_mf_retvm_if(pNaviList == NULL, NULL, "pNavi_sList is NULL");
-
- Eina_List *l = NULL;
- void *item = NULL;
-
- ugNaviBar *ret = NULL;
- EINA_LIST_FOREACH(pNaviList, l, item) {
- if (((ugNaviBar *)item)->ug_pNaviBar == pNaviBar) {
- ret = (ugNaviBar *)item;
- break;
- }
- }
- UG_TRACE_END;
- return ret;
-}
-
-
-/******************************
** Prototype : mf_ug_navi_bar_get_navi_struct_by_label
** Description : Samsung
** Input : void* data
@@ -694,8 +684,8 @@ void mf_ug_navi_bar_refresh_navibar_recovered_view(void *data, ugNaviBar *pNaviS ugd->ug_Status.ug_pPath = g_string_new(pNaviStruct->ug_pCurrentPath);
Evas_Object *newContent = mf_ug_genlist_create_content_list_view(ugd);
- pNaviStruct->ug_pContent = newContent;
- mf_ug_navi_bar_set_new_content(pNaviStruct->ug_pNaviLayout, newContent);
+ ugd->ug_MainWindow.ug_pContent = newContent;
+ mf_ug_navi_bar_set_new_content(ugd->ug_MainWindow.ug_pNaviLayout, newContent);
UG_TRACE_END;
}
@@ -705,10 +695,9 @@ void mf_ug_navi_bar_transition_finished_cb(void *data, Evas_Object *obj, void *e ug_mf_retm_if(data == NULL, "data is NULL");
ug_mf_retm_if(obj == NULL, "obj is NULL");
ugData *ugd = (ugData *)data;
- ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
- Elm_Object_Item *it = pNavi_s->ug_pPreNaviItem;
+ Elm_Object_Item *it = ugd->ug_MainWindow.ug_pPreNaviItem;
UG_SAFE_DEL_NAVI_ITEM(it);
- pNavi_s->ug_pPreNaviItem = NULL;
+ ugd->ug_MainWindow.ug_pPreNaviItem = NULL;
mf_ug_navi_bar_set_blocking(data, false);
evas_object_smart_callback_del(obj, "transition,finished", mf_ug_navi_bar_transition_finished_cb);
UG_TRACE_END;
@@ -721,9 +710,8 @@ void mf_ug_navi_bar_remove_previous_contents(void *data) ug_mf_retm_if(data == NULL, "data is NULL");
ugData *ugd = (ugData *)data;
Evas_Object *pNaviBar = NULL;
- ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
- if (pNavi_s && pNavi_s->ug_pNaviBar) {
- pNaviBar = pNavi_s->ug_pNaviBar;
+ if (ugd->ug_MainWindow.ug_pNaviBar) {
+ pNaviBar = ugd->ug_MainWindow.ug_pNaviBar;
mf_ug_navi_bar_set_blocking(data, true);
evas_object_smart_callback_add(pNaviBar, "transition,finished", mf_ug_navi_bar_transition_finished_cb, ugd);
}
@@ -739,11 +727,11 @@ void mf_ug_navi_bar_del_item_directly(void *data) if (ugd->ug_Status.ug_b_NaviPushFlag) {
ugNaviBar *pNavi_s_previous = NULL;
pNavi_s_previous = mf_ug_navi_bar_get_in_use_navi(ugd) ;
- if(pNavi_s_previous && pNavi_s_previous->ug_pPreNaviItem)
+ if(pNavi_s_previous && ugd->ug_MainWindow.ug_pPreNaviItem)
{
- UG_SAFE_DEL_NAVI_ITEM(pNavi_s_previous->ug_pPreNaviItem);
+ UG_SAFE_DEL_NAVI_ITEM(ugd->ug_MainWindow.ug_pPreNaviItem);
mf_ug_navi_bar_set_blocking(ugd, false);
- evas_object_smart_callback_del(pNavi_s_previous->ug_pNaviBar, "transition,finished", mf_ug_navi_bar_transition_finished_cb);
+ evas_object_smart_callback_del(ugd->ug_MainWindow.ug_pNaviBar, "transition,finished", mf_ug_navi_bar_transition_finished_cb);
}
}
UG_TRACE_END;
@@ -782,13 +770,47 @@ ugNaviBar *ug_mf_navi_bar_get_navi_from_navilist(Eina_List *navilist, const char return NULL;
}
-Evas_Object *ug_mf_navi_bar_get_navibar_from_navilist(Eina_List *navilist, const char *label)
+void mf_ug_navi_bar_set_navi_to_main(void *data)
{
- ugNaviBar *pNavi_s = NULL;
- pNavi_s = ug_mf_navi_bar_get_navi_from_navilist(navilist, label);
- if (pNavi_s && pNavi_s->ug_pNaviBar)
- return pNavi_s->ug_pNaviBar;
- else
- return NULL;
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is NULL");
+ ugData *ugd = (ugData *)data;
+
+ if (ugd->ug_Status.ug_iMmcFlag != MMC_OFF) {
+ elm_object_part_content_unset(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.content");
+ evas_object_hide(ugd->ug_MainWindow.ug_pTabBar);
+ elm_object_part_content_unset(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.tabbar");
+ evas_object_hide(ugd->ug_MainWindow.ug_pTabLayout);
+ elm_object_part_content_unset(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content");
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pNaviBar);
+ evas_object_show(ugd->ug_MainWindow.ug_pMainLayout);
+ }
+ UG_TRACE_END;
+}
+
+void mf_ug_navi_bar_reset_tab_to_main(void *data)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is NULL");
+ ugData *ugd = (ugData *)data;
+ ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd);
+
+ if (ugd->ug_Status.ug_iMmcFlag != MMC_OFF) {
+ if (mf_ug_fm_svc_wapper_is_root_path(ugd)) {
+ Evas_Object *pOldContent = NULL;
+ pOldContent = elm_object_part_content_unset(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content");
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.content", pOldContent);
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.tabbar", ugd->ug_MainWindow.ug_pTabBar);
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pTabLayout);
+ evas_object_show(ugd->ug_MainWindow.ug_pTabLayout);
+ evas_object_show(ugd->ug_MainWindow.ug_pTabBar);
+ mf_ug_tab_bar_set_selected_item(mf_ug_tab_bar_get_item_by_label(ugd->ug_MainWindow.ug_pTabBar, pNavi_s->ug_pNaviLabel));
+ }
+ } else {
+ elm_object_part_content_unset(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content");
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pMainLayout, "elm.swallow.content", ugd->ug_MainWindow.ug_pNaviBar);
+ elm_naviframe_item_title_visible_set(ugd->ug_MainWindow.ug_pNaviItem, EINA_TRUE);
+ }
+ UG_TRACE_END;
}
diff --git a/src/widget/mf-ug-popup.c b/src/widget/mf-ug-popup.c index cceeb69..f47d857 100755..100644 --- a/src/widget/mf-ug-popup.c +++ b/src/widget/mf-ug-popup.c @@ -1,26 +1,140 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
#include "mf-ug-util.h"
#include "mf-ug-winset.h"
+#include "mf-ug-fs-util.h"
#include "mf-ug-resource.h"
+#define MF_UG_POPUP_STYLE_MIN_MENUSTYLE "min_menustyle"
+#define MF_UG_POPUP_MENUSTYLE_WIDTH (614*elm_config_scale_get())
+#define MF_UG_POPUP_MENUSTYLE_HEIGHT(x) ((113*x-1)*elm_config_scale_get())
+#define MF_UG_POPUP_MENUSTYLE_HEIGHT_MAX (408*elm_config_scale_get())
+Elm_Genlist_Item_Class ug_listby_itc;
+#define MF_UG_ITEM_COUNT 4
+
+typedef struct {
+ int index;
+ ugData* ugd;
+} ugListByData_s;
+
+static int __mf_ug_popup_get_list_by_selected_item(void *data)
+{
+ ug_mf_retvm_if(data == NULL, 0, "data is NULL");
+ ugData *ugd = (ugData *)data;
+
+ int iSortTypeValue = ugd->ug_Status.ug_iSortType;
+
+ int ret = -1;
+ switch (iSortTypeValue) {
+ case MF_UG_SORT_BY_DATE_O2R:
+ case MF_UG_SORT_BY_DATE_R2O:
+ ret = 1;
+ break;
+ case MF_UG_SORT_BY_TYPE_A2Z:
+ case MF_UG_SORT_BY_TYPE_Z2A:
+ ret = 3;
+ break;
+ case MF_UG_SORT_BY_NAME_A2Z:
+ case MF_UG_SORT_BY_NAME_Z2A:
+ ret = 0;
+ break;
+ case MF_UG_SORT_BY_SIZE_S2L:
+ case MF_UG_SORT_BY_SIZE_L2S:
+ ret = 2;
+ break;
+ default:
+ ret = 0;
+ break;
+ }
+ return ret;
+}
+
+
+static char *__mf_ug_popup_get_genlist_label(void *data, Evas_Object * obj, const char *part)
+{
+ ugListByData_s *params = (ugListByData_s *) data;
+ assert(params);
+ ugData *ugd = params->ugd;
+ assert(ugd);
+ assert(part);
+
+ char *ret = NULL;
+ if (!strcmp(part, "elm.text")) {
+ switch (params->index) {
+ case 0: /**< Sort by file name ascending */
+ ret = g_strdup(MF_UG_LABEL_NAME);
+ break;
+ case 1: /**< Sort by file size ascending */
+ ret = g_strdup(MF_UG_LABEL_DATE);
+ break;
+ case 2: /**< Sort by file date ascending */
+ ret = g_strdup(MF_UG_LABEL_SIZE);
+ break;
+ case 3: /**< Sort by file type ascending */
+ ret = g_strdup(MF_UG_LABEL_TYPE);
+ break;
+ default:
+ break;
+ }
+ return ret;
+ }
+ return NULL;
+}
+
+static Evas_Object* __mf_ug_popup_get_genlist_icon(void *data, Evas_Object * obj, const char *part)
+{
+ ugListByData_s *params = (ugListByData_s *) data;
+ assert(params);
+ ugData *ugd = params->ugd;
+ assert(ugd);
+ assert(part);
+
+ if (!strcmp(part, "elm.icon")) {
+ Evas_Object *radio = NULL;
+ radio = elm_radio_add(obj);
+ elm_object_focus_set(radio, EINA_FALSE);
+ elm_radio_state_value_set(radio, params->index);
+ elm_radio_group_add(radio, ugd->ug_Status.ug_pRadioGroup);
+ elm_radio_value_set(radio, ugd->ug_Status.ug_iRadioValue);
+ evas_object_show(radio);
+ return radio;
+ }
+ return NULL;
+}
+
+static void __mf_ug_popup_genlist_select(void *data, Evas_Object * obj, void *event_info)
+{
+ assert(data);
+ assert(event_info);
+ ugListByData_s *params = NULL;
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ if (item != NULL) {
+ params = (ugListByData_s *) elm_object_item_data_get(item);
+ if (params != NULL && params->ugd != NULL) {
+ params->ugd->ug_Status.ug_iSelectedSortType = params->index;
+ elm_radio_value_set(params->ugd->ug_Status.ug_pRadioGroup, params->index);
+ }
+ }
+}
/******************************
** Prototype : mfPopupCreate
@@ -45,20 +159,57 @@ ** Modification : Created function
**
******************************/
-void mf_ug_popup_create(void *data, mf_ug_popup_mode popupMode, char *title, char *context, char *first_btn_text, char *second_btn_text,
- char *third_btn_text, Evas_Smart_Cb func, void *param)
+static Evas_Object *__ug_mf_popup_button_create(Evas_Object *parent, const char *label)
+{
+ Evas_Object *btn = NULL;
+ btn = elm_button_add(parent);
+ if (label) {
+ elm_object_text_set(btn, label);
+ }
+ return btn;
+
+}
+
+static Evas_Object *__mf_ug_popup_box_set(Evas_Object *parent, Evas_Object *content, int item_cnt)
+{
+ ug_mf_retvm_if(parent == NULL, NULL, "parent is NULL");
+ ug_mf_retvm_if(content == NULL, NULL, "content is NULL");
+ ug_mf_retvm_if(item_cnt < 0, NULL, "content is NULL");
+
+ Evas_Object *box = elm_box_add(parent);
+ if (item_cnt > MF_UG_ITEM_COUNT) {
+ evas_object_size_hint_min_set(box, MF_UG_POPUP_MENUSTYLE_WIDTH,
+ MF_UG_POPUP_MENUSTYLE_HEIGHT(item_cnt));
+ } else {
+ evas_object_size_hint_min_set(box, MF_UG_POPUP_MENUSTYLE_WIDTH,
+ MF_UG_POPUP_MENUSTYLE_HEIGHT(item_cnt));
+ }
+
+ evas_object_show(content);
+ elm_box_pack_end(box, content);
+ return box;
+}
+
+void mf_ug_popup_create(void *data, mf_ug_popup_mode popupMode, char *title, const char *context, const char *first_btn_text, const char *second_btn_text,
+ const char *third_btn_text, Evas_Smart_Cb func, void *param)
{
Evas_Object *popup;
ugData *ugd = (ugData *)data;
ug_mf_retm_if(ugd == NULL, "ugd is NULL");
+
+ Evas_Object *genlist;
+ Evas_Object *radio_group = NULL;
+ Evas_Object *box = NULL;
Evas_Object *btn1 = NULL;
Evas_Object *btn2 = NULL;
+ int index = 0;
+ int listby_selected= 0;
popup = elm_popup_add(ugd->ug_MainWindow.ug_pMainLayout);
ugd->ug_MainWindow.ug_pNormalPopup = popup;
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
if (title) {
- elm_object_part_text_set(popup, "elm.title", title);
+ elm_object_part_text_set(popup, "title,text", title);
}
if (context && popupMode != UG_POPMODE_PROGRESSBAR) {
elm_object_text_set(popup, context);
@@ -87,9 +238,64 @@ void mf_ug_popup_create(void *data, mf_ug_popup_mode popupMode, char *title, cha evas_object_smart_callback_add(btn1, "clicked", func, param);
elm_object_part_content_set(popup, "button1", btn1);
break;
+ case UG_POPMODE_SEARCH:
+ btn1 = __ug_mf_popup_button_create(popup, MF_UG_LABEL_CANCEL);
+ evas_object_smart_callback_add(btn1, "clicked", func, param);
+ elm_object_part_content_set(popup, "button1", btn1);
+ break;
+ case UG_POPMODE_LIST_BY:
+ elm_object_style_set(popup, MF_UG_POPUP_STYLE_MIN_MENUSTYLE);
+
+ btn1 = __ug_mf_popup_button_create(popup, MF_UG_LABEL_ASCENDING);
+ evas_object_smart_callback_add(btn1, "clicked", func, param);
+ elm_object_part_content_set(popup, "button1", btn1);
+
+ btn2 = __ug_mf_popup_button_create(popup, MF_UG_LABEL_DESCENDING);
+ evas_object_smart_callback_add(btn2, "clicked", func, param);
+ elm_object_part_content_set(popup, "button2", btn2);
+
+ if (ugd->ug_Status.ug_pRadioGroup) {
+ evas_object_del(ugd->ug_Status.ug_pRadioGroup);
+ ugd->ug_Status.ug_pRadioGroup = NULL;
+ }
+
+ radio_group = elm_radio_add(ugd->ug_MainWindow.ug_pWindow);
+ elm_object_focus_set(radio_group, EINA_FALSE);
+ elm_radio_value_set(radio_group, 0);
+ evas_object_hide(radio_group);
+ ugd->ug_Status.ug_pRadioGroup = radio_group;
+
+ listby_selected = __mf_ug_popup_get_list_by_selected_item(ugd);
+ ugd->ug_Status.ug_iRadioValue = listby_selected;
+
+ ug_listby_itc.item_style = "1text.1icon.2";
+ ug_listby_itc.func.text_get = __mf_ug_popup_get_genlist_label;
+ ug_listby_itc.func.content_get = __mf_ug_popup_get_genlist_icon;
+ ug_listby_itc.func.state_get = NULL;
+ ug_listby_itc.func.del = NULL;
+ genlist = elm_genlist_add(popup);
+ elm_object_focus_set(genlist, EINA_FALSE);
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ for (index = 0; index < MF_UG_ITEM_COUNT; index++) {
+ Elm_Object_Item *it = NULL;
+ ugListByData_s *item_data = malloc(sizeof(ugListByData_s));
+ if (item_data == NULL)
+ continue;
+
+ item_data->index = index;
+ item_data->ugd = ugd;
+ it = elm_genlist_item_append(genlist, &ug_listby_itc, (void *)item_data, NULL,
+ ELM_GENLIST_ITEM_NONE, __mf_ug_popup_genlist_select, popup);
+ }
+
+ box = __mf_ug_popup_box_set(popup, genlist, MF_UG_ITEM_COUNT);
+ elm_object_content_set(popup, box);
+ evas_object_smart_callback_add(popup, "response", func, param);
+
+ break;
default:
return;
}
evas_object_show(popup);
}
-
diff --git a/src/widget/mf-ug-search-view.c b/src/widget/mf-ug-search-view.c new file mode 100644 index 0000000..3497e36 --- /dev/null +++ b/src/widget/mf-ug-search-view.c @@ -0,0 +1,366 @@ +/* + * myfile + * + * Copyright 2012 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.tizenopensource.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + + +#include <Eina.h> +#include <Ecore_X.h> + +#include "mf-ug-main.h" +#include "mf-ug-util.h" +#include "mf-ug-winset.h" +#include "mf-ug-fs-util.h" +#include "mf-ug-resource.h" + +#define MF_SEARCH_OPTION_DEF (MF_SEARCH_OPT_EXT) +#define MF_SEARCH_ROOT_NUM 1 +#define MF_SEARCH_TIMER_INTERVAL 0.5 + +extern int flagSearchMsg; +extern pthread_mutex_t gLockSearchMsg; +extern pthread_cond_t gCondSearchMsg; + +typedef struct { + char *size; + char *create_date; +} mf_search_detail_infor_s; + + +static void __mf_ug_search_view_search_bar_click_item(ugData *data, GString * path) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + + if (ugd->ug_Status.search_handler > 0) { + mf_ug_search_stop(ugd->ug_Status.search_handler); + mf_ug_search_finalize(&ugd->ug_Status.search_handler); + } + + ug_debug("result is [%s]", path->str); + + service_h service; + + int ret = 0; + ret = service_create(&service); + + if (ret == SERVICE_ERROR_NONE) { + service_add_extra_data(service, "result", path->str); + ug_send_result(ugd->ug, service); + service_destroy(service); + + } + + ug_destroy_me(ugd->ug); + + UG_TRACE_END; +} + +static void __mf_ug_search_view_item_sel(void *data, Evas_Object * obj, void *event_info) +{ + ug_debug("Start"); + assert(data); + + Elm_Object_Item *item = (Elm_Object_Item *) event_info; + if (item != NULL) { + ugListItemData *selected = (ugListItemData *) elm_object_item_data_get(item); + + elm_genlist_item_selected_set(item, FALSE); + __mf_ug_search_view_search_bar_click_item(data, selected->ug_pItemName); + } +} + + +void mf_ug_search_view_item_append(void *data, void *user_data) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)user_data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + + ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd); + ug_mf_retm_if(pNavi_s == NULL, "get navi failed"); + + char *item_name = (char *)data; + ug_mf_retm_if(item_name == NULL, "input item_name error"); + + ugListItemData *m_TempItem = NULL; + GString *search_path = g_string_new(item_name); + + + g_string_free(search_path, TRUE); + search_path = NULL; + + m_TempItem = (ugListItemData *) malloc(sizeof(ugListItemData)); + + if (m_TempItem == NULL) { + return; + } + memset(m_TempItem, 0, sizeof(ugListItemData)); + + m_TempItem->ug_pItemName = g_string_new(item_name); + m_TempItem->ug_iGroupValue = 0; + m_TempItem->ug_pRadioBox = NULL; + m_TempItem->ug_bChecked = FALSE; + m_TempItem->ug_pCheckBox = NULL; + m_TempItem->ug_pThumbPath = NULL; + m_TempItem->ug_bRealThumbFlag = FALSE; + m_TempItem->ug_pData = ugd; + m_TempItem->ug_pItem = NULL; + + if (pNavi_s == NULL) { + UG_SAFE_FREE_GSTRING(m_TempItem->ug_pItemName); + UG_SAFE_FREE_CHAR(m_TempItem); + ug_debug("input data error"); + return; + } + /*delete timer if exists*/ + +#ifdef UG_THUMB_REAL_TIME_UPDATE + if (ugd->ug_Status.ug_pThumbUpdateTimer != NULL) { + ecore_timer_del(ugd->ug_Status.ug_pThumbUpdateTimer); + ugd->ug_Status.ug_pThumbUpdateTimer = NULL; + } +#endif + Elm_Object_Item *it = NULL; + + it = elm_genlist_item_append(ugd->ug_MainWindow.ug_pContent, &ugd->ug_Status.ug_itc, m_TempItem, NULL, ELM_GENLIST_ITEM_NONE, __mf_ug_search_view_item_sel, ugd); + m_TempItem->ug_pItem = it; + UG_TRACE_END; + +} + +static void __mf_ug_search_view_result_cb(mf_search_result_t *result, void *user_data) +{ + ug_mf_retm_if(result == NULL, "result is NULL"); + + ugData *ugd = (ugData *)user_data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + + ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd); + ug_mf_retm_if(pNavi_s == NULL, "get navi failed"); + + if (g_list_length(result->dir_list) + g_list_length(result->file_list) == 0) { + mf_ug_popup_create(ugd, UG_POPMODE_TEXT, NULL, MF_UG_LABEL_NO_RESULT, NULL, NULL, NULL, NULL, NULL); + ugd->ug_Status.ug_iMore = UG_MORE_DEFAULT; + + } else { + + Evas_Object *playout = ugd->ug_MainWindow.ug_pNaviLayout; + ug_mf_retm_if(playout == NULL, "get conformant failed"); + Evas_Object *newContent = NULL; + + Evas_Object *unUsed = elm_object_part_content_unset(playout, "part1"); + evas_object_del(unUsed); + + //newContent = mf_ug_genlist_create_content_list_view(ugd); + newContent = __mf_ug_genlist_create_gl(ugd); + ugd->ug_MainWindow.ug_pContent = newContent; + + elm_object_part_content_set(playout, "part1", newContent); + + if (result->dir_list != NULL) { + g_list_foreach(result->dir_list, mf_ug_search_view_item_append, ugd); + } + if (result->file_list != NULL) { + g_list_foreach(result->file_list, mf_ug_search_view_item_append, ugd); + } + mf_ug_ctrl_bar_listby_item_diable(ugd->ug_MainWindow.ug_pNaviCtrlBar, true); + } +} + + +static Eina_Bool __mf_ug_search_view_stop(void *data) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + ug_mf_retm_if(ugd->ug_Status.callback_label == NULL, "ugd->ug_Status.callback_label is NULL"); + ug_mf_retm_if(ugd->ug_Status.callback_timer == NULL, "ugd->ug_Status.callback_timer is NULL"); + + const char *label = ugd->ug_Status.callback_label; + + if (g_strcmp0(label, MF_UG_LABEL_CANCEL) == 0 ) { + + if (ugd->ug_UiGadget.ug_pSyncPipe != NULL) { + ecore_pipe_del(ugd->ug_UiGadget.ug_pSyncPipe); + ugd->ug_UiGadget.ug_pSyncPipe = NULL; + } + + __mf_ug_search_view_result_cb(((ms_handle_t *) ugd->ug_Status.search_handler)->result, ugd); + + if (ugd->ug_Status.search_handler > 0) { + mf_ug_search_stop(ugd->ug_Status.search_handler); + } + + evas_object_del(ugd->ug_MainWindow.ug_pNormalPopup); + ugd->ug_MainWindow.ug_pNormalPopup = NULL; + + if (ugd->ug_Status.search_handler > 0) { + mf_ug_search_finalize(&ugd->ug_Status.search_handler); + } + + } + ugd->ug_Status.callback_label = NULL; + ugd->ug_Status.callback_timer = NULL; + UG_TRACE_END; + return ECORE_CALLBACK_CANCEL; +} + +static void __mf_ug_search_view_stop_cb(void *data, Evas_Object * obj, void *event_info) { + + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + + if (ugd->ug_Status.callback_label != NULL || ugd->ug_Status.callback_timer != NULL) { + return; + } + + Evas_Object *btn = (Evas_Object *)obj; + ugd->ug_Status.callback_label = elm_object_text_get(btn); + ugd->ug_Status.callback_timer = ecore_timer_add(1.0, __mf_ug_search_view_stop, ugd); + + UG_TRACE_END; +} + + +static int __mf_ug_search_view_idle_search_msg_cope_finished(void *data) +{ + pthread_mutex_lock(&gLockSearchMsg); + if (flagSearchMsg == 0) { + flagSearchMsg = 1; + pthread_cond_signal(&gCondSearchMsg); + } + pthread_mutex_unlock(&gLockSearchMsg); + + return ECORE_CALLBACK_CANCEL; +} + +static void __mf_ug_search_view_pipe_cb(void *data, void *buffer, unsigned int nbyte) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + if (ugd == NULL) { + ug_debug("input ugd is NULL"); + goto MF_CONTINURE_SEARCH; + } + + mf_search_pipe_msg *pSearchMsg = (mf_search_pipe_msg *) buffer; + if (pSearchMsg == NULL) { + ug_debug("received message is NULL"); + goto MF_CONTINURE_SEARCH; + } + + if (pSearchMsg->mf_sp_msg_type == MF_SEARCH_PIPE_MSG_RESULT_REPORT) { + ug_debug("result get"); + } else if (pSearchMsg->mf_sp_msg_type == MF_SEARCH_PIPE_MSG_ROOT_CHANGE) { + ug_debug("root change "); + } else if (pSearchMsg->mf_sp_msg_type == MF_SEARCH_PIPE_MSG_FINISHED) { + evas_object_del(ugd->ug_MainWindow.ug_pNormalPopup); + ugd->ug_MainWindow.ug_pNormalPopup = NULL; + __mf_ug_search_view_result_cb((mf_search_result_t *) pSearchMsg->report_result, data); + } + +MF_CONTINURE_SEARCH: + ecore_idler_add((Ecore_Task_Cb)__mf_ug_search_view_idle_search_msg_cope_finished, NULL); + UG_TRACE_END; +} + +static void __mf_ug_search_view_idle_search_start(void *data) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + + ugNaviBar *pNavi_s = mf_ug_navi_bar_get_in_use_navi(ugd); + ug_mf_retm_if(pNavi_s == NULL, "pNavi_s is NULL"); + char *text = NULL; + + if (ugd->ug_UiGadget.ug_pExtension) + text = g_strdup(ugd->ug_UiGadget.ug_pExtension); + + const char *SearchRoot[MF_SEARCH_ROOT_NUM] = { ugd->ug_Status.ug_pPath->str}; + + /*Start Search routine*/ + if (!mf_ug_search_start(ugd->ug_Status.search_handler, SearchRoot, MF_SEARCH_ROOT_NUM, \ + ((text) ? text : NULL), MF_SEARCH_OPTION_DEF, (void *)ugd)) { + ug_debug("start success"); + /*generate the popup used to show search path + **it's sure that new_desc is not NULL even if original path is NULL*/ + mf_ug_popup_create(ugd, UG_POPMODE_SEARCH, NULL, MF_UG_LABEL_SEARCH, NULL, NULL, NULL, __mf_ug_search_view_stop_cb, ugd); + } else { + ug_debug("start failed"); + } + ug_debug(); + + + if (text != NULL) { + free(text); + text = NULL; + } + +} + +void mf_ug_search_view_enter_search_routine(void *data, Evas_Object * obj, void *event_info) +{ + UG_TRACE_BEGIN; + ugData *ugd = (ugData *)data; + ug_mf_retm_if(ugd == NULL, "ugd is NULL"); + + if (ugd->ug_Status.ug_b_NaviPushFlag) { + UG_TRACE_END; + return; + } + +#ifdef UG_THUMB_REAL_TIME_UPDATE + if (ugd->ug_Status.ug_pThumbUpdateTimer != NULL) { + ecore_timer_del(ugd->ug_Status.ug_pThumbUpdateTimer); + ugd->ug_Status.ug_pThumbUpdateTimer = NULL; + } +#endif + ugd->ug_Status.ug_iMore = UG_MORE_SEARCH; + + if (ugd->ug_Status.search_handler > 0) + mf_ug_search_finalize(&ugd->ug_Status.search_handler); + + int ret = mf_ug_search_init(&ugd->ug_Status.search_handler); + ug_mf_retm_if(ret < 0, "Fail to mf_ug_search_init()"); + + if (ugd->ug_UiGadget.ug_pSyncPipe != NULL) { + ecore_pipe_del(ugd->ug_UiGadget.ug_pSyncPipe); + ugd->ug_UiGadget.ug_pSyncPipe = NULL; + } + ugd->ug_UiGadget.ug_pSyncPipe = ecore_pipe_add(__mf_ug_search_view_pipe_cb, ugd); + + if (ugd->ug_UiGadget.ug_pSyncPipe == NULL) { + ug_debug("add pipe failed"); + } + /*this is to init global variable to ensure the first message can be transmitted correctly*/ + /*flagSearchMsg is to indicate the condition wait to sync data of threads*/ + pthread_mutex_lock(&gLockSearchMsg); + flagSearchMsg = 1; + pthread_mutex_unlock(&gLockSearchMsg); + + /*delete guide text label in the box*/ + /*evas_object_del(elm_object_content_unset(pNavi_s->pNaviConform));*/ + __mf_ug_search_view_idle_search_start(ugd); + + UG_TRACE_END; +} + diff --git a/src/widget/mf-ug-tab-bar.c b/src/widget/mf-ug-tab-bar.c index 26ea0e3..a2390cf 100755..100644 --- a/src/widget/mf-ug-tab-bar.c +++ b/src/widget/mf-ug-tab-bar.c @@ -1,26 +1,30 @@ /*
+ * myfile
+ *
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
- *
- * You may not use this file except in compliance with the License.
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+ *
* http://www.tizenopensource.org/license
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
*
- * See the License for the specific language governing permissions and limitations under the License.
*/
-
#include "mf-ug-winset.h"
#include "mf-ug-util.h"
+#include "mf-ug-fs-util.h"
#include "mf-ug-fm-svc-wrapper.h"
-
+#include "mf-ug-cb.h"
+#include "mf-ug-resource.h"
/******************************
** Prototype : mf_ug_tab_bar_create
@@ -52,7 +56,6 @@ Evas_Object *mf_ug_tab_bar_create(Evas_Object *parent) }
-
/******************************
** Prototype : mf_ug_tab_bar_append_item
** Description : Samsung
@@ -83,7 +86,6 @@ Elm_Object_Item *mf_ug_tab_bar_append_item(Evas_Object *pTabBar, char *pTabIconP }
-
/******************************
** Prototype : mf_ug_tab_bar_set_item_view
** Description : Samsung
@@ -100,9 +102,11 @@ Elm_Object_Item *mf_ug_tab_bar_append_item(Evas_Object *pTabBar, char *pTabIconP ** Modification : Created function
**
******************************/
-void mf_ug_tab_bar_set_item_view(Evas_Object *parent, Evas_Object *tab_layout, Evas_Object *view)
+void mf_ug_tab_bar_set_item_view(Evas_Object *tab_layout, Evas_Object *view)
{
UG_TRACE_BEGIN;
+ ug_mf_retm_if(tab_layout == NULL, "tab_layout is NULL");
+ ug_mf_retm_if(view == NULL, "view is NULL");
Evas_Object *layout = tab_layout;
Evas_Object *unset = elm_object_part_content_get(layout, "elm.swallow.content");
if (unset) {
@@ -114,6 +118,7 @@ void mf_ug_tab_bar_set_item_view(Evas_Object *parent, Evas_Object *tab_layout, E UG_TRACE_END;
}
+
/******************************
** Prototype : mf_ug_tab_bar_remove_item_by_label
** Description : Samsung
@@ -146,7 +151,6 @@ void mf_ug_tab_bar_remove_item_by_label(Evas_Object *pTabBar, char *pTabLabel) UG_TRACE_END;
}
-
/******************************
** Prototype : mf_ug_tab_bar_remove_all_items
** Description : Samsung
@@ -178,6 +182,7 @@ void mf_ug_tab_bar_remove_all_items(Evas_Object *pTabBar) UG_TRACE_END;
}
+
/******************************
** Prototype : mf_ug_tab_bar_set_selected_item
** Description : Samsung
@@ -201,8 +206,6 @@ void mf_ug_tab_bar_set_selected_item(Elm_Object_Item *pItem) }
-
-
/******************************
** Prototype : mf_ug_tab_bar_set_item_disable
** Description : Samsung
@@ -249,3 +252,69 @@ int mf_ug_tab_bar_items_count_get(Evas_Object *pTabBar) return count;
}
+void mf_ug_tar_bar_disable(void *data, Eina_Bool disabled)
+{
+
+ UG_TRACE_BEGIN;
+ ugData *ugd = (ugData *)data;
+ ug_mf_retm_if(ugd == NULL, "ugd is NULL");
+
+ if (mf_ug_fm_svc_wapper_is_root_path(ugd)) {
+ mf_ug_tab_bar_init(ugd);
+ if (ugd->ug_Status.ug_iMmcFlag != MMC_OFF && ugd->ug_MainWindow.ug_pTabBar) {
+ if (disabled) {
+ mf_ug_navi_bar_set_navi_to_main(ugd);
+ } else {
+ mf_ug_navi_bar_reset_tab_to_main(ugd);
+ }
+
+ }
+ }
+ UG_TRACE_END;
+}
+
+Elm_Object_Item *mf_ug_tab_bar_get_item_by_label(Evas_Object *pTabBar, char *pTabLabel)
+{
+ ug_mf_retvm_if(pTabBar == NULL, NULL, "pTabBar is NULL");
+ ug_mf_retvm_if(pTabLabel == NULL, NULL, "pTabLabel is NULL");
+ Elm_Object_Item *pItem = NULL;
+
+ pItem = elm_toolbar_first_item_get(pTabBar);
+ while(pItem) {
+ if (g_strcmp0(pTabLabel, elm_object_item_text_get(pItem)) == 0) {
+ return pItem;
+ }
+ pItem = elm_toolbar_item_next_get(pItem);
+ }
+ return NULL;
+}
+
+void mf_ug_tab_bar_init(void *data)
+{
+ UG_TRACE_BEGIN;
+ ug_mf_retm_if(data == NULL, "data is null");
+ ugData *ugd = (ugData *)data;
+
+ if (ugd->ug_MainWindow.ug_pTabLayout == NULL) {
+ ugd->ug_MainWindow.ug_pTabLayout = mf_ug_main_tab_layout_create(ugd->ug_MainWindow.ug_pWindow);
+ ugd->ug_MainWindow.ug_pTabBackGround = mf_ug_main_create_bg(ugd->ug_MainWindow.ug_pWindow);
+ elm_object_part_content_set(ugd->ug_MainWindow.ug_pTabLayout, "elm.swallow.bg", ugd->ug_MainWindow.ug_pTabBackGround);
+ }
+ if (ugd->ug_MainWindow.ug_pTabBar == NULL) {
+ ugd->ug_MainWindow.ug_pTabBar = mf_ug_tab_bar_create(ugd->ug_MainWindow.ug_pWindow);
+ }
+ ugNaviBar *pNaviBarStruct = NULL;
+
+ pNaviBarStruct = ug_mf_navi_bar_get_navi_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, MF_UG_LABEL_PHONE);
+ if(!mf_ug_tab_bar_get_item_by_label(ugd->ug_MainWindow.ug_pTabBar, pNaviBarStruct->ug_pNaviLabel))
+ mf_ug_tab_bar_append_item(ugd->ug_MainWindow.ug_pTabBar, UG_ICON_PHONE, MF_UG_LABEL_PHONE,
+ ugd);
+
+ pNaviBarStruct = ug_mf_navi_bar_get_navi_from_navilist(ugd->ug_MainWindow.ug_pNaviBarList, MF_UG_LABEL_MMC);
+ if(!mf_ug_tab_bar_get_item_by_label(ugd->ug_MainWindow.ug_pTabBar, MF_UG_LABEL_MMC))
+ mf_ug_tab_bar_append_item(ugd->ug_MainWindow.ug_pTabBar, UG_ICON_MEMORY, MF_UG_LABEL_MMC,
+ ugd);
+
+}
+
+
diff --git a/ug-myfile-efl.xml b/ug-myfile-efl.xml new file mode 100644 index 0000000..2dc047d --- /dev/null +++ b/ug-myfile-efl.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns="http://tizen.org/ns/packages" package="myfile-efl" version="0.1" install-location="internal-only"> + <label>myfile-efl</label> + <author email="gliang.wang@samsung.com" href="www.samsung.com">Guangliang Wang</author> + <description>My Files Application</description> + <ui-application appid="myfile-efl" exec="/opt/ug/bin/myfile-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false"> + <icon>ug-myfile-efl.png</icon> + <label>My Files</label> + <label xml:lang="en-us">My Files</label> + <label xml:lang="nl-nl">My Files</label> + <label xml:lang="de-de">My Files</label> + <label xml:lang="zh-hk">My Files</label> + <label xml:lang="zh-cn">My Files</label> + <label xml:lang="ru-ru">My Files</label> + <label xml:lang="zh-tw">My Files</label> + <label xml:lang="ja-jp">My Files</label> + <label xml:lang="es-es">My Files</label> + <label xml:lang="el-gr">My Files</label> + <label xml:lang="it-it">My Files</label> + <label xml:lang="tr-tr">My Files</label> + <label xml:lang="pt-pt">My Files</label> + <label xml:lang="fr-fr">My Files</label> + <label xml:lang="ko-kr">My Files</label> + <application-service> + <operation name="http://tizen.org/appsvc/operation/pick"/> + </application-service> + </ui-application> +</manifest> diff --git a/ug_navibar_layout.edc b/ug_navibar_layout.edc index 64c0b7d..227bc81 100755..100644 --- a/ug_navibar_layout.edc +++ b/ug_navibar_layout.edc @@ -1,24 +1,3 @@ -/* - * Copyright (c) Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Flora Software License (the "License"). - * - * You may obtain a copy of the License at - * http://www.tizenopensource.org/license - * - * Your use of this source code is conditioned on your acceptance of the - * terms and conditions of the License. - * If you do not agree to the terms and conditions of the License, - * do not use the source code herein. - * - * THIS SOURCE CODE IS LICENSED ONLY UNDER THE TERMS OF THE LICENSE. - * - * THIS SOURCE CODE IS DISTRIBUTED ON AN "AS-IS" BASIS AND "WITH ALL FAULTS", - * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EXPRESS OR IMPLIED. - * - * See the License for specific language governing permissions and limitations. - */ - #define UG_BASIC_W 480 #define UG_BASIC_H 800 @@ -334,114 +313,53 @@ collections name:"upper_folder"; parts { - part - { - name: "upper"; - type: SWALLOW; - mouse_events: 1; - scale: 1; - description { - state: "default" 0.0; - min: UG_MAIN_W GENLIST_ITEM_H; - rel1 - { - relative: 0.0 0.0; - } - rel2 - { - relative: 1.0 1.0; + + part + { + name: "base"; + type: RECT; + repeat_events: 0; + scale: 1; + description { + state: "default" 0.0; + color: 215 225 232 255; } - align: 0.5 0.5; } - } + part { name: "home"; + type: SWALLOW; + description { state: "default" 0.0; + rel1.relative: 0.022 0.157; + rel2.relative: 0.489 0.843; + } + } + part { name: "upper"; + type: SWALLOW; + description { state: "default" 0.0; + rel1.relative: 0.511 0.157; + rel2.relative: 0.978 0.843; + } + } + } } group { name: "pathinfo"; parts { - part - { - name: "base"; - type: RECT; - repeat_events: 0; - scale: 1; - description { - state: "default" 0.0; - min: UG_MAIN_W PATH_INFO_H; - color: PATH_INFO_BG_COLOR; - } - } - part - { - name: "bg"; - type: RECT; - clip_to: "disclip"; - repeat_events: 0; - mouse_events: 0; - description { - state: "default" 0.0; - color: PATH_INFO_BG_COLOR; - } - } - MF_UG_PART_PADDING_TOP(0) - MF_UG_PART_PADDING_BOTTOM( 0 ) - MF_UG_PART_PADDING_LEFT( 10 ) - part - { - name: "bottom_line"; - type: RECT; - mouse_events: 0; - description { state: "default" 0.0; - min: 0 1; - fixed: 0 1; - visible: 1; - color: BOTTOM_LINE_COLOR; - rel1 - { - relative: 0.0 1.0; - offset: 0 -1; - } - } - } - part - { - name: "info"; - clip_to: "disclip"; - type: SWALLOW; - scale: 1; - description { state: "default" 0.0; - min: 0 PATH_INFO_LABEL_H; - max: 0 PATH_INFO_LABEL_H; - fixed: 0 1; - align: 0.0 0.5; - rel1 - { - relative: 1.0 1.0; - offset: 0 0; - to_x: "elm.padding.left"; - to_y: "elm.padding.top"; - } - rel2 - { - relative: 1.0 0.0; - offset: 0 0; - to_x: "elm.padding.left"; - to_y: "elm.padding.bottom"; - } - } - } + part + { + name: "info"; + type: SWALLOW; + repeat_events: 0; + scale: 1; + description { + state: "default" 0.0; + min: 0 PATH_INFO_H; + } + } - part - { - name: "disclip"; - type: RECT; - description - { - state: "default" 0.0; - } - } - } + + } } } |